1unsetenv(3C) Standard C Library Functions unsetenv(3C)
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 removes an environment variable from the envi‐
16 ronment of the calling process. The name argument points to a string
17 that is the name of the variable to be removed. The named argument can‐
18 not contain an '=' character. If the named variable does not exist in
19 the current environment, the environment is unchanged and the function
20 is considered to have completed successfully.
21
22
23 If the application modifies environ or the pointers to which it points,
24 the behavior of unsetenv() is undefined. The unsetenv() function
25 updates the list of pointers to which environ points.
26
28 Upon successful completion, 0 is returned. Otherwise, -1 is returned,
29 errno set to indicate the error, and the environment is left unchanged.
30
32 The unsetenv() function will fail if:
33
34 EINVAL The name argument is a null pointer, points to an empty
35 string, or points to a string containing an '=' character.
36
37
39 See attributes(5) for descriptions of the following attributes:
40
41
42
43
44 ┌─────────────────────────────┬─────────────────────────────┐
45 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
46 ├─────────────────────────────┼─────────────────────────────┤
47 │Interface Stability │Standard │
48 ├─────────────────────────────┼─────────────────────────────┤
49 │MT-Level │MT-Safe │
50 └─────────────────────────────┴─────────────────────────────┘
51
53 getenv(3C), setenv(3C), attributes(5), standards(5)
54
55
56
57SunOS 5.11 1 Nov 2003 unsetenv(3C)