]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Add putenv and unsetenv.
authorKevin Ryde <user42@zip.com.au>
Wed, 15 Oct 2003 00:10:05 +0000 (00:10 +0000)
committerKevin Ryde <user42@zip.com.au>
Wed, 15 Oct 2003 00:10:05 +0000 (00:10 +0000)
doc/autoconf.texi

index 80097e85bfb4dcfdfd828ea0bfd953e339f90545..f85fdc7552e5b53a80b6d7eb7a26bf0f89f77822 100644 (file)
@@ -3544,6 +3544,21 @@ Did you know that, on some older hosts, @code{exit} returns @code{int}?
 This is because @code{exit} predates @code{void}, and there was a long
 tradition of it returning @code{int}.
 
+@item @code{putenv}
+@c @fuindex putenv
+@prindex @code{putenv}
+POSIX specifies that @code{putenv} puts the given string directly in
+@code{environ}, but some systems make a copy of it instead (eg.@:
+glibc 2.0, or BSD).  And when a copy is made, @code{unsetenv} might
+not free it, causing a memory leak (eg.@: FreeBSD 4).
+
+POSIX specifies that @code{putenv("FOO")} removes @samp{FOO} from the
+environment, but on some systems (eg.@: FreeBSD 4) this is not the
+case and instead @code{unsetenv} must be used.
+
+On MINGW, a call @code{putenv("FOO=")} removes @samp{FOO} from the
+environment, rather than inserting it with an empty value.
+
 @item @code{snprintf}
 @c @fuindex snprintf
 @prindex @code{snprintf}
@@ -3609,6 +3624,13 @@ that are open.  For example, on Windows 9x and ME, such a call would fail;
 on DOS it could even lead to file system corruption, as the file might end
 up being written to after the OS has removed it.
 
+@item @code{unsetenv}
+@c @fuindex unsetenv
+@prindex @code{unsetenv}
+On MINGW, @code{unsetenv} is not available, but a variable @samp{FOO}
+can be removed with a call @code{putenv("FOO=")}, as described under
+@code{putenv} above.
+
 @item @code{va_copy}
 @c @fuindex va_copy
 @prindex @code{va_copy}