summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS5
-rw-r--r--doc/functions/unsetenv.texi7
-rw-r--r--lib/getdate.y1
-rw-r--r--lib/relocwrapper.c1
-rw-r--r--lib/setenv.c4
-rw-r--r--lib/setenv.h53
-rw-r--r--lib/stdlib.in.h25
-rw-r--r--lib/unsetenv.c6
-rw-r--r--lib/xsetenv.c1
-rw-r--r--lib/xsetenv.h2
-rw-r--r--m4/setenv.m412
-rw-r--r--m4/stdlib_h.m47
-rw-r--r--modules/getdate1
-rw-r--r--modules/relocatable-prog-wrapper2
-rw-r--r--modules/setenv8
-rw-r--r--modules/stdlib5
-rw-r--r--modules/unsetenv26
-rw-r--r--modules/xsetenv1
18 files changed, 94 insertions, 73 deletions
diff --git a/NEWS b/NEWS
index adb0163729..c30b27207f 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,11 @@ User visible incompatible changes
Date Modules Changes
+2007-12-24 setenv The include file is changed from "setenv.h" to
+ <stdlib.h>. Also, the unsetenv function is no
+ longer declared in this module; use the 'unsetenv'
+ module if you need it.
+
2007-12-03 getpagesize The include file is changed from "getpagesize.h"
to <unistd.h>.
diff --git a/doc/functions/unsetenv.texi b/doc/functions/unsetenv.texi
index 82b00d4a61..644182a370 100644
--- a/doc/functions/unsetenv.texi
+++ b/doc/functions/unsetenv.texi
@@ -11,11 +11,12 @@ Portability problems fixed by Gnulib:
@item
This function is missing on some platforms:
AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, mingw, BeOS.
+@item
+This function has the return type @samp{void} instead of @samp{int} on some
+platforms:
+MacOS X 10.3, FreeBSD 6.0, NetBSD 1.6, OpenBSD 3.8, OSF/1 5.1.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
-@item
-This function has the return type @samp{void} instead of @samp{int} on some
-platforms.
@end itemize
diff --git a/lib/getdate.y b/lib/getdate.y
index e292f5e465..1ed914f31c 100644
--- a/lib/getdate.y
+++ b/lib/getdate.y
@@ -66,7 +66,6 @@
#include <stdlib.h>
#include <string.h>
-#include "setenv.h"
#include "xalloc.h"
diff --git a/lib/relocwrapper.c b/lib/relocwrapper.c
index ca186c3575..76e3559167 100644
--- a/lib/relocwrapper.c
+++ b/lib/relocwrapper.c
@@ -53,7 +53,6 @@
#include "progname.h"
#include "relocatable.h"
-#include "setenv.h"
#include "c-ctype.h"
/* Return a copy of the filename, with an extra ".bin" at the end.
diff --git a/lib/setenv.c b/lib/setenv.c
index 75488be0b1..ea1d1167ff 100644
--- a/lib/setenv.c
+++ b/lib/setenv.c
@@ -19,12 +19,14 @@
#endif
#include <alloca.h>
+/* Specification. */
+#include <stdlib.h>
+
#include <errno.h>
#ifndef __set_errno
# define __set_errno(ev) ((errno) = (ev))
#endif
-#include <stdlib.h>
#include <string.h>
#if _LIBC || HAVE_UNISTD_H
# include <unistd.h>
diff --git a/lib/setenv.h b/lib/setenv.h
deleted file mode 100644
index 9f5d0b7ec9..0000000000
--- a/lib/setenv.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Setting environment variables.
- Copyright (C) 2001-2004, 2007 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#if HAVE_SETENV || HAVE_UNSETENV
-
-/* Get setenv(), unsetenv() declarations. */
-# include <stdlib.h>
-
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if !HAVE_SETENV
-
-/* Set NAME to VALUE in the environment.
- If REPLACE is nonzero, overwrite an existing value. */
-extern int setenv (const char *name, const char *value, int replace);
-
-#endif
-
-#if HAVE_UNSETENV
-
-# if VOID_UNSETENV
-/* On some systems, unsetenv() returns void.
- This is the case for FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4. */
-# define unsetenv(name) ((unsetenv)(name), 0)
-# endif
-
-#else
-
-/* Remove the variable NAME from the environment. */
-extern int unsetenv (const char *name);
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index dc9f98f8d3..100ff52652 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -1,6 +1,6 @@
/* A GNU-like <stdlib.h>.
- Copyright (C) 1995, 2001-2002, 2006-2007 Free Software Foundation, Inc.
+ Copyright (C) 1995, 2001-2004, 2006-2007 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -176,6 +176,29 @@ extern int putenv (char *string);
#endif
+#if @GNULIB_SETENV@
+# if !@HAVE_SETENV@
+/* Set NAME to VALUE in the environment.
+ If REPLACE is nonzero, overwrite an existing value. */
+extern int setenv (const char *name, const char *value, int replace);
+# endif
+#endif
+
+
+#if @GNULIB_UNSETENV@
+# if @HAVE_UNSETENV@
+# if @VOID_UNSETENV@
+/* On some systems, unsetenv() returns void.
+ This is the case for MacOS X 10.3, FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4. */
+# define unsetenv(name) ((unsetenv)(name), 0)
+# endif
+# else
+/* Remove the variable NAME from the environment. */
+extern int unsetenv (const char *name);
+# endif
+#endif
+
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/unsetenv.c b/lib/unsetenv.c
index 90b8449126..c783997a2b 100644
--- a/lib/unsetenv.c
+++ b/lib/unsetenv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992,1995-1999,2000-2002,2005-2006 Free Software Foundation, Inc.
+/* Copyright (C) 1992,1995-1999,2000-2002,2005-2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
@@ -16,12 +16,14 @@
#include <config.h>
+/* Specification. */
+#include <stdlib.h>
+
#include <errno.h>
#if !_LIBC
# define __set_errno(ev) ((errno) = (ev))
#endif
-#include <stdlib.h>
#include <string.h>
#include <unistd.h>
diff --git a/lib/xsetenv.c b/lib/xsetenv.c
index 4939fe1b8c..44e5c3f9f7 100644
--- a/lib/xsetenv.c
+++ b/lib/xsetenv.c
@@ -21,7 +21,6 @@
#include <stdlib.h>
-#include "setenv.h"
#include "error.h"
#include "gettext.h"
diff --git a/lib/xsetenv.h b/lib/xsetenv.h
index 24b59c2e92..0b65f4ffb8 100644
--- a/lib/xsetenv.h
+++ b/lib/xsetenv.h
@@ -15,7 +15,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Get unsetenv(). It can be used without error checking. */
-#include "setenv.h"
+#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
diff --git a/m4/setenv.m4 b/m4/setenv.m4
index d6901de240..bbb5548ffa 100644
--- a/m4/setenv.m4
+++ b/m4/setenv.m4
@@ -1,4 +1,4 @@
-# setenv.m4 serial 8
+# setenv.m4 serial 9
dnl Copyright (C) 2001-2004, 2006-2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,8 +6,10 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_SETENV],
[
+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
AC_CHECK_FUNCS_ONCE([setenv])
if test $ac_cv_func_setenv = no; then
+ HAVE_SETENV=0
AC_LIBOBJ([setenv])
gl_PREREQ_SETENV
fi
@@ -16,14 +18,20 @@ AC_DEFUN([gl_FUNC_SETENV],
# Like gl_FUNC_SETENV, except prepare for separate compilation (no AC_LIBOBJ).
AC_DEFUN([gl_FUNC_SETENV_SEPARATE],
[
+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
AC_CHECK_FUNCS_ONCE([setenv])
+ if test $ac_cv_func_setenv = no; then
+ HAVE_SETENV=0
+ fi
gl_PREREQ_SETENV
])
AC_DEFUN([gl_FUNC_UNSETENV],
[
+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
AC_CHECK_FUNCS([unsetenv])
if test $ac_cv_func_unsetenv = no; then
+ HAVE_UNSETENV=0
AC_LIBOBJ([unsetenv])
gl_PREREQ_UNSETENV
else
@@ -40,7 +48,7 @@ int unsetenv();
#endif
], , gt_cv_func_unsetenv_ret='int', gt_cv_func_unsetenv_ret='void')])
if test $gt_cv_func_unsetenv_ret = 'void'; then
- AC_DEFINE(VOID_UNSETENV, 1, [Define if unsetenv() returns void, not int.])
+ VOID_UNSETENV=1
fi
fi
])
diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4
index 278df744c7..fe4ce122e9 100644
--- a/m4/stdlib_h.m4
+++ b/m4/stdlib_h.m4
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 4
+# stdlib_h.m4 serial 5
dnl Copyright (C) 2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -26,12 +26,17 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP])
GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP])
GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV])
+ GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV])
+ GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_CALLOC_POSIX=1; AC_SUBST([HAVE_CALLOC_POSIX])
HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT])
HAVE_MALLOC_POSIX=1; AC_SUBST([HAVE_MALLOC_POSIX])
HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP])
HAVE_REALLOC_POSIX=1; AC_SUBST([HAVE_REALLOC_POSIX])
+ HAVE_SETENV=1; AC_SUBST([HAVE_SETENV])
+ HAVE_UNSETENV=1; AC_SUBST([HAVE_UNSETENV])
REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV])
+ VOID_UNSETENV=0; AC_SUBST([VOID_UNSETENV])
])
diff --git a/modules/getdate b/modules/getdate
index 88b51af37c..59c1abf833 100644
--- a/modules/getdate
+++ b/modules/getdate
@@ -15,6 +15,7 @@ gettime
intprops
mktime
setenv
+unsetenv
time
verify
xalloc
diff --git a/modules/relocatable-prog-wrapper b/modules/relocatable-prog-wrapper
index 0002774d99..4a2faf5b46 100644
--- a/modules/relocatable-prog-wrapper
+++ b/modules/relocatable-prog-wrapper
@@ -19,7 +19,6 @@ lib/malloca.h
lib/malloca.c
lib/relocatable.h
lib/relocatable.c
-lib/setenv.h
lib/setenv.c
lib/strerror.c
lib/c-ctype.h
@@ -38,6 +37,7 @@ alloca-opt
pathmax
ssize_t
stdbool
+stdlib
unistd
configure.ac:
diff --git a/modules/setenv b/modules/setenv
index 9aaf72664f..1c93bfb5c0 100644
--- a/modules/setenv
+++ b/modules/setenv
@@ -1,26 +1,24 @@
Description:
setenv() function: set an environment variable.
-unsetenv() function: remove an environment variable.
Files:
-lib/setenv.h
lib/setenv.c
-lib/unsetenv.c
m4/setenv.m4
Depends-on:
+stdlib
malloca
alloca-opt
unistd
configure.ac:
gl_FUNC_SETENV
-gl_FUNC_UNSETENV
+gl_STDLIB_MODULE_INDICATOR([setenv])
Makefile.am:
Include:
-"setenv.h"
+<stdlib.h>
License:
LGPL
diff --git a/modules/stdlib b/modules/stdlib
index 1c6b4f23b2..07adcd1c2b 100644
--- a/modules/stdlib
+++ b/modules/stdlib
@@ -30,13 +30,18 @@ stdlib.h: stdlib.in.h
-e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
-e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
-e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \
+ -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \
+ -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
-e 's|@''HAVE_CALLOC_POSIX''@|$(HAVE_CALLOC_POSIX)|g' \
-e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
-e 's|@''HAVE_MALLOC_POSIX''@|$(HAVE_MALLOC_POSIX)|g' \
-e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
-e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \
+ -e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \
+ -e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \
-e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
-e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
+ -e 's|@''VOID_UNSETENV''@|$(VOID_UNSETENV)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
< $(srcdir)/stdlib.in.h; \
} > $@-t
diff --git a/modules/unsetenv b/modules/unsetenv
new file mode 100644
index 0000000000..261c8e4d65
--- /dev/null
+++ b/modules/unsetenv
@@ -0,0 +1,26 @@
+Description:
+unsetenv() function: remove an environment variable.
+
+Files:
+lib/unsetenv.c
+m4/setenv.m4
+
+Depends-on:
+stdlib
+unistd
+
+configure.ac:
+gl_FUNC_UNSETENV
+gl_STDLIB_MODULE_INDICATOR([unsetenv])
+
+Makefile.am:
+
+Include:
+<stdlib.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
+
diff --git a/modules/xsetenv b/modules/xsetenv
index ea313e7fe2..29319f1223 100644
--- a/modules/xsetenv
+++ b/modules/xsetenv
@@ -8,6 +8,7 @@ lib/xsetenv.c
Depends-on:
setenv
+unsetenv
error
exit
gettext-h