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