## getenv

#### OS/161 Reference Manual

### Name

getenv - retrieve an environment variable

### Library

Standard C Library (libc, -lc)

### Synopsis

`#include <stdlib.h>`
`char *`
`getenv(const char *`variable`);`

### Description

`getenv` retrieves the value of the environment variable variable from the current process environment. Unless you implement `execve` and environment variable passing, the environment used is a default environment compiled into libc.

### Return Values

On success, `getenv` returns a pointer to the value of the requested variable. This pointer points to internal storage and the contents should not be modified. The contents will in turn be stable until/unless the process environment is modified. If the requested variable is not found, `getenv` returns `NULL`.

### See Also

execvp