tuxreadenv
-add variables to the environment from a file
#include <atmi.h>
int tuxreadenv(char *file, char *label)
tuxreadenv
reads a file containing environment variables and adds them to the environment, independent of platform. These variables are available using tuxgetenv
(3) and can be reset using tuxputenv
(3).
The format of the environment file is as follows.
or
where variable
=
value
set
variable
=
value
variable
must begin with an alphabetic or underscore character and contain only alphanumeric or underscore characters, and value
may contain any character except newline.
value
, strings of the form ${env
} are expanded using variables already in the environment (forward referencing is not supported and if a value is not set, the variable is replaced with the empty string). Backslash (\) may be used to escape the dollar sign and itself. All other shell quoting and escape mechanisms are ignored and the expanded value
is placed into the environment.
where [
label
]
label
follows the same rules for variable
above (lines with invalid label
values are ignored).
If If An error message is printed to the Here is an example environment file.
In the DOS, Windows, OS/2, and NetWare environments, file
is NULL, then a default file name is used. The fixed file names are as follows:
DOS, Windows, OS2, NT: C:\TUXEDO\TUXEDO.ENV
or
MAC: TUXEDO.ENV in the system preferences directory
NETWARE: SYS:SYSTEM\TUXEDO.ENV
POSIX: /usr/tuxedo/TUXEDO.ENV /var/opt/tuxedo/TUXEDO.ENV
label
is NULL, then only variables in the global section are put into the environment. For other values of label
, the global section variables plus any variables in a section matching the label
are put into the environment.
userlog
() if there is a memory failure, if a non-null file name does not exist, or if a non-null label does not exist.
Example
TUXDIR=/usr/tuxedo
[application1]
;this is a comment
/* this is a comment */
#this is a comment
//this is a comment
FIELDTBLS=app1_flds
FLDTBLDIR=/usr/app1/udataobj
[application2]
FIELDTBLS=app2_flds
FLDTBLDIR=/usr/app2/udataobj Return Values
tuxreadenv
() returns non-zero if it was unable to obtain enough space via malloc
for an expanded environment or was unable to open and read a non-NULL filename, otherwise zero.
Portability
tuxreadenv
() converts all environment variable names to upper case.
See Also
tuxgetenv
(3), tuxputenv
(3)