1SETENV(3)                  Linux Programmer's Manual                 SETENV(3)
2
3
4

NAME

6       setenv - change or add an environment variable
7

SYNOPSIS

9       #include <stdlib.h>
10
11       int setenv(const char *name, const char *value, int overwrite);
12
13       int unsetenv(const char *name);
14

DESCRIPTION

16       The  setenv()  function  adds the variable name to the environment with
17       the value value, if name does not already exist.  If name does exist in
18       the  environment,  then  its  value is changed to value if overwrite is
19       non-zero; if overwrite is zero, then the value of name is not changed.
20
21       The unsetenv() function deletes the variable name from the environment.
22

RETURN VALUE

24       The setenv() function returns zero on  success,  or  -1  if  there  was
25       insufficient space in the environment.  The unsetenv() function returns
26       zero on success, or -1 on error, with errno set to indicate  the  cause
27       of the error.
28

ERRORS

30       EINVAL name contained an '=' character.
31

CONFORMING TO

33       4.3BSD, POSIX.1-2001.
34

NOTES

36       Prior to glibc 2.2.2, unsetenv() was prototyped as returning void; more
37       recent glibc versions follow the POSIX.1-2001-compliant prototype shown
38       in the SYNOPSIS.
39

BUGS

41       POSIX.1-2001  specifies  that  if  name contains an '=' character, then
42       setenv() should fail with the error EINVAL; however, versions of  glibc
43       before 2.3.4 allowed an '=' sign in name.
44

SEE ALSO

46       clearenv(3), getenv(3), putenv(3), environ(7)
47
48
49
50BSD                               2004-05-09                         SETENV(3)
Impressum