The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

getenv - get value of an environment variable

 SYNOPSIS



#include <stdlib.h>

char *getenv(const char *name);

 DESCRIPTION

The getenv() function searches the environment list for a string of the form "name=value", and returns a pointer to a string containing the value for the specified name. If the specified name cannot be found, a null pointer is returned. The string pointed to must not be modified by the application, but may be overwritten by a subsequent call to getenv() or putenv() but will not be overwritten by a call to any other function in this document.

This interface need not be reentrant.

 RETURN VALUE

Upon successful completion, getenv() returns a pointer to a string containing the value for the specified name. If the specified name cannot be found a null pointer is returned.

The return value from getenv() may point to static data which may be overwritten by subsequent calls to getenv() or putenv().

 ERRORS

No errors are defined.

 EXAMPLES

None.

 APPLICATION USAGE

None.

 FUTURE DIRECTIONS

None.

 SEE ALSO

exec, putenv(), <stdlib.h>, the XBD specification, Environment Variables .

DERIVATION

Derived from Issue 1 of the SVID.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]