libidn-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU libidn branch, master, updated. libidn-1-15-24-g0b13a4f


From: Simon Josefsson
Subject: [SCM] GNU libidn branch, master, updated. libidn-1-15-24-g0b13a4f
Date: Wed, 18 Nov 2009 14:46:17 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU libidn".

http://git.savannah.gnu.org/cgit/libidn.git/commit/?id=0b13a4f93ae9a116d6613d16ca4ffb03b902d30f

The branch, master has been updated
       via  0b13a4f93ae9a116d6613d16ca4ffb03b902d30f (commit)
       via  8ee6b1f269a17e82b1a5922fbee17daf1ec8fc32 (commit)
      from  057c2e407b3ccc6d33e1a700aa9e77ceb457bdbb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 0b13a4f93ae9a116d6613d16ca4ffb03b902d30f
Author: Simon Josefsson <address@hidden>
Date:   Wed Nov 18 15:46:11 2009 +0100

    Update gnulib files.

commit 8ee6b1f269a17e82b1a5922fbee17daf1ec8fc32
Author: Simon Josefsson <address@hidden>
Date:   Fri Nov 6 14:31:58 2009 +0100

    Update gnulib files.

-----------------------------------------------------------------------

Summary of changes:
 build-aux/pmccabe2html           |   17 ++---
 build-aux/update-copyright       |    7 ++-
 build-aux/useless-if-before-free |    5 +-
 doc/cyclo/Makefile.am            |   14 ++--
 gl/Makefile.am                   |    8 ++
 gl/getopt.c                      |    5 +-
 gl/intprops.h                    |   38 ++++++-----
 gl/m4/environ.m4                 |    4 +-
 gl/m4/gnulib-comp.m4             |   13 +++-
 gl/m4/malloc.m4                  |   41 ++++++++++++
 gl/m4/pmccabe2html.m4            |   14 ----
 gl/m4/putenv.m4                  |   41 ++++++++++++
 gl/m4/setenv.m4                  |   53 +++++++++++++--
 gl/m4/stdlib_h.m4                |    9 ++-
 gl/m4/unistd_h.m4                |   10 +++-
 gl/unistd.in.h                   |   58 +++++++++++++++--
 gl/version-etc.c                 |   12 ++-
 gltests/Makefile.am              |   42 ++++++++++++-
 gltests/malloc.c                 |   57 ++++++++++++++++
 gltests/putenv.c                 |  132 ++++++++++++++++++++++++++++++++++++++
 gltests/setenv.c                 |   54 +++++++++++++++-
 gltests/stdlib.in.h              |   77 ++++++++++++++++++++--
 gltests/test-getopt.c            |    2 +-
 gltests/test-getopt.h            |   44 ++++++------
 gltests/test-getopt_long.h       |   97 +++++++++++++++------------
 gltests/test-setenv.c            |   60 +++++++++++++++++
 gltests/test-stddef.c            |    2 +-
 gltests/test-stdint.c            |    4 +-
 gltests/test-stdlib.c            |    2 +-
 gltests/test-strerror.c          |    4 +-
 gltests/test-string.c            |    2 +-
 gltests/test-unistd.c            |    2 +-
 gltests/test-unsetenv.c          |   65 +++++++++++++++++++
 gltests/test-update-copyright.sh |   10 +++-
 gltests/test-version-etc.c       |    2 +-
 gltests/test-wchar.c             |    2 +-
 gltests/unsetenv.c               |   28 ++++++++-
 lib/gltests/Makefile.am          |    1 +
 lib/gltests/intprops.h           |   38 ++++++-----
 lib/gltests/test-stddef.c        |    2 +-
 lib/gltests/test-stdint.c        |    4 +-
 lib/gltests/test-string.c        |    2 +-
 lib/gltests/test-strverscmp.c    |    4 +-
 lib/gltests/test-wchar.c         |    2 +-
 maint.mk                         |   27 ++++++++
 45 files changed, 928 insertions(+), 189 deletions(-)
 mode change 100755 => 100644 build-aux/pmccabe2html
 create mode 100644 gl/m4/malloc.m4
 delete mode 100644 gl/m4/pmccabe2html.m4
 create mode 100644 gl/m4/putenv.m4
 create mode 100644 gltests/malloc.c
 create mode 100644 gltests/putenv.c
 create mode 100644 gltests/test-setenv.c
 create mode 100644 gltests/test-unsetenv.c

diff --git a/build-aux/pmccabe2html b/build-aux/pmccabe2html
old mode 100755
new mode 100644
index 27bb8f3..dd397cf
--- a/build-aux/pmccabe2html
+++ b/build-aux/pmccabe2html
@@ -1,7 +1,6 @@
-#!/usr/bin/awk -f
-# pmccabe2html - pmccabe to html converter
+# pmccabe2html - AWK script to convert pmccabe output to html
 
-# Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2007, 2008, 2009 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
@@ -22,16 +21,16 @@
 
 # Typical Invocation is from a Makefile.am:
 #
-# cyclo-libidn.html:
+# cyclo-$(PACKAGE).html:
 #      $(PMCCABE) ${top_srcdir}/lib/*.[ch] \
 #              | sort -nr \
 #              | $(AWK) -f ${top_srcdir}/build-aux/pmccabe2html \
 #                      -v lang=html -v name="$(PACKAGE_NAME)" \
-#                      -v 
vcurl="http://git.savannah.gnu.org/gitweb/?p=libidn.git;a=blob;f=%FILENAME%;hb=HEAD";
 \
-#                      -v url="http://www.gnu.org/software/libidn/"; \
-#                       -v css=../../build-aux/pmccabe.css \
-#                      > tmp
-#      mv tmp $@
+#                      -v 
vcurl="http://git.savannah.gnu.org/gitweb/?p=$(PACKAGE).git;a=blob;f=%FILENAME%;hb=HEAD"
 \
+#                      -v url="http://www.gnu.org/software/$(PACKAGE)/" \
+#                       -v css=${top_srcdir}/build-aux/pmccabe.css \
+#                      > address@hidden
+#      mv address@hidden $@
 #
 # The variables available are:
 #   lang     output language, either 'html' or 'wiki'
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index 2480142..f541761 100755
--- a/build-aux/update-copyright
+++ b/build-aux/update-copyright
@@ -1,7 +1,9 @@
-#!/usr/bin/perl -0777 -pi
+eval '(exit $?0)' && eval 'exec perl -wS -0777 -pi "$0" ${1+"$@"}'
+  & eval 'exec perl -wS -0777 -pi "$0" $argv:q'
+    if 0;
 # Update an FSF copyright year list to include the current year.
 
-my $VERSION = '2009-09-09.22:00'; # UTC
+my $VERSION = '2009-10-30.15:57'; # UTC
 
 # Copyright (C) 2009 Free Software Foundation, Inc.
 #
@@ -249,6 +251,7 @@ else
   }
 
 # Local variables:
+# mode: perl
 # indent-tabs-mode: nil
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "my $VERSION = '"
diff --git a/build-aux/useless-if-before-free b/build-aux/useless-if-before-free
index abcdef2..793c975 100755
--- a/build-aux/useless-if-before-free
+++ b/build-aux/useless-if-before-free
@@ -1,4 +1,6 @@
-#!/usr/bin/perl -T
+eval '(exit $?0)' && eval 'exec perl -wST "$0" ${1+"$@"}'
+  & eval 'exec perl -wST "$0" $argv:q'
+    if 0;
 # Detect instances of "if (p) free (p);".
 # Likewise for "if (p != NULL) free (p);".  And with braces.
 # Also detect "if (NULL != p) free (p);".
@@ -197,6 +199,7 @@ When modifying files, refuse to process anything other than 
a regular file.
 EOF
 
 ## Local Variables:
+## mode: perl
 ## indent-tabs-mode: nil
 ## eval: (add-hook 'write-file-hooks 'time-stamp)
 ## time-stamp-start: "my $VERSION = '"
diff --git a/doc/cyclo/Makefile.am b/doc/cyclo/Makefile.am
index 2c72cfc..0cff877 100644
--- a/doc/cyclo/Makefile.am
+++ b/doc/cyclo/Makefile.am
@@ -16,15 +16,15 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-EXTRA_DIST = cyclo-libidn.html
+EXTRA_DIST = cyclo-$(PACKAGE).html
 
-cyclo-libidn.html:
+cyclo-$(PACKAGE).html:
        $(PMCCABE) ${top_srcdir}/lib/*.[ch] \
                | sort -nr \
                | $(AWK) -f ${top_srcdir}/build-aux/pmccabe2html \
                        -v lang=html -v name="$(PACKAGE_NAME)" \
-                       -v 
vcurl="http://git.savannah.gnu.org/gitweb/?p=libidn.git;a=blob;f=%FILENAME%;hb=HEAD";
 \
-                       -v url="http://www.gnu.org/software/libidn/"; \
-                       -v css=../../build-aux/pmccabe.css \
-                       > tmp
-       mv tmp $@
+                       -v 
vcurl="http://git.savannah.gnu.org/gitweb/?p=$(PACKAGE).git;a=blob;f=%FILENAME%;hb=HEAD"
 \
+                       -v url="http://www.gnu.org/software/$(PACKAGE)/" \
+                       -v css=${top_srcdir}/build-aux/pmccabe.css \
+                       > address@hidden
+       mv address@hidden $@
diff --git a/gl/Makefile.am b/gl/Makefile.am
index 8605b81..48a2b71 100644
--- a/gl/Makefile.am
+++ b/gl/Makefile.am
@@ -332,6 +332,7 @@ unistd.h: unistd.in.h
              -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \
              -e 's|@''GNULIB_GETDOMAINNAME''@|$(GNULIB_GETDOMAINNAME)|g' \
              -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \
+             -e 's|@''GNULIB_GETGROUPS''@|$(GNULIB_GETGROUPS)|g' \
              -e 's|@''GNULIB_GETHOSTNAME''@|$(GNULIB_GETHOSTNAME)|g' \
              -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
              -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \
@@ -351,7 +352,9 @@ unistd.h: unistd.in.h
              -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' 
\
              -e 's|@''GNULIB_UNLINK''@|$(GNULIB_UNLINK)|g' \
              -e 's|@''GNULIB_UNLINKAT''@|$(GNULIB_UNLINKAT)|g' \
+             -e 's|@''GNULIB_USLEEP''@|$(GNULIB_USLEEP)|g' \
              -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \
+             -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \
              -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
              -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \
              -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \
@@ -361,9 +364,11 @@ unistd.h: unistd.in.h
              -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
              -e 's|@''HAVE_GETDOMAINNAME''@|$(HAVE_GETDOMAINNAME)|g' \
              -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \
+             -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \
              -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \
              -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
              -e 's|@''HAVE_GETUSERSHELL''@|$(HAVE_GETUSERSHELL)|g' \
+             -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \
              -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \
              -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \
              -e 's|@''HAVE_PIPE2''@|$(HAVE_PIPE2)|g' \
@@ -373,6 +378,7 @@ unistd.h: unistd.in.h
              -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \
              -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \
              -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \
+             -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \
              -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
              -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
              -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
@@ -384,6 +390,7 @@ unistd.h: unistd.in.h
              -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
              -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \
              -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
+             -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \
              -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
              -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
              -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \
@@ -394,6 +401,7 @@ unistd.h: unistd.in.h
              -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \
              -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \
              -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \
+             -e 's|@''REPLACE_USLEEP''@|$(REPLACE_USLEEP)|g' \
              -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \
              -e 
's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \
              -e 
's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g'
 \
diff --git a/gl/getopt.c b/gl/getopt.c
index f1e6d1f..797d166 100644
--- a/gl/getopt.c
+++ b/gl/getopt.c
@@ -2,7 +2,7 @@
    NOTE: getopt is now part of the C library, so if you don't know what
    "Keep this file name-space clean" means, talk to address@hidden
    before changing it!
-   Copyright (C) 
1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004,2006,2008
+   Copyright (C) 
1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004,2006,2008,2009
        Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -225,7 +225,8 @@ exchange (char **argv, struct _getopt_data *d)
 /* Initialize the internal data when the first call is made.  */
 
 static const char *
-_getopt_initialize (int argc, char **argv, const char *optstring,
+_getopt_initialize (int argc _UNUSED_PARAMETER_,
+                   char **argv _UNUSED_PARAMETER_, const char *optstring,
                    int posixly_correct, struct _getopt_data *d)
 {
   /* Start processing options with ARGV-element 1 (since ARGV-element 0
diff --git a/gl/intprops.h b/gl/intprops.h
index 002161e..325c397 100644
--- a/gl/intprops.h
+++ b/gl/intprops.h
@@ -1,6 +1,7 @@
 /* intprops.h -- properties of integer types
 
-   Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 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
@@ -17,37 +18,40 @@
 
 /* Written by Paul Eggert.  */
 
-#include <limits.h>
+#ifndef GL_INTPROPS_H
+# define GL_INTPROPS_H
+
+# include <limits.h>
 
 /* The extra casts in the following macros work around compiler bugs,
    e.g., in Cray C 5.0.3.0.  */
 
 /* True if the arithmetic type T is an integer type.  bool counts as
    an integer.  */
-#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
+# define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
 
 /* True if negative values of the signed integer type T use two's
    complement, ones' complement, or signed magnitude representation,
    respectively.  Much GNU code assumes two's complement, but some
    people like to be portable to all possible C hosts.  */
-#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
-#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
-#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
+# define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
+# define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
+# define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
 
 /* True if the arithmetic type T is signed.  */
-#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
 
 /* The maximum and minimum values for the integer type T.  These
    macros have undefined behavior if T is signed and has padding bits.
    If this is a problem for you, please let us know how to fix it for
    your host.  */
-#define TYPE_MINIMUM(t) \
+# define TYPE_MINIMUM(t) \
   ((t) (! TYPE_SIGNED (t) \
        ? (t) 0 \
        : TYPE_SIGNED_MAGNITUDE (t) \
        ? ~ (t) 0 \
        : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
-#define TYPE_MAXIMUM(t) \
+# define TYPE_MAXIMUM(t) \
   ((t) (! TYPE_SIGNED (t) \
        ? (t) -1 \
        : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
@@ -58,20 +62,22 @@
    tighter bound.  Otherwise, it overestimates the true bound by one byte
    when applied to unsigned types of size 2, 4, 16, ... bytes.
    The symbol signed_type_or_expr__ is private to this header file.  */
-#if __GNUC__ >= 2
-# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t))
-#else
-# define signed_type_or_expr__(t) 1
-#endif
+# if __GNUC__ >= 2
+#  define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t))
+# else
+#  define signed_type_or_expr__(t) 1
+# endif
 
 /* Bound on length of the string representing an integer type or expression T.
    Subtract 1 for the sign bit if T is signed; log10 (2.0) < 146/485;
    add 1 for integer division truncation; add 1 more for a minus sign
    if needed.  */
-#define INT_STRLEN_BOUND(t) \
+# define INT_STRLEN_BOUND(t) \
   ((sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) * 146 / 485 \
    + signed_type_or_expr__ (t) + 1)
 
 /* Bound on buffer size needed to represent an integer type or expression T,
    including the terminating null.  */
-#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
+# define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
+
+#endif /* GL_INTPROPS_H */
diff --git a/gl/m4/environ.m4 b/gl/m4/environ.m4
index b17bb60..1803820 100644
--- a/gl/m4/environ.m4
+++ b/gl/m4/environ.m4
@@ -1,10 +1,10 @@
-# environ.m4 serial 2
+# environ.m4 serial 3
 dnl Copyright (C) 2001-2004, 2006-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
-AC_DEFUN([gl_ENVIRON],
+AC_DEFUN_ONCE([gl_ENVIRON],
 [
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
   dnl Persuade glibc <unistd.h> to declare environ.
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index c3a876f..75f4813 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -69,7 +69,7 @@ AC_DEFUN([gl_INIT],
        m4_defn([m4_PACKAGE_VERSION])), [1], [],
         [AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
        [GNUmakefile=$GNUmakefile])])
-  gl_PMCCABE2HTML
+  AC_PATH_PROG([PMCCABE], [pmccabe], [false])
   AC_CHECK_DECLS([program_invocation_name], [], [], [#include <errno.h>])
   AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include <errno.h>])
   gl_STDARG_H
@@ -122,8 +122,12 @@ AC_DEFUN([gl_INIT],
   gl_FUNC_ALLOCA
   gl_ENVIRON
   gl_UNISTD_MODULE_INDICATOR([environ])
+  gl_FUNC_MALLOC_POSIX
+  gl_STDLIB_MODULE_INDICATOR([malloc-posix])
   gl_MALLOCA
   gl_MULTIARCH
+  gl_FUNC_PUTENV
+  gl_STDLIB_MODULE_INDICATOR([putenv])
   gl_FUNC_SETENV
   gl_STDLIB_MODULE_INDICATOR([setenv])
   gl_STDINT_H
@@ -273,10 +277,11 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/gnulib-common.m4
   m4/include_next.m4
   m4/longlong.m4
+  m4/malloc.m4
   m4/malloca.m4
   m4/manywarnings.m4
   m4/multiarch.m4
-  m4/pmccabe2html.m4
+  m4/putenv.m4
   m4/setenv.m4
   m4/stdarg.m4
   m4/stddef_h.m4
@@ -297,12 +302,14 @@ AC_DEFUN([gl_FILE_LIST], [
   tests/test-getopt.h
   tests/test-getopt_long.h
   tests/test-malloca.c
+  tests/test-setenv.c
   tests/test-stddef.c
   tests/test-stdint.c
   tests/test-stdlib.c
   tests/test-strerror.c
   tests/test-string.c
   tests/test-unistd.c
+  tests/test-unsetenv.c
   tests/test-update-copyright.sh
   tests/test-vc-list-files-cvs.sh
   tests/test-vc-list-files-git.sh
@@ -310,9 +317,11 @@ AC_DEFUN([gl_FILE_LIST], [
   tests/test-version-etc.sh
   tests/test-wchar.c
   tests=lib/alloca.in.h
+  tests=lib/malloc.c
   tests=lib/malloca.c
   tests=lib/malloca.h
   tests=lib/malloca.valgrind
+  tests=lib/putenv.c
   tests=lib/setenv.c
   tests=lib/stdint.in.h
   tests=lib/stdlib.in.h
diff --git a/gl/m4/malloc.m4 b/gl/m4/malloc.m4
new file mode 100644
index 0000000..8070171
--- /dev/null
+++ b/gl/m4/malloc.m4
@@ -0,0 +1,41 @@
+# malloc.m4 serial 9
+dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# gl_FUNC_MALLOC_POSIX
+# --------------------
+# Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it
+# fails), and replace malloc if it is not.
+AC_DEFUN([gl_FUNC_MALLOC_POSIX],
+[
+  AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
+  if test $gl_cv_func_malloc_posix = yes; then
+    HAVE_MALLOC_POSIX=1
+    AC_DEFINE([HAVE_MALLOC_POSIX], [1],
+      [Define if the 'malloc' function is POSIX compliant.])
+  else
+    AC_LIBOBJ([malloc])
+    HAVE_MALLOC_POSIX=0
+  fi
+  AC_SUBST([HAVE_MALLOC_POSIX])
+])
+
+# Test whether malloc, realloc, calloc are POSIX compliant,
+# Set gl_cv_func_malloc_posix to yes or no accordingly.
+AC_DEFUN([gl_CHECK_MALLOC_POSIX],
+[
+  AC_CACHE_CHECK([whether malloc, realloc, calloc are POSIX compliant],
+    [gl_cv_func_malloc_posix],
+    [
+      dnl It is too dangerous to try to allocate a large amount of memory:
+      dnl some systems go to their knees when you do that. So assume that
+      dnl all Unix implementations of the function are POSIX compliant.
+      AC_TRY_COMPILE([],
+        [#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+         choke me
+         #endif
+        ], [gl_cv_func_malloc_posix=yes], [gl_cv_func_malloc_posix=no])
+    ])
+])
diff --git a/gl/m4/pmccabe2html.m4 b/gl/m4/pmccabe2html.m4
deleted file mode 100644
index 2985f7c..0000000
--- a/gl/m4/pmccabe2html.m4
+++ /dev/null
@@ -1,14 +0,0 @@
-# pmccabe2html.m4 serial 2
-dnl Copyright (C) 2008, 2009 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Simon Josefsson
-
-# Usage: gl_PMCCABE2HTML([]).
-AC_DEFUN([gl_PMCCABE2HTML],
-[
-  AC_REQUIRE([AC_PROG_AWK])
-  AC_PATH_PROG([PMCCABE], [pmccabe], [false])
-])
diff --git a/gl/m4/putenv.m4 b/gl/m4/putenv.m4
new file mode 100644
index 0000000..120f5a4
--- /dev/null
+++ b/gl/m4/putenv.m4
@@ -0,0 +1,41 @@
+# putenv.m4 serial 16
+dnl Copyright (C) 2002-2009 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Jim Meyering.
+dnl
+dnl Check whether putenv ("FOO") removes FOO from the environment.
+dnl The putenv in libc on at least SunOS 4.1.4 does *not* do that.
+
+AC_DEFUN([gl_FUNC_PUTENV],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_CACHE_CHECK([for putenv compatible with GNU and SVID],
+   [gl_cv_func_svid_putenv],
+   [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],[[
+    /* Put it in env.  */
+    if (putenv ("CONFTEST_putenv=val"))
+      return 1;
+
+    /* Try to remove it.  */
+    if (putenv ("CONFTEST_putenv"))
+      return 1;
+
+    /* Make sure it was deleted.  */
+    if (getenv ("CONFTEST_putenv") != 0)
+      return 1;
+
+    return 0;
+             ]])],
+            gl_cv_func_svid_putenv=yes,
+            gl_cv_func_svid_putenv=no,
+            dnl When crosscompiling, assume putenv is broken.
+            gl_cv_func_svid_putenv=no)
+   ])
+  if test $gl_cv_func_svid_putenv = no; then
+    REPLACE_PUTENV=1
+    AC_LIBOBJ([putenv])
+  fi
+])
diff --git a/gl/m4/setenv.m4 b/gl/m4/setenv.m4
index e28407e..a5df034 100644
--- a/gl/m4/setenv.m4
+++ b/gl/m4/setenv.m4
@@ -1,4 +1,4 @@
-# setenv.m4 serial 11
+# setenv.m4 serial 13
 dnl Copyright (C) 2001-2004, 2006-2009 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,12 +6,9 @@ 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_REQUIRE([gl_FUNC_SETENV_SEPARATE])
+  if test $HAVE_SETENV$REPLACE_SETENV != 10; then
     AC_LIBOBJ([setenv])
-    gl_PREREQ_SETENV
   fi
 ])
 
@@ -22,6 +19,24 @@ AC_DEFUN([gl_FUNC_SETENV_SEPARATE],
   AC_CHECK_FUNCS_ONCE([setenv])
   if test $ac_cv_func_setenv = no; then
     HAVE_SETENV=0
+  else
+    AC_CACHE_CHECK([whether setenv validates arguments],
+      [gl_cv_func_setenv_works],
+      [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+       #include <stdlib.h>
+       #include <errno.h>
+      ]], [[
+       if (setenv (NULL, "", 0) != -1) return 1;
+       if (errno != EINVAL) return 2;
+       if (setenv ("a", "=", 1) != 0) return 3;
+       if (strcmp (getenv ("a"), "=") != 0) return 4;
+      ]])],
+      [gl_cv_func_setenv_works=yes], [gl_cv_func_setenv_works=no],
+      [gl_cv_func_setenv_works="guessing no"])])
+    if test "$gl_cv_func_setenv_works" != yes; then
+      REPLACE_SETENV=1
+      AC_LIBOBJ([setenv])
+    fi
   fi
   gl_PREREQ_SETENV
 ])
@@ -35,6 +50,7 @@ AC_DEFUN([gl_FUNC_UNSETENV],
     AC_LIBOBJ([unsetenv])
     gl_PREREQ_UNSETENV
   else
+    dnl Some BSDs return void, failing to do error checking.
     AC_CACHE_CHECK([for unsetenv() return type], [gt_cv_func_unsetenv_ret],
       [AC_TRY_COMPILE([#include <stdlib.h>
 extern
@@ -48,7 +64,30 @@ int unsetenv();
 #endif
 ], , gt_cv_func_unsetenv_ret='int', gt_cv_func_unsetenv_ret='void')])
     if test $gt_cv_func_unsetenv_ret = 'void'; then
-      VOID_UNSETENV=1
+      AC_DEFINE([VOID_UNSETENV], [1], [Define to 1 if unsetenv returns void
+       instead of int.])
+      REPLACE_UNSETENV=1
+      AC_LIBOBJ([unsetenv])
+    fi
+
+    dnl Solaris 10 unsetenv does not remove all copies of a name.
+    AC_CACHE_CHECK([whether unsetenv works on duplicates],
+      [gl_cv_func_unsetenv_works],
+      [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+       #include <stdlib.h>
+      ]], [[
+       char entry[] = "b=2";
+       if (putenv ("a=1")) return 1;
+       if (putenv (entry)) return 2;
+       entry[0] = 'a';
+       unsetenv ("a");
+       if (getenv ("a")) return 3;
+      ]])],
+      [gl_cv_func_unsetenv_works=yes], [gl_cv_func_unsetenv_works=no],
+      [gl_cv_func_unsetenv_works="guessing no"])])
+    if test "$gl_cv_func_unsetenv_works" != yes; then
+      REPLACE_UNSETENV=1
+      AC_LIBOBJ([unsetenv])
     fi
   fi
 ])
diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4
index 42d551d..10e010e 100644
--- a/gl/m4/stdlib_h.m4
+++ b/gl/m4/stdlib_h.m4
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 20
+# stdlib_h.m4 serial 21
 dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -41,7 +41,9 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   GNULIB_MALLOC_POSIX=0;  AC_SUBST([GNULIB_MALLOC_POSIX])
   GNULIB_MKDTEMP=0;       AC_SUBST([GNULIB_MKDTEMP])
   GNULIB_MKOSTEMP=0;      AC_SUBST([GNULIB_MKOSTEMP])
+  GNULIB_MKOSTEMPS=0;     AC_SUBST([GNULIB_MKOSTEMPS])
   GNULIB_MKSTEMP=0;       AC_SUBST([GNULIB_MKSTEMP])
+  GNULIB_MKSTEMPS=0;      AC_SUBST([GNULIB_MKSTEMPS])
   GNULIB_PUTENV=0;        AC_SUBST([GNULIB_PUTENV])
   GNULIB_RANDOM_R=0;      AC_SUBST([GNULIB_RANDOM_R])
   GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX])
@@ -61,6 +63,8 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   HAVE_MALLOC_POSIX=1;       AC_SUBST([HAVE_MALLOC_POSIX])
   HAVE_MKDTEMP=1;            AC_SUBST([HAVE_MKDTEMP])
   HAVE_MKOSTEMP=1;           AC_SUBST([HAVE_MKOSTEMP])
+  HAVE_MKOSTEMPS=1;          AC_SUBST([HAVE_MKOSTEMPS])
+  HAVE_MKSTEMPS=1;           AC_SUBST([HAVE_MKSTEMPS])
   HAVE_RANDOM_R=1;           AC_SUBST([HAVE_RANDOM_R])
   HAVE_REALLOC_POSIX=1;      AC_SUBST([HAVE_REALLOC_POSIX])
   HAVE_REALPATH=1;           AC_SUBST([HAVE_REALPATH])
@@ -76,6 +80,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   REPLACE_MKSTEMP=0;         AC_SUBST([REPLACE_MKSTEMP])
   REPLACE_PUTENV=0;          AC_SUBST([REPLACE_PUTENV])
   REPLACE_REALPATH=0;        AC_SUBST([REPLACE_REALPATH])
+  REPLACE_SETENV=0;          AC_SUBST([REPLACE_SETENV])
   REPLACE_STRTOD=0;          AC_SUBST([REPLACE_STRTOD])
-  VOID_UNSETENV=0;           AC_SUBST([VOID_UNSETENV])
+  REPLACE_UNSETENV=0;        AC_SUBST([REPLACE_UNSETENV])
 ])
diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4
index 5aa39ae..25bdb59 100644
--- a/gl/m4/unistd_h.m4
+++ b/gl/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 31
+# unistd_h.m4 serial 35
 dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -46,6 +46,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   GNULIB_GETCWD=0;           AC_SUBST([GNULIB_GETCWD])
   GNULIB_GETDOMAINNAME=0;    AC_SUBST([GNULIB_GETDOMAINNAME])
   GNULIB_GETDTABLESIZE=0;    AC_SUBST([GNULIB_GETDTABLESIZE])
+  GNULIB_GETGROUPS=0;        AC_SUBST([GNULIB_GETGROUPS])
   GNULIB_GETHOSTNAME=0;      AC_SUBST([GNULIB_GETHOSTNAME])
   GNULIB_GETLOGIN_R=0;       AC_SUBST([GNULIB_GETLOGIN_R])
   GNULIB_GETPAGESIZE=0;      AC_SUBST([GNULIB_GETPAGESIZE])
@@ -65,8 +66,10 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE])
   GNULIB_UNLINK=0;           AC_SUBST([GNULIB_UNLINK])
   GNULIB_UNLINKAT=0;         AC_SUBST([GNULIB_UNLINKAT])
+  GNULIB_USLEEP=0;           AC_SUBST([GNULIB_USLEEP])
   GNULIB_WRITE=0;            AC_SUBST([GNULIB_WRITE])
   dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_CHOWN=1;           AC_SUBST([HAVE_CHOWN])
   HAVE_DUP2=1;            AC_SUBST([HAVE_DUP2])
   HAVE_DUP3=1;            AC_SUBST([HAVE_DUP3])
   HAVE_EUIDACCESS=1;      AC_SUBST([HAVE_EUIDACCESS])
@@ -76,9 +79,11 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_FTRUNCATE=1;       AC_SUBST([HAVE_FTRUNCATE])
   HAVE_GETDOMAINNAME=1;   AC_SUBST([HAVE_GETDOMAINNAME])
   HAVE_GETDTABLESIZE=1;   AC_SUBST([HAVE_GETDTABLESIZE])
+  HAVE_GETGROUPS=1;       AC_SUBST([HAVE_GETGROUPS])
   HAVE_GETHOSTNAME=1;     AC_SUBST([HAVE_GETHOSTNAME])
   HAVE_GETPAGESIZE=1;     AC_SUBST([HAVE_GETPAGESIZE])
   HAVE_GETUSERSHELL=1;    AC_SUBST([HAVE_GETUSERSHELL])
+  HAVE_LCHOWN=1;          AC_SUBST([HAVE_LCHOWN])
   HAVE_LINK=1;            AC_SUBST([HAVE_LINK])
   HAVE_LINKAT=1;          AC_SUBST([HAVE_LINKAT])
   HAVE_PIPE2=1;           AC_SUBST([HAVE_PIPE2])
@@ -92,6 +97,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_OS_H=0;            AC_SUBST([HAVE_OS_H])
   HAVE_SYS_PARAM_H=0;     AC_SUBST([HAVE_SYS_PARAM_H])
   HAVE_UNLINKAT=1;        AC_SUBST([HAVE_UNLINKAT])
+  HAVE_USLEEP=1;          AC_SUBST([HAVE_USLEEP])
   REPLACE_CHOWN=0;        AC_SUBST([REPLACE_CHOWN])
   REPLACE_CLOSE=0;        AC_SUBST([REPLACE_CLOSE])
   REPLACE_DUP=0;          AC_SUBST([REPLACE_DUP])
@@ -99,6 +105,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   REPLACE_FCHDIR=0;       AC_SUBST([REPLACE_FCHDIR])
   REPLACE_FCHOWNAT=0;     AC_SUBST([REPLACE_FCHOWNAT])
   REPLACE_GETCWD=0;       AC_SUBST([REPLACE_GETCWD])
+  REPLACE_GETGROUPS=0;    AC_SUBST([REPLACE_GETGROUPS])
   REPLACE_GETPAGESIZE=0;  AC_SUBST([REPLACE_GETPAGESIZE])
   REPLACE_LCHOWN=0;       AC_SUBST([REPLACE_LCHOWN])
   REPLACE_LINK=0;         AC_SUBST([REPLACE_LINK])
@@ -109,6 +116,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   REPLACE_SYMLINK=0;      AC_SUBST([REPLACE_SYMLINK])
   REPLACE_UNLINK=0;       AC_SUBST([REPLACE_UNLINK])
   REPLACE_UNLINKAT=0;     AC_SUBST([REPLACE_UNLINKAT])
+  REPLACE_USLEEP=0;       AC_SUBST([REPLACE_USLEEP])
   REPLACE_WRITE=0;        AC_SUBST([REPLACE_WRITE])
   UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H])
   UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0;
diff --git a/gl/unistd.in.h b/gl/unistd.in.h
index c755467..1bf5633 100644
--- a/gl/unistd.in.h
+++ b/gl/unistd.in.h
@@ -126,18 +126,16 @@ extern "C" {
 
 #if @GNULIB_CHOWN@
 # if @REPLACE_CHOWN@
-#  ifndef REPLACE_CHOWN
-#   define REPLACE_CHOWN 1
-#  endif
-#  if REPLACE_CHOWN
+#  undef chown
+#  define chown rpl_chown
+# endif
+# if address@hidden@ || @REPLACE_CHOWN@
 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
    to GID (if GID is not -1).  Follow symbolic links.
    Return 0 if successful, otherwise -1 and errno set.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/chown.html>.  */
-#   define chown rpl_chown
 extern int chown (const char *file, uid_t uid, gid_t gid);
-#  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef chown
@@ -406,6 +404,28 @@ extern int getdtablesize (void);
 #endif
 
 
+#if @GNULIB_GETGROUPS@
+# if @REPLACE_GETGROUPS@
+#  undef getgroups
+#  define getgroups rpl_getgroups
+# endif
+# if address@hidden@ || @REPLACE_GETGROUPS@
+/* Return the supplemental groups that the current process belongs to.
+   It is unspecified whether the effective group id is in the list.
+   If N is 0, return the group count; otherwise, N describes how many
+   entries are available in GROUPS.  Return -1 and set errno if N is
+   not 0 and not large enough.  Fails with ENOSYS on some systems.  */
+int getgroups (int n, gid_t *groups);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getgroups
+# define getgroups(n,g)                                                 \
+    (GL_LINK_WARNING ("getgroups is unportable - "                      \
+                      "use gnulib module getgroups for portability"),   \
+     getgroups (n, g))
+#endif
+
+
 #if @GNULIB_GETHOSTNAME@
 /* Return the standard host name of the machine.
    WARNING! The host name may or may not be fully qualified.
@@ -545,12 +565,15 @@ extern void endusershell (void);
 
 #if @GNULIB_LCHOWN@
 # if @REPLACE_LCHOWN@
+#  undef lchown
+#  define lchown rpl_lchown
+# endif
+# if address@hidden@ || @REPLACE_LCHOWN@
 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
    to GID (if GID is not -1).  Do not follow symbolic links.
    Return 0 if successful, otherwise -1 and errno set.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/lchown.html>.  */
-#  define lchown rpl_lchown
 extern int lchown (char const *file, uid_t owner, gid_t group);
 # endif
 #elif defined GNULIB_POSIXCHECK
@@ -769,6 +792,27 @@ extern int unlinkat (int fd, char const *file, int flag);
 #endif
 
 
+#if @GNULIB_USLEEP@
+# if @REPLACE_USLEEP@
+#  undef usleep
+#  define usleep rpl_usleep
+# endif
+# if address@hidden@ || @REPLACE_USLEEP@
+/* Pause the execution of the current thread for N microseconds.
+   Returns 0 on completion, or -1 on range error.
+   See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/sleep.html>.  */
+extern int usleep (useconds_t n);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef usleep
+# define usleep(n) \
+    (GL_LINK_WARNING ("usleep is unportable - " \
+                      "use gnulib module usleep for portability"), \
+     usleep (n))
+#endif
+
+
 #if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
 /* Write up to COUNT bytes starting at BUF to file descriptor FD.
    See the POSIX:2001 specification
diff --git a/gl/version-etc.c b/gl/version-etc.c
index a580140..bf67c37 100644
--- a/gl/version-etc.c
+++ b/gl/version-etc.c
@@ -236,13 +236,17 @@ emit_bug_reporting_address (void)
      for this package.  Please add _another line_ saying
      "Report translation bugs to <...>\n" with the address for translation
      bugs (typically your translation team's web or email address).  */
-  printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
+  printf (_("\nReport bugs to: %s\n"), PACKAGE_BUGREPORT);
 #ifdef PACKAGE_PACKAGER_BUG_REPORTS
-  printf (_("Report %s bugs to <%s>.\n"), PACKAGE_PACKAGER,
+  printf (_("Report %s bugs to: %s\n"), PACKAGE_PACKAGER,
          PACKAGE_PACKAGER_BUG_REPORTS);
 #endif
-  printf (_("%s home page: <http://www.gnu.org/software/%s/>.\n"),
+#ifdef PACKAGE_URL
+  printf (_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
+#else
+  printf (_("%s home page: <http://www.gnu.org/software/%s/>\n"),
          PACKAGE_NAME, PACKAGE);
-  fputs (_("General help using GNU software: 
<http://www.gnu.org/gethelp/>.\n"),
+#endif
+  fputs (_("General help using GNU software: <http://www.gnu.org/gethelp/>\n"),
         stdout);
 }
diff --git a/gltests/Makefile.am b/gltests/Makefile.am
index f525397..a4a4611 100644
--- a/gltests/Makefile.am
+++ b/gltests/Makefile.am
@@ -14,6 +14,7 @@ AUTOMAKE_OPTIONS = 1.5 foreign
 
 SUBDIRS =
 TESTS =
+XFAIL_TESTS =
 TESTS_ENVIRONMENT =
 noinst_PROGRAMS =
 check_PROGRAMS =
@@ -104,6 +105,15 @@ EXTRA_DIST += $(top_srcdir)/build-aux/link-warning.h
 
 ## end   gnulib module link-warning
 
+## begin gnulib module malloc-posix
+
+
+EXTRA_DIST += malloc.c
+
+EXTRA_libtests_a_SOURCES += malloc.c
+
+## end   gnulib module malloc-posix
+
 ## begin gnulib module malloca
 
 libtests_a_SOURCES += malloca.c
@@ -121,6 +131,15 @@ EXTRA_DIST += test-malloca.c
 
 ## end   gnulib module malloca-tests
 
+## begin gnulib module putenv
+
+
+EXTRA_DIST += putenv.c
+
+EXTRA_libtests_a_SOURCES += putenv.c
+
+## end   gnulib module putenv
+
 ## begin gnulib module setenv
 
 
@@ -130,6 +149,14 @@ EXTRA_libtests_a_SOURCES += setenv.c
 
 ## end   gnulib module setenv
 
+## begin gnulib module setenv-tests
+
+TESTS += test-setenv
+check_PROGRAMS += test-setenv
+EXTRA_DIST += test-setenv.c
+
+## end   gnulib module setenv-tests
+
 ## begin gnulib module stddef-tests
 
 TESTS += test-stddef
@@ -210,7 +237,9 @@ stdlib.h: stdlib.in.h
              -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \
              -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
              -e 's|@''GNULIB_MKOSTEMP''@|$(GNULIB_MKOSTEMP)|g' \
+             -e 's|@''GNULIB_MKOSTEMPS''@|$(GNULIB_MKOSTEMPS)|g' \
              -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
+             -e 's|@''GNULIB_MKSTEMPS''@|$(GNULIB_MKSTEMPS)|g' \
              -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \
              -e 's|@''GNULIB_RANDOM_R''@|$(GNULIB_RANDOM_R)|g' \
              -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \
@@ -229,6 +258,8 @@ stdlib.h: stdlib.in.h
              -e 's|@''HAVE_MALLOC_POSIX''@|$(HAVE_MALLOC_POSIX)|g' \
              -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
              -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \
+             -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \
+             -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \
              -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
              -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
              -e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \
@@ -245,8 +276,9 @@ stdlib.h: stdlib.in.h
              -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
              -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
              -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
+             -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
              -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
-             -e 's|@''VOID_UNSETENV''@|$(VOID_UNSETENV)|g' \
+             -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              < $(srcdir)/stdlib.in.h; \
        } > address@hidden && \
@@ -301,6 +333,14 @@ EXTRA_libtests_a_SOURCES += unsetenv.c
 
 ## end   gnulib module unsetenv
 
+## begin gnulib module unsetenv-tests
+
+TESTS += test-unsetenv
+check_PROGRAMS += test-unsetenv
+EXTRA_DIST += test-unsetenv.c
+
+## end   gnulib module unsetenv-tests
+
 ## begin gnulib module update-copyright-tests
 
 TESTS += test-update-copyright.sh
diff --git a/gltests/malloc.c b/gltests/malloc.c
new file mode 100644
index 0000000..f2f6663
--- /dev/null
+++ b/gltests/malloc.c
@@ -0,0 +1,57 @@
+/* malloc() function that is glibc compatible.
+
+   Copyright (C) 1997, 1998, 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
+   the Free Software Foundation; either version 3, 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, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/* written by Jim Meyering and Bruno Haible */
+
+#include <config.h>
+/* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h.  */
+#ifdef malloc
+# define NEED_MALLOC_GNU
+# undef malloc
+#endif
+
+/* Specification.  */
+#include <stdlib.h>
+
+#include <errno.h>
+
+/* Call the system's malloc below.  */
+#undef malloc
+
+/* Allocate an N-byte block of memory from the heap.
+   If N is zero, allocate a 1-byte block.  */
+
+void *
+rpl_malloc (size_t n)
+{
+  void *result;
+
+#ifdef NEED_MALLOC_GNU
+  if (n == 0)
+    n = 1;
+#endif
+
+  result = malloc (n);
+
+#if !HAVE_MALLOC_POSIX
+  if (result == NULL)
+    errno = ENOMEM;
+#endif
+
+  return result;
+}
diff --git a/gltests/putenv.c b/gltests/putenv.c
new file mode 100644
index 0000000..cc14b93
--- /dev/null
+++ b/gltests/putenv.c
@@ -0,0 +1,132 @@
+/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2008
+   Free Software Foundation, Inc.
+
+   NOTE: The canonical source of this file is maintained with the GNU C
+   Library.  Bugs can be reported to address@hidden
+
+   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 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/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdlib.h>
+
+#include <stddef.h>
+
+/* Include errno.h *after* sys/types.h to work around header problems
+   on AIX 3.2.5.  */
+#include <errno.h>
+#ifndef __set_errno
+# define __set_errno(ev) ((errno) = (ev))
+#endif
+
+#include <string.h>
+#include <unistd.h>
+
+#if HAVE_GNU_LD
+# define environ __environ
+#else
+extern char **environ;
+#endif
+
+#if _LIBC
+/* This lock protects against simultaneous modifications of `environ'.  */
+# include <bits/libc-lock.h>
+__libc_lock_define_initialized (static, envlock)
+# define LOCK  __libc_lock_lock (envlock)
+# define UNLOCK        __libc_lock_unlock (envlock)
+#else
+# define LOCK
+# define UNLOCK
+#endif
+
+static int
+_unsetenv (const char *name)
+{
+  size_t len;
+  char **ep;
+
+  if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  len = strlen (name);
+
+  LOCK;
+
+  ep = environ;
+  while (*ep != NULL)
+    if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
+      {
+       /* Found it.  Remove this pointer by moving later ones back.  */
+       char **dp = ep;
+
+       do
+         dp[0] = dp[1];
+       while (*dp++);
+       /* Continue the loop in case NAME appears again.  */
+      }
+    else
+      ++ep;
+
+  UNLOCK;
+
+  return 0;
+}
+
+
+/* Put STRING, which is of the form "NAME=VALUE", in the environment.
+   If STRING contains no `=', then remove STRING from the environment.  */
+int
+putenv (char *string)
+{
+  const char *const name_end = strchr (string, '=');
+  register size_t size;
+  register char **ep;
+
+  if (name_end == NULL)
+    {
+      /* Remove the variable from the environment.  */
+      return _unsetenv (string);
+    }
+
+  size = 0;
+  for (ep = environ; *ep != NULL; ++ep)
+    if (!strncmp (*ep, string, name_end - string) &&
+       (*ep)[name_end - string] == '=')
+      break;
+    else
+      ++size;
+
+  if (*ep == NULL)
+    {
+      static char **last_environ = NULL;
+      char **new_environ = (char **) malloc ((size + 2) * sizeof (char *));
+      if (new_environ == NULL)
+       return -1;
+      (void) memcpy ((void *) new_environ, (void *) environ,
+                    size * sizeof (char *));
+      new_environ[size] = (char *) string;
+      new_environ[size + 1] = NULL;
+      free (last_environ);
+      last_environ = new_environ;
+      environ = new_environ;
+    }
+  else
+    *ep = string;
+
+  return 0;
+}
diff --git a/gltests/setenv.c b/gltests/setenv.c
index 83b52b8..0df5b21 100644
--- a/gltests/setenv.c
+++ b/gltests/setenv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992,1995-1999,2000-2003,2005-2008 Free Software Foundation, 
Inc.
+/* Copyright (C) 1992,1995-1999,2000-2003,2005-2009 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
@@ -32,12 +32,12 @@
 # include <unistd.h>
 #endif
 
-#if _LIBC || !HAVE_SETENV
-
 #if !_LIBC
 # include "malloca.h"
 #endif
 
+#if _LIBC || !HAVE_SETENV
+
 #if !_LIBC
 # define __environ     environ
 #endif
@@ -281,6 +281,12 @@ __add_to_environ (const char *name, const char *value, 
const char *combined,
 int
 setenv (const char *name, const char *value, int replace)
 {
+  if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
   return __add_to_environ (name, value, NULL, replace);
 }
 
@@ -328,3 +334,45 @@ weak_alias (__clearenv, clearenv)
 #endif
 
 #endif /* _LIBC || !HAVE_SETENV */
+
+/* The rest of this file is called into use when replacing an existing
+   but buggy setenv.  Known bugs include failure to diagnose invalid
+   name, and consuming a leading '=' from value.  */
+#if HAVE_SETENV
+
+# undef setenv
+# define STREQ(a, b) (strcmp (a, b) == 0)
+
+int
+rpl_setenv (const char *name, const char *value, int replace)
+{
+  int result;
+  if (!name || !*name || strchr (name, '='))
+    {
+      errno = EINVAL;
+      return -1;
+    }
+  /* Call the real setenv even if replace is 0, in case implementation
+     has underlying data to update, such as when environ changes.  */
+  result = setenv (name, value, replace);
+  if (result == 0 && replace && *value == '=')
+    {
+      char *tmp = getenv (name);
+      if (!STREQ (tmp, value))
+        {
+          int saved_errno;
+          size_t len = strlen (value);
+          tmp = malloca (len + 2);
+          /* Since leading '=' is eaten, double it up.  */
+          *tmp = '=';
+          memcpy (tmp + 1, value, len + 1);
+          result = setenv (name, tmp, replace);
+          saved_errno = errno;
+          freea (tmp);
+          errno = saved_errno;
+        }
+    }
+  return result;
+}
+
+#endif /* HAVE_SETENV */
diff --git a/gltests/stdlib.in.h b/gltests/stdlib.in.h
index 7a9246a..dd15ac0 100644
--- a/gltests/stdlib.in.h
+++ b/gltests/stdlib.in.h
@@ -224,6 +224,31 @@ extern int mkostemp (char * /*template*/, int /*flags*/);
      mkostemp (t, f))
 #endif
 
+#if @GNULIB_MKOSTEMPS@
+# if address@hidden@
+/* Create a unique temporary file from TEMPLATE.
+   The last six characters of TEMPLATE before a suffix of length
+   SUFFIXLEN must be "XXXXXX";
+   they are replaced with a string that makes the file name unique.
+   The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
+   and O_TEXT, O_BINARY (defined in "binary-io.h").
+   The file is then created, with the specified flags, ensuring it didn't exist
+   before.
+   The file is created read-write (mask at least 0600 & ~umask), but it may be
+   world-readable and world-writable (mask 0666 & ~umask), depending on the
+   implementation.
+   Returns the open file descriptor if successful, otherwise -1 and errno
+   set.  */
+extern int mkostemps (char * /*template*/, int /*suffixlen*/, int /*flags*/);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mkostemps
+# define mkostemps(t,s,f)                          \
+    (GL_LINK_WARNING ("mkostemps is unportable - " \
+                      "use gnulib module mkostemps for portability"), \
+     mkostemps (t, s, f))
+#endif
+
 #if @GNULIB_MKSTEMP@
 # if @REPLACE_MKSTEMP@
 /* Create a unique temporary file from TEMPLATE.
@@ -249,6 +274,28 @@ extern int mkstemp (char * /*template*/);
      mkstemp (t))
 #endif
 
+#if @GNULIB_MKSTEMPS@
+# if address@hidden@
+/* Create a unique temporary file from TEMPLATE.
+   The last six characters of TEMPLATE prior to a suffix of length
+   SUFFIXLEN must be "XXXXXX";
+   they are replaced with a string that makes the file name unique.
+   The file is then created, ensuring it didn't exist before.
+   The file is created read-write (mask at least 0600 & ~umask), but it may be
+   world-readable and world-writable (mask 0666 & ~umask), depending on the
+   implementation.
+   Returns the open file descriptor if successful, otherwise -1 and errno
+   set.  */
+extern int mkstemps (char * /*template*/, int /*suffixlen*/);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mkstemps
+# define mkstemps(t,s)                             \
+    (GL_LINK_WARNING ("mkstemps is unportable - " \
+                      "use gnulib module mkstemps for portability"), \
+     mkstemps (t, s))
+#endif
+
 #if @GNULIB_PUTENV@
 # if @REPLACE_PUTENV@
 #  undef putenv
@@ -337,11 +384,21 @@ extern int rpmatch (const char *response);
 #endif
 
 #if @GNULIB_SETENV@
-# if address@hidden@
+# if @REPLACE_SETENV@
+#  undef setenv
+#  define setenv rpl_setenv
+# endif
+# if address@hidden@ || @REPLACE_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
+#elif defined GNULIB_POSIXCHECK
+# undef setenv
+# define setenv(n,v,o)                                                  \
+    (GL_LINK_WARNING ("setenv is unportable - "                         \
+                      "use gnulib module setenv for portability"),      \
+     setenv (n, v, o))
 #endif
 
 #if @GNULIB_STRTOD@
@@ -401,16 +458,20 @@ extern unsigned long long strtoull (const char *string, 
char **endptr, int base)
 #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
+# if @REPLACE_UNSETENV@
+#  undef unsetenv
+#  define unsetenv rpl_unsetenv
+# endif
+# if address@hidden@ || @REPLACE_UNSETENV@
 /* Remove the variable NAME from the environment.  */
 extern int unsetenv (const char *name);
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef unsetenv
+# define unsetenv(n)                                                    \
+    (GL_LINK_WARNING ("unsetenv is unportable - "                       \
+                      "use gnulib module unsetenv for portability"),    \
+     unsetenv (n))
 #endif
 
 #ifdef __cplusplus
diff --git a/gltests/test-getopt.c b/gltests/test-getopt.c
index 12d8d92..6c59d47 100644
--- a/gltests/test-getopt.c
+++ b/gltests/test-getopt.c
@@ -53,7 +53,7 @@
 #endif
 
 int
-main ()
+main (void)
 {
   unsetenv ("POSIXLY_CORRECT");
 
diff --git a/gltests/test-getopt.h b/gltests/test-getopt.h
index 352fe32..4efec4b 100644
--- a/gltests/test-getopt.h
+++ b/gltests/test-getopt.h
@@ -17,7 +17,7 @@
 /* Written by Bruno Haible <address@hidden>, 2009.  */
 
 static void
-getopt_loop (int argc, char **argv,
+getopt_loop (int argc, const char **argv,
             const char *options,
             int *a_seen, int *b_seen,
             const char **p_value, const char **q_value,
@@ -27,7 +27,7 @@ getopt_loop (int argc, char **argv,
   int c;
 
   opterr = 0;
-  while ((c = getopt (argc, argv, options)) != -1)
+  while ((c = getopt (argc, (char **) argv, options)) != -1)
     {
       switch (c)
        {
@@ -74,7 +74,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-a";
@@ -102,7 +102,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-b";
@@ -131,7 +131,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-ba";
@@ -159,7 +159,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-ab";
@@ -190,7 +190,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-pfoo";
@@ -217,7 +217,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-p";
@@ -245,7 +245,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-ab";
@@ -278,7 +278,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-pfoo";
@@ -305,7 +305,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-p";
@@ -333,7 +333,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-p";
@@ -364,7 +364,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-p";
@@ -396,7 +396,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "donald";
@@ -458,7 +458,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[20];
+      const char *argv[20];
 
       argv[argc++] = "program";
       argv[argc++] = "donald";
@@ -536,7 +536,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "donald";
@@ -579,7 +579,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[20];
+      const char *argv[20];
 
       argv[argc++] = "program";
       argv[argc++] = "donald";
@@ -650,7 +650,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "donald";
@@ -713,7 +713,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "donald";
@@ -751,7 +751,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "-+";
@@ -779,7 +779,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[20];
+      const char *argv[20];
 
       argv[argc++] = "program";
       argv[argc++] = "donald";
@@ -829,7 +829,7 @@ test_getopt (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
 
       argv[argc++] = "program";
       argv[argc++] = "donald";
diff --git a/gltests/test-getopt_long.h b/gltests/test-getopt_long.h
index fb505b2..d0d16fa 100644
--- a/gltests/test-getopt_long.h
+++ b/gltests/test-getopt_long.h
@@ -41,7 +41,7 @@ static const struct option long_options_optional[] =
   };
 
 static void
-getopt_long_loop (int argc, char **argv,
+getopt_long_loop (int argc, const char **argv,
                  const char *options, const struct option *long_options,
                  const char **p_value, const char **q_value,
                  int *non_options_count, const char **non_options,
@@ -51,7 +51,8 @@ getopt_long_loop (int argc, char **argv,
   int c;
 
   opterr = 0;
-  while ((c = getopt_long (argc, argv, options, long_options, &option_index))
+  while ((c = getopt_long (argc, (char **) argv, options, long_options,
+                          &option_index))
         != -1)
     {
       switch (c)
@@ -86,6 +87,16 @@ getopt_long_loop (int argc, char **argv,
     }
 }
 
+/* Reduce casting, so we can use string literals elsewhere.
+   getopt_long takes an array of char*, but luckily does not modify
+   those elements, so we can pass const char*.  */
+static int
+do_getopt_long (int argc, const char **argv, const char *shortopts,
+                const struct option *longopts, int *longind)
+{
+  return getopt_long (argc, (char **) argv, shortopts, longopts, longind);
+}
+
 static void
 test_getopt_long (void)
 {
@@ -94,7 +105,7 @@ test_getopt_long (void)
   /* Test disambiguation of options.  */
   {
     int argc = 0;
-    char *argv[10];
+    const char *argv[10];
     int option_index;
     int c;
 
@@ -102,13 +113,13 @@ test_getopt_long (void)
     argv[argc++] = "--x";
     optind = 1;
     opterr = 0;
-    c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    c = do_getopt_long (argc, argv, "ab", long_options_required, 
&option_index);
     ASSERT (c == '?');
     ASSERT (optopt == 0);
   }
   {
     int argc = 0;
-    char *argv[10];
+    const char *argv[10];
     int option_index;
     int c;
 
@@ -116,13 +127,13 @@ test_getopt_long (void)
     argv[argc++] = "--xt";
     optind = 1;
     opterr = 0;
-    c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    c = do_getopt_long (argc, argv, "ab", long_options_required, 
&option_index);
     ASSERT (c == '?');
     ASSERT (optopt == 0);
   }
   {
     int argc = 0;
-    char *argv[10];
+    const char *argv[10];
     int option_index;
     int c;
 
@@ -130,13 +141,13 @@ test_getopt_long (void)
     argv[argc++] = "--xtr";
     optind = 1;
     opterr = 0;
-    c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    c = do_getopt_long (argc, argv, "ab", long_options_required, 
&option_index);
     ASSERT (c == '?');
     ASSERT (optopt == 0);
   }
   {
     int argc = 0;
-    char *argv[10];
+    const char *argv[10];
     int option_index;
     int c;
 
@@ -144,12 +155,12 @@ test_getopt_long (void)
     argv[argc++] = "--xtra";
     optind = 1;
     opterr = 0;
-    c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    c = do_getopt_long (argc, argv, "ab", long_options_required, 
&option_index);
     ASSERT (c == 1001);
   }
   {
     int argc = 0;
-    char *argv[10];
+    const char *argv[10];
     int option_index;
     int c;
 
@@ -157,13 +168,13 @@ test_getopt_long (void)
     argv[argc++] = "--xtre";
     optind = 1;
     opterr = 0;
-    c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    c = do_getopt_long (argc, argv, "ab", long_options_required, 
&option_index);
     ASSERT (c == '?');
     ASSERT (optopt == 0);
   }
   {
     int argc = 0;
-    char *argv[10];
+    const char *argv[10];
     int option_index;
     int c;
 
@@ -171,13 +182,13 @@ test_getopt_long (void)
     argv[argc++] = "--xtrem";
     optind = 1;
     opterr = 0;
-    c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    c = do_getopt_long (argc, argv, "ab", long_options_required, 
&option_index);
     ASSERT (c == '?');
     ASSERT (optopt == 0);
   }
   {
     int argc = 0;
-    char *argv[10];
+    const char *argv[10];
     int option_index;
     int c;
 
@@ -185,12 +196,12 @@ test_getopt_long (void)
     argv[argc++] = "--xtreme";
     optind = 1;
     opterr = 0;
-    c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    c = do_getopt_long (argc, argv, "ab", long_options_required, 
&option_index);
     ASSERT (c == 1002);
   }
   {
     int argc = 0;
-    char *argv[10];
+    const char *argv[10];
     int option_index;
     int c;
 
@@ -198,12 +209,12 @@ test_getopt_long (void)
     argv[argc++] = "--xtremel";
     optind = 1;
     opterr = 0;
-    c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    c = do_getopt_long (argc, argv, "ab", long_options_required, 
&option_index);
     ASSERT (c == 1003);
   }
   {
     int argc = 0;
-    char *argv[10];
+    const char *argv[10];
     int option_index;
     int c;
 
@@ -211,7 +222,7 @@ test_getopt_long (void)
     argv[argc++] = "--xtremely";
     optind = 1;
     opterr = 0;
-    c = getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    c = do_getopt_long (argc, argv, "ab", long_options_required, 
&option_index);
     ASSERT (c == 1003);
   }
 
@@ -224,7 +235,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -252,7 +263,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -281,7 +292,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -309,7 +320,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -340,7 +351,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -367,7 +378,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -395,7 +406,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -427,7 +438,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -454,7 +465,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -482,7 +493,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -512,7 +523,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -544,7 +555,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -584,7 +595,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[20];
+      const char *argv[20];
       a_seen = 0;
       b_seen = 0;
 
@@ -634,7 +645,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -677,7 +688,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[20];
+      const char *argv[20];
       a_seen = 0;
       b_seen = 0;
 
@@ -747,7 +758,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -788,7 +799,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -826,7 +837,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -854,7 +865,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[20];
+      const char *argv[20];
       a_seen = 0;
       b_seen = 0;
 
@@ -904,7 +915,7 @@ test_getopt_long (void)
       const char *non_options[10];
       int unrecognized = 0;
       int argc = 0;
-      char *argv[10];
+      const char *argv[10];
       a_seen = 0;
       b_seen = 0;
 
@@ -944,14 +955,14 @@ static void
 test_getopt_long_posix (void)
 {
   int c = 3;
-  char *v[4] = {"test", "-r", "foo", NULL};
-  struct option l[] = {{NULL}};
+  const char *v[4] = {"test", "-r", "foo", NULL};
+  struct option l[] = {{NULL, 0, NULL, 0}};
   int start;
   int result;
   for (start = OPTIND_MIN; start <= 1; start++)
     {
       optind = start;
-      result = getopt_long (c, v, "r::", l, NULL);
+      result = do_getopt_long (c, v, "r::", l, NULL);
     }
   ASSERT (result == 'r');
   ASSERT (optarg == NULL);
diff --git a/gltests/test-setenv.c b/gltests/test-setenv.c
new file mode 100644
index 0000000..61be838
--- /dev/null
+++ b/gltests/test-setenv.c
@@ -0,0 +1,60 @@
+/* Tests of setenv.
+   Copyright (C) 2009 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/>.  */
+
+/* Written by Eric Blake <address@hidden>, 2009.  */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#define ASSERT(expr) \
+  do                                                                         \
+    {                                                                        \
+      if (!(expr))                                                           \
+        {                                                                    \
+          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__);  \
+          fflush (stderr);                                                   \
+          abort ();                                                          \
+        }                                                                    \
+    }                                                                        \
+  while (0)
+
+int
+main (void)
+{
+  /* Test overwriting.  */
+  ASSERT (setenv ("a", "==", -1) == 0);
+  ASSERT (setenv ("a", "2", 0) == 0);
+  ASSERT (strcmp (getenv ("a"), "==") == 0);
+
+  /* Required to fail with EINVAL.  */
+  errno = 0;
+  ASSERT (setenv ("", "", 1) == -1);
+  ASSERT (errno == EINVAL);
+  errno = 0;
+  ASSERT (setenv ("a=b", "", 0) == -1);
+  ASSERT (errno == EINVAL);
+  errno = 0;
+  ASSERT (setenv (NULL, "", 0) == -1);
+  ASSERT (errno == EINVAL);
+
+  return 0;
+}
diff --git a/gltests/test-stddef.c b/gltests/test-stddef.c
index f848498..c0a7515 100644
--- a/gltests/test-stddef.c
+++ b/gltests/test-stddef.c
@@ -32,7 +32,7 @@ size_t c = 2;
 verify (sizeof NULL == sizeof (void *));
 
 int
-main ()
+main (void)
 {
   return 0;
 }
diff --git a/gltests/test-stdint.c b/gltests/test-stdint.c
index a2bf42a..4e9b362 100644
--- a/gltests/test-stdint.c
+++ b/gltests/test-stdint.c
@@ -1,5 +1,5 @@
 /* Test of <stdint.h> substitute.
-   Copyright (C) 2006-2008 Free Software Foundation, Inc.
+   Copyright (C) 2006-2009 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
@@ -354,7 +354,7 @@ verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0);
 
 
 int
-main ()
+main (void)
 {
   return 0;
 }
diff --git a/gltests/test-stdlib.c b/gltests/test-stdlib.c
index ae46ba1..fad5cf4 100644
--- a/gltests/test-stdlib.c
+++ b/gltests/test-stdlib.c
@@ -29,7 +29,7 @@ int exitcode;
 verify (sizeof NULL == sizeof (void *));
 
 int
-main ()
+main (void)
 {
   /* Check that some macros are defined and different integer constants.  */
   switch (exitcode)
diff --git a/gltests/test-strerror.c b/gltests/test-strerror.c
index 3d9814d..27eb969 100644
--- a/gltests/test-strerror.c
+++ b/gltests/test-strerror.c
@@ -1,5 +1,5 @@
 /* Test of strerror() function.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2009 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
@@ -37,7 +37,7 @@
   while (0)
 
 int
-main (int argc, char **argv)
+main (void)
 {
   char *str;
 
diff --git a/gltests/test-string.c b/gltests/test-string.c
index fe53cd9..69df747 100644
--- a/gltests/test-string.c
+++ b/gltests/test-string.c
@@ -27,7 +27,7 @@
 verify (sizeof NULL == sizeof (void *));
 
 int
-main ()
+main (void)
 {
   return 0;
 }
diff --git a/gltests/test-unistd.c b/gltests/test-unistd.c
index 129367b..dd907f4 100644
--- a/gltests/test-unistd.c
+++ b/gltests/test-unistd.c
@@ -50,7 +50,7 @@ intptr_t t8;
 #endif
 
 int
-main ()
+main (void)
 {
   return 0;
 }
diff --git a/gltests/test-unsetenv.c b/gltests/test-unsetenv.c
new file mode 100644
index 0000000..11af82c
--- /dev/null
+++ b/gltests/test-unsetenv.c
@@ -0,0 +1,65 @@
+/* Tests of unsetenv.
+   Copyright (C) 2009 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/>.  */
+
+/* Written by Eric Blake <address@hidden>, 2009.  */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#define ASSERT(expr) \
+  do                                                                         \
+    {                                                                        \
+      if (!(expr))                                                           \
+        {                                                                    \
+          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__);  \
+          fflush (stderr);                                                   \
+          abort ();                                                          \
+        }                                                                    \
+    }                                                                        \
+  while (0)
+
+int
+main (void)
+{
+  char entry[] = "b=2";
+
+  /* Test removal when multiple entries present.  */
+  ASSERT (putenv ("a=1") == 0);
+  ASSERT (putenv (entry) == 0);
+  entry[0] = 'a'; /* Unspecified what getenv("a") would be at this point.  */
+  ASSERT (unsetenv ("a") == 0); /* Both entries will be removed.  */
+  ASSERT (getenv ("a") == NULL);
+  ASSERT (unsetenv ("a") == 0);
+
+  /* Required to fail with EINVAL.  */
+  errno = 0;
+  ASSERT (unsetenv ("") == -1);
+  ASSERT (errno == EINVAL);
+  errno = 0;
+  ASSERT (unsetenv ("a=b") == -1);
+  ASSERT (errno == EINVAL);
+  errno = 0;
+  ASSERT (unsetenv (NULL) == -1);
+  ASSERT (errno == EINVAL);
+
+  return 0;
+}
diff --git a/gltests/test-update-copyright.sh b/gltests/test-update-copyright.sh
index 24574b2..859c75d 100755
--- a/gltests/test-update-copyright.sh
+++ b/gltests/test-update-copyright.sh
@@ -32,7 +32,12 @@ trap 'rm -f $TMP_BASE*' 0 1 2 3 15
 
 TMP=$TMP_BASE
 s=$TMP-script
-printf '#!/usr/bin/perl -pi\ns/a/b/\n' > $s
+cat <<\EOF > $s
+eval '(exit $?0)' && eval 'exec perl -wS -0777 -pi "$0" ${1+"$@"}'
+  & eval 'exec perl -wS -0777 -pi "$0" $argv:q'
+    if 0;
+s/a/b/
+EOF
 chmod a+x $s
 echo a > $TMP-in
 ./$s $TMP-in 2>/dev/null && test b = "`cat $TMP-in 2>/dev/null`" ||
@@ -82,6 +87,7 @@ Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
 # Foundation, Inc.
 EOF
 
+rm -f $TMP.*.bak
 UPDATE_COPYRIGHT_YEAR=2009 \
   update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr
 compare /dev/null $TMP-stdout || exit 1
@@ -124,6 +130,7 @@ Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
 # Foundation, Inc.
 EOF
 
+rm -f $TMP.*.bak
 UPDATE_COPYRIGHT_YEAR=2010 UPDATE_COPYRIGHT_USE_INTERVALS=1 \
   update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr
 compare /dev/null $TMP-stdout || exit 1
@@ -162,6 +169,7 @@ Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
 # Copyright (C) 1990-2005, 2007-2010 Free Software Foundation, Inc.
 EOF
 
+rm -f $TMP.*.bak
 UPDATE_COPYRIGHT_YEAR=2010 UPDATE_COPYRIGHT_FORCE=1 \
   update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr
 compare /dev/null $TMP-stdout || exit 1
diff --git a/gltests/test-version-etc.c b/gltests/test-version-etc.c
index 71cbc8b..9ff97c4 100644
--- a/gltests/test-version-etc.c
+++ b/gltests/test-version-etc.c
@@ -24,7 +24,7 @@
 #define AUTHORS "Sergey Poznyakoff", "Eric Blake"
 
 int
-main (int argc, char **argv)
+main (int argc _UNUSED_PARAMETER_, char **argv)
 {
   set_program_name (argv[0]);
   version_etc (stdout, "test-version-etc", "dummy", "0", AUTHORS,
diff --git a/gltests/test-wchar.c b/gltests/test-wchar.c
index 2866068..2e60bb8 100644
--- a/gltests/test-wchar.c
+++ b/gltests/test-wchar.c
@@ -31,7 +31,7 @@ wint_t b = 'x';
 verify (sizeof NULL == sizeof (void *));
 
 int
-main ()
+main (void)
 {
   return 0;
 }
diff --git a/gltests/unsetenv.c b/gltests/unsetenv.c
index 73ea878..21fb199 100644
--- a/gltests/unsetenv.c
+++ b/gltests/unsetenv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992,1995-1999,2000-2002,2005-2008 Free Software Foundation, 
Inc.
+/* Copyright (C) 1992,1995-1999,2000-2002,2005-2009 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
@@ -47,6 +47,7 @@ __libc_lock_define_initialized (static, envlock)
 # define unsetenv __unsetenv
 #endif
 
+#if _LIBC || !HAVE_UNSETENV
 
 int
 unsetenv (const char *name)
@@ -88,3 +89,28 @@ unsetenv (const char *name)
 # undef unsetenv
 weak_alias (__unsetenv, unsetenv)
 #endif
+
+#else /* HAVE_UNSETENV */
+
+# undef unsetenv
+
+/* Call the underlying unsetenv, in case there is hidden bookkeeping
+   that needs updating beyond just modifying environ.  */
+int
+rpl_unsetenv (const char *name)
+{
+  int result = 0;
+  if (!name || !*name || strchr (name, '='))
+    {
+      errno = EINVAL;
+      return -1;
+    }
+  while (getenv (name))
+# if !VOID_UNSETENV
+    result =
+# endif
+      unsetenv (name);
+  return result;
+}
+
+#endif /* HAVE_UNSETENV */
diff --git a/lib/gltests/Makefile.am b/lib/gltests/Makefile.am
index e72ecd5..a6d6297 100644
--- a/lib/gltests/Makefile.am
+++ b/lib/gltests/Makefile.am
@@ -14,6 +14,7 @@ AUTOMAKE_OPTIONS = 1.5 foreign
 
 SUBDIRS =
 TESTS =
+XFAIL_TESTS =
 TESTS_ENVIRONMENT =
 noinst_PROGRAMS =
 check_PROGRAMS =
diff --git a/lib/gltests/intprops.h b/lib/gltests/intprops.h
index 002161e..325c397 100644
--- a/lib/gltests/intprops.h
+++ b/lib/gltests/intprops.h
@@ -1,6 +1,7 @@
 /* intprops.h -- properties of integer types
 
-   Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 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
@@ -17,37 +18,40 @@
 
 /* Written by Paul Eggert.  */
 
-#include <limits.h>
+#ifndef GL_INTPROPS_H
+# define GL_INTPROPS_H
+
+# include <limits.h>
 
 /* The extra casts in the following macros work around compiler bugs,
    e.g., in Cray C 5.0.3.0.  */
 
 /* True if the arithmetic type T is an integer type.  bool counts as
    an integer.  */
-#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
+# define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
 
 /* True if negative values of the signed integer type T use two's
    complement, ones' complement, or signed magnitude representation,
    respectively.  Much GNU code assumes two's complement, but some
    people like to be portable to all possible C hosts.  */
-#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
-#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
-#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
+# define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
+# define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
+# define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
 
 /* True if the arithmetic type T is signed.  */
-#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
 
 /* The maximum and minimum values for the integer type T.  These
    macros have undefined behavior if T is signed and has padding bits.
    If this is a problem for you, please let us know how to fix it for
    your host.  */
-#define TYPE_MINIMUM(t) \
+# define TYPE_MINIMUM(t) \
   ((t) (! TYPE_SIGNED (t) \
        ? (t) 0 \
        : TYPE_SIGNED_MAGNITUDE (t) \
        ? ~ (t) 0 \
        : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
-#define TYPE_MAXIMUM(t) \
+# define TYPE_MAXIMUM(t) \
   ((t) (! TYPE_SIGNED (t) \
        ? (t) -1 \
        : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
@@ -58,20 +62,22 @@
    tighter bound.  Otherwise, it overestimates the true bound by one byte
    when applied to unsigned types of size 2, 4, 16, ... bytes.
    The symbol signed_type_or_expr__ is private to this header file.  */
-#if __GNUC__ >= 2
-# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t))
-#else
-# define signed_type_or_expr__(t) 1
-#endif
+# if __GNUC__ >= 2
+#  define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t))
+# else
+#  define signed_type_or_expr__(t) 1
+# endif
 
 /* Bound on length of the string representing an integer type or expression T.
    Subtract 1 for the sign bit if T is signed; log10 (2.0) < 146/485;
    add 1 for integer division truncation; add 1 more for a minus sign
    if needed.  */
-#define INT_STRLEN_BOUND(t) \
+# define INT_STRLEN_BOUND(t) \
   ((sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) * 146 / 485 \
    + signed_type_or_expr__ (t) + 1)
 
 /* Bound on buffer size needed to represent an integer type or expression T,
    including the terminating null.  */
-#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
+# define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
+
+#endif /* GL_INTPROPS_H */
diff --git a/lib/gltests/test-stddef.c b/lib/gltests/test-stddef.c
index f848498..c0a7515 100644
--- a/lib/gltests/test-stddef.c
+++ b/lib/gltests/test-stddef.c
@@ -32,7 +32,7 @@ size_t c = 2;
 verify (sizeof NULL == sizeof (void *));
 
 int
-main ()
+main (void)
 {
   return 0;
 }
diff --git a/lib/gltests/test-stdint.c b/lib/gltests/test-stdint.c
index a2bf42a..4e9b362 100644
--- a/lib/gltests/test-stdint.c
+++ b/lib/gltests/test-stdint.c
@@ -1,5 +1,5 @@
 /* Test of <stdint.h> substitute.
-   Copyright (C) 2006-2008 Free Software Foundation, Inc.
+   Copyright (C) 2006-2009 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
@@ -354,7 +354,7 @@ verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0);
 
 
 int
-main ()
+main (void)
 {
   return 0;
 }
diff --git a/lib/gltests/test-string.c b/lib/gltests/test-string.c
index fe53cd9..69df747 100644
--- a/lib/gltests/test-string.c
+++ b/lib/gltests/test-string.c
@@ -27,7 +27,7 @@
 verify (sizeof NULL == sizeof (void *));
 
 int
-main ()
+main (void)
 {
   return 0;
 }
diff --git a/lib/gltests/test-strverscmp.c b/lib/gltests/test-strverscmp.c
index 04da20c..a98695b 100644
--- a/lib/gltests/test-strverscmp.c
+++ b/lib/gltests/test-strverscmp.c
@@ -1,5 +1,5 @@
 /* Test of strverscmp() function.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009 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
@@ -37,7 +37,7 @@
   while (0)
 
 int
-main (int argc, char **argv)
+main (void)
 {
   ASSERT (strverscmp ("", "") == 0);
   ASSERT (strverscmp ("a", "a") == 0);
diff --git a/lib/gltests/test-wchar.c b/lib/gltests/test-wchar.c
index 2866068..2e60bb8 100644
--- a/lib/gltests/test-wchar.c
+++ b/lib/gltests/test-wchar.c
@@ -31,7 +31,7 @@ wint_t b = 'x';
 verify (sizeof NULL == sizeof (void *));
 
 int
-main ()
+main (void)
 {
   return 0;
 }
diff --git a/maint.mk b/maint.mk
index 68bd8f9..34d66e1 100644
--- a/maint.mk
+++ b/maint.mk
@@ -156,6 +156,12 @@ sc_prohibit_strcmp:
          { echo '$(ME): use STREQ in place of the above uses of str''cmp' \
                1>&2; exit 1; } || :
 
+# Pass EXIT_*, not number, to usage, exit, and error (when exiting)
+sc_prohibit_magic_number_exit:
+       @re='\<(usage|exit) ?\([0-9]|\<error ?\([1-9][0-9]*,'           \
+       msg='use EXIT_* values rather than magic number'                \
+         $(_prohibit_regexp)
+
 # Using EXIT_SUCCESS as the first argument to error is misleading,
 # since when that parameter is 0, error does not exit.  Use `0' instead.
 sc_error_exit_success:
@@ -251,6 +257,10 @@ endef
 sc_prohibit_assert_without_use:
        @h='<assert.h>' re='\<assert *\(' $(_header_without_use)
 
+# Prohibit the inclusion of close-stream.h without an actual use.
+sc_prohibit_close_stream_without_use:
+       @h='"close-stream.h"' re='\<close_stream *\(' $(_header_without_use)
+
 # Prohibit the inclusion of getopt.h without an actual use.
 sc_prohibit_getopt_without_use:
        @h='<getopt.h>' re='\<getopt(_long)? *\(' $(_header_without_use)
@@ -279,6 +289,23 @@ sc_prohibit_error_without_use:
        re='\<error(_at_line|_print_progname|_one_per_line|_message_count)? 
*\('\
          $(_header_without_use)
 
+# Don't include xalloc.h unless you use one of its functions.
+# Consider these symbols:
+# perl -lne '/^# *define (\w+)\(/ and print $1' lib/xalloc.h|grep -v '^__';
+# perl -lne '/^(?:extern )?(?:void|char) \*?(\w+) \(/ and print $1' 
lib/xalloc.h
+# Divide into two sets on case, and filter each through this:
+# | sort | perl -MRegexp::Assemble -le \
+#  'print Regexp::Assemble->new(file => "/dev/stdin")->as_string'|sed 
's/\?://g'
+# Note this was produced by the above:
+# _xa1 = x(alloc_(oversized|die)|([cz]|2?re)alloc|m(alloc|emdup)|strdup)
+# But we can do better:
+_xa1 = x(alloc_(oversized|die)|([cmz]|2?re)alloc|(mem|str)dup)
+_xa2 = X([CZ]|N?M)ALLOC
+sc_prohibit_xalloc_without_use:
+       @h='"xalloc.h"' \
+       re='\<($(_xa1)|$(_xa2)) *\('\
+         $(_header_without_use)
+
 sc_prohibit_safe_read_without_use:
        @h='"safe-read.h"' re='(\<SAFE_READ_ERROR\>|\<safe_read *\()' \
          $(_header_without_use)


hooks/post-receive
-- 
GNU libidn




reply via email to

[Prev in Thread] Current Thread [Next in Thread]