Index of Section 3 Manual Pages
| Interix / SUA | unsetenv.3 | Interix / SUA |
unsetenv(3) unsetenv(3)
getenv()
NAME
getenv(), putenv(), setenv(), unsetenv() - environment variable functions
SYNOPSIS
#include
char * getenv (const char *name)
int putenv (char *string)
int setenv (const char *name, const char *value, int overwrite)
int unsetenv (const char *name)
DESCRIPTION
These functions set, fetch, and remove environment variables from the host
environment list.
The getenv(3) function obtains the current value of the environment
variable, name. If the variable name is not in the current environment, a
null pointer is returned.
The putenv(3) function inserts or resets an environment variable in the
current environment list. The form of the argument string is name=value.
If the environment variable name does not exist in the list, it is
inserted with the given value. If it does exist, its value is replaced.
The setenv(3) function inserts or resets the environment variable name in
the current environment list. If the variable name does not exist in the
list, it is inserted with the given value. If the variable does exist, the
argument overwrite is tested; if overwrite is zero, the variable is not
reset; otherwise, it is reset to the given value.
The unsetenv(3) function removes the environment variable name from the
current environment list. It is not an error if the named variable does
not exist in the current environment.
RETURN VALUES
The putenv(3), setenv(3), and unsetenv(3) functions return zero if
successful; otherwise the global variable errno is set to indicate the
error and a -1 is returned.
ERRORS
[EINVAL]
The name argument is a null pointer, points to an empty string, or
points to a string containing an equal sign (=) character.
[ENOMEM]
The putenv(3) and setenv(3) functions were unable to allocate memory
for the environment.
SEE ALSO
sh(1)
exec(2)
USAGE NOTES
None of these functions are thread safe.
None of these functions are async-signal safe.