merge with 1.9
[gnulib.git] / lib / putenv.c
index c39d1b7..47f7256 100644 (file)
@@ -16,6 +16,17 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
+#ifdef HAVE_CONFIG_H
+#if defined (CONFIG_BROKETS)
+/* We use <config.h> instead of "config.h" so that a compilation
+   using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
+   (which it would do because it found this file in $srcdir).  */
+#include <config.h>
+#else
+#include "config.h"
+#endif
+#endif
+
 #include <sys/types.h>
 #include <errno.h>
 
@@ -25,6 +36,8 @@ Cambridge, MA 02139, USA.  */
 /* Don't include stdlib.h for non-GNU C libraries because some of them
    contain conflicting prototypes for getopt.  */
 #include <stdlib.h>
+#else
+char *malloc ();
 #endif /* GNU C library.  */
 
 #ifndef STDC_HEADERS
@@ -93,7 +106,8 @@ putenv (string)
       char **new_environ = (char **) malloc ((size + 2) * sizeof (char *));
       if (new_environ == NULL)
        return -1;
-      (void) bcopy ((char *) environ, (char *) new_environ, size * sizeof (char *));
+      (void) bcopy ((char *) environ, (char *) new_environ,
+                   size * sizeof (char *));
       new_environ[size] = (char *) string;
       new_environ[size + 1] = NULL;
       if (last_environ != NULL)