]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/clearenv.3
Fix redundant formatting macros
[thirdparty/man-pages.git] / man3 / clearenv.3
CommitLineData
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.
c13182ef 11.\"
fea681da
MK
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.
c13182ef 19.\"
fea681da
MK
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.
cc4615cc 24.TH CLEARENV 3 2007-07-26 "Linux" "Linux Programmer's Manual"
fea681da
MK
25.SH NAME
26clearenv \- clear the environment
27.SH SYNOPSIS
28.nf
29.B #include <stdlib.h>
30.sp
0daa9e92 31.B "int clearenv(void);"
fea681da 32.fi
cc4615cc
MK
33.sp
34.in -4n
35Feature Test Macro Requirements for glibc (see
36.BR feature_test_macros (7)):
37.in
38.sp
39.BR clearenv ():
40_SVID_SOURCE || _XOPEN_SOURCE
fea681da 41.SH DESCRIPTION
60a90ecd
MK
42The
43.BR clearenv ()
44function clears the environment of all name-value
fea681da
MK
45pairs and sets the value of the external variable
46.I environ
47to NULL.
fea681da 48.SH "RETURN VALUE"
60a90ecd
MK
49The
50.BR clearenv ()
51function returns zero on success, and a non-zero
fea681da
MK
52value on failure.
53.\" Most versions of Unix return -1 on error, or do not even have errors.
f59a3f19 54.\" Glibc info and the Watcom C library document "a non-zero value".
a759cc87 55.SH VERSIONS
c13182ef
MK
56Not in libc4, libc5.
57In glibc since glibc 2.0.
fea681da 58.SH "CONFORMING TO"
e45a6aea 59Various Unix variants (DG/UX, HP-UX, QNX, ...).
fea681da 60POSIX.9 (bindings for FORTRAN77).
60a90ecd
MK
61POSIX.1-1996 did not accept
62.BR clearenv ()
d9c1ae64
MK
63and
64.BR putenv (3),
fea681da 65but changed its mind and scheduled these functions for some
c13182ef 66later issue of this standard (cf. B.4.6.1).
68e1685c 67However, POSIX.1-2001
d9c1ae64 68only adds
988db661 69.BR putenv (3),
d9c1ae64 70and rejected
60a90ecd 71.BR clearenv ().
fea681da 72.SH NOTES
c13182ef
MK
73Used in security-conscious applications.
74If it is unavailable
fea681da
MK
75the assignment
76.RS
77.nf
7295b7ed 78 environ = NULL;
fea681da
MK
79.fi
80.RE
81will probably do.
82.LP
aa496226 83The DG/UX and Tru64 man pages write: If
fea681da
MK
84.I environ
85has been modified by anything other than the
fb186734
MK
86.BR putenv (3),
87.BR getenv (3),
fea681da 88or
31e9a9ec 89.BR clearenv ()
fea681da 90functions, then
63aa9df0 91.BR clearenv ()
fea681da
MK
92will return an error and the process environment will remain unchanged.
93.\" .LP
68e1685c 94.\" HP-UX has a ENOMEM error return.
fea681da
MK
95.SH "SEE ALSO"
96.BR getenv (3),
97.BR putenv (3),
98.BR setenv (3),
99.BR unsetenv (3),
aa949e2d 100.BR environ (7)