diff options
Diffstat (limited to 'src/lib/libc/stdlib/getenv.3')
-rw-r--r-- | src/lib/libc/stdlib/getenv.3 | 66 |
1 files changed, 30 insertions, 36 deletions
diff --git a/src/lib/libc/stdlib/getenv.3 b/src/lib/libc/stdlib/getenv.3 index 411eb35da4..b2aa0080d6 100644 --- a/src/lib/libc/stdlib/getenv.3 +++ b/src/lib/libc/stdlib/getenv.3 | |||
@@ -1,5 +1,5 @@ | |||
1 | .\" Copyright (c) 1988, 1991 The Regents of the University of California. | 1 | .\" Copyright (c) 1988, 1991, 1993 |
2 | .\" All rights reserved. | 2 | .\" The Regents of the University of California. All rights reserved. |
3 | .\" | 3 | .\" |
4 | .\" This code is derived from software contributed to Berkeley by | 4 | .\" This code is derived from software contributed to Berkeley by |
5 | .\" the American National Standards Committee X3, on Information | 5 | .\" the American National Standards Committee X3, on Information |
@@ -33,10 +33,9 @@ | |||
33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
34 | .\" SUCH DAMAGE. | 34 | .\" SUCH DAMAGE. |
35 | .\" | 35 | .\" |
36 | .\" from: @(#)getenv.3 6.11 (Berkeley) 6/29/91 | 36 | .\" $OpenBSD: getenv.3,v 1.7 2000/04/20 13:50:02 aaron Exp $ |
37 | .\" $Id: getenv.3,v 1.1.1.1 1995/10/18 08:42:17 deraadt Exp $ | ||
38 | .\" | 37 | .\" |
39 | .Dd June 29, 1991 | 38 | .Dd December 11, 1993 |
40 | .Dt GETENV 3 | 39 | .Dt GETENV 3 |
41 | .Os | 40 | .Os |
42 | .Sh NAME | 41 | .Sh NAME |
@@ -56,59 +55,51 @@ | |||
56 | .Ft void | 55 | .Ft void |
57 | .Fn unsetenv "const char *name" | 56 | .Fn unsetenv "const char *name" |
58 | .Sh DESCRIPTION | 57 | .Sh DESCRIPTION |
59 | These functions set, unset and fetch environment variables from the | 58 | These functions set, unset, and fetch environment variables from the host |
60 | host | ||
61 | .Em environment list . | 59 | .Em environment list . |
62 | For compatibility with differing environment conventions, | 60 | For compatibility with differing environment conventions, the given arguments |
63 | the given arguments | 61 | .Fa name |
64 | .Ar name | ||
65 | and | 62 | and |
66 | .Ar value | 63 | .Fa value |
67 | may be appended and prepended, | 64 | may be appended and prepended, respectively, with an equal sign |
68 | respectively, | ||
69 | with an equal sign | ||
70 | .Dq Li \&= . | 65 | .Dq Li \&= . |
71 | .Pp | 66 | .Pp |
72 | The | 67 | The |
73 | .Fn getenv | 68 | .Fn getenv |
74 | function obtains the current value of the environment variable, | 69 | function obtains the current value of the environment variable, |
75 | .Ar name . | 70 | .Fa name . |
76 | If the variable | 71 | If the variable |
77 | .Ar name | 72 | .Fa name |
78 | is not in the current environment , | 73 | is not in the current environment, a null pointer is returned. |
79 | a null pointer is returned. | ||
80 | .Pp | 74 | .Pp |
81 | The | 75 | The |
82 | .Fn setenv | 76 | .Fn setenv |
83 | function inserts or resets the environment variable | 77 | function inserts or resets the environment variable |
84 | .Ar name | 78 | .Fa name |
85 | in the current environment list. | 79 | in the current environment list. |
86 | If the variable | 80 | If the variable |
87 | .Ar name | 81 | .Fa name |
88 | does not exist in the list, | 82 | does not exist in the list, it is inserted with the given |
89 | it is inserted with the given | 83 | .Fa value . |
90 | .Ar value. | ||
91 | If the variable does exist, the argument | 84 | If the variable does exist, the argument |
92 | .Ar overwrite | 85 | .Fa overwrite |
93 | is tested; if | 86 | is tested; if |
94 | .Ar overwrite is | 87 | .Fa overwrite |
95 | zero, the | 88 | is zero, the variable is not reset, otherwise it is reset to the given |
96 | variable is not reset, otherwise it is reset | 89 | .Fa value . |
97 | to the given | ||
98 | .Ar value . | ||
99 | .Pp | 90 | .Pp |
100 | The | 91 | The |
101 | .Fn putenv | 92 | .Fn putenv |
102 | function takes an argument of the form ``name=value'' and is | 93 | function takes an argument of the form |
103 | equivalent to: | 94 | .Ar name Ns No = Ns Ar value |
95 | and is equivalent to: | ||
104 | .Bd -literal -offset indent | 96 | .Bd -literal -offset indent |
105 | setenv(name, value, 1); | 97 | setenv(name, value, 1); |
106 | .Ed | 98 | .Ed |
107 | .Pp | 99 | .Pp |
108 | The | 100 | The |
109 | .Fn unsetenv | 101 | .Fn unsetenv |
110 | function | 102 | function deletes all instances of the variable name pointed to by |
111 | deletes all instances of the variable name pointed to by | ||
112 | .Fa name | 103 | .Fa name |
113 | from the list. | 104 | from the list. |
114 | .Sh RETURN VALUES | 105 | .Sh RETURN VALUES |
@@ -118,10 +109,13 @@ and | |||
118 | .Fn putenv | 109 | .Fn putenv |
119 | return zero if successful; otherwise the global variable | 110 | return zero if successful; otherwise the global variable |
120 | .Va errno | 111 | .Va errno |
121 | is set to indicate the error and a | 112 | is set to indicate the error and \-1 is returned. |
122 | \-1 is returned. | 113 | .Pp |
114 | If | ||
115 | .Fn getenv | ||
116 | is successful, the string returned should be considered read-only. | ||
123 | .Sh ERRORS | 117 | .Sh ERRORS |
124 | .Bl -tag -width Er | 118 | .Bl -tag -width [ENOMEM] |
125 | .It Bq Er ENOMEM | 119 | .It Bq Er ENOMEM |
126 | The function | 120 | The function |
127 | .Fn setenv | 121 | .Fn setenv |