Loading...
stdlib/FreeBSD/getenv.3 Libc-1725.40.4 Libc-825.25
--- Libc/Libc-1725.40.4/stdlib/FreeBSD/getenv.3
+++ Libc/Libc-825.25/stdlib/FreeBSD/getenv.3
@@ -13,7 +13,11 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. Neither the name of the University nor the names of its contributors
+.\" 3. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"	This product includes software developed by the University of
+.\"	California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
 .\"
@@ -30,9 +34,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getenv.3	8.2 (Berkeley) 12/11/93
-.\" $FreeBSD$
-.\"
-.Dd June 20, 2007
+.\" $FreeBSD: src/lib/libc/stdlib/getenv.3,v 1.16 2004/07/07 19:57:13 ru Exp $
+.\"
+.Dd December 11, 1993
 .Dt GETENV 3
 .Os
 .Sh NAME
@@ -46,26 +50,41 @@
 .Sh SYNOPSIS
 .In stdlib.h
 .Ft char *
-.Fn getenv "const char *name"
+.Fo getenv
+.Fa "const char *name"
+.Fc
 .Ft int
-.Fn setenv "const char *name" "const char *value" "int overwrite"
+.Fo putenv
+.Fa "char *string"
+.Fc
 .Ft int
-.Fn putenv "char *string"
+.Fo setenv
+.Fa "const char *name"
+.Fa "const char *value"
+.Fa "int overwrite"
+.Fc
 .Ft int
-.Fn unsetenv "const char *name"
+.Fo unsetenv
+.Fa "const char *name"
+.Fc
 .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
 function obtains the current value of the environment variable,
 .Fa name .
-The application should not modify the string pointed
-to by the
-.Fn getenv
-function.
 .Pp
 The
 .Fn setenv
@@ -81,7 +100,8 @@
 .Fa overwrite
 is tested; if
 .Fa overwrite
-is zero, the
+is
+zero, the
 variable is not reset, otherwise it is reset
 to the given
 .Fa value .
@@ -131,33 +151,13 @@
 .Bl -tag -width Er
 .It Bq Er EINVAL
 The function
-.Fn getenv ,
-.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.
-.Pp
-The function
-.Fn putenv
+.Fn unsetenv
 failed because
-.Fa string
-is a
-.Dv NULL
-pointer or
-.Fa string
-is without an
-.Dq Li \&=
-character.
+.Fa name
+was not found in the environment list.
 .It Bq Er ENOMEM
 The function
-.Fn setenv ,
-.Fn unsetenv
+.Fn setenv
 or
 .Fn putenv
 failed because it was unable to allocate memory for the environment.
@@ -206,38 +206,33 @@
 .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
-and
-.Fn unsetenv
-appeared in
-.At v7 .
-The
-.Fn putenv
-function appeared in
-.Bx 4.3 Reno .
 .Sh BUGS
 Successive calls to
 .Fn setenv
-that assign a larger-sized
+or
+.Fn putenv
+assigning a differently sized
 .Fa value
-than any previous value to the same
+to the same
 .Fa name
 will result in a memory leak.
 The
 .Fx
-semantics for this function
+semantics for these functions
 (namely, that the contents of
 .Fa value
 are copied and that old values remain accessible indefinitely) make this
 bug unavoidable.
 Future versions may eliminate one or both of these
 semantic guarantees in order to fix the bug.
+.Sh HISTORY
+The functions
+.Fn setenv
+and
+.Fn unsetenv
+appeared in
+.At v7 .
+The
+.Fn putenv
+function appeared in
+.Bx 4.3 Reno .