ApVSys : Application Versioning System

      Copyright (C) 2002 Arnaud BERTRAND
      web-site: http://www.apvsys.org


The ap-environment file is a kind of setup script executed before each command related to a tool or version of a tool. This file can be written in C, perl, sh, csh, bash, ksh or tcsh and must be located in the root directory of the tool/version: $APVSYS_ROOT/OsName/vOsVersion/ToolName/vToolVersion/ap-environment.xx

Warning: The extension of ap-environment.xx determines which interpreter will start according to the following list.

 so   -> C compiled code
 pl   -> perl
 sh   -> sh
 csh  -> csh
 bash -> bash
 ksh  -> ksh
 tcsh -> tcsh

The priority order is the order above with .so having greatest priority but it would be very strange to require 2 ap-environment.xx files for the same version of a tool!

Some variables and functions are available for use in these scripts:

Predefined environment variables:

Predifined functions:

of course, the syntax of these commands depends on the language used. Please read the syntax section.

The syntax

To show the syntax, an example will be shown for each language:

C-mode : ap-environment.so

This file is the only one which has to be compiled. It comes from ap-environment.c and must contains the function int apenvironment(int argc, char** argv). This functions must return 1 if successful. To compile ap-environment.c, the script apv-envCompile MUST be used. Here is an example:

 int apenvironment(int argc, char **argv) {
   printf("--- C environment setting ---\n");
   set_env("APVEXAMPLE","C tested");
   append_env("APVAPPEND", "second:set");
   prepend_env("APVPREPEND", "second:set");
   printf("--- END C environment setting ---\n");
   return 1;

IMPORTANT NOTE: loadenv must contains 4 arguments and the last two arguments are argc, argv.

Perl-mode : ap-environment.pl

 print "--- perl environment setting ---\n";
 &loadenv("apv-child2", "v2.0");
 $ENV{APVEXAMPLE}="perl tested";
 &append_env("APVAPPEND", "second:set");
 &prepend_env("APVPREPEND", "second:set");
 print "--- END perl environment setting ---\n";

sh-mode : ap-environment.sh ( same syntax for .bash and .ksh )

 echo "--- sh environment setting ---"
 loadenv "apv-child1"
 loadenv "apv-child2" "v2.0"
 APVEXAMPLE="sh tested"
 APVUNIQ=`uniquify_env "sh:sha:shb:sha:sha:sh:shc"`
 append_env APVAPPEND "second:set"
 prepend_env APVPREPEND "second:set"
 export APVUNIQ
 echo "--- END sh environment setting ---"

csh-mode : ap-environment.csh ( same syntax for .tcsh )

 echo "--- csh environment setting ---"
 loadenv "apv-child1"
 loadenv "apv-child2" "v2.0"
 setenv APVEXAMPLE "csh tested"
 setenv APVUNIQ `uniquify_env "csh:csha:cshb:csha:csha:csh:cshc"`
 setenv APVAPPEND "first:set"
 setenv APVPREPEND "first:set"
 append_env APVAPPEND "second:set"
 prepend_env APVPREPEND "second:set"
 echo "--- END csh environment setting ---"


apvsys-intro(1) ap-environment(1) apv(1) apv-linktool(1) apv-regtool(1) apv-setdefault(1) apv-osmirror(1) apv-nativeoscheck(1) apv-dbcheck(1) apv-lib(1) apv-xcheck(1)