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

s
setenv(3C) setenv(3C)
setenv("NEWHOME","/tmp/HOME",1);
The following code updates the variable HOME.
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.
Users of setenv() and unsetenv() should note that the libcext library will not be available in
future releases of HP-UX. However these functions will be available as part of the C library libc
.
AUTHOR
setenv() and unsetenv() were developed by HP.
SEE ALSO
exec(2), getenv(3C), malloc(3C), putenv(3C), environ(5), thread_safety(5).
HP-UX 11i Version 2: December 2007 Update − 2 − Hewlett-Packard Company 399