summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/getenv.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/stdlib/getenv.3')
-rw-r--r--src/lib/libc/stdlib/getenv.333
1 files changed, 12 insertions, 21 deletions
diff --git a/src/lib/libc/stdlib/getenv.3 b/src/lib/libc/stdlib/getenv.3
index d6ffc8b1dd..b2aa0080d6 100644
--- a/src/lib/libc/stdlib/getenv.3
+++ b/src/lib/libc/stdlib/getenv.3
@@ -33,7 +33,7 @@
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.\" $OpenBSD: getenv.3,v 1.6 1999/09/06 23:26:30 aaron Exp $ 36.\" $OpenBSD: getenv.3,v 1.7 2000/04/20 13:50:02 aaron Exp $
37.\" 37.\"
38.Dd December 11, 1993 38.Dd December 11, 1993
39.Dt GETENV 3 39.Dt GETENV 3
@@ -55,17 +55,13 @@
55.Ft void 55.Ft void
56.Fn unsetenv "const char *name" 56.Fn unsetenv "const char *name"
57.Sh DESCRIPTION 57.Sh DESCRIPTION
58These functions set, unset and fetch environment variables from the 58These functions set, unset, and fetch environment variables from the host
59host
60.Em environment list . 59.Em environment list .
61For compatibility with differing environment conventions, 60For compatibility with differing environment conventions, the given arguments
62the given arguments
63.Fa name 61.Fa name
64and 62and
65.Fa value 63.Fa value
66may be appended and prepended, 64may be appended and prepended, respectively, with an equal sign
67respectively,
68with an equal sign
69.Dq Li \&= . 65.Dq Li \&= .
70.Pp 66.Pp
71The 67The
@@ -74,8 +70,7 @@ function obtains the current value of the environment variable,
74.Fa name . 70.Fa name .
75If the variable 71If the variable
76.Fa name 72.Fa name
77is not in the current environment, 73is not in the current environment, a null pointer is returned.
78a null pointer is returned.
79.Pp 74.Pp
80The 75The
81.Fn setenv 76.Fn setenv
@@ -84,30 +79,27 @@ function inserts or resets the environment variable
84in the current environment list. 79in the current environment list.
85If the variable 80If the variable
86.Fa name 81.Fa name
87does not exist in the list, 82does not exist in the list, it is inserted with the given
88it is inserted with the given
89.Fa value . 83.Fa value .
90If the variable does exist, the argument 84If the variable does exist, the argument
91.Fa overwrite 85.Fa overwrite
92is tested; if 86is tested; if
93.Fa overwrite 87.Fa overwrite
94is zero, 88is zero, the variable is not reset, otherwise it is reset to the given
95the variable is not reset, otherwise it is reset
96to the given
97.Fa value . 89.Fa value .
98.Pp 90.Pp
99The 91The
100.Fn putenv 92.Fn putenv
101function takes an argument of the form ``name=value'' and is 93function takes an argument of the form
102equivalent to: 94.Ar name Ns No = Ns Ar value
95and is equivalent to:
103.Bd -literal -offset indent 96.Bd -literal -offset indent
104setenv(name, value, 1); 97setenv(name, value, 1);
105.Ed 98.Ed
106.Pp 99.Pp
107The 100The
108.Fn unsetenv 101.Fn unsetenv
109function 102function deletes all instances of the variable name pointed to by
110deletes all instances of the variable name pointed to by
111.Fa name 103.Fa name
112from the list. 104from the list.
113.Sh RETURN VALUES 105.Sh RETURN VALUES
@@ -117,8 +109,7 @@ and
117.Fn putenv 109.Fn putenv
118return zero if successful; otherwise the global variable 110return zero if successful; otherwise the global variable
119.Va errno 111.Va errno
120is set to indicate the error and a 112is set to indicate the error and \-1 is returned.
121\-1 is returned.
122.Pp 113.Pp
123If 114If
124.Fn getenv 115.Fn getenv