getenv(3C)
_________________________________________________________________
getenv function
Return a pointer to environment variables.
_________________________________________________________________
Calling Sequence
char *name, *value, *getenv();
value = getenv(name);
where name is a byte pointer to a null-terminated string
containing the environment variable to search for.
Description
The getenv function gets a pointer to environment variables that
are passed with the functions execle and execve. These functions
either initiate a child process (if the vfork routine is called
first), or kill the current process to chain to a new process.
The environment is always passed from parent to child process.
Returns
The getenv function returns a null pointer if it does not find
the variable. Otherwise, it returns a byte pointer to a null-
terminated string holding the environment value.
Related Functions
See also the exec functions described in Chapter 2 of Using
Specialized C Functions, and the main function, described in this
chapter.
Example
This example prints out the user's name.
main() {
char *getenv();
printf("Your user name is:\n");
printf("%s\n", getenv("LOGNAME"));
}
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)