HP C/iX Library Reference Manual (30026-90004)

198 Chapter5
HP C/iX Library Function Descriptions
getenv
getenv
Returns the value of an environment variable.
Syntax
#include <stdlib.h>
char *getenv (const char *
name
);
Parameters
name
The string to search. The string may be either the desired name,
null-terminated, or of the form
name=value
, in which case getenv() uses
the portion to the left of the = as the search key.
Return Values
x A pointer to a string associated with the environment variable pointed to
by
name
.
NULL The value pointed to by
name
was not found in the environment list.
Description
The getenv function searches the environment list for a string that matches the string
pointed to by
name
, and returns a pointer to the value in the current environment if such a
string is present. If the string is not present, getenv() returns a null pointer.
The environment list consists of JCW variables and MPE/iX variables. Refer to the
MPE/iX Commands Reference Manual for more information on MPE/iX variables.
NOTE
If linking with the POSIX/iX library, refer to the description of getenv()
located in the MPE/iX Developer's Kit Reference Manual.
See Also
ANSI C 4.10.4.4