]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/clearenv.3
s/manpage/man page/
[thirdparty/man-pages.git] / man3 / clearenv.3
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" "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
34 The
35 .BR clearenv ()
36 function clears the environment of all name-value
37 pairs and sets the value of the external variable
38 .I environ
39 to NULL.
40 .SH "RETURN VALUE"
41 The
42 .BR clearenv ()
43 function returns zero on success, and a non-zero
44 value on failure.
45 .\" Most versions of Unix return -1 on error, or do not even have errors.
46 .\" Glibc info and the Watcom C library document "a non-zero value".
47 .SH VERSIONS
48 Not in libc4, libc5.
49 In glibc since glibc 2.0.
50 .SH "CONFORMING TO"
51 Various Unix variants (DG/UX, HP-UX, QNX, ...).
52 POSIX.9 (bindings for FORTRAN77).
53 POSIX.1-1996 did not accept
54 .BR clearenv ()
55 and
56 .BR putenv (3),
57 but changed its mind and scheduled these functions for some
58 later issue of this standard (cf. B.4.6.1).
59 However, POSIX.1-2001
60 only adds
61 .BR putenv (3),
62 and rejected
63 .BR clearenv ().
64 .SH NOTES
65 Used in security-conscious applications.
66 If it is unavailable
67 the assignment
68 .RS
69 .nf
70 environ = NULL;
71 .fi
72 .RE
73 will probably do.
74 .LP
75 The DG/UX and Tru64 man pages write: If
76 .I environ
77 has been modified by anything other than the
78 .BR putenv (3),
79 .BR getenv (3),
80 or
81 .BR clearenv ()
82 functions, then
83 .BR clearenv ()
84 will return an error and the process environment will remain unchanged.
85 .\" .LP
86 .\" HP-UX has a ENOMEM error return.
87 .SH "SEE ALSO"
88 .BR getenv (3),
89 .BR putenv (3),
90 .BR setenv (3),
91 .BR unsetenv (3),
92 .BR environ (7)