changeset 15639:6c1f469caade

putenv: Support for MSVC. * modules/putenv (Depends-on): Add environ. * lib/putenv.c (environ): Disable declaration. * lib/unistd.in.h: Update comment.
author Bruno Haible <bruno@clisp.org>
date Sat, 17 Sep 2011 17:34:03 +0200
parents f2a7b56d34a3
children e9fd9d86c6e0
files ChangeLog lib/putenv.c lib/unistd.in.h modules/putenv
diffstat 4 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-09-17  Bruno Haible  <bruno@clisp.org>
+
+	putenv: Support for MSVC.
+	* modules/putenv (Depends-on): Add environ.
+	* lib/putenv.c (environ): Disable declaration.
+	* lib/unistd.in.h: Update comment.
+
 2011-09-17  Bruno Haible  <bruno@clisp.org>
 
 	math: Avoid macro redefinition warnings on MSVC.
--- a/lib/putenv.c
+++ b/lib/putenv.c
@@ -34,10 +34,12 @@
 #include <string.h>
 #include <unistd.h>
 
-#if HAVE_GNU_LD
+#if _LIBC
+# if HAVE_GNU_LD
 # define environ __environ
-#else
+# else
 extern char **environ;
+# endif
 #endif
 
 #if _LIBC
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -75,7 +75,8 @@
 #endif
 
 /* mingw fails to declare _exit in <unistd.h>.  */
-/* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>.  */
+/* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
+   <unistd.h>.  */
 /* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>.  */
 /* But avoid namespace pollution on glibc systems.  */
 #ifndef __GLIBC__
--- a/modules/putenv
+++ b/modules/putenv
@@ -7,6 +7,7 @@
 
 Depends-on:
 stdlib
+environ         [test $REPLACE_PUTENV = 1]
 malloc-posix    [test $REPLACE_PUTENV = 1]
 
 configure.ac: