1UNSETENV(3P) POSIX Programmer's Manual UNSETENV(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 unsetenv - remove an environment variable
13
15 #include <stdlib.h>
16
17 int unsetenv(const char *name);
18
19
21 The unsetenv() function shall remove an environment variable from the
22 environment of the calling process. The name argument points to a
23 string, which is the name of the variable to be removed. The named
24 argument shall not contain an '=' character. If the named variable does
25 not exist in the current environment, the environment shall be
26 unchanged and the function is considered to have completed successâ
27 fully.
28
29 If the application modifies environ or the pointers to which it points,
30 the behavior of unsetenv() is undefined. The unsetenv() function shall
31 update the list of pointers to which environ points.
32
33 The unsetenv() function need not be reentrant. A function that is not
34 required to be reentrant is not required to be thread-safe.
35
37 Upon successful completion, zero shall be returned. Otherwise, -1 shall
38 be returned, errno set to indicate the error, and the environment shall
39 be unchanged.
40
42 The unsetenv() function shall fail if:
43
44 EINVAL The name argument is a null pointer, points to an empty string,
45 or points to a string containing an '=' character.
46
47
48 The following sections are informative.
49
51 None.
52
54 None.
55
57 Refer to the RATIONALE section in setenv().
58
60 None.
61
63 getenv(), setenv(), the Base Definitions volume of
64 IEEE Std 1003.1-2001, <stdlib.h>, <sys/types.h>, <unistd.h>
65
67 Portions of this text are reprinted and reproduced in electronic form
68 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
69 -- Portable Operating System Interface (POSIX), The Open Group Base
70 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
71 Electrical and Electronics Engineers, Inc and The Open Group. In the
72 event of any discrepancy between this version and the original IEEE and
73 The Open Group Standard, the original IEEE and The Open Group Standard
74 is the referee document. The original Standard can be obtained online
75 at http://www.opengroup.org/unix/online.html .
76
77
78
79IEEE/The Open Group 2003 UNSETENV(3P)