1CLEARENV(3) Library Functions Manual CLEARENV(3)
2
3
4
6 clearenv - clear the environment
7
9 #include <stdlib.h>
10
11 int clearenv(void);
12
14 The clearenv() function clears the environment of all name-value pairs
15 and sets the value of the external variable environ to NULL.
16
17
19 The clearenv() function returns zero on success, and a non-zero value
20 on failure.
21
22
24 Not in libc4, libc5. In glibc since glibc 2.0.
25
26
28 Various Unix variants (DG/UX, HP-UX, QNX, ...). POSIX.9 (bindings for
29 FORTRAN77). POSIX.1-1996 did not accept clearenv() and putenv(), but
30 changed its mind and scheduled these functions for some later issue of
31 this standard (cf. B.4.6.1). However, POSIX.1-2001 only adds putenv(),
32 and rejected clearenv().
33
34
36 Used in security-conscious applications. If it is unavailable the
37 assignment
38 environ = NULL;
39 will probably do.
40
41 The DG/UX and Tru64 manpages write: If environ has been modified by
42 anything other than the putenv(), getenv(), or clearenv() functions,
43 then clearenv() will return an error and the process environment will
44 remain unchanged.
45
47 getenv(3), putenv(3), setenv(3), unsetenv(3), environ(7)
48
49
50
51Linux Programmer's Manual 2001-10-17 CLEARENV(3)