HP-UX Reference (11i v3 07/02) - 3 Library Functions N-Z (vol 7)

s
setenv(3C) setenv(3C)
const char *envname="HOME";
const char *envval="/tmp/home";
setenv(envname,envval,1);
The following code removes the variable NEWHOME from the current environment.
unsetenv("NEWHOME");
WARNINGS
The setenv() and unsetenv() functions manipulate the environment pointed to by environ, and can
be used in conjunction with
getenv(). However, envp (the third argument to main) is not changed.
The
setenv() uses malloc() to enlarge the environment (see malloc(3C)).
After the
setenv() or unsetenv() function is called, environment variables may not be in alphabeti-
cal order.
AUTHOR
setenv() and unsetenv() were developed by HP.
SEE ALSO
exec(2), getenv(3C), malloc(3C), putenv(3C), environ(5), thread_safety(5).
STANDARDS CONFORMANCE
setenv(): UNIX 03
unsetenv() : UNIX 03
HP-UX 11i Version 3: February 2007 2 Hewlett-Packard Company 393