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
20 The unsetenv() function shall remove an environment variable from the
21 environment of the calling process. The name argument points to a
22 string, which is the name of the variable to be removed. The named
23 argument shall not contain an '=' character. If the named variable does
24 not exist in the current environment, the environment shall be
25 unchanged and the function is considered to have completed success‐
26 fully.
27
28 The unsetenv() function shall update the list of pointers to which env‐
29 iron points.
30
31 The unsetenv() function need not be thread-safe.
32
34 Upon successful completion, zero shall be returned. Otherwise, -1 shall
35 be returned, errno set to indicate the error, and the environment shall
36 be unchanged.
37
39 The unsetenv() function shall fail if:
40
41 EINVAL The name argument points to an empty string, or points to a
42 string containing an '=' character.
43
44 The following sections are informative.
45
47 None.
48
50 None.
51
53 Refer to the RATIONALE section in setenv().
54
56 None.
57
59 getenv(), setenv()
60
61 The Base Definitions volume of POSIX.1‐2017, <stdlib.h>, <sys_types.h>
62
64 Portions of this text are reprinted and reproduced in electronic form
65 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
66 table Operating System Interface (POSIX), The Open Group Base Specifi‐
67 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
68 Electrical and Electronics Engineers, Inc and The Open Group. In the
69 event of any discrepancy between this version and the original IEEE and
70 The Open Group Standard, the original IEEE and The Open Group Standard
71 is the referee document. The original Standard can be obtained online
72 at http://www.opengroup.org/unix/online.html .
73
74 Any typographical or formatting errors that appear in this page are
75 most likely to have been introduced during the conversion of the source
76 files to man page format. To report such errors, see https://www.ker‐
77 nel.org/doc/man-pages/reporting_bugs.html .
78
79
80
81IEEE/The Open Group 2017 UNSETENV(3P)