aboutsummaryrefslogtreecommitdiffstats
path: root/man3/putenv.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/putenv.3')
-rw-r--r--man3/putenv.327
1 files changed, 20 insertions, 7 deletions
diff --git a/man3/putenv.3 b/man3/putenv.3
index 22ae42490a..f643e36523 100644
--- a/man3/putenv.3
+++ b/man3/putenv.3
@@ -42,7 +42,9 @@ putenv \- change or add an environment variable
.\" Not: const char *
.fi
.SH DESCRIPTION
-The \fBputenv\fP() function adds or changes the value of environment
+The
+.BR putenv ()
+function adds or changes the value of environment
variables.
The argument \fIstring\fP is of the form \fIname\fP=\fIvalue\fP.
If \fIname\fP does not already exist in the environment, then
@@ -53,31 +55,42 @@ then the value of \fIname\fP in the environment is changed to
The string pointed to by \fIstring\fP becomes part of the environment,
so altering the string changes the environment.
.SH "RETURN VALUE"
-The \fBputenv\fP() function returns zero on success,
+The
+.BR putenv ()
+function returns zero on success,
or non-zero if an error occurs.
.SH ERRORS
.TP
.B ENOMEM
Insufficient space to allocate new environment.
.SH NOTES
-The \fBputenv\fP() function is not required to be reentrant, and the
+The
+.BR putenv ()
+function is not required to be reentrant, and the
one in libc4, libc5 and glibc2.0 is not, but the glibc2.1 version is.
.LP
Description for libc4, libc5, glibc:
If the argument \fIstring\fP is of the form \fIname\fP,
and does not contain an `=' character, then the variable \fIname\fP
is removed from the environment.
-If \fBputenv\fP() has to allocate a new array \fIenviron\fP,
-and the previous array was also allocated by \fBputenv\fP(),
+If
+.BR putenv ()
+has to allocate a new array \fIenviron\fP,
+and the previous array was also allocated by
+.BR putenv (),
then it will be freed.
In no case will the old storage associated
to the environment variable itself be freed.
.LP
The libc4 and libc5 and glibc 2.1.2 versions conform to SUSv2:
-the pointer \fIstring\fP given to \fBputenv\fP() is used.
+the pointer \fIstring\fP given to
+.BR putenv ()
+is used.
In particular, this string becomes part of the environment;
changing it later will change the environment.
-(Thus, it is an error is to call \fBputenv\fP() with an automatic variable
+(Thus, it is an error is to call
+.BR putenv ()
+with an automatic variable
as the argument, then return from the calling function while \fIstring\fP
is still part of the environment.)
However, glibc 2.0-2.1.1 differs: a copy of the string is used.