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

NAME

6       clearenv - clear the environment
7

SYNOPSIS

9       #include <stdlib.h>
10
11       int clearenv(void);
12
13   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15       clearenv(): _SVID_SOURCE || _XOPEN_SOURCE
16

DESCRIPTION

18       The  clearenv() function clears the environment of all name-value pairs
19       and sets the value of the external variable environ to NULL.
20

RETURN VALUE

22       The clearenv() function returns zero on success, and a  non-zero  value
23       on failure.
24

VERSIONS

26       Not in libc4, libc5.  In glibc since glibc 2.0.
27

CONFORMING TO

29       Various  Unix variants (DG/UX, HP-UX, QNX, ...).  POSIX.9 (bindings for
30       FORTRAN77).  POSIX.1-1996 did not accept clearenv() and putenv(3),  but
31       changed  its mind and scheduled these functions for some later issue of
32       this  standard  (cf.  B.4.6.1).   However,   POSIX.1-2001   only   adds
33       putenv(3), and rejected clearenv().
34

NOTES

36       Used  in  security-conscious  applications.   If  it is unavailable the
37       assignment
38
39           environ = NULL;
40
41       will probably do.
42
43       The DG/UX and Tru64 man pages write: If environ has  been  modified  by
44       anything  other than the putenv(3), getenv(3), or clearenv() functions,
45       then clearenv() will return an error and the process  environment  will
46       remain unchanged.
47

SEE ALSO

49       getenv(3), putenv(3), setenv(3), unsetenv(3), environ(7)
50

COLOPHON

52       This  page  is  part of release 3.22 of the Linux man-pages project.  A
53       description of the project, and information about reporting  bugs,  can
54       be found at http://www.kernel.org/doc/man-pages/.
55
56
57
58Linux                             2007-07-26                       CLEARENV(3)
Impressum