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
11
13 unsetenv — remove an environment variable
14
16 #include <stdlib.h>
17
18 int unsetenv(const char *name);
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 The unsetenv() function shall update the list of pointers to which env‐
30 iron points.
31
32 The unsetenv() function need not be thread-safe.
33
35 Upon successful completion, zero shall be returned. Otherwise, −1 shall
36 be returned, errno set to indicate the error, and the environment shall
37 be unchanged.
38
40 The unsetenv() function shall fail if:
41
42 EINVAL The name argument points to an empty string, or points to a
43 string containing an '=' character.
44
45 The following sections are informative.
46
48 None.
49
51 None.
52
54 Refer to the RATIONALE section in setenv().
55
57 None.
58
60 getenv(), setenv()
61
62 The Base Definitions volume of POSIX.1‐2008, <stdlib.h>, <sys_types.h>
63
65 Portions of this text are reprinted and reproduced in electronic form
66 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
67 -- Portable Operating System Interface (POSIX), The Open Group Base
68 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
69 cal and Electronics Engineers, Inc and The Open Group. (This is
70 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
71 event of any discrepancy between this version and the original IEEE and
72 The Open Group Standard, the original IEEE and The Open Group Standard
73 is the referee document. The original Standard can be obtained online
74 at http://www.unix.org/online.html .
75
76 Any typographical or formatting errors that appear in this page are
77 most likely to have been introduced during the conversion of the source
78 files to man page format. To report such errors, see https://www.ker‐
79 nel.org/doc/man-pages/reporting_bugs.html .
80
81
82
83IEEE/The Open Group 2013 UNSETENV(3P)