C/C++ Programmer's Guide (G06.27+, H06.08+, J06.03+)

env
is the environment array. Each element (except for the last) points to a null-terminated string
containing the name and value of one environment parameter. The last element has the pointer
value NULL.
When declaring parameters to the function main(), note:
The parameters to main() are optional; you can declare no parameters, just argc and argv,
or all three parameters. You cannot declare env alone.
The identifiers argc, argv, and env are simply the traditional names of three parameters to
main(); you can use identifiers of your own choosing.
The elements of the environment array env point to strings of the form:
"param-name=param-value"
where param-name is the name of the environment parameter and param-value is its
value.
The putenv() function sets the value of a parameter in the environment array, and the
getenv() function retrieves the value of a parameter in the environment array.
Use env and putenv() with caution, however. The environment parameter of main() is not
updated when the environment array is enlarged or moved. Therefore, using the env parameter
after invoking putenv() might result in inaccurate results. If you need to modify and examine the
environment array, you should use the extermal variable environ, which always has the correct
value.
Retrieving Startup Information
The Guardian C run-time library includes six functions that allow the retrieval of the process startup
message, the PARAM message, and the ASSIGN messages. You can call these functions only from
Guardian processes. These functions are listed in Table 53. For a detailed description of each
function, see the Guardian TNS C Library Calls Reference Manual or the Guardian Native C
Library Calls Reference Manual.
Table 53 C Functions That Retrieve Process Startup Information
ActionFunction
Retrieves a specified ASSIGN message.get_assign_msg()
Retrieves the ASSIGN message that corresponds to the logical-unit
name requested.
get_assign_msg_by_name()
Determines how many ASSIGN messages are assigned to a
particular process.
get_max_assign_msg_ordinal()
Retrieves the value of the parameter that corresponds to the
parameter name requested.
get_param_by_name()
Retrieves the PARAM message.get_param_msg()
Retrieves the process startup message.get_startup_msg()
Program Termination
The program termination phase of execution begins when your process returns from the function
main() or calls the exit() or terminate_program() library function. In either case, these
occurs:
All file buffers are flushed.
All open files are closed.
322 Running and Debugging C and C++ Programs