summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/getenv.3
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdlib/getenv.3')
-rw-r--r--lib/libc/stdlib/getenv.353
1 files changed, 18 insertions, 35 deletions
diff --git a/lib/libc/stdlib/getenv.3 b/lib/libc/stdlib/getenv.3
index 9ebf30b..3d365f1 100644
--- a/lib/libc/stdlib/getenv.3
+++ b/lib/libc/stdlib/getenv.3
@@ -32,7 +32,7 @@
.\" @(#)getenv.3 8.2 (Berkeley) 12/11/93
.\" $FreeBSD$
.\"
-.Dd April 30, 2007
+.Dd October 12, 2006
.Dt GETENV 3
.Os
.Sh NAME
@@ -50,13 +50,22 @@
.Ft int
.Fn setenv "const char *name" "const char *value" "int overwrite"
.Ft int
-.Fn putenv "char *string"
-.Ft int
+.Fn putenv "const char *string"
+.Ft void
.Fn unsetenv "const char *name"
.Sh DESCRIPTION
These functions set, unset and fetch environment variables from the
host
.Em environment list .
+For compatibility with differing environment conventions,
+the given arguments
+.Fa name
+and
+.Fa value
+may be appended and prepended,
+respectively,
+with an equal sign
+.Dq Li \&= .
.Pp
The
.Fn getenv
@@ -88,18 +97,11 @@ to the given
.Pp
The
.Fn putenv
-function takes an argument of the form ``name=value'' and
-puts it directly into the current environment,
-so altering the argument shall change the environment.
-If the variable
-.Fa name
-does not exist in the list,
-it is inserted with the given
-.Fa value .
-If the variable
-.Fa name
-does exist, it is reset to the given
-.Fa value .
+function takes an argument of the form ``name=value'' and is
+equivalent to:
+.Bd -literal -offset indent
+setenv(name, value, 1);
+.Ed
.Pp
The
.Fn unsetenv
@@ -119,21 +121,9 @@ is not in the current environment,
.Dv NULL
is returned.
.Pp
-.Rv -std setenv putenv unsetenv
+.Rv -std setenv putenv
.Sh ERRORS
.Bl -tag -width Er
-.It Bq Er EINVAL
-The function
-.Fn setenv
-or
-.Fn unsetenv
-failed because the
-.Fa name
-is a
-.Dv NULL
-pointer, points to an empty string, or points to a string containing an
-.Dq Li \&=
-character.
.It Bq Er ENOMEM
The function
.Fn setenv
@@ -151,13 +141,6 @@ The
.Fn getenv
function conforms to
.St -isoC .
-The
-.Fn setenv ,
-.Fn putenv
-and
-.Fn unsetenv
-functions conforms to
-.St -p1003.1-2001 .
.Sh HISTORY
The functions
.Fn setenv
OpenPOWER on IntegriCloud