OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man3 / clearenv.3
1 .\" Copyright 2001 John Levon <moz@compsoc.man.ac.uk>
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" Additions, aeb, 2001-10-17.
26 .TH CLEARENV 3  2014-08-19 "Linux" "Linux Programmer's Manual"
27 .SH NAME
28 clearenv \- clear the environment
29 .SH SYNOPSIS
30 .nf
31 .B #include <stdlib.h>
32 .sp
33 .B "int clearenv(void);"
34 .fi
35 .sp
36 .in -4n
37 Feature Test Macro Requirements for glibc (see
38 .BR feature_test_macros (7)):
39 .in
40 .sp
41 .BR clearenv ():
42 _SVID_SOURCE || _BSD_SOURCE
43 .SH DESCRIPTION
44 The
45 .BR clearenv ()
46 function clears the environment of all name-value
47 pairs and sets the value of the external variable
48 .I environ
49 to NULL.
50 .SH RETURN VALUE
51 The
52 .BR clearenv ()
53 function returns zero on success, and a nonzero
54 value on failure.
55 .\" Most versions of UNIX return -1 on error, or do not even have errors.
56 .\" Glibc info and the Watcom C library document "a nonzero value".
57 .SH VERSIONS
58 Available since glibc 2.0.
59 .SH CONFORMING TO
60 Various UNIX variants (DG/UX, HP-UX, QNX, ...).
61 POSIX.9 (bindings for FORTRAN77).
62 POSIX.1-1996 did not accept
63 .BR clearenv ()
64 and
65 .BR putenv (3),
66 but changed its mind and scheduled these functions for some
67 later issue of this standard (cf. B.4.6.1).
68 However, POSIX.1-2001
69 adds only
70 .BR putenv (3),
71 and rejected
72 .BR clearenv ().
73 .SH NOTES
74 Used in security-conscious applications.
75 If it is unavailable
76 the assignment
77 .nf
78
79     environ = NULL;
80
81 .fi
82 will probably do.
83 .LP
84 The DG/UX and Tru64 man pages write: If
85 .I environ
86 has been modified by anything other than the
87 .BR putenv (3),
88 .BR getenv (3),
89 or
90 .BR clearenv ()
91 functions, then
92 .BR clearenv ()
93 will return an error and the process environment will remain unchanged.
94 .\" .LP
95 .\" HP-UX has a ENOMEM error return.
96 .SH SEE ALSO
97 .BR getenv (3),
98 .BR putenv (3),
99 .BR setenv (3),
100 .BR unsetenv (3),
101 .BR environ (7)
102 .SH COLOPHON
103 This page is part of release 3.79 of the Linux
104 .I man-pages
105 project.
106 A description of the project,
107 information about reporting bugs,
108 and the latest version of this page,
109 can be found at
110 \%http://www.kernel.org/doc/man\-pages/.