]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright 2001 John Levon <moz@compsoc.man.ac.uk> |
2 | .\" | |
3 | .\" Permission is granted to make and distribute verbatim copies of this | |
4 | .\" manual provided the copyright notice and this permission notice are | |
5 | .\" preserved on all copies. | |
6 | .\" | |
7 | .\" Permission is granted to copy and distribute modified versions of this | |
8 | .\" manual under the conditions for verbatim copying, provided that the | |
9 | .\" entire resulting derived work is distributed under the terms of a | |
10 | .\" permission notice identical to this one. | |
11 | .\" | |
12 | .\" Since the Linux kernel and libraries are constantly changing, this | |
13 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
14 | .\" responsibility for errors or omissions, or for damages resulting from | |
15 | .\" the use of the information contained herein. The author(s) may not | |
16 | .\" have taken the same level of care in the production of this manual, | |
17 | .\" which is licensed free of charge, as they might when working | |
18 | .\" professionally. | |
19 | .\" | |
20 | .\" Formatted or processed versions of this manual, if unaccompanied by | |
21 | .\" the source, must acknowledge the copyright and authors of this work. | |
22 | .\" | |
23 | .\" Additions, aeb, 2001-10-17. | |
24 | .TH CLEARENV 3 2001-10-17 "Linux Programmer's Manual" | |
25 | .SH NAME | |
26 | clearenv \- clear the environment | |
27 | .SH SYNOPSIS | |
28 | .nf | |
29 | .B #include <stdlib.h> | |
30 | .sp | |
31 | .BI "int clearenv(void);" | |
32 | .fi | |
33 | .SH DESCRIPTION | |
63aa9df0 | 34 | The \fBclearenv\fP() function clears the environment of all name-value |
fea681da MK |
35 | pairs and sets the value of the external variable |
36 | .I environ | |
37 | to NULL. | |
fea681da | 38 | .SH "RETURN VALUE" |
63aa9df0 | 39 | The \fBclearenv\fP() function returns zero on success, and a non-zero |
fea681da MK |
40 | value on failure. |
41 | .\" Most versions of Unix return -1 on error, or do not even have errors. | |
f59a3f19 | 42 | .\" Glibc info and the Watcom C library document "a non-zero value". |
fea681da MK |
43 | .SH AVAILABILITY |
44 | Not in libc4, libc5. In glibc since glibc 2.0. | |
fea681da | 45 | .SH "CONFORMING TO" |
e45a6aea | 46 | Various Unix variants (DG/UX, HP-UX, QNX, ...). |
fea681da | 47 | POSIX.9 (bindings for FORTRAN77). |
63aa9df0 | 48 | POSIX.1-1996 did not accept \fBclearenv\fP() and \fIputenv\fP(), |
fea681da | 49 | but changed its mind and scheduled these functions for some |
68e1685c MK |
50 | later issue of this standard (cf. B.4.6.1). |
51 | However, POSIX.1-2001 | |
63aa9df0 | 52 | only adds \fIputenv\fP(), and rejected \fBclearenv\fP(). |
fea681da MK |
53 | .SH NOTES |
54 | Used in security-conscious applications. If it is unavailable | |
55 | the assignment | |
56 | .RS | |
57 | .nf | |
58 | environ = NULL; | |
59 | .fi | |
60 | .RE | |
61 | will probably do. | |
62 | .LP | |
e45a6aea | 63 | The DG/UX and Tru64 manpages write: If |
fea681da MK |
64 | .I environ |
65 | has been modified by anything other than the | |
31e9a9ec MK |
66 | .BR putenv (), |
67 | .BR getenv (), | |
fea681da | 68 | or |
31e9a9ec | 69 | .BR clearenv () |
fea681da | 70 | functions, then |
63aa9df0 | 71 | .BR clearenv () |
fea681da MK |
72 | will return an error and the process environment will remain unchanged. |
73 | .\" .LP | |
68e1685c | 74 | .\" HP-UX has a ENOMEM error return. |
fea681da MK |
75 | .SH "SEE ALSO" |
76 | .BR getenv (3), | |
77 | .BR putenv (3), | |
78 | .BR setenv (3), | |
79 | .BR unsetenv (3), | |
aa949e2d | 80 | .BR environ (7) |