[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    getenv(3C) manual page Table of Contents

Name

getenv - return value for environment name

Synopsis

#include <stdlib.h>

char *getenv(const char *name);

MT-Level

Safe

Description

getenv() searches the environment list (see environ(5) ) for a string of the form name=value and, if the string is present, returns a pointer to the value in the current environment.

Return Values

If successful, getenv() returns a pointer to the value in the current environment; otherwise, it returns a null pointer.

See Also

exec(2) , putenv(3C) , environ(5)

Notes

getenv() can be safely called from a multi-thread program. However, care must still be taken when using getenv() and putenv(3C) in a multi-thread program. These routines examine and modify the environment list. This list is shared by all threads in a program. The system prevents the list from being accessed simultaneously by two different threads. However, it does not prevent two threads from successively accessing the environment list using getenv() or putenv(3C) .


Table of Contents