shishi-commit
[Top][All Lists]
Advanced

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

[SCM] GNU shishi branch, master, updated. shishi-0-0-40-15-gfef3b6e


From: Simon Josefsson
Subject: [SCM] GNU shishi branch, master, updated. shishi-0-0-40-15-gfef3b6e
Date: Tue, 29 Dec 2009 14:36:19 +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 shishi".

http://git.savannah.gnu.org/cgit/shishi.git/commit/?id=fef3b6eefd84b37c51d6bf7d5d44c4ebc4170bc2

The branch, master has been updated
       via  fef3b6eefd84b37c51d6bf7d5d44c4ebc4170bc2 (commit)
       via  9e2546303eaac5c69aa8ec958bfb670835978166 (commit)
       via  7775a382828d5c7839951c6269f048039afd6fd0 (commit)
      from  aa311d2978e2f49bee025a0d023e0ab6bb30cd39 (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 fef3b6eefd84b37c51d6bf7d5d44c4ebc4170bc2
Author: Simon Josefsson <address@hidden>
Date:   Tue Dec 29 15:25:56 2009 +0100

    Update gnulib files.

commit 9e2546303eaac5c69aa8ec958bfb670835978166
Author: Simon Josefsson <address@hidden>
Date:   Tue Dec 29 15:19:47 2009 +0100

    Update gnulib files.

commit 7775a382828d5c7839951c6269f048039afd6fd0
Author: Simon Josefsson <address@hidden>
Date:   Tue Dec 29 15:17:19 2009 +0100

    Update gnulib files.

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

Summary of changes:
 build-aux/arg-nonnull.h          |   26 +
 build-aux/gendocs.sh             |    8 +-
 build-aux/gnupload               |   53 +-
 build-aux/link-warning.h         |   29 +-
 build-aux/useless-if-before-free |    5 +-
 db/gl/areadlink.c                |  105 +-
 db/gl/areadlink.h                |   12 +-
 db/gl/gnulib.mk                  |  261 ++
 db/gl/m4/dos.m4                  |   71 +
 {gl => db/gl}/m4/extensions.m4   |   20 +-
 db/gl/m4/gnulib-common.m4        |   23 +-
 db/gl/m4/gnulib-comp.m4          |   37 +-
 {gl => db/gl}/m4/longlong.m4     |   64 +-
 {gl => db/gl}/m4/multiarch.m4    |    0
 db/gl/m4/readlink.m4             |   35 +-
 db/gl/m4/stat.m4                 |   61 +
 db/gl/m4/stdbool.m4              |  115 +
 db/gl/m4/stddef_h.m4             |   45 +
 {gl => db/gl}/m4/stdint.m4       |   12 +-
 db/gl/m4/sys_stat_h.m4           |   75 +
 {gl => db/gl}/m4/time_h.m4       |   22 +-
 db/gl/m4/unistd_h.m4             |  128 +
 db/gl/m4/wchar.m4                |  154 +
 {gl => db/gl}/m4/wchar_t.m4      |    0
 {gl => db/gl}/m4/wint_t.m4       |    0
 db/gl/readlink.c                 |   49 +-
 db/gl/stat.c                     |  104 +
 {gl => db/gl}/stdbool.in.h       |    0
 db/gl/stddef.in.h                |   86 +
 {gl => db/gl}/stdint.in.h        |    8 +-
 db/gl/sys_stat.in.h              |  548 +++
 {gl => db/gl}/time.in.h          |   34 +-
 {gl => db/gl}/wchar.in.h         |   14 +-
 gl/Makefile.am                   |  459 ++-
 gl/alloca.c                      |  154 +-
 gl/arcfour.c                     |    6 +-
 gl/arcfour.h                     |    2 +-
 gl/arpa_inet.in.h                |   19 +-
 gl/base64.c                      |  336 +-
 gl/base64.h                      |   14 +-
 gl/close-hook.c                  |    2 +-
 gl/close.c                       |    2 +-
 gl/connect.c                     |    4 +-
 gl/des.c                         |  252 +-
 gl/des.h                         |   20 +-
 gl/dup2.c                        |  122 +
 gl/fcntl.c                       |  294 ++
 gl/fcntl.in.h                    |  131 +-
 gl/fseeko.c                      |   53 +-
 gl/gc-gnulib.c                   |  281 +-
 gl/gc-libgcrypt.c                |   31 +-
 gl/gc-pbkdf2-sha1.c              |  149 +-
 gl/gc.h                          |   32 +-
 gl/getaddrinfo.c                 |  171 +-
 gl/getdate.y                     | 1173 +++---
 gl/getdelim.c                    |   78 +-
 gl/getdomainname.c               |    2 +-
 gl/gethostname.c                 |   54 +-
 gl/getpagesize.c                 |   39 -
 gl/getpass.c                     |   44 +-
 gl/getsubopt.c                   |   14 +-
 gl/gettext.h                     |   10 +-
 gl/gettimeofday.c                |    4 +-
 gl/hmac-md5.c                    |    2 +-
 gl/hmac-sha1.c                   |    2 +-
 gl/hmac.h                        |    4 +-
 gl/inet_ntop.c                   |   92 +-
 gl/intprops.h                    |   50 +-
 gl/m4/clock_time.m4              |    5 +-
 gl/m4/close.m4                   |    9 +-
 gl/m4/dup2.m4                    |   58 +
 gl/m4/environ.m4                 |    4 +-
 gl/m4/extensions.m4              |   20 +-
 gl/m4/fclose.m4                  |    8 +-
 gl/m4/fcntl-o.m4                 |   81 +
 gl/m4/fcntl.m4                   |   83 +
 gl/m4/fcntl_h.m4                 |   81 +-
 gl/m4/fseeko.m4                  |   11 +-
 gl/m4/gc-random.m4               |   20 +-
 gl/m4/getaddrinfo.m4             |   23 +-
 gl/m4/getdate.m4                 |   22 +-
 gl/m4/getdelim.m4                |    2 +-
 gl/m4/gethostname.m4             |   88 +-
 gl/m4/getline.m4                 |   16 +-
 gl/m4/getpagesize.m4             |   29 -
 gl/m4/gettimeofday.m4            |   50 +-
 gl/m4/gnulib-common.m4           |   23 +-
 gl/m4/gnulib-comp.m4             |   39 +-
 gl/m4/include_next.m4            |   78 +-
 gl/m4/inet_ntop.m4               |   17 +-
 gl/m4/ld-version-script.m4       |    2 +-
 gl/m4/lib-ld.m4                  |    6 +-
 gl/m4/longlong.m4                |   64 +-
 gl/m4/lseek.m4                   |   20 +-
 gl/m4/memchr.m4                  |    8 +-
 gl/m4/mktime.m4                  |   64 +-
 gl/m4/select.m4                  |    7 +-
 gl/m4/setenv.m4                  |   53 +-
 gl/m4/sockets.m4                 |   30 +-
 gl/m4/socklen.m4                 |   40 +-
 gl/m4/sockpfaf.m4                |   18 +-
 gl/m4/stdbool.m4                 |  138 +-
 gl/m4/stddef_h.m4                |   45 +
 gl/m4/stdint.m4                  |   12 +-
 gl/m4/stdio_h.m4                 |  113 +-
 gl/m4/stdlib_h.m4                |   27 +-
 gl/m4/string_h.m4                |   54 +-
 gl/m4/strndup.m4                 |   46 +-
 gl/m4/strtok_r.m4                |   52 +-
 gl/m4/sys_select_h.m4            |   33 +-
 gl/m4/sys_socket_h.m4            |    6 +-
 gl/m4/sys_stat_h.m4              |   56 +-
 gl/m4/sys_time_h.m4              |   12 +-
 gl/m4/time_h.m4                  |   22 +-
 gl/m4/time_r.m4                  |   20 +-
 gl/m4/timegm.m4                  |    2 +-
 gl/m4/unistd_h.m4                |   46 +-
 gl/m4/warnings.m4                |    2 +-
 gl/m4/wchar.m4                   |   58 +-
 gl/malloca.c                     |   64 +-
 gl/malloca.h                     |    8 +-
 gl/md4.c                         |  118 +-
 gl/md4.h                         |    7 +-
 gl/md5.c                         |  141 +-
 gl/md5.h                         |   12 +-
 gl/memchr.c                      |   24 +-
 gl/mktime-internal.h             |    4 +
 gl/mktime.c                      |  378 +-
 gl/netdb.in.h                    |   88 +-
 gl/override/lib/gettext.h.diff   |   24 +-
 gl/printf-args.c                 |  211 +-
 gl/printf-args.h                 |   52 +-
 gl/printf-parse.c                |  938 +++---
 gl/printf-parse.h                |   18 +-
 gl/read-file.c                   |   50 +-
 gl/realloc.c                     |    2 +-
 gl/recvfrom.c                    |    8 +-
 gl/select.c                      |  229 +-
 gl/sendto.c                      |    2 +-
 gl/setenv.c                      |  255 +-
 gl/sha1.c                        |  136 +-
 gl/sha1.h                        |    6 +-
 gl/signal.in.h                   |   14 +-
 gl/snprintf.c                    |   10 +-
 gl/socket.c                      |   10 +-
 gl/sockets.c                     |   62 +-
 gl/stddef.in.h                   |   86 +
 gl/stdint.in.h                   |    8 +-
 gl/stdio-impl.h                  |   42 +-
 gl/stdio-write.c                 |   48 +-
 gl/stdio.in.h                    |  731 ++--
 gl/stdlib.in.h                   |  297 +-
 gl/strcasecmp.c                  |    2 +-
 gl/strerror.c                    |    8 +-
 gl/string.in.h                   |  121 +-
 gl/strings.in.h                  |   10 +-
 gl/strncasecmp.c                 |    2 +-
 gl/strtok_r.c                    |   22 +-
 gl/strverscmp.c                  |    4 +-
 gl/sys_select.in.h               |   14 +-
 gl/sys_socket.in.h               |   93 +-
 gl/sys_stat.in.h                 |  237 +-
 gl/sys_time.in.h                 |    7 +-
 gl/time.in.h                     |   34 +-
 gl/timegm.c                      |    6 +-
 gl/timespec.h                    |    8 +-
 gl/unistd.in.h                   |  425 ++-
 gl/unsetenv.c                    |   50 +-
 gl/vasnprintf.c                  | 8035 +++++++++++++++++++-------------------
 gl/verify.h                      |    4 +-
 gl/w32sock.h                     |    1 -
 gl/wchar.in.h                    |   14 +-
 gl/xalloc.h                      |   46 +-
 gl/xgetdomainname.c              |   14 +-
 gl/xgethostname.c                |   36 +-
 gl/xvasprintf.c                  |   22 +-
 maint.mk                         |  160 +-
 src/gl/error.c                   |  160 +-
 src/gl/error.h                   |    6 +-
 src/gl/getopt.c                  | 1271 +++---
 src/gl/getopt.in.h               |   68 +-
 src/gl/getopt1.c                 |  136 +-
 src/gl/getopt_int.h              |   36 +-
 src/gl/gnulib.mk                 |   80 +-
 src/gl/locale.in.h               |   26 +-
 src/gl/m4/error.m4               |    5 +-
 src/gl/m4/getopt.m4              |  288 ++-
 src/gl/m4/gnulib-cache.m4        |    4 +-
 src/gl/m4/gnulib-common.m4       |   23 +-
 src/gl/m4/gnulib-comp.m4         |   19 +-
 src/gl/m4/locale_h.m4            |   82 +-
 src/gl/m4/stddef_h.m4            |   45 +
 src/gl/m4/version-etc.m4         |   10 +-
 {gl => src/gl}/m4/wchar_t.m4     |    0
 src/gl/progname.c                |   35 +-
 src/gl/progname.h                |   12 +-
 src/gl/stddef.in.h               |   86 +
 src/gl/strerror.c                |    8 +-
 src/gl/version-etc.c             |  106 +-
 src/gl/version-etc.h             |   20 +-
 200 files changed, 14448 insertions(+), 9665 deletions(-)
 create mode 100644 build-aux/arg-nonnull.h
 mode change 100755 => 100644 build-aux/gendocs.sh
 create mode 100644 db/gl/m4/dos.m4
 copy {gl => db/gl}/m4/extensions.m4 (83%)
 copy {gl => db/gl}/m4/longlong.m4 (69%)
 copy {gl => db/gl}/m4/multiarch.m4 (100%)
 create mode 100644 db/gl/m4/stat.m4
 create mode 100644 db/gl/m4/stdbool.m4
 create mode 100644 db/gl/m4/stddef_h.m4
 copy {gl => db/gl}/m4/stdint.m4 (98%)
 create mode 100644 db/gl/m4/sys_stat_h.m4
 copy {gl => db/gl}/m4/time_h.m4 (80%)
 create mode 100644 db/gl/m4/unistd_h.m4
 create mode 100644 db/gl/m4/wchar.m4
 copy {gl => db/gl}/m4/wchar_t.m4 (100%)
 copy {gl => db/gl}/m4/wint_t.m4 (100%)
 create mode 100644 db/gl/stat.c
 copy {gl => db/gl}/stdbool.in.h (100%)
 create mode 100644 db/gl/stddef.in.h
 copy {gl => db/gl}/stdint.in.h (98%)
 create mode 100644 db/gl/sys_stat.in.h
 copy {gl => db/gl}/time.in.h (76%)
 copy {gl => db/gl}/wchar.in.h (96%)
 create mode 100644 gl/dup2.c
 create mode 100644 gl/fcntl.c
 delete mode 100644 gl/getpagesize.c
 create mode 100644 gl/m4/dup2.m4
 create mode 100644 gl/m4/fcntl-o.m4
 create mode 100644 gl/m4/fcntl.m4
 delete mode 100644 gl/m4/getpagesize.m4
 create mode 100644 gl/m4/stddef_h.m4
 create mode 100644 gl/mktime-internal.h
 create mode 100644 gl/stddef.in.h
 create mode 100644 src/gl/m4/stddef_h.m4
 copy {gl => src/gl}/m4/wchar_t.m4 (100%)
 create mode 100644 src/gl/stddef.in.h

diff --git a/build-aux/arg-nonnull.h b/build-aux/arg-nonnull.h
new file mode 100644
index 0000000..24ad6b5
--- /dev/null
+++ b/build-aux/arg-nonnull.h
@@ -0,0 +1,26 @@
+/* A C macro for declaring that specific arguments must not be NULL.
+   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
+   Lesser 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/>.  */
+
+/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
+   that the values passed as arguments n, ..., m must be non-NULL pointers.
+   n = 1 stands for the first argument, n = 2 for the second argument etc.  */
+#ifndef _GL_ARG_NONNULL
+# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
+#  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
+# else
+#  define _GL_ARG_NONNULL(params)
+# endif
+#endif
diff --git a/build-aux/gendocs.sh b/build-aux/gendocs.sh
old mode 100755
new mode 100644
index a1ed4b4..992d9fc
--- a/build-aux/gendocs.sh
+++ b/build-aux/gendocs.sh
@@ -2,15 +2,15 @@
 # gendocs.sh -- generate a GNU manual in many formats.  This script is
 #   mentioned in maintain.texi.  See the help message below for usage details.
 
-scriptversion=2009-04-08.09
+scriptversion=2009-09-09.22
 
 # Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009
 # Free Software Foundation, Inc.
 #
-# This program is free software; you can redistribute it and/or modify
+# 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.
+# 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
diff --git a/build-aux/gnupload b/build-aux/gnupload
index 002cee3..bfdad59 100755
--- a/build-aux/gnupload
+++ b/build-aux/gnupload
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Sign files and upload them.
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2009-12-21.21; # UTC
 
 # Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation
 #
@@ -73,34 +73,33 @@ actual command line options.  Use this to keep your 
defaults.  Comments
 (#) and empty lines in $conffile are allowed.
 
 Examples:
-1. Upload automake-1.8.2b.tar.gz and automake-1.8.2b.tar.bz2 to two sites:
-  gnupload --to sources.redhat.com:~ftp/pub/automake \\
-           --to alpha.gnu.org:automake \\
-           automake-1.8.2b.tar.gz automake-1.8.2b.tar.bz2
-
-2. Same as above, but also create symbolic links to automake-latest.tar.*:
-  gnupload --to sources.redhat.com:~ftp/pub/automake \\
-           --to alpha.gnu.org:automake \\
-           --symlink-regex \\
-           automake-1.8.2b.tar.gz automake-1.8.2b.tar.bz2
-
-3. Symlink automake-1.8.2b.tar.gz to automake-latest.tar.gz and
-automake-1.8.2b.tar.bz2 to automake-latest.tar.bz2 on both sites:
+1. Upload foobar-1.0.tar.gz to ftp.gnu.org:
+  gnupload --to ftp.gnu.org:foobar foobar-1.0.tar.gz
 
-  gnupload --to sources.redhat.com:~ftp/pub/automake \\
-           --to alpha.gnu.org:automake \\
-           --symlink automake-1.8.2b.tar.gz automake-latest.tar.gz \\
-                     automake-1.8.2b.tar.bz2 automake-latest.tar.bz2
+2. Upload foobar-1.0.tar.gz and foobar-1.0.tar.xz to ftp.gnu.org:
+  gnupload --to ftp.gnu.org:foobar foobar-1.0.tar.gz foobar-1.0.tar.xz
 
-4. Delete automake-1.8.2a.tar.gz and .bz2, remove symlink
-automake-latest.tar.gz and upload automake-1.8.2b.tar.gz:
-
-  gnupload --to sources.redhat.com:~ftp/pub/automake \\
-           --to alpha.gnu.org:automake \\
-           --delete automake-1.8.2a.tar.gz automake-1.8.2a.tar.bz2 \\
-           --rmsymlink automake-latest.tar.gz \\
-           -- \\
-           automake-1.8.2b.tar.gz automake-1.8.2b.tar.bz2
+3. Same as above, and also create symbolic links to foobar-latest.tar.*:
+  gnupload --to ftp.gnu.org:foobar \\
+           --symlink-regex \\
+           foobar-1.0.tar.gz foobar-1.0.tar.xz
+
+4. Upload foobar-0.9.90.tar.gz to two sites:
+  gnupload --to alpha.gnu.org:foobar \\
+           --to sources.redhat.com:~ftp/pub/foobar \\
+           foobar-0.9.90.tar.gz
+
+5. Delete oopsbar-0.9.91.tar.gz and upload foobar-0.9.91.tar.gz
+   (the -- terminates the list of files to delete):
+  gnupload --to alpha.gnu.org:foobar \\
+           --to sources.redhat.com:~ftp/pub/foobar \\
+           --delete oopsbar-0.9.91.tar.gz \\
+           -- foobar-0.9.91.tar.gz
+
+gnupload uses the ncftpput program to do the transfers; if you don't
+happen to have an ncftp package installed, the ncftpput-ftp script in
+the build-aux/ directory of the gnulib package
+(http://savannah.gnu.org/projects/gnulib) may serve as a replacement.
 
 Report bugs to <address@hidden>.
 Send patches to <address@hidden>."
diff --git a/build-aux/link-warning.h b/build-aux/link-warning.h
index fda0194..7fefab7 100644
--- a/build-aux/link-warning.h
+++ b/build-aux/link-warning.h
@@ -1,3 +1,20 @@
+/* A C macro for emitting link time warnings.
+   Copyright (C) 1995, 1997, 2000, 2002-2003, 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 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
+   Lesser 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/>.  */
+
 /* GL_LINK_WARNING("literal string") arranges to emit the literal string as
    a linker warning on most glibc systems.
    We use a linker warning rather than a preprocessor warning, because
@@ -15,12 +32,12 @@
 #  define GL_LINK_WARNING2(file, line, message) \
      GL_LINK_WARNING3 (file ":" #line ": warning: " message)
 #  define GL_LINK_WARNING3(message) \
-     ({ static const char warning[sizeof (message)]            \
-          __attribute__ ((__unused__,                          \
-                          __section__ (".gnu.warning"),                \
-                          __aligned__ (1)))                    \
-          = message "\n";                                      \
-        (void)0;                                               \
+     ({ static const char warning[sizeof (message)]             \
+          __attribute__ ((__unused__,                           \
+                          __section__ (".gnu.warning"),         \
+                          __aligned__ (1)))                     \
+          = message "\n";                                       \
+        (void)0;                                                \
      })
 # else
 #  define GL_LINK_WARNING(message) ((void) 0)
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/db/gl/areadlink.c b/db/gl/areadlink.c
index 4e770eb..b506eb8 100644
--- a/db/gl/areadlink.c
+++ b/db/gl/areadlink.c
@@ -1,7 +1,7 @@
 /* areadlink.c -- readlink wrapper to return the link name in malloc'd storage
    Unlike xreadlink and xreadlink_with_size, don't ever call exit.
 
-   Copyright (C) 2001, 2003-2007 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2003-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
@@ -24,20 +24,23 @@
 /* Specification.  */
 #include "areadlink.h"
 
-#include <string.h>
 #include <errno.h>
 #include <limits.h>
-#include <sys/types.h>
+#include <stdint.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
 
-#ifndef SIZE_MAX
-# define SIZE_MAX ((size_t) -1)
-#endif
 #ifndef SSIZE_MAX
 # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
 #endif
 
+/* The initial buffer size for the link value.  A power of 2
+   detects arithmetic overflow earlier, but is not required.  */
+enum {
+  INITIAL_BUF_SIZE = 1024
+};
+
 /* Call readlink to get the symbolic link value of FILENAME.
    Return a pointer to that NUL-terminated string in malloc'd storage.
    If readlink fails, return NULL and set errno.
@@ -47,17 +50,13 @@
 char *
 areadlink (char const *filename)
 {
-  /* The initial buffer size for the link value.  A power of 2
-     detects arithmetic overflow earlier, but is not required.  */
-#define INITIAL_BUF_SIZE 1024
-
   /* Allocate the initial buffer on the stack.  This way, in the common
      case of a symlink of small size, we get away with a single small malloc()
      instead of a big malloc() followed by a shrinking realloc().  */
   char initial_buf[INITIAL_BUF_SIZE];
 
   char *buffer = initial_buf;
-  size_t buf_size = sizeof (initial_buf);
+  size_t buf_size = sizeof initial_buf;
 
   while (1)
     {
@@ -65,56 +64,56 @@ areadlink (char const *filename)
       ssize_t link_length = readlink (filename, buffer, buf_size);
 
       /* On AIX 5L v5.3 and HP-UX 11i v2 04/09, readlink returns -1
-        with errno == ERANGE if the buffer is too small.  */
+         with errno == ERANGE if the buffer is too small.  */
       if (link_length < 0 && errno != ERANGE)
-       {
-         if (buffer != initial_buf)
-           {
-             int saved_errno = errno;
-             free (buffer);
-             errno = saved_errno;
-           }
-         return NULL;
-       }
+        {
+          if (buffer != initial_buf)
+            {
+              int saved_errno = errno;
+              free (buffer);
+              errno = saved_errno;
+            }
+          return NULL;
+        }
 
       if ((size_t) link_length < buf_size)
-       {
-         buffer[link_length++] = '\0';
-
-         /* Return it in a chunk of memory as small as possible.  */
-         if (buffer == initial_buf)
-           {
-             buffer = (char *) malloc (link_length);
-             if (buffer == NULL)
-               /* errno is ENOMEM.  */
-               return NULL;
-             memcpy (buffer, initial_buf, link_length);
-           }
-         else
-           {
-             /* Shrink buffer before returning it.  */
-             if ((size_t) link_length < buf_size)
-               {
-                 char *smaller_buffer = (char *) realloc (buffer, link_length);
-
-                 if (smaller_buffer != NULL)
-                   buffer = smaller_buffer;
-               }
-           }
-         return buffer;
-       }
+        {
+          buffer[link_length++] = '\0';
+
+          /* Return it in a chunk of memory as small as possible.  */
+          if (buffer == initial_buf)
+            {
+              buffer = (char *) malloc (link_length);
+              if (buffer == NULL)
+                /* errno is ENOMEM.  */
+                return NULL;
+              memcpy (buffer, initial_buf, link_length);
+            }
+          else
+            {
+              /* Shrink buffer before returning it.  */
+              if ((size_t) link_length < buf_size)
+                {
+                  char *smaller_buffer = (char *) realloc (buffer, 
link_length);
+
+                  if (smaller_buffer != NULL)
+                    buffer = smaller_buffer;
+                }
+            }
+          return buffer;
+        }
 
       if (buffer != initial_buf)
-       free (buffer);
+        free (buffer);
       buf_size *= 2;
       if (SSIZE_MAX < buf_size || (SIZE_MAX / 2 < SSIZE_MAX && buf_size == 0))
-       {
-         errno = ENOMEM;
-         return NULL;
-       }
+        {
+          errno = ENOMEM;
+          return NULL;
+        }
       buffer = (char *) malloc (buf_size);
       if (buffer == NULL)
-       /* errno is ENOMEM.  */
-       return NULL;
+        /* errno is ENOMEM.  */
+        return NULL;
     }
 }
diff --git a/db/gl/areadlink.h b/db/gl/areadlink.h
index 8720ed9..f1443f8 100644
--- a/db/gl/areadlink.h
+++ b/db/gl/areadlink.h
@@ -1,6 +1,7 @@
 /* Read symbolic links without size limitation.
 
-   Copyright (C) 2001, 2003, 2004, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2003, 2004, 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
@@ -21,3 +22,12 @@
 
 extern char *areadlink (char const *filename);
 extern char *areadlink_with_size (char const *filename, size_t size_hint);
+
+#if GNULIB_AREADLINKAT
+extern char *areadlinkat (int fd, char const *filename);
+#endif
+
+#if GNULIB_AREADLINKAT_WITH_SIZE
+extern char *areadlinkat_with_size (int fd, char const *filename,
+                                    size_t size_hint);
+#endif
diff --git a/db/gl/gnulib.mk b/db/gl/gnulib.mk
index d1cfd92..799099e 100644
--- a/db/gl/gnulib.mk
+++ b/db/gl/gnulib.mk
@@ -30,6 +30,30 @@ EXTRA_DIST += areadlink.h
 
 ## end   gnulib module areadlink
 
+## begin gnulib module arg-nonnull
+
+# The BUILT_SOURCES created by this Makefile snippet are not used via #include
+# statements but through direct file reference. Therefore this snippet must be
+# present in all Makefile.am that need it. This is ensured by the applicability
+# 'all' defined above.
+
+BUILT_SOURCES += arg-nonnull.h
+# The arg-nonnull.h that gets inserted into generated .h files is the same as
+# build-aux/arg-nonnull.h, except that it has the copyright header cut off.
+arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       sed -n -e '/GL_ARG_NONNULL/,$$p' \
+         < $(top_srcdir)/build-aux/arg-nonnull.h \
+         > address@hidden && \
+       mv address@hidden $@
+MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t
+
+ARG_NONNULL_H=arg-nonnull.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h
+
+## end   gnulib module arg-nonnull
+
 ## begin gnulib module readlink
 
 
@@ -39,6 +63,243 @@ EXTRA_libgnu_la_SOURCES += readlink.c
 
 ## end   gnulib module readlink
 
+## begin gnulib module stat
+
+
+EXTRA_DIST += stat.c
+
+EXTRA_libgnu_la_SOURCES += stat.c
+
+## end   gnulib module stat
+
+## begin gnulib module stdbool
+
+BUILT_SOURCES += $(STDBOOL_H)
+
+# We need the following in order to create <stdbool.h> when the system
+# doesn't have one that works.
+stdbool.h: stdbool.in.h
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; 
\
+       } > address@hidden && \
+       mv address@hidden $@
+MOSTLYCLEANFILES += stdbool.h stdbool.h-t
+
+EXTRA_DIST += stdbool.in.h
+
+## end   gnulib module stdbool
+
+## begin gnulib module stddef
+
+BUILT_SOURCES += $(STDDEF_H)
+
+# We need the following in order to create <stddef.h> when the system
+# doesn't have one that works with the given compiler.
+stddef.h: stddef.in.h
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
+             -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \
+             -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
+             < $(srcdir)/stddef.in.h; \
+       } > address@hidden && \
+       mv address@hidden $@
+MOSTLYCLEANFILES += stddef.h stddef.h-t
+
+EXTRA_DIST += stddef.in.h
+
+## end   gnulib module stddef
+
+## begin gnulib module stdint
+
+BUILT_SOURCES += $(STDINT_H)
+
+# We need the following in order to create <stdint.h> when the system
+# doesn't have one that works with the given compiler.
+stdint.h: stdint.in.h
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
+             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \
+             -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
+             -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
+             -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \
+             -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
+             -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
+             -e 
's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
+             -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \
+             -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \
+             -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \
+             -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \
+             -e 
's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \
+             -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \
+             -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \
+             -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \
+             -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \
+             -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \
+             -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \
+             -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \
+             -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
+             -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
+             < $(srcdir)/stdint.in.h; \
+       } > address@hidden && \
+       mv address@hidden $@
+MOSTLYCLEANFILES += stdint.h stdint.h-t
+
+EXTRA_DIST += stdint.in.h
+
+## end   gnulib module stdint
+
+## begin gnulib module sys_stat
+
+BUILT_SOURCES += sys/stat.h
+
+# We need the following in order to create <sys/stat.h> when the system
+# has one that is incomplete.
+sys/stat.h: sys_stat.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+       $(AM_V_at)$(MKDIR_P) sys
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
+             -e 's|@''GNULIB_FCHMODAT''@|$(GNULIB_FCHMODAT)|g' \
+             -e 's|@''GNULIB_FSTATAT''@|$(GNULIB_FSTATAT)|g' \
+             -e 's|@''GNULIB_FUTIMENS''@|$(GNULIB_FUTIMENS)|g' \
+             -e 's|@''GNULIB_LCHMOD''@|$(GNULIB_LCHMOD)|g' \
+             -e 's|@''GNULIB_LSTAT''@|$(GNULIB_LSTAT)|g' \
+             -e 's|@''GNULIB_MKDIRAT''@|$(GNULIB_MKDIRAT)|g' \
+             -e 's|@''GNULIB_MKFIFO''@|$(GNULIB_MKFIFO)|g' \
+             -e 's|@''GNULIB_MKFIFOAT''@|$(GNULIB_MKFIFOAT)|g' \
+             -e 's|@''GNULIB_MKNOD''@|$(GNULIB_MKNOD)|g' \
+             -e 's|@''GNULIB_MKNODAT''@|$(GNULIB_MKNODAT)|g' \
+             -e 's|@''GNULIB_STAT''@|$(GNULIB_STAT)|g' \
+             -e 's|@''GNULIB_UTIMENSAT''@|$(GNULIB_UTIMENSAT)|g' \
+             -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \
+             -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \
+             -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \
+             -e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \
+             -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \
+             -e 's|@''HAVE_MKDIRAT''@|$(HAVE_MKDIRAT)|g' \
+             -e 's|@''HAVE_MKFIFO''@|$(HAVE_MKFIFO)|g' \
+             -e 's|@''HAVE_MKFIFOAT''@|$(HAVE_MKFIFOAT)|g' \
+             -e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \
+             -e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \
+             -e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \
+             -e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \
+             -e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \
+             -e 's|@''REPLACE_FUTIMENS''@|$(REPLACE_FUTIMENS)|g' \
+             -e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \
+             -e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \
+             -e 's|@''REPLACE_MKFIFO''@|$(REPLACE_MKFIFO)|g' \
+             -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \
+             -e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \
+             -e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \
+             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             < $(srcdir)/sys_stat.in.h; \
+       } > address@hidden && \
+       mv address@hidden $@
+MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t
+MOSTLYCLEANDIRS += sys
+
+EXTRA_DIST += sys_stat.in.h
+
+## end   gnulib module sys_stat
+
+## begin gnulib module time
+
+BUILT_SOURCES += time.h
+
+# We need the following in order to create <time.h> when the system
+# doesn't have one that works with the given compiler.
+time.h: time.in.h $(ARG_NONNULL_H)
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \
+             -e 's|@REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \
+             -e 's|@REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \
+             -e 's|@REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
+             -e 's|@REPLACE_STRPTIME''@|$(REPLACE_STRPTIME)|g' \
+             -e 's|@REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \
+             -e 
's|@SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g'
 \
+             -e 
's|@TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             < $(srcdir)/time.in.h; \
+       } > address@hidden && \
+       mv address@hidden $@
+MOSTLYCLEANFILES += time.h time.h-t
+
+EXTRA_DIST += time.in.h
+
+## end   gnulib module time
+
+## begin gnulib module wchar
+
+BUILT_SOURCES += $(WCHAR_H)
+
+# We need the following in order to create <wchar.h> when the system
+# version does not work standalone.
+wchar.h: wchar.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
+             -e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \
+             -e 's|@''GNULIB_BTOWC''@|$(GNULIB_BTOWC)|g' \
+             -e 's|@''GNULIB_WCTOB''@|$(GNULIB_WCTOB)|g' \
+             -e 's|@''GNULIB_MBSINIT''@|$(GNULIB_MBSINIT)|g' \
+             -e 's|@''GNULIB_MBRTOWC''@|$(GNULIB_MBRTOWC)|g' \
+             -e 's|@''GNULIB_MBRLEN''@|$(GNULIB_MBRLEN)|g' \
+             -e 's|@''GNULIB_MBSRTOWCS''@|$(GNULIB_MBSRTOWCS)|g' \
+             -e 's|@''GNULIB_MBSNRTOWCS''@|$(GNULIB_MBSNRTOWCS)|g' \
+             -e 's|@''GNULIB_WCRTOMB''@|$(GNULIB_WCRTOMB)|g' \
+             -e 's|@''GNULIB_WCSRTOMBS''@|$(GNULIB_WCSRTOMBS)|g' \
+             -e 's|@''GNULIB_WCSNRTOMBS''@|$(GNULIB_WCSNRTOMBS)|g' \
+             -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
+             -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \
+             -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \
+             -e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \
+             -e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \
+             -e 's|@''HAVE_MBRLEN''@|$(HAVE_MBRLEN)|g' \
+             -e 's|@''HAVE_MBSRTOWCS''@|$(HAVE_MBSRTOWCS)|g' \
+             -e 's|@''HAVE_MBSNRTOWCS''@|$(HAVE_MBSNRTOWCS)|g' \
+             -e 's|@''HAVE_WCRTOMB''@|$(HAVE_WCRTOMB)|g' \
+             -e 's|@''HAVE_WCSRTOMBS''@|$(HAVE_WCSRTOMBS)|g' \
+             -e 's|@''HAVE_WCSNRTOMBS''@|$(HAVE_WCSNRTOMBS)|g' \
+             -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \
+             -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
+             -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \
+             -e 's|@''REPLACE_BTOWC''@|$(REPLACE_BTOWC)|g' \
+             -e 's|@''REPLACE_WCTOB''@|$(REPLACE_WCTOB)|g' \
+             -e 's|@''REPLACE_MBSINIT''@|$(REPLACE_MBSINIT)|g' \
+             -e 's|@''REPLACE_MBRTOWC''@|$(REPLACE_MBRTOWC)|g' \
+             -e 's|@''REPLACE_MBRLEN''@|$(REPLACE_MBRLEN)|g' \
+             -e 's|@''REPLACE_MBSRTOWCS''@|$(REPLACE_MBSRTOWCS)|g' \
+             -e 's|@''REPLACE_MBSNRTOWCS''@|$(REPLACE_MBSNRTOWCS)|g' \
+             -e 's|@''REPLACE_WCRTOMB''@|$(REPLACE_WCRTOMB)|g' \
+             -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \
+             -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \
+             -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
+             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+           < $(srcdir)/wchar.in.h; \
+       } > address@hidden && \
+       mv address@hidden $@
+MOSTLYCLEANFILES += wchar.h wchar.h-t
+
+EXTRA_DIST += wchar.in.h
+
+## end   gnulib module wchar
+
 
 mostlyclean-local: mostlyclean-generic
        @for dir in '' $(MOSTLYCLEANDIRS); do \
diff --git a/db/gl/m4/dos.m4 b/db/gl/m4/dos.m4
new file mode 100644
index 0000000..5c3593c
--- /dev/null
+++ b/db/gl/m4/dos.m4
@@ -0,0 +1,71 @@
+#serial 11   -*- autoconf -*-
+
+# Define some macros required for proper operation of code in lib/*.c
+# on MSDOS/Windows systems.
+
+# Copyright (C) 2000, 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# From Jim Meyering.
+
+AC_DEFUN([gl_AC_DOS],
+  [
+    AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos],
+      [
+        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
+#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined 
__CYGWIN__
+neither MSDOS nor Windows
+#endif]])],
+        [ac_cv_win_or_dos=yes],
+        [ac_cv_win_or_dos=no])
+      ])
+
+    if test x"$ac_cv_win_or_dos" = xyes; then
+      ac_fs_accepts_drive_letter_prefix=1
+      ac_fs_backslash_is_file_name_separator=1
+      AC_CACHE_CHECK([whether drive letter can start relative path],
+                     [ac_cv_drive_letter_can_be_relative],
+        [
+          AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
+#if defined __CYGWIN__
+drive letters are always absolute
+#endif]])],
+          [ac_cv_drive_letter_can_be_relative=yes],
+          [ac_cv_drive_letter_can_be_relative=no])
+        ])
+      if test x"$ac_cv_drive_letter_can_be_relative" = xyes; then
+        ac_fs_drive_letter_can_be_relative=1
+      else
+        ac_fs_drive_letter_can_be_relative=0
+      fi
+    else
+      ac_fs_accepts_drive_letter_prefix=0
+      ac_fs_backslash_is_file_name_separator=0
+      ac_fs_drive_letter_can_be_relative=0
+    fi
+
+    AC_DEFINE_UNQUOTED([FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX],
+      $ac_fs_accepts_drive_letter_prefix,
+      [Define on systems for which file names may have a so-called
+       `drive letter' prefix, define this to compute the length of that
+       prefix, including the colon.])
+
+    AH_VERBATIM(ISSLASH,
+    [#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
+# define ISSLASH(C) ((C) == '/' || (C) == '\\')
+#else
+# define ISSLASH(C) ((C) == '/')
+#endif])
+
+    AC_DEFINE_UNQUOTED([FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR],
+      $ac_fs_backslash_is_file_name_separator,
+      [Define if the backslash character may also serve as a file name
+       component separator.])
+
+    AC_DEFINE_UNQUOTED([FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE],
+      $ac_fs_drive_letter_can_be_relative,
+      [Define if a drive letter prefix denotes a relative path if it is
+       not followed by a file name component separator.])
+  ])
diff --git a/gl/m4/extensions.m4 b/db/gl/m4/extensions.m4
similarity index 83%
copy from gl/m4/extensions.m4
copy to db/gl/m4/extensions.m4
index ba6d5e1..ac19b36 100644
--- a/gl/m4/extensions.m4
+++ b/db/gl/m4/extensions.m4
@@ -1,4 +1,4 @@
-# serial 8  -*- Autoconf -*-
+# serial 9  -*- Autoconf -*-
 # Enable extensions on systems that normally disable them.
 
 # Copyright (C) 2003, 2006-2009 Free Software Foundation, Inc.
@@ -12,6 +12,20 @@
 # enough in this area it's likely we'll need to redefine
 # AC_USE_SYSTEM_EXTENSIONS for quite some time.
 
+# If autoconf reports a warning
+#     warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
+# or  warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
+# the fix is
+#   1) to ensure that AC_USE_SYSTEM_EXTENSIONS is never directly invoked
+#      but always AC_REQUIREd,
+#   2) to ensure that for each occurrence of
+#        AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+#      or
+#        AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+#      the corresponding gnulib module description has 'extensions' among
+#      its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS
+#      invocation occurs in gl_EARLY, not in gl_INIT.
+
 # AC_USE_SYSTEM_EXTENSIONS
 # ------------------------
 # Enable extensions on systems that normally disable them,
@@ -74,8 +88,8 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
     [ac_cv_safe_to_define___extensions__],
     [AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM([[
-#        define __EXTENSIONS__ 1
-         ]AC_INCLUDES_DEFAULT])],
+#         define __EXTENSIONS__ 1
+          ]AC_INCLUDES_DEFAULT])],
        [ac_cv_safe_to_define___extensions__=yes],
        [ac_cv_safe_to_define___extensions__=no])])
   test $ac_cv_safe_to_define___extensions__ = yes &&
diff --git a/db/gl/m4/gnulib-common.m4 b/db/gl/m4/gnulib-common.m4
index c8fda20..63c6300 100644
--- a/db/gl/m4/gnulib-common.m4
+++ b/db/gl/m4/gnulib-common.m4
@@ -23,14 +23,17 @@ AC_DEFUN([gl_COMMON_BODY], [
 # define __GNUC_STDC_INLINE__ 1
 #endif])
   AH_VERBATIM([unused_parameter],
-[/* Define as a marker that can be attached to function parameter declarations
-   for parameters that are not used.  This helps to reduce warnings, such as
-   from GCC -Wunused-parameter.  */
+[/* Define as a marker that can be attached to declarations that might not
+    be used.  This helps to reduce warnings, such as from
+    GCC -Wunused-parameter.  */
 #if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _UNUSED_PARAMETER_ __attribute__ ((__unused__))
+# define _GL_UNUSED __attribute__ ((__unused__))
 #else
-# define _UNUSED_PARAMETER_
+# define _GL_UNUSED
 #endif
+/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name
+   is a misnomer outside of parameter lists.  */
+#define _UNUSED_PARAMETER_ _GL_UNUSED
 ])
 ])
 
@@ -70,13 +73,13 @@ AC_DEFUN([AC_C_RESTRICT],
    for ac_kw in __restrict __restrict__ _Restrict restrict; do
      AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
       [[typedef int * int_ptr;
-       int foo (int_ptr $ac_kw ip) {
-       return ip[0];
+        int foo (int_ptr $ac_kw ip) {
+        return ip[0];
        }]],
       [[int s[1];
-       int * $ac_kw t = s;
-       t[0] = 0;
-       return foo(t)]])],
+        int * $ac_kw t = s;
+        t[0] = 0;
+        return foo(t)]])],
       [ac_cv_c_restrict=$ac_kw])
      test "$ac_cv_c_restrict" != no && break
    done
diff --git a/db/gl/m4/gnulib-comp.m4 b/db/gl/m4/gnulib-comp.m4
index 9870a8e..5062c30 100644
--- a/db/gl/m4/gnulib-comp.m4
+++ b/db/gl/m4/gnulib-comp.m4
@@ -25,6 +25,7 @@ AC_DEFUN([gl3_EARLY],
   m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
   m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
   AC_REQUIRE([AC_PROG_RANLIB])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
 ])
 
 # This macro should be invoked from ./configure.ac, in the section
@@ -40,8 +41,18 @@ AC_DEFUN([gl3_INIT],
   m4_pushdef([gl3_LIBSOURCES_DIR], [])
   gl_COMMON
   gl_source_base='db/gl'
+  gl_MULTIARCH
   gl_FUNC_READLINK
   gl_UNISTD_MODULE_INDICATOR([readlink])
+  gl_FUNC_STAT
+  gl_SYS_STAT_MODULE_INDICATOR([stat])
+  AM_STDBOOL_H
+  gl_STDDEF_H
+  gl_STDINT_H
+  gl_HEADER_SYS_STAT_H
+  AC_PROG_MKDIR_P
+  gl_HEADER_TIME_H
+  gl_WCHAR_H
   m4_ifval(gl3_LIBSOURCES_LIST, [
     m4_syscmd([test ! -d ]m4_defn([gl3_LIBSOURCES_DIR])[ ||
       for gl_file in ]gl3_LIBSOURCES_LIST[ ; do
@@ -64,7 +75,7 @@ AC_DEFUN([gl3_INIT],
     if test -n "$gl3_LIBOBJS"; then
       # Remove the extension.
       sed_drop_objext='s/\.o$//;s/\.obj$//'
-      for i in `for i in $gl3_LIBOBJS; do echo "$i"; done | sed 
"$sed_drop_objext" | sort | uniq`; do
+      for i in `for i in $gl3_LIBOBJS; do echo "$i"; done | sed -e 
"$sed_drop_objext" | sort | uniq`; do
         gl3_libobjs="$gl3_libobjs $i.$ac_objext"
         gl3_ltlibobjs="$gl3_ltlibobjs $i.lo"
       done
@@ -103,7 +114,7 @@ AC_DEFUN([gl3_INIT],
     if test -n "$gl3tests_LIBOBJS"; then
       # Remove the extension.
       sed_drop_objext='s/\.o$//;s/\.obj$//'
-      for i in `for i in $gl3tests_LIBOBJS; do echo "$i"; done | sed 
"$sed_drop_objext" | sort | uniq`; do
+      for i in `for i in $gl3tests_LIBOBJS; do echo "$i"; done | sed -e 
"$sed_drop_objext" | sort | uniq`; do
         gl3tests_libobjs="$gl3tests_libobjs $i.$ac_objext"
         gl3tests_ltlibobjs="$gl3tests_ltlibobjs $i.lo"
       done
@@ -170,10 +181,32 @@ AC_DEFUN([gl3tests_LIBSOURCES], [
 # This macro records the list of files which have been installed by
 # gnulib-tool and may be removed by future gnulib-tool invocations.
 AC_DEFUN([gl3_FILE_LIST], [
+  build-aux/arg-nonnull.h
   lib/areadlink.c
   lib/areadlink.h
   lib/readlink.c
+  lib/stat.c
+  lib/stdbool.in.h
+  lib/stddef.in.h
+  lib/stdint.in.h
+  lib/sys_stat.in.h
+  lib/time.in.h
+  lib/wchar.in.h
   m4/00gnulib.m4
+  m4/dos.m4
+  m4/extensions.m4
   m4/gnulib-common.m4
+  m4/longlong.m4
+  m4/multiarch.m4
   m4/readlink.m4
+  m4/stat.m4
+  m4/stdbool.m4
+  m4/stddef_h.m4
+  m4/stdint.m4
+  m4/sys_stat_h.m4
+  m4/time_h.m4
+  m4/unistd_h.m4
+  m4/wchar.m4
+  m4/wchar_t.m4
+  m4/wint_t.m4
 ])
diff --git a/gl/m4/longlong.m4 b/db/gl/m4/longlong.m4
similarity index 69%
copy from gl/m4/longlong.m4
copy to db/gl/m4/longlong.m4
index eedc8d5..6d17ea3 100644
--- a/gl/m4/longlong.m4
+++ b/db/gl/m4/longlong.m4
@@ -20,30 +20,30 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT],
     [AC_LINK_IFELSE(
        [_AC_TYPE_LONG_LONG_SNIPPET],
        [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
-       dnl If cross compiling, assume the bug isn't important, since
-       dnl nobody cross compiles for this platform as far as we know.
-       AC_RUN_IFELSE(
-         [AC_LANG_PROGRAM(
-            address@hidden:@include <limits.h>
-              @%:@ifndef LLONG_MAX
-              @%:@ define HALF \
-                       (1LL << (sizeof (long long int) * CHAR_BIT - 2))
-              @%:@ define LLONG_MAX (HALF - 1 + HALF)
-              @%:@endif]],
-            [[long long int n = 1;
-              int i;
-              for (i = 0; ; i++)
-                {
-                  long long int m = n << i;
-                  if (m >> i != n)
-                    return 1;
-                  if (LLONG_MAX / 2 < m)
-                    break;
-                }
-              return 0;]])],
-         [ac_cv_type_long_long_int=yes],
-         [ac_cv_type_long_long_int=no],
-         [ac_cv_type_long_long_int=yes])],
+        dnl If cross compiling, assume the bug isn't important, since
+        dnl nobody cross compiles for this platform as far as we know.
+        AC_RUN_IFELSE(
+          [AC_LANG_PROGRAM(
+             address@hidden:@include <limits.h>
+               @%:@ifndef LLONG_MAX
+               @%:@ define HALF \
+                        (1LL << (sizeof (long long int) * CHAR_BIT - 2))
+               @%:@ define LLONG_MAX (HALF - 1 + HALF)
+               @%:@endif]],
+             [[long long int n = 1;
+               int i;
+               for (i = 0; ; i++)
+                 {
+                   long long int m = n << i;
+                   if (m >> i != n)
+                     return 1;
+                   if (LLONG_MAX / 2 < m)
+                     break;
+                 }
+               return 0;]])],
+          [ac_cv_type_long_long_int=yes],
+          [ac_cv_type_long_long_int=no],
+          [ac_cv_type_long_long_int=yes])],
        [ac_cv_type_long_long_int=no])])
   if test $ac_cv_type_long_long_int = yes; then
     AC_DEFINE([HAVE_LONG_LONG_INT], [1],
@@ -83,24 +83,24 @@ AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
 [
   AC_LANG_PROGRAM(
     [[/* For now, do not test the preprocessor; as of 2007 there are too many
-        implementations with broken preprocessors.  Perhaps this can
-        be revisited in 2012.  In the meantime, code should not expect
-        #if to work with literals wider than 32 bits.  */
+         implementations with broken preprocessors.  Perhaps this can
+         be revisited in 2012.  In the meantime, code should not expect
+         #if to work with literals wider than 32 bits.  */
       /* Test literals.  */
       long long int ll = 9223372036854775807ll;
       long long int nll = -9223372036854775807LL;
       unsigned long long int ull = 18446744073709551615ULL;
       /* Test constant expressions.   */
       typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
-                    ? 1 : -1)];
+                     ? 1 : -1)];
       typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
-                    ? 1 : -1)];
+                     ? 1 : -1)];
       int i = 63;]],
     [[/* Test availability of runtime routines for shift and division.  */
       long long int llmax = 9223372036854775807ll;
       unsigned long long int ullmax = 18446744073709551615ull;
       return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
-             | (llmax / ll) | (llmax % ll)
-             | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
-             | (ullmax / ull) | (ullmax % ull));]])
+              | (llmax / ll) | (llmax % ll)
+              | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
+              | (ullmax / ull) | (ullmax % ull));]])
 ])
diff --git a/gl/m4/multiarch.m4 b/db/gl/m4/multiarch.m4
similarity index 100%
copy from gl/m4/multiarch.m4
copy to db/gl/m4/multiarch.m4
diff --git a/db/gl/m4/readlink.m4 b/db/gl/m4/readlink.m4
index ff3f1f5..e61c1a1 100644
--- a/db/gl/m4/readlink.m4
+++ b/db/gl/m4/readlink.m4
@@ -1,4 +1,4 @@
-# readlink.m4 serial 5
+# readlink.m4 serial 8
 dnl Copyright (C) 2003, 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,
@@ -12,6 +12,39 @@ AC_DEFUN([gl_FUNC_READLINK],
     HAVE_READLINK=0
     AC_LIBOBJ([readlink])
     gl_PREREQ_READLINK
+  else
+    AC_CACHE_CHECK([whether readlink signature is correct],
+      [gl_cv_decl_readlink_works],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM(
+           [[#include <unistd.h>
+      /* Cause compilation failure if original declaration has wrong type.  */
+      ssize_t readlink (const char *, char *, size_t);]])],
+         [gl_cv_decl_readlink_works=yes], [gl_cv_decl_readlink_works=no])])
+    dnl Solaris 9 ignores trailing slash.
+    dnl FreeBSD 7.2 dereferences only one level of links with trailing slash.
+    AC_CACHE_CHECK([whether readlink handles trailing slash correctly],
+      [gl_cv_func_readlink_works],
+      [# We have readlink, so assume ln -s works.
+       ln -s conftest.no-such conftest.link
+       ln -s conftest.link conftest.lnk2
+       AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+           [[#include <unistd.h>
+]], [[char buf[20];
+      return readlink ("conftest.lnk2/", buf, sizeof buf) != -1;]])],
+         [gl_cv_func_readlink_works=yes], [gl_cv_func_readlink_works=no],
+         [gl_cv_func_readlink_works="guessing no"])
+      rm -f conftest.link])
+    if test "$gl_cv_func_readlink_works" != yes; then
+      AC_DEFINE([READLINK_TRAILING_SLASH_BUG], [1], [Define to 1 if readlink
+        fails to recognize a trailing slash.])
+      REPLACE_READLINK=1
+      AC_LIBOBJ([readlink])
+    elif test "$gl_cv_decl_readlink_works" != yes; then
+      REPLACE_READLINK=1
+      AC_LIBOBJ([readlink])
+    fi
   fi
 ])
 
diff --git a/db/gl/m4/stat.m4 b/db/gl/m4/stat.m4
new file mode 100644
index 0000000..ce6933b
--- /dev/null
+++ b/db/gl/m4/stat.m4
@@ -0,0 +1,61 @@
+# serial 3
+
+# Copyright (C) 2009 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_STAT],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_REQUIRE([gl_AC_DOS])
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([lstat])
+  dnl mingw is the only known platform where stat(".") and stat("./") differ
+  AC_CACHE_CHECK([whether stat handles trailing slashes on directories],
+      [gl_cv_func_stat_dir_slash],
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+           [[#include <sys/stat.h>
+]], [[struct stat st; return stat (".", &st) != stat ("./", &st);]])],
+         [gl_cv_func_stat_dir_slash=yes], [gl_cv_func_stat_dir_slash=no],
+         [case $host_os in
+            mingw*) gl_cv_func_stat_dir_slash="guessing no";;
+            *) gl_cv_func_stat_dir_slash="guessing yes";;
+          esac])])
+  dnl Solaris 9 mistakenly succeeds on stat("file/")
+  dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/")
+  AC_CACHE_CHECK([whether stat handles trailing slashes on files],
+      [gl_cv_func_stat_file_slash],
+      [touch conftest.tmp
+       # Assume that if we have lstat, we can also check symlinks.
+       if test $ac_cv_func_lstat = yes; then
+         ln -s conftest.tmp conftest.lnk
+       fi
+       AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+           [[#include <sys/stat.h>
+]], [[struct stat st;
+      if (!stat ("conftest.tmp/", &st)) return 1;
+#if HAVE_LSTAT
+      if (!stat ("conftest.lnk/", &st)) return 2;
+#endif
+           ]])],
+         [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no],
+         [gl_cv_func_stat_file_slash="guessing no"])
+       rm -f conftest.tmp conftest.lnk])
+  case $gl_cv_func_stat_dir_slash in
+    *no) REPLACE_STAT=1
+      AC_DEFINE([REPLACE_FUNC_STAT_DIR], [1], [Define to 1 if stat needs
+        help when passed a directory name with a trailing slash]);;
+  esac
+  case $gl_cv_func_stat_file_slash in
+    *no) REPLACE_STAT=1
+      AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs
+        help when passed a file name with a trailing slash]);;
+  esac
+  if test $REPLACE_STAT = 1; then
+    AC_LIBOBJ([stat])
+  fi
+])
diff --git a/db/gl/m4/stdbool.m4 b/db/gl/m4/stdbool.m4
new file mode 100644
index 0000000..5e22d7a
--- /dev/null
+++ b/db/gl/m4/stdbool.m4
@@ -0,0 +1,115 @@
+# Check for stdbool.h that conforms to C99.
+
+dnl Copyright (C) 2002-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.
+
+# Prepare for substituting <stdbool.h> if it is not supported.
+
+AC_DEFUN([AM_STDBOOL_H],
+[
+  AC_REQUIRE([AC_HEADER_STDBOOL])
+
+  # Define two additional variables used in the Makefile substitution.
+
+  if test "$ac_cv_header_stdbool_h" = yes; then
+    STDBOOL_H=''
+  else
+    STDBOOL_H='stdbool.h'
+  fi
+  AC_SUBST([STDBOOL_H])
+
+  if test "$ac_cv_type__Bool" = yes; then
+    HAVE__BOOL=1
+  else
+    HAVE__BOOL=0
+  fi
+  AC_SUBST([HAVE__BOOL])
+])
+
+# AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future.
+AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H])
+
+# This macro is only needed in autoconf <= 2.59.  Newer versions of autoconf
+# have this macro built-in.
+
+AC_DEFUN([AC_HEADER_STDBOOL],
+  [AC_CACHE_CHECK([for stdbool.h that conforms to C99],
+     [ac_cv_header_stdbool_h],
+     [AC_TRY_COMPILE(
+        [
+          #include <stdbool.h>
+          #ifndef bool
+           "error: bool is not defined"
+          #endif
+          #ifndef false
+           "error: false is not defined"
+          #endif
+          #if false
+           "error: false is not 0"
+          #endif
+          #ifndef true
+           "error: true is not defined"
+          #endif
+          #if true != 1
+           "error: true is not 1"
+          #endif
+          #ifndef __bool_true_false_are_defined
+           "error: __bool_true_false_are_defined is not defined"
+          #endif
+
+          struct s { _Bool s: 1; _Bool t; } s;
+
+          char a[true == 1 ? 1 : -1];
+          char b[false == 0 ? 1 : -1];
+          char c[__bool_true_false_are_defined == 1 ? 1 : -1];
+          char d[(bool) 0.5 == true ? 1 : -1];
+          bool e = &s;
+          char f[(_Bool) 0.0 == false ? 1 : -1];
+          char g[true];
+          char h[sizeof (_Bool)];
+          char i[sizeof s.t];
+          enum { j = false, k = true, l = false * true, m = true * 256 };
+          _Bool n[m];
+          char o[sizeof n == m * sizeof n[0] ? 1 : -1];
+          char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
+          #if defined __xlc__ || defined __GNUC__
+           /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
+              reported by James Lemley on 2005-10-05; see
+              
http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
+              This test is not quite right, since xlc is allowed to
+              reject this program, as the initializer for xlcbug is
+              not one of the forms that C requires support for.
+              However, doing the test right would require a run-time
+              test, and that would make cross-compilation harder.
+              Let us hope that IBM fixes the xlc bug, and also adds
+              support for this kind of constant expression.  In the
+              meantime, this test will reject xlc, which is OK, since
+              our stdbool.h substitute should suffice.  We also test
+              this with GCC, where it should work, to detect more
+              quickly whether someone messes up the test in the
+              future.  */
+           char digs[] = "0123456789";
+           int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
+          #endif
+          /* Catch a bug in an HP-UX C compiler.  See
+             http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+             
http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+           */
+          _Bool q = true;
+          _Bool *pq = &q;
+        ],
+        [
+          *pq |= q;
+          *pq |= ! q;
+          /* Refer to every declared value, to avoid compiler optimizations.  
*/
+          return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
+                  + !m + !n + !o + !p + !q + !pq);
+        ],
+        [ac_cv_header_stdbool_h=yes],
+        [ac_cv_header_stdbool_h=no])])
+   AC_CHECK_TYPES([_Bool])
+   if test $ac_cv_header_stdbool_h = yes; then
+     AC_DEFINE([HAVE_STDBOOL_H], [1], [Define to 1 if stdbool.h conforms to 
C99.])
+   fi])
diff --git a/db/gl/m4/stddef_h.m4 b/db/gl/m4/stddef_h.m4
new file mode 100644
index 0000000..682e9c6
--- /dev/null
+++ b/db/gl/m4/stddef_h.m4
@@ -0,0 +1,45 @@
+dnl A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues.
+# stddef_h.m4 serial 1
+dnl Copyright (C) 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_STDDEF_H],
+[
+  AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
+  AC_REQUIRE([gt_TYPE_WCHAR_T])
+  if test $gt_cv_c_wchar_t = no; then
+    HAVE_WCHAR_T=0
+    STDDEF_H=stddef.h
+  fi
+  AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions],
+    [gl_cv_decl_null_works],
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h>
+      int test[2 * (sizeof NULL == sizeof (void *)) -1];
+]])],
+      [gl_cv_decl_null_works=yes],
+      [gl_cv_decl_null_works=no])])
+  if test $gl_cv_decl_null_works = no; then
+    REPLACE_NULL=1
+    STDDEF_H=stddef.h
+  fi
+  if test -n "$STDDEF_H"; then
+    gl_CHECK_NEXT_HEADERS([stddef.h])
+  fi
+])
+
+AC_DEFUN([gl_STDDEF_MODULE_INDICATOR],
+[
+  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+  AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
+  
GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
+])
+
+AC_DEFUN([gl_STDDEF_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  REPLACE_NULL=0;                AC_SUBST([REPLACE_NULL])
+  HAVE_WCHAR_T=1;                AC_SUBST([HAVE_WCHAR_T])
+  STDDEF_H='';                   AC_SUBST([STDDEF_H])
+])
diff --git a/gl/m4/stdint.m4 b/db/gl/m4/stdint.m4
similarity index 98%
copy from gl/m4/stdint.m4
copy to db/gl/m4/stdint.m4
index a2e8bdd..819d629 100644
--- a/gl/m4/stdint.m4
+++ b/db/gl/m4/stdint.m4
@@ -396,12 +396,12 @@ AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
        for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do
          case $glsuf in
            '')  gltype1='int';;
-           l)  gltype1='long int';;
-           ll) gltype1='long long int';;
-           i64)        gltype1='__int64';;
-           u)  gltype1='unsigned int';;
-           ul) gltype1='unsigned long int';;
-           ull)        gltype1='unsigned long long int';;
+           l)   gltype1='long int';;
+           ll)  gltype1='long long int';;
+           i64) gltype1='__int64';;
+           u)   gltype1='unsigned int';;
+           ul)  gltype1='unsigned long int';;
+           ull) gltype1='unsigned long long int';;
            ui64)gltype1='unsigned __int64';;
          esac
          AC_COMPILE_IFELSE(
diff --git a/db/gl/m4/sys_stat_h.m4 b/db/gl/m4/sys_stat_h.m4
new file mode 100644
index 0000000..838cf48
--- /dev/null
+++ b/db/gl/m4/sys_stat_h.m4
@@ -0,0 +1,75 @@
+# sys_stat_h.m4 serial 21   -*- Autoconf -*-
+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,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Eric Blake.
+dnl Provide a GNU-like <sys/stat.h>.
+
+AC_DEFUN([gl_HEADER_SYS_STAT_H],
+[
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+
+  dnl For the mkdir substitute.
+  AC_REQUIRE([AC_C_INLINE])
+
+  dnl Check for broken stat macros.
+  AC_REQUIRE([AC_HEADER_STAT])
+
+  gl_CHECK_NEXT_HEADERS([sys/stat.h])
+
+  dnl Define types that are supposed to be defined in <sys/types.h> or
+  dnl <sys/stat.h>.
+  AC_CHECK_TYPE([nlink_t], [],
+    [AC_DEFINE([nlink_t], [int],
+       [Define to the type of st_nlink in struct stat, or a supertype.])],
+    [#include <sys/types.h>
+     #include <sys/stat.h>])
+
+]) # gl_HEADER_SYS_STAT_H
+
+AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
+[
+  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+  
GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
+])
+
+AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR
+  GNULIB_FCHMODAT=0;    AC_SUBST([GNULIB_FCHMODAT])
+  GNULIB_FSTATAT=0;     AC_SUBST([GNULIB_FSTATAT])
+  GNULIB_FUTIMENS=0;    AC_SUBST([GNULIB_FUTIMENS])
+  GNULIB_LCHMOD=0;      AC_SUBST([GNULIB_LCHMOD])
+  GNULIB_LSTAT=0;       AC_SUBST([GNULIB_LSTAT])
+  GNULIB_MKDIRAT=0;     AC_SUBST([GNULIB_MKDIRAT])
+  GNULIB_MKFIFO=0;      AC_SUBST([GNULIB_MKFIFO])
+  GNULIB_MKFIFOAT=0;    AC_SUBST([GNULIB_MKFIFOAT])
+  GNULIB_MKNOD=0;       AC_SUBST([GNULIB_MKNOD])
+  GNULIB_MKNODAT=0;     AC_SUBST([GNULIB_MKNODAT])
+  GNULIB_STAT=0;        AC_SUBST([GNULIB_STAT])
+  GNULIB_UTIMENSAT=0;   AC_SUBST([GNULIB_UTIMENSAT])
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_FCHMODAT=1;      AC_SUBST([HAVE_FCHMODAT])
+  HAVE_FSTATAT=1;       AC_SUBST([HAVE_FSTATAT])
+  HAVE_FUTIMENS=1;      AC_SUBST([HAVE_FUTIMENS])
+  HAVE_LCHMOD=1;        AC_SUBST([HAVE_LCHMOD])
+  HAVE_LSTAT=1;         AC_SUBST([HAVE_LSTAT])
+  HAVE_MKDIRAT=1;       AC_SUBST([HAVE_MKDIRAT])
+  HAVE_MKFIFO=1;        AC_SUBST([HAVE_MKFIFO])
+  HAVE_MKFIFOAT=1;      AC_SUBST([HAVE_MKFIFOAT])
+  HAVE_MKNOD=1;         AC_SUBST([HAVE_MKNOD])
+  HAVE_MKNODAT=1;       AC_SUBST([HAVE_MKNODAT])
+  HAVE_UTIMENSAT=1;     AC_SUBST([HAVE_UTIMENSAT])
+  REPLACE_FSTAT=0;      AC_SUBST([REPLACE_FSTAT])
+  REPLACE_FSTATAT=0;    AC_SUBST([REPLACE_FSTATAT])
+  REPLACE_FUTIMENS=0;   AC_SUBST([REPLACE_FUTIMENS])
+  REPLACE_LSTAT=0;      AC_SUBST([REPLACE_LSTAT])
+  REPLACE_MKDIR=0;      AC_SUBST([REPLACE_MKDIR])
+  REPLACE_MKFIFO=0;     AC_SUBST([REPLACE_MKFIFO])
+  REPLACE_MKNOD=0;      AC_SUBST([REPLACE_MKNOD])
+  REPLACE_STAT=0;       AC_SUBST([REPLACE_STAT])
+  REPLACE_UTIMENSAT=0;  AC_SUBST([REPLACE_UTIMENSAT])
+])
diff --git a/gl/m4/time_h.m4 b/db/gl/m4/time_h.m4
similarity index 80%
copy from gl/m4/time_h.m4
copy to db/gl/m4/time_h.m4
index d42a635..c038b17 100644
--- a/gl/m4/time_h.m4
+++ b/db/gl/m4/time_h.m4
@@ -1,7 +1,6 @@
 # Configure a more-standard replacement for <time.h>.
 
-# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007 Free Software
-# Foundation, Inc.
+# Copyright (C) 2000-2001, 2003-2007, 2009 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -30,6 +29,7 @@ AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
   dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK;
   dnl this lets maintainers check for portability.
   REPLACE_LOCALTIME_R=GNULIB_PORTCHECK;  AC_SUBST([REPLACE_LOCALTIME_R])
+  REPLACE_MKTIME=GNULIB_PORTCHECK;       AC_SUBST([REPLACE_MKTIME])
   REPLACE_NANOSLEEP=GNULIB_PORTCHECK;    AC_SUBST([REPLACE_NANOSLEEP])
   REPLACE_STRPTIME=GNULIB_PORTCHECK;     AC_SUBST([REPLACE_STRPTIME])
   REPLACE_TIMEGM=GNULIB_PORTCHECK;       AC_SUBST([REPLACE_TIMEGM])
@@ -45,9 +45,9 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
     [gl_cv_sys_struct_timespec_in_time_h],
     [AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM(
-         [[#include <time.h>
-         ]],
-         [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
+          [[#include <time.h>
+          ]],
+          [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
        [gl_cv_sys_struct_timespec_in_time_h=yes],
        [gl_cv_sys_struct_timespec_in_time_h=no])])
 
@@ -59,12 +59,12 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
     AC_CACHE_CHECK([for struct timespec in <sys/time.h>],
       [gl_cv_sys_struct_timespec_in_sys_time_h],
       [AC_COMPILE_IFELSE(
-        [AC_LANG_PROGRAM(
-           [[#include <sys/time.h>
-           ]],
-           [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
-        [gl_cv_sys_struct_timespec_in_sys_time_h=yes],
-        [gl_cv_sys_struct_timespec_in_sys_time_h=no])])
+         [AC_LANG_PROGRAM(
+            [[#include <sys/time.h>
+            ]],
+            [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
+         [gl_cv_sys_struct_timespec_in_sys_time_h=yes],
+         [gl_cv_sys_struct_timespec_in_sys_time_h=no])])
     if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then
       SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1
     fi
diff --git a/db/gl/m4/unistd_h.m4 b/db/gl/m4/unistd_h.m4
new file mode 100644
index 0000000..cb50d50
--- /dev/null
+++ b/db/gl/m4/unistd_h.m4
@@ -0,0 +1,128 @@
+# unistd_h.m4 serial 36
+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,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Written by Simon Josefsson, Bruno Haible.
+
+AC_DEFUN([gl_UNISTD_H],
+[
+  dnl Use AC_REQUIRE here, so that the default behavior below is expanded
+  dnl once only, before all statements that occur in other macros.
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+
+  gl_CHECK_NEXT_HEADERS([unistd.h])
+
+  AC_CHECK_HEADERS_ONCE([unistd.h])
+  if test $ac_cv_header_unistd_h = yes; then
+    HAVE_UNISTD_H=1
+  else
+    HAVE_UNISTD_H=0
+  fi
+  AC_SUBST([HAVE_UNISTD_H])
+])
+
+AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
+[
+  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  
GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
+])
+
+AC_DEFUN([gl_UNISTD_H_DEFAULTS],
+[
+  GNULIB_CHOWN=0;            AC_SUBST([GNULIB_CHOWN])
+  GNULIB_CLOSE=0;            AC_SUBST([GNULIB_CLOSE])
+  GNULIB_DUP2=0;             AC_SUBST([GNULIB_DUP2])
+  GNULIB_DUP3=0;             AC_SUBST([GNULIB_DUP3])
+  GNULIB_ENVIRON=0;          AC_SUBST([GNULIB_ENVIRON])
+  GNULIB_EUIDACCESS=0;       AC_SUBST([GNULIB_EUIDACCESS])
+  GNULIB_FACCESSAT=0;        AC_SUBST([GNULIB_FACCESSAT])
+  GNULIB_FCHDIR=0;           AC_SUBST([GNULIB_FCHDIR])
+  GNULIB_FCHOWNAT=0;         AC_SUBST([GNULIB_FCHOWNAT])
+  GNULIB_FSYNC=0;            AC_SUBST([GNULIB_FSYNC])
+  GNULIB_FTRUNCATE=0;        AC_SUBST([GNULIB_FTRUNCATE])
+  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])
+  GNULIB_GETUSERSHELL=0;     AC_SUBST([GNULIB_GETUSERSHELL])
+  GNULIB_LCHOWN=0;           AC_SUBST([GNULIB_LCHOWN])
+  GNULIB_LINK=0;             AC_SUBST([GNULIB_LINK])
+  GNULIB_LINKAT=0;           AC_SUBST([GNULIB_LINKAT])
+  GNULIB_LSEEK=0;            AC_SUBST([GNULIB_LSEEK])
+  GNULIB_PIPE2=0;            AC_SUBST([GNULIB_PIPE2])
+  GNULIB_PREAD=0;            AC_SUBST([GNULIB_PREAD])
+  GNULIB_READLINK=0;         AC_SUBST([GNULIB_READLINK])
+  GNULIB_READLINKAT=0;       AC_SUBST([GNULIB_READLINKAT])
+  GNULIB_RMDIR=0;            AC_SUBST([GNULIB_RMDIR])
+  GNULIB_SLEEP=0;            AC_SUBST([GNULIB_SLEEP])
+  GNULIB_SYMLINK=0;          AC_SUBST([GNULIB_SYMLINK])
+  GNULIB_SYMLINKAT=0;        AC_SUBST([GNULIB_SYMLINKAT])
+  GNULIB_UNISTD_H_GETOPT=0;  AC_SUBST([GNULIB_UNISTD_H_GETOPT])
+  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])
+  HAVE_FACCESSAT=1;       AC_SUBST([HAVE_FACCESSAT])
+  HAVE_FCHOWNAT=1;        AC_SUBST([HAVE_FCHOWNAT])
+  HAVE_FSYNC=1;           AC_SUBST([HAVE_FSYNC])
+  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])
+  HAVE_PREAD=1;           AC_SUBST([HAVE_PREAD])
+  HAVE_READLINK=1;        AC_SUBST([HAVE_READLINK])
+  HAVE_READLINKAT=1;      AC_SUBST([HAVE_READLINKAT])
+  HAVE_SLEEP=1;           AC_SUBST([HAVE_SLEEP])
+  HAVE_SYMLINK=1;         AC_SUBST([HAVE_SYMLINK])
+  HAVE_SYMLINKAT=1;       AC_SUBST([HAVE_SYMLINKAT])
+  HAVE_DECL_ENVIRON=1;    AC_SUBST([HAVE_DECL_ENVIRON])
+  HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R])
+  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])
+  REPLACE_DUP2=0;         AC_SUBST([REPLACE_DUP2])
+  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])
+  REPLACE_LINKAT=0;       AC_SUBST([REPLACE_LINKAT])
+  REPLACE_LSEEK=0;        AC_SUBST([REPLACE_LSEEK])
+  REPLACE_PREAD=0;        AC_SUBST([REPLACE_PREAD])
+  REPLACE_READLINK=0;     AC_SUBST([REPLACE_READLINK])
+  REPLACE_RMDIR=0;        AC_SUBST([REPLACE_RMDIR])
+  REPLACE_SLEEP=0;        AC_SUBST([REPLACE_SLEEP])
+  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;
+                           AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS])
+])
diff --git a/db/gl/m4/wchar.m4 b/db/gl/m4/wchar.m4
new file mode 100644
index 0000000..ad19376
--- /dev/null
+++ b/db/gl/m4/wchar.m4
@@ -0,0 +1,154 @@
+dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
+
+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.
+
+dnl Written by Eric Blake.
+
+# wchar.m4 serial 27
+
+AC_DEFUN([gl_WCHAR_H],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_REQUIRE([gl_WCHAR_H_INLINE_OK])
+  AC_CACHE_CHECK([whether <wchar.h> is standalone],
+    [gl_cv_header_wchar_h_standalone],
+    [AC_COMPILE_IFELSE([[#include <wchar.h>
+wchar_t w;]],
+      [gl_cv_header_wchar_h_standalone=yes],
+      [gl_cv_header_wchar_h_standalone=no])])
+
+  AC_REQUIRE([gt_TYPE_WINT_T])
+  if test $gt_cv_c_wint_t = yes; then
+    HAVE_WINT_T=1
+  else
+    HAVE_WINT_T=0
+  fi
+  AC_SUBST([HAVE_WINT_T])
+
+  dnl If <stddef.h> is replaced, then <wchar.h> must also be replaced.
+  AC_REQUIRE([gl_STDDEF_H])
+
+  if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != 
yes || test -n "$STDDEF_H"; then
+    WCHAR_H=wchar.h
+  fi
+
+  dnl Prepare for creating substitute <wchar.h>.
+  dnl Do it always: WCHAR_H may be empty here but can be set later.
+  dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
+  dnl character support).
+  AC_CHECK_HEADERS_ONCE([wchar.h])
+  if test $ac_cv_header_wchar_h = yes; then
+    HAVE_WCHAR_H=1
+  else
+    HAVE_WCHAR_H=0
+  fi
+  AC_SUBST([HAVE_WCHAR_H])
+  dnl Execute this unconditionally, because WCHAR_H may be set by other
+  dnl modules, after this code is executed.
+  gl_CHECK_NEXT_HEADERS([wchar.h])
+])
+
+dnl Check whether <wchar.h> is usable at all.
+AC_DEFUN([gl_WCHAR_H_INLINE_OK],
+[
+  dnl Test whether <wchar.h> suffers due to the transition from '__inline' to
+  dnl 'gnu_inline'. See <http://sourceware.org/bugzilla/show_bug.cgi?id=4022>
+  dnl and <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. In summary,
+  dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and
+  dnl the option -std=c99 or -std=gnu99, leads to a broken <wchar.h>.
+  AC_CACHE_CHECK([whether <wchar.h> uses 'inline' correctly],
+    [gl_cv_header_wchar_h_correct_inline],
+    [gl_cv_header_wchar_h_correct_inline=yes
+     AC_LANG_CONFTEST([
+       AC_LANG_SOURCE([[#define wcstod renamed_wcstod
+#include <wchar.h>
+extern int zero (void);
+int main () { return zero(); }
+]])])
+     if AC_TRY_EVAL([ac_compile]); then
+       mv conftest.$ac_objext conftest1.$ac_objext
+       AC_LANG_CONFTEST([
+         AC_LANG_SOURCE([[#define wcstod renamed_wcstod
+#include <wchar.h>
+int zero (void) { return 0; }
+]])])
+       if AC_TRY_EVAL([ac_compile]); then
+         mv conftest.$ac_objext conftest2.$ac_objext
+         if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext 
conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then
+           :
+         else
+           gl_cv_header_wchar_h_correct_inline=no
+         fi
+       fi
+     fi
+     rm -f conftest1.$ac_objext conftest2.$ac_objext conftest$ac_exeext
+    ])
+  if test $gl_cv_header_wchar_h_correct_inline = no; then
+    AC_MSG_ERROR([<wchar.h> cannot be used with this compiler ($CC $CFLAGS 
$CPPFLAGS).
+This is a known interoperability problem of glibc <= 2.5 with gcc >= 4.3 in
+C99 mode. You have four options:
+  - Add the flag -fgnu89-inline to CC and reconfigure, or
+  - Fix your include files, using parts of
+    
<http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b037a293a48718af30d706c2e18c929d0e69a621>,
 or
+  - Use a gcc version older than 4.3, or
+  - Don't use the flags -std=c99 or -std=gnu99.
+Configuration aborted.])
+  fi
+])
+
+dnl Unconditionally enables the replacement of <wchar.h>.
+AC_DEFUN([gl_REPLACE_WCHAR_H],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  WCHAR_H=wchar.h
+])
+
+AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
+[
+  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  
GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
+])
+
+AC_DEFUN([gl_WCHAR_H_DEFAULTS],
+[
+  GNULIB_BTOWC=0;      AC_SUBST([GNULIB_BTOWC])
+  GNULIB_WCTOB=0;      AC_SUBST([GNULIB_WCTOB])
+  GNULIB_MBSINIT=0;    AC_SUBST([GNULIB_MBSINIT])
+  GNULIB_MBRTOWC=0;    AC_SUBST([GNULIB_MBRTOWC])
+  GNULIB_MBRLEN=0;     AC_SUBST([GNULIB_MBRLEN])
+  GNULIB_MBSRTOWCS=0;  AC_SUBST([GNULIB_MBSRTOWCS])
+  GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS])
+  GNULIB_WCRTOMB=0;    AC_SUBST([GNULIB_WCRTOMB])
+  GNULIB_WCSRTOMBS=0;  AC_SUBST([GNULIB_WCSRTOMBS])
+  GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS])
+  GNULIB_WCWIDTH=0;    AC_SUBST([GNULIB_WCWIDTH])
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_BTOWC=1;         AC_SUBST([HAVE_BTOWC])
+  HAVE_MBSINIT=1;       AC_SUBST([HAVE_MBSINIT])
+  HAVE_MBRTOWC=1;       AC_SUBST([HAVE_MBRTOWC])
+  HAVE_MBRLEN=1;        AC_SUBST([HAVE_MBRLEN])
+  HAVE_MBSRTOWCS=1;     AC_SUBST([HAVE_MBSRTOWCS])
+  HAVE_MBSNRTOWCS=1;    AC_SUBST([HAVE_MBSNRTOWCS])
+  HAVE_WCRTOMB=1;       AC_SUBST([HAVE_WCRTOMB])
+  HAVE_WCSRTOMBS=1;     AC_SUBST([HAVE_WCSRTOMBS])
+  HAVE_WCSNRTOMBS=1;    AC_SUBST([HAVE_WCSNRTOMBS])
+  HAVE_DECL_WCTOB=1;    AC_SUBST([HAVE_DECL_WCTOB])
+  HAVE_DECL_WCWIDTH=1;  AC_SUBST([HAVE_DECL_WCWIDTH])
+  REPLACE_MBSTATE_T=0;  AC_SUBST([REPLACE_MBSTATE_T])
+  REPLACE_BTOWC=0;      AC_SUBST([REPLACE_BTOWC])
+  REPLACE_WCTOB=0;      AC_SUBST([REPLACE_WCTOB])
+  REPLACE_MBSINIT=0;    AC_SUBST([REPLACE_MBSINIT])
+  REPLACE_MBRTOWC=0;    AC_SUBST([REPLACE_MBRTOWC])
+  REPLACE_MBRLEN=0;     AC_SUBST([REPLACE_MBRLEN])
+  REPLACE_MBSRTOWCS=0;  AC_SUBST([REPLACE_MBSRTOWCS])
+  REPLACE_MBSNRTOWCS=0; AC_SUBST([REPLACE_MBSNRTOWCS])
+  REPLACE_WCRTOMB=0;    AC_SUBST([REPLACE_WCRTOMB])
+  REPLACE_WCSRTOMBS=0;  AC_SUBST([REPLACE_WCSRTOMBS])
+  REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS])
+  REPLACE_WCWIDTH=0;    AC_SUBST([REPLACE_WCWIDTH])
+  WCHAR_H='';           AC_SUBST([WCHAR_H])
+])
diff --git a/gl/m4/wchar_t.m4 b/db/gl/m4/wchar_t.m4
similarity index 100%
copy from gl/m4/wchar_t.m4
copy to db/gl/m4/wchar_t.m4
diff --git a/gl/m4/wint_t.m4 b/db/gl/m4/wint_t.m4
similarity index 100%
copy from gl/m4/wint_t.m4
copy to db/gl/m4/wint_t.m4
diff --git a/db/gl/readlink.c b/db/gl/readlink.c
index 5cccdc9..41c81f9 100644
--- a/db/gl/readlink.c
+++ b/db/gl/readlink.c
@@ -1,5 +1,5 @@
 /* Stub for readlink().
-   Copyright (C) 2003-2007 Free Software Foundation, Inc.
+   Copyright (C) 2003-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
@@ -20,30 +20,55 @@
 #include <unistd.h>
 
 #include <errno.h>
-#include <sys/types.h>
+#include <string.h>
 #include <sys/stat.h>
-#include <stddef.h>
 
 #if !HAVE_READLINK
 
 /* readlink() substitute for systems that don't have a readlink() function,
    such as DJGPP 2.03 and mingw32.  */
 
-/* The official POSIX return type of readlink() is ssize_t, but since here
-   we have no declaration in a public header file, we use 'int' as return
-   type.  */
-
-int
-readlink (const char *path, char *buf, size_t bufsize)
+ssize_t
+readlink (const char *name, char *buf _GL_UNUSED,
+          size_t bufsize _GL_UNUSED)
 {
   struct stat statbuf;
 
   /* In general we should use lstat() here, not stat().  But on platforms
-     without symbolic links lstat() - if it exists - would be equivalent to
+     without symbolic links, lstat() - if it exists - would be equivalent to
      stat(), therefore we can use stat().  This saves us a configure check.  */
-  if (stat (path, &statbuf) >= 0)
+  if (stat (name, &statbuf) >= 0)
     errno = EINVAL;
   return -1;
 }
 
-#endif
+#else /* HAVE_READLINK */
+
+# undef readlink
+
+/* readlink() wrapper that uses correct types, for systems like cygwin
+   1.5.x where readlink returns int, and which rejects trailing slash,
+   for Solaris 9.  */
+
+ssize_t
+rpl_readlink (const char *name, char *buf, size_t bufsize)
+{
+# if READLINK_TRAILING_SLASH_BUG
+  size_t len = strlen (name);
+  if (len && name[len - 1] == '/')
+    {
+      /* Even if name without the slash is a symlink to a directory,
+         both lstat() and stat() must resolve the trailing slash to
+         the directory rather than the symlink.  We can therefore
+         safely use stat() to distinguish between EINVAL and
+         ENOTDIR/ENOENT, avoiding extra overhead of rpl_lstat().  */
+      struct stat st;
+      if (stat (name, &st) == 0)
+        errno = EINVAL;
+      return -1;
+    }
+# endif /* READLINK_TRAILING_SLASH_BUG */
+  return readlink (name, buf, bufsize);
+}
+
+#endif /* HAVE_READLINK */
diff --git a/db/gl/stat.c b/db/gl/stat.c
new file mode 100644
index 0000000..d9a7479
--- /dev/null
+++ b/db/gl/stat.c
@@ -0,0 +1,104 @@
+/* Work around platform bugs in stat.
+   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 */
+
+#include <config.h>
+
+/* Get the original definition of stat.  It might be defined as a macro.  */
+#define __need_system_sys_stat_h
+#include <sys/types.h>
+#include <sys/stat.h>
+#undef __need_system_sys_stat_h
+
+static inline int
+orig_stat (const char *filename, struct stat *buf)
+{
+  return stat (filename, buf);
+}
+
+/* Specification.  */
+#include <sys/stat.h>
+
+#include <errno.h>
+#include <limits.h>
+#include <stdbool.h>
+#include <string.h>
+
+/* Store information about NAME into ST.  Work around bugs with
+   trailing slashes.  Mingw has other bugs (such as st_ino always
+   being 0 on success) which this wrapper does not work around.  But
+   at least this implementation provides the ability to emulate fchdir
+   correctly.  */
+
+int
+rpl_stat (char const *name, struct stat *st)
+{
+  int result = orig_stat (name, st);
+#if REPLACE_FUNC_STAT_FILE
+  /* Solaris 9 mistakenly succeeds when given a non-directory with a
+     trailing slash.  */
+  if (result == 0 && !S_ISDIR (st->st_mode))
+    {
+      size_t len = strlen (name);
+      if (ISSLASH (name[len - 1]))
+        {
+          errno = ENOTDIR;
+          return -1;
+        }
+    }
+#endif /* REPLACE_FUNC_STAT_FILE */
+#if REPLACE_FUNC_STAT_DIR
+  if (result == -1 && errno == ENOENT)
+    {
+      /* Due to mingw's oddities, there are some directories (like
+         c:\) where stat() only succeeds with a trailing slash, and
+         other directories (like c:\windows) where stat() only
+         succeeds without a trailing slash.  But we want the two to be
+         synonymous, since chdir() manages either style.  Likewise, Mingw also
+         reports ENOENT for names longer than PATH_MAX, when we want
+         ENAMETOOLONG, and for stat("file/"), when we want ENOTDIR.
+         Fortunately, mingw PATH_MAX is small enough for stack
+         allocation.  */
+      char fixed_name[PATH_MAX + 1] = {0};
+      size_t len = strlen (name);
+      bool check_dir = false;
+      if (PATH_MAX <= len)
+        errno = ENAMETOOLONG;
+      else if (len)
+        {
+          strcpy (fixed_name, name);
+          if (ISSLASH (fixed_name[len - 1]))
+            {
+              check_dir = true;
+              while (len && ISSLASH (fixed_name[len - 1]))
+                fixed_name[--len] = '\0';
+              if (!len)
+                fixed_name[0] = '/';
+            }
+          else
+            fixed_name[len++] = '/';
+          result = orig_stat (fixed_name, st);
+          if (result == 0 && check_dir && !S_ISDIR (st->st_mode))
+            {
+              result = -1;
+              errno = ENOTDIR;
+            }
+        }
+    }
+#endif /* REPLACE_FUNC_STAT_DIR */
+  return result;
+}
diff --git a/gl/stdbool.in.h b/db/gl/stdbool.in.h
similarity index 100%
copy from gl/stdbool.in.h
copy to db/gl/stdbool.in.h
diff --git a/db/gl/stddef.in.h b/db/gl/stddef.in.h
new file mode 100644
index 0000000..aff3b94
--- /dev/null
+++ b/db/gl/stddef.in.h
@@ -0,0 +1,86 @@
+/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
+
+   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, 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 Eric Blake.  */
+
+/*
+ * POSIX 2008 <stddef.h> for platforms that have issues.
+ * <http://www.opengroup.org/susv3xbd/stddef.h.html>
+ */
+
+#if __GNUC__ >= 3
address@hidden@
+#endif
+
+#if defined __need_wchar_t || defined __need_size_t  \
+  || defined __need_ptrdiff_t || defined __need_NULL \
+  || defined __need_wint_t
+/* Special invocation convention inside gcc header files.  In
+   particular, gcc provides a version of <stddef.h> that blindly
+   redefines NULL even when __need_wint_t was defined, even though
+   wint_t is not normally provided by <stddef.h>.  Hence, we must
+   remember if special invocation has ever been used to obtain wint_t,
+   in which case we need to clean up NULL yet again.  */
+
+# if !(defined _GL_STDDEF_H && defined _GL_STDDEF_WINT_T)
+#  ifdef __need_wint_t
+#   undef _GL_STDDEF_H
+#   define _GL_STDDEF_WINT_T
+#  endif
+#  @INCLUDE_NEXT@ @NEXT_STDDEF_H@
+# endif
+
+#else
+/* Normal invocation convention.  */
+
+# ifndef _GL_STDDEF_H
+
+/* The include_next requires a split double-inclusion guard.  */
+
+#  @INCLUDE_NEXT@ @NEXT_STDDEF_H@
+
+#  ifndef _GL_STDDEF_H
+#   define _GL_STDDEF_H
+
+/* On NetBSD 5.0, the definition of NULL lacks proper parentheses.  */
+#if @REPLACE_NULL@
+# undef NULL
+# ifdef __cplusplus
+   /* ISO C++ says that the macro NULL must expand to an integer constant
+      expression, hence '((void *) 0)' is not allowed in C++.  */
+#  if __GNUG__ >= 3
+    /* GNU C++ has a __null macro that behaves like an integer ('int' or
+       'long') but has the same size as a pointer.  Use that, to avoid
+       warnings.  */
+#   define NULL __null
+#  else
+#   define NULL 0L
+#  endif
+# else
+#  define NULL ((void *) 0)
+# endif
+#endif
+
+/* Some platforms lack wchar_t.  */
+#if address@hidden@
+# define wchar_t int
+#endif
+
+#  endif /* _GL_STDDEF_H */
+# endif /* _GL_STDDEF_H */
+#endif /* __need_XXX */
diff --git a/gl/stdint.in.h b/db/gl/stdint.in.h
similarity index 98%
copy from gl/stdint.in.h
copy to db/gl/stdint.in.h
index 53aa34a..9467e75 100644
--- a/gl/stdint.in.h
+++ b/db/gl/stdint.in.h
@@ -102,8 +102,8 @@
   ((signed) \
    ? ~ _STDINT_MIN (signed, bits, zero) \
    : /* The expression for the unsigned case.  The subtraction of (signed) \
-       is a nop in the unsigned case and avoids "signed integer overflow" \
-       warnings in the signed case.  */ \
+        is a nop in the unsigned case and avoids "signed integer overflow" \
+        warnings in the signed case.  */ \
      ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
 
 /* 7.18.1.1. Exact-width integer types */
@@ -454,10 +454,10 @@ typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == 
sizeof (uintmax_t)) -
 #undef SIG_ATOMIC_MAX
 #define SIG_ATOMIC_MIN  \
    _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
-               address@hidden@)
+                address@hidden@)
 #define SIG_ATOMIC_MAX  \
    _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
-               address@hidden@)
+                address@hidden@)
 
 
 /* size_t limit */
diff --git a/db/gl/sys_stat.in.h b/db/gl/sys_stat.in.h
new file mode 100644
index 0000000..5e51591
--- /dev/null
+++ b/db/gl/sys_stat.in.h
@@ -0,0 +1,548 @@
+/* Provide a more complete sys/stat header file.
+   Copyright (C) 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
+   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 Eric Blake, Paul Eggert, and Jim Meyering.  */
+
+/* This file is supposed to be used on platforms where <sys/stat.h> is
+   incomplete.  It is intended to provide definitions and prototypes
+   needed by an application.  Start with what the system provides.  */
+
+#if __GNUC__ >= 3
address@hidden@
+#endif
+
+#if defined __need_system_sys_stat_h
+/* Special invocation convention.  */
+
address@hidden@ @NEXT_SYS_STAT_H@
+
+#else
+/* Normal invocation convention.  */
+
+#ifndef _GL_SYS_STAT_H
+
+/* Get nlink_t.  */
+#include <sys/types.h>
+
+/* Get struct timespec.  */
+#include <time.h>
+
+/* The include_next requires a split double-inclusion guard.  */
address@hidden@ @NEXT_SYS_STAT_H@
+
+#ifndef _GL_SYS_STAT_H
+#define _GL_SYS_STAT_H
+
+/* The definition of GL_LINK_WARNING is copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* Before doing "#define mkdir rpl_mkdir" below, we need to include all
+   headers that may declare mkdir().  */
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+# include <io.h>
+#endif
+
+#ifndef S_IFMT
+# define S_IFMT 0170000
+#endif
+
+#if STAT_MACROS_BROKEN
+# undef S_ISBLK
+# undef S_ISCHR
+# undef S_ISDIR
+# undef S_ISFIFO
+# undef S_ISLNK
+# undef S_ISNAM
+# undef S_ISMPB
+# undef S_ISMPC
+# undef S_ISNWK
+# undef S_ISREG
+# undef S_ISSOCK
+#endif
+
+#ifndef S_ISBLK
+# ifdef S_IFBLK
+#  define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
+# else
+#  define S_ISBLK(m) 0
+# endif
+#endif
+
+#ifndef S_ISCHR
+# ifdef S_IFCHR
+#  define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+# else
+#  define S_ISCHR(m) 0
+# endif
+#endif
+
+#ifndef S_ISDIR
+# ifdef S_IFDIR
+#  define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+# else
+#  define S_ISDIR(m) 0
+# endif
+#endif
+
+#ifndef S_ISDOOR /* Solaris 2.5 and up */
+# define S_ISDOOR(m) 0
+#endif
+
+#ifndef S_ISFIFO
+# ifdef S_IFIFO
+#  define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+# else
+#  define S_ISFIFO(m) 0
+# endif
+#endif
+
+#ifndef S_ISLNK
+# ifdef S_IFLNK
+#  define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
+# else
+#  define S_ISLNK(m) 0
+# endif
+#endif
+
+#ifndef S_ISMPB /* V7 */
+# ifdef S_IFMPB
+#  define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
+#  define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
+# else
+#  define S_ISMPB(m) 0
+#  define S_ISMPC(m) 0
+# endif
+#endif
+
+#ifndef S_ISNAM /* Xenix */
+# ifdef S_IFNAM
+#  define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
+# else
+#  define S_ISNAM(m) 0
+# endif
+#endif
+
+#ifndef S_ISNWK /* HP/UX */
+# ifdef S_IFNWK
+#  define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
+# else
+#  define S_ISNWK(m) 0
+# endif
+#endif
+
+#ifndef S_ISPORT /* Solaris 10 and up */
+# define S_ISPORT(m) 0
+#endif
+
+#ifndef S_ISREG
+# ifdef S_IFREG
+#  define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+# else
+#  define S_ISREG(m) 0
+# endif
+#endif
+
+#ifndef S_ISSOCK
+# ifdef S_IFSOCK
+#  define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
+# else
+#  define S_ISSOCK(m) 0
+# endif
+#endif
+
+
+#ifndef S_TYPEISMQ
+# define S_TYPEISMQ(p) 0
+#endif
+
+#ifndef S_TYPEISTMO
+# define S_TYPEISTMO(p) 0
+#endif
+
+
+#ifndef S_TYPEISSEM
+# ifdef S_INSEM
+#  define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
+# else
+#  define S_TYPEISSEM(p) 0
+# endif
+#endif
+
+#ifndef S_TYPEISSHM
+# ifdef S_INSHD
+#  define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
+# else
+#  define S_TYPEISSHM(p) 0
+# endif
+#endif
+
+/* high performance ("contiguous data") */
+#ifndef S_ISCTG
+# define S_ISCTG(p) 0
+#endif
+
+/* Cray DMF (data migration facility): off line, with data  */
+#ifndef S_ISOFD
+# define S_ISOFD(p) 0
+#endif
+
+/* Cray DMF (data migration facility): off line, with no data  */
+#ifndef S_ISOFL
+# define S_ISOFL(p) 0
+#endif
+
+/* 4.4BSD whiteout */
+#ifndef S_ISWHT
+# define S_ISWHT(m) 0
+#endif
+
+/* If any of the following are undefined,
+   define them to their de facto standard values.  */
+#if !S_ISUID
+# define S_ISUID 04000
+#endif
+#if !S_ISGID
+# define S_ISGID 02000
+#endif
+
+/* S_ISVTX is a common extension to POSIX.  */
+#ifndef S_ISVTX
+# define S_ISVTX 01000
+#endif
+
+#if !S_IRUSR && S_IREAD
+# define S_IRUSR S_IREAD
+#endif
+#if !S_IRUSR
+# define S_IRUSR 00400
+#endif
+#if !S_IRGRP
+# define S_IRGRP (S_IRUSR >> 3)
+#endif
+#if !S_IROTH
+# define S_IROTH (S_IRUSR >> 6)
+#endif
+
+#if !S_IWUSR && S_IWRITE
+# define S_IWUSR S_IWRITE
+#endif
+#if !S_IWUSR
+# define S_IWUSR 00200
+#endif
+#if !S_IWGRP
+# define S_IWGRP (S_IWUSR >> 3)
+#endif
+#if !S_IWOTH
+# define S_IWOTH (S_IWUSR >> 6)
+#endif
+
+#if !S_IXUSR && S_IEXEC
+# define S_IXUSR S_IEXEC
+#endif
+#if !S_IXUSR
+# define S_IXUSR 00100
+#endif
+#if !S_IXGRP
+# define S_IXGRP (S_IXUSR >> 3)
+#endif
+#if !S_IXOTH
+# define S_IXOTH (S_IXUSR >> 6)
+#endif
+
+#if !S_IRWXU
+# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
+#endif
+#if !S_IRWXG
+# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
+#endif
+#if !S_IRWXO
+# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
+#endif
+
+/* S_IXUGO is a common extension to POSIX.  */
+#if !S_IXUGO
+# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
+#endif
+
+#ifndef S_IRWXUGO
+# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
+#endif
+
+/* Macros for futimens and utimensat.  */
+#ifndef UTIME_NOW
+# define UTIME_NOW (-1)
+# define UTIME_OMIT (-2)
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#if @GNULIB_FCHMODAT@
+# if address@hidden@
+extern int fchmodat (int fd, char const *file, mode_t mode, int flag)
+     _GL_ARG_NONNULL ((2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fchmodat
+# define fchmodat(d,n,m,f)                         \
+    (GL_LINK_WARNING ("fchmodat is not portable - " \
+                      "use gnulib module openat for portability"), \
+     fchmodat (d, n, m, f))
+#endif
+
+
+#if @REPLACE_FSTAT@
+# define fstat rpl_fstat
+extern int fstat (int fd, struct stat *buf) _GL_ARG_NONNULL ((2));
+#endif
+
+
+#if @GNULIB_FSTATAT@
+# if @REPLACE_FSTATAT@
+#  undef fstatat
+#  define fstatat rpl_fstatat
+# endif
+# if address@hidden@ || @REPLACE_FSTATAT@
+extern int fstatat (int fd, char const *name, struct stat *st, int flags)
+     _GL_ARG_NONNULL ((2, 3));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fstatat
+# define fstatat(d,n,s,f)                         \
+    (GL_LINK_WARNING ("fstatat is not portable - " \
+                      "use gnulib module openat for portability"), \
+     fstatat (d, n, s, f))
+#endif
+
+
+#if @GNULIB_FUTIMENS@
+# if @REPLACE_FUTIMENS@
+#  undef futimens
+#  define futimens rpl_futimens
+# endif
+# if address@hidden@ || @REPLACE_FUTIMENS@
+extern int futimens (int fd, struct timespec const times[2]);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef futimens
+# define futimens(f,t)                         \
+    (GL_LINK_WARNING ("futimens is not portable - " \
+                      "use gnulib module futimens for portability"), \
+     futimens (f, t))
+#endif
+
+
+#if @GNULIB_LCHMOD@
+/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
+   denotes a symbolic link.  */
+# if address@hidden@
+/* The lchmod replacement follows symbolic links.  Callers should take
+   this into account; lchmod should be applied only to arguments that
+   are known to not be symbolic links.  On hosts that lack lchmod,
+   this can lead to race conditions between the check and the
+   invocation of lchmod, but we know of no workarounds that are
+   reliable in general.  You might try requesting support for lchmod
+   from your operating system supplier.  */
+#  define lchmod chmod
+# endif
+# if 0 /* assume already declared */
+extern int lchmod (const char *filename, mode_t mode) _GL_ARG_NONNULL ((1));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef lchmod
+# define lchmod(f,m) \
+    (GL_LINK_WARNING ("lchmod is unportable - " \
+                      "use gnulib module lchmod for portability"), \
+     lchmod (f, m))
+#endif
+
+
+#if @GNULIB_LSTAT@
+# if ! @HAVE_LSTAT@
+/* mingw does not support symlinks, therefore it does not have lstat.  But
+   without links, stat does just fine.  */
+#  define lstat stat
+# elif @REPLACE_LSTAT@
+#  undef lstat
+#  define lstat rpl_lstat
+extern int rpl_lstat (const char *name, struct stat *buf)
+     _GL_ARG_NONNULL ((1, 2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef lstat
+# define lstat(p,b)                                                     \
+  (GL_LINK_WARNING ("lstat is unportable - "                            \
+                    "use gnulib module lstat for portability"),         \
+   lstat (p, b))
+#endif
+
+
+#if @REPLACE_MKDIR@
+# undef mkdir
+# define mkdir rpl_mkdir
+extern int mkdir (char const *name, mode_t mode) _GL_ARG_NONNULL ((1));
+#else
+/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
+   Additionally, it declares _mkdir (and depending on compile flags, an
+   alias mkdir), only in the nonstandard <io.h>, which is included above.  */
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+
+static inline int
+rpl_mkdir (char const *name, mode_t mode)
+{
+  return _mkdir (name);
+}
+
+#  define mkdir rpl_mkdir
+# endif
+#endif
+
+
+#if @GNULIB_MKDIRAT@
+# if address@hidden@
+extern int mkdirat (int fd, char const *file, mode_t mode)
+     _GL_ARG_NONNULL ((2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mkdirat
+# define mkdirat(d,n,m)                         \
+    (GL_LINK_WARNING ("mkdirat is not portable - " \
+                      "use gnulib module openat for portability"), \
+     mkdirat (d, n, m))
+#endif
+
+
+#if @GNULIB_MKFIFO@
+# if @REPLACE_MKFIFO@
+#  undef mkfifo
+#  define mkfifo rpl_mkfifo
+# endif
+# if address@hidden@ || @REPLACE_MKFIFO@
+extern int mkfifo (char const *file, mode_t mode) _GL_ARG_NONNULL ((1));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mkfifo
+# define mkfifo(n,m)                                                    \
+    (GL_LINK_WARNING ("mkfifo is not portable - "                       \
+                      "use gnulib module mkfifo for portability"),      \
+     mkfifo (n, m))
+#endif
+
+
+#if @GNULIB_MKFIFOAT@
+# if address@hidden@
+extern int mkfifoat (int fd, char const *file, mode_t mode)
+     _GL_ARG_NONNULL ((2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mkfifoat
+# define mkfifoat(d,n,m)                                     \
+    (GL_LINK_WARNING ("mkfifoat is not portable - " \
+                      "use gnulib module mkfifoat for portability"), \
+     mkfifoat (d, n, m))
+#endif
+
+
+#if @GNULIB_MKNOD@
+# if @REPLACE_MKNOD@
+#  undef mknod
+#  define mknod rpl_mknod
+# endif
+# if address@hidden@ || @REPLACE_MKNOD@
+extern int mknod (char const *file, mode_t mode, dev_t dev)
+     _GL_ARG_NONNULL ((1));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mknod
+# define mknod(n,m,d)                                                   \
+    (GL_LINK_WARNING ("mknod is not portable - "                        \
+                      "use gnulib module mknod for portability"),       \
+     mknod (n, m, d))
+#endif
+
+
+#if @GNULIB_MKNODAT@
+# if address@hidden@
+extern int mknodat (int fd, char const *file, mode_t mode, dev_t dev)
+     _GL_ARG_NONNULL ((2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mknodat
+# define mknodat(f,n,m,d)                            \
+    (GL_LINK_WARNING ("mknodat is not portable - " \
+                      "use gnulib module mkfifoat for portability"), \
+     mknodat (f, n, m, d))
+#endif
+
+
+#if @GNULIB_STAT@
+# if @REPLACE_STAT@
+/* We can't use the object-like #define stat rpl_stat, because of
+   struct stat.  This means that rpl_stat will not be used if the user
+   does (stat)(a,b).  Oh well.  */
+#  undef stat
+#  ifdef _LARGE_FILES
+    /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
+       so we have to replace stat64() instead of stat(). */
+#   define stat stat64
+#   undef stat64
+#   define stat64(name, st) rpl_stat (name, st)
+#  else /* !_LARGE_FILES */
+#   define stat(name, st) rpl_stat (name, st)
+#  endif /* !_LARGE_FILES */
+extern int stat (const char *name, struct stat *buf) _GL_ARG_NONNULL ((1, 2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef stat
+# define stat(p,b)                                                      \
+  (GL_LINK_WARNING ("stat is unportable - "                             \
+                    "use gnulib module stat for portability"),          \
+   stat (p, b))
+#endif
+
+
+#if @GNULIB_UTIMENSAT@
+# if @REPLACE_UTIMENSAT@
+#  undef utimensat
+#  define utimensat rpl_utimensat
+# endif
+# if address@hidden@ || @REPLACE_UTIMENSAT@
+   extern int utimensat (int fd, char const *name,
+                         struct timespec const times[2], int flag)
+        _GL_ARG_NONNULL ((2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef utimensat
+# define utimensat(d,n,t,f)                          \
+    (GL_LINK_WARNING ("utimensat is not portable - " \
+                      "use gnulib module utimensat for portability"), \
+     utimensat (d, n, t, f))
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _GL_SYS_STAT_H */
+#endif /* _GL_SYS_STAT_H */
+#endif
diff --git a/gl/time.in.h b/db/gl/time.in.h
similarity index 76%
copy from gl/time.in.h
copy to db/gl/time.in.h
index dec37e8..3578534 100644
--- a/gl/time.in.h
+++ b/db/gl/time.in.h
@@ -1,6 +1,6 @@
 /* A more-standard <time.h>.
 
-   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,6 +37,11 @@
 
 # @INCLUDE_NEXT@ @NEXT_TIME_H@
 
+/* NetBSD 5.0 mis-defines NULL.  */
+#include <stddef.h>
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 # ifdef __cplusplus
 extern "C" {
 # endif
@@ -63,7 +68,14 @@ struct timespec
    <http://www.opengroup.org/susv3xsh/nanosleep.html>.  */
 # if @REPLACE_NANOSLEEP@
 #  define nanosleep rpl_nanosleep
-int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp);
+extern int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp)
+     _GL_ARG_NONNULL ((1));
+# endif
+
+/* Return the 'time_t' representation of TP and normalize TP.  */
+# if @REPLACE_MKTIME@
+#  define mktime rpl_mktime
+extern time_t mktime (struct tm *__tp) _GL_ARG_NONNULL ((1));
 # endif
 
 /* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
@@ -74,10 +86,12 @@ int nanosleep (struct timespec const *__rqtp, struct 
timespec *__rmtp);
 #  define localtime_r rpl_localtime_r
 #  undef gmtime_r
 #  define gmtime_r rpl_gmtime_r
-struct tm *localtime_r (time_t const *restrict __timer,
-                       struct tm *restrict __result);
-struct tm *gmtime_r (time_t const *restrict __timer,
-                    struct tm *restrict __result);
+extern struct tm *localtime_r (time_t const *restrict __timer,
+                               struct tm *restrict __result)
+     _GL_ARG_NONNULL ((1, 2));
+extern struct tm *gmtime_r (time_t const *restrict __timer,
+                            struct tm *restrict __result)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 
 /* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
@@ -86,15 +100,17 @@ struct tm *gmtime_r (time_t const *restrict __timer,
 # if @REPLACE_STRPTIME@
 #  undef strptime
 #  define strptime rpl_strptime
-char *strptime (char const *restrict __buf, char const *restrict __format,
-               struct tm *restrict __tm);
+extern char *strptime (char const *restrict __buf,
+                       char const *restrict __format,
+                       struct tm *restrict __tm)
+     _GL_ARG_NONNULL ((1, 2, 3));
 # endif
 
 /* Convert TM to a time_t value, assuming UTC.  */
 # if @REPLACE_TIMEGM@
 #  undef timegm
 #  define timegm rpl_timegm
-time_t timegm (struct tm *__tm);
+extern time_t timegm (struct tm *__tm) _GL_ARG_NONNULL ((1));
 # endif
 
 /* Encourage applications to avoid unsafe functions that can overrun
diff --git a/gl/wchar.in.h b/db/gl/wchar.in.h
similarity index 96%
copy from gl/wchar.in.h
copy to db/gl/wchar.in.h
index cc5baad..df171d6 100644
--- a/gl/wchar.in.h
+++ b/db/gl/wchar.in.h
@@ -74,6 +74,8 @@
 
 /* The definition of GL_LINK_WARNING is copied here.  */
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -197,7 +199,8 @@ extern size_t mbrlen (const char *s, size_t n, mbstate_t 
*ps);
 #  define mbsrtowcs rpl_mbsrtowcs
 # endif
 # if address@hidden@ || @REPLACE_MBSRTOWCS@
-extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, 
mbstate_t *ps);
+extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, 
mbstate_t *ps)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsrtowcs
@@ -215,7 +218,8 @@ extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, 
size_t len, mbstate_t
 #  define mbsnrtowcs rpl_mbsnrtowcs
 # endif
 # if address@hidden@ || @REPLACE_MBSNRTOWCS@
-extern size_t mbsnrtowcs (wchar_t *dest, const char **srcp, size_t srclen, 
size_t len, mbstate_t *ps);
+extern size_t mbsnrtowcs (wchar_t *dest, const char **srcp, size_t srclen, 
size_t len, mbstate_t *ps)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsnrtowcs
@@ -251,7 +255,8 @@ extern size_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps);
 #  define wcsrtombs rpl_wcsrtombs
 # endif
 # if address@hidden@ || @REPLACE_WCSRTOMBS@
-extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, 
mbstate_t *ps);
+extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, 
mbstate_t *ps)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsrtombs
@@ -269,7 +274,8 @@ extern size_t wcsrtombs (char *dest, const wchar_t **srcp, 
size_t len, mbstate_t
 #  define wcsnrtombs rpl_wcsnrtombs
 # endif
 # if address@hidden@ || @REPLACE_WCSNRTOMBS@
-extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, 
size_t len, mbstate_t *ps);
+extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, 
size_t len, mbstate_t *ps)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsnrtombs
diff --git a/gl/Makefile.am b/gl/Makefile.am
index 680cde1..8f2ea19 100644
--- a/gl/Makefile.am
+++ b/gl/Makefile.am
@@ -63,9 +63,10 @@ BUILT_SOURCES += $(ALLOCA_H)
 # We need the following in order to create <alloca.h> when the system
 # doesn't have one that works with the given compiler.
 alloca.h: alloca.in.h
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          cat $(srcdir)/alloca.in.h; \
-       } > address@hidden
+       } > address@hidden && \
        mv -f address@hidden $@
 MOSTLYCLEANFILES += alloca.h alloca.h-t
 
@@ -73,15 +74,39 @@ EXTRA_DIST += alloca.in.h
 
 ## end   gnulib module alloca-opt
 
+## begin gnulib module arg-nonnull
+
+# The BUILT_SOURCES created by this Makefile snippet are not used via #include
+# statements but through direct file reference. Therefore this snippet must be
+# present in all Makefile.am that need it. This is ensured by the applicability
+# 'all' defined above.
+
+BUILT_SOURCES += arg-nonnull.h
+# The arg-nonnull.h that gets inserted into generated .h files is the same as
+# build-aux/arg-nonnull.h, except that it has the copyright header cut off.
+arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       sed -n -e '/GL_ARG_NONNULL/,$$p' \
+         < $(top_srcdir)/build-aux/arg-nonnull.h \
+         > address@hidden && \
+       mv address@hidden $@
+MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t
+
+ARG_NONNULL_H=arg-nonnull.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h
+
+## end   gnulib module arg-nonnull
+
 ## begin gnulib module arpa_inet
 
 BUILT_SOURCES += $(ARPA_INET_H)
 
 # We need the following in order to create <arpa/inet.h> when the system
 # doesn't have one.
-arpa/inet.h: arpa_inet.in.h
-       @MKDIR_P@ arpa
-       rm -f address@hidden $@
+arpa/inet.h: arpa_inet.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+       $(AM_V_at)$(MKDIR_P) arpa
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
@@ -92,8 +117,9 @@ arpa/inet.h: arpa_inet.in.h
              -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \
              -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              < $(srcdir)/arpa_inet.in.h; \
-       } > address@hidden
+       } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += arpa/inet.h arpa/inet.h-t
 MOSTLYCLEANDIRS += arpa
@@ -234,6 +260,15 @@ EXTRA_libgnu_la_SOURCES += gc-pbkdf2-sha1.c
 
 ## end   gnulib module crypto/gc-pbkdf2-sha1
 
+## begin gnulib module dup2
+
+
+EXTRA_DIST += dup2.c
+
+EXTRA_libgnu_la_SOURCES += dup2.c
+
+## end   gnulib module dup2
+
 ## begin gnulib module errno
 
 BUILT_SOURCES += $(ERRNO_H)
@@ -241,7 +276,7 @@ BUILT_SOURCES += $(ERRNO_H)
 # We need the following in order to create <errno.h> when the system
 # doesn't have one that is POSIX compliant.
 errno.h: errno.in.h
-       rm -f address@hidden $@
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
@@ -253,7 +288,7 @@ errno.h: errno.in.h
              -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \
              -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \
              < $(srcdir)/errno.in.h; \
-       } > address@hidden
+       } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += errno.h errno.h-t
 
@@ -272,26 +307,43 @@ EXTRA_libgnu_la_SOURCES += fclose.c
 
 ## begin gnulib module fcntl
 
-BUILT_SOURCES += $(FCNTL_H)
+
+EXTRA_DIST += fcntl.c
+
+EXTRA_libgnu_la_SOURCES += fcntl.c
+
+## end   gnulib module fcntl
+
+## begin gnulib module fcntl-h
+
+BUILT_SOURCES += fcntl.h
 
 # We need the following in order to create <fcntl.h> when the system
 # doesn't have one that works with the given compiler.
-fcntl.h: fcntl.in.h
-       rm -f address@hidden $@
+fcntl.h: fcntl.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \
+             -e 's|@''GNULIB_FCNTL''@|$(GNULIB_FCNTL)|g' \
              -e 's|@''GNULIB_OPEN''@|$(GNULIB_OPEN)|g' \
+             -e 's|@''GNULIB_OPENAT''@|$(GNULIB_OPENAT)|g' \
+             -e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \
+             -e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \
+             -e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \
              -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \
+             -e 's|@''REPLACE_OPENAT''@|$(REPLACE_OPENAT)|g' \
+             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              < $(srcdir)/fcntl.in.h; \
-       } > address@hidden
+       } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += fcntl.h fcntl.h-t
 
 EXTRA_DIST += fcntl.in.h
 
-## end   gnulib module fcntl
+## end   gnulib module fcntl-h
 
 ## begin gnulib module float
 
@@ -300,13 +352,13 @@ BUILT_SOURCES += $(FLOAT_H)
 # We need the following in order to create <float.h> when the system
 # doesn't have one that works with the given compiler.
 float.h: float.in.h
-       rm -f address@hidden $@
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \
              < $(srcdir)/float.in.h; \
-       } > address@hidden
+       } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += float.h float.h-t
 
@@ -371,7 +423,7 @@ EXTRA_libgnu_la_SOURCES += getdomainname.c
 ## begin gnulib module gethostname
 
 
-EXTRA_DIST += gethostname.c
+EXTRA_DIST += gethostname.c w32sock.h
 
 EXTRA_libgnu_la_SOURCES += gethostname.c
 
@@ -386,15 +438,6 @@ EXTRA_libgnu_la_SOURCES += getline.c
 
 ## end   gnulib module getline
 
-## begin gnulib module getpagesize
-
-
-EXTRA_DIST += getpagesize.c
-
-EXTRA_libgnu_la_SOURCES += getpagesize.c
-
-## end   gnulib module getpagesize
-
 ## begin gnulib module getpass
 
 
@@ -488,7 +531,23 @@ EXTRA_DIST += intprops.h
 
 ## begin gnulib module link-warning
 
-LINK_WARNING_H=$(top_srcdir)/build-aux/link-warning.h
+# The BUILT_SOURCES created by this Makefile snippet are not used via #include
+# statements but through direct file reference. Therefore this snippet must be
+# present in all Makefile.am that need it. This is ensured by the applicability
+# 'all' defined above.
+
+BUILT_SOURCES += link-warning.h
+# The link-warning.h that gets inserted into generated .h files is the same as
+# build-aux/link-warning.h, except that it has the copyright header cut off.
+link-warning.h: $(top_srcdir)/build-aux/link-warning.h
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       sed -n -e '/GL_LINK_WARNING/,$$p' \
+         < $(top_srcdir)/build-aux/link-warning.h \
+         > address@hidden && \
+       mv address@hidden $@
+MOSTLYCLEANFILES += link-warning.h link-warning.h-t
+
+LINK_WARNING_H=link-warning.h
 
 EXTRA_DIST += $(top_srcdir)/build-aux/link-warning.h
 
@@ -544,7 +603,7 @@ libgnu_la_SOURCES += minmax.h
 ## begin gnulib module mktime
 
 
-EXTRA_DIST += mktime.c
+EXTRA_DIST += mktime-internal.h mktime.c
 
 EXTRA_libgnu_la_SOURCES += mktime.c
 
@@ -556,8 +615,8 @@ BUILT_SOURCES += $(NETDB_H)
 
 # We need the following in order to create <netdb.h> when the system
 # doesn't have one that works with the given compiler.
-netdb.h: netdb.in.h
-       rm -f address@hidden $@
+netdb.h: netdb.in.h $(ARG_NONNULL_H)
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
@@ -569,8 +628,9 @@ netdb.h: netdb.in.h
              -e 's|@''HAVE_DECL_GAI_STRERROR''@|$(HAVE_DECL_GAI_STRERROR)|g' \
              -e 's|@''HAVE_DECL_GETADDRINFO''@|$(HAVE_DECL_GETADDRINFO)|g' \
              -e 's|@''HAVE_DECL_GETNAMEINFO''@|$(HAVE_DECL_GETNAMEINFO)|g' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              < $(srcdir)/netdb.in.h; \
-       } > address@hidden
+       } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += netdb.h netdb.h-t
 
@@ -585,15 +645,15 @@ BUILT_SOURCES += $(NETINET_IN_H)
 # We need the following in order to create <netinet/in.h> when the system
 # doesn't have one.
 netinet/in.h: netinet_in.in.h
-       @MKDIR_P@ netinet
-       rm -f address@hidden $@
+       $(AM_V_at)$(MKDIR_P) netinet
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_NETINET_IN_H''@|$(NEXT_NETINET_IN_H)|g' \
              -e 's|@''HAVE_NETINET_IN_H''@|$(HAVE_NETINET_IN_H)|g' \
              < $(srcdir)/netinet_in.in.h; \
-       } > address@hidden
+       } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t
 MOSTLYCLEANDIRS += netinet
@@ -680,8 +740,8 @@ BUILT_SOURCES += signal.h
 
 # We need the following in order to create <signal.h> when the system
 # doesn't have a complete one.
-signal.h: signal.in.h
-       rm -f address@hidden $@
+signal.h: signal.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
@@ -696,8 +756,9 @@ signal.h: signal.in.h
              -e 
's|@''HAVE_STRUCT_SIGACTION_SA_SIGACTION''@|$(HAVE_STRUCT_SIGACTION_SA_SIGACTION)|g'
 \
              -e 
's|@''HAVE_TYPE_VOLATILE_SIG_ATOMIC_T''@|$(HAVE_TYPE_VOLATILE_SIG_ATOMIC_T)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              < $(srcdir)/signal.in.h; \
-       } > address@hidden
+       } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += signal.h signal.h-t
 
@@ -744,13 +805,13 @@ BUILT_SOURCES += $(STDARG_H)
 # We need the following in order to create <stdarg.h> when the system
 # doesn't have one that works with the given compiler.
 stdarg.h: stdarg.in.h
-       rm -f address@hidden $@
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_STDARG_H''@|$(NEXT_STDARG_H)|g' \
              < $(srcdir)/stdarg.in.h; \
-       } > address@hidden
+       } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += stdarg.h stdarg.h-t
 
@@ -765,10 +826,10 @@ BUILT_SOURCES += $(STDBOOL_H)
 # We need the following in order to create <stdbool.h> when the system
 # doesn't have one that works.
 stdbool.h: stdbool.in.h
-       rm -f address@hidden $@
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; 
\
-       } > address@hidden
+       } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += stdbool.h stdbool.h-t
 
@@ -776,6 +837,29 @@ EXTRA_DIST += stdbool.in.h
 
 ## end   gnulib module stdbool
 
+## begin gnulib module stddef
+
+BUILT_SOURCES += $(STDDEF_H)
+
+# We need the following in order to create <stddef.h> when the system
+# doesn't have one that works with the given compiler.
+stddef.h: stddef.in.h
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
+             -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \
+             -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
+             < $(srcdir)/stddef.in.h; \
+       } > address@hidden && \
+       mv address@hidden $@
+MOSTLYCLEANFILES += stddef.h stddef.h-t
+
+EXTRA_DIST += stddef.in.h
+
+## end   gnulib module stddef
+
 ## begin gnulib module stdint
 
 BUILT_SOURCES += $(STDINT_H)
@@ -783,7 +867,7 @@ BUILT_SOURCES += $(STDINT_H)
 # We need the following in order to create <stdint.h> when the system
 # doesn't have one that works with the given compiler.
 stdint.h: stdint.in.h
-       rm -f address@hidden $@
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -810,7 +894,7 @@ stdint.h: stdint.in.h
              -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
              -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
              < $(srcdir)/stdint.in.h; \
-       } > address@hidden
+       } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += stdint.h stdint.h-t
 
@@ -824,84 +908,94 @@ BUILT_SOURCES += stdio.h
 
 # We need the following in order to create <stdio.h> when the system
 # doesn't have one that works with the given compiler.
-stdio.h: stdio.in.h
-       rm -f address@hidden $@
+stdio.h: stdio.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \
-             -e 's|@''GNULIB_FPRINTF''@|$(GNULIB_FPRINTF)|g' \
-             -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \
-             -e 's|@''GNULIB_PRINTF''@|$(GNULIB_PRINTF)|g' \
-             -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \
-             -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \
-             -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \
-             -e 's|@''GNULIB_VFPRINTF''@|$(GNULIB_VFPRINTF)|g' \
-             -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \
-             -e 's|@''GNULIB_VPRINTF''@|$(GNULIB_VPRINTF)|g' \
-             -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \
-             -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
-             -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \
              -e 's|@''GNULIB_DPRINTF''@|$(GNULIB_DPRINTF)|g' \
-             -e 's|@''GNULIB_VDPRINTF''@|$(GNULIB_VDPRINTF)|g' \
-             -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \
-             -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \
-             -e 
's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_FCLOSE''@|$(GNULIB_FCLOSE)|g' \
+             -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \
              -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \
+             -e 's|@''GNULIB_FPRINTF''@|$(GNULIB_FPRINTF)|g' \
+             -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_FPURGE''@|$(GNULIB_FPURGE)|g' \
+             -e 's|@''GNULIB_FPUTC''@|$(GNULIB_FPUTC)|g' \
+             -e 's|@''GNULIB_FPUTS''@|$(GNULIB_FPUTS)|g' \
              -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \
              -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \
              -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \
              -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \
              -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \
-             -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \
-             -e 's|@''GNULIB_FPURGE''@|$(GNULIB_FPURGE)|g' \
-             -e 's|@''GNULIB_FCLOSE''@|$(GNULIB_FCLOSE)|g' \
-             -e 's|@''GNULIB_FPUTC''@|$(GNULIB_FPUTC)|g' \
-             -e 's|@''GNULIB_PUTC''@|$(GNULIB_PUTC)|g' \
-             -e 's|@''GNULIB_PUTCHAR''@|$(GNULIB_PUTCHAR)|g' \
-             -e 's|@''GNULIB_FPUTS''@|$(GNULIB_FPUTS)|g' \
-             -e 's|@''GNULIB_PUTS''@|$(GNULIB_PUTS)|g' \
              -e 's|@''GNULIB_FWRITE''@|$(GNULIB_FWRITE)|g' \
              -e 's|@''GNULIB_GETDELIM''@|$(GNULIB_GETDELIM)|g' \
              -e 's|@''GNULIB_GETLINE''@|$(GNULIB_GETLINE)|g' \
+             -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \
+             -e 
's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \
              -e 's|@''GNULIB_PERROR''@|$(GNULIB_PERROR)|g' \
+             -e 's|@''GNULIB_POPEN''@|$(GNULIB_POPEN)|g' \
+             -e 's|@''GNULIB_PRINTF''@|$(GNULIB_PRINTF)|g' \
+             -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_PUTC''@|$(GNULIB_PUTC)|g' \
+             -e 's|@''GNULIB_PUTCHAR''@|$(GNULIB_PUTCHAR)|g' \
+             -e 's|@''GNULIB_PUTS''@|$(GNULIB_PUTS)|g' \
+             -e 's|@''GNULIB_REMOVE''@|$(GNULIB_REMOVE)|g' \
+             -e 's|@''GNULIB_RENAME''@|$(GNULIB_RENAME)|g' \
+             -e 's|@''GNULIB_RENAMEAT''@|$(GNULIB_RENAMEAT)|g' \
+             -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \
+             -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \
              -e 's|@''GNULIB_STDIO_H_SIGPIPE''@|$(GNULIB_STDIO_H_SIGPIPE)|g' \
-             -e 
's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \
-             -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
-             -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \
-             -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \
-             -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \
-             -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \
+             -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \
+             -e 's|@''GNULIB_VDPRINTF''@|$(GNULIB_VDPRINTF)|g' \
+             -e 's|@''GNULIB_VFPRINTF''@|$(GNULIB_VFPRINTF)|g' \
+             -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_VPRINTF''@|$(GNULIB_VPRINTF)|g' \
+             -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
+             -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \
+             -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \
+             -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \
+             -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
+             -e 
's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \
              -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \
-             -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \
              -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \
-             -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \
-             -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
              -e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \
-             -e 's|@''REPLACE_DPRINTF''@|$(REPLACE_DPRINTF)|g' \
-             -e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \
-             -e 's|@''REPLACE_VDPRINTF''@|$(REPLACE_VDPRINTF)|g' \
+             -e 's|@''HAVE_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \
              -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
-             -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
-             -e 
's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \
-             -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \
+             -e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \
+             -e 's|@''REPLACE_DPRINTF''@|$(REPLACE_DPRINTF)|g' \
+             -e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \
+             -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
              -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \
+             -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
+             -e 's|@''REPLACE_FPURGE''@|$(REPLACE_FPURGE)|g' \
              -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \
-             -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
              -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \
-             -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
+             -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
              -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \
-             -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
-             -e 's|@''REPLACE_FPURGE''@|$(REPLACE_FPURGE)|g' \
-             -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \
-             -e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \
-             -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \
-             -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
+             -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
              -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \
+             -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \
              -e 's|@''REPLACE_PERROR''@|$(REPLACE_PERROR)|g' \
+             -e 's|@''REPLACE_POPEN''@|$(REPLACE_POPEN)|g' \
+             -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \
+             -e 's|@''REPLACE_REMOVE''@|$(REPLACE_REMOVE)|g' \
+             -e 's|@''REPLACE_RENAME''@|$(REPLACE_RENAME)|g' \
+             -e 's|@''REPLACE_RENAMEAT''@|$(REPLACE_RENAMEAT)|g' \
+             -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \
+             -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \
+             -e 
's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \
+             -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
+             -e 's|@''REPLACE_VDPRINTF''@|$(REPLACE_VDPRINTF)|g' \
+             -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \
+             -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \
+             -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \
+             -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              < $(srcdir)/stdio.in.h; \
-       } > address@hidden
+       } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += stdio.h stdio.h-t
 
@@ -917,23 +1011,27 @@ BUILT_SOURCES += stdlib.h
 
 # We need the following in order to create <stdlib.h> when the system
 # doesn't have one that works with the given compiler.
-stdlib.h: stdlib.in.h
-       rm -f address@hidden $@
+stdlib.h: stdlib.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
-             -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
-             -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \
-             -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \
-             -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \
              -e 's|@''GNULIB_ATOLL''@|$(GNULIB_ATOLL)|g' \
+             -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \
+             -e 
's|@''GNULIB_CANONICALIZE_FILE_NAME''@|$(GNULIB_CANONICALIZE_FILE_NAME)|g' \
              -e 's|@''GNULIB_GETLOADAVG''@|$(GNULIB_GETLOADAVG)|g' \
              -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \
+             -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' \
+             -e 's|@''GNULIB_REALPATH''@|$(GNULIB_REALPATH)|g' \
              -e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \
              -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \
              -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \
@@ -942,11 +1040,18 @@ stdlib.h: stdlib.in.h
              -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
              -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \
              -e 's|@''HAVE_CALLOC_POSIX''@|$(HAVE_CALLOC_POSIX)|g' \
+             -e 
's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \
+             -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|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_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' \
+             -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \
              -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
              -e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \
              -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
@@ -955,14 +1060,17 @@ stdlib.h: stdlib.in.h
              -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' 
\
              -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \
              -e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \
-             -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \
+             -e 
's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \
              -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)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              < $(srcdir)/stdlib.in.h; \
-       } > address@hidden
+       } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += stdlib.h stdlib.h-t
 
@@ -1012,8 +1120,8 @@ BUILT_SOURCES += string.h
 
 # We need the following in order to create <string.h> when the system
 # doesn't have one that works with the given compiler.
-string.h: string.in.h
-       rm -f address@hidden $@
+string.h: string.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
@@ -1059,7 +1167,6 @@ string.h: string.in.h
              -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \
              -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \
              -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \
-             -e 's|@''HAVE_STRNDUP''@|$(HAVE_STRNDUP)|g' \
              -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \
              -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \
              -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \
@@ -1075,10 +1182,14 @@ string.h: string.in.h
              -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \
              -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
              -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
+             -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \
              -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
+             -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \
+             -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              < $(srcdir)/string.in.h; \
-       } > address@hidden
+       } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += string.h string.h-t
 
@@ -1092,8 +1203,8 @@ BUILT_SOURCES += strings.h
 
 # We need the following in order to create <strings.h> when the system
 # doesn't have one that works with the given compiler.
-strings.h: strings.in.h
-       rm -f address@hidden $@
+strings.h: strings.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
@@ -1101,8 +1212,9 @@ strings.h: strings.in.h
              -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
              -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              < $(srcdir)/strings.in.h; \
-       } > address@hidden
+       } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += strings.h strings.h-t
 
@@ -1152,9 +1264,9 @@ BUILT_SOURCES += $(SYS_SELECT_H)
 
 # We need the following in order to create <sys/select.h> when the system
 # doesn't have one that works with the given compiler.
-sys/select.h: sys_select.in.h
-       @MKDIR_P@ sys
-       rm -f address@hidden $@
+sys/select.h: sys_select.in.h $(LINK_WARNING_H)
+       $(AM_V_at)$(MKDIR_P) sys
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
@@ -1165,7 +1277,7 @@ sys/select.h: sys_select.in.h
              -e 's|@''REPLACE_SELECT''@|$(REPLACE_SELECT)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              < $(srcdir)/sys_select.in.h; \
-       } > address@hidden
+       } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += sys/select.h sys/select.h-t
 MOSTLYCLEANDIRS += sys
@@ -1180,8 +1292,9 @@ BUILT_SOURCES += $(SYS_SOCKET_H)
 
 # We need the following in order to create <sys/socket.h> when the system
 # doesn't have one that works with the given compiler.
-sys/socket.h: sys_socket.in.h
-       @MKDIR_P@ sys
+sys/socket.h: sys_socket.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+       $(AM_V_at)$(MKDIR_P) sys
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
@@ -1202,13 +1315,16 @@ sys/socket.h: sys_socket.in.h
              -e 's|@''GNULIB_SENDTO''@|$(GNULIB_SENDTO)|g' \
              -e 's|@''GNULIB_SETSOCKOPT''@|$(GNULIB_SETSOCKOPT)|g' \
              -e 's|@''GNULIB_SHUTDOWN''@|$(GNULIB_SHUTDOWN)|g' \
+             -e 's|@''GNULIB_ACCEPT4''@|$(GNULIB_ACCEPT4)|g' \
              -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
              -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \
              -e 
's|@''HAVE_STRUCT_SOCKADDR_STORAGE''@|$(HAVE_STRUCT_SOCKADDR_STORAGE)|g' \
              -e 's|@''HAVE_SA_FAMILY_T''@|$(HAVE_SA_FAMILY_T)|g' \
+             -e 's|@''HAVE_ACCEPT4''@|$(HAVE_ACCEPT4)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              < $(srcdir)/sys_socket.in.h; \
-       } > address@hidden
+       } > address@hidden && \
        mv -f address@hidden $@
 MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t
 MOSTLYCLEANDIRS += sys
@@ -1219,26 +1335,53 @@ EXTRA_DIST += sys_socket.in.h
 
 ## begin gnulib module sys_stat
 
-BUILT_SOURCES += $(SYS_STAT_H)
+BUILT_SOURCES += sys/stat.h
 
 # We need the following in order to create <sys/stat.h> when the system
 # has one that is incomplete.
-sys/stat.h: sys_stat.in.h
-       @MKDIR_P@ sys
-       rm -f address@hidden $@
+sys/stat.h: sys_stat.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+       $(AM_V_at)$(MKDIR_P) sys
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
+             -e 's|@''GNULIB_FCHMODAT''@|$(GNULIB_FCHMODAT)|g' \
+             -e 's|@''GNULIB_FSTATAT''@|$(GNULIB_FSTATAT)|g' \
+             -e 's|@''GNULIB_FUTIMENS''@|$(GNULIB_FUTIMENS)|g' \
              -e 's|@''GNULIB_LCHMOD''@|$(GNULIB_LCHMOD)|g' \
              -e 's|@''GNULIB_LSTAT''@|$(GNULIB_LSTAT)|g' \
+             -e 's|@''GNULIB_MKDIRAT''@|$(GNULIB_MKDIRAT)|g' \
+             -e 's|@''GNULIB_MKFIFO''@|$(GNULIB_MKFIFO)|g' \
+             -e 's|@''GNULIB_MKFIFOAT''@|$(GNULIB_MKFIFOAT)|g' \
+             -e 's|@''GNULIB_MKNOD''@|$(GNULIB_MKNOD)|g' \
+             -e 's|@''GNULIB_MKNODAT''@|$(GNULIB_MKNODAT)|g' \
+             -e 's|@''GNULIB_STAT''@|$(GNULIB_STAT)|g' \
+             -e 's|@''GNULIB_UTIMENSAT''@|$(GNULIB_UTIMENSAT)|g' \
+             -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \
+             -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \
+             -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \
              -e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \
              -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \
+             -e 's|@''HAVE_MKDIRAT''@|$(HAVE_MKDIRAT)|g' \
+             -e 's|@''HAVE_MKFIFO''@|$(HAVE_MKFIFO)|g' \
+             -e 's|@''HAVE_MKFIFOAT''@|$(HAVE_MKFIFOAT)|g' \
+             -e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \
+             -e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \
+             -e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \
+             -e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \
+             -e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \
+             -e 's|@''REPLACE_FUTIMENS''@|$(REPLACE_FUTIMENS)|g' \
              -e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \
              -e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \
+             -e 's|@''REPLACE_MKFIFO''@|$(REPLACE_MKFIFO)|g' \
+             -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \
+             -e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \
+             -e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              < $(srcdir)/sys_stat.in.h; \
-       } > address@hidden
+       } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t
 MOSTLYCLEANDIRS += sys
@@ -1253,9 +1396,9 @@ BUILT_SOURCES += $(SYS_TIME_H)
 
 # We need the following in order to create <sys/time.h> when the system
 # doesn't have one that works with the given compiler.
-sys/time.h: sys_time.in.h
-       @MKDIR_P@ sys
-       rm -f address@hidden $@
+sys/time.h: sys_time.in.h $(ARG_NONNULL_H)
+       $(AM_V_at)$(MKDIR_P) sys
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -1263,8 +1406,9 @@ sys/time.h: sys_time.in.h
              -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \
              -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \
              -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              < $(srcdir)/sys_time.in.h; \
-       } > address@hidden
+       } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += sys/time.h sys/time.h-t
 
@@ -1278,20 +1422,22 @@ BUILT_SOURCES += time.h
 
 # We need the following in order to create <time.h> when the system
 # doesn't have one that works with the given compiler.
-time.h: time.in.h
-       rm -f address@hidden $@
+time.h: time.in.h $(ARG_NONNULL_H)
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \
              -e 's|@REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \
+             -e 's|@REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \
              -e 's|@REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
              -e 's|@REPLACE_STRPTIME''@|$(REPLACE_STRPTIME)|g' \
              -e 's|@REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \
              -e 
's|@SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g'
 \
              -e 
's|@TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              < $(srcdir)/time.in.h; \
-       } > address@hidden
+       } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += time.h time.h-t
 
@@ -1311,7 +1457,7 @@ EXTRA_libgnu_la_SOURCES += time_r.c
 ## begin gnulib module timegm
 
 
-EXTRA_DIST += timegm.c
+EXTRA_DIST += mktime-internal.h timegm.c
 
 EXTRA_libgnu_la_SOURCES += timegm.c
 
@@ -1330,8 +1476,8 @@ BUILT_SOURCES += unistd.h
 
 # We need the following in order to create an empty placeholder for
 # <unistd.h> when the system doesn't have one.
-unistd.h: unistd.in.h
-       rm -f address@hidden $@
+unistd.h: unistd.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -1340,54 +1486,98 @@ unistd.h: unistd.in.h
              -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \
              -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \
              -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \
+             -e 's|@''GNULIB_DUP3''@|$(GNULIB_DUP3)|g' \
              -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \
              -e 's|@''GNULIB_EUIDACCESS''@|$(GNULIB_EUIDACCESS)|g' \
+             -e 's|@''GNULIB_FACCESSAT''@|$(GNULIB_FACCESSAT)|g' \
              -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \
+             -e 's|@''GNULIB_FCHOWNAT''@|$(GNULIB_FCHOWNAT)|g' \
              -e 's|@''GNULIB_FSYNC''@|$(GNULIB_FSYNC)|g' \
              -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \
              -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' \
              -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \
              -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \
              -e 's|@''GNULIB_LINK''@|$(GNULIB_LINK)|g' \
+             -e 's|@''GNULIB_LINKAT''@|$(GNULIB_LINKAT)|g' \
              -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \
+             -e 's|@''GNULIB_PIPE2''@|$(GNULIB_PIPE2)|g' \
+             -e 's|@''GNULIB_PREAD''@|$(GNULIB_PREAD)|g' \
              -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
+             -e 's|@''GNULIB_READLINKAT''@|$(GNULIB_READLINKAT)|g' \
+             -e 's|@''GNULIB_RMDIR''@|$(GNULIB_RMDIR)|g' \
              -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \
+             -e 's|@''GNULIB_SYMLINK''@|$(GNULIB_SYMLINK)|g' \
+             -e 's|@''GNULIB_SYMLINKAT''@|$(GNULIB_SYMLINKAT)|g' \
+             -e 's|@''GNULIB_UNISTD_H_GETOPT''@|$(GNULIB_UNISTD_H_GETOPT)|g' \
              -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' \
+             -e 's|@''HAVE_FACCESSAT''@|$(HAVE_FACCESSAT)|g' \
+             -e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \
              -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \
              -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' \
+             -e 's|@''HAVE_PREAD''@|$(HAVE_PREAD)|g' \
              -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
+             -e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \
              -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
+             -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' \
              -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
              -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
              -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \
+             -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \
              -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \
              -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' \
+             -e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \
              -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
+             -e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \
+             -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \
+             -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \
+             -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \
+             -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'
 \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              < $(srcdir)/unistd.in.h; \
-       } > address@hidden
+       } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += unistd.h unistd.h-t
 
@@ -1448,8 +1638,8 @@ BUILT_SOURCES += $(WCHAR_H)
 
 # We need the following in order to create <wchar.h> when the system
 # version does not work standalone.
-wchar.h: wchar.in.h
-       rm -f address@hidden $@
+wchar.h: wchar.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
@@ -1491,8 +1681,9 @@ wchar.h: wchar.in.h
              -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \
              -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
            < $(srcdir)/wchar.in.h; \
-       } > address@hidden
+       } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += wchar.h wchar.h-t
 
diff --git a/gl/alloca.c b/gl/alloca.c
index ff1cb7e..75afdb9 100644
--- a/gl/alloca.c
+++ b/gl/alloca.c
@@ -81,37 +81,37 @@ long i00afunc ();
    STACK_DIRECTION = 0 => direction of growth unknown  */
 
 #  ifndef STACK_DIRECTION
-#   define STACK_DIRECTION     0       /* Direction unknown.  */
+#   define STACK_DIRECTION      0       /* Direction unknown.  */
 #  endif
 
 #  if STACK_DIRECTION != 0
 
-#   define STACK_DIR   STACK_DIRECTION /* Known at compile-time.  */
+#   define STACK_DIR    STACK_DIRECTION /* Known at compile-time.  */
 
 #  else /* STACK_DIRECTION == 0; need run-time code.  */
 
-static int stack_dir;          /* 1 or -1 once known.  */
-#   define STACK_DIR   stack_dir
+static int stack_dir;           /* 1 or -1 once known.  */
+#   define STACK_DIR    stack_dir
 
 static void
 find_stack_direction (void)
 {
-  static char *addr = NULL;    /* Address of first `dummy', once known.  */
-  auto char dummy;             /* To get stack address.  */
+  static char *addr = NULL;     /* Address of first `dummy', once known.  */
+  auto char dummy;              /* To get stack address.  */
 
   if (addr == NULL)
-    {                          /* Initial entry.  */
+    {                           /* Initial entry.  */
       addr = ADDRESS_FUNCTION (dummy);
 
-      find_stack_direction (); /* Recurse once.  */
+      find_stack_direction ();  /* Recurse once.  */
     }
   else
     {
       /* Second entry.  */
       if (ADDRESS_FUNCTION (dummy) > addr)
-       stack_dir = 1;          /* Stack grew upward.  */
+        stack_dir = 1;          /* Stack grew upward.  */
       else
-       stack_dir = -1;         /* Stack grew downward.  */
+        stack_dir = -1;         /* Stack grew downward.  */
     }
 }
 
@@ -124,21 +124,21 @@ find_stack_direction (void)
    It is very important that sizeof(header) agree with malloc
    alignment chunk size.  The following default should work okay.  */
 
-#  ifndef      ALIGN_SIZE
-#   define ALIGN_SIZE  sizeof(double)
+#  ifndef       ALIGN_SIZE
+#   define ALIGN_SIZE   sizeof(double)
 #  endif
 
 typedef union hdr
 {
-  char align[ALIGN_SIZE];      /* To force sizeof(header).  */
+  char align[ALIGN_SIZE];       /* To force sizeof(header).  */
   struct
     {
-      union hdr *next;         /* For chaining headers.  */
-      char *deep;              /* For stack depth measure.  */
+      union hdr *next;          /* For chaining headers.  */
+      char *deep;               /* For stack depth measure.  */
     } h;
 } header;
 
-static header *last_alloca_header = NULL;      /* -> last alloca header.  */
+static header *last_alloca_header = NULL;       /* -> last alloca header.  */
 
 /* Return a pointer to at least SIZE bytes of storage,
    which will be automatically reclaimed upon exit from
@@ -150,11 +150,11 @@ static header *last_alloca_header = NULL; /* -> last 
alloca header.  */
 void *
 alloca (size_t size)
 {
-  auto char probe;             /* Probes stack depth: */
+  auto char probe;              /* Probes stack depth: */
   register char *depth = ADDRESS_FUNCTION (probe);
 
 #  if STACK_DIRECTION == 0
-  if (STACK_DIR == 0)          /* Unknown growth direction.  */
+  if (STACK_DIR == 0)           /* Unknown growth direction.  */
     find_stack_direction ();
 #  endif
 
@@ -162,7 +162,7 @@ alloca (size_t size)
      was allocated from deeper in the stack than currently.  */
 
   {
-    register header *hp;       /* Traverses linked list.  */
+    register header *hp;        /* Traverses linked list.  */
 
 #  ifdef emacs
     BLOCK_INPUT;
@@ -170,18 +170,18 @@ alloca (size_t size)
 
     for (hp = last_alloca_header; hp != NULL;)
       if ((STACK_DIR > 0 && hp->h.deep > depth)
-         || (STACK_DIR < 0 && hp->h.deep < depth))
-       {
-         register header *np = hp->h.next;
+          || (STACK_DIR < 0 && hp->h.deep < depth))
+        {
+          register header *np = hp->h.next;
 
-         free (hp);            /* Collect garbage.  */
+          free (hp);            /* Collect garbage.  */
 
-         hp = np;              /* -> next header.  */
-       }
+          hp = np;              /* -> next header.  */
+        }
       else
-       break;                  /* Rest are not deeper.  */
+        break;                  /* Rest are not deeper.  */
 
-    last_alloca_header = hp;   /* -> last valid storage.  */
+    last_alloca_header = hp;    /* -> last valid storage.  */
 
 #  ifdef emacs
     UNBLOCK_INPUT;
@@ -189,7 +189,7 @@ alloca (size_t size)
   }
 
   if (size == 0)
-    return NULL;               /* No allocation required.  */
+    return NULL;                /* No allocation required.  */
 
   /* Allocate combined header + user data storage.  */
 
@@ -229,10 +229,10 @@ alloca (size_t size)
 /* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
 struct stack_control_header
   {
-    long shgrow:32;            /* Number of times stack has grown.  */
-    long shaseg:32;            /* Size of increments to stack.  */
-    long shhwm:32;             /* High water mark of stack.  */
-    long shsize:32;            /* Current size of stack (all segments).  */
+    long shgrow:32;             /* Number of times stack has grown.  */
+    long shaseg:32;             /* Size of increments to stack.  */
+    long shhwm:32;              /* High water mark of stack.  */
+    long shsize:32;             /* Current size of stack (all segments).  */
   };
 
 /* The stack segment linkage control information occurs at
@@ -244,21 +244,21 @@ struct stack_control_header
 
 struct stack_segment_linkage
   {
-    long ss[0200];             /* 0200 overflow words.  */
-    long sssize:32;            /* Number of words in this segment.  */
-    long ssbase:32;            /* Offset to stack base.  */
+    long ss[0200];              /* 0200 overflow words.  */
+    long sssize:32;             /* Number of words in this segment.  */
+    long ssbase:32;             /* Offset to stack base.  */
     long:32;
-    long sspseg:32;            /* Offset to linkage control of previous
-                                  segment of stack.  */
+    long sspseg:32;             /* Offset to linkage control of previous
+                                   segment of stack.  */
     long:32;
-    long sstcpt:32;            /* Pointer to task common address block.  */
-    long sscsnm;               /* Private control structure number for
-                                  microtasking.  */
-    long ssusr1;               /* Reserved for user.  */
-    long ssusr2;               /* Reserved for user.  */
-    long sstpid;               /* Process ID for pid based multi-tasking.  */
-    long ssgvup;               /* Pointer to multitasking thread giveup.  */
-    long sscray[7];            /* Reserved for Cray Research.  */
+    long sstcpt:32;             /* Pointer to task common address block.  */
+    long sscsnm;                /* Private control structure number for
+                                   microtasking.  */
+    long ssusr1;                /* Reserved for user.  */
+    long ssusr2;                /* Reserved for user.  */
+    long sstpid;                /* Process ID for pid based multi-tasking.  */
+    long ssgvup;                /* Pointer to multitasking thread giveup.  */
+    long sscray[7];             /* Reserved for Cray Research.  */
     long ssa0;
     long ssa1;
     long ssa2;
@@ -282,27 +282,27 @@ struct stack_segment_linkage
    returned by the STKSTAT library routine.  */
 struct stk_stat
   {
-    long now;                  /* Current total stack size.  */
-    long maxc;                 /* Amount of contiguous space which would
-                                  be required to satisfy the maximum
-                                  stack demand to date.  */
-    long high_water;           /* Stack high-water mark.  */
-    long overflows;            /* Number of stack overflow ($STKOFEN) calls.  
*/
-    long hits;                 /* Number of internal buffer hits.  */
-    long extends;              /* Number of block extensions.  */
-    long stko_mallocs;         /* Block allocations by $STKOFEN.  */
-    long underflows;           /* Number of stack underflow calls ($STKRETN).  
*/
-    long stko_free;            /* Number of deallocations by $STKRETN.  */
-    long stkm_free;            /* Number of deallocations by $STKMRET.  */
-    long segments;             /* Current number of stack segments.  */
-    long maxs;                 /* Maximum number of stack segments so far.  */
-    long pad_size;             /* Stack pad size.  */
-    long current_address;      /* Current stack segment address.  */
-    long current_size;         /* Current stack segment size.  This
-                                  number is actually corrupted by STKSTAT to
-                                  include the fifteen word trailer area.  */
-    long initial_address;      /* Address of initial segment.  */
-    long initial_size;         /* Size of initial segment.  */
+    long now;                   /* Current total stack size.  */
+    long maxc;                  /* Amount of contiguous space which would
+                                   be required to satisfy the maximum
+                                   stack demand to date.  */
+    long high_water;            /* Stack high-water mark.  */
+    long overflows;             /* Number of stack overflow ($STKOFEN) calls.  
*/
+    long hits;                  /* Number of internal buffer hits.  */
+    long extends;               /* Number of block extensions.  */
+    long stko_mallocs;          /* Block allocations by $STKOFEN.  */
+    long underflows;            /* Number of stack underflow calls ($STKRETN). 
 */
+    long stko_free;             /* Number of deallocations by $STKRETN.  */
+    long stkm_free;             /* Number of deallocations by $STKMRET.  */
+    long segments;              /* Current number of stack segments.  */
+    long maxs;                  /* Maximum number of stack segments so far.  */
+    long pad_size;              /* Stack pad size.  */
+    long current_address;       /* Current stack segment address.  */
+    long current_size;          /* Current stack segment size.  This
+                                   number is actually corrupted by STKSTAT to
+                                   include the fifteen word trailer area.  */
+    long initial_address;       /* Address of initial segment.  */
+    long initial_size;          /* Size of initial segment.  */
   };
 
 /* The following structure describes the data structure which trails
@@ -311,13 +311,13 @@ struct stk_stat
 
 struct stk_trailer
   {
-    long this_address;         /* Address of this block.  */
-    long this_size;            /* Size of this block (does not include
-                                  this trailer).  */
+    long this_address;          /* Address of this block.  */
+    long this_size;             /* Size of this block (does not include
+                                   this trailer).  */
     long unknown2;
     long unknown3;
-    long link;                 /* Address of trailer block of previous
-                                  segment.  */
+    long link;                  /* Address of trailer block of previous
+                                   segment.  */
     long unknown5;
     long unknown6;
     long unknown7;
@@ -355,8 +355,8 @@ i00afunc (long *address)
   /* Set up the iteration.  */
 
   trailer = (struct stk_trailer *) (status.current_address
-                                   + status.current_size
-                                   - 15);
+                                    + status.current_size
+                                    - 15);
 
   /* There must be at least one stack segment.  Therefore it is
      a fatal error if "trailer" is null.  */
@@ -371,10 +371,10 @@ i00afunc (long *address)
       block = (long *) trailer->this_address;
       size = trailer->this_size;
       if (block == 0 || size == 0)
-       abort ();
+        abort ();
       trailer = (struct stk_trailer *) trailer->link;
       if ((block <= address) && (address < (block + size)))
-       break;
+        break;
     }
 
   /* Set the result to the offset in this segment and add the sizes
@@ -390,7 +390,7 @@ i00afunc (long *address)
   do
     {
       if (trailer->this_size <= 0)
-       abort ();
+        abort ();
       result += trailer->this_size;
       trailer = (struct stk_trailer *) trailer->link;
     }
@@ -453,7 +453,7 @@ i00afunc (long address)
       fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
 #    endif
       if (pseg == 0)
-       break;
+        break;
       stkl = stkl - pseg;
       ssptr = (struct stack_segment_linkage *) stkl;
       size = ssptr->sssize;
diff --git a/gl/arcfour.c b/gl/arcfour.c
index 3650bf8..2c02efa 100644
--- a/gl/arcfour.c
+++ b/gl/arcfour.c
@@ -33,7 +33,7 @@
 
 void
 arcfour_stream (arcfour_context * context, const char *inbuf, char *outbuf,
-               size_t length)
+                size_t length)
 {
   uint8_t i = context->idx_i;
   uint8_t j = context->idx_j;
@@ -49,7 +49,7 @@ arcfour_stream (arcfour_context * context, const char *inbuf, 
char *outbuf,
       sbox[i] = sbox[j];
       sbox[j] = t;
       *outbuf++ = (*inbuf++
-                  ^ sbox[(0U + sbox[i] + sbox[j]) % ARCFOUR_SBOX_SIZE]);
+                   ^ sbox[(0U + sbox[i] + sbox[j]) % ARCFOUR_SBOX_SIZE]);
     }
 
   context->idx_i = i;
@@ -73,6 +73,6 @@ arcfour_setkey (arcfour_context * context, const char *key, 
size_t keylen)
       sbox[i] = sbox[j];
       sbox[j] = t;
       if (++k == keylen)
-       k = 0;
+        k = 0;
     }
 }
diff --git a/gl/arcfour.h b/gl/arcfour.h
index 01c4f9a..92d4605 100644
--- a/gl/arcfour.h
+++ b/gl/arcfour.h
@@ -40,7 +40,7 @@ typedef struct
    before this function is called. */
 extern void
 arcfour_stream (arcfour_context * context,
-               const char *inbuf, char *outbuf, size_t length);
+                const char *inbuf, char *outbuf, size_t length);
 
 /* Initialize CONTEXT using encryption KEY of KEYLEN bytes.  KEY
    should be 40 bits (5 bytes) or longer.  The KEY cannot be zero
diff --git a/gl/arpa_inet.in.h b/gl/arpa_inet.in.h
index ac93399..f34fd42 100644
--- a/gl/arpa_inet.in.h
+++ b/gl/arpa_inet.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <arpa/inet.h>.
 
-   Copyright (C) 2005-2006, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 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
@@ -19,8 +19,11 @@
 #ifndef _GL_ARPA_INET_H
 
 /* Gnulib's sys/socket.h is responsible for pulling in winsock2.h etc
-   under MinGW. */
-#include <sys/socket.h>
+   under MinGW.
+   But avoid namespace pollution on glibc systems.  */
+#ifndef __GLIBC__
+# include <sys/socket.h>
+#endif
 
 #if @HAVE_ARPA_INET_H@
 
@@ -38,6 +41,8 @@
 
 /* The definition of GL_LINK_WARNING is copied here.  */
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -60,7 +65,8 @@ extern "C" {
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/inet_ntop.html>.  */
 extern const char *inet_ntop (int af, const void *restrict src,
-                             char *restrict dst, socklen_t cnt);
+                              char *restrict dst, socklen_t cnt)
+     _GL_ARG_NONNULL ((2, 3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef inet_ntop
@@ -72,13 +78,14 @@ extern const char *inet_ntop (int af, const void *restrict 
src,
 
 #if @GNULIB_INET_PTON@
 # if address@hidden@
-extern int inet_pton (int af, const char *restrict src, void *restrict dst);
+extern int inet_pton (int af, const char *restrict src, void *restrict dst)
+     _GL_ARG_NONNULL ((2, 3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef inet_pton
 # define inet_pton(af,src,dst) \
   (GL_LINK_WARNING ("inet_pton is unportable - " \
-                   "use gnulib module inet_pton for portability"), \
+                    "use gnulib module inet_pton for portability"), \
    inet_pton (af, src, dst))
 #endif
 
diff --git a/gl/base64.c b/gl/base64.c
index 42ccc9c..e0c5055 100644
--- a/gl/base64.c
+++ b/gl/base64.c
@@ -67,7 +67,7 @@ to_uchar (char ch)
    terminate the output buffer. */
 void
 base64_encode (const char *restrict in, size_t inlen,
-              char *restrict out, size_t outlen)
+               char *restrict out, size_t outlen)
 {
   static const char b64str[64] =
     "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@@ -76,27 +76,27 @@ base64_encode (const char *restrict in, size_t inlen,
     {
       *out++ = b64str[(to_uchar (in[0]) >> 2) & 0x3f];
       if (!--outlen)
-       break;
+        break;
       *out++ = b64str[((to_uchar (in[0]) << 4)
-                      + (--inlen ? to_uchar (in[1]) >> 4 : 0))
-                     & 0x3f];
+                       + (--inlen ? to_uchar (in[1]) >> 4 : 0))
+                      & 0x3f];
       if (!--outlen)
-       break;
+        break;
       *out++ =
-       (inlen
-        ? b64str[((to_uchar (in[1]) << 2)
-                  + (--inlen ? to_uchar (in[2]) >> 6 : 0))
-                 & 0x3f]
-        : '=');
+        (inlen
+         ? b64str[((to_uchar (in[1]) << 2)
+                   + (--inlen ? to_uchar (in[2]) >> 6 : 0))
+                  & 0x3f]
+         : '=');
       if (!--outlen)
-       break;
+        break;
       *out++ = inlen ? b64str[to_uchar (in[2]) & 0x3f] : '=';
       if (!--outlen)
-       break;
+        break;
       if (inlen)
-       inlen--;
+        inlen--;
       if (inlen)
-       in += 3;
+        in += 3;
     }
 
   if (outlen)
@@ -153,71 +153,71 @@ base64_encode_alloc (const char *in, size_t inlen, char 
**out)
 
    IBM C V6 for AIX mishandles "#define B64(x) ...'x'...", so use "_"
    as the formal parameter rather than "x".  */
-#define B64(_)                                 \
-  ((_) == 'A' ? 0                              \
-   : (_) == 'B' ? 1                            \
-   : (_) == 'C' ? 2                            \
-   : (_) == 'D' ? 3                            \
-   : (_) == 'E' ? 4                            \
-   : (_) == 'F' ? 5                            \
-   : (_) == 'G' ? 6                            \
-   : (_) == 'H' ? 7                            \
-   : (_) == 'I' ? 8                            \
-   : (_) == 'J' ? 9                            \
-   : (_) == 'K' ? 10                           \
-   : (_) == 'L' ? 11                           \
-   : (_) == 'M' ? 12                           \
-   : (_) == 'N' ? 13                           \
-   : (_) == 'O' ? 14                           \
-   : (_) == 'P' ? 15                           \
-   : (_) == 'Q' ? 16                           \
-   : (_) == 'R' ? 17                           \
-   : (_) == 'S' ? 18                           \
-   : (_) == 'T' ? 19                           \
-   : (_) == 'U' ? 20                           \
-   : (_) == 'V' ? 21                           \
-   : (_) == 'W' ? 22                           \
-   : (_) == 'X' ? 23                           \
-   : (_) == 'Y' ? 24                           \
-   : (_) == 'Z' ? 25                           \
-   : (_) == 'a' ? 26                           \
-   : (_) == 'b' ? 27                           \
-   : (_) == 'c' ? 28                           \
-   : (_) == 'd' ? 29                           \
-   : (_) == 'e' ? 30                           \
-   : (_) == 'f' ? 31                           \
-   : (_) == 'g' ? 32                           \
-   : (_) == 'h' ? 33                           \
-   : (_) == 'i' ? 34                           \
-   : (_) == 'j' ? 35                           \
-   : (_) == 'k' ? 36                           \
-   : (_) == 'l' ? 37                           \
-   : (_) == 'm' ? 38                           \
-   : (_) == 'n' ? 39                           \
-   : (_) == 'o' ? 40                           \
-   : (_) == 'p' ? 41                           \
-   : (_) == 'q' ? 42                           \
-   : (_) == 'r' ? 43                           \
-   : (_) == 's' ? 44                           \
-   : (_) == 't' ? 45                           \
-   : (_) == 'u' ? 46                           \
-   : (_) == 'v' ? 47                           \
-   : (_) == 'w' ? 48                           \
-   : (_) == 'x' ? 49                           \
-   : (_) == 'y' ? 50                           \
-   : (_) == 'z' ? 51                           \
-   : (_) == '0' ? 52                           \
-   : (_) == '1' ? 53                           \
-   : (_) == '2' ? 54                           \
-   : (_) == '3' ? 55                           \
-   : (_) == '4' ? 56                           \
-   : (_) == '5' ? 57                           \
-   : (_) == '6' ? 58                           \
-   : (_) == '7' ? 59                           \
-   : (_) == '8' ? 60                           \
-   : (_) == '9' ? 61                           \
-   : (_) == '+' ? 62                           \
-   : (_) == '/' ? 63                           \
+#define B64(_)                                  \
+  ((_) == 'A' ? 0                               \
+   : (_) == 'B' ? 1                             \
+   : (_) == 'C' ? 2                             \
+   : (_) == 'D' ? 3                             \
+   : (_) == 'E' ? 4                             \
+   : (_) == 'F' ? 5                             \
+   : (_) == 'G' ? 6                             \
+   : (_) == 'H' ? 7                             \
+   : (_) == 'I' ? 8                             \
+   : (_) == 'J' ? 9                             \
+   : (_) == 'K' ? 10                            \
+   : (_) == 'L' ? 11                            \
+   : (_) == 'M' ? 12                            \
+   : (_) == 'N' ? 13                            \
+   : (_) == 'O' ? 14                            \
+   : (_) == 'P' ? 15                            \
+   : (_) == 'Q' ? 16                            \
+   : (_) == 'R' ? 17                            \
+   : (_) == 'S' ? 18                            \
+   : (_) == 'T' ? 19                            \
+   : (_) == 'U' ? 20                            \
+   : (_) == 'V' ? 21                            \
+   : (_) == 'W' ? 22                            \
+   : (_) == 'X' ? 23                            \
+   : (_) == 'Y' ? 24                            \
+   : (_) == 'Z' ? 25                            \
+   : (_) == 'a' ? 26                            \
+   : (_) == 'b' ? 27                            \
+   : (_) == 'c' ? 28                            \
+   : (_) == 'd' ? 29                            \
+   : (_) == 'e' ? 30                            \
+   : (_) == 'f' ? 31                            \
+   : (_) == 'g' ? 32                            \
+   : (_) == 'h' ? 33                            \
+   : (_) == 'i' ? 34                            \
+   : (_) == 'j' ? 35                            \
+   : (_) == 'k' ? 36                            \
+   : (_) == 'l' ? 37                            \
+   : (_) == 'm' ? 38                            \
+   : (_) == 'n' ? 39                            \
+   : (_) == 'o' ? 40                            \
+   : (_) == 'p' ? 41                            \
+   : (_) == 'q' ? 42                            \
+   : (_) == 'r' ? 43                            \
+   : (_) == 's' ? 44                            \
+   : (_) == 't' ? 45                            \
+   : (_) == 'u' ? 46                            \
+   : (_) == 'v' ? 47                            \
+   : (_) == 'w' ? 48                            \
+   : (_) == 'x' ? 49                            \
+   : (_) == 'y' ? 50                            \
+   : (_) == 'z' ? 51                            \
+   : (_) == '0' ? 52                            \
+   : (_) == '1' ? 53                            \
+   : (_) == '2' ? 54                            \
+   : (_) == '3' ? 55                            \
+   : (_) == '4' ? 56                            \
+   : (_) == '5' ? 57                            \
+   : (_) == '6' ? 58                            \
+   : (_) == '7' ? 59                            \
+   : (_) == '8' ? 60                            \
+   : (_) == '9' ? 61                            \
+   : (_) == '+' ? 62                            \
+   : (_) == '/' ? 63                            \
    : -1)
 
 static const signed char b64[0x100] = {
@@ -328,12 +328,12 @@ get_4 (struct base64_decode_context *ctx,
     {
       char const *t = *in;
       if (4 <= in_end - *in && memchr (t, '\n', 4) == NULL)
-       {
-         /* This is the common case: no newline.  */
-         *in += 4;
-         *n_non_newline = 4;
-         return (char *) t;
-       }
+        {
+          /* This is the common case: no newline.  */
+          *in += 4;
+          *n_non_newline = 4;
+          return (char *) t;
+        }
     }
 
   {
@@ -341,13 +341,13 @@ get_4 (struct base64_decode_context *ctx,
     char const *p = *in;
     while (p < in_end)
       {
-       char c = *p++;
-       if (c != '\n')
-         {
-           ctx->buf[ctx->i++] = c;
-           if (ctx->i == 4)
-             break;
-         }
+        char c = *p++;
+        if (c != '\n')
+          {
+            ctx->buf[ctx->i++] = c;
+            if (ctx->i == 4)
+              break;
+          }
       }
 
     *in = p;
@@ -356,12 +356,12 @@ get_4 (struct base64_decode_context *ctx,
   }
 }
 
-#define return_false                           \
-  do                                           \
-    {                                          \
-      *outp = out;                             \
-      return false;                            \
-    }                                          \
+#define return_false                            \
+  do                                            \
+    {                                           \
+      *outp = out;                              \
+      return false;                             \
+    }                                           \
   while (false)
 
 /* Decode up to four bytes of base64-encoded data, IN, of length INLEN
@@ -372,7 +372,7 @@ get_4 (struct base64_decode_context *ctx,
    *OUTLEN to reflect the number of bytes remaining in *OUT.  */
 static inline bool
 decode_4 (char const *restrict in, size_t inlen,
-         char *restrict *outp, size_t *outleft)
+          char *restrict *outp, size_t *outleft)
 {
   char *out = *outp;
   if (inlen < 2)
@@ -384,7 +384,7 @@ decode_4 (char const *restrict in, size_t inlen,
   if (*outleft)
     {
       *out++ = ((b64[to_uchar (in[0])] << 2)
-               | (b64[to_uchar (in[1])] >> 4));
+                | (b64[to_uchar (in[1])] >> 4));
       --*outleft;
     }
 
@@ -394,43 +394,43 @@ decode_4 (char const *restrict in, size_t inlen,
   if (in[2] == '=')
     {
       if (inlen != 4)
-       return_false;
+        return_false;
 
       if (in[3] != '=')
-       return_false;
+        return_false;
     }
   else
     {
       if (!isbase64 (in[2]))
-       return_false;
+        return_false;
 
       if (*outleft)
-       {
-         *out++ = (((b64[to_uchar (in[1])] << 4) & 0xf0)
-                   | (b64[to_uchar (in[2])] >> 2));
-         --*outleft;
-       }
+        {
+          *out++ = (((b64[to_uchar (in[1])] << 4) & 0xf0)
+                    | (b64[to_uchar (in[2])] >> 2));
+          --*outleft;
+        }
 
       if (inlen == 3)
-       return_false;
+        return_false;
 
       if (in[3] == '=')
-       {
-         if (inlen != 4)
-           return_false;
-       }
+        {
+          if (inlen != 4)
+            return_false;
+        }
       else
-       {
-         if (!isbase64 (in[3]))
-           return_false;
-
-         if (*outleft)
-           {
-             *out++ = (((b64[to_uchar (in[2])] << 6) & 0xc0)
-                       | b64[to_uchar (in[3])]);
-             --*outleft;
-           }
-       }
+        {
+          if (!isbase64 (in[3]))
+            return_false;
+
+          if (*outleft)
+            {
+              *out++ = (((b64[to_uchar (in[2])] << 6) & 0xc0)
+                        | b64[to_uchar (in[3])]);
+              --*outleft;
+            }
+        }
     }
 
   *outp = out;
@@ -457,8 +457,8 @@ decode_4 (char const *restrict in, size_t inlen,
 
 bool
 base64_decode_ctx (struct base64_decode_context *ctx,
-                  const char *restrict in, size_t inlen,
-                  char *restrict out, size_t *outlen)
+                   const char *restrict in, size_t inlen,
+                   char *restrict out, size_t *outlen)
 {
   size_t outleft = *outlen;
   bool ignore_newlines = ctx != NULL;
@@ -476,57 +476,57 @@ base64_decode_ctx (struct base64_decode_context *ctx,
     {
       size_t outleft_save = outleft;
       if (ctx_i == 0 && !flush_ctx)
-       {
-         while (true)
-           {
-             /* Save a copy of outleft, in case we need to re-parse this
-                block of four bytes.  */
-             outleft_save = outleft;
-             if (!decode_4 (in, inlen, &out, &outleft))
-               break;
-
-             in += 4;
-             inlen -= 4;
-           }
-       }
+        {
+          while (true)
+            {
+              /* Save a copy of outleft, in case we need to re-parse this
+                 block of four bytes.  */
+              outleft_save = outleft;
+              if (!decode_4 (in, inlen, &out, &outleft))
+                break;
+
+              in += 4;
+              inlen -= 4;
+            }
+        }
 
       if (inlen == 0 && !flush_ctx)
-       break;
+        break;
 
       /* Handle the common case of 72-byte wrapped lines.
-        This also handles any other multiple-of-4-byte wrapping.  */
+         This also handles any other multiple-of-4-byte wrapping.  */
       if (inlen && *in == '\n' && ignore_newlines)
-       {
-         ++in;
-         --inlen;
-         continue;
-       }
+        {
+          ++in;
+          --inlen;
+          continue;
+        }
 
       /* Restore OUT and OUTLEFT.  */
       out -= outleft_save - outleft;
       outleft = outleft_save;
 
       {
-       char const *in_end = in + inlen;
-       char const *non_nl;
-
-       if (ignore_newlines)
-         non_nl = get_4 (ctx, &in, in_end, &inlen);
-       else
-         non_nl = in;  /* Might have nl in this case. */
-
-       /* If the input is empty or consists solely of newlines (0 
non-newlines),
-          then we're done.  Likewise if there are fewer than 4 bytes when not
-          flushing context and not treating newlines as garbage.  */
-       if (inlen == 0 || (inlen < 4 && !flush_ctx && ignore_newlines))
-         {
-           inlen = 0;
-           break;
-         }
-       if (!decode_4 (non_nl, inlen, &out, &outleft))
-         break;
-
-       inlen = in_end - in;
+        char const *in_end = in + inlen;
+        char const *non_nl;
+
+        if (ignore_newlines)
+          non_nl = get_4 (ctx, &in, in_end, &inlen);
+        else
+          non_nl = in;  /* Might have nl in this case. */
+
+        /* If the input is empty or consists solely of newlines (0 
non-newlines),
+           then we're done.  Likewise if there are fewer than 4 bytes when not
+           flushing context and not treating newlines as garbage.  */
+        if (inlen == 0 || (inlen < 4 && !flush_ctx && ignore_newlines))
+          {
+            inlen = 0;
+            break;
+          }
+        if (!decode_4 (non_nl, inlen, &out, &outleft))
+          break;
+
+        inlen = in_end - in;
       }
     }
 
@@ -548,8 +548,8 @@ base64_decode_ctx (struct base64_decode_context *ctx,
    undefined. */
 bool
 base64_decode_alloc_ctx (struct base64_decode_context *ctx,
-                        const char *in, size_t inlen, char **out,
-                        size_t *outlen)
+                         const char *in, size_t inlen, char **out,
+                         size_t *outlen)
 {
   /* This may allocate a few bytes too many, depending on input,
      but it's not worth the extra CPU time to compute the exact size.
diff --git a/gl/base64.h b/gl/base64.h
index 63b6abc..364e089 100644
--- a/gl/base64.h
+++ b/gl/base64.h
@@ -38,24 +38,24 @@ struct base64_decode_context
 extern bool isbase64 (char ch);
 
 extern void base64_encode (const char *restrict in, size_t inlen,
-                          char *restrict out, size_t outlen);
+                           char *restrict out, size_t outlen);
 
 extern size_t base64_encode_alloc (const char *in, size_t inlen, char **out);
 
 extern void base64_decode_ctx_init (struct base64_decode_context *ctx);
 
 extern bool base64_decode_ctx (struct base64_decode_context *ctx,
-                              const char *restrict in, size_t inlen,
-                              char *restrict out, size_t *outlen);
+                               const char *restrict in, size_t inlen,
+                               char *restrict out, size_t *outlen);
 
 extern bool base64_decode_alloc_ctx (struct base64_decode_context *ctx,
-                                    const char *in, size_t inlen,
-                                    char **out, size_t *outlen);
+                                     const char *in, size_t inlen,
+                                     char **out, size_t *outlen);
 
 #define base64_decode(in, inlen, out, outlen) \
-       base64_decode_ctx (NULL, in, inlen, out, outlen)
+        base64_decode_ctx (NULL, in, inlen, out, outlen)
 
 #define base64_decode_alloc(in, inlen, out, outlen) \
-       base64_decode_alloc_ctx (NULL, in, inlen, out, outlen)
+        base64_decode_alloc_ctx (NULL, in, inlen, out, outlen)
 
 #endif /* BASE64_H */
diff --git a/gl/close-hook.c b/gl/close-hook.c
index fe1f22c..4ef1300 100644
--- a/gl/close-hook.c
+++ b/gl/close-hook.c
@@ -66,7 +66,7 @@ register_close_hook (close_hook_fn hook, struct close_hook 
*link)
     {
       /* The link is already in use.  */
       if (link->private_fn != hook)
-       abort ();
+        abort ();
     }
 }
 
diff --git a/gl/close.c b/gl/close.c
index 0e56dcb..5278f24 100644
--- a/gl/close.c
+++ b/gl/close.c
@@ -33,7 +33,7 @@ rpl_close (int fd)
   int retval = close (fd);
 #endif
 
-#ifdef FCHDIR_REPLACEMENT
+#if REPLACE_FCHDIR
   if (retval >= 0)
     _gl_unregister_fd (fd);
 #endif
diff --git a/gl/connect.c b/gl/connect.c
index c7abf20..df41438 100644
--- a/gl/connect.c
+++ b/gl/connect.c
@@ -36,9 +36,9 @@ rpl_connect (int fd, struct sockaddr *sockaddr, int len)
   if (r < 0)
     {
       /* EINPROGRESS is not returned by WinSock 2.0; for backwards
-        compatibility, connect(2) uses EWOULDBLOCK.  */
+         compatibility, connect(2) uses EWOULDBLOCK.  */
       if (WSAGetLastError () == WSAEWOULDBLOCK)
-       WSASetLastError (WSAEINPROGRESS);
+        WSASetLastError (WSAEINPROGRESS);
 
       set_winsock_errno ();
     }
diff --git a/gl/des.c b/gl/des.c
index 2dab7db..4bbfdf3 100644
--- a/gl/des.c
+++ b/gl/des.c
@@ -99,7 +99,7 @@
 #include "des.h"
 
 #include <stdio.h>
-#include <string.h>            /* memcpy, memcmp */
+#include <string.h>             /* memcpy, memcmp */
 
 /*
  * The s-box values are permuted according to the 'primitive function P'
@@ -253,70 +253,70 @@ static const unsigned char encrypt_rotate_tab[16] = {
  * bits cleared.
  */
 static const unsigned char weak_keys[64][8] = {
-  {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},    /*w */
+  {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},     /*w */
   {0x00, 0x00, 0x1e, 0x1e, 0x00, 0x00, 0x0e, 0x0e},
   {0x00, 0x00, 0xe0, 0xe0, 0x00, 0x00, 0xf0, 0xf0},
   {0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0xfe, 0xfe},
-  {0x00, 0x1e, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x0e},    /*sw */
+  {0x00, 0x1e, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x0e},     /*sw */
   {0x00, 0x1e, 0x1e, 0x00, 0x00, 0x0e, 0x0e, 0x00},
   {0x00, 0x1e, 0xe0, 0xfe, 0x00, 0x0e, 0xf0, 0xfe},
   {0x00, 0x1e, 0xfe, 0xe0, 0x00, 0x0e, 0xfe, 0xf0},
-  {0x00, 0xe0, 0x00, 0xe0, 0x00, 0xf0, 0x00, 0xf0},    /*sw */
+  {0x00, 0xe0, 0x00, 0xe0, 0x00, 0xf0, 0x00, 0xf0},     /*sw */
   {0x00, 0xe0, 0x1e, 0xfe, 0x00, 0xf0, 0x0e, 0xfe},
   {0x00, 0xe0, 0xe0, 0x00, 0x00, 0xf0, 0xf0, 0x00},
   {0x00, 0xe0, 0xfe, 0x1e, 0x00, 0xf0, 0xfe, 0x0e},
-  {0x00, 0xfe, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0xfe},    /*sw */
+  {0x00, 0xfe, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0xfe},     /*sw */
   {0x00, 0xfe, 0x1e, 0xe0, 0x00, 0xfe, 0x0e, 0xf0},
   {0x00, 0xfe, 0xe0, 0x1e, 0x00, 0xfe, 0xf0, 0x0e},
   {0x00, 0xfe, 0xfe, 0x00, 0x00, 0xfe, 0xfe, 0x00},
   {0x1e, 0x00, 0x00, 0x1e, 0x0e, 0x00, 0x00, 0x0e},
-  {0x1e, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x0e, 0x00},    /*sw */
+  {0x1e, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x0e, 0x00},     /*sw */
   {0x1e, 0x00, 0xe0, 0xfe, 0x0e, 0x00, 0xf0, 0xfe},
   {0x1e, 0x00, 0xfe, 0xe0, 0x0e, 0x00, 0xfe, 0xf0},
   {0x1e, 0x1e, 0x00, 0x00, 0x0e, 0x0e, 0x00, 0x00},
-  {0x1e, 0x1e, 0x1e, 0x1e, 0x0e, 0x0e, 0x0e, 0x0e},    /*w */
+  {0x1e, 0x1e, 0x1e, 0x1e, 0x0e, 0x0e, 0x0e, 0x0e},     /*w */
   {0x1e, 0x1e, 0xe0, 0xe0, 0x0e, 0x0e, 0xf0, 0xf0},
   {0x1e, 0x1e, 0xfe, 0xfe, 0x0e, 0x0e, 0xfe, 0xfe},
   {0x1e, 0xe0, 0x00, 0xfe, 0x0e, 0xf0, 0x00, 0xfe},
-  {0x1e, 0xe0, 0x1e, 0xe0, 0x0e, 0xf0, 0x0e, 0xf0},    /*sw */
+  {0x1e, 0xe0, 0x1e, 0xe0, 0x0e, 0xf0, 0x0e, 0xf0},     /*sw */
   {0x1e, 0xe0, 0xe0, 0x1e, 0x0e, 0xf0, 0xf0, 0x0e},
   {0x1e, 0xe0, 0xfe, 0x00, 0x0e, 0xf0, 0xfe, 0x00},
   {0x1e, 0xfe, 0x00, 0xe0, 0x0e, 0xfe, 0x00, 0xf0},
-  {0x1e, 0xfe, 0x1e, 0xfe, 0x0e, 0xfe, 0x0e, 0xfe},    /*sw */
+  {0x1e, 0xfe, 0x1e, 0xfe, 0x0e, 0xfe, 0x0e, 0xfe},     /*sw */
   {0x1e, 0xfe, 0xe0, 0x00, 0x0e, 0xfe, 0xf0, 0x00},
   {0x1e, 0xfe, 0xfe, 0x1e, 0x0e, 0xfe, 0xfe, 0x0e},
   {0xe0, 0x00, 0x00, 0xe0, 0xf0, 0x00, 0x00, 0xf0},
   {0xe0, 0x00, 0x1e, 0xfe, 0xf0, 0x00, 0x0e, 0xfe},
-  {0xe0, 0x00, 0xe0, 0x00, 0xf0, 0x00, 0xf0, 0x00},    /*sw */
+  {0xe0, 0x00, 0xe0, 0x00, 0xf0, 0x00, 0xf0, 0x00},     /*sw */
   {0xe0, 0x00, 0xfe, 0x1e, 0xf0, 0x00, 0xfe, 0x0e},
   {0xe0, 0x1e, 0x00, 0xfe, 0xf0, 0x0e, 0x00, 0xfe},
   {0xe0, 0x1e, 0x1e, 0xe0, 0xf0, 0x0e, 0x0e, 0xf0},
-  {0xe0, 0x1e, 0xe0, 0x1e, 0xf0, 0x0e, 0xf0, 0x0e},    /*sw */
+  {0xe0, 0x1e, 0xe0, 0x1e, 0xf0, 0x0e, 0xf0, 0x0e},     /*sw */
   {0xe0, 0x1e, 0xfe, 0x00, 0xf0, 0x0e, 0xfe, 0x00},
   {0xe0, 0xe0, 0x00, 0x00, 0xf0, 0xf0, 0x00, 0x00},
   {0xe0, 0xe0, 0x1e, 0x1e, 0xf0, 0xf0, 0x0e, 0x0e},
-  {0xe0, 0xe0, 0xe0, 0xe0, 0xf0, 0xf0, 0xf0, 0xf0},    /*w */
+  {0xe0, 0xe0, 0xe0, 0xe0, 0xf0, 0xf0, 0xf0, 0xf0},     /*w */
   {0xe0, 0xe0, 0xfe, 0xfe, 0xf0, 0xf0, 0xfe, 0xfe},
   {0xe0, 0xfe, 0x00, 0x1e, 0xf0, 0xfe, 0x00, 0x0e},
   {0xe0, 0xfe, 0x1e, 0x00, 0xf0, 0xfe, 0x0e, 0x00},
-  {0xe0, 0xfe, 0xe0, 0xfe, 0xf0, 0xfe, 0xf0, 0xfe},    /*sw */
+  {0xe0, 0xfe, 0xe0, 0xfe, 0xf0, 0xfe, 0xf0, 0xfe},     /*sw */
   {0xe0, 0xfe, 0xfe, 0xe0, 0xf0, 0xfe, 0xfe, 0xf0},
   {0xfe, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0xfe},
   {0xfe, 0x00, 0x1e, 0xe0, 0xfe, 0x00, 0x0e, 0xf0},
   {0xfe, 0x00, 0xe0, 0x1e, 0xfe, 0x00, 0xf0, 0x0e},
-  {0xfe, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0xfe, 0x00},    /*sw */
+  {0xfe, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0xfe, 0x00},     /*sw */
   {0xfe, 0x1e, 0x00, 0xe0, 0xfe, 0x0e, 0x00, 0xf0},
   {0xfe, 0x1e, 0x1e, 0xfe, 0xfe, 0x0e, 0x0e, 0xfe},
   {0xfe, 0x1e, 0xe0, 0x00, 0xfe, 0x0e, 0xf0, 0x00},
-  {0xfe, 0x1e, 0xfe, 0x1e, 0xfe, 0x0e, 0xfe, 0x0e},    /*sw */
+  {0xfe, 0x1e, 0xfe, 0x1e, 0xfe, 0x0e, 0xfe, 0x0e},     /*sw */
   {0xfe, 0xe0, 0x00, 0x1e, 0xfe, 0xf0, 0x00, 0x0e},
   {0xfe, 0xe0, 0x1e, 0x00, 0xfe, 0xf0, 0x0e, 0x00},
   {0xfe, 0xe0, 0xe0, 0xfe, 0xfe, 0xf0, 0xf0, 0xfe},
-  {0xfe, 0xe0, 0xfe, 0xe0, 0xfe, 0xf0, 0xfe, 0xf0},    /*sw */
+  {0xfe, 0xe0, 0xfe, 0xe0, 0xfe, 0xf0, 0xfe, 0xf0},     /*sw */
   {0xfe, 0xfe, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00},
   {0xfe, 0xfe, 0x1e, 0x1e, 0xfe, 0xfe, 0x0e, 0x0e},
   {0xfe, 0xfe, 0xe0, 0xe0, 0xfe, 0xfe, 0xf0, 0xf0},
-  {0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe}     /*w */
+  {0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe}      /*w */
 };
 
 bool
@@ -337,12 +337,12 @@ gl_des_is_weak_key (const char * key)
       middle = (left + right) / 2;
 
       if (!(cmp_result = memcmp (work, weak_keys[middle], 8)))
-       return -1;
+        return -1;
 
       if (cmp_result > 0)
-       left = middle + 1;
+        left = middle + 1;
       else
-       right = middle - 1;
+        right = middle - 1;
     }
 
   return 0;
@@ -351,9 +351,9 @@ gl_des_is_weak_key (const char * key)
 /*
  * Macro to swap bits across two words.
  */
-#define DO_PERMUTATION(a, temp, b, offset, mask)       \
-    temp = ((a>>offset) ^ b) & mask;                   \
-    b ^= temp;                                         \
+#define DO_PERMUTATION(a, temp, b, offset, mask)        \
+    temp = ((a>>offset) ^ b) & mask;                    \
+    b ^= temp;                                          \
     a ^= temp<<offset;
 
 
@@ -362,29 +362,29 @@ gl_des_is_weak_key (const char * key)
  * or decrypted. Additionally the resulting two words are rotated one bit
  * to the left.
  */
-#define INITIAL_PERMUTATION(left, temp, right)         \
-    DO_PERMUTATION(left, temp, right, 4, 0x0f0f0f0f)   \
-    DO_PERMUTATION(left, temp, right, 16, 0x0000ffff)  \
-    DO_PERMUTATION(right, temp, left, 2, 0x33333333)   \
-    DO_PERMUTATION(right, temp, left, 8, 0x00ff00ff)   \
-    right =  (right << 1) | (right >> 31);             \
-    temp  =  (left ^ right) & 0xaaaaaaaa;              \
-    right ^= temp;                                     \
-    left  ^= temp;                                     \
+#define INITIAL_PERMUTATION(left, temp, right)          \
+    DO_PERMUTATION(left, temp, right, 4, 0x0f0f0f0f)    \
+    DO_PERMUTATION(left, temp, right, 16, 0x0000ffff)   \
+    DO_PERMUTATION(right, temp, left, 2, 0x33333333)    \
+    DO_PERMUTATION(right, temp, left, 8, 0x00ff00ff)    \
+    right =  (right << 1) | (right >> 31);              \
+    temp  =  (left ^ right) & 0xaaaaaaaa;               \
+    right ^= temp;                                      \
+    left  ^= temp;                                      \
     left  =  (left << 1) | (left >> 31);
 
 /*
  * The 'inverse initial permutation'.
  */
-#define FINAL_PERMUTATION(left, temp, right)           \
-    left  =  (left << 31) | (left >> 1);               \
-    temp  =  (left ^ right) & 0xaaaaaaaa;              \
-    left  ^= temp;                                     \
-    right ^= temp;                                     \
-    right  =  (right << 31) | (right >> 1);            \
-    DO_PERMUTATION(right, temp, left, 8, 0x00ff00ff)   \
-    DO_PERMUTATION(right, temp, left, 2, 0x33333333)   \
-    DO_PERMUTATION(left, temp, right, 16, 0x0000ffff)  \
+#define FINAL_PERMUTATION(left, temp, right)            \
+    left  =  (left << 31) | (left >> 1);                \
+    temp  =  (left ^ right) & 0xaaaaaaaa;               \
+    left  ^= temp;                                      \
+    right ^= temp;                                      \
+    right  =  (right << 31) | (right >> 1);             \
+    DO_PERMUTATION(right, temp, left, 8, 0x00ff00ff)    \
+    DO_PERMUTATION(right, temp, left, 2, 0x33333333)    \
+    DO_PERMUTATION(left, temp, right, 16, 0x0000ffff)   \
     DO_PERMUTATION(left, temp, right, 4, 0x0f0f0f0f)
 
 
@@ -394,40 +394,40 @@ gl_des_is_weak_key (const char * key)
  * Please note: The data in 'from' and 'to' is already rotated one bit to
  * the left, done in the initial permutation.
  */
-#define DES_ROUND(from, to, work, subkey)              \
-    work = from ^ *subkey++;                           \
-    to ^= sbox8[  work     & 0x3f ];                   \
-    to ^= sbox6[ (work>>8)  & 0x3f ];                  \
-    to ^= sbox4[ (work>>16) & 0x3f ];                  \
-    to ^= sbox2[ (work>>24) & 0x3f ];                  \
-    work = ((from << 28) | (from >> 4)) ^ *subkey++;   \
-    to ^= sbox7[  work     & 0x3f ];                   \
-    to ^= sbox5[ (work>>8)  & 0x3f ];                  \
-    to ^= sbox3[ (work>>16) & 0x3f ];                  \
+#define DES_ROUND(from, to, work, subkey)               \
+    work = from ^ *subkey++;                            \
+    to ^= sbox8[  work      & 0x3f ];                   \
+    to ^= sbox6[ (work>>8)  & 0x3f ];                   \
+    to ^= sbox4[ (work>>16) & 0x3f ];                   \
+    to ^= sbox2[ (work>>24) & 0x3f ];                   \
+    work = ((from << 28) | (from >> 4)) ^ *subkey++;    \
+    to ^= sbox7[  work      & 0x3f ];                   \
+    to ^= sbox5[ (work>>8)  & 0x3f ];                   \
+    to ^= sbox3[ (work>>16) & 0x3f ];                   \
     to ^= sbox1[ (work>>24) & 0x3f ];
 
 /*
  * Macros to convert 8 bytes from/to 32bit words.
  */
-#define READ_64BIT_DATA(data, left, right)                                \
+#define READ_64BIT_DATA(data, left, right)                                 \
     left  = (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3];  \
     right = (data[4] << 24) | (data[5] << 16) | (data[6] << 8) | data[7];
 
-#define WRITE_64BIT_DATA(data, left, right)                               \
-    data[0] = (left >> 24) &0xff; data[1] = (left >> 16) &0xff;           \
-    data[2] = (left >> 8) &0xff; data[3] = left &0xff;                    \
-    data[4] = (right >> 24) &0xff; data[5] = (right >> 16) &0xff;         \
+#define WRITE_64BIT_DATA(data, left, right)                                \
+    data[0] = (left >> 24) &0xff; data[1] = (left >> 16) &0xff;    \
+    data[2] = (left >> 8) &0xff; data[3] = left &0xff;                     \
+    data[4] = (right >> 24) &0xff; data[5] = (right >> 16) &0xff;          \
     data[6] = (right >> 8) &0xff; data[7] = right &0xff;
 
 /*
- * des_key_schedule():   Calculate 16 subkeys pairs (even/odd) for
- *                       16 encryption rounds.
- *                       To calculate subkeys for decryption the caller
- *                       have to reorder the generated subkeys.
+ * des_key_schedule():    Calculate 16 subkeys pairs (even/odd) for
+ *                        16 encryption rounds.
+ *                        To calculate subkeys for decryption the caller
+ *                        have to reorder the generated subkeys.
  *
- *    rawkey:      8 Bytes of key data
- *    subkey:      Array of at least 32 uint32_ts. Will be filled
- *                 with calculated subkeys.
+ *    rawkey:       8 Bytes of key data
+ *    subkey:       Array of at least 32 uint32_ts. Will be filled
+ *                  with calculated subkeys.
  *
  */
 static void
@@ -441,79 +441,79 @@ des_key_schedule (const char * _rawkey, uint32_t * subkey)
     DO_PERMUTATION (right, work, left, 4, 0x0f0f0f0f)
     DO_PERMUTATION (right, work, left, 0, 0x10101010)
     left = ((leftkey_swap[(left >> 0) & 0xf] << 3)
-           | (leftkey_swap[(left >> 8) & 0xf] << 2)
-           | (leftkey_swap[(left >> 16) & 0xf] << 1)
-           | (leftkey_swap[(left >> 24) & 0xf])
-           | (leftkey_swap[(left >> 5) & 0xf] << 7)
-           | (leftkey_swap[(left >> 13) & 0xf] << 6)
-           | (leftkey_swap[(left >> 21) & 0xf] << 5)
-           | (leftkey_swap[(left >> 29) & 0xf] << 4));
+            | (leftkey_swap[(left >> 8) & 0xf] << 2)
+            | (leftkey_swap[(left >> 16) & 0xf] << 1)
+            | (leftkey_swap[(left >> 24) & 0xf])
+            | (leftkey_swap[(left >> 5) & 0xf] << 7)
+            | (leftkey_swap[(left >> 13) & 0xf] << 6)
+            | (leftkey_swap[(left >> 21) & 0xf] << 5)
+            | (leftkey_swap[(left >> 29) & 0xf] << 4));
 
   left &= 0x0fffffff;
 
   right = ((rightkey_swap[(right >> 1) & 0xf] << 3)
-          | (rightkey_swap[(right >> 9) & 0xf] << 2)
-          | (rightkey_swap[(right >> 17) & 0xf] << 1)
-          | (rightkey_swap[(right >> 25) & 0xf])
-          | (rightkey_swap[(right >> 4) & 0xf] << 7)
-          | (rightkey_swap[(right >> 12) & 0xf] << 6)
-          | (rightkey_swap[(right >> 20) & 0xf] << 5)
-          | (rightkey_swap[(right >> 28) & 0xf] << 4));
+           | (rightkey_swap[(right >> 9) & 0xf] << 2)
+           | (rightkey_swap[(right >> 17) & 0xf] << 1)
+           | (rightkey_swap[(right >> 25) & 0xf])
+           | (rightkey_swap[(right >> 4) & 0xf] << 7)
+           | (rightkey_swap[(right >> 12) & 0xf] << 6)
+           | (rightkey_swap[(right >> 20) & 0xf] << 5)
+           | (rightkey_swap[(right >> 28) & 0xf] << 4));
 
   right &= 0x0fffffff;
 
   for (round = 0; round < 16; ++round)
     {
       left = ((left << encrypt_rotate_tab[round])
-             | (left >> (28 - encrypt_rotate_tab[round]))) & 0x0fffffff;
+              | (left >> (28 - encrypt_rotate_tab[round]))) & 0x0fffffff;
       right = ((right << encrypt_rotate_tab[round])
-              | (right >> (28 - encrypt_rotate_tab[round]))) & 0x0fffffff;
+               | (right >> (28 - encrypt_rotate_tab[round]))) & 0x0fffffff;
 
       *subkey++ = (((left << 4) & 0x24000000)
-                  | ((left << 28) & 0x10000000)
-                  | ((left << 14) & 0x08000000)
-                  | ((left << 18) & 0x02080000)
-                  | ((left << 6) & 0x01000000)
-                  | ((left << 9) & 0x00200000)
-                  | ((left >> 1) & 0x00100000)
-                  | ((left << 10) & 0x00040000)
-                  | ((left << 2) & 0x00020000)
-                  | ((left >> 10) & 0x00010000)
-                  | ((right >> 13) & 0x00002000)
-                  | ((right >> 4) & 0x00001000)
-                  | ((right << 6) & 0x00000800)
-                  | ((right >> 1) & 0x00000400)
-                  | ((right >> 14) & 0x00000200)
-                  | (right & 0x00000100)
-                  | ((right >> 5) & 0x00000020)
-                  | ((right >> 10) & 0x00000010)
-                  | ((right >> 3) & 0x00000008)
-                  | ((right >> 18) & 0x00000004)
-                  | ((right >> 26) & 0x00000002)
-                  | ((right >> 24) & 0x00000001));
+                   | ((left << 28) & 0x10000000)
+                   | ((left << 14) & 0x08000000)
+                   | ((left << 18) & 0x02080000)
+                   | ((left << 6) & 0x01000000)
+                   | ((left << 9) & 0x00200000)
+                   | ((left >> 1) & 0x00100000)
+                   | ((left << 10) & 0x00040000)
+                   | ((left << 2) & 0x00020000)
+                   | ((left >> 10) & 0x00010000)
+                   | ((right >> 13) & 0x00002000)
+                   | ((right >> 4) & 0x00001000)
+                   | ((right << 6) & 0x00000800)
+                   | ((right >> 1) & 0x00000400)
+                   | ((right >> 14) & 0x00000200)
+                   | (right & 0x00000100)
+                   | ((right >> 5) & 0x00000020)
+                   | ((right >> 10) & 0x00000010)
+                   | ((right >> 3) & 0x00000008)
+                   | ((right >> 18) & 0x00000004)
+                   | ((right >> 26) & 0x00000002)
+                   | ((right >> 24) & 0x00000001));
 
       *subkey++ = (((left << 15) & 0x20000000)
-                  | ((left << 17) & 0x10000000)
-                  | ((left << 10) & 0x08000000)
-                  | ((left << 22) & 0x04000000)
-                  | ((left >> 2) & 0x02000000)
-                  | ((left << 1) & 0x01000000)
-                  | ((left << 16) & 0x00200000)
-                  | ((left << 11) & 0x00100000)
-                  | ((left << 3) & 0x00080000)
-                  | ((left >> 6) & 0x00040000)
-                  | ((left << 15) & 0x00020000)
-                  | ((left >> 4) & 0x00010000)
-                  | ((right >> 2) & 0x00002000)
-                  | ((right << 8) & 0x00001000)
-                  | ((right >> 14) & 0x00000808)
-                  | ((right >> 9) & 0x00000400)
-                  | ((right) & 0x00000200)
-                  | ((right << 7) & 0x00000100)
-                  | ((right >> 7) & 0x00000020)
-                  | ((right >> 3) & 0x00000011)
-                  | ((right << 2) & 0x00000004)
-                  | ((right >> 21) & 0x00000002));
+                   | ((left << 17) & 0x10000000)
+                   | ((left << 10) & 0x08000000)
+                   | ((left << 22) & 0x04000000)
+                   | ((left >> 2) & 0x02000000)
+                   | ((left << 1) & 0x01000000)
+                   | ((left << 16) & 0x00200000)
+                   | ((left << 11) & 0x00100000)
+                   | ((left << 3) & 0x00080000)
+                   | ((left >> 6) & 0x00040000)
+                   | ((left << 15) & 0x00020000)
+                   | ((left >> 4) & 0x00010000)
+                   | ((right >> 2) & 0x00002000)
+                   | ((right << 8) & 0x00001000)
+                   | ((right >> 14) & 0x00000808)
+                   | ((right >> 9) & 0x00000400)
+                   | ((right) & 0x00000200)
+                   | ((right << 7) & 0x00000100)
+                   | ((right >> 7) & 0x00000020)
+                   | ((right >> 3) & 0x00000011)
+                   | ((right << 2) & 0x00000004)
+                   | ((right >> 21) & 0x00000002));
     }
 }
 
@@ -592,7 +592,7 @@ gl_3des_set2keys (gl_3des_ctx *ctx, const char * key1, 
const char * key2)
 
 void
 gl_3des_set3keys (gl_3des_ctx *ctx, const char * key1,
-                   const char * key2, const char * key3)
+                    const char * key2, const char * key3)
 {
   int i;
 
@@ -615,8 +615,8 @@ gl_3des_set3keys (gl_3des_ctx *ctx, const char * key1,
 
 void
 gl_3des_ecb_crypt (gl_3des_ctx *ctx,
-                  const char * _from,
-                  char * _to, int mode)
+                   const char * _from,
+                   char * _to, int mode)
 {
   const unsigned char *from = (const unsigned char *) _from;
   unsigned char *to = (unsigned char *) _to;
@@ -664,6 +664,6 @@ gl_3des_makekey (gl_3des_ctx *ctx, const char * key, size_t 
keylen)
   gl_3des_set3keys (ctx, key, key + 8, key + 16);
 
   return !(gl_des_is_weak_key (key)
-          || gl_des_is_weak_key (key + 8)
-          || gl_des_is_weak_key (key + 16));
+           || gl_des_is_weak_key (key + 8)
+           || gl_des_is_weak_key (key + 16));
 }
diff --git a/gl/des.h b/gl/des.h
index 61c494c..6e28185 100644
--- a/gl/des.h
+++ b/gl/des.h
@@ -84,8 +84,8 @@ gl_des_ecb_crypt (gl_des_ctx *ctx, const char * from,  char * 
to, int mode);
  * keys, but simply ignore them.  Does not check for weak keys. */
 extern void
 gl_3des_set2keys (gl_3des_ctx *ctx,
-                 const char * key1,
-                 const char * key2);
+                  const char * key1,
+                  const char * key2);
 
 /*
  * Fill a Triple-DES context CTX with subkeys calculated from three
@@ -94,26 +94,26 @@ gl_3des_set2keys (gl_3des_ctx *ctx,
  * keys. */
 extern void
 gl_3des_set3keys (gl_3des_ctx *ctx,
-                 const char * key1,
-                 const char * key2,
-                 const char * key3);
+                  const char * key1,
+                  const char * key2,
+                  const char * key3);
 
 /* Fill a Triple-DES context CTX with subkeys calculated from three
  * concatenated 64bit keys in KEY, with weak key checking.  Does not
  * check the parity bits of the keys, but simply ignore them. */
 extern bool
 gl_3des_makekey (gl_3des_ctx *ctx,
-                const char * key,
-                size_t keylen);
+                 const char * key,
+                 size_t keylen);
 
 /* Electronic Codebook Mode Triple-DES encryption/decryption of data
  * according to 'mode'.  Sometimes this mode is named 'EDE' mode
  * (Encryption-Decryption-Encryption). */
 extern void
 gl_3des_ecb_crypt (gl_3des_ctx *ctx,
-                  const char * from,
-                  char * to,
-                  int mode);
+                   const char * from,
+                   char * to,
+                   int mode);
 
 #define gl_3des_ecb_encrypt(ctx, from, to) gl_3des_ecb_crypt(ctx,from,to,0)
 #define gl_3des_ecb_decrypt(ctx, from, to) gl_3des_ecb_crypt(ctx,from,to,1)
diff --git a/gl/dup2.c b/gl/dup2.c
new file mode 100644
index 0000000..7ce49a2
--- /dev/null
+++ b/gl/dup2.c
@@ -0,0 +1,122 @@
+/* Duplicate an open file descriptor to a specified file descriptor.
+
+   Copyright (C) 1999, 2004, 2005, 2006, 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
+   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 Paul Eggert */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#include <errno.h>
+#include <fcntl.h>
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+/* Get declarations of the Win32 API functions.  */
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+#endif
+
+#if HAVE_DUP2
+
+# undef dup2
+
+int
+rpl_dup2 (int fd, int desired_fd)
+{
+  int result;
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+  /* If fd is closed, mingw hangs on dup2 (fd, fd).  If fd is open,
+     dup2 (fd, fd) returns 0, but all further attempts to use fd in
+     future dup2 calls will hang.  */
+  if (fd == desired_fd)
+    {
+      if ((HANDLE) _get_osfhandle (fd) == INVALID_HANDLE_VALUE)
+        {
+          errno = EBADF;
+          return -1;
+        }
+      return fd;
+    }
+# endif
+  result = dup2 (fd, desired_fd);
+# ifdef __linux__
+  /* Correct a Linux return value.
+     
<http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.30.y.git;a=commitdiff;h=2b79bc4f7ebbd5af3c8b867968f9f15602d5f802>
+   */
+  if (fd == desired_fd && result == (unsigned int) -EBADF)
+    {
+      errno = EBADF;
+      result = -1;
+    }
+# endif
+  if (result == 0)
+    result = desired_fd;
+  /* Correct a cygwin 1.5.x errno value.  */
+  else if (result == -1 && errno == EMFILE)
+    errno = EBADF;
+# if REPLACE_FCHDIR
+  if (fd != desired_fd && result != -1)
+    result = _gl_register_dup (fd, result);
+# endif
+  return result;
+}
+
+#else /* !HAVE_DUP2 */
+
+/* On older platforms, dup2 did not exist.  */
+
+# ifndef F_DUPFD
+static int
+dupfd (int fd, int desired_fd)
+{
+  int duplicated_fd = dup (fd);
+  if (duplicated_fd < 0 || duplicated_fd == desired_fd)
+    return duplicated_fd;
+  else
+    {
+      int r = dupfd (fd, desired_fd);
+      int e = errno;
+      close (duplicated_fd);
+      errno = e;
+      return r;
+    }
+}
+# endif
+
+int
+dup2 (int fd, int desired_fd)
+{
+  int result = fcntl (fd, F_GETFL) < 0 ? -1 : fd;
+  if (result == -1 || fd == desired_fd)
+    return result;
+  close (desired_fd);
+# ifdef F_DUPFD
+  result = fcntl (fd, F_DUPFD, desired_fd);
+#  if REPLACE_FCHDIR
+  if (0 <= result)
+    result = _gl_register_dup (fd, result);
+#  endif
+# else
+  result = dupfd (fd, desired_fd);
+# endif
+  if (result == -1 && (errno == EMFILE || errno == EINVAL))
+    errno = EBADF;
+  return result;
+}
+#endif /* !HAVE_DUP2 */
diff --git a/gl/fcntl.c b/gl/fcntl.c
new file mode 100644
index 0000000..5069eec
--- /dev/null
+++ b/gl/fcntl.c
@@ -0,0 +1,294 @@
+/* Provide file descriptor control.
+
+   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>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <fcntl.h>
+
+#include <errno.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <unistd.h>
+
+#if !HAVE_FCNTL
+# define rpl_fcntl fcntl
+#endif
+#undef fcntl
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+/* Get declarations of the Win32 API functions.  */
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+
+/* Upper bound on getdtablesize().  See lib/getdtablesize.c.  */
+# define OPEN_MAX_MAX 0x10000
+
+/* Duplicate OLDFD into the first available slot of at least NEWFD,
+   which must be positive, with FLAGS determining whether the duplicate
+   will be inheritable.  */
+static int
+dupfd (int oldfd, int newfd, int flags)
+{
+  /* Mingw has no way to create an arbitrary fd.  Iterate until all
+     file descriptors less than newfd are filled up.  */
+  HANDLE curr_process = GetCurrentProcess ();
+  HANDLE old_handle = (HANDLE) _get_osfhandle (oldfd);
+  unsigned char fds_to_close[OPEN_MAX_MAX / CHAR_BIT];
+  unsigned int fds_to_close_bound = 0;
+  int result;
+  BOOL inherit = flags & O_CLOEXEC ? FALSE : TRUE;
+  int mode;
+
+  if (newfd < 0 || getdtablesize () <= newfd)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+  if (old_handle == INVALID_HANDLE_VALUE
+      || (mode = setmode (oldfd, O_BINARY)) == -1)
+    {
+      /* oldfd is not open, or is an unassigned standard file
+         descriptor.  */
+      errno = EBADF;
+      return -1;
+    }
+  setmode (oldfd, mode);
+  flags |= mode;
+
+  for (;;)
+    {
+      HANDLE new_handle;
+      int duplicated_fd;
+      unsigned int index;
+
+      if (!DuplicateHandle (curr_process,           /* SourceProcessHandle */
+                            old_handle,             /* SourceHandle */
+                            curr_process,           /* TargetProcessHandle */
+                            (PHANDLE) &new_handle,  /* TargetHandle */
+                            (DWORD) 0,              /* DesiredAccess */
+                            inherit,                /* InheritHandle */
+                            DUPLICATE_SAME_ACCESS)) /* Options */
+        {
+          /* TODO: Translate GetLastError () into errno.  */
+          errno = EMFILE;
+          result = -1;
+          break;
+        }
+      duplicated_fd = _open_osfhandle ((long) new_handle, flags);
+      if (duplicated_fd < 0)
+        {
+          CloseHandle (new_handle);
+          errno = EMFILE;
+          result = -1;
+          break;
+        }
+      if (newfd <= duplicated_fd)
+        {
+          result = duplicated_fd;
+          break;
+        }
+
+      /* Set the bit duplicated_fd in fds_to_close[].  */
+      index = (unsigned int) duplicated_fd / CHAR_BIT;
+      if (fds_to_close_bound <= index)
+        {
+          if (sizeof fds_to_close <= index)
+            /* Need to increase OPEN_MAX_MAX.  */
+            abort ();
+          memset (fds_to_close + fds_to_close_bound, '\0',
+                  index + 1 - fds_to_close_bound);
+          fds_to_close_bound = index + 1;
+        }
+      fds_to_close[index] |= 1 << ((unsigned int) duplicated_fd % CHAR_BIT);
+    }
+
+  /* Close the previous fds that turned out to be too small.  */
+  {
+    int saved_errno = errno;
+    unsigned int duplicated_fd;
+
+    for (duplicated_fd = 0;
+         duplicated_fd < fds_to_close_bound * CHAR_BIT;
+         duplicated_fd++)
+      if ((fds_to_close[duplicated_fd / CHAR_BIT]
+           >> (duplicated_fd % CHAR_BIT))
+          & 1)
+        close (duplicated_fd);
+
+    errno = saved_errno;
+  }
+
+# if REPLACE_FCHDIR
+  if (0 <= result)
+    result = _gl_register_dup (oldfd, result);
+# endif
+  return result;
+}
+#endif /* W32 */
+
+/* Perform the specified ACTION on the file descriptor FD, possibly
+   using the argument ARG further described below.  This replacement
+   handles the following actions, and forwards all others on to the
+   native fcntl.  An unrecognized ACTION returns -1 with errno set to
+   EINVAL.
+
+   F_DUPFD - duplicate FD, with int ARG being the minimum target fd.
+   If successful, return the duplicate, which will be inheritable;
+   otherwise return -1 and set errno.
+
+   F_DUPFD_CLOEXEC - duplicate FD, with int ARG being the minimum
+   target fd.  If successful, return the duplicate, which will not be
+   inheritable; otherwise return -1 and set errno.
+
+   F_GETFD - ARG need not be present.  If successful, return a
+   non-negative value containing the descriptor flags of FD (only
+   FD_CLOEXEC is portable, but other flags may be present); otherwise
+   return -1 and set errno.  */
+
+int
+rpl_fcntl (int fd, int action, /* arg */...)
+{
+  va_list arg;
+  int result = -1;
+  va_start (arg, action);
+  switch (action)
+    {
+
+#if !HAVE_FCNTL
+    case F_DUPFD:
+      {
+        int target = va_arg (arg, int);
+        result = dupfd (fd, target, 0);
+        break;
+      }
+#elif FCNTL_DUPFD_BUGGY || REPLACE_FCHDIR
+    case F_DUPFD:
+      {
+        int target = va_arg (arg, int);
+        /* Detect invalid target; needed for cygwin 1.5.x.  */
+        if (target < 0 || getdtablesize () <= target)
+          errno = EINVAL;
+        else
+          {
+            result = fcntl (fd, action, target);
+# if REPLACE_FCHDIR
+            if (0 <= result)
+              result = _gl_register_dup (fd, result);
+# endif
+          }
+        break;
+      } /* F_DUPFD */
+#endif /* FCNTL_DUPFD_BUGGY || REPLACE_FCHDIR */
+
+    case F_DUPFD_CLOEXEC:
+      {
+        int target = va_arg (arg, int);
+
+#if !HAVE_FCNTL
+        result = dupfd (fd, target, O_CLOEXEC);
+        break;
+#else /* HAVE_FCNTL */
+        /* Try the system call first, if the headers claim it exists
+           (that is, if GNULIB_defined_F_DUPFD_CLOEXEC is 0), since we
+           may be running with a glibc that has the macro but with an
+           older kernel that does not support it.  Cache the
+           information on whether the system call really works, but
+           avoid caching failure if the corresponding F_DUPFD fails
+           for any reason.  0 = unknown, 1 = yes, -1 = no.  */
+        static int have_dupfd_cloexec = GNULIB_defined_F_DUPFD_CLOEXEC ? -1 : 
0;
+        if (0 <= have_dupfd_cloexec)
+          {
+            result = fcntl (fd, action, target);
+            if (0 <= result || errno != EINVAL)
+              {
+                have_dupfd_cloexec = 1;
+# if REPLACE_FCHDIR
+                if (0 <= result)
+                  result = _gl_register_dup (fd, result);
+# endif
+              }
+            else
+              {
+                result = rpl_fcntl (fd, F_DUPFD, target);
+                if (result < 0)
+                  break;
+                have_dupfd_cloexec = -1;
+              }
+          }
+        else
+          result = rpl_fcntl (fd, F_DUPFD, target);
+        if (0 <= result && have_dupfd_cloexec == -1)
+          {
+            int flags = fcntl (result, F_GETFD);
+            if (flags < 0 || fcntl (result, F_SETFD, flags | FD_CLOEXEC) == -1)
+              {
+                int saved_errno = errno;
+                close (result);
+                errno = saved_errno;
+                result = -1;
+              }
+          }
+        break;
+#endif /* HAVE_FCNTL */
+      } /* F_DUPFD_CLOEXEC */
+
+#if !HAVE_FCNTL
+    case F_GETFD:
+      {
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+        HANDLE handle = (HANDLE) _get_osfhandle (fd);
+        DWORD flags;
+        if (handle == INVALID_HANDLE_VALUE
+            || GetHandleInformation (handle, &flags) == 0)
+          errno = EBADF;
+        else
+          result = (flags & HANDLE_FLAG_INHERIT) ? 0 : FD_CLOEXEC;
+# else /* !W32 */
+        /* Use dup2 to reject invalid file descriptors.  No way to
+           access this information, so punt.  */
+        if (0 <= dup2 (fd, fd))
+          result = 0;
+# endif /* !W32 */
+        break;
+      } /* F_GETFD */
+#endif /* !HAVE_FCNTL */
+
+      /* Implementing F_SETFD on mingw is not trivial - there is no
+         API for changing the O_NOINHERIT bit on an fd, and merely
+         changing the HANDLE_FLAG_INHERIT bit on the underlying handle
+         can lead to odd state.  It may be possible by duplicating the
+         handle, using _open_osfhandle with the right flags, then
+         using dup2 to move the duplicate onto the original, but that
+         is not supported for now.  */
+
+    default:
+      {
+#if HAVE_FCNTL
+        void *p = va_arg (arg, void *);
+        result = fcntl (fd, action, p);
+#else
+        errno = EINVAL;
+#endif
+        break;
+      }
+    }
+  va_end (arg);
+  return result;
+}
diff --git a/gl/fcntl.in.h b/gl/fcntl.in.h
index fd7520e..d3eb27f 100644
--- a/gl/fcntl.in.h
+++ b/gl/fcntl.in.h
@@ -1,6 +1,6 @@
 /* Like <fcntl.h>, but with non-working flags defined to 0.
 
-   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
@@ -25,8 +25,10 @@
 /* Special invocation convention.  */
 
 #include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
+#ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems.  */
+# include <sys/stat.h>
+# include <unistd.h>
+#endif
 address@hidden@ @NEXT_FCNTL_H@
 
 #else
@@ -35,8 +37,10 @@
 #ifndef _GL_FCNTL_H
 
 #include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
+#ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems.  */
+# include <sys/stat.h>
+# include <unistd.h>
+#endif
 /* The include_next requires a split double-inclusion guard.  */
 address@hidden@ @NEXT_FCNTL_H@
 
@@ -44,29 +48,92 @@
 #define _GL_FCNTL_H
 
 
+/* The definition of GL_LINK_WARNING is copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+
 /* Declare overridden functions.  */
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+#if @GNULIB_FCNTL@
+# if @REPLACE_FCNTL@
+#  undef fcntl
+#  define fcntl rpl_fcntl
+# endif
+# if address@hidden@ || @REPLACE_FCNTL@
+extern int fcntl (int fd, int action, ...);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fcntl
+# define fcntl \
+    (GL_LINK_WARNING ("fcntl is not always POSIX compliant - " \
+                      "use gnulib module fcntl for portability"), \
+     fcntl)
+#endif
+
 #if @GNULIB_OPEN@
 # if @REPLACE_OPEN@
 #  undef open
 #  define open rpl_open
-extern int open (const char *filename, int flags, ...);
+extern int open (const char *filename, int flags, ...) _GL_ARG_NONNULL ((1));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef open
+# define open \
+    (GL_LINK_WARNING ("open is not always POSIX compliant - " \
+                      "use gnulib module open for portability"), \
+     open)
 #endif
 
-#ifdef FCHDIR_REPLACEMENT
-/* gnulib internal function.  */
-extern void _gl_register_fd (int fd, const char *filename);
+#if @GNULIB_OPENAT@
+# if @REPLACE_OPENAT@
+#  undef openat
+#  define openat rpl_openat
+# endif
+# if address@hidden@ || @REPLACE_OPENAT@
+extern int openat (int fd, char const *file, int flags, /* mode_t mode */ ...)
+     _GL_ARG_NONNULL ((2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef openat
+# define openat \
+    (GL_LINK_WARNING ("openat is not portable - " \
+                      "use gnulib module openat for portability"), \
+     openat)
 #endif
 
 #ifdef __cplusplus
 }
 #endif
 
+/* Fix up the FD_* macros, only known to be missing on mingw.  */
+
+#ifndef FD_CLOEXEC
+# define FD_CLOEXEC 1
+#endif
+
+/* Fix up the supported F_* macros.  Intentionally leave other F_*
+   macros undefined.  Only known to be missing on mingw.  */
+
+#ifndef F_DUPFD_CLOEXEC
+# define F_DUPFD_CLOEXEC 0x40000000
+/* Witness variable: 1 if gnulib defined F_DUPFD_CLOEXEC, 0 otherwise.  */
+# define GNULIB_defined_F_DUPFD_CLOEXEC 1
+#else
+# define GNULIB_defined_F_DUPFD_CLOEXEC 0
+#endif
+
+#ifndef F_DUPFD
+# define F_DUPFD 1
+#endif
+
+#ifndef F_GETFD
+# define F_GETFD 2
+#endif
 
 /* Fix up the O_* macros.  */
 
@@ -75,6 +142,12 @@ extern void _gl_register_fd (int fd, const char *filename);
 # define O_DIRECT O_DIRECTIO
 #endif
 
+#if !defined O_CLOEXEC && defined O_NOINHERIT
+/* Mingw spells it `O_NOINHERIT'.  Intentionally leave it
+   undefined if not available.  */
+# define O_CLOEXEC O_NOINHERIT
+#endif
+
 #ifndef O_DIRECT
 # define O_DIRECT 0
 #endif
@@ -119,6 +192,10 @@ extern void _gl_register_fd (int fd, const char *filename);
 # define O_SYNC 0
 #endif
 
+#ifndef O_TTY_INIT
+# define O_TTY_INIT 0
+#endif
+
 /* For systems that distinguish between text and binary I/O.
    O_BINARY is usually declared in fcntl.h  */
 #if !defined O_BINARY && defined _O_BINARY
@@ -138,6 +215,42 @@ extern void _gl_register_fd (int fd, const char *filename);
 # define O_TEXT 0
 #endif
 
+/* Fix up the AT_* macros.  */
+
+/* Work around a bug in Solaris 9 and 10: AT_FDCWD is positive.  Its
+   value exceeds INT_MAX, so its use as an int doesn't conform to the
+   C standard, and GCC and Sun C complain in some cases.  If the bug
+   is present, undef AT_FDCWD here, so it can be redefined below.  */
+#if 0 < AT_FDCWD && AT_FDCWD == 0xffd19553
+# undef AT_FDCWD
+#endif
+
+/* Use the same bit pattern as Solaris 9, but with the proper
+   signedness.  The bit pattern is important, in case this actually is
+   Solaris with the above workaround.  */
+#ifndef AT_FDCWD
+# define AT_FDCWD (-3041965)
+#endif
+
+/* Use the same values as Solaris 9.  This shouldn't matter, but
+   there's no real reason to differ.  */
+#ifndef AT_SYMLINK_NOFOLLOW
+# define AT_SYMLINK_NOFOLLOW 4096
+#endif
+
+#ifndef AT_REMOVEDIR
+# define AT_REMOVEDIR 1
+#endif
+
+/* Solaris 9 lacks these two, so just pick unique values.  */
+#ifndef AT_SYMLINK_FOLLOW
+# define AT_SYMLINK_FOLLOW 2
+#endif
+
+#ifndef AT_EACCESS
+# define AT_EACCESS 4
+#endif
+
 
 #endif /* _GL_FCNTL_H */
 #endif /* _GL_FCNTL_H */
diff --git a/gl/fseeko.c b/gl/fseeko.c
index cf7c42f..7242b56 100644
--- a/gl/fseeko.c
+++ b/gl/fseeko.c
@@ -50,10 +50,10 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
   if ((fp->_flags & __SL64) == 0)
     {
       /* Cygwin 1.5.0 through 1.5.24 failed to open stdin in 64-bit
-        mode; but has an fseeko that requires 64-bit mode.  */
+         mode; but has an fseeko that requires 64-bit mode.  */
       FILE *tmp = fopen ("/dev/null", "r");
       if (!tmp)
-       return -1;
+        return -1;
       fp->_flags |= __SL64;
       fp->_seek64 = tmp->_seek64;
       fclose (tmp);
@@ -62,8 +62,8 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
   if (fp_->_p == fp_->_bf._base
       && fp_->_r == 0
       && fp_->_w == ((fp_->_flags & (__SLBF | __SNBF | __SRD)) == 0 /* fully 
buffered and not currently reading? */
-                    ? fp_->_bf._size
-                    : 0)
+                     ? fp_->_bf._size
+                     : 0)
       && fp_ub._base == NULL)
 #elif defined __EMX__               /* emx+gcc */
   if (fp->_ptr == fp->_buffer
@@ -77,9 +77,9 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
   if (((fp->__modeflags & __FLAG_WRITING) == 0
        || fp->__bufpos == fp->__bufstart)
       && ((fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) == 0
-         || fp->__bufpos == fp->__bufread))
+          || fp->__bufpos == fp->__bufread))
 #elif defined __QNX__               /* QNX */
-  if ((fp->_Mode & _MWRITE ? fp->_Next == fp->_Buf : fp->_Next == fp->_Rend)
+  if ((fp->_Mode & 0x2000 /* _MWRITE */ ? fp->_Next == fp->_Buf : fp->_Next == 
fp->_Rend)
       && fp->_Rback == fp->_Back + sizeof (fp->_Back)
       && fp->_Rsave == NULL)
 #elif defined __MINT__              /* Atari FreeMiNT */
@@ -92,25 +92,42 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
 #endif
     {
       /* We get here when an fflush() call immediately preceded this one.  We
-        know there are no buffers.
-        POSIX requires us to modify the file descriptor's position.
-        But we cannot position beyond end of file here.  */
+         know there are no buffers.
+         POSIX requires us to modify the file descriptor's position.
+         But we cannot position beyond end of file here.  */
       off_t pos =
-       lseek (fileno (fp),
-              whence == SEEK_END && offset > 0 ? 0 : offset,
-              whence);
+        lseek (fileno (fp),
+               whence == SEEK_END && offset > 0 ? 0 : offset,
+               whence);
       if (pos == -1)
-       {
+        {
 #if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, 
DragonFly, MacOS X, Cygwin */
-         fp_->_flags &= ~__SOFF;
+          fp_->_flags &= ~__SOFF;
 #endif
-         return -1;
-       }
+          return -1;
+        }
 
 #if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, 
Linux libc5 */
       fp->_flags &= ~_IO_EOF_SEEN;
 #elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, 
DragonFly, MacOS X, Cygwin */
+# if defined __CYGWIN__
+      /* fp_->_offset is typed as an integer.  */
       fp_->_offset = pos;
+# else
+      /* fp_->_offset is an fpos_t.  */
+      {
+        /* Use a union, since on NetBSD, the compilation flags
+           determine whether fpos_t is typedef'd to off_t or a struct
+           containing a single off_t member.  */
+        union
+          {
+            fpos_t f;
+            off_t o;
+          } u;
+        u.o = pos;
+        fp_->_offset = u.f;
+      }
+# endif
       fp_->_flags |= __SOFF;
       fp_->_flags &= ~__SEOF;
 #elif defined __EMX__               /* emx+gcc */
@@ -122,9 +139,9 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
       fp->__eof = 0;
 #endif
       /* If we were not requested to position beyond end of file, we're
-        done.  */
+         done.  */
       if (!(whence == SEEK_END && offset > 0))
-       return 0;
+        return 0;
     }
   return fseeko (fp, offset, whence);
 }
diff --git a/gl/gc-gnulib.c b/gl/gc-gnulib.c
index 5a4444b..7ef355b 100644
--- a/gl/gc-gnulib.c
+++ b/gl/gc-gnulib.c
@@ -1,5 +1,6 @@
 /* gc-gnulib.c --- Common gnulib internal crypto interface functions
- * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008  Simon Josefsson
+ * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free
+ * Software Foundation, Inc.
  *
  * This file is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published
@@ -101,12 +102,12 @@ gc_init (void)
 
   /* We first try to use the Intel PIII RNG if drivers are present */
   if (!CryptAcquireContext (&g_hProv, NULL, NULL,
-                           PROV_INTEL_SEC, CRYPT_VERIFY_CONTEXT))
+                            PROV_INTEL_SEC, CRYPT_VERIFY_CONTEXT))
     {
       /* not a PIII or no drivers available, use default RSA CSP */
       if (!CryptAcquireContext (&g_hProv, NULL, NULL,
-                               PROV_RSA_FULL, CRYPT_VERIFY_CONTEXT))
-       return GC_RANDOM_ERROR;
+                                PROV_RSA_FULL, CRYPT_VERIFY_CONTEXT))
+        return GC_RANDOM_ERROR;
     }
 # endif
 #endif
@@ -176,12 +177,12 @@ randomize (int level, char *data, size_t datalen)
       tmp = read (fd, data, datalen);
 
       if (tmp < 0)
-       {
-         int save_errno = errno;
-         close (fd);
-         errno = save_errno;
-         return GC_RANDOM_ERROR;
-       }
+        {
+          int save_errno = errno;
+          close (fd);
+          errno = save_errno;
+          return GC_RANDOM_ERROR;
+        }
 
       len += tmp;
     }
@@ -219,9 +220,9 @@ gc_random (char *data, size_t datalen)
 
 void
 gc_set_allocators (gc_malloc_t func_malloc,
-                  gc_malloc_t secure_malloc,
-                  gc_secure_check_t secure_check,
-                  gc_realloc_t func_realloc, gc_free_t func_free)
+                   gc_malloc_t secure_malloc,
+                   gc_secure_check_t secure_check,
+                   gc_realloc_t func_realloc, gc_free_t func_free)
 {
   return;
 }
@@ -251,7 +252,7 @@ typedef struct _gc_cipher_ctx
 
 Gc_rc
 gc_cipher_open (Gc_cipher alg, Gc_cipher_mode mode,
-               gc_cipher_handle * outhandle)
+                gc_cipher_handle * outhandle)
 {
   _gc_cipher_ctx *ctx;
   Gc_rc rc = GC_OK;
@@ -268,14 +269,14 @@ gc_cipher_open (Gc_cipher alg, Gc_cipher_mode mode,
 #ifdef GNULIB_GC_ARCTWO
     case GC_ARCTWO40:
       switch (mode)
-       {
-       case GC_ECB:
-       case GC_CBC:
-         break;
+        {
+        case GC_ECB:
+        case GC_CBC:
+          break;
 
-       default:
-         rc = GC_INVALID_CIPHER;
-       }
+        default:
+          rc = GC_INVALID_CIPHER;
+        }
       break;
 #endif
 
@@ -283,26 +284,26 @@ gc_cipher_open (Gc_cipher alg, Gc_cipher_mode mode,
     case GC_ARCFOUR128:
     case GC_ARCFOUR40:
       switch (mode)
-       {
-       case GC_STREAM:
-         break;
+        {
+        case GC_STREAM:
+          break;
 
-       default:
-         rc = GC_INVALID_CIPHER;
-       }
+        default:
+          rc = GC_INVALID_CIPHER;
+        }
       break;
 #endif
 
 #ifdef GNULIB_GC_DES
     case GC_DES:
       switch (mode)
-       {
-       case GC_ECB:
-         break;
+        {
+        case GC_ECB:
+          break;
 
-       default:
-         rc = GC_INVALID_CIPHER;
-       }
+        default:
+          rc = GC_INVALID_CIPHER;
+        }
       break;
 #endif
 
@@ -311,14 +312,14 @@ gc_cipher_open (Gc_cipher alg, Gc_cipher_mode mode,
     case GC_AES192:
     case GC_AES256:
       switch (mode)
-       {
-       case GC_ECB:
-       case GC_CBC:
-         break;
+        {
+        case GC_ECB:
+        case GC_CBC:
+          break;
 
-       default:
-         rc = GC_INVALID_CIPHER;
-       }
+        default:
+          rc = GC_INVALID_CIPHER;
+        }
       break;
 #endif
 
@@ -357,7 +358,7 @@ gc_cipher_setkey (gc_cipher_handle handle, size_t keylen, 
const char *key)
 #ifdef GNULIB_GC_DES
     case GC_DES:
       if (keylen != 8)
-       return GC_INVALID_CIPHER;
+        return GC_INVALID_CIPHER;
       gl_des_setkey (&ctx->desContext, key);
       break;
 #endif
@@ -367,26 +368,26 @@ gc_cipher_setkey (gc_cipher_handle handle, size_t keylen, 
const char *key)
     case GC_AES192:
     case GC_AES256:
       {
-       rijndael_rc rc;
-       size_t i;
-       char keyMaterial[RIJNDAEL_MAX_KEY_SIZE + 1];
-
-       for (i = 0; i < keylen; i++)
-         sprintf (&keyMaterial[2 * i], "%02x", key[i] & 0xFF);
-
-       rc = rijndaelMakeKey (&ctx->aesEncKey, RIJNDAEL_DIR_ENCRYPT,
-                             keylen * 8, keyMaterial);
-       if (rc < 0)
-         return GC_INVALID_CIPHER;
-
-       rc = rijndaelMakeKey (&ctx->aesDecKey, RIJNDAEL_DIR_DECRYPT,
-                             keylen * 8, keyMaterial);
-       if (rc < 0)
-         return GC_INVALID_CIPHER;
-
-       rc = rijndaelCipherInit (&ctx->aesContext, RIJNDAEL_MODE_ECB, NULL);
-       if (rc < 0)
-         return GC_INVALID_CIPHER;
+        rijndael_rc rc;
+        size_t i;
+        char keyMaterial[RIJNDAEL_MAX_KEY_SIZE + 1];
+
+        for (i = 0; i < keylen; i++)
+          sprintf (&keyMaterial[2 * i], "%02x", key[i] & 0xFF);
+
+        rc = rijndaelMakeKey (&ctx->aesEncKey, RIJNDAEL_DIR_ENCRYPT,
+                              keylen * 8, keyMaterial);
+        if (rc < 0)
+          return GC_INVALID_CIPHER;
+
+        rc = rijndaelMakeKey (&ctx->aesDecKey, RIJNDAEL_DIR_DECRYPT,
+                              keylen * 8, keyMaterial);
+        if (rc < 0)
+          return GC_INVALID_CIPHER;
+
+        rc = rijndaelCipherInit (&ctx->aesContext, RIJNDAEL_MODE_ECB, NULL);
+        if (rc < 0)
+          return GC_INVALID_CIPHER;
       }
       break;
 #endif
@@ -408,7 +409,7 @@ gc_cipher_setiv (gc_cipher_handle handle, size_t ivlen, 
const char *iv)
 #ifdef GNULIB_GC_ARCTWO
     case GC_ARCTWO40:
       if (ivlen != ARCTWO_BLOCK_SIZE)
-       return GC_INVALID_CIPHER;
+        return GC_INVALID_CIPHER;
       memcpy (ctx->arctwoIV, iv, ivlen);
       break;
 #endif
@@ -418,30 +419,30 @@ gc_cipher_setiv (gc_cipher_handle handle, size_t ivlen, 
const char *iv)
     case GC_AES192:
     case GC_AES256:
       switch (ctx->mode)
-       {
-       case GC_ECB:
-         /* Doesn't use IV. */
-         break;
+        {
+        case GC_ECB:
+          /* Doesn't use IV. */
+          break;
 
-       case GC_CBC:
-         {
-           rijndael_rc rc;
-           size_t i;
-           char ivMaterial[2 * RIJNDAEL_MAX_IV_SIZE + 1];
+        case GC_CBC:
+          {
+            rijndael_rc rc;
+            size_t i;
+            char ivMaterial[2 * RIJNDAEL_MAX_IV_SIZE + 1];
 
-           for (i = 0; i < ivlen; i++)
-             sprintf (&ivMaterial[2 * i], "%02x", iv[i] & 0xFF);
+            for (i = 0; i < ivlen; i++)
+              sprintf (&ivMaterial[2 * i], "%02x", iv[i] & 0xFF);
 
-           rc = rijndaelCipherInit (&ctx->aesContext, RIJNDAEL_MODE_CBC,
-                                    ivMaterial);
-           if (rc < 0)
-             return GC_INVALID_CIPHER;
-         }
-         break;
+            rc = rijndaelCipherInit (&ctx->aesContext, RIJNDAEL_MODE_CBC,
+                                     ivMaterial);
+            if (rc < 0)
+              return GC_INVALID_CIPHER;
+          }
+          break;
 
-       default:
-         return GC_INVALID_CIPHER;
-       }
+        default:
+          return GC_INVALID_CIPHER;
+        }
       break;
 #endif
 
@@ -462,27 +463,27 @@ gc_cipher_encrypt_inline (gc_cipher_handle handle, size_t 
len, char *data)
 #ifdef GNULIB_GC_ARCTWO
     case GC_ARCTWO40:
       switch (ctx->mode)
-       {
-       case GC_ECB:
-         arctwo_encrypt (&ctx->arctwoContext, data, data, len);
-         break;
-
-       case GC_CBC:
-         for (; len >= ARCTWO_BLOCK_SIZE; len -= ARCTWO_BLOCK_SIZE,
-              data += ARCTWO_BLOCK_SIZE)
-           {
-             size_t i;
-             for (i = 0; i < ARCTWO_BLOCK_SIZE; i++)
-               data[i] ^= ctx->arctwoIV[i];
-             arctwo_encrypt (&ctx->arctwoContext, data, data,
-                             ARCTWO_BLOCK_SIZE);
-             memcpy (ctx->arctwoIV, data, ARCTWO_BLOCK_SIZE);
-           }
-         break;
-
-       default:
-         return GC_INVALID_CIPHER;
-       }
+        {
+        case GC_ECB:
+          arctwo_encrypt (&ctx->arctwoContext, data, data, len);
+          break;
+
+        case GC_CBC:
+          for (; len >= ARCTWO_BLOCK_SIZE; len -= ARCTWO_BLOCK_SIZE,
+               data += ARCTWO_BLOCK_SIZE)
+            {
+              size_t i;
+              for (i = 0; i < ARCTWO_BLOCK_SIZE; i++)
+                data[i] ^= ctx->arctwoIV[i];
+              arctwo_encrypt (&ctx->arctwoContext, data, data,
+                              ARCTWO_BLOCK_SIZE);
+              memcpy (ctx->arctwoIV, data, ARCTWO_BLOCK_SIZE);
+            }
+          break;
+
+        default:
+          return GC_INVALID_CIPHER;
+        }
       break;
 #endif
 
@@ -496,7 +497,7 @@ gc_cipher_encrypt_inline (gc_cipher_handle handle, size_t 
len, char *data)
 #ifdef GNULIB_GC_DES
     case GC_DES:
       for (; len >= 8; len -= 8, data += 8)
-       gl_des_ecb_encrypt (&ctx->desContext, data, data);
+        gl_des_ecb_encrypt (&ctx->desContext, data, data);
       break;
 #endif
 
@@ -505,12 +506,12 @@ gc_cipher_encrypt_inline (gc_cipher_handle handle, size_t 
len, char *data)
     case GC_AES192:
     case GC_AES256:
       {
-       int nblocks;
+        int nblocks;
 
-       nblocks = rijndaelBlockEncrypt (&ctx->aesContext, &ctx->aesEncKey,
-                                       data, 8 * len, data);
-       if (nblocks < 0)
-         return GC_INVALID_CIPHER;
+        nblocks = rijndaelBlockEncrypt (&ctx->aesContext, &ctx->aesEncKey,
+                                        data, 8 * len, data);
+        if (nblocks < 0)
+          return GC_INVALID_CIPHER;
       }
       break;
 #endif
@@ -532,29 +533,29 @@ gc_cipher_decrypt_inline (gc_cipher_handle handle, size_t 
len, char *data)
 #ifdef GNULIB_GC_ARCTWO
     case GC_ARCTWO40:
       switch (ctx->mode)
-       {
-       case GC_ECB:
-         arctwo_decrypt (&ctx->arctwoContext, data, data, len);
-         break;
-
-       case GC_CBC:
-         for (; len >= ARCTWO_BLOCK_SIZE; len -= ARCTWO_BLOCK_SIZE,
-              data += ARCTWO_BLOCK_SIZE)
-           {
-             char tmpIV[ARCTWO_BLOCK_SIZE];
-             size_t i;
-             memcpy (tmpIV, data, ARCTWO_BLOCK_SIZE);
-             arctwo_decrypt (&ctx->arctwoContext, data, data,
-                             ARCTWO_BLOCK_SIZE);
-             for (i = 0; i < ARCTWO_BLOCK_SIZE; i++)
-               data[i] ^= ctx->arctwoIV[i];
-             memcpy (ctx->arctwoIV, tmpIV, ARCTWO_BLOCK_SIZE);
-           }
-         break;
-
-       default:
-         return GC_INVALID_CIPHER;
-       }
+        {
+        case GC_ECB:
+          arctwo_decrypt (&ctx->arctwoContext, data, data, len);
+          break;
+
+        case GC_CBC:
+          for (; len >= ARCTWO_BLOCK_SIZE; len -= ARCTWO_BLOCK_SIZE,
+               data += ARCTWO_BLOCK_SIZE)
+            {
+              char tmpIV[ARCTWO_BLOCK_SIZE];
+              size_t i;
+              memcpy (tmpIV, data, ARCTWO_BLOCK_SIZE);
+              arctwo_decrypt (&ctx->arctwoContext, data, data,
+                              ARCTWO_BLOCK_SIZE);
+              for (i = 0; i < ARCTWO_BLOCK_SIZE; i++)
+                data[i] ^= ctx->arctwoIV[i];
+              memcpy (ctx->arctwoIV, tmpIV, ARCTWO_BLOCK_SIZE);
+            }
+          break;
+
+        default:
+          return GC_INVALID_CIPHER;
+        }
       break;
 #endif
 
@@ -568,7 +569,7 @@ gc_cipher_decrypt_inline (gc_cipher_handle handle, size_t 
len, char *data)
 #ifdef GNULIB_GC_DES
     case GC_DES:
       for (; len >= 8; len -= 8, data += 8)
-       gl_des_ecb_decrypt (&ctx->desContext, data, data);
+        gl_des_ecb_decrypt (&ctx->desContext, data, data);
       break;
 #endif
 
@@ -577,12 +578,12 @@ gc_cipher_decrypt_inline (gc_cipher_handle handle, size_t 
len, char *data)
     case GC_AES192:
     case GC_AES256:
       {
-       int nblocks;
+        int nblocks;
 
-       nblocks = rijndaelBlockDecrypt (&ctx->aesContext, &ctx->aesDecKey,
-                                       data, 8 * len, data);
-       if (nblocks < 0)
-         return GC_INVALID_CIPHER;
+        nblocks = rijndaelBlockDecrypt (&ctx->aesContext, &ctx->aesDecKey,
+                                        data, 8 * len, data);
+        if (nblocks < 0)
+          return GC_INVALID_CIPHER;
       }
       break;
 #endif
@@ -900,7 +901,7 @@ gc_sha1 (const void *in, size_t inlen, void *resbuf)
 #ifdef GNULIB_GC_HMAC_MD5
 Gc_rc
 gc_hmac_md5 (const void *key, size_t keylen,
-            const void *in, size_t inlen, char *resbuf)
+             const void *in, size_t inlen, char *resbuf)
 {
   hmac_md5 (key, keylen, in, inlen, resbuf);
   return GC_OK;
@@ -910,7 +911,7 @@ gc_hmac_md5 (const void *key, size_t keylen,
 #ifdef GNULIB_GC_HMAC_SHA1
 Gc_rc
 gc_hmac_sha1 (const void *key, size_t keylen,
-             const void *in, size_t inlen, char *resbuf)
+              const void *in, size_t inlen, char *resbuf)
 {
   hmac_sha1 (key, keylen, in, inlen, resbuf);
   return GC_OK;
diff --git a/gl/gc-libgcrypt.c b/gl/gc-libgcrypt.c
index f5dc45f..73355e6 100644
--- a/gl/gc-libgcrypt.c
+++ b/gl/gc-libgcrypt.c
@@ -1,5 +1,6 @@
 /* gc-libgcrypt.c --- Crypto wrappers around Libgcrypt for GC.
- * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008  Simon Josefsson
+ * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free
+ * Software Foundation, Inc.
  *
  * This file is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published
@@ -47,14 +48,14 @@ gc_init (void)
   if (err == GPG_ERR_NO_ERROR)
     {
       if (gcry_control (GCRYCTL_DISABLE_SECMEM, NULL, 0))
-       return GC_INIT_ERROR;
+        return GC_INIT_ERROR;
 
       if (gcry_check_version (GCRYPT_VERSION) == NULL)
-       return GC_INIT_ERROR;
+        return GC_INIT_ERROR;
 
       err = gcry_control (GCRYCTL_INITIALIZATION_FINISHED, NULL, 0);
       if (err != GPG_ERR_NO_ERROR)
-       return GC_INIT_ERROR;
+        return GC_INIT_ERROR;
     }
 
   return GC_OK;
@@ -97,19 +98,19 @@ gc_random (char *data, size_t datalen)
 
 void
 gc_set_allocators (gc_malloc_t func_malloc,
-                  gc_malloc_t secure_malloc,
-                  gc_secure_check_t secure_check,
-                  gc_realloc_t func_realloc, gc_free_t func_free)
+                   gc_malloc_t secure_malloc,
+                   gc_secure_check_t secure_check,
+                   gc_realloc_t func_realloc, gc_free_t func_free)
 {
   gcry_set_allocation_handler (func_malloc, secure_malloc, secure_check,
-                              func_realloc, func_free);
+                               func_realloc, func_free);
 }
 
 /* Ciphers. */
 
 Gc_rc
 gc_cipher_open (Gc_cipher alg, Gc_cipher_mode mode,
-               gc_cipher_handle * outhandle)
+                gc_cipher_handle * outhandle)
 {
   int gcryalg, gcrymode;
   gcry_error_t err;
@@ -178,7 +179,7 @@ gc_cipher_open (Gc_cipher alg, Gc_cipher_mode mode,
     }
 
   err = gcry_cipher_open ((gcry_cipher_hd_t *) outhandle,
-                         gcryalg, gcrymode, 0);
+                          gcryalg, gcrymode, 0);
   if (gcry_err_code (err))
     return GC_INVALID_CIPHER;
 
@@ -213,7 +214,7 @@ Gc_rc
 gc_cipher_encrypt_inline (gc_cipher_handle handle, size_t len, char *data)
 {
   if (gcry_cipher_encrypt ((gcry_cipher_hd_t) handle,
-                          data, len, NULL, len) != 0)
+                           data, len, NULL, len) != 0)
     return GC_INVALID_CIPHER;
 
   return GC_OK;
@@ -223,7 +224,7 @@ Gc_rc
 gc_cipher_decrypt_inline (gc_cipher_handle handle, size_t len, char *data)
 {
   if (gcry_cipher_decrypt ((gcry_cipher_hd_t) handle,
-                          data, len, NULL, len) != 0)
+                           data, len, NULL, len) != 0)
     return GC_INVALID_CIPHER;
 
   return GC_OK;
@@ -324,7 +325,7 @@ gc_hash_open (Gc_hash hash, Gc_hash_mode mode, 
gc_hash_handle * outhandle)
     {
       err = gcry_md_open (&ctx->gch, gcryalg, gcrymode);
       if (gcry_err_code (err))
-       rc = GC_INVALID_HASH;
+        rc = GC_INVALID_HASH;
     }
 
   if (rc == GC_OK)
@@ -647,7 +648,7 @@ gc_sha1 (const void *in, size_t inlen, void *resbuf)
 #ifdef GNULIB_GC_HMAC_MD5
 Gc_rc
 gc_hmac_md5 (const void *key, size_t keylen,
-            const void *in, size_t inlen, char *resbuf)
+             const void *in, size_t inlen, char *resbuf)
 {
   size_t hlen = gcry_md_get_algo_dlen (GCRY_MD_MD5);
   gcry_md_hd_t mdh;
@@ -687,7 +688,7 @@ gc_hmac_md5 (const void *key, size_t keylen,
 #ifdef GNULIB_GC_HMAC_SHA1
 Gc_rc
 gc_hmac_sha1 (const void *key, size_t keylen,
-             const void *in, size_t inlen, char *resbuf)
+              const void *in, size_t inlen, char *resbuf)
 {
   size_t hlen = gcry_md_get_algo_dlen (GCRY_MD_SHA1);
   gcry_md_hd_t mdh;
diff --git a/gl/gc-pbkdf2-sha1.c b/gl/gc-pbkdf2-sha1.c
index 5316dfa..6d84b60 100644
--- a/gl/gc-pbkdf2-sha1.c
+++ b/gl/gc-pbkdf2-sha1.c
@@ -1,5 +1,5 @@
 /* gc-pbkdf2-sha1.c --- Password-Based Key Derivation Function a'la PKCS#5
-   Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005, 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
@@ -15,8 +15,7 @@
    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 Simon Josefsson.  The comments in this file are taken
-   from RFC 2898.  */
+/* Written by Simon Josefsson. */
 
 #include <config.h>
 
@@ -25,37 +24,17 @@
 #include <stdlib.h>
 #include <string.h>
 
-/*
- * 5.2 PBKDF2
- *
- *  PBKDF2 applies a pseudorandom function (see Appendix B.1 for an
- *  example) to derive keys. The length of the derived key is essentially
- *  unbounded. (However, the maximum effective search space for the
- *  derived key may be limited by the structure of the underlying
- *  pseudorandom function. See Appendix B.1 for further discussion.)
- *  PBKDF2 is recommended for new applications.
- *
- *  PBKDF2 (P, S, c, dkLen)
- *
- *  Options:        PRF        underlying pseudorandom function (hLen
- *                             denotes the length in octets of the
- *                             pseudorandom function output)
- *
- *  Input:          P          password, an octet string (ASCII or UTF-8)
- *                  S          salt, an octet string
- *                  c          iteration count, a positive integer
- *                  dkLen      intended length in octets of the derived
- *                             key, a positive integer, at most
- *                             (2^32 - 1) * hLen
- *
- *  Output:         DK         derived key, a dkLen-octet string
- */
-
+/* Implement PKCS#5 PBKDF2 as per RFC 2898.  The PRF to use is hard
+   coded to be HMAC-SHA1.  Inputs are the password P of length PLEN,
+   the salt S of length SLEN, the iteration counter C (> 0), and the
+   desired derived output length DKLEN.  Output buffer is DK which
+   must have room for at least DKLEN octets.  The output buffer will
+   be filled with the derived data.  */
 Gc_rc
 gc_pbkdf2_sha1 (const char *P, size_t Plen,
-               const char *S, size_t Slen,
-               unsigned int c,
-               char *DK, size_t dkLen)
+                const char *S, size_t Slen,
+                unsigned int c,
+                char *DK, size_t dkLen)
 {
   unsigned int hLen = 20;
   char U[20];
@@ -75,74 +54,12 @@ gc_pbkdf2_sha1 (const char *P, size_t Plen,
   if (dkLen == 0)
     return GC_PKCS5_INVALID_DERIVED_KEY_LENGTH;
 
-  /*
-   *
-   *  Steps:
-   *
-   *     1. If dkLen > (2^32 - 1) * hLen, output "derived key too long" and
-   *        stop.
-   */
-
   if (dkLen > 4294967295U)
     return GC_PKCS5_DERIVED_KEY_TOO_LONG;
 
-  /*
-   *     2. Let l be the number of hLen-octet blocks in the derived key,
-   *        rounding up, and let r be the number of octets in the last
-   *        block:
-   *
-   *                  l = CEIL (dkLen / hLen) ,
-   *                  r = dkLen - (l - 1) * hLen .
-   *
-   *        Here, CEIL (x) is the "ceiling" function, i.e. the smallest
-   *        integer greater than, or equal to, x.
-   */
-
   l = ((dkLen - 1) / hLen) + 1;
   r = dkLen - (l - 1) * hLen;
 
-  /*
-   *     3. For each block of the derived key apply the function F defined
-   *        below to the password P, the salt S, the iteration count c, and
-   *        the block index to compute the block:
-   *
-   *                  T_1 = F (P, S, c, 1) ,
-   *                  T_2 = F (P, S, c, 2) ,
-   *                  ...
-   *                  T_l = F (P, S, c, l) ,
-   *
-   *        where the function F is defined as the exclusive-or sum of the
-   *        first c iterates of the underlying pseudorandom function PRF
-   *        applied to the password P and the concatenation of the salt S
-   *        and the block index i:
-   *
-   *                  F (P, S, c, i) = U_1 \xor U_2 \xor ... \xor U_c
-   *
-   *        where
-   *
-   *                  U_1 = PRF (P, S || INT (i)) ,
-   *                  U_2 = PRF (P, U_1) ,
-   *                  ...
-   *                  U_c = PRF (P, U_{c-1}) .
-   *
-   *        Here, INT (i) is a four-octet encoding of the integer i, most
-   *        significant octet first.
-   *
-   *     4. Concatenate the blocks and extract the first dkLen octets to
-   *        produce a derived key DK:
-   *
-   *                  DK = T_1 || T_2 ||  ...  || T_l<0..r-1>
-   *
-   *     5. Output the derived key DK.
-   *
-   *  Note. The construction of the function F follows a "belt-and-
-   *  suspenders" approach. The iterates U_i are computed recursively to
-   *  remove a degree of parallelism from an opponent; they are exclusive-
-   *  ored together to reduce concerns about the recursion degenerating
-   *  into a small set of values.
-   *
-   */
-
   tmp = malloc (tmplen);
   if (tmp == NULL)
     return GC_MALLOC_ERROR;
@@ -154,28 +71,28 @@ gc_pbkdf2_sha1 (const char *P, size_t Plen,
       memset (T, 0, hLen);
 
       for (u = 1; u <= c; u++)
-       {
-         if (u == 1)
-           {
-             tmp[Slen + 0] = (i & 0xff000000) >> 24;
-             tmp[Slen + 1] = (i & 0x00ff0000) >> 16;
-             tmp[Slen + 2] = (i & 0x0000ff00) >> 8;
-             tmp[Slen + 3] = (i & 0x000000ff) >> 0;
-
-             rc = gc_hmac_sha1 (P, Plen, tmp, tmplen, U);
-           }
-         else
-           rc = gc_hmac_sha1 (P, Plen, U, hLen, U);
-
-         if (rc != GC_OK)
-           {
-             free (tmp);
-             return rc;
-           }
-
-         for (k = 0; k < hLen; k++)
-           T[k] ^= U[k];
-       }
+        {
+          if (u == 1)
+            {
+              tmp[Slen + 0] = (i & 0xff000000) >> 24;
+              tmp[Slen + 1] = (i & 0x00ff0000) >> 16;
+              tmp[Slen + 2] = (i & 0x0000ff00) >> 8;
+              tmp[Slen + 3] = (i & 0x000000ff) >> 0;
+
+              rc = gc_hmac_sha1 (P, Plen, tmp, tmplen, U);
+            }
+          else
+            rc = gc_hmac_sha1 (P, Plen, U, hLen, U);
+
+          if (rc != GC_OK)
+            {
+              free (tmp);
+              return rc;
+            }
+
+          for (k = 0; k < hLen; k++)
+            T[k] ^= U[k];
+        }
 
       memcpy (DK + (i - 1) * hLen, T, i == l ? r : hLen);
     }
diff --git a/gl/gc.h b/gl/gc.h
index 0a0a689..8735ad2 100644
--- a/gl/gc.h
+++ b/gl/gc.h
@@ -107,10 +107,10 @@ typedef int (*gc_secure_check_t) (const void *);
 typedef void *(*gc_realloc_t) (void *p, size_t n);
 typedef void (*gc_free_t) (void *);
 extern void gc_set_allocators (gc_malloc_t func_malloc,
-                              gc_malloc_t secure_malloc,
-                              gc_secure_check_t secure_check,
-                              gc_realloc_t func_realloc,
-                              gc_free_t func_free);
+                               gc_malloc_t secure_malloc,
+                               gc_secure_check_t secure_check,
+                               gc_realloc_t func_realloc,
+                               gc_free_t func_free);
 
 /* Randomness. */
 extern Gc_rc gc_nonce (char *data, size_t datalen);
@@ -119,27 +119,27 @@ extern Gc_rc gc_random (char *data, size_t datalen);
 
 /* Ciphers. */
 extern Gc_rc gc_cipher_open (Gc_cipher cipher, Gc_cipher_mode mode,
-                            gc_cipher_handle *outhandle);
+                             gc_cipher_handle *outhandle);
 extern Gc_rc gc_cipher_setkey (gc_cipher_handle handle,
-                              size_t keylen, const char *key);
+                               size_t keylen, const char *key);
 extern Gc_rc gc_cipher_setiv (gc_cipher_handle handle,
-                             size_t ivlen, const char *iv);
+                              size_t ivlen, const char *iv);
 extern Gc_rc gc_cipher_encrypt_inline (gc_cipher_handle handle,
-                                      size_t len, char *data);
+                                       size_t len, char *data);
 extern Gc_rc gc_cipher_decrypt_inline (gc_cipher_handle handle,
-                                      size_t len, char *data);
+                                       size_t len, char *data);
 extern Gc_rc gc_cipher_close (gc_cipher_handle handle);
 
 /* Hashes. */
 
 extern Gc_rc gc_hash_open (Gc_hash hash, Gc_hash_mode mode,
-                          gc_hash_handle *outhandle);
+                           gc_hash_handle *outhandle);
 extern Gc_rc gc_hash_clone (gc_hash_handle handle, gc_hash_handle *outhandle);
 extern size_t gc_hash_digest_length (Gc_hash hash);
 extern void gc_hash_hmac_setkey (gc_hash_handle handle,
-                                size_t len, const char *key);
+                                 size_t len, const char *key);
 extern void gc_hash_write (gc_hash_handle handle,
-                          size_t len, const char *data);
+                           size_t len, const char *data);
 extern const char *gc_hash_read (gc_hash_handle handle);
 extern void gc_hash_close (gc_hash_handle handle);
 
@@ -158,9 +158,9 @@ extern Gc_rc gc_md4 (const void *in, size_t inlen, void 
*resbuf);
 extern Gc_rc gc_md5 (const void *in, size_t inlen, void *resbuf);
 extern Gc_rc gc_sha1 (const void *in, size_t inlen, void *resbuf);
 extern Gc_rc gc_hmac_md5 (const void *key, size_t keylen,
-                         const void *in, size_t inlen, char *resbuf);
+                          const void *in, size_t inlen, char *resbuf);
 extern Gc_rc gc_hmac_sha1 (const void *key, size_t keylen,
-                          const void *in, size_t inlen, char *resbuf);
+                           const void *in, size_t inlen, char *resbuf);
 
 /* Derive cryptographic keys from a password P of length PLEN, with
    salt S of length SLEN, placing the result in pre-allocated buffer
@@ -171,8 +171,8 @@ extern Gc_rc gc_hmac_sha1 (const void *key, size_t keylen,
    an Gc_rc error code is returned.  */
 extern Gc_rc
 gc_pbkdf2_sha1 (const char *P, size_t Plen,
-               const char *S, size_t Slen,
-               unsigned int c, char *DK, size_t dkLen);
+                const char *S, size_t Slen,
+                unsigned int c, char *DK, size_t dkLen);
 
 /*
   TODO:
diff --git a/gl/getaddrinfo.c b/gl/getaddrinfo.c
index f09cf9e..417e64b 100644
--- a/gl/getaddrinfo.c
+++ b/gl/getaddrinfo.c
@@ -1,6 +1,5 @@
 /* Get address information (partial implementation).
-   Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software
-   Foundation, Inc.
+   Copyright (C) 1997, 2001-2002, 2004-2009 Free Software Foundation, Inc.
    Contributed by Simon Josefsson <address@hidden>.
 
    This program is free software; you can redistribute it and/or modify
@@ -19,6 +18,10 @@
 
 #include <config.h>
 
+/* Don't use __attribute__ __nonnull__ in this compilation unit.  Otherwise gcc
+   optimizes away the sa == NULL test below.  */
+#define _GL_ARG_NONNULL(params)
+
 #include <netdb.h>
 
 #if HAVE_NETINET_IN_H
@@ -58,12 +61,12 @@
 
 #ifdef WIN32_NATIVE
 typedef int (WSAAPI *getaddrinfo_func) (const char*, const char*,
-                                       const struct addrinfo*,
-                                       struct addrinfo**);
+                                        const struct addrinfo*,
+                                        struct addrinfo**);
 typedef void (WSAAPI *freeaddrinfo_func) (struct addrinfo*);
 typedef int (WSAAPI *getnameinfo_func) (const struct sockaddr*,
-                                       socklen_t, char*, DWORD,
-                                       char*, DWORD, int);
+                                        socklen_t, char*, DWORD,
+                                        char*, DWORD, int);
 
 static getaddrinfo_func getaddrinfo_ptr = NULL;
 static freeaddrinfo_func freeaddrinfo_ptr = NULL;
@@ -123,9 +126,9 @@ validate_family (int family)
    socket addresses. */
 int
 getaddrinfo (const char *restrict nodename,
-            const char *restrict servname,
-            const struct addrinfo *restrict hints,
-            struct addrinfo **restrict res)
+             const char *restrict servname,
+             const struct addrinfo *restrict hints,
+             struct addrinfo **restrict res)
 {
   struct addrinfo *tmp;
   int port = 0;
@@ -165,7 +168,7 @@ getaddrinfo (const char *restrict nodename,
   if (!nodename)
     {
       if (!(hints->ai_flags & AI_PASSIVE))
-       return EAI_NONAME;
+        return EAI_NONAME;
 
 #ifdef HAVE_IPV6
       nodename = (hints->ai_family == AF_INET6) ? "::" : "0.0.0.0";
@@ -178,24 +181,24 @@ getaddrinfo (const char *restrict nodename,
     {
       struct servent *se = NULL;
       const char *proto =
-       (hints && hints->ai_socktype == SOCK_DGRAM) ? "udp" : "tcp";
+        (hints && hints->ai_socktype == SOCK_DGRAM) ? "udp" : "tcp";
 
       if (hints == NULL || !(hints->ai_flags & AI_NUMERICSERV))
-       /* FIXME: Use getservbyname_r if available. */
-       se = getservbyname (servname, proto);
+        /* FIXME: Use getservbyname_r if available. */
+        se = getservbyname (servname, proto);
 
       if (!se)
-       {
-         char *c;
-         if (!(*servname >= '0' && *servname <= '9'))
-           return EAI_NONAME;
-         port = strtoul (servname, &c, 10);
-         if (*c || port > 0xffff)
-           return EAI_NONAME;
-         port = htons (port);
-       }
+        {
+          char *c;
+          if (!(*servname >= '0' && *servname <= '9'))
+            return EAI_NONAME;
+          port = strtoul (servname, &c, 10);
+          if (*c || port > 0xffff)
+            return EAI_NONAME;
+          port = htons (port);
+        }
       else
-       port = se->s_port;
+        port = se->s_port;
     }
 
   /* FIXME: Use gethostbyname_r if available. */
@@ -230,23 +233,23 @@ getaddrinfo (const char *restrict nodename,
 #if HAVE_IPV6
     case PF_INET6:
       {
-       struct v6_pair *p = storage;
-       struct sockaddr_in6 *sinp = &p->sockaddr_in6;
-       tmp = &p->addrinfo;
+        struct v6_pair *p = storage;
+        struct sockaddr_in6 *sinp = &p->sockaddr_in6;
+        tmp = &p->addrinfo;
 
-       if (port)
-         sinp->sin6_port = port;
+        if (port)
+          sinp->sin6_port = port;
 
-       if (he->h_length != sizeof (sinp->sin6_addr))
-         {
-           free (storage);
-           return EAI_SYSTEM; /* FIXME: Better return code?  Set errno? */
-         }
+        if (he->h_length != sizeof (sinp->sin6_addr))
+          {
+            free (storage);
+            return EAI_SYSTEM; /* FIXME: Better return code?  Set errno? */
+          }
 
-       memcpy (&sinp->sin6_addr, he->h_addr_list[0], sizeof sinp->sin6_addr);
+        memcpy (&sinp->sin6_addr, he->h_addr_list[0], sizeof sinp->sin6_addr);
 
-       tmp->ai_addr = (struct sockaddr *) sinp;
-       tmp->ai_addrlen = sizeof *sinp;
+        tmp->ai_addr = (struct sockaddr *) sinp;
+        tmp->ai_addrlen = sizeof *sinp;
       }
       break;
 #endif
@@ -254,23 +257,23 @@ getaddrinfo (const char *restrict nodename,
 #if HAVE_IPV4
     case PF_INET:
       {
-       struct v4_pair *p = storage;
-       struct sockaddr_in *sinp = &p->sockaddr_in;
-       tmp = &p->addrinfo;
+        struct v4_pair *p = storage;
+        struct sockaddr_in *sinp = &p->sockaddr_in;
+        tmp = &p->addrinfo;
 
-       if (port)
-         sinp->sin_port = port;
+        if (port)
+          sinp->sin_port = port;
 
-       if (he->h_length != sizeof (sinp->sin_addr))
-         {
-           free (storage);
-           return EAI_SYSTEM; /* FIXME: Better return code?  Set errno? */
-         }
+        if (he->h_length != sizeof (sinp->sin_addr))
+          {
+            free (storage);
+            return EAI_SYSTEM; /* FIXME: Better return code?  Set errno? */
+          }
 
-       memcpy (&sinp->sin_addr, he->h_addr_list[0], sizeof sinp->sin_addr);
+        memcpy (&sinp->sin_addr, he->h_addr_list[0], sizeof sinp->sin_addr);
 
-       tmp->ai_addr = (struct sockaddr *) sinp;
-       tmp->ai_addrlen = sizeof *sinp;
+        tmp->ai_addr = (struct sockaddr *) sinp;
+        tmp->ai_addrlen = sizeof *sinp;
       }
       break;
 #endif
@@ -284,16 +287,16 @@ getaddrinfo (const char *restrict nodename,
     {
       const char *cn;
       if (he->h_name)
-       cn = he->h_name;
+        cn = he->h_name;
       else
-       cn = nodename;
+        cn = nodename;
 
       tmp->ai_canonname = strdup (cn);
       if (!tmp->ai_canonname)
-       {
-         free (storage);
-         return EAI_MEMORY;
-       }
+        {
+          free (storage);
+          return EAI_MEMORY;
+        }
     }
 
   tmp->ai_protocol = (hints) ? hints->ai_protocol : 0;
@@ -349,14 +352,14 @@ freeaddrinfo (struct addrinfo *ai)
 }
 
 int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
-               char *restrict node, socklen_t nodelen,
-               char *restrict service, socklen_t servicelen,
-               int flags)
+                char *restrict node, socklen_t nodelen,
+                char *restrict service, socklen_t servicelen,
+                int flags)
 {
 #ifdef WIN32_NATIVE
   if (use_win32_p ())
     return getnameinfo_ptr (sa, salen, node, nodelen,
-                           service, servicelen, flags);
+                            service, servicelen, flags);
 #endif
 
   /* FIXME: Support other flags. */
@@ -373,13 +376,13 @@ int getnameinfo(const struct sockaddr *restrict sa, 
socklen_t salen,
 #if HAVE_IPV4
     case AF_INET:
       if (salen < sizeof (struct sockaddr_in))
-       return EAI_FAMILY;
+        return EAI_FAMILY;
       break;
 #endif
 #if HAVE_IPV6
     case AF_INET6:
       if (salen < sizeof (struct sockaddr_in6))
-       return EAI_FAMILY;
+        return EAI_FAMILY;
       break;
 #endif
     default:
@@ -389,28 +392,28 @@ int getnameinfo(const struct sockaddr *restrict sa, 
socklen_t salen,
   if (node && nodelen > 0 && flags & NI_NUMERICHOST)
     {
       switch (sa->sa_family)
-       {
+        {
 #if HAVE_IPV4
-       case AF_INET:
-         if (!inet_ntop (AF_INET,
-                         &(((const struct sockaddr_in *) sa)->sin_addr),
-                         node, nodelen))
-           return EAI_SYSTEM;
-         break;
+        case AF_INET:
+          if (!inet_ntop (AF_INET,
+                          &(((const struct sockaddr_in *) sa)->sin_addr),
+                          node, nodelen))
+            return EAI_SYSTEM;
+          break;
 #endif
 
 #if HAVE_IPV6
-       case AF_INET6:
-         if (!inet_ntop (AF_INET6,
-                         &(((const struct sockaddr_in6 *) sa)->sin6_addr),
-                         node, nodelen))
-           return EAI_SYSTEM;
-         break;
+        case AF_INET6:
+          if (!inet_ntop (AF_INET6,
+                          &(((const struct sockaddr_in6 *) sa)->sin6_addr),
+                          node, nodelen))
+            return EAI_SYSTEM;
+          break;
 #endif
 
-       default:
-         return EAI_FAMILY;
-       }
+        default:
+          return EAI_FAMILY;
+        }
     }
 
   if (service && servicelen > 0 && flags & NI_NUMERICSERV)
@@ -422,13 +425,13 @@ int getnameinfo(const struct sockaddr *restrict sa, 
socklen_t salen,
 #if HAVE_IPV6
       case AF_INET6:
 #endif
-       {
-         unsigned short int port
-           = ntohs (((const struct sockaddr_in *) sa)->sin_port);
-         if (servicelen <= snprintf (service, servicelen, "%u", port))
-           return EAI_OVERFLOW;
-       }
-       break;
+        {
+          unsigned short int port
+            = ntohs (((const struct sockaddr_in *) sa)->sin_port);
+          if (servicelen <= snprintf (service, servicelen, "%u", port))
+            return EAI_OVERFLOW;
+        }
+        break;
       }
 
   return 0;
diff --git a/gl/getdate.y b/gl/getdate.y
index 2f3c924..57aee96 100644
--- a/gl/getdate.y
+++ b/gl/getdate.y
@@ -78,16 +78,6 @@
    of `digit' even when the host does not conform to POSIX.  */
 #define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
 
-#ifndef __attribute__
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
-#  define __attribute__(x)
-# endif
-#endif
-
-#ifndef ATTRIBUTE_UNUSED
-# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
-#endif
-
 /* Shift A right by B bits portably, by dividing A by 2**B and
    truncating towards minus infinity.  A and B should be free of side
    effects, and B should be in the range 0 <= B <= INT_BITS - 2, where
@@ -98,9 +88,9 @@
    implementations (e.g., UNICOS 9.0 on a Cray Y-MP EL) don't shift
    right in the usual way when A < 0, so SHR falls back on division if
    ordinary A >> B doesn't seem to be the usual signed shift.  */
-#define SHR(a, b)      \
-  (-1 >> 1 == -1       \
-   ? (a) >> (b)                \
+#define SHR(a, b)       \
+  (-1 >> 1 == -1        \
+   ? (a) >> (b)         \
    : (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))
 
 #define EPOCH_YEAR 1970
@@ -108,12 +98,21 @@
 
 #define HOUR(x) ((x) * 60)
 
-/* Lots of this code assumes time_t and time_t-like values fit into
-   long int.  It also assumes that signed integer overflow silently
-   wraps around, but there's no portable way to check for that at
-   compile-time.  */
+/* long_time_t is a signed integer type that contains all time_t values.  */
 verify (TYPE_IS_INTEGER (time_t));
-verify (LONG_MIN <= TYPE_MINIMUM (time_t) && TYPE_MAXIMUM (time_t) <= 
LONG_MAX);
+#if TIME_T_FITS_IN_LONG_INT
+typedef long int long_time_t;
+#else
+typedef time_t long_time_t;
+#endif
+
+/* Lots of this code assumes time_t and time_t-like values fit into
+   long_time_t.  */
+verify (TYPE_MINIMUM (long_time_t) <= TYPE_MINIMUM (time_t)
+        && TYPE_MAXIMUM (time_t) <= TYPE_MAXIMUM (long_time_t));
+
+/* FIXME: It also assumes that signed integer overflow silently wraps around,
+   but this is not true any more with recent versions of GCC 4.  */
 
 /* An integer value, and the number of digits in its textual
    representation.  */
@@ -146,7 +145,7 @@ typedef struct
   long int day;
   long int hour;
   long int minutes;
-  long int seconds;
+  long_time_t seconds;
   long int ns;
 } relative_time;
 
@@ -219,30 +218,30 @@ digits_to_date_time (parser_control *pc, textint text_int)
   else
     {
       if (4 < text_int.digits)
-       {
-         pc->dates_seen++;
-         pc->day = text_int.value % 100;
-         pc->month = (text_int.value / 100) % 100;
-         pc->year.value = text_int.value / 10000;
-         pc->year.digits = text_int.digits - 4;
-       }
+        {
+          pc->dates_seen++;
+          pc->day = text_int.value % 100;
+          pc->month = (text_int.value / 100) % 100;
+          pc->year.value = text_int.value / 10000;
+          pc->year.digits = text_int.digits - 4;
+        }
       else
-       {
-         pc->times_seen++;
-         if (text_int.digits <= 2)
-           {
-             pc->hour = text_int.value;
-             pc->minutes = 0;
-           }
-         else
-           {
-             pc->hour = text_int.value / 100;
-             pc->minutes = text_int.value % 100;
-           }
-         pc->seconds.tv_sec = 0;
-         pc->seconds.tv_nsec = 0;
-         pc->meridian = MER24;
-       }
+        {
+          pc->times_seen++;
+          if (text_int.digits <= 2)
+            {
+              pc->hour = text_int.value;
+              pc->minutes = 0;
+            }
+          else
+            {
+              pc->hour = text_int.value / 100;
+              pc->minutes = text_int.value % 100;
+            }
+          pc->seconds.tv_sec = 0;
+          pc->seconds.tv_nsec = 0;
+          pc->meridian = MER24;
+        }
     }
 }
 
@@ -263,7 +262,7 @@ apply_relative_time (parser_control *pc, relative_time rel, 
int factor)
 /* Set PC-> hour, minutes, seconds and nanoseconds members from arguments.  */
 static void
 set_hhmmss (parser_control *pc, long int hour, long int minutes,
-           time_t sec, long int nsec)
+            time_t sec, long int nsec)
 {
   pc->hour = hour;
   pc->minutes = minutes;
@@ -316,8 +315,8 @@ spec:
 timespec:
     '@' seconds
       {
-       pc->seconds = $2;
-       pc->timespec_seen = true;
+        pc->seconds = $2;
+        pc->timespec_seen = true;
       }
   ;
 
@@ -345,45 +344,45 @@ item:
 time:
     tUNUMBER tMERIDIAN
       {
-       set_hhmmss (pc, $1.value, 0, 0, 0);
-       pc->meridian = $2;
+        set_hhmmss (pc, $1.value, 0, 0, 0);
+        pc->meridian = $2;
       }
   | tUNUMBER ':' tUNUMBER o_merid
       {
-       set_hhmmss (pc, $1.value, $3.value, 0, 0);
-       pc->meridian = $4;
+        set_hhmmss (pc, $1.value, $3.value, 0, 0);
+        pc->meridian = $4;
       }
   | tUNUMBER ':' tUNUMBER tSNUMBER o_colon_minutes
       {
-       set_hhmmss (pc, $1.value, $3.value, 0, 0);
-       pc->meridian = MER24;
-       pc->zones_seen++;
-       pc->time_zone = time_zone_hhmm (pc, $4, $5);
+        set_hhmmss (pc, $1.value, $3.value, 0, 0);
+        pc->meridian = MER24;
+        pc->zones_seen++;
+        pc->time_zone = time_zone_hhmm (pc, $4, $5);
       }
   | tUNUMBER ':' tUNUMBER ':' unsigned_seconds o_merid
       {
-       set_hhmmss (pc, $1.value, $3.value, $5.tv_sec, $5.tv_nsec);
-       pc->meridian = $6;
+        set_hhmmss (pc, $1.value, $3.value, $5.tv_sec, $5.tv_nsec);
+        pc->meridian = $6;
       }
   | tUNUMBER ':' tUNUMBER ':' unsigned_seconds tSNUMBER o_colon_minutes
       {
-       set_hhmmss (pc, $1.value, $3.value, $5.tv_sec, $5.tv_nsec);
-       pc->meridian = MER24;
-       pc->zones_seen++;
-       pc->time_zone = time_zone_hhmm (pc, $6, $7);
+        set_hhmmss (pc, $1.value, $3.value, $5.tv_sec, $5.tv_nsec);
+        pc->meridian = MER24;
+        pc->zones_seen++;
+        pc->time_zone = time_zone_hhmm (pc, $6, $7);
       }
   ;
 
 local_zone:
     tLOCAL_ZONE
       {
-       pc->local_isdst = $1;
-       pc->dsts_seen += (0 < $1);
+        pc->local_isdst = $1;
+        pc->dsts_seen += (0 < $1);
       }
   | tLOCAL_ZONE tDST
       {
-       pc->local_isdst = 1;
-       pc->dsts_seen += (0 < $1) + 1;
+        pc->local_isdst = 1;
+        pc->dsts_seen += (0 < $1) + 1;
       }
   ;
 
@@ -392,7 +391,7 @@ zone:
       { pc->time_zone = $1; }
   | tZONE relunit_snumber
       { pc->time_zone = $1;
-       apply_relative_time (pc, $2, 1); }
+        apply_relative_time (pc, $2, 1); }
   | tZONE tSNUMBER o_colon_minutes
       { pc->time_zone = $1 + time_zone_hhmm (pc, $2, $3); }
   | tDAYZONE
@@ -404,96 +403,96 @@ zone:
 day:
     tDAY
       {
-       pc->day_ordinal = 0;
-       pc->day_number = $1;
+        pc->day_ordinal = 0;
+        pc->day_number = $1;
       }
   | tDAY ','
       {
-       pc->day_ordinal = 0;
-       pc->day_number = $1;
+        pc->day_ordinal = 0;
+        pc->day_number = $1;
       }
   | tORDINAL tDAY
       {
-       pc->day_ordinal = $1;
-       pc->day_number = $2;
+        pc->day_ordinal = $1;
+        pc->day_number = $2;
       }
   | tUNUMBER tDAY
       {
-       pc->day_ordinal = $1.value;
-       pc->day_number = $2;
+        pc->day_ordinal = $1.value;
+        pc->day_number = $2;
       }
   ;
 
 date:
     tUNUMBER '/' tUNUMBER
       {
-       pc->month = $1.value;
-       pc->day = $3.value;
+        pc->month = $1.value;
+        pc->day = $3.value;
       }
   | tUNUMBER '/' tUNUMBER '/' tUNUMBER
       {
-       /* Interpret as YYYY/MM/DD if the first value has 4 or more digits,
-          otherwise as MM/DD/YY.
-          The goal in recognizing YYYY/MM/DD is solely to support legacy
-          machine-generated dates like those in an RCS log listing.  If
-          you want portability, use the ISO 8601 format.  */
-       if (4 <= $1.digits)
-         {
-           pc->year = $1;
-           pc->month = $3.value;
-           pc->day = $5.value;
-         }
-       else
-         {
-           pc->month = $1.value;
-           pc->day = $3.value;
-           pc->year = $5;
-         }
+        /* Interpret as YYYY/MM/DD if the first value has 4 or more digits,
+           otherwise as MM/DD/YY.
+           The goal in recognizing YYYY/MM/DD is solely to support legacy
+           machine-generated dates like those in an RCS log listing.  If
+           you want portability, use the ISO 8601 format.  */
+        if (4 <= $1.digits)
+          {
+            pc->year = $1;
+            pc->month = $3.value;
+            pc->day = $5.value;
+          }
+        else
+          {
+            pc->month = $1.value;
+            pc->day = $3.value;
+            pc->year = $5;
+          }
       }
   | tUNUMBER tSNUMBER tSNUMBER
       {
-       /* ISO 8601 format.  YYYY-MM-DD.  */
-       pc->year = $1;
-       pc->month = -$2.value;
-       pc->day = -$3.value;
+        /* ISO 8601 format.  YYYY-MM-DD.  */
+        pc->year = $1;
+        pc->month = -$2.value;
+        pc->day = -$3.value;
       }
   | tUNUMBER tMONTH tSNUMBER
       {
-       /* e.g. 17-JUN-1992.  */
-       pc->day = $1.value;
-       pc->month = $2;
-       pc->year.value = -$3.value;
-       pc->year.digits = $3.digits;
+        /* e.g. 17-JUN-1992.  */
+        pc->day = $1.value;
+        pc->month = $2;
+        pc->year.value = -$3.value;
+        pc->year.digits = $3.digits;
       }
   | tMONTH tSNUMBER tSNUMBER
       {
-       /* e.g. JUN-17-1992.  */
-       pc->month = $1;
-       pc->day = -$2.value;
-       pc->year.value = -$3.value;
-       pc->year.digits = $3.digits;
+        /* e.g. JUN-17-1992.  */
+        pc->month = $1;
+        pc->day = -$2.value;
+        pc->year.value = -$3.value;
+        pc->year.digits = $3.digits;
       }
   | tMONTH tUNUMBER
       {
-       pc->month = $1;
-       pc->day = $2.value;
+        pc->month = $1;
+        pc->day = $2.value;
       }
   | tMONTH tUNUMBER ',' tUNUMBER
       {
-       pc->month = $1;
-       pc->day = $2.value;
-       pc->year = $4;
+        pc->month = $1;
+        pc->day = $2.value;
+        pc->year = $4;
       }
   | tUNUMBER tMONTH
       {
-       pc->day = $1.value;
-       pc->month = $2;
+        pc->day = $1.value;
+        pc->month = $2;
       }
   | tUNUMBER tMONTH tUNUMBER
       {
-       pc->day = $1.value;
-       pc->month = $2;
-       pc->year = $3;
+        pc->day = $1.value;
+        pc->month = $2;
+        pc->year = $3;
       }
   ;
 
@@ -592,10 +591,10 @@ number:
 hybrid:
     tUNUMBER relunit_snumber
       {
-       /* Hybrid all-digit and relative offset, so that we accept e.g.,
-          "YYYYMMDD +N days" as well as "YYYYMMDD N days".  */
-       digits_to_date_time (pc, $1);
-       apply_relative_time (pc, $2, 1);
+        /* Hybrid all-digit and relative offset, so that we accept e.g.,
+           "YYYYMMDD +N days" as well as "YYYYMMDD N days".  */
+        digits_to_date_time (pc, $1);
+        apply_relative_time (pc, $2, 1);
       }
   ;
 
@@ -631,71 +630,71 @@ static table const dst_table[] =
 
 static table const month_and_day_table[] =
 {
-  { "JANUARY", tMONTH,  1 },
-  { "FEBRUARY",        tMONTH,  2 },
-  { "MARCH",   tMONTH,  3 },
-  { "APRIL",   tMONTH,  4 },
-  { "MAY",     tMONTH,  5 },
-  { "JUNE",    tMONTH,  6 },
-  { "JULY",    tMONTH,  7 },
-  { "AUGUST",  tMONTH,  8 },
-  { "SEPTEMBER",tMONTH,         9 },
-  { "SEPT",    tMONTH,  9 },
-  { "OCTOBER", tMONTH, 10 },
-  { "NOVEMBER",        tMONTH, 11 },
-  { "DECEMBER",        tMONTH, 12 },
-  { "SUNDAY",  tDAY,    0 },
-  { "MONDAY",  tDAY,    1 },
-  { "TUESDAY", tDAY,    2 },
-  { "TUES",    tDAY,    2 },
-  { "WEDNESDAY",tDAY,   3 },
-  { "WEDNES",  tDAY,    3 },
-  { "THURSDAY",        tDAY,    4 },
-  { "THUR",    tDAY,    4 },
-  { "THURS",   tDAY,    4 },
-  { "FRIDAY",  tDAY,    5 },
-  { "SATURDAY",        tDAY,    6 },
+  { "JANUARY",  tMONTH,  1 },
+  { "FEBRUARY", tMONTH,  2 },
+  { "MARCH",    tMONTH,  3 },
+  { "APRIL",    tMONTH,  4 },
+  { "MAY",      tMONTH,  5 },
+  { "JUNE",     tMONTH,  6 },
+  { "JULY",     tMONTH,  7 },
+  { "AUGUST",   tMONTH,  8 },
+  { "SEPTEMBER",tMONTH,  9 },
+  { "SEPT",     tMONTH,  9 },
+  { "OCTOBER",  tMONTH, 10 },
+  { "NOVEMBER", tMONTH, 11 },
+  { "DECEMBER", tMONTH, 12 },
+  { "SUNDAY",   tDAY,    0 },
+  { "MONDAY",   tDAY,    1 },
+  { "TUESDAY",  tDAY,    2 },
+  { "TUES",     tDAY,    2 },
+  { "WEDNESDAY",tDAY,    3 },
+  { "WEDNES",   tDAY,    3 },
+  { "THURSDAY", tDAY,    4 },
+  { "THUR",     tDAY,    4 },
+  { "THURS",    tDAY,    4 },
+  { "FRIDAY",   tDAY,    5 },
+  { "SATURDAY", tDAY,    6 },
   { NULL, 0, 0 }
 };
 
 static table const time_units_table[] =
 {
-  { "YEAR",    tYEAR_UNIT,      1 },
-  { "MONTH",   tMONTH_UNIT,     1 },
-  { "FORTNIGHT",tDAY_UNIT,     14 },
-  { "WEEK",    tDAY_UNIT,       7 },
-  { "DAY",     tDAY_UNIT,       1 },
-  { "HOUR",    tHOUR_UNIT,      1 },
-  { "MINUTE",  tMINUTE_UNIT,    1 },
-  { "MIN",     tMINUTE_UNIT,    1 },
-  { "SECOND",  tSEC_UNIT,       1 },
-  { "SEC",     tSEC_UNIT,       1 },
+  { "YEAR",     tYEAR_UNIT,      1 },
+  { "MONTH",    tMONTH_UNIT,     1 },
+  { "FORTNIGHT",tDAY_UNIT,      14 },
+  { "WEEK",     tDAY_UNIT,       7 },
+  { "DAY",      tDAY_UNIT,       1 },
+  { "HOUR",     tHOUR_UNIT,      1 },
+  { "MINUTE",   tMINUTE_UNIT,    1 },
+  { "MIN",      tMINUTE_UNIT,    1 },
+  { "SECOND",   tSEC_UNIT,       1 },
+  { "SEC",      tSEC_UNIT,       1 },
   { NULL, 0, 0 }
 };
 
 /* Assorted relative-time words. */
 static table const relative_time_table[] =
 {
-  { "TOMORROW",        tDAY_SHIFT,      1 },
-  { "YESTERDAY",tDAY_SHIFT,    -1 },
-  { "TODAY",   tDAY_SHIFT,      0 },
-  { "NOW",     tDAY_SHIFT,      0 },
-  { "LAST",    tORDINAL,       -1 },
-  { "THIS",    tORDINAL,        0 },
-  { "NEXT",    tORDINAL,        1 },
-  { "FIRST",   tORDINAL,        1 },
-/*{ "SECOND",  tORDINAL,        2 }, */
-  { "THIRD",   tORDINAL,        3 },
-  { "FOURTH",  tORDINAL,        4 },
-  { "FIFTH",   tORDINAL,        5 },
-  { "SIXTH",   tORDINAL,        6 },
-  { "SEVENTH", tORDINAL,        7 },
-  { "EIGHTH",  tORDINAL,        8 },
-  { "NINTH",   tORDINAL,        9 },
-  { "TENTH",   tORDINAL,       10 },
-  { "ELEVENTH",        tORDINAL,       11 },
-  { "TWELFTH", tORDINAL,       12 },
-  { "AGO",     tAGO,            1 },
+  { "TOMORROW", tDAY_SHIFT,      1 },
+  { "YESTERDAY",tDAY_SHIFT,     -1 },
+  { "TODAY",    tDAY_SHIFT,      0 },
+  { "NOW",      tDAY_SHIFT,      0 },
+  { "LAST",     tORDINAL,       -1 },
+  { "THIS",     tORDINAL,        0 },
+  { "NEXT",     tORDINAL,        1 },
+  { "FIRST",    tORDINAL,        1 },
+/*{ "SECOND",   tORDINAL,        2 }, */
+  { "THIRD",    tORDINAL,        3 },
+  { "FOURTH",   tORDINAL,        4 },
+  { "FIFTH",    tORDINAL,        5 },
+  { "SIXTH",    tORDINAL,        6 },
+  { "SEVENTH",  tORDINAL,        7 },
+  { "EIGHTH",   tORDINAL,        8 },
+  { "NINTH",    tORDINAL,        9 },
+  { "TENTH",    tORDINAL,       10 },
+  { "ELEVENTH", tORDINAL,       11 },
+  { "TWELFTH",  tORDINAL,       12 },
+  { "AGO",      tAGO,            1 },
   { NULL, 0, 0 }
 };
 
@@ -704,9 +703,9 @@ static table const relative_time_table[] =
    stamps in London during summer.  */
 static table const universal_time_zone_table[] =
 {
-  { "GMT",     tZONE,     HOUR ( 0) }, /* Greenwich Mean */
-  { "UT",      tZONE,     HOUR ( 0) }, /* Universal (Coordinated) */
-  { "UTC",     tZONE,     HOUR ( 0) },
+  { "GMT",      tZONE,     HOUR ( 0) }, /* Greenwich Mean */
+  { "UT",       tZONE,     HOUR ( 0) }, /* Universal (Coordinated) */
+  { "UTC",      tZONE,     HOUR ( 0) },
   { NULL, 0, 0 }
 };
 
@@ -717,84 +716,84 @@ static table const universal_time_zone_table[] =
    abbreviations; use numeric abbreviations like `-0500' instead.  */
 static table const time_zone_table[] =
 {
-  { "WET",     tZONE,     HOUR ( 0) }, /* Western European */
-  { "WEST",    tDAYZONE,  HOUR ( 0) }, /* Western European Summer */
-  { "BST",     tDAYZONE,  HOUR ( 0) }, /* British Summer */
-  { "ART",     tZONE,    -HOUR ( 3) }, /* Argentina */
-  { "BRT",     tZONE,    -HOUR ( 3) }, /* Brazil */
-  { "BRST",    tDAYZONE, -HOUR ( 3) }, /* Brazil Summer */
-  { "NST",     tZONE,   -(HOUR ( 3) + 30) },   /* Newfoundland Standard */
-  { "NDT",     tDAYZONE,-(HOUR ( 3) + 30) },   /* Newfoundland Daylight */
-  { "AST",     tZONE,    -HOUR ( 4) }, /* Atlantic Standard */
-  { "ADT",     tDAYZONE, -HOUR ( 4) }, /* Atlantic Daylight */
-  { "CLT",     tZONE,    -HOUR ( 4) }, /* Chile */
-  { "CLST",    tDAYZONE, -HOUR ( 4) }, /* Chile Summer */
-  { "EST",     tZONE,    -HOUR ( 5) }, /* Eastern Standard */
-  { "EDT",     tDAYZONE, -HOUR ( 5) }, /* Eastern Daylight */
-  { "CST",     tZONE,    -HOUR ( 6) }, /* Central Standard */
-  { "CDT",     tDAYZONE, -HOUR ( 6) }, /* Central Daylight */
-  { "MST",     tZONE,    -HOUR ( 7) }, /* Mountain Standard */
-  { "MDT",     tDAYZONE, -HOUR ( 7) }, /* Mountain Daylight */
-  { "PST",     tZONE,    -HOUR ( 8) }, /* Pacific Standard */
-  { "PDT",     tDAYZONE, -HOUR ( 8) }, /* Pacific Daylight */
-  { "AKST",    tZONE,    -HOUR ( 9) }, /* Alaska Standard */
-  { "AKDT",    tDAYZONE, -HOUR ( 9) }, /* Alaska Daylight */
-  { "HST",     tZONE,    -HOUR (10) }, /* Hawaii Standard */
-  { "HAST",    tZONE,    -HOUR (10) }, /* Hawaii-Aleutian Standard */
-  { "HADT",    tDAYZONE, -HOUR (10) }, /* Hawaii-Aleutian Daylight */
-  { "SST",     tZONE,    -HOUR (12) }, /* Samoa Standard */
-  { "WAT",     tZONE,     HOUR ( 1) }, /* West Africa */
-  { "CET",     tZONE,     HOUR ( 1) }, /* Central European */
-  { "CEST",    tDAYZONE,  HOUR ( 1) }, /* Central European Summer */
-  { "MET",     tZONE,     HOUR ( 1) }, /* Middle European */
-  { "MEZ",     tZONE,     HOUR ( 1) }, /* Middle European */
-  { "MEST",    tDAYZONE,  HOUR ( 1) }, /* Middle European Summer */
-  { "MESZ",    tDAYZONE,  HOUR ( 1) }, /* Middle European Summer */
-  { "EET",     tZONE,     HOUR ( 2) }, /* Eastern European */
-  { "EEST",    tDAYZONE,  HOUR ( 2) }, /* Eastern European Summer */
-  { "CAT",     tZONE,     HOUR ( 2) }, /* Central Africa */
-  { "SAST",    tZONE,     HOUR ( 2) }, /* South Africa Standard */
-  { "EAT",     tZONE,     HOUR ( 3) }, /* East Africa */
-  { "MSK",     tZONE,     HOUR ( 3) }, /* Moscow */
-  { "MSD",     tDAYZONE,  HOUR ( 3) }, /* Moscow Daylight */
-  { "IST",     tZONE,    (HOUR ( 5) + 30) },   /* India Standard */
-  { "SGT",     tZONE,     HOUR ( 8) }, /* Singapore */
-  { "KST",     tZONE,     HOUR ( 9) }, /* Korea Standard */
-  { "JST",     tZONE,     HOUR ( 9) }, /* Japan Standard */
-  { "GST",     tZONE,     HOUR (10) }, /* Guam Standard */
-  { "NZST",    tZONE,     HOUR (12) }, /* New Zealand Standard */
-  { "NZDT",    tDAYZONE,  HOUR (12) }, /* New Zealand Daylight */
+  { "WET",      tZONE,     HOUR ( 0) }, /* Western European */
+  { "WEST",     tDAYZONE,  HOUR ( 0) }, /* Western European Summer */
+  { "BST",      tDAYZONE,  HOUR ( 0) }, /* British Summer */
+  { "ART",      tZONE,    -HOUR ( 3) }, /* Argentina */
+  { "BRT",      tZONE,    -HOUR ( 3) }, /* Brazil */
+  { "BRST",     tDAYZONE, -HOUR ( 3) }, /* Brazil Summer */
+  { "NST",      tZONE,   -(HOUR ( 3) + 30) },   /* Newfoundland Standard */
+  { "NDT",      tDAYZONE,-(HOUR ( 3) + 30) },   /* Newfoundland Daylight */
+  { "AST",      tZONE,    -HOUR ( 4) }, /* Atlantic Standard */
+  { "ADT",      tDAYZONE, -HOUR ( 4) }, /* Atlantic Daylight */
+  { "CLT",      tZONE,    -HOUR ( 4) }, /* Chile */
+  { "CLST",     tDAYZONE, -HOUR ( 4) }, /* Chile Summer */
+  { "EST",      tZONE,    -HOUR ( 5) }, /* Eastern Standard */
+  { "EDT",      tDAYZONE, -HOUR ( 5) }, /* Eastern Daylight */
+  { "CST",      tZONE,    -HOUR ( 6) }, /* Central Standard */
+  { "CDT",      tDAYZONE, -HOUR ( 6) }, /* Central Daylight */
+  { "MST",      tZONE,    -HOUR ( 7) }, /* Mountain Standard */
+  { "MDT",      tDAYZONE, -HOUR ( 7) }, /* Mountain Daylight */
+  { "PST",      tZONE,    -HOUR ( 8) }, /* Pacific Standard */
+  { "PDT",      tDAYZONE, -HOUR ( 8) }, /* Pacific Daylight */
+  { "AKST",     tZONE,    -HOUR ( 9) }, /* Alaska Standard */
+  { "AKDT",     tDAYZONE, -HOUR ( 9) }, /* Alaska Daylight */
+  { "HST",      tZONE,    -HOUR (10) }, /* Hawaii Standard */
+  { "HAST",     tZONE,    -HOUR (10) }, /* Hawaii-Aleutian Standard */
+  { "HADT",     tDAYZONE, -HOUR (10) }, /* Hawaii-Aleutian Daylight */
+  { "SST",      tZONE,    -HOUR (12) }, /* Samoa Standard */
+  { "WAT",      tZONE,     HOUR ( 1) }, /* West Africa */
+  { "CET",      tZONE,     HOUR ( 1) }, /* Central European */
+  { "CEST",     tDAYZONE,  HOUR ( 1) }, /* Central European Summer */
+  { "MET",      tZONE,     HOUR ( 1) }, /* Middle European */
+  { "MEZ",      tZONE,     HOUR ( 1) }, /* Middle European */
+  { "MEST",     tDAYZONE,  HOUR ( 1) }, /* Middle European Summer */
+  { "MESZ",     tDAYZONE,  HOUR ( 1) }, /* Middle European Summer */
+  { "EET",      tZONE,     HOUR ( 2) }, /* Eastern European */
+  { "EEST",     tDAYZONE,  HOUR ( 2) }, /* Eastern European Summer */
+  { "CAT",      tZONE,     HOUR ( 2) }, /* Central Africa */
+  { "SAST",     tZONE,     HOUR ( 2) }, /* South Africa Standard */
+  { "EAT",      tZONE,     HOUR ( 3) }, /* East Africa */
+  { "MSK",      tZONE,     HOUR ( 3) }, /* Moscow */
+  { "MSD",      tDAYZONE,  HOUR ( 3) }, /* Moscow Daylight */
+  { "IST",      tZONE,    (HOUR ( 5) + 30) },   /* India Standard */
+  { "SGT",      tZONE,     HOUR ( 8) }, /* Singapore */
+  { "KST",      tZONE,     HOUR ( 9) }, /* Korea Standard */
+  { "JST",      tZONE,     HOUR ( 9) }, /* Japan Standard */
+  { "GST",      tZONE,     HOUR (10) }, /* Guam Standard */
+  { "NZST",     tZONE,     HOUR (12) }, /* New Zealand Standard */
+  { "NZDT",     tDAYZONE,  HOUR (12) }, /* New Zealand Daylight */
   { NULL, 0, 0 }
 };
 
 /* Military time zone table. */
 static table const military_table[] =
 {
-  { "A", tZONE,        -HOUR ( 1) },
-  { "B", tZONE,        -HOUR ( 2) },
-  { "C", tZONE,        -HOUR ( 3) },
-  { "D", tZONE,        -HOUR ( 4) },
-  { "E", tZONE,        -HOUR ( 5) },
-  { "F", tZONE,        -HOUR ( 6) },
-  { "G", tZONE,        -HOUR ( 7) },
-  { "H", tZONE,        -HOUR ( 8) },
-  { "I", tZONE,        -HOUR ( 9) },
-  { "K", tZONE,        -HOUR (10) },
-  { "L", tZONE,        -HOUR (11) },
-  { "M", tZONE,        -HOUR (12) },
-  { "N", tZONE,         HOUR ( 1) },
-  { "O", tZONE,         HOUR ( 2) },
-  { "P", tZONE,         HOUR ( 3) },
-  { "Q", tZONE,         HOUR ( 4) },
-  { "R", tZONE,         HOUR ( 5) },
-  { "S", tZONE,         HOUR ( 6) },
-  { "T", tZONE,         HOUR ( 7) },
-  { "U", tZONE,         HOUR ( 8) },
-  { "V", tZONE,         HOUR ( 9) },
-  { "W", tZONE,         HOUR (10) },
-  { "X", tZONE,         HOUR (11) },
-  { "Y", tZONE,         HOUR (12) },
-  { "Z", tZONE,         HOUR ( 0) },
+  { "A", tZONE, -HOUR ( 1) },
+  { "B", tZONE, -HOUR ( 2) },
+  { "C", tZONE, -HOUR ( 3) },
+  { "D", tZONE, -HOUR ( 4) },
+  { "E", tZONE, -HOUR ( 5) },
+  { "F", tZONE, -HOUR ( 6) },
+  { "G", tZONE, -HOUR ( 7) },
+  { "H", tZONE, -HOUR ( 8) },
+  { "I", tZONE, -HOUR ( 9) },
+  { "K", tZONE, -HOUR (10) },
+  { "L", tZONE, -HOUR (11) },
+  { "M", tZONE, -HOUR (12) },
+  { "N", tZONE,  HOUR ( 1) },
+  { "O", tZONE,  HOUR ( 2) },
+  { "P", tZONE,  HOUR ( 3) },
+  { "Q", tZONE,  HOUR ( 4) },
+  { "R", tZONE,  HOUR ( 5) },
+  { "S", tZONE,  HOUR ( 6) },
+  { "T", tZONE,  HOUR ( 7) },
+  { "U", tZONE,  HOUR ( 8) },
+  { "V", tZONE,  HOUR ( 9) },
+  { "W", tZONE,  HOUR (10) },
+  { "X", tZONE,  HOUR (11) },
+  { "Y", tZONE,  HOUR (12) },
+  { "Z", tZONE,  HOUR ( 0) },
   { NULL, 0, 0 }
 };
 
@@ -904,10 +903,10 @@ tm_diff (struct tm const *a, struct tm const *b)
   long int ayear = a->tm_year;
   long int years = ayear - b->tm_year;
   long int days = (365 * years + intervening_leap_days
-                  + (a->tm_yday - b->tm_yday));
+                   + (a->tm_yday - b->tm_yday));
   return (60 * (60 * (24 * days + (a->tm_hour - b->tm_hour))
-               + (a->tm_min - b->tm_min))
-         + (a->tm_sec - b->tm_sec));
+                + (a->tm_min - b->tm_min))
+          + (a->tm_sec - b->tm_sec));
 }
 #endif /* ! HAVE_TM_GMTOFF */
 
@@ -955,9 +954,9 @@ lookup_word (parser_control const *pc, char *word)
     {
       word[wordlen - 1] = '\0';
       for (tp = time_units_table; tp->name; tp++)
-       if (strcmp (word, tp->name) == 0)
-         return tp;
-      word[wordlen - 1] = 'S'; /* For "this" in relative_time_table.  */
+        if (strcmp (word, tp->name) == 0)
+          return tp;
+      word[wordlen - 1] = 'S';  /* For "this" in relative_time_table.  */
     }
 
   for (tp = relative_time_table; tp->name; tp++)
@@ -968,7 +967,7 @@ lookup_word (parser_control const *pc, char *word)
   if (wordlen == 1)
     for (tp = military_table; tp->name; tp++)
       if (word[0] == tp->name[0])
-       return tp;
+        return tp;
 
   /* Drop out any periods and try the time zone table again. */
   for (period_found = false, p = q = word; (*p = *q); q++)
@@ -991,163 +990,163 @@ yylex (YYSTYPE *lvalp, parser_control *pc)
   for (;;)
     {
       while (c = *pc->input, c_isspace (c))
-       pc->input++;
+        pc->input++;
 
       if (ISDIGIT (c) || c == '-' || c == '+')
-       {
-         char const *p;
-         int sign;
-         unsigned long int value;
-         if (c == '-' || c == '+')
-           {
-             sign = c == '-' ? -1 : 1;
-             while (c = *++pc->input, c_isspace (c))
-               continue;
-             if (! ISDIGIT (c))
-               /* skip the '-' sign */
-               continue;
-           }
-         else
-           sign = 0;
-         p = pc->input;
-         for (value = 0; ; value *= 10)
-           {
-             unsigned long int value1 = value + (c - '0');
-             if (value1 < value)
-               return '?';
-             value = value1;
-             c = *++p;
-             if (! ISDIGIT (c))
-               break;
-             if (ULONG_MAX / 10 < value)
-               return '?';
-           }
-         if ((c == '.' || c == ',') && ISDIGIT (p[1]))
-           {
-             time_t s;
-             int ns;
-             int digits;
-             unsigned long int value1;
-
-             /* Check for overflow when converting value to time_t.  */
-             if (sign < 0)
-               {
-                 s = - value;
-                 if (0 < s)
-                   return '?';
-                 value1 = -s;
-               }
-             else
-               {
-                 s = value;
-                 if (s < 0)
-                   return '?';
-                 value1 = s;
-               }
-             if (value != value1)
-               return '?';
-
-             /* Accumulate fraction, to ns precision.  */
-             p++;
-             ns = *p++ - '0';
-             for (digits = 2; digits <= LOG10_BILLION; digits++)
-               {
-                 ns *= 10;
-                 if (ISDIGIT (*p))
-                   ns += *p++ - '0';
-               }
-
-             /* Skip excess digits, truncating toward -Infinity.  */
-             if (sign < 0)
-               for (; ISDIGIT (*p); p++)
-                 if (*p != '0')
-                   {
-                     ns++;
-                     break;
-                   }
-             while (ISDIGIT (*p))
-               p++;
-
-             /* Adjust to the timespec convention, which is that
-                tv_nsec is always a positive offset even if tv_sec is
-                negative.  */
-             if (sign < 0 && ns)
-               {
-                 s--;
-                 if (! (s < 0))
-                   return '?';
-                 ns = BILLION - ns;
-               }
-
-             lvalp->timespec.tv_sec = s;
-             lvalp->timespec.tv_nsec = ns;
-             pc->input = p;
-             return sign ? tSDECIMAL_NUMBER : tUDECIMAL_NUMBER;
-           }
-         else
-           {
-             lvalp->textintval.negative = sign < 0;
-             if (sign < 0)
-               {
-                 lvalp->textintval.value = - value;
-                 if (0 < lvalp->textintval.value)
-                   return '?';
-               }
-             else
-               {
-                 lvalp->textintval.value = value;
-                 if (lvalp->textintval.value < 0)
-                   return '?';
-               }
-             lvalp->textintval.digits = p - pc->input;
-             pc->input = p;
-             return sign ? tSNUMBER : tUNUMBER;
-           }
-       }
+        {
+          char const *p;
+          int sign;
+          unsigned long int value;
+          if (c == '-' || c == '+')
+            {
+              sign = c == '-' ? -1 : 1;
+              while (c = *++pc->input, c_isspace (c))
+                continue;
+              if (! ISDIGIT (c))
+                /* skip the '-' sign */
+                continue;
+            }
+          else
+            sign = 0;
+          p = pc->input;
+          for (value = 0; ; value *= 10)
+            {
+              unsigned long int value1 = value + (c - '0');
+              if (value1 < value)
+                return '?';
+              value = value1;
+              c = *++p;
+              if (! ISDIGIT (c))
+                break;
+              if (ULONG_MAX / 10 < value)
+                return '?';
+            }
+          if ((c == '.' || c == ',') && ISDIGIT (p[1]))
+            {
+              time_t s;
+              int ns;
+              int digits;
+              unsigned long int value1;
+
+              /* Check for overflow when converting value to time_t.  */
+              if (sign < 0)
+                {
+                  s = - value;
+                  if (0 < s)
+                    return '?';
+                  value1 = -s;
+                }
+              else
+                {
+                  s = value;
+                  if (s < 0)
+                    return '?';
+                  value1 = s;
+                }
+              if (value != value1)
+                return '?';
+
+              /* Accumulate fraction, to ns precision.  */
+              p++;
+              ns = *p++ - '0';
+              for (digits = 2; digits <= LOG10_BILLION; digits++)
+                {
+                  ns *= 10;
+                  if (ISDIGIT (*p))
+                    ns += *p++ - '0';
+                }
+
+              /* Skip excess digits, truncating toward -Infinity.  */
+              if (sign < 0)
+                for (; ISDIGIT (*p); p++)
+                  if (*p != '0')
+                    {
+                      ns++;
+                      break;
+                    }
+              while (ISDIGIT (*p))
+                p++;
+
+              /* Adjust to the timespec convention, which is that
+                 tv_nsec is always a positive offset even if tv_sec is
+                 negative.  */
+              if (sign < 0 && ns)
+                {
+                  s--;
+                  if (! (s < 0))
+                    return '?';
+                  ns = BILLION - ns;
+                }
+
+              lvalp->timespec.tv_sec = s;
+              lvalp->timespec.tv_nsec = ns;
+              pc->input = p;
+              return sign ? tSDECIMAL_NUMBER : tUDECIMAL_NUMBER;
+            }
+          else
+            {
+              lvalp->textintval.negative = sign < 0;
+              if (sign < 0)
+                {
+                  lvalp->textintval.value = - value;
+                  if (0 < lvalp->textintval.value)
+                    return '?';
+                }
+              else
+                {
+                  lvalp->textintval.value = value;
+                  if (lvalp->textintval.value < 0)
+                    return '?';
+                }
+              lvalp->textintval.digits = p - pc->input;
+              pc->input = p;
+              return sign ? tSNUMBER : tUNUMBER;
+            }
+        }
 
       if (c_isalpha (c))
-       {
-         char buff[20];
-         char *p = buff;
-         table const *tp;
-
-         do
-           {
-             if (p < buff + sizeof buff - 1)
-               *p++ = c;
-             c = *++pc->input;
-           }
-         while (c_isalpha (c) || c == '.');
-
-         *p = '\0';
-         tp = lookup_word (pc, buff);
-         if (! tp)
-           return '?';
-         lvalp->intval = tp->value;
-         return tp->type;
-       }
+        {
+          char buff[20];
+          char *p = buff;
+          table const *tp;
+
+          do
+            {
+              if (p < buff + sizeof buff - 1)
+                *p++ = c;
+              c = *++pc->input;
+            }
+          while (c_isalpha (c) || c == '.');
+
+          *p = '\0';
+          tp = lookup_word (pc, buff);
+          if (! tp)
+            return '?';
+          lvalp->intval = tp->value;
+          return tp->type;
+        }
 
       if (c != '(')
-       return *pc->input++;
+        return *pc->input++;
       count = 0;
       do
-       {
-         c = *pc->input++;
-         if (c == '\0')
-           return c;
-         if (c == '(')
-           count++;
-         else if (c == ')')
-           count--;
-       }
+        {
+          c = *pc->input++;
+          if (c == '\0')
+            return c;
+          if (c == '(')
+            count++;
+          else if (c == ')')
+            count--;
+        }
       while (count != 0);
     }
 }
 
 /* Do nothing if the parser reports an error.  */
 static int
-yyerror (parser_control const *pc ATTRIBUTE_UNUSED,
-        char const *s ATTRIBUTE_UNUSED)
+yyerror (parser_control const *pc _GL_UNUSED,
+         char const *s _GL_UNUSED)
 {
   return 0;
 }
@@ -1162,19 +1161,19 @@ mktime_ok (struct tm const *tm0, struct tm const *tm1, 
time_t t)
   if (t == (time_t) -1)
     {
       /* Guard against falsely reporting an error when parsing a time
-        stamp that happens to equal (time_t) -1, on a host that
-        supports such a time stamp.  */
+         stamp that happens to equal (time_t) -1, on a host that
+         supports such a time stamp.  */
       tm1 = localtime (&t);
       if (!tm1)
-       return false;
+        return false;
     }
 
   return ! ((tm0->tm_sec ^ tm1->tm_sec)
-           | (tm0->tm_min ^ tm1->tm_min)
-           | (tm0->tm_hour ^ tm1->tm_hour)
-           | (tm0->tm_mday ^ tm1->tm_mday)
-           | (tm0->tm_mon ^ tm1->tm_mon)
-           | (tm0->tm_year ^ tm1->tm_year));
+            | (tm0->tm_min ^ tm1->tm_min)
+            | (tm0->tm_hour ^ tm1->tm_hour)
+            | (tm0->tm_mday ^ tm1->tm_mday)
+            | (tm0->tm_mon ^ tm1->tm_mon)
+            | (tm0->tm_year ^ tm1->tm_year));
 }
 
 /* A reasonable upper bound for the size of ordinary TZ strings.
@@ -1191,8 +1190,8 @@ get_tz (char tzbuf[TZBUFSIZE])
     {
       size_t tzsize = strlen (tz) + 1;
       tz = (tzsize <= TZBUFSIZE
-           ? memcpy (tzbuf, tz, tzsize)
-           : xmemdup (tz, tzsize));
+            ? memcpy (tzbuf, tz, tzsize)
+            : xmemdup (tz, tzsize));
     }
   return tz;
 }
@@ -1240,32 +1239,32 @@ get_date (struct timespec *result, char const *p, 
struct timespec const *now)
       char const *s;
 
       for (s = tzbase; *s; s++, tzsize++)
-       if (*s == '\\')
-         {
-           s++;
-           if (! (*s == '\\' || *s == '"'))
-             break;
-         }
-       else if (*s == '"')
-         {
-           char *z;
-           char *tz1;
-           char tz1buf[TZBUFSIZE];
-           bool large_tz = TZBUFSIZE < tzsize;
-           bool setenv_ok;
-           tz0 = get_tz (tz0buf);
-           z = tz1 = large_tz ? xmalloc (tzsize) : tz1buf;
-           for (s = tzbase; *s != '"'; s++)
-             *z++ = *(s += *s == '\\');
-           *z = '\0';
-           setenv_ok = setenv ("TZ", tz1, 1) == 0;
-           if (large_tz)
-             free (tz1);
-           if (!setenv_ok)
-             goto fail;
-           tz_was_altered = true;
-           p = s + 1;
-         }
+        if (*s == '\\')
+          {
+            s++;
+            if (! (*s == '\\' || *s == '"'))
+              break;
+          }
+        else if (*s == '"')
+          {
+            char *z;
+            char *tz1;
+            char tz1buf[TZBUFSIZE];
+            bool large_tz = TZBUFSIZE < tzsize;
+            bool setenv_ok;
+            tz0 = get_tz (tz0buf);
+            z = tz1 = large_tz ? xmalloc (tzsize) : tz1buf;
+            for (s = tzbase; *s != '"'; s++)
+              *z++ = *(s += *s == '\\');
+            *z = '\0';
+            setenv_ok = setenv ("TZ", tz1, 1) == 0;
+            if (large_tz)
+              free (tz1);
+            if (!setenv_ok)
+              goto fail;
+            tz_was_altered = true;
+            p = s + 1;
+          }
     }
 
   /* As documented, be careful to treat the empty string just like
@@ -1309,19 +1308,19 @@ get_date (struct timespec *result, char const *p, 
struct timespec const *now)
     int quarter;
     for (quarter = 1; quarter <= 3; quarter++)
       {
-       time_t probe = Start + quarter * (90 * 24 * 60 * 60);
-       struct tm const *probe_tm = localtime (&probe);
-       if (probe_tm && probe_tm->tm_zone
-           && probe_tm->tm_isdst != pc.local_time_zone_table[0].value)
-         {
-             {
-               pc.local_time_zone_table[1].name = probe_tm->tm_zone;
-               pc.local_time_zone_table[1].type = tLOCAL_ZONE;
-               pc.local_time_zone_table[1].value = probe_tm->tm_isdst;
-               pc.local_time_zone_table[2].name = NULL;
-             }
-           break;
-         }
+        time_t probe = Start + quarter * (90 * 24 * 60 * 60);
+        struct tm const *probe_tm = localtime (&probe);
+        if (probe_tm && probe_tm->tm_zone
+            && probe_tm->tm_isdst != pc.local_time_zone_table[0].value)
+          {
+              {
+                pc.local_time_zone_table[1].name = probe_tm->tm_zone;
+                pc.local_time_zone_table[1].type = tLOCAL_ZONE;
+                pc.local_time_zone_table[1].value = probe_tm->tm_isdst;
+                pc.local_time_zone_table[2].name = NULL;
+              }
+            break;
+          }
       }
   }
 #else
@@ -1333,9 +1332,9 @@ get_date (struct timespec *result, char const *p, struct 
timespec const *now)
     int i;
     for (i = 0; i < 2; i++)
       {
-       pc.local_time_zone_table[i].name = tzname[i];
-       pc.local_time_zone_table[i].type = tLOCAL_ZONE;
-       pc.local_time_zone_table[i].value = i;
+        pc.local_time_zone_table[i].name = tzname[i];
+        pc.local_time_zone_table[i].type = tLOCAL_ZONE;
+        pc.local_time_zone_table[i].value = i;
       }
     pc.local_time_zone_table[i].name = NULL;
   }
@@ -1346,11 +1345,11 @@ get_date (struct timespec *result, char const *p, 
struct timespec const *now)
 
   if (pc.local_time_zone_table[0].name && pc.local_time_zone_table[1].name
       && ! strcmp (pc.local_time_zone_table[0].name,
-                  pc.local_time_zone_table[1].name))
+                   pc.local_time_zone_table[1].name))
     {
       /* This locale uses the same abbrevation for standard and
-        daylight times.  So if we see that abbreviation, we don't
-        know whether it's daylight time.  */
+         daylight times.  So if we see that abbreviation, we don't
+         know whether it's daylight time.  */
       pc.local_time_zone_table[0].value = -1;
       pc.local_time_zone_table[1].name = NULL;
     }
@@ -1363,160 +1362,162 @@ get_date (struct timespec *result, char const *p, 
struct timespec const *now)
   else
     {
       if (1 < (pc.times_seen | pc.dates_seen | pc.days_seen | pc.dsts_seen
-              | (pc.local_zones_seen + pc.zones_seen)))
-       goto fail;
+               | (pc.local_zones_seen + pc.zones_seen)))
+        goto fail;
 
       tm.tm_year = to_year (pc.year) - TM_YEAR_BASE;
       tm.tm_mon = pc.month - 1;
       tm.tm_mday = pc.day;
       if (pc.times_seen || (pc.rels_seen && ! pc.dates_seen && ! pc.days_seen))
-       {
-         tm.tm_hour = to_hour (pc.hour, pc.meridian);
-         if (tm.tm_hour < 0)
-           goto fail;
-         tm.tm_min = pc.minutes;
-         tm.tm_sec = pc.seconds.tv_sec;
-       }
+        {
+          tm.tm_hour = to_hour (pc.hour, pc.meridian);
+          if (tm.tm_hour < 0)
+            goto fail;
+          tm.tm_min = pc.minutes;
+          tm.tm_sec = pc.seconds.tv_sec;
+        }
       else
-       {
-         tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
-         pc.seconds.tv_nsec = 0;
-       }
+        {
+          tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
+          pc.seconds.tv_nsec = 0;
+        }
 
       /* Let mktime deduce tm_isdst if we have an absolute time stamp.  */
       if (pc.dates_seen | pc.days_seen | pc.times_seen)
-       tm.tm_isdst = -1;
+        tm.tm_isdst = -1;
 
       /* But if the input explicitly specifies local time with or without
-        DST, give mktime that information.  */
+         DST, give mktime that information.  */
       if (pc.local_zones_seen)
-       tm.tm_isdst = pc.local_isdst;
+        tm.tm_isdst = pc.local_isdst;
 
       tm0 = tm;
 
       Start = mktime (&tm);
 
       if (! mktime_ok (&tm0, &tm, Start))
-       {
-         if (! pc.zones_seen)
-           goto fail;
-         else
-           {
-             /* Guard against falsely reporting errors near the time_t
-                boundaries when parsing times in other time zones.  For
-                example, suppose the input string "1969-12-31 23:00:00 -0100",
-                the current time zone is 8 hours ahead of UTC, and the min
-                time_t value is 1970-01-01 00:00:00 UTC.  Then the min
-                localtime value is 1970-01-01 08:00:00, and mktime will
-                therefore fail on 1969-12-31 23:00:00.  To work around the
-                problem, set the time zone to 1 hour behind UTC temporarily
-                by setting TZ="XXX1:00" and try mktime again.  */
-
-             long int time_zone = pc.time_zone;
-             long int abs_time_zone = time_zone < 0 ? - time_zone : time_zone;
-             long int abs_time_zone_hour = abs_time_zone / 60;
-             int abs_time_zone_min = abs_time_zone % 60;
-             char tz1buf[sizeof "XXX+0:00"
-                         + sizeof pc.time_zone * CHAR_BIT / 3];
-             if (!tz_was_altered)
-               tz0 = get_tz (tz0buf);
-             sprintf (tz1buf, "XXX%s%ld:%02d", "-" + (time_zone < 0),
-                      abs_time_zone_hour, abs_time_zone_min);
-             if (setenv ("TZ", tz1buf, 1) != 0)
-               goto fail;
-             tz_was_altered = true;
-             tm = tm0;
-             Start = mktime (&tm);
-             if (! mktime_ok (&tm0, &tm, Start))
-               goto fail;
-           }
-       }
+        {
+          if (! pc.zones_seen)
+            goto fail;
+          else
+            {
+              /* Guard against falsely reporting errors near the time_t
+                 boundaries when parsing times in other time zones.  For
+                 example, suppose the input string "1969-12-31 23:00:00 -0100",
+                 the current time zone is 8 hours ahead of UTC, and the min
+                 time_t value is 1970-01-01 00:00:00 UTC.  Then the min
+                 localtime value is 1970-01-01 08:00:00, and mktime will
+                 therefore fail on 1969-12-31 23:00:00.  To work around the
+                 problem, set the time zone to 1 hour behind UTC temporarily
+                 by setting TZ="XXX1:00" and try mktime again.  */
+
+              long int time_zone = pc.time_zone;
+              long int abs_time_zone = time_zone < 0 ? - time_zone : time_zone;
+              long int abs_time_zone_hour = abs_time_zone / 60;
+              int abs_time_zone_min = abs_time_zone % 60;
+              char tz1buf[sizeof "XXX+0:00"
+                          + sizeof pc.time_zone * CHAR_BIT / 3];
+              if (!tz_was_altered)
+                tz0 = get_tz (tz0buf);
+              sprintf (tz1buf, "XXX%s%ld:%02d", "-" + (time_zone < 0),
+                       abs_time_zone_hour, abs_time_zone_min);
+              if (setenv ("TZ", tz1buf, 1) != 0)
+                goto fail;
+              tz_was_altered = true;
+              tm = tm0;
+              Start = mktime (&tm);
+              if (! mktime_ok (&tm0, &tm, Start))
+                goto fail;
+            }
+        }
 
       if (pc.days_seen && ! pc.dates_seen)
-       {
-         tm.tm_mday += ((pc.day_number - tm.tm_wday + 7) % 7
-                        + 7 * (pc.day_ordinal
-                               - (0 < pc.day_ordinal
-                                  && tm.tm_wday != pc.day_number)));
-         tm.tm_isdst = -1;
-         Start = mktime (&tm);
-         if (Start == (time_t) -1)
-           goto fail;
-       }
+        {
+          tm.tm_mday += ((pc.day_number - tm.tm_wday + 7) % 7
+                         + 7 * (pc.day_ordinal
+                                - (0 < pc.day_ordinal
+                                   && tm.tm_wday != pc.day_number)));
+          tm.tm_isdst = -1;
+          Start = mktime (&tm);
+          if (Start == (time_t) -1)
+            goto fail;
+        }
 
       /* Add relative date.  */
       if (pc.rel.year | pc.rel.month | pc.rel.day)
-       {
-         int year = tm.tm_year + pc.rel.year;
-         int month = tm.tm_mon + pc.rel.month;
-         int day = tm.tm_mday + pc.rel.day;
-         if (((year < tm.tm_year) ^ (pc.rel.year < 0))
-             | ((month < tm.tm_mon) ^ (pc.rel.month < 0))
-             | ((day < tm.tm_mday) ^ (pc.rel.day < 0)))
-           goto fail;
-         tm.tm_year = year;
-         tm.tm_mon = month;
-         tm.tm_mday = day;
-         tm.tm_hour = tm0.tm_hour;
-         tm.tm_min = tm0.tm_min;
-         tm.tm_sec = tm0.tm_sec;
-         tm.tm_isdst = tm0.tm_isdst;
-         Start = mktime (&tm);
-         if (Start == (time_t) -1)
-           goto fail;
-       }
+        {
+          int year = tm.tm_year + pc.rel.year;
+          int month = tm.tm_mon + pc.rel.month;
+          int day = tm.tm_mday + pc.rel.day;
+          if (((year < tm.tm_year) ^ (pc.rel.year < 0))
+              | ((month < tm.tm_mon) ^ (pc.rel.month < 0))
+              | ((day < tm.tm_mday) ^ (pc.rel.day < 0)))
+            goto fail;
+          tm.tm_year = year;
+          tm.tm_mon = month;
+          tm.tm_mday = day;
+          tm.tm_hour = tm0.tm_hour;
+          tm.tm_min = tm0.tm_min;
+          tm.tm_sec = tm0.tm_sec;
+          tm.tm_isdst = tm0.tm_isdst;
+          Start = mktime (&tm);
+          if (Start == (time_t) -1)
+            goto fail;
+        }
 
       /* The only "output" of this if-block is an updated Start value,
-        so this block must follow others that clobber Start.  */
+         so this block must follow others that clobber Start.  */
       if (pc.zones_seen)
-       {
-         long int delta = pc.time_zone * 60;
-         time_t t1;
+        {
+          long int delta = pc.time_zone * 60;
+          time_t t1;
 #ifdef HAVE_TM_GMTOFF
-         delta -= tm.tm_gmtoff;
+          delta -= tm.tm_gmtoff;
 #else
-         time_t t = Start;
-         struct tm const *gmt = gmtime (&t);
-         if (! gmt)
-           goto fail;
-         delta -= tm_diff (&tm, gmt);
+          time_t t = Start;
+          struct tm const *gmt = gmtime (&t);
+          if (! gmt)
+            goto fail;
+          delta -= tm_diff (&tm, gmt);
 #endif
-         t1 = Start - delta;
-         if ((Start < t1) != (delta < 0))
-           goto fail;  /* time_t overflow */
-         Start = t1;
-       }
+          t1 = Start - delta;
+          if ((Start < t1) != (delta < 0))
+            goto fail;  /* time_t overflow */
+          Start = t1;
+        }
 
       /* Add relative hours, minutes, and seconds.  On hosts that support
-        leap seconds, ignore the possibility of leap seconds; e.g.,
-        "+ 10 minutes" adds 600 seconds, even if one of them is a
-        leap second.  Typically this is not what the user wants, but it's
-        too hard to do it the other way, because the time zone indicator
-        must be applied before relative times, and if mktime is applied
-        again the time zone will be lost.  */
+         leap seconds, ignore the possibility of leap seconds; e.g.,
+         "+ 10 minutes" adds 600 seconds, even if one of them is a
+         leap second.  Typically this is not what the user wants, but it's
+         too hard to do it the other way, because the time zone indicator
+         must be applied before relative times, and if mktime is applied
+         again the time zone will be lost.  */
       {
-       long int sum_ns = pc.seconds.tv_nsec + pc.rel.ns;
-       long int normalized_ns = (sum_ns % BILLION + BILLION) % BILLION;
-       time_t t0 = Start;
-       long int d1 = 60 * 60 * pc.rel.hour;
-       time_t t1 = t0 + d1;
-       long int d2 = 60 * pc.rel.minutes;
-       time_t t2 = t1 + d2;
-       long int d3 = pc.rel.seconds;
-       time_t t3 = t2 + d3;
-       long int d4 = (sum_ns - normalized_ns) / BILLION;
-       time_t t4 = t3 + d4;
-
-       if ((d1 / (60 * 60) ^ pc.rel.hour)
-           | (d2 / 60 ^ pc.rel.minutes)
-           | ((t1 < t0) ^ (d1 < 0))
-           | ((t2 < t1) ^ (d2 < 0))
-           | ((t3 < t2) ^ (d3 < 0))
-           | ((t4 < t3) ^ (d4 < 0)))
-         goto fail;
-
-       result->tv_sec = t4;
-       result->tv_nsec = normalized_ns;
+        long int sum_ns = pc.seconds.tv_nsec + pc.rel.ns;
+        long int normalized_ns = (sum_ns % BILLION + BILLION) % BILLION;
+        time_t t0 = Start;
+        long int d1 = 60 * 60 * pc.rel.hour;
+        time_t t1 = t0 + d1;
+        long int d2 = 60 * pc.rel.minutes;
+        time_t t2 = t1 + d2;
+        long_time_t d3 = pc.rel.seconds;
+        long_time_t t3 = t2 + d3;
+        long int d4 = (sum_ns - normalized_ns) / BILLION;
+        long_time_t t4 = t3 + d4;
+        time_t t5 = t4;
+
+        if ((d1 / (60 * 60) ^ pc.rel.hour)
+            | (d2 / 60 ^ pc.rel.minutes)
+            | ((t1 < t0) ^ (d1 < 0))
+            | ((t2 < t1) ^ (d2 < 0))
+            | ((t3 < t2) ^ (d3 < 0))
+            | ((t4 < t3) ^ (d4 < 0))
+            | (t5 != t4))
+          goto fail;
+
+        result->tv_sec = t5;
+        result->tv_nsec = normalized_ns;
       }
     }
 
@@ -1548,19 +1549,19 @@ main (int ac, char **av)
       struct timespec d;
       struct tm const *tm;
       if (! get_date (&d, buff, NULL))
-       printf ("Bad format - couldn't convert.\n");
+        printf ("Bad format - couldn't convert.\n");
       else if (! (tm = localtime (&d.tv_sec)))
-       {
-         long int sec = d.tv_sec;
-         printf ("localtime (%ld) failed\n", sec);
-       }
+        {
+          long int sec = d.tv_sec;
+          printf ("localtime (%ld) failed\n", sec);
+        }
       else
-       {
-         int ns = d.tv_nsec;
-         printf ("%04ld-%02d-%02d %02d:%02d:%02d.%09d\n",
-                 tm->tm_year + 1900L, tm->tm_mon + 1, tm->tm_mday,
-                 tm->tm_hour, tm->tm_min, tm->tm_sec, ns);
-       }
+        {
+          int ns = d.tv_nsec;
+          printf ("%04ld-%02d-%02d %02d:%02d:%02d.%09d\n",
+                  tm->tm_year + 1900L, tm->tm_mon + 1, tm->tm_mday,
+                  tm->tm_hour, tm->tm_min, tm->tm_sec, ns);
+        }
       printf ("\t> ");
       fflush (stdout);
     }
diff --git a/gl/getdelim.c b/gl/getdelim.c
index b74e5b5..10179ef 100644
--- a/gl/getdelim.c
+++ b/gl/getdelim.c
@@ -21,6 +21,10 @@
 
 #include <config.h>
 
+/* Don't use __attribute__ __nonnull__ in this compilation unit.  Otherwise gcc
+   optimizes away the lineptr == NULL || n == NULL || fp == NULL tests below.  
*/
+#define _GL_ARG_NONNULL(params)
+
 #include <stdio.h>
 
 #include <limits.h>
@@ -34,15 +38,15 @@
 
 #if USE_UNLOCKED_IO
 # include "unlocked-io.h"
-# define getc_maybe_unlocked(fp)       getc(fp)
+# define getc_maybe_unlocked(fp)        getc(fp)
 #elif !HAVE_FLOCKFILE || !HAVE_FUNLOCKFILE || !HAVE_DECL_GETC_UNLOCKED
 # undef flockfile
 # undef funlockfile
 # define flockfile(x) ((void) 0)
 # define funlockfile(x) ((void) 0)
-# define getc_maybe_unlocked(fp)       getc(fp)
+# define getc_maybe_unlocked(fp)        getc(fp)
 #else
-# define getc_maybe_unlocked(fp)       getc_unlocked(fp)
+# define getc_maybe_unlocked(fp)        getc_unlocked(fp)
 #endif
 
 /* Read up to (and including) a DELIMITER from FP into *LINEPTR (and
@@ -71,10 +75,10 @@ getdelim (char **lineptr, size_t *n, int delimiter, FILE 
*fp)
       *n = 120;
       new_lineptr = (char *) realloc (*lineptr, *n);
       if (new_lineptr == NULL)
-       {
-         result = -1;
-         goto unlock_return;
-       }
+        {
+          result = -1;
+          goto unlock_return;
+        }
       *lineptr = new_lineptr;
     }
 
@@ -84,44 +88,44 @@ getdelim (char **lineptr, size_t *n, int delimiter, FILE 
*fp)
 
       i = getc_maybe_unlocked (fp);
       if (i == EOF)
-       {
-         result = -1;
-         break;
-       }
+        {
+          result = -1;
+          break;
+        }
 
       /* Make enough space for len+1 (for final NUL) bytes.  */
       if (cur_len + 1 >= *n)
-       {
-         size_t needed_max =
-           SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX;
-         size_t needed = 2 * *n + 1;   /* Be generous. */
-         char *new_lineptr;
-
-         if (needed_max < needed)
-           needed = needed_max;
-         if (cur_len + 1 >= needed)
-           {
-             result = -1;
-             errno = EOVERFLOW;
-             goto unlock_return;
-           }
-
-         new_lineptr = (char *) realloc (*lineptr, needed);
-         if (new_lineptr == NULL)
-           {
-             result = -1;
-             goto unlock_return;
-           }
-
-         *lineptr = new_lineptr;
-         *n = needed;
-       }
+        {
+          size_t needed_max =
+            SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX;
+          size_t needed = 2 * *n + 1;   /* Be generous. */
+          char *new_lineptr;
+
+          if (needed_max < needed)
+            needed = needed_max;
+          if (cur_len + 1 >= needed)
+            {
+              result = -1;
+              errno = EOVERFLOW;
+              goto unlock_return;
+            }
+
+          new_lineptr = (char *) realloc (*lineptr, needed);
+          if (new_lineptr == NULL)
+            {
+              result = -1;
+              goto unlock_return;
+            }
+
+          *lineptr = new_lineptr;
+          *n = needed;
+        }
 
       (*lineptr)[cur_len] = i;
       cur_len++;
 
       if (i == delimiter)
-       break;
+        break;
     }
   (*lineptr)[cur_len] = '\0';
   result = cur_len ? cur_len : result;
diff --git a/gl/getdomainname.c b/gl/getdomainname.c
index 6580753..c0041cc 100644
--- a/gl/getdomainname.c
+++ b/gl/getdomainname.c
@@ -38,7 +38,7 @@
 int
 getdomainname (char *name, size_t len)
 {
-  const char *result = "";     /* Hardcode your domain name if you want.  */
+  const char *result = "";      /* Hardcode your domain name if you want.  */
   size_t result_len = strlen (result);
 
   if (result_len > len)
diff --git a/gl/gethostname.c b/gl/gethostname.c
index acff351..dd89508 100644
--- a/gl/gethostname.c
+++ b/gl/gethostname.c
@@ -1,6 +1,6 @@
 /* gethostname emulation for SysV and POSIX.1.
 
-   Copyright (C) 1992, 2003, 2006, 2008 Free Software Foundation, Inc.
+   Copyright (C) 1992, 2003, 2006, 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
@@ -15,10 +15,14 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-/* David MacKenzie <address@hidden> */
+/* David MacKenzie <address@hidden>
+   Windows port by Simon Josefsson <address@hidden> */
 
 #include <config.h>
 
+#if !((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__)
+/* Unix API.  */
+
 /* Specification.  */
 #include <unistd.h>
 
@@ -50,7 +54,51 @@ gethostname (char *name, size_t len)
     }
   strncpy (name, uts.nodename, len);
 #else
-  strcpy (name, "");           /* Hardcode your system name if you want.  */
+  strcpy (name, "");            /* Hardcode your system name if you want.  */
 #endif
   return 0;
 }
+
+#else
+/* Native Windows API.  Which primitive to choose?
+   - gethostname() requires linking with -lws2_32.
+   - GetComputerName() does not return the right kind of hostname.
+   - GetComputerNameEx(ComputerNameDnsHostname,...) returns the right hostname,
+     but it is hard to use portably:
+       - It requires defining _WIN32_WINNT to at least 0x0500.
+       - With mingw, it also requires
+         "#define GetComputerNameEx GetComputerNameExA".
+       - With older versions of mingw, none of the declarations are present at
+         all, not even of the enum value ComputerNameDnsHostname.
+   So we use gethostname().  Linking with -lws2_32 is the least evil.  */
+
+#define WIN32_LEAN_AND_MEAN
+/* Get winsock2.h. */
+#include <unistd.h>
+
+/* Get INT_MAX.  */
+#include <limits.h>
+
+/* Get set_winsock_errno. */
+#include "w32sock.h"
+
+#include "sockets.h"
+
+#undef gethostname
+
+int
+rpl_gethostname (char *name, size_t len)
+{
+  int r;
+
+  if (len > INT_MAX)
+    len = INT_MAX;
+  gl_sockets_startup (SOCKETS_1_1);
+  r = gethostname (name, (int) len);
+  if (r < 0)
+    set_winsock_errno ();
+
+  return r;
+}
+
+#endif
diff --git a/gl/getpagesize.c b/gl/getpagesize.c
deleted file mode 100644
index 5498aa9..0000000
--- a/gl/getpagesize.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* getpagesize emulation for systems where it cannot be done in a C macro.
-
-   Copyright (C) 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/>.  */
-
-/* Written by Bruno Haible and Martin Lambers.  */
-
-#include <config.h>
-
-/* Specification. */
-#include <unistd.h>
-
-/* This implementation is only for native Win32 systems.  */
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-
-int
-getpagesize (void)
-{
-  SYSTEM_INFO system_info;
-  GetSystemInfo (&system_info);
-  return system_info.dwPageSize;
-}
-
-#endif
diff --git a/gl/getpass.c b/gl/getpass.c
index 208e21b..4d564df 100644
--- a/gl/getpass.c
+++ b/gl/getpass.c
@@ -34,7 +34,7 @@
 #  include <stdio_ext.h>
 # endif
 #else
-# define __fsetlocking(stream, type)   /* empty */
+# define __fsetlocking(stream, type)    /* empty */
 #endif
 
 #if HAVE_TERMIOS_H
@@ -145,17 +145,17 @@ getpass (const char *prompt)
   if (buf != NULL)
     {
       if (nread < 0)
-       buf[0] = '\0';
+        buf[0] = '\0';
       else if (buf[nread - 1] == '\n')
-       {
-         /* Remove the newline.  */
-         buf[nread - 1] = '\0';
-         if (tty_changed)
-           {
-             /* Write the newline that was not echoed.  */
-             putc_unlocked ('\n', out);
-           }
-       }
+        {
+          /* Remove the newline.  */
+          buf[nread - 1] = '\0';
+          if (tty_changed)
+            {
+              /* Write the newline that was not echoed.  */
+              putc_unlocked ('\n', out);
+            }
+        }
     }
 
   /* Restore the original setting.  */
@@ -204,20 +204,20 @@ getpass (const char *prompt)
     {
       c = _getch ();
       if (c == '\r')
-       {
-         getpassbuf[i] = '\0';
-         break;
-       }
+        {
+          getpassbuf[i] = '\0';
+          break;
+        }
       else if (i < PASS_MAX)
-       {
-         getpassbuf[i++] = c;
-       }
+        {
+          getpassbuf[i++] = c;
+        }
 
       if (i >= PASS_MAX)
-       {
-         getpassbuf[i] = '\0';
-         break;
-       }
+        {
+          getpassbuf[i] = '\0';
+          break;
+        }
     }
 
   if (prompt)
diff --git a/gl/getsubopt.c b/gl/getsubopt.c
index f29f359..b8199f1 100644
--- a/gl/getsubopt.c
+++ b/gl/getsubopt.c
@@ -58,16 +58,16 @@ getsubopt (char **optionp, char *const *tokens, char 
**valuep)
      one of the TOKENS.  */
   for (cnt = 0; tokens[cnt] != NULL; ++cnt)
     if (strncmp (*optionp, tokens[cnt], vstart - *optionp) == 0
-       && tokens[cnt][vstart - *optionp] == '\0')
+        && tokens[cnt][vstart - *optionp] == '\0')
       {
-       /* We found the current option in TOKENS.  */
-       *valuep = vstart != endp ? vstart + 1 : NULL;
+        /* We found the current option in TOKENS.  */
+        *valuep = vstart != endp ? vstart + 1 : NULL;
 
-       if (*endp != '\0')
-         *endp++ = '\0';
-       *optionp = endp;
+        if (*endp != '\0')
+          *endp++ = '\0';
+        *optionp = endp;
 
-       return cnt;
+        return cnt;
       }
 
   /* The current suboption does not match any option.  */
diff --git a/gl/gettext.h b/gl/gettext.h
index 41c0ae1..3616330 100644
--- a/gl/gettext.h
+++ b/gl/gettext.h
@@ -140,8 +140,8 @@ inline
 #endif
 static const char *
 pgettext_aux (const char *domain,
-             const char *msg_ctxt_id, const char *msgid,
-             int category)
+              const char *msg_ctxt_id, const char *msgid,
+              int category)
 {
   const char *translation = dcgettext (domain, msg_ctxt_id, category);
   if (translation == msg_ctxt_id)
@@ -159,9 +159,9 @@ inline
 #endif
 static const char *
 npgettext_aux (const char *domain,
-              const char *msg_ctxt_id, const char *msgid,
-              const char *msgid_plural, unsigned long int n,
-              int category)
+               const char *msg_ctxt_id, const char *msgid,
+               const char *msgid_plural, unsigned long int n,
+               int category)
 {
   const char *translation =
     dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
diff --git a/gl/gettimeofday.c b/gl/gettimeofday.c
index eb6bf9c..63ee747 100644
--- a/gl/gettimeofday.c
+++ b/gl/gettimeofday.c
@@ -1,6 +1,6 @@
 /* Provide gettimeofday for systems that don't have it or for which it's 
broken.
 
-   Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007 Free Software
+   Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007, 2009 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -111,7 +111,7 @@ rpl_gettimeofday (struct timeval *restrict tv, void 
*restrict tz)
   struct tm save = *localtime_buffer_addr;
 # endif
 
-  int result = gettimeofday (tv, tz);
+  int result = gettimeofday (tv, (struct timezone *) tz);
 
 # if GETTIMEOFDAY_CLOBBERS_LOCALTIME
   *localtime_buffer_addr = save;
diff --git a/gl/hmac-md5.c b/gl/hmac-md5.c
index a6811c2..7c487a1 100644
--- a/gl/hmac-md5.c
+++ b/gl/hmac-md5.c
@@ -31,7 +31,7 @@
 
 int
 hmac_md5 (const void *key, size_t keylen,
-         const void *in, size_t inlen, void *resbuf)
+          const void *in, size_t inlen, void *resbuf)
 {
   struct md5_ctx inner;
   struct md5_ctx outer;
diff --git a/gl/hmac-sha1.c b/gl/hmac-sha1.c
index f6cf18c..5afe379 100644
--- a/gl/hmac-sha1.c
+++ b/gl/hmac-sha1.c
@@ -31,7 +31,7 @@
 
 int
 hmac_sha1 (const void *key, size_t keylen,
-          const void *in, size_t inlen, void *resbuf)
+           const void *in, size_t inlen, void *resbuf)
 {
   struct sha1_ctx inner;
   struct sha1_ctx outer;
diff --git a/gl/hmac.h b/gl/hmac.h
index 90dae1c..22787d7 100644
--- a/gl/hmac.h
+++ b/gl/hmac.h
@@ -28,7 +28,7 @@
    RESBUF buffer.  Return 0 on success.  */
 int
 hmac_md5 (const void *key, size_t keylen,
-         const void *buffer, size_t buflen, void *resbuf);
+          const void *buffer, size_t buflen, void *resbuf);
 
 /* Compute Hashed Message Authentication Code with SHA-1, over BUFFER
    data of BUFLEN bytes using the KEY of KEYLEN bytes, writing the
@@ -36,6 +36,6 @@ hmac_md5 (const void *key, size_t keylen,
    success.  */
 int
 hmac_sha1 (const void *key, size_t keylen,
-          const void *in, size_t inlen, void *resbuf);
+           const void *in, size_t inlen, void *resbuf);
 
 #endif /* HMAC_H */
diff --git a/gl/inet_ntop.c b/gl/inet_ntop.c
index be091ff..7763c56 100644
--- a/gl/inet_ntop.c
+++ b/gl/inet_ntop.c
@@ -1,6 +1,6 @@
 /* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form
 
-   Copyright (C) 2005, 2006, 2008  Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006, 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
@@ -42,10 +42,6 @@
 #include <string.h>
 #include <errno.h>
 
-#ifndef EAFNOSUPPORT
-# define EAFNOSUPPORT EINVAL
-#endif
-
 #define NS_IN6ADDRSZ 16
 #define NS_INT16SZ 2
 
@@ -63,15 +59,15 @@ static const char *inet_ntop6 (const unsigned char *src, 
char *dst, socklen_t si
 
 /* char *
  * inet_ntop(af, src, dst, size)
- *     convert a network format address to presentation format.
+ *      convert a network format address to presentation format.
  * return:
- *     pointer to presentation format address (`dst'), or NULL (see errno).
+ *      pointer to presentation format address (`dst'), or NULL (see errno).
  * author:
- *     Paul Vixie, 1996.
+ *      Paul Vixie, 1996.
  */
 const char *
 inet_ntop (int af, const void *restrict src,
-          char *restrict dst, socklen_t cnt)
+           char *restrict dst, socklen_t cnt)
 {
   switch (af)
     {
@@ -94,14 +90,14 @@ inet_ntop (int af, const void *restrict src,
 
 /* const char *
  * inet_ntop4(src, dst, size)
- *     format an IPv4 address
+ *      format an IPv4 address
  * return:
- *     `dst' (as a const)
+ *      `dst' (as a const)
  * notes:
- *     (1) uses no statics
- *     (2) takes a u_char* not an in_addr as input
+ *      (1) uses no statics
+ *      (2) takes a u_char* not an in_addr as input
  * author:
- *     Paul Vixie, 1996.
+ *      Paul Vixie, 1996.
  */
 static const char *
 inet_ntop4 (const unsigned char *src, char *dst, socklen_t size)
@@ -126,9 +122,9 @@ inet_ntop4 (const unsigned char *src, char *dst, socklen_t 
size)
 
 /* const char *
  * inet_ntop6(src, dst, size)
- *     convert IPv6 binary address into presentation (printable) format
+ *      convert IPv6 binary address into presentation (printable) format
  * author:
- *     Paul Vixie, 1996.
+ *      Paul Vixie, 1996.
  */
 static const char *
 inet_ntop6 (const unsigned char *src, char *dst, socklen_t size)
@@ -161,26 +157,26 @@ inet_ntop6 (const unsigned char *src, char *dst, 
socklen_t size)
   for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
     {
       if (words[i] == 0)
-       {
-         if (cur.base == -1)
-           cur.base = i, cur.len = 1;
-         else
-           cur.len++;
-       }
+        {
+          if (cur.base == -1)
+            cur.base = i, cur.len = 1;
+          else
+            cur.len++;
+        }
       else
-       {
-         if (cur.base != -1)
-           {
-             if (best.base == -1 || cur.len > best.len)
-               best = cur;
-             cur.base = -1;
-           }
-       }
+        {
+          if (cur.base != -1)
+            {
+              if (best.base == -1 || cur.len > best.len)
+                best = cur;
+              cur.base = -1;
+            }
+        }
     }
   if (cur.base != -1)
     {
       if (best.base == -1 || cur.len > best.len)
-       best = cur;
+        best = cur;
     }
   if (best.base != -1 && best.len < 2)
     best.base = -1;
@@ -193,28 +189,28 @@ inet_ntop6 (const unsigned char *src, char *dst, 
socklen_t size)
     {
       /* Are we inside the best run of 0x00's? */
       if (best.base != -1 && i >= best.base && i < (best.base + best.len))
-       {
-         if (i == best.base)
-           *tp++ = ':';
-         continue;
-       }
+        {
+          if (i == best.base)
+            *tp++ = ':';
+          continue;
+        }
       /* Are we following an initial run of 0x00s or any real hex? */
       if (i != 0)
-       *tp++ = ':';
+        *tp++ = ':';
       /* Is this address an encapsulated IPv4? */
       if (i == 6 && best.base == 0 &&
-         (best.len == 6 || (best.len == 5 && words[5] == 0xffff)))
-       {
-         if (!inet_ntop4 (src + 12, tp, sizeof tmp - (tp - tmp)))
-           return (NULL);
-         tp += strlen (tp);
-         break;
-       }
+          (best.len == 6 || (best.len == 5 && words[5] == 0xffff)))
+        {
+          if (!inet_ntop4 (src + 12, tp, sizeof tmp - (tp - tmp)))
+            return (NULL);
+          tp += strlen (tp);
+          break;
+        }
       {
-       int len = sprintf (tp, "%x", words[i]);
-       if (len < 0)
-         return NULL;
-       tp += len;
+        int len = sprintf (tp, "%x", words[i]);
+        if (len < 0)
+          return NULL;
+        tp += len;
       }
     }
   /* Was it a trailing run of 0x00's? */
diff --git a/gl/intprops.h b/gl/intprops.h
index 002161e..a0f4669 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,40 +18,43 @@
 
 /* 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) \
+        ? (t) 0 \
+        : TYPE_SIGNED_MAGNITUDE (t) \
+        ? ~ (t) 0 \
+        : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
+# define TYPE_MAXIMUM(t) \
   ((t) (! TYPE_SIGNED (t) \
-       ? (t) -1 \
-       : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
+        ? (t) -1 \
+        : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
 
 /* Return zero if T can be determined to be an unsigned type.
    Otherwise, return 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/clock_time.m4 b/gl/m4/clock_time.m4
index d191072..d11e106 100644
--- a/gl/m4/clock_time.m4
+++ b/gl/m4/clock_time.m4
@@ -1,4 +1,4 @@
-# clock_time.m4 serial 9
+# clock_time.m4 serial 10
 dnl Copyright (C) 2002-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,
@@ -20,11 +20,12 @@ AC_DEFUN([gl_CLOCK_TIME],
   # Save and restore LIBS so e.g., -lrt, isn't added to it.  Otherwise, *all*
   # programs in the package would end up linked with that potentially-shared
   # library, inducing unnecessary run-time overhead.
+  LIB_CLOCK_GETTIME=
+  AC_SUBST([LIB_CLOCK_GETTIME])
   gl_saved_libs=$LIBS
     AC_SEARCH_LIBS([clock_gettime], [rt posix4],
                    [test "$ac_cv_search_clock_gettime" = "none required" ||
                     LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
-    AC_SUBST([LIB_CLOCK_GETTIME])
     AC_CHECK_FUNCS([clock_gettime clock_settime])
   LIBS=$gl_saved_libs
 ])
diff --git a/gl/m4/close.m4 b/gl/m4/close.m4
index b1189f5..fdcc96b 100644
--- a/gl/m4/close.m4
+++ b/gl/m4/close.m4
@@ -1,4 +1,4 @@
-# close.m4 serial 3
+# close.m4 serial 5
 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,
@@ -9,6 +9,9 @@ AC_DEFUN([gl_FUNC_CLOSE],
   m4_ifdef([gl_PREREQ_SYS_H_WINSOCK2], [
     gl_PREREQ_SYS_H_WINSOCK2
     if test $UNISTD_H_HAVE_WINSOCK2_H = 1; then
+      dnl Even if the 'socket' module is not used here, another part of the
+      dnl application may use it and pass file descriptors that refer to
+      dnl sockets to the close() function. So enable the support for sockets.
       gl_REPLACE_CLOSE
     fi
   ])
@@ -17,9 +20,7 @@ AC_DEFUN([gl_FUNC_CLOSE],
 AC_DEFUN([gl_REPLACE_CLOSE],
 [
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-  if test $REPLACE_CLOSE != 1; then
-    AC_LIBOBJ([close])
-  fi
   REPLACE_CLOSE=1
+  AC_LIBOBJ([close])
   gl_REPLACE_FCLOSE
 ])
diff --git a/gl/m4/dup2.m4 b/gl/m4/dup2.m4
new file mode 100644
index 0000000..73a3209
--- /dev/null
+++ b/gl/m4/dup2.m4
@@ -0,0 +1,58 @@
+#serial 10
+dnl Copyright (C) 2002, 2005, 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.
+
+AC_DEFUN([gl_FUNC_DUP2],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CHECK_FUNCS_ONCE([dup2])
+  if test $ac_cv_func_dup2 = no; then
+    HAVE_DUP2=0
+    AC_LIBOBJ([dup2])
+  else
+    AC_CACHE_CHECK([whether dup2 works], [gl_cv_func_dup2_works],
+      [AC_RUN_IFELSE([
+         AC_LANG_PROGRAM([[#include <unistd.h>
+#include <errno.h>]],
+           [if (dup2 (1, 1) == 0)
+              return 1;
+            close (0);
+            if (dup2 (0, 0) != -1)
+              return 2;
+            /* Many gnulib modules require POSIX conformance of EBADF.  */
+            if (dup2 (1, 1000000) == -1 && errno != EBADF)
+              return 3;
+            return 0;
+           ])
+        ],
+        [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no],
+        [case "$host_os" in
+           mingw*) # on this platform, dup2 always returns 0 for success
+             gl_cv_func_dup2_works=no;;
+           cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0
+             gl_cv_func_dup2_works=no;;
+           linux*) # On linux between 2008-07-27 and 2009-05-11, dup2 of a
+                   # closed fd may yield -EBADF instead of -1 / errno=EBADF.
+             gl_cv_func_dup2_works=no;;
+           freebsd*) # on FreeBSD 6.1, dup2(1,1000000) gives EMFILE, not EBADF.
+             gl_cv_func_dup2_works=no;;
+           *) gl_cv_func_dup2_works=yes;;
+         esac])
+      ])
+    if test "$gl_cv_func_dup2_works" = no; then
+      gl_REPLACE_DUP2
+    fi
+  fi
+])
+
+AC_DEFUN([gl_REPLACE_DUP2],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  if test $ac_cv_func_dup2 = yes; then
+    REPLACE_DUP2=1
+  fi
+  AC_LIBOBJ([dup2])
+])
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/extensions.m4 b/gl/m4/extensions.m4
index ba6d5e1..ac19b36 100644
--- a/gl/m4/extensions.m4
+++ b/gl/m4/extensions.m4
@@ -1,4 +1,4 @@
-# serial 8  -*- Autoconf -*-
+# serial 9  -*- Autoconf -*-
 # Enable extensions on systems that normally disable them.
 
 # Copyright (C) 2003, 2006-2009 Free Software Foundation, Inc.
@@ -12,6 +12,20 @@
 # enough in this area it's likely we'll need to redefine
 # AC_USE_SYSTEM_EXTENSIONS for quite some time.
 
+# If autoconf reports a warning
+#     warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
+# or  warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
+# the fix is
+#   1) to ensure that AC_USE_SYSTEM_EXTENSIONS is never directly invoked
+#      but always AC_REQUIREd,
+#   2) to ensure that for each occurrence of
+#        AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+#      or
+#        AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+#      the corresponding gnulib module description has 'extensions' among
+#      its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS
+#      invocation occurs in gl_EARLY, not in gl_INIT.
+
 # AC_USE_SYSTEM_EXTENSIONS
 # ------------------------
 # Enable extensions on systems that normally disable them,
@@ -74,8 +88,8 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
     [ac_cv_safe_to_define___extensions__],
     [AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM([[
-#        define __EXTENSIONS__ 1
-         ]AC_INCLUDES_DEFAULT])],
+#         define __EXTENSIONS__ 1
+          ]AC_INCLUDES_DEFAULT])],
        [ac_cv_safe_to_define___extensions__=yes],
        [ac_cv_safe_to_define___extensions__=no])])
   test $ac_cv_safe_to_define___extensions__ = yes &&
diff --git a/gl/m4/fclose.m4 b/gl/m4/fclose.m4
index d10c104..ab2986f 100644
--- a/gl/m4/fclose.m4
+++ b/gl/m4/fclose.m4
@@ -1,5 +1,5 @@
-# fclose.m4 serial 1
-dnl Copyright (C) 2008 Free Software Foundation, Inc.
+# fclose.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.
@@ -11,8 +11,6 @@ AC_DEFUN([gl_FUNC_FCLOSE],
 AC_DEFUN([gl_REPLACE_FCLOSE],
 [
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
-  if test $REPLACE_FCLOSE != 1; then
-    AC_LIBOBJ([fclose])
-  fi
   REPLACE_FCLOSE=1
+  AC_LIBOBJ([fclose])
 ])
diff --git a/gl/m4/fcntl-o.m4 b/gl/m4/fcntl-o.m4
new file mode 100644
index 0000000..10d564c
--- /dev/null
+++ b/gl/m4/fcntl-o.m4
@@ -0,0 +1,81 @@
+# fcntl-o.m4 serial 1
+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,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Written by Paul Eggert.
+
+# Test whether the flags O_NOATIME and O_NOFOLLOW actually work.
+# Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise.
+# Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise.
+AC_DEFUN([gl_FCNTL_O_FLAGS],
+[
+  dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW.
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+  AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h],
+    [AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <sys/types.h>
+           #include <sys/stat.h>
+           #include <unistd.h>
+           #include <fcntl.h>
+           #ifndef O_NOATIME
+            #define O_NOATIME 0
+           #endif
+           #ifndef O_NOFOLLOW
+            #define O_NOFOLLOW 0
+           #endif
+           static int const constants[] =
+            {
+              O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND,
+              O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY
+            };
+          ]],
+          [[
+            int status = !constants;
+            {
+              static char const sym[] = "conftest.sym";
+              if (symlink (".", sym) != 0
+                  || close (open (sym, O_RDONLY | O_NOFOLLOW)) == 0)
+                status |= 32;
+              unlink (sym);
+            }
+            {
+              static char const file[] = "confdefs.h";
+              int fd = open (file, O_RDONLY | O_NOATIME);
+              char c;
+              struct stat st0, st1;
+              if (fd < 0
+                  || fstat (fd, &st0) != 0
+                  || sleep (1) != 0
+                  || read (fd, &c, 1) != 1
+                  || close (fd) != 0
+                  || stat (file, &st1) != 0
+                  || st0.st_atime != st1.st_atime)
+                status |= 64;
+            }
+            return status;]])],
+       [gl_cv_header_working_fcntl_h=yes],
+       [case $? in #(
+        32) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #(
+        64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #(
+        96) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #(
+         *) gl_cv_header_working_fcntl_h='no';;
+        esac],
+       [gl_cv_header_working_fcntl_h=cross-compiling])])
+
+  case $gl_cv_header_working_fcntl_h in #(
+  *O_NOATIME* | no | cross-compiling) ac_val=0;; #(
+  *) ac_val=1;;
+  esac
+  AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val],
+    [Define to 1 if O_NOATIME works.])
+
+  case $gl_cv_header_working_fcntl_h in #(
+  *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #(
+  *) ac_val=1;;
+  esac
+  AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val],
+    [Define to 1 if O_NOFOLLOW works.])
+])
diff --git a/gl/m4/fcntl.m4 b/gl/m4/fcntl.m4
new file mode 100644
index 0000000..4fc5f6b
--- /dev/null
+++ b/gl/m4/fcntl.m4
@@ -0,0 +1,83 @@
+# fcntl.m4 serial 3
+dnl Copyright (C) 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.
+
+# For now, this module ensures that fcntl()
+# - supports F_DUPFD correctly
+# - supports or emulates F_DUPFD_CLOEXEC
+# - supports F_GETFD
+# Still to be ported to mingw:
+# - F_SETFD
+# - F_GETFL, F_SETFL
+# - F_GETOWN, F_SETOWN
+# - F_GETLK, F_SETLK, F_SETLKW
+AC_DEFUN([gl_FUNC_FCNTL],
+[
+  dnl Persuade glibc to expose F_DUPFD_CLOEXEC.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CHECK_FUNCS_ONCE([fcntl])
+  if test $ac_cv_func_fcntl = no; then
+    gl_REPLACE_FCNTL
+  else
+    dnl cygwin 1.5.x F_DUPFD has wrong errno, and allows negative target
+    AC_CACHE_CHECK([whether fcntl handles F_DUPFD correctly],
+      [gl_cv_func_fcntl_f_dupfd_works],
+      [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <fcntl.h>
+]], [[return fcntl (0, F_DUPFD, -1) != -1;
+         ]])],
+         [gl_cv_func_fcntl_f_dupfd_works=yes],
+         [gl_cv_func_fcntl_f_dupfd_works=no],
+         [# Guess that it works on glibc systems
+          case $host_os in #((
+            *-gnu*) gl_cv_func_fcntl_f_dupfd_works="guessing yes";;
+            *)      gl_cv_func_fcntl_f_dupfd_works="guessing no";;
+          esac])])
+    case $gl_cv_func_fcntl_f_dupfd_works in
+      *yes) ;;
+      *) gl_REPLACE_FCNTL
+        AC_DEFINE([FCNTL_DUPFD_BUGGY], [1], [Define this to 1 if F_DUPFD
+          behavior does not match POSIX]) ;;
+    esac
+
+    dnl Many systems lack F_DUPFD_CLOEXEC
+    AC_CACHE_CHECK([whether fcntl understands F_DUPFD_CLOEXEC],
+      [gl_cv_func_fcntl_f_dupfd_cloexec],
+      [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <fcntl.h>
+#ifndef F_DUPFD_CLOEXEC
+choke me
+#endif
+         ]])],
+         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#ifdef __linux__
+/* The Linux kernel only added F_DUPFD_CLOEXEC in 2.6.24, so we always replace
+   it to support the semantics on older kernels that failed with EINVAL.  */
+choke me
+#endif
+           ]])],
+           [gl_cv_func_fcntl_f_dupfd_cloexec=yes],
+           [gl_cv_func_fcntl_f_dupfd_cloexec="needs runtime check"])],
+         [gl_cv_func_fcntl_f_dupfd_cloexec=no])])
+    if test "$gl_cv_func_fcntl_f_dupfd_cloexec" != yes; then
+      gl_REPLACE_FCNTL
+      dnl No witness macro needed for this bug.
+    fi
+  fi
+])
+
+AC_DEFUN([gl_REPLACE_FCNTL],
+[
+  AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([fcntl])
+  if test $ac_cv_func_fcntl = no; then
+    HAVE_FCNTL=0
+  else
+    REPLACE_FCNTL=1
+  fi
+  AC_LIBOBJ([fcntl])
+])
diff --git a/gl/m4/fcntl_h.m4 b/gl/m4/fcntl_h.m4
index 1ae0b15..e899148 100644
--- a/gl/m4/fcntl_h.m4
+++ b/gl/m4/fcntl_h.m4
@@ -1,3 +1,4 @@
+# serial 9
 # Configure fcntl.h.
 dnl Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
@@ -9,76 +10,8 @@ dnl Written by Paul Eggert.
 AC_DEFUN([gl_FCNTL_H],
 [
   AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
-  dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW.
-  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-  AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h],
-    [AC_RUN_IFELSE(
-       [AC_LANG_PROGRAM(
-         [[#include <sys/types.h>
-          #include <sys/stat.h>
-          #include <unistd.h>
-          #include <fcntl.h>
-          #ifndef O_NOATIME
-           #define O_NOATIME 0
-          #endif
-          #ifndef O_NOFOLLOW
-           #define O_NOFOLLOW 0
-          #endif
-          static int const constants[] =
-           {
-             O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND,
-             O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY
-           };
-         ]],
-         [[
-           int status = !constants;
-           {
-             static char const sym[] = "conftest.sym";
-             if (symlink (".", sym) != 0
-                 || close (open (sym, O_RDONLY | O_NOFOLLOW)) == 0)
-               status |= 32;
-           }
-           {
-             static char const file[] = "confdefs.h";
-             int fd = open (file, O_RDONLY | O_NOATIME);
-             char c;
-             struct stat st0, st1;
-             if (fd < 0
-                 || fstat (fd, &st0) != 0
-                 || sleep (1) != 0
-                 || read (fd, &c, 1) != 1
-                 || close (fd) != 0
-                 || stat (file, &st1) != 0
-                 || st0.st_atime != st1.st_atime)
-               status |= 64;
-           }
-           return status;]])],
-       [gl_cv_header_working_fcntl_h=yes],
-       [case $? in #(
-       32) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #(
-       64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #(
-       96) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #(
-        *) gl_cv_header_working_fcntl_h='no';;
-       esac],
-       [gl_cv_header_working_fcntl_h=cross-compiling])])
-
-  case $gl_cv_header_working_fcntl_h in #(
-  *O_NOATIME* | no | cross-compiling) ac_val=0;; #(
-  *) ac_val=1;;
-  esac
-  AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val],
-    [Define to 1 if O_NOATIME works.])
-
-  case $gl_cv_header_working_fcntl_h in #(
-  *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #(
-  *) ac_val=1;;
-  esac
-  AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val],
-    [Define to 1 if O_NOFOLLOW works.])
-
+  AC_REQUIRE([gl_FCNTL_O_FLAGS])
   gl_CHECK_NEXT_HEADERS([fcntl.h])
-  FCNTL_H='fcntl.h'
-  AC_SUBST([FCNTL_H])
 ])
 
 AC_DEFUN([gl_FCNTL_MODULE_INDICATOR],
@@ -90,7 +23,13 @@ AC_DEFUN([gl_FCNTL_MODULE_INDICATOR],
 
 AC_DEFUN([gl_FCNTL_H_DEFAULTS],
 [
-  GNULIB_OPEN=0;  AC_SUBST([GNULIB_OPEN])
+  GNULIB_FCNTL=0;   AC_SUBST([GNULIB_FCNTL])
+  GNULIB_OPEN=0;    AC_SUBST([GNULIB_OPEN])
+  GNULIB_OPENAT=0;  AC_SUBST([GNULIB_OPENAT])
   dnl Assume proper GNU behavior unless another module says otherwise.
-  REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN])
+  HAVE_FCNTL=1;     AC_SUBST([HAVE_FCNTL])
+  HAVE_OPENAT=1;    AC_SUBST([HAVE_OPENAT])
+  REPLACE_FCNTL=0;  AC_SUBST([REPLACE_FCNTL])
+  REPLACE_OPEN=0;   AC_SUBST([REPLACE_OPEN])
+  REPLACE_OPENAT=0; AC_SUBST([REPLACE_OPENAT])
 ])
diff --git a/gl/m4/fseeko.m4 b/gl/m4/fseeko.m4
index 3d77365..feba6ab 100644
--- a/gl/m4/fseeko.m4
+++ b/gl/m4/fseeko.m4
@@ -1,5 +1,5 @@
-# fseeko.m4 serial 4
-dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
+# fseeko.m4 serial 6
+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.
@@ -15,8 +15,9 @@ AC_DEFUN([gl_FUNC_FSEEKO],
 
   AC_CACHE_CHECK([for fseeko], [gl_cv_func_fseeko],
     [
-      AC_TRY_LINK([#include <stdio.h>], [fseeko (stdin, 0, 0);],
-       [gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
+]], [fseeko (stdin, 0, 0);])],
+        [gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
     ])
   if test $gl_cv_func_fseeko = no; then
     HAVE_FSEEKO=0
@@ -31,4 +32,6 @@ AC_DEFUN([gl_REPLACE_FSEEKO],
   AC_LIBOBJ([fseeko])
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
   REPLACE_FSEEKO=1
+  dnl If we are also using the fseek module, then fseek needs replacing, too.
+  m4_ifdef([gl_REPLACE_FSEEK], [gl_REPLACE_FSEEK])
 ])
diff --git a/gl/m4/gc-random.m4 b/gl/m4/gc-random.m4
index 3bbfdaf..2ca27a1 100644
--- a/gl/m4/gc-random.m4
+++ b/gl/m4/gc-random.m4
@@ -39,23 +39,23 @@ AC_DEFUN([gl_GC_RANDOM],
 
   AC_MSG_CHECKING([device with (strong) random data...])
   AC_ARG_ENABLE([random-device],
-       AS_HELP_STRING([--enable-random-device],
-               [device with (strong) randomness (for Nettle)]),
-       NAME_OF_RANDOM_DEVICE=$enableval)
+        AS_HELP_STRING([--enable-random-device],
+                [device with (strong) randomness (for Nettle)]),
+        NAME_OF_RANDOM_DEVICE=$enableval)
   AC_MSG_RESULT([$NAME_OF_RANDOM_DEVICE])
 
   AC_MSG_CHECKING([device with pseudo random data...])
   AC_ARG_ENABLE([pseudo-random-device],
-       AS_HELP_STRING([--enable-pseudo-random-device],
-               [device with pseudo randomness (for Nettle)]),
-       NAME_OF_PSEUDO_RANDOM_DEVICE=$enableval)
+        AS_HELP_STRING([--enable-pseudo-random-device],
+                [device with pseudo randomness (for Nettle)]),
+        NAME_OF_PSEUDO_RANDOM_DEVICE=$enableval)
   AC_MSG_RESULT([$NAME_OF_PSEUDO_RANDOM_DEVICE])
 
   AC_MSG_CHECKING([device with unpredictable data for nonces...])
   AC_ARG_ENABLE([nonce-device],
-       AS_HELP_STRING([--enable-nonce-device],
-               [device with unpredictable nonces (for Nettle)]),
-       NAME_OF_NONCE_DEVICE=$enableval)
+        AS_HELP_STRING([--enable-nonce-device],
+                [device with unpredictable nonces (for Nettle)]),
+        NAME_OF_NONCE_DEVICE=$enableval)
   AC_MSG_RESULT([$NAME_OF_NONCE_DEVICE])
 
   if test "$cross_compiling" != yes; then
@@ -80,7 +80,7 @@ AC_DEFUN([gl_GC_RANDOM],
   AC_DEFINE_UNQUOTED([NAME_OF_RANDOM_DEVICE], ["$NAME_OF_RANDOM_DEVICE"],
                    [defined to the name of the (strong) random device])
   AC_DEFINE_UNQUOTED([NAME_OF_PSEUDO_RANDOM_DEVICE],
-                        "$NAME_OF_PSEUDO_RANDOM_DEVICE",
+                         "$NAME_OF_PSEUDO_RANDOM_DEVICE",
                    [defined to the name of the pseudo random device])
   AC_DEFINE_UNQUOTED([NAME_OF_NONCE_DEVICE], ["$NAME_OF_NONCE_DEVICE"],
                    [defined to the name of the unpredictable nonce device])
diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4
index 4088671..4445072 100644
--- a/gl/m4/getaddrinfo.m4
+++ b/gl/m4/getaddrinfo.m4
@@ -1,4 +1,4 @@
-# getaddrinfo.m4 serial 20
+# getaddrinfo.m4 serial 22
 dnl Copyright (C) 2004-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,
@@ -25,7 +25,7 @@ AC_DEFUN([gl_GETADDRINFO],
   LIBS="$gai_saved_LIBS $GETADDRINFO_LIB"
 
   AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [
-    AC_TRY_LINK([
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 #include <sys/types.h>
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
@@ -34,21 +34,21 @@ AC_DEFUN([gl_GETADDRINFO],
 #include <netdb.h>
 #endif
 #include <stddef.h>
-], [getaddrinfo("", "", NULL, NULL);],
+]], [[getaddrinfo("", "", NULL, NULL);]])],
       [gl_cv_func_getaddrinfo=yes],
       [gl_cv_func_getaddrinfo=no])])
   if test $gl_cv_func_getaddrinfo = no; then
     AC_CACHE_CHECK([for getaddrinfo in ws2tcpip.h and -lws2_32],
-                  gl_cv_w32_getaddrinfo, [
+                   gl_cv_w32_getaddrinfo, [
       gl_cv_w32_getaddrinfo=no
       am_save_LIBS="$LIBS"
       LIBS="$LIBS -lws2_32"
-      AC_TRY_LINK([
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 #ifdef HAVE_WS2TCPIP_H
 #include <ws2tcpip.h>
 #endif
 #include <stddef.h>
-], [getaddrinfo(NULL, NULL, NULL, NULL);], gl_cv_w32_getaddrinfo=yes)
+]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])], [gl_cv_w32_getaddrinfo=yes])
       LIBS="$am_save_LIBS"
     ])
     if test "$gl_cv_w32_getaddrinfo" = "yes"; then
@@ -64,7 +64,7 @@ AC_DEFUN([gl_GETADDRINFO],
   # header included somehow.
   AC_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)],
     gl_cv_func_gai_strerror, [
-      AC_TRY_LINK([
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 #include <sys/types.h>
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
@@ -76,7 +76,7 @@ AC_DEFUN([gl_GETADDRINFO],
 #include <ws2tcpip.h>
 #endif
 #include <stddef.h>
-], [gai_strerror (NULL);],
+]], [[gai_strerror (NULL);]])],
         [gl_cv_func_gai_strerror=yes],
         [gl_cv_func_gai_strerror=no])])
   if test $gl_cv_func_gai_strerror = no; then
@@ -96,6 +96,7 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
   AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
   AC_REQUIRE([gl_HOSTENT]) dnl for HOSTENT_LIB
   AC_REQUIRE([gl_SERVENT]) dnl for SERVENT_LIB
+  AC_REQUIRE([gl_INET_NTOP]) dnl for INET_NTOP_LIB
   AC_REQUIRE([AC_C_RESTRICT])
   AC_REQUIRE([gl_SOCKET_FAMILIES])
   AC_REQUIRE([gl_HEADER_SYS_SOCKET])
@@ -163,4 +164,10 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
     *" $SERVENT_LIB "*) ;;
     *) GETADDRINFO_LIB="$GETADDRINFO_LIB $SERVENT_LIB" ;;
   esac
+
+  dnl Append $INET_NTOP_LIB to GETADDRINFO_LIB, avoiding gratuitous duplicates.
+  case " $GETADDRINFO_LIB " in
+    *" $INET_NTOP_LIB "*) ;;
+    *) GETADDRINFO_LIB="$GETADDRINFO_LIB $INET_NTOP_LIB" ;;
+  esac
 ])
diff --git a/gl/m4/getdate.m4 b/gl/m4/getdate.m4
index 67f9c65..a18bd9c 100644
--- a/gl/m4/getdate.m4
+++ b/gl/m4/getdate.m4
@@ -1,4 +1,4 @@
-# getdate.m4 serial 14
+# getdate.m4 serial 16
 dnl Copyright (C) 2002-2006, 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,
@@ -13,9 +13,9 @@ dnl static variables (even though gcc supports this in 
pre-C99 mode).
 AC_DEFUN([gl_C_COMPOUND_LITERALS],
 [
   AC_CACHE_CHECK([for compound literals], [gl_cv_compound_literals],
-  [AC_TRY_COMPILE([struct s { int i, j; };],
-    [struct s t = (struct s) { 3, 4 };
-     if (t.i != 0) return 0;],
+  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[struct s { int i, j; };]],
+      [[struct s t = (struct s) { 3, 4 };
+        if (t.i != 0) return 0;]])],
     gl_cv_compound_literals=yes,
     gl_cv_compound_literals=no)])
   if test $gl_cv_compound_literals = yes; then
@@ -36,4 +36,18 @@ AC_DEFUN([gl_GETDATE],
   AC_STRUCT_TIMEZONE
   AC_REQUIRE([gl_CLOCK_TIME])
   AC_REQUIRE([gl_TM_GMTOFF])
+  AC_COMPILE_IFELSE(
+    [AC_LANG_SOURCE([[
+#include <time.h> /* for time_t */
+#include <limits.h> /* for CHAR_BIT, LONG_MIN, LONG_MAX */
+#define TYPE_MINIMUM(t) \
+  ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
+#define TYPE_MAXIMUM(t) \
+  ((t) ((t) 0 < (t) -1 ? (t) -1 : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
+typedef int verify_min[2 * (LONG_MIN <= TYPE_MINIMUM (time_t)) - 1];
+typedef int verify_max[2 * (TYPE_MAXIMUM (time_t) <= LONG_MAX) - 1];
+       ]])],
+    [AC_DEFINE([TIME_T_FITS_IN_LONG_INT], [1],
+       [Define to 1 if all 'time_t' values fit in a 'long int'.])
+    ])
 ])
diff --git a/gl/m4/getdelim.m4 b/gl/m4/getdelim.m4
index 7760f82..8ab3839 100644
--- a/gl/m4/getdelim.m4
+++ b/gl/m4/getdelim.m4
@@ -1,6 +1,6 @@
 # getdelim.m4 serial 5
 
-dnl Copyright (C) 2005, 2006, 2007 Free Software dnl Foundation, Inc.
+dnl Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 dnl
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
diff --git a/gl/m4/gethostname.m4 b/gl/m4/gethostname.m4
index 6b6fca9..02ce846 100644
--- a/gl/m4/gethostname.m4
+++ b/gl/m4/gethostname.m4
@@ -1,21 +1,101 @@
-# gethostname.m4 serial 5
+# gethostname.m4 serial 9
 dnl Copyright (C) 2002, 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.
 
+# Ensure
+# - the gethostname() function,
+# - the HOST_NAME_MAX macro in <limits.h>.
 AC_DEFUN([gl_FUNC_GETHOSTNAME],
 [
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
   gl_PREREQ_SYS_H_WINSOCK2
-  AC_REPLACE_FUNCS([gethostname])
-  if test $ac_cv_func_gethostname = no; then
+
+  dnl Where is gethostname() defined?
+  dnl - On native Windows, it is in ws2_32.dll.
+  dnl - Otherwise is is in libc.
+  GETHOSTNAME_LIB=
+  AC_CHECK_FUNCS([gethostname], , [
+    AC_CACHE_CHECK([for gethostname in winsock2.h and -lws2_32],
+      [gl_cv_w32_gethostname],
+      [gl_cv_w32_gethostname=no
+       gl_save_LIBS="$LIBS"
+       LIBS="$LIBS -lws2_32"
+       AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+#include <stddef.h>
+]], [[gethostname(NULL, 0);]])], [gl_cv_w32_gethostname=yes])
+       LIBS="$gl_save_LIBS"
+      ])
+    if test "$gl_cv_w32_gethostname" = "yes"; then
+      GETHOSTNAME_LIB="-lws2_32"
+    fi
+  ])
+  AC_SUBST([GETHOSTNAME_LIB])
+
+  if test "$ac_cv_func_gethostname" = no; then
+    AC_LIBOBJ([gethostname])
     HAVE_GETHOSTNAME=0
     gl_PREREQ_GETHOSTNAME
   fi
+
+  dnl Also provide HOST_NAME_MAX when <limits.h> lacks it.
+  dnl - On most Unix systems, use MAXHOSTNAMELEN from <sys/param.h> instead.
+  dnl - On Solaris, Cygwin, BeOS, use MAXHOSTNAMELEN from <netdb.h> instead.
+  dnl - On mingw, use 256, because
+  dnl   <http://msdn.microsoft.com/en-us/library/ms738527.aspx> says:
+  dnl   "if a buffer of 256 bytes is passed in the name parameter and
+  dnl    the namelen parameter is set to 256, the buffer size will always
+  dnl    be adequate."
+  dnl With this, there is no need to use sysconf (_SC_HOST_NAME_MAX), which
+  dnl is not a compile-time constant.
+  dnl We cannot override <limits.h> using the usual technique, because
+  dnl gl_CHECK_NEXT_HEADERS does not work for <limits.h>. Therefore retrieve
+  dnl the value of HOST_NAME_MAX at configure time.
+  AC_CHECK_HEADERS_ONCE([sys/param.h])
+  AC_CHECK_HEADERS_ONCE([sys/socket.h])
+  AC_CHECK_HEADERS_ONCE([netdb.h])
+  AC_CACHE_CHECK([for HOST_NAME_MAX], [gl_cv_decl_HOST_NAME_MAX], [
+    gl_cv_decl_HOST_NAME_MAX=
+    AC_EGREP_CPP([lucky], [
+#include <limits.h>
+#ifdef HOST_NAME_MAX
+lucky
+#endif
+      ], [gl_cv_decl_HOST_NAME_MAX=yes])
+    if test -z "$gl_cv_decl_HOST_NAME_MAX"; then
+      dnl It's not defined in <limits.h>. Substitute it.
+      if test "$gl_cv_w32_gethostname" = yes; then
+        dnl mingw.
+        gl_cv_decl_HOST_NAME_MAX=256
+      else
+        _AC_COMPUTE_INT([MAXHOSTNAMELEN], [gl_cv_decl_HOST_NAME_MAX], [
+#include <sys/types.h>
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+#if HAVE_NETDB_H
+# include <netdb.h>
+#endif
+])
+      fi
+    fi
+  ])
+  if test "$gl_cv_decl_HOST_NAME_MAX" != yes; then
+    AC_DEFINE_UNQUOTED([HOST_NAME_MAX], [$gl_cv_decl_HOST_NAME_MAX],
+      [Define HOST_NAME_MAX when <limits.h> does not define it.])
+  fi
 ])
 
 # Prerequisites of lib/gethostname.c.
 AC_DEFUN([gl_PREREQ_GETHOSTNAME], [
-  AC_CHECK_FUNCS([uname])
+  if test "$gl_cv_w32_gethostname" != "yes"; then
+    AC_CHECK_FUNCS([uname])
+  fi
 ])
diff --git a/gl/m4/getline.m4 b/gl/m4/getline.m4
index 9993345..fd01a49 100644
--- a/gl/m4/getline.m4
+++ b/gl/m4/getline.m4
@@ -1,4 +1,4 @@
-# getline.m4 serial 19
+# getline.m4 serial 20
 
 dnl Copyright (C) 1998-2003, 2005-2007, 2009 Free Software Foundation, Inc.
 dnl
@@ -23,13 +23,13 @@ AC_DEFUN([gl_FUNC_GETLINE],
 
   gl_getline_needs_run_time_check=no
   AC_CHECK_FUNC([getline],
-               dnl Found it in some library.  Verify that it works.
-               gl_getline_needs_run_time_check=yes,
-               am_cv_func_working_getline=no)
+                dnl Found it in some library.  Verify that it works.
+                gl_getline_needs_run_time_check=yes,
+                am_cv_func_working_getline=no)
   if test $gl_getline_needs_run_time_check = yes; then
     AC_CACHE_CHECK([for working getline function], 
[am_cv_func_working_getline],
     [echo fooN |tr -d '\012'|tr N '\012' > conftest.data
-    AC_TRY_RUN([
+    AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #    include <stdio.h>
 #    include <stdlib.h>
 #    include <string.h>
@@ -40,12 +40,12 @@ AC_DEFUN([gl_FUNC_GETLINE],
       int len;
       FILE *in = fopen ("./conftest.data", "r");
       if (!in)
-       return 1;
+        return 1;
       len = getline (&line, &siz, in);
       exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1);
     }
-    ], am_cv_func_working_getline=yes dnl The library version works.
-    , am_cv_func_working_getline=no dnl The library version does NOT work.
+    ]])], [am_cv_func_working_getline=yes] dnl The library version works.
+    , [am_cv_func_working_getline=no] dnl The library version does NOT work.
     , dnl We're cross compiling. Assume it works on glibc2 systems.
       [AC_EGREP_CPP([Lucky GNU user],
          [
diff --git a/gl/m4/getpagesize.m4 b/gl/m4/getpagesize.m4
deleted file mode 100644
index 0d07a3a..0000000
--- a/gl/m4/getpagesize.m4
+++ /dev/null
@@ -1,29 +0,0 @@
-# getpagesize.m4 serial 7
-dnl Copyright (C) 2002, 2004-2005, 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,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_GETPAGESIZE],
-[
-  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-  AC_REQUIRE([AC_CANONICAL_HOST])
-  AC_CHECK_FUNCS([getpagesize])
-  if test $ac_cv_func_getpagesize = no; then
-    HAVE_GETPAGESIZE=0
-    AC_CHECK_HEADERS([OS.h])
-    if test $ac_cv_header_OS_h = yes; then
-      HAVE_OS_H=1
-    fi
-    AC_CHECK_HEADERS([sys/param.h])
-    if test $ac_cv_header_sys_param_h = yes; then
-      HAVE_SYS_PARAM_H=1
-    fi
-  fi
-  case "$host_os" in
-    mingw*)
-      REPLACE_GETPAGESIZE=1
-      AC_LIBOBJ([getpagesize])
-      ;;
-  esac
-])
diff --git a/gl/m4/gettimeofday.m4 b/gl/m4/gettimeofday.m4
index 0fec7d4..ad51963 100644
--- a/gl/m4/gettimeofday.m4
+++ b/gl/m4/gettimeofday.m4
@@ -17,16 +17,16 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY],
     [gl_cv_func_gettimeofday_posix_signature],
     [AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM(
-         [[#include <sys/time.h>
-           struct timeval c;
-         ]],
-         [[
-           int (*f) (struct timeval *restrict, void *restrict) = gettimeofday;
-           int x = f (&c, 0);
-           return !(x | c.tv_sec | c.tv_usec);
-         ]])],
-       [gl_cv_func_gettimeofday_posix_signature=yes],
-       [gl_cv_func_gettimeofday_posix_signature=no])])
+          [[#include <sys/time.h>
+            struct timeval c;
+          ]],
+          [[
+            int (*f) (struct timeval *restrict, void *restrict) = gettimeofday;
+            int x = f (&c, 0);
+            return !(x | c.tv_sec | c.tv_usec);
+          ]])],
+        [gl_cv_func_gettimeofday_posix_signature=yes],
+        [gl_cv_func_gettimeofday_posix_signature=no])])
 
   gl_FUNC_GETTIMEOFDAY_CLOBBER
 
@@ -56,21 +56,21 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER],
   [gl_cv_func_gettimeofday_clobber],
   [AC_RUN_IFELSE(
      [AC_LANG_PROGRAM(
-       [[#include <string.h>
-         #include <sys/time.h>
-         #include <time.h>
-         #include <stdlib.h>
-       ]],
-       [[
-         time_t t = 0;
-         struct tm *lt;
-         struct tm saved_lt;
-         struct timeval tv;
-         lt = localtime (&t);
-         saved_lt = *lt;
-         gettimeofday (&tv, NULL);
-         return memcmp (lt, &saved_lt, sizeof (struct tm)) != 0;
-       ]])],
+        [[#include <string.h>
+          #include <sys/time.h>
+          #include <time.h>
+          #include <stdlib.h>
+        ]],
+        [[
+          time_t t = 0;
+          struct tm *lt;
+          struct tm saved_lt;
+          struct timeval tv;
+          lt = localtime (&t);
+          saved_lt = *lt;
+          gettimeofday (&tv, NULL);
+          return memcmp (lt, &saved_lt, sizeof (struct tm)) != 0;
+        ]])],
      [gl_cv_func_gettimeofday_clobber=no],
      [gl_cv_func_gettimeofday_clobber=yes],
      dnl When crosscompiling, assume it is broken.
diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4
index c8fda20..63c6300 100644
--- a/gl/m4/gnulib-common.m4
+++ b/gl/m4/gnulib-common.m4
@@ -23,14 +23,17 @@ AC_DEFUN([gl_COMMON_BODY], [
 # define __GNUC_STDC_INLINE__ 1
 #endif])
   AH_VERBATIM([unused_parameter],
-[/* Define as a marker that can be attached to function parameter declarations
-   for parameters that are not used.  This helps to reduce warnings, such as
-   from GCC -Wunused-parameter.  */
+[/* Define as a marker that can be attached to declarations that might not
+    be used.  This helps to reduce warnings, such as from
+    GCC -Wunused-parameter.  */
 #if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _UNUSED_PARAMETER_ __attribute__ ((__unused__))
+# define _GL_UNUSED __attribute__ ((__unused__))
 #else
-# define _UNUSED_PARAMETER_
+# define _GL_UNUSED
 #endif
+/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name
+   is a misnomer outside of parameter lists.  */
+#define _UNUSED_PARAMETER_ _GL_UNUSED
 ])
 ])
 
@@ -70,13 +73,13 @@ AC_DEFUN([AC_C_RESTRICT],
    for ac_kw in __restrict __restrict__ _Restrict restrict; do
      AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
       [[typedef int * int_ptr;
-       int foo (int_ptr $ac_kw ip) {
-       return ip[0];
+        int foo (int_ptr $ac_kw ip) {
+        return ip[0];
        }]],
       [[int s[1];
-       int * $ac_kw t = s;
-       t[0] = 0;
-       return foo(t)]])],
+        int * $ac_kw t = s;
+        t[0] = 0;
+        return foo(t)]])],
       [ac_cv_c_restrict=$ac_kw])
      test "$ac_cv_c_restrict" != no && break
    done
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index 0a29959..c55609a 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -49,7 +49,7 @@ AC_DEFUN([gl_INIT],
   gl_COMMON
   gl_source_base='gl'
 changequote(,)dnl
-LTALLOCA=`echo "$ALLOCA" | sed 's/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'`
+LTALLOCA=`echo "$ALLOCA" | sed -e 's/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'`
 changequote([, ])dnl
 AC_SUBST([LTALLOCA])
   gl_FUNC_ALLOCA
@@ -89,11 +89,15 @@ AC_SUBST([LTALLOCA])
   gl_GC_PBKDF2_SHA1
   gl_GC_RANDOM
   gl_MODULE_INDICATOR([gc-random])
+  gl_FUNC_DUP2
+  gl_UNISTD_MODULE_INDICATOR([dup2])
   gl_ENVIRON
   gl_UNISTD_MODULE_INDICATOR([environ])
   gl_HEADER_ERRNO_H
   gl_FUNC_FCLOSE
   gl_STDIO_MODULE_INDICATOR([fclose])
+  gl_FUNC_FCNTL
+  gl_FCNTL_MODULE_INDICATOR([fcntl])
   gl_FCNTL_H
   gl_FLOAT_H
   gl_FUNC_FSEEKO
@@ -109,8 +113,6 @@ AC_SUBST([LTALLOCA])
   gl_UNISTD_MODULE_INDICATOR([gethostname])
   gl_FUNC_GETLINE
   gl_STDIO_MODULE_INDICATOR([getline])
-  gl_FUNC_GETPAGESIZE
-  gl_UNISTD_MODULE_INDICATOR([getpagesize])
   gl_FUNC_GETPASS
   AC_REQUIRE([gl_HEADER_SYS_SOCKET])
   if test "$ac_cv_header_winsock2_h" = yes; then
@@ -185,11 +187,21 @@ AC_SUBST([LTALLOCA])
   if test "$ac_cv_header_winsock2_h" = yes; then
     AC_LIBOBJ([socket])
   fi
+  # When this module is used, sockets may actually occur as file descriptors,
+  # hence it is worth warning if the modules 'close' and 'ioctl' are not used.
+  m4_ifdef([gl_UNISTD_H_DEFAULTS], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])])
+  m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])])
+  AC_REQUIRE([gl_PREREQ_SYS_H_WINSOCK2])
+  if test "$ac_cv_header_winsock2_h" = yes; then
+    UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1
+    SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1
+  fi
   gl_SYS_SOCKET_MODULE_INDICATOR([socket])
   gl_SOCKETS
   gl_TYPE_SOCKLEN_T
   gl_STDARG_H
   AM_STDBOOL_H
+  gl_STDDEF_H
   gl_STDINT_H
   gl_STDIO_H
   gl_STDLIB_H
@@ -229,8 +241,8 @@ AC_SUBST([LTALLOCA])
   gl_FUNC_VASPRINTF
   gl_STDIO_MODULE_INDICATOR([vasprintf])
   m4_ifdef([AM_XGETTEXT_OPTION],
-    [AM_XGETTEXT_OPTION([--flag=asprintf:2:c-format])
-     AM_XGETTEXT_OPTION([--flag=vasprintf:2:c-format])])
+    [AM_][XGETTEXT_OPTION([--flag=asprintf:2:c-format])
+     AM_][XGETTEXT_OPTION([--flag=vasprintf:2:c-format])])
   AC_SUBST([WARN_CFLAGS])
   gl_WCHAR_H
   gl_XALLOC
@@ -238,7 +250,7 @@ AC_SUBST([LTALLOCA])
   gl_XSTRNDUP
   gl_XVASPRINTF
   m4_ifdef([AM_XGETTEXT_OPTION],
-    [AM_XGETTEXT_OPTION([--flag=xasprintf:1:c-format])])
+    [AM_][XGETTEXT_OPTION([--flag=xasprintf:1:c-format])])
   m4_ifval(gl_LIBSOURCES_LIST, [
     m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ ||
       for gl_file in ]gl_LIBSOURCES_LIST[ ; do
@@ -261,7 +273,7 @@ AC_SUBST([LTALLOCA])
     if test -n "$gl_LIBOBJS"; then
       # Remove the extension.
       sed_drop_objext='s/\.o$//;s/\.obj$//'
-      for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed 
"$sed_drop_objext" | sort | uniq`; do
+      for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e 
"$sed_drop_objext" | sort | uniq`; do
         gl_libobjs="$gl_libobjs $i.$ac_objext"
         gl_ltlibobjs="$gl_ltlibobjs $i.lo"
       done
@@ -300,7 +312,7 @@ AC_SUBST([LTALLOCA])
     if test -n "$gltests_LIBOBJS"; then
       # Remove the extension.
       sed_drop_objext='s/\.o$//;s/\.obj$//'
-      for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed 
"$sed_drop_objext" | sort | uniq`; do
+      for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e 
"$sed_drop_objext" | sort | uniq`; do
         gltests_libobjs="$gltests_libobjs $i.$ac_objext"
         gltests_ltlibobjs="$gltests_ltlibobjs $i.lo"
       done
@@ -367,6 +379,7 @@ AC_DEFUN([gltests_LIBSOURCES], [
 # This macro records the list of files which have been installed by
 # gnulib-tool and may be removed by future gnulib-tool invocations.
 AC_DEFUN([gl_FILE_LIST], [
+  build-aux/arg-nonnull.h
   build-aux/config.rpath
   build-aux/gendocs.sh
   build-aux/gnupload
@@ -398,8 +411,10 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/crc.h
   lib/des.c
   lib/des.h
+  lib/dup2.c
   lib/errno.in.h
   lib/fclose.c
+  lib/fcntl.c
   lib/fcntl.in.h
   lib/float+.h
   lib/float.in.h
@@ -416,7 +431,6 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/getdomainname.c
   lib/gethostname.c
   lib/getline.c
-  lib/getpagesize.c
   lib/getpass.c
   lib/getpass.h
   lib/getpeername.c
@@ -443,6 +457,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/memxor.c
   lib/memxor.h
   lib/minmax.h
+  lib/mktime-internal.h
   lib/mktime.c
   lib/netdb.in.h
   lib/netinet_in.in.h
@@ -470,6 +485,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/sockets.h
   lib/stdarg.in.h
   lib/stdbool.in.h
+  lib/stddef.in.h
   lib/stdint.in.h
   lib/stdio-impl.h
   lib/stdio-write.c
@@ -526,11 +542,14 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/close.m4
   m4/crc.m4
   m4/des.m4
+  m4/dup2.m4
   m4/eealloc.m4
   m4/environ.m4
   m4/errno_h.m4
   m4/extensions.m4
   m4/fclose.m4
+  m4/fcntl-o.m4
+  m4/fcntl.m4
   m4/fcntl_h.m4
   m4/float_h.m4
   m4/fseeko.m4
@@ -548,7 +567,6 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/getdomainname.m4
   m4/gethostname.m4
   m4/getline.m4
-  m4/getpagesize.m4
   m4/getpass.m4
   m4/getsubopt.m4
   m4/gettime.m4
@@ -598,6 +616,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/sockpfaf.m4
   m4/stdarg.m4
   m4/stdbool.m4
+  m4/stddef_h.m4
   m4/stdint.m4
   m4/stdint_h.m4
   m4/stdio_h.m4
diff --git a/gl/m4/include_next.m4 b/gl/m4/include_next.m4
index 5e22ded..2e6273f 100644
--- a/gl/m4/include_next.m4
+++ b/gl/m4/include_next.m4
@@ -109,11 +109,11 @@ EOF
 # be
 # '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
 # That way, a header file with the following line:
-#      address@hidden@ @NEXT_FOO_H@
+#       address@hidden@ @NEXT_FOO_H@
 # or
-#      address@hidden@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@
+#       address@hidden@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@
 # behaves (after sed substitution) as if it contained
-#      #include_next <foo.h>
+#       #include_next <foo.h>
 # even if the compiler does not support include_next.
 # The three "///" are to pacify Sun C 5.8, which otherwise would say
 # "warning: #include of /usr/include/... may be non-portable".
@@ -129,46 +129,46 @@ AC_DEFUN([gl_CHECK_NEXT_HEADERS],
 
   m4_foreach_w([gl_HEADER_NAME], [$1],
     [AS_VAR_PUSHDEF([gl_next_header],
-                   [gl_cv_next_]m4_defn([gl_HEADER_NAME]))
+                    [gl_cv_next_]m4_defn([gl_HEADER_NAME]))
      if test $gl_cv_have_include_next = yes; then
        AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
      else
        AC_CACHE_CHECK(
-        [absolute name of <]m4_defn([gl_HEADER_NAME])[>],
-        m4_defn([gl_next_header]),
-        [AS_VAR_PUSHDEF([gl_header_exists],
-                        [ac_cv_header_]m4_defn([gl_HEADER_NAME]))
-         if test AS_VAR_GET(gl_header_exists) = yes; then
-           AC_LANG_CONFTEST(
-             [AC_LANG_SOURCE(
-                [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
-              )])
-           dnl AIX "xlc -E" and "cc -E" omit #line directives for header files
-           dnl that contain only a #include of other header files and no
-           dnl non-comment tokens of their own. This leads to a failure to
-           dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h>
-           dnl and others. The workaround is to force preservation of comments
-           dnl through option -C. This ensures all necessary #line directives
-           dnl are present. GCC supports option -C as well.
-           case "$host_os" in
-             aix*) gl_absname_cpp="$ac_cpp -C" ;;
-             *)    gl_absname_cpp="$ac_cpp" ;;
-           esac
-           dnl eval is necessary to expand gl_absname_cpp.
-           dnl Ultrix and Pyramid sh refuse to redirect output of eval,
-           dnl so use subshell.
-           AS_VAR_SET([gl_next_header],
-             ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 
2>&AS_MESSAGE_LOG_FD |
-              sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{
-                s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1#
-                s#^/[^/]#//&#
-                p
-                q
-              }'`'"'])
-         else
-           AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
-         fi
-         AS_VAR_POPDEF([gl_header_exists])])
+         [absolute name of <]m4_defn([gl_HEADER_NAME])[>],
+         m4_defn([gl_next_header]),
+         [AS_VAR_PUSHDEF([gl_header_exists],
+                         [ac_cv_header_]m4_defn([gl_HEADER_NAME]))
+          if test AS_VAR_GET(gl_header_exists) = yes; then
+            AC_LANG_CONFTEST(
+              [AC_LANG_SOURCE(
+                 [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
+               )])
+            dnl AIX "xlc -E" and "cc -E" omit #line directives for header files
+            dnl that contain only a #include of other header files and no
+            dnl non-comment tokens of their own. This leads to a failure to
+            dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h>
+            dnl and others. The workaround is to force preservation of comments
+            dnl through option -C. This ensures all necessary #line directives
+            dnl are present. GCC supports option -C as well.
+            case "$host_os" in
+              aix*) gl_absname_cpp="$ac_cpp -C" ;;
+              *)    gl_absname_cpp="$ac_cpp" ;;
+            esac
+            dnl eval is necessary to expand gl_absname_cpp.
+            dnl Ultrix and Pyramid sh refuse to redirect output of eval,
+            dnl so use subshell.
+            AS_VAR_SET([gl_next_header],
+              ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 
2>&AS_MESSAGE_LOG_FD |
+               sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{
+                 s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1#
+                 s#^/[^/]#//&#
+                 p
+                 q
+               }'`'"'])
+          else
+            AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
+          fi
+          AS_VAR_POPDEF([gl_header_exists])])
      fi
      AC_SUBST(
        AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])),
diff --git a/gl/m4/inet_ntop.m4 b/gl/m4/inet_ntop.m4
index 2bbdca1..2a8ff20 100644
--- a/gl/m4/inet_ntop.m4
+++ b/gl/m4/inet_ntop.m4
@@ -1,4 +1,4 @@
-# inet_ntop.m4 serial 9
+# inet_ntop.m4 serial 11
 dnl Copyright (C) 2005, 2006, 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,
@@ -11,17 +11,18 @@ AC_DEFUN([gl_INET_NTOP],
 
   gl_REPLACE_ARPA_INET_H
 
-  dnl The AC_SEARCH_LIBS call is a hack to persuade the Solaris 8 linker to
-  dnl find inet_ntop.
-  dnl
-  dnl It is the responsibility of gl_INET_NTOP's caller to arrange for
-  dnl -lnsl if it is needed.  Normally -lnsl is not needed on Solaris 8,
-  dnl since inet_ntop is needed only by getaddrinfo, and getaddrinfo
-  dnl isn't built on Solaris 8.
+  dnl Most platforms that provide inet_ntop define it in libc.
+  dnl Solaris 8..10 provide inet_ntop in libnsl instead.
   gl_save_LIBS=$LIBS
   AC_SEARCH_LIBS([inet_ntop], [nsl], [],
     [AC_REPLACE_FUNCS([inet_ntop])])
   LIBS=$gl_save_LIBS
+  INET_NTOP_LIB=
+  if test "$ac_cv_search_inet_ntop" != "no" &&
+     test "$ac_cv_search_inet_ntop" != "none required"; then
+    INET_NTOP_LIB="$ac_cv_search_inet_ntop"
+  fi
+  AC_SUBST([INET_NTOP_LIB])
 
   gl_PREREQ_INET_NTOP
 ])
diff --git a/gl/m4/ld-version-script.m4 b/gl/m4/ld-version-script.m4
index a97888f..43b725b 100644
--- a/gl/m4/ld-version-script.m4
+++ b/gl/m4/ld-version-script.m4
@@ -27,7 +27,7 @@ AC_DEFUN([gl_LD_VERSION_SCRIPT],
     LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
     cat > conftest.map <<EOF
 VERS_1 {
-       global: sym;
+        global: sym;
 };
 
 VERS_2 {
diff --git a/gl/m4/lib-ld.m4 b/gl/m4/lib-ld.m4
index e4863f2..4b4db07 100644
--- a/gl/m4/lib-ld.m4
+++ b/gl/m4/lib-ld.m4
@@ -59,7 +59,7 @@ if test "$GCC" = yes; then
       # Canonicalize the path of ld
       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
-       ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+        ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
       done
       test -z "$LD" && LD="$ac_prog"
       ;;
@@ -89,9 +89,9 @@ AC_CACHE_VAL([acl_cv_path_LD],
       # Break only if it was the GNU/non-GNU ld that we prefer.
       case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
       *GNU* | *'with BFD'*)
-       test "$with_gnu_ld" != no && break ;;
+        test "$with_gnu_ld" != no && break ;;
       *)
-       test "$with_gnu_ld" != yes && break ;;
+        test "$with_gnu_ld" != yes && break ;;
       esac
     fi
   done
diff --git a/gl/m4/longlong.m4 b/gl/m4/longlong.m4
index eedc8d5..6d17ea3 100644
--- a/gl/m4/longlong.m4
+++ b/gl/m4/longlong.m4
@@ -20,30 +20,30 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT],
     [AC_LINK_IFELSE(
        [_AC_TYPE_LONG_LONG_SNIPPET],
        [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
-       dnl If cross compiling, assume the bug isn't important, since
-       dnl nobody cross compiles for this platform as far as we know.
-       AC_RUN_IFELSE(
-         [AC_LANG_PROGRAM(
-            address@hidden:@include <limits.h>
-              @%:@ifndef LLONG_MAX
-              @%:@ define HALF \
-                       (1LL << (sizeof (long long int) * CHAR_BIT - 2))
-              @%:@ define LLONG_MAX (HALF - 1 + HALF)
-              @%:@endif]],
-            [[long long int n = 1;
-              int i;
-              for (i = 0; ; i++)
-                {
-                  long long int m = n << i;
-                  if (m >> i != n)
-                    return 1;
-                  if (LLONG_MAX / 2 < m)
-                    break;
-                }
-              return 0;]])],
-         [ac_cv_type_long_long_int=yes],
-         [ac_cv_type_long_long_int=no],
-         [ac_cv_type_long_long_int=yes])],
+        dnl If cross compiling, assume the bug isn't important, since
+        dnl nobody cross compiles for this platform as far as we know.
+        AC_RUN_IFELSE(
+          [AC_LANG_PROGRAM(
+             address@hidden:@include <limits.h>
+               @%:@ifndef LLONG_MAX
+               @%:@ define HALF \
+                        (1LL << (sizeof (long long int) * CHAR_BIT - 2))
+               @%:@ define LLONG_MAX (HALF - 1 + HALF)
+               @%:@endif]],
+             [[long long int n = 1;
+               int i;
+               for (i = 0; ; i++)
+                 {
+                   long long int m = n << i;
+                   if (m >> i != n)
+                     return 1;
+                   if (LLONG_MAX / 2 < m)
+                     break;
+                 }
+               return 0;]])],
+          [ac_cv_type_long_long_int=yes],
+          [ac_cv_type_long_long_int=no],
+          [ac_cv_type_long_long_int=yes])],
        [ac_cv_type_long_long_int=no])])
   if test $ac_cv_type_long_long_int = yes; then
     AC_DEFINE([HAVE_LONG_LONG_INT], [1],
@@ -83,24 +83,24 @@ AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
 [
   AC_LANG_PROGRAM(
     [[/* For now, do not test the preprocessor; as of 2007 there are too many
-        implementations with broken preprocessors.  Perhaps this can
-        be revisited in 2012.  In the meantime, code should not expect
-        #if to work with literals wider than 32 bits.  */
+         implementations with broken preprocessors.  Perhaps this can
+         be revisited in 2012.  In the meantime, code should not expect
+         #if to work with literals wider than 32 bits.  */
       /* Test literals.  */
       long long int ll = 9223372036854775807ll;
       long long int nll = -9223372036854775807LL;
       unsigned long long int ull = 18446744073709551615ULL;
       /* Test constant expressions.   */
       typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
-                    ? 1 : -1)];
+                     ? 1 : -1)];
       typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
-                    ? 1 : -1)];
+                     ? 1 : -1)];
       int i = 63;]],
     [[/* Test availability of runtime routines for shift and division.  */
       long long int llmax = 9223372036854775807ll;
       unsigned long long int ullmax = 18446744073709551615ull;
       return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
-             | (llmax / ll) | (llmax % ll)
-             | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
-             | (ullmax / ull) | (ullmax % ull));]])
+              | (llmax / ll) | (llmax % ll)
+              | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
+              | (ullmax / ull) | (ullmax % ull));]])
 ])
diff --git a/gl/m4/lseek.m4 b/gl/m4/lseek.m4
index f336990..b40da70 100644
--- a/gl/m4/lseek.m4
+++ b/gl/m4/lseek.m4
@@ -19,21 +19,21 @@ int main ()
   /* Exit with success only if stdin is seekable.  */
   return lseek (0, (off_t)0, SEEK_CUR) < 0;
 }],
-        [if test -s conftest$ac_exeext \
-            && ./conftest$ac_exeext < conftest.$ac_ext \
-            && { echo hi | ./conftest$ac_exeext; test $? = 1; }; then
-           gl_cv_func_lseek_pipe=yes
-         else
-           gl_cv_func_lseek_pipe=no
-         fi],
-        [gl_cv_func_lseek_pipe=no])
+         [if test -s conftest$ac_exeext \
+             && ./conftest$ac_exeext < conftest.$ac_ext \
+             && { echo hi | ./conftest$ac_exeext; test $? = 1; }; then
+            gl_cv_func_lseek_pipe=yes
+          else
+            gl_cv_func_lseek_pipe=no
+          fi],
+         [gl_cv_func_lseek_pipe=no])
      else
        AC_COMPILE_IFELSE([
 #if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) || defined 
__BEOS__
 /* mingw and BeOS mistakenly return 0 when trying to seek on pipes.  */
   Choke me.
 #endif],
-        [gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no])
+         [gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no])
      fi])
   if test $gl_cv_func_lseek_pipe = no; then
     gl_REPLACE_LSEEK
@@ -46,5 +46,5 @@ AC_DEFUN([gl_REPLACE_LSEEK],
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
   REPLACE_LSEEK=1
   AC_DEFINE([LSEEK_PIPE_BROKEN], [1],
-           [Define to 1 if lseek does not detect pipes.])
+            [Define to 1 if lseek does not detect pipes.])
 ])
diff --git a/gl/m4/memchr.m4 b/gl/m4/memchr.m4
index 1194bac..81531ca 100644
--- a/gl/m4/memchr.m4
+++ b/gl/m4/memchr.m4
@@ -53,11 +53,11 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
     {
       int pagesize = getpagesize ();
       char *two_pages =
-       (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
-                      flags, fd, 0);
+        (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
+                       flags, fd, 0);
       if (two_pages != (char *)(-1)
-         && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
-       fence = two_pages + pagesize;
+          && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
+        fence = two_pages + pagesize;
     }
 #endif
   if (fence)
diff --git a/gl/m4/mktime.m4 b/gl/m4/mktime.m4
index 1e926e8..bea8782 100644
--- a/gl/m4/mktime.m4
+++ b/gl/m4/mktime.m4
@@ -85,8 +85,8 @@ static int
 mktime_test (time_t now)
 {
   return (mktime_test1 (now)
-         && mktime_test1 ((time_t) (time_t_max - now))
-         && mktime_test1 ((time_t) (time_t_min + now)));
+          && mktime_test1 ((time_t) (time_t_max - now))
+          && mktime_test1 ((time_t) (time_t_min + now)));
 }
 
 static int
@@ -116,17 +116,17 @@ bigtime_test (int j)
     {
       struct tm *lt = localtime (&now);
       if (! (lt
-            && lt->tm_year == tm.tm_year
-            && lt->tm_mon == tm.tm_mon
-            && lt->tm_mday == tm.tm_mday
-            && lt->tm_hour == tm.tm_hour
-            && lt->tm_min == tm.tm_min
-            && lt->tm_sec == tm.tm_sec
-            && lt->tm_yday == tm.tm_yday
-            && lt->tm_wday == tm.tm_wday
-            && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
-                 == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
-       return 0;
+             && lt->tm_year == tm.tm_year
+             && lt->tm_mon == tm.tm_mon
+             && lt->tm_mday == tm.tm_mday
+             && lt->tm_hour == tm.tm_hour
+             && lt->tm_min == tm.tm_min
+             && lt->tm_sec == tm.tm_sec
+             && lt->tm_yday == tm.tm_yday
+             && lt->tm_wday == tm.tm_wday
+             && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
+                  == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
+        return 0;
     }
   return 1;
 }
@@ -158,7 +158,7 @@ year_2050_test ()
      to the correct answer that we can assume the discrepancy is
      due to leap seconds.  */
   return (t == (time_t) -1
-         || (0 < t && answer - 120 <= t && t <= answer + 120));
+          || (0 < t && answer - 120 <= t && t <= answer + 120));
 }
 
 int
@@ -176,7 +176,7 @@ main ()
     {
       t = (time_t_max << 1) + 1;
       if (t <= time_t_max)
-       break;
+        break;
       time_t_max = t;
     }
   time_t_min = - ((time_t) ~ (time_t) 0 == (time_t) -1) - time_t_max;
@@ -185,29 +185,29 @@ main ()
   for (i = 0; i < N_STRINGS; i++)
     {
       if (tz_strings[i])
-       putenv (tz_strings[i]);
+        putenv (tz_strings[i]);
 
       for (t = 0; t <= time_t_max - delta; t += delta)
-       if (! mktime_test (t))
-         return 1;
+        if (! mktime_test (t))
+          return 1;
       if (! (mktime_test ((time_t) 1)
-            && mktime_test ((time_t) (60 * 60))
-            && mktime_test ((time_t) (60 * 60 * 24))))
-       return 1;
+             && mktime_test ((time_t) (60 * 60))
+             && mktime_test ((time_t) (60 * 60 * 24))))
+        return 1;
 
       for (j = 1; ; j <<= 1)
-       if (! bigtime_test (j))
-         return 1;
-       else if (INT_MAX / 2 < j)
-         break;
+        if (! bigtime_test (j))
+          return 1;
+        else if (INT_MAX / 2 < j)
+          break;
       if (! bigtime_test (INT_MAX))
-       return 1;
+        return 1;
     }
   return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ());
 }]])],
-              [ac_cv_func_working_mktime=yes],
-              [ac_cv_func_working_mktime=no],
-              [ac_cv_func_working_mktime=no])])
+               [ac_cv_func_working_mktime=yes],
+               [ac_cv_func_working_mktime=no],
+               [ac_cv_func_working_mktime=no])])
 if test $ac_cv_func_working_mktime = no; then
   AC_LIBOBJ([mktime])
 fi
@@ -215,12 +215,14 @@ fi
 
 AC_DEFUN([gl_FUNC_MKTIME],
 [
+  AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
   AC_FUNC_MKTIME
   dnl Note: AC_FUNC_MKTIME does AC_LIBOBJ([mktime]).
   if test $ac_cv_func_working_mktime = no; then
-    AC_DEFINE([mktime], [rpl_mktime],
-      [Define to rpl_mktime if the replacement function should be used.])
+    REPLACE_MKTIME=1
     gl_PREREQ_MKTIME
+  else
+    REPLACE_MKTIME=0
   fi
 ])
 
diff --git a/gl/m4/select.m4 b/gl/m4/select.m4
index 5397df0..d801c38 100644
--- a/gl/m4/select.m4
+++ b/gl/m4/select.m4
@@ -1,4 +1,4 @@
-# select.m4 serial 1
+# select.m4 serial 3
 dnl Copyright (C) 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,
@@ -8,6 +8,7 @@ AC_DEFUN([gl_FUNC_SELECT],
 [
   AC_REQUIRE([gl_HEADER_SYS_SELECT])
   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_REQUIRE([gl_SOCKETS])
   if test "$ac_cv_header_winsock2_h" = yes; then
     AC_LIBOBJ([select])
   else
@@ -17,7 +18,7 @@ AC_DEFUN([gl_FUNC_SELECT],
     AC_CACHE_CHECK([whether select supports a 0 argument],
       [gl_cv_func_select_supports0],
       [
-        AC_TRY_RUN([
+        AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #include <sys/types.h>
 #include <sys/time.h>
 #if HAVE_SYS_SELECT_H
@@ -29,7 +30,7 @@ int main ()
   timeout.tv_sec = 0;
   timeout.tv_usec = 5;
   return select (0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &timeout) < 0;
-}], [gl_cv_func_select_supports0=yes], [gl_cv_func_select_supports0=no],
+}]])], [gl_cv_func_select_supports0=yes], [gl_cv_func_select_supports0=no],
           [
 changequote(,)dnl
            case "$host_os" in
diff --git a/gl/m4/setenv.m4 b/gl/m4/setenv.m4
index e28407e..a4cfb9e 100644
--- a/gl/m4/setenv.m4
+++ b/gl/m4/setenv.m4
@@ -1,4 +1,4 @@
-# setenv.m4 serial 11
+# setenv.m4 serial 15
 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 ("", "", 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 ((char *) "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/sockets.m4 b/gl/m4/sockets.m4
index db71bf1..3edc010 100644
--- a/gl/m4/sockets.m4
+++ b/gl/m4/sockets.m4
@@ -1,4 +1,4 @@
-# sockets.m4 serial 5
+# sockets.m4 serial 6
 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,
@@ -16,14 +16,14 @@ AC_DEFUN([gl_SOCKETS],
                    [gl_cv_func_wsastartup], [
       gl_save_LIBS="$LIBS"
       LIBS="$LIBS -lws2_32"
-      AC_TRY_LINK([
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 #ifdef HAVE_WINSOCK2_H
 # include <winsock2.h>
-#endif], [
-        WORD wVersionRequested = MAKEWORD(1, 1);
-        WSADATA wsaData;
-        int err = WSAStartup(wVersionRequested, &wsaData);
-        WSACleanup ();],
+#endif]], [[
+          WORD wVersionRequested = MAKEWORD(1, 1);
+          WSADATA wsaData;
+          int err = WSAStartup(wVersionRequested, &wsaData);
+          WSACleanup ();]])],
         gl_cv_func_wsastartup=yes, gl_cv_func_wsastartup=no)
       LIBS="$gl_save_LIBS"
     ])
@@ -38,35 +38,35 @@ AC_DEFUN([gl_SOCKETS],
     dnl BeOS has most socket functions in libnet.
     AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [
       gl_cv_lib_socket=
-      AC_TRY_LINK([extern
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
 #ifdef __cplusplus
 "C"
 #endif
-char setsockopt();], [setsockopt();],
+char setsockopt();]], [[setsockopt();]])],
         [],
         [gl_save_LIBS="$LIBS"
          LIBS="$gl_save_LIBS -lsocket"
-         AC_TRY_LINK([extern
+         AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
 #ifdef __cplusplus
 "C"
 #endif
-char setsockopt();], [setsockopt();],
+char setsockopt();]], [[setsockopt();]])],
            [gl_cv_lib_socket="-lsocket"])
          if test -z "$gl_cv_lib_socket"; then
            LIBS="$gl_save_LIBS -lnetwork"
-           AC_TRY_LINK([extern
+           AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
 #ifdef __cplusplus
 "C"
 #endif
-char setsockopt();], [setsockopt();],
+char setsockopt();]], [[setsockopt();]])],
              [gl_cv_lib_socket="-lnetwork"])
            if test -z "$gl_cv_lib_socket"; then
              LIBS="$gl_save_LIBS -lnet"
-             AC_TRY_LINK([extern
+             AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
 #ifdef __cplusplus
 "C"
 #endif
-char setsockopt();], [setsockopt();],
+char setsockopt();]], [[setsockopt();]])],
                [gl_cv_lib_socket="-lnet"])
            fi
          fi
diff --git a/gl/m4/socklen.m4 b/gl/m4/socklen.m4
index b755757..36436ed 100644
--- a/gl/m4/socklen.m4
+++ b/gl/m4/socklen.m4
@@ -1,5 +1,5 @@
-# socklen.m4 serial 6
-dnl Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+# socklen.m4 serial 7
+dnl Copyright (C) 2005, 2006, 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.
@@ -20,30 +20,30 @@ AC_DEFUN([gl_TYPE_SOCKLEN_T],
    AC_CHECK_TYPE([socklen_t], ,
      [AC_MSG_CHECKING([for socklen_t equivalent])
       AC_CACHE_VAL([gl_cv_socklen_t_equiv],
-       [# Systems have either "struct sockaddr *" or
-        # "void *" as the second argument to getpeername
-        gl_cv_socklen_t_equiv=
-        for arg2 in "struct sockaddr" void; do
-          for t in int size_t "unsigned int" "long int" "unsigned long int"; do
-            AC_TRY_COMPILE(
-              [#include <sys/types.h>
-               #include <sys/socket.h>
+        [# Systems have either "struct sockaddr *" or
+         # "void *" as the second argument to getpeername
+         gl_cv_socklen_t_equiv=
+         for arg2 in "struct sockaddr" void; do
+           for t in int size_t "unsigned int" "long int" "unsigned long int"; 
do
+             AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+                 [[#include <sys/types.h>
+                   #include <sys/socket.h>
 
-               int getpeername (int, $arg2 *, $t *);],
-              [$t len;
-               getpeername (0, 0, &len);],
-              [gl_cv_socklen_t_equiv="$t"])
-            test "$gl_cv_socklen_t_equiv" != "" && break
-          done
-          test "$gl_cv_socklen_t_equiv" != "" && break
-        done
+                   int getpeername (int, $arg2 *, $t *);]],
+                 [[$t len;
+                  getpeername (0, 0, &len);]])],
+               [gl_cv_socklen_t_equiv="$t"])
+             test "$gl_cv_socklen_t_equiv" != "" && break
+           done
+           test "$gl_cv_socklen_t_equiv" != "" && break
+         done
       ])
       if test "$gl_cv_socklen_t_equiv" = ""; then
-       AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
+        AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
       fi
       AC_MSG_RESULT([$gl_cv_socklen_t_equiv])
       AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv],
-       [type to use in place of socklen_t if not defined])],
+        [type to use in place of socklen_t if not defined])],
      [#include <sys/types.h>
       #if HAVE_SYS_SOCKET_H
       # include <sys/socket.h>
diff --git a/gl/m4/sockpfaf.m4 b/gl/m4/sockpfaf.m4
index 99ea06f..bbdfabc 100644
--- a/gl/m4/sockpfaf.m4
+++ b/gl/m4/sockpfaf.m4
@@ -1,4 +1,4 @@
-# sockpfaf.m4 serial 6
+# sockpfaf.m4 serial 7
 dnl Copyright (C) 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,
@@ -18,7 +18,7 @@ AC_DEFUN([gl_SOCKET_FAMILIES],
 
   AC_MSG_CHECKING([for IPv4 sockets])
   AC_CACHE_VAL([gl_cv_socket_ipv4],
-    [AC_TRY_COMPILE([#include <sys/types.h>
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
@@ -27,9 +27,9 @@ AC_DEFUN([gl_SOCKET_FAMILIES],
 #endif
 #ifdef HAVE_WINSOCK2_H
 #include <winsock2.h>
-#endif],
-[int x = AF_INET; struct in_addr y; struct sockaddr_in z;
- if (&x && &y && &z) return 0;],
+#endif]],
+[[int x = AF_INET; struct in_addr y; struct sockaddr_in z;
+ if (&x && &y && &z) return 0;]])],
        gl_cv_socket_ipv4=yes, gl_cv_socket_ipv4=no)])
   AC_MSG_RESULT([$gl_cv_socket_ipv4])
   if test $gl_cv_socket_ipv4 = yes; then
@@ -38,7 +38,7 @@ AC_DEFUN([gl_SOCKET_FAMILIES],
 
   AC_MSG_CHECKING([for IPv6 sockets])
   AC_CACHE_VAL([gl_cv_socket_ipv6],
-    [AC_TRY_COMPILE([#include <sys/types.h>
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
@@ -47,9 +47,9 @@ AC_DEFUN([gl_SOCKET_FAMILIES],
 #endif
 #ifdef HAVE_WINSOCK2_H
 #include <winsock2.h>
-#endif],
-[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z;
- if (&x && &y && &z) return 0;],
+#endif]],
+[[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z;
+ if (&x && &y && &z) return 0;]])],
        gl_cv_socket_ipv6=yes, gl_cv_socket_ipv6=no)])
   AC_MSG_RESULT([$gl_cv_socket_ipv6])
   if test $gl_cv_socket_ipv6 = yes; then
diff --git a/gl/m4/stdbool.m4 b/gl/m4/stdbool.m4
index 57c804a..5e22d7a 100644
--- a/gl/m4/stdbool.m4
+++ b/gl/m4/stdbool.m4
@@ -38,77 +38,77 @@ AC_DEFUN([AC_HEADER_STDBOOL],
   [AC_CACHE_CHECK([for stdbool.h that conforms to C99],
      [ac_cv_header_stdbool_h],
      [AC_TRY_COMPILE(
-       [
-         #include <stdbool.h>
-         #ifndef bool
-          "error: bool is not defined"
-         #endif
-         #ifndef false
-          "error: false is not defined"
-         #endif
-         #if false
-          "error: false is not 0"
-         #endif
-         #ifndef true
-          "error: true is not defined"
-         #endif
-         #if true != 1
-          "error: true is not 1"
-         #endif
-         #ifndef __bool_true_false_are_defined
-          "error: __bool_true_false_are_defined is not defined"
-         #endif
+        [
+          #include <stdbool.h>
+          #ifndef bool
+           "error: bool is not defined"
+          #endif
+          #ifndef false
+           "error: false is not defined"
+          #endif
+          #if false
+           "error: false is not 0"
+          #endif
+          #ifndef true
+           "error: true is not defined"
+          #endif
+          #if true != 1
+           "error: true is not 1"
+          #endif
+          #ifndef __bool_true_false_are_defined
+           "error: __bool_true_false_are_defined is not defined"
+          #endif
 
-         struct s { _Bool s: 1; _Bool t; } s;
+          struct s { _Bool s: 1; _Bool t; } s;
 
-         char a[true == 1 ? 1 : -1];
-         char b[false == 0 ? 1 : -1];
-         char c[__bool_true_false_are_defined == 1 ? 1 : -1];
-         char d[(bool) 0.5 == true ? 1 : -1];
-         bool e = &s;
-         char f[(_Bool) 0.0 == false ? 1 : -1];
-         char g[true];
-         char h[sizeof (_Bool)];
-         char i[sizeof s.t];
-         enum { j = false, k = true, l = false * true, m = true * 256 };
-         _Bool n[m];
-         char o[sizeof n == m * sizeof n[0] ? 1 : -1];
-         char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
-         #if defined __xlc__ || defined __GNUC__
-          /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
-             reported by James Lemley on 2005-10-05; see
-             
http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
-             This test is not quite right, since xlc is allowed to
-             reject this program, as the initializer for xlcbug is
-             not one of the forms that C requires support for.
-             However, doing the test right would require a run-time
-             test, and that would make cross-compilation harder.
-             Let us hope that IBM fixes the xlc bug, and also adds
-             support for this kind of constant expression.  In the
-             meantime, this test will reject xlc, which is OK, since
-             our stdbool.h substitute should suffice.  We also test
-             this with GCC, where it should work, to detect more
-             quickly whether someone messes up the test in the
-             future.  */
-          char digs[] = "0123456789";
-          int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
-         #endif
-         /* Catch a bug in an HP-UX C compiler.  See
-            http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
-            
http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
-          */
-         _Bool q = true;
-         _Bool *pq = &q;
-       ],
-       [
-         *pq |= q;
-         *pq |= ! q;
-         /* Refer to every declared value, to avoid compiler optimizations.  */
-         return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
-                 + !m + !n + !o + !p + !q + !pq);
-       ],
-       [ac_cv_header_stdbool_h=yes],
-       [ac_cv_header_stdbool_h=no])])
+          char a[true == 1 ? 1 : -1];
+          char b[false == 0 ? 1 : -1];
+          char c[__bool_true_false_are_defined == 1 ? 1 : -1];
+          char d[(bool) 0.5 == true ? 1 : -1];
+          bool e = &s;
+          char f[(_Bool) 0.0 == false ? 1 : -1];
+          char g[true];
+          char h[sizeof (_Bool)];
+          char i[sizeof s.t];
+          enum { j = false, k = true, l = false * true, m = true * 256 };
+          _Bool n[m];
+          char o[sizeof n == m * sizeof n[0] ? 1 : -1];
+          char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
+          #if defined __xlc__ || defined __GNUC__
+           /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
+              reported by James Lemley on 2005-10-05; see
+              
http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
+              This test is not quite right, since xlc is allowed to
+              reject this program, as the initializer for xlcbug is
+              not one of the forms that C requires support for.
+              However, doing the test right would require a run-time
+              test, and that would make cross-compilation harder.
+              Let us hope that IBM fixes the xlc bug, and also adds
+              support for this kind of constant expression.  In the
+              meantime, this test will reject xlc, which is OK, since
+              our stdbool.h substitute should suffice.  We also test
+              this with GCC, where it should work, to detect more
+              quickly whether someone messes up the test in the
+              future.  */
+           char digs[] = "0123456789";
+           int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
+          #endif
+          /* Catch a bug in an HP-UX C compiler.  See
+             http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+             
http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+           */
+          _Bool q = true;
+          _Bool *pq = &q;
+        ],
+        [
+          *pq |= q;
+          *pq |= ! q;
+          /* Refer to every declared value, to avoid compiler optimizations.  
*/
+          return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
+                  + !m + !n + !o + !p + !q + !pq);
+        ],
+        [ac_cv_header_stdbool_h=yes],
+        [ac_cv_header_stdbool_h=no])])
    AC_CHECK_TYPES([_Bool])
    if test $ac_cv_header_stdbool_h = yes; then
      AC_DEFINE([HAVE_STDBOOL_H], [1], [Define to 1 if stdbool.h conforms to 
C99.])
diff --git a/gl/m4/stddef_h.m4 b/gl/m4/stddef_h.m4
new file mode 100644
index 0000000..682e9c6
--- /dev/null
+++ b/gl/m4/stddef_h.m4
@@ -0,0 +1,45 @@
+dnl A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues.
+# stddef_h.m4 serial 1
+dnl Copyright (C) 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_STDDEF_H],
+[
+  AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
+  AC_REQUIRE([gt_TYPE_WCHAR_T])
+  if test $gt_cv_c_wchar_t = no; then
+    HAVE_WCHAR_T=0
+    STDDEF_H=stddef.h
+  fi
+  AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions],
+    [gl_cv_decl_null_works],
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h>
+      int test[2 * (sizeof NULL == sizeof (void *)) -1];
+]])],
+      [gl_cv_decl_null_works=yes],
+      [gl_cv_decl_null_works=no])])
+  if test $gl_cv_decl_null_works = no; then
+    REPLACE_NULL=1
+    STDDEF_H=stddef.h
+  fi
+  if test -n "$STDDEF_H"; then
+    gl_CHECK_NEXT_HEADERS([stddef.h])
+  fi
+])
+
+AC_DEFUN([gl_STDDEF_MODULE_INDICATOR],
+[
+  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+  AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
+  
GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
+])
+
+AC_DEFUN([gl_STDDEF_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  REPLACE_NULL=0;                AC_SUBST([REPLACE_NULL])
+  HAVE_WCHAR_T=1;                AC_SUBST([HAVE_WCHAR_T])
+  STDDEF_H='';                   AC_SUBST([STDDEF_H])
+])
diff --git a/gl/m4/stdint.m4 b/gl/m4/stdint.m4
index a2e8bdd..819d629 100644
--- a/gl/m4/stdint.m4
+++ b/gl/m4/stdint.m4
@@ -396,12 +396,12 @@ AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
        for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do
          case $glsuf in
            '')  gltype1='int';;
-           l)  gltype1='long int';;
-           ll) gltype1='long long int';;
-           i64)        gltype1='__int64';;
-           u)  gltype1='unsigned int';;
-           ul) gltype1='unsigned long int';;
-           ull)        gltype1='unsigned long long int';;
+           l)   gltype1='long int';;
+           ll)  gltype1='long long int';;
+           i64) gltype1='__int64';;
+           u)   gltype1='unsigned int';;
+           ul)  gltype1='unsigned long int';;
+           ull) gltype1='unsigned long long int';;
            ui64)gltype1='unsigned __int64';;
          esac
          AC_COMPILE_IFELSE(
diff --git a/gl/m4/stdio_h.m4 b/gl/m4/stdio_h.m4
index fcbe68f..256efe1 100644
--- a/gl/m4/stdio_h.m4
+++ b/gl/m4/stdio_h.m4
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 16
+# stdio_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,78 +41,87 @@ AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
 
 AC_DEFUN([gl_STDIO_H_DEFAULTS],
 [
-  GNULIB_FPRINTF=0;              AC_SUBST([GNULIB_FPRINTF])
-  GNULIB_FPRINTF_POSIX=0;        AC_SUBST([GNULIB_FPRINTF_POSIX])
-  GNULIB_PRINTF=0;               AC_SUBST([GNULIB_PRINTF])
-  GNULIB_PRINTF_POSIX=0;         AC_SUBST([GNULIB_PRINTF_POSIX])
-  GNULIB_SNPRINTF=0;             AC_SUBST([GNULIB_SNPRINTF])
-  GNULIB_SPRINTF_POSIX=0;        AC_SUBST([GNULIB_SPRINTF_POSIX])
-  GNULIB_VFPRINTF=0;             AC_SUBST([GNULIB_VFPRINTF])
-  GNULIB_VFPRINTF_POSIX=0;       AC_SUBST([GNULIB_VFPRINTF_POSIX])
-  GNULIB_VPRINTF=0;              AC_SUBST([GNULIB_VPRINTF])
-  GNULIB_VPRINTF_POSIX=0;        AC_SUBST([GNULIB_VPRINTF_POSIX])
-  GNULIB_VSNPRINTF=0;            AC_SUBST([GNULIB_VSNPRINTF])
-  GNULIB_VSPRINTF_POSIX=0;       AC_SUBST([GNULIB_VSPRINTF_POSIX])
   GNULIB_DPRINTF=0;              AC_SUBST([GNULIB_DPRINTF])
-  GNULIB_VDPRINTF=0;             AC_SUBST([GNULIB_VDPRINTF])
-  GNULIB_VASPRINTF=0;            AC_SUBST([GNULIB_VASPRINTF])
-  GNULIB_OBSTACK_PRINTF=0;       AC_SUBST([GNULIB_OBSTACK_PRINTF])
-  GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX])
+  GNULIB_FCLOSE=0;               AC_SUBST([GNULIB_FCLOSE])
+  GNULIB_FFLUSH=0;               AC_SUBST([GNULIB_FFLUSH])
   GNULIB_FOPEN=0;                AC_SUBST([GNULIB_FOPEN])
+  GNULIB_FPRINTF=0;              AC_SUBST([GNULIB_FPRINTF])
+  GNULIB_FPRINTF_POSIX=0;        AC_SUBST([GNULIB_FPRINTF_POSIX])
+  GNULIB_FPURGE=0;               AC_SUBST([GNULIB_FPURGE])
+  GNULIB_FPUTC=0;                AC_SUBST([GNULIB_FPUTC])
+  GNULIB_FPUTS=0;                AC_SUBST([GNULIB_FPUTS])
   GNULIB_FREOPEN=0;              AC_SUBST([GNULIB_FREOPEN])
   GNULIB_FSEEK=0;                AC_SUBST([GNULIB_FSEEK])
   GNULIB_FSEEKO=0;               AC_SUBST([GNULIB_FSEEKO])
   GNULIB_FTELL=0;                AC_SUBST([GNULIB_FTELL])
   GNULIB_FTELLO=0;               AC_SUBST([GNULIB_FTELLO])
-  GNULIB_FFLUSH=0;               AC_SUBST([GNULIB_FFLUSH])
-  GNULIB_FPURGE=0;               AC_SUBST([GNULIB_FPURGE])
-  GNULIB_FCLOSE=0;               AC_SUBST([GNULIB_FCLOSE])
-  GNULIB_FPUTC=0;                AC_SUBST([GNULIB_FPUTC])
-  GNULIB_PUTC=0;                 AC_SUBST([GNULIB_PUTC])
-  GNULIB_PUTCHAR=0;              AC_SUBST([GNULIB_PUTCHAR])
-  GNULIB_FPUTS=0;                AC_SUBST([GNULIB_FPUTS])
-  GNULIB_PUTS=0;                 AC_SUBST([GNULIB_PUTS])
   GNULIB_FWRITE=0;               AC_SUBST([GNULIB_FWRITE])
   GNULIB_GETDELIM=0;             AC_SUBST([GNULIB_GETDELIM])
   GNULIB_GETLINE=0;              AC_SUBST([GNULIB_GETLINE])
+  GNULIB_OBSTACK_PRINTF=0;       AC_SUBST([GNULIB_OBSTACK_PRINTF])
+  GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX])
   GNULIB_PERROR=0;               AC_SUBST([GNULIB_PERROR])
+  GNULIB_POPEN=0;                AC_SUBST([GNULIB_POPEN])
+  GNULIB_PRINTF=0;               AC_SUBST([GNULIB_PRINTF])
+  GNULIB_PRINTF_POSIX=0;         AC_SUBST([GNULIB_PRINTF_POSIX])
+  GNULIB_PUTC=0;                 AC_SUBST([GNULIB_PUTC])
+  GNULIB_PUTCHAR=0;              AC_SUBST([GNULIB_PUTCHAR])
+  GNULIB_PUTS=0;                 AC_SUBST([GNULIB_PUTS])
+  GNULIB_REMOVE=0;               AC_SUBST([GNULIB_REMOVE])
+  GNULIB_RENAME=0;               AC_SUBST([GNULIB_RENAME])
+  GNULIB_RENAMEAT=0;             AC_SUBST([GNULIB_RENAMEAT])
+  GNULIB_SNPRINTF=0;             AC_SUBST([GNULIB_SNPRINTF])
+  GNULIB_SPRINTF_POSIX=0;        AC_SUBST([GNULIB_SPRINTF_POSIX])
   GNULIB_STDIO_H_SIGPIPE=0;      AC_SUBST([GNULIB_STDIO_H_SIGPIPE])
+  GNULIB_VASPRINTF=0;            AC_SUBST([GNULIB_VASPRINTF])
+  GNULIB_VDPRINTF=0;             AC_SUBST([GNULIB_VDPRINTF])
+  GNULIB_VFPRINTF=0;             AC_SUBST([GNULIB_VFPRINTF])
+  GNULIB_VFPRINTF_POSIX=0;       AC_SUBST([GNULIB_VFPRINTF_POSIX])
+  GNULIB_VPRINTF=0;              AC_SUBST([GNULIB_VPRINTF])
+  GNULIB_VPRINTF_POSIX=0;        AC_SUBST([GNULIB_VPRINTF_POSIX])
+  GNULIB_VSNPRINTF=0;            AC_SUBST([GNULIB_VSNPRINTF])
+  GNULIB_VSPRINTF_POSIX=0;       AC_SUBST([GNULIB_VSPRINTF_POSIX])
   dnl Assume proper GNU behavior unless another module says otherwise.
-  REPLACE_STDIO_WRITE_FUNCS=0;   AC_SUBST([REPLACE_STDIO_WRITE_FUNCS])
-  REPLACE_FPRINTF=0;             AC_SUBST([REPLACE_FPRINTF])
-  REPLACE_VFPRINTF=0;            AC_SUBST([REPLACE_VFPRINTF])
-  REPLACE_PRINTF=0;              AC_SUBST([REPLACE_PRINTF])
-  REPLACE_VPRINTF=0;             AC_SUBST([REPLACE_VPRINTF])
-  REPLACE_SNPRINTF=0;            AC_SUBST([REPLACE_SNPRINTF])
+  HAVE_DECL_FPURGE=1;            AC_SUBST([HAVE_DECL_FPURGE])
+  HAVE_DECL_GETDELIM=1;          AC_SUBST([HAVE_DECL_GETDELIM])
+  HAVE_DECL_GETLINE=1;           AC_SUBST([HAVE_DECL_GETLINE])
+  HAVE_DECL_OBSTACK_PRINTF=1;    AC_SUBST([HAVE_DECL_OBSTACK_PRINTF])
   HAVE_DECL_SNPRINTF=1;          AC_SUBST([HAVE_DECL_SNPRINTF])
-  REPLACE_VSNPRINTF=0;           AC_SUBST([REPLACE_VSNPRINTF])
   HAVE_DECL_VSNPRINTF=1;         AC_SUBST([HAVE_DECL_VSNPRINTF])
-  REPLACE_SPRINTF=0;             AC_SUBST([REPLACE_SPRINTF])
-  REPLACE_VSPRINTF=0;            AC_SUBST([REPLACE_VSPRINTF])
   HAVE_DPRINTF=1;                AC_SUBST([HAVE_DPRINTF])
-  REPLACE_DPRINTF=0;             AC_SUBST([REPLACE_DPRINTF])
-  HAVE_VDPRINTF=1;               AC_SUBST([HAVE_VDPRINTF])
-  REPLACE_VDPRINTF=0;            AC_SUBST([REPLACE_VDPRINTF])
+  HAVE_FSEEKO=1;                 AC_SUBST([HAVE_FSEEKO])
+  HAVE_FTELLO=1;                 AC_SUBST([HAVE_FTELLO])
+  HAVE_RENAMEAT=1;               AC_SUBST([HAVE_RENAMEAT])
   HAVE_VASPRINTF=1;              AC_SUBST([HAVE_VASPRINTF])
-  REPLACE_VASPRINTF=0;           AC_SUBST([REPLACE_VASPRINTF])
-  HAVE_DECL_OBSTACK_PRINTF=1;    AC_SUBST([HAVE_DECL_OBSTACK_PRINTF])
-  REPLACE_OBSTACK_PRINTF=0;      AC_SUBST([REPLACE_OBSTACK_PRINTF])
+  HAVE_VDPRINTF=1;               AC_SUBST([HAVE_VDPRINTF])
+  REPLACE_DPRINTF=0;             AC_SUBST([REPLACE_DPRINTF])
+  REPLACE_FCLOSE=0;              AC_SUBST([REPLACE_FCLOSE])
+  REPLACE_FFLUSH=0;              AC_SUBST([REPLACE_FFLUSH])
   REPLACE_FOPEN=0;               AC_SUBST([REPLACE_FOPEN])
+  REPLACE_FPRINTF=0;             AC_SUBST([REPLACE_FPRINTF])
+  REPLACE_FPURGE=0;              AC_SUBST([REPLACE_FPURGE])
   REPLACE_FREOPEN=0;             AC_SUBST([REPLACE_FREOPEN])
-  HAVE_FSEEKO=1;                 AC_SUBST([HAVE_FSEEKO])
-  REPLACE_FSEEKO=0;              AC_SUBST([REPLACE_FSEEKO])
   REPLACE_FSEEK=0;               AC_SUBST([REPLACE_FSEEK])
-  HAVE_FTELLO=1;                 AC_SUBST([HAVE_FTELLO])
-  REPLACE_FTELLO=0;              AC_SUBST([REPLACE_FTELLO])
+  REPLACE_FSEEKO=0;              AC_SUBST([REPLACE_FSEEKO])
   REPLACE_FTELL=0;               AC_SUBST([REPLACE_FTELL])
-  REPLACE_FFLUSH=0;              AC_SUBST([REPLACE_FFLUSH])
-  REPLACE_FPURGE=0;              AC_SUBST([REPLACE_FPURGE])
-  HAVE_DECL_FPURGE=1;            AC_SUBST([HAVE_DECL_FPURGE])
-  REPLACE_FCLOSE=0;              AC_SUBST([REPLACE_FCLOSE])
-  HAVE_DECL_GETDELIM=1;          AC_SUBST([HAVE_DECL_GETDELIM])
-  HAVE_DECL_GETLINE=1;           AC_SUBST([HAVE_DECL_GETLINE])
+  REPLACE_FTELLO=0;              AC_SUBST([REPLACE_FTELLO])
   REPLACE_GETLINE=0;             AC_SUBST([REPLACE_GETLINE])
+  REPLACE_OBSTACK_PRINTF=0;      AC_SUBST([REPLACE_OBSTACK_PRINTF])
   REPLACE_PERROR=0;              AC_SUBST([REPLACE_PERROR])
+  REPLACE_POPEN=0;               AC_SUBST([REPLACE_POPEN])
+  REPLACE_PRINTF=0;              AC_SUBST([REPLACE_PRINTF])
+  REPLACE_REMOVE=0;              AC_SUBST([REPLACE_REMOVE])
+  REPLACE_RENAME=0;              AC_SUBST([REPLACE_RENAME])
+  REPLACE_RENAMEAT=0;            AC_SUBST([REPLACE_RENAMEAT])
+  REPLACE_SNPRINTF=0;            AC_SUBST([REPLACE_SNPRINTF])
+  REPLACE_SPRINTF=0;             AC_SUBST([REPLACE_SPRINTF])
+  REPLACE_STDIO_WRITE_FUNCS=0;   AC_SUBST([REPLACE_STDIO_WRITE_FUNCS])
+  REPLACE_VASPRINTF=0;           AC_SUBST([REPLACE_VASPRINTF])
+  REPLACE_VDPRINTF=0;            AC_SUBST([REPLACE_VDPRINTF])
+  REPLACE_VFPRINTF=0;            AC_SUBST([REPLACE_VFPRINTF])
+  REPLACE_VPRINTF=0;             AC_SUBST([REPLACE_VPRINTF])
+  REPLACE_VSNPRINTF=0;           AC_SUBST([REPLACE_VSNPRINTF])
+  REPLACE_VSPRINTF=0;            AC_SUBST([REPLACE_VSPRINTF])
 ])
 
 dnl Code shared by fseeko and ftello.  Determine if large files are supported,
@@ -131,6 +140,6 @@ AC_DEFUN([gl_STDIN_LARGE_OFFSET],
   choke me
 # endif
 #endif]])],
-       [gl_cv_var_stdin_large_offset=yes],
-       [gl_cv_var_stdin_large_offset=no])])
+        [gl_cv_var_stdin_large_offset=yes],
+        [gl_cv_var_stdin_large_offset=no])])
 ])
diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4
index b295f16..10e010e 100644
--- a/gl/m4/stdlib_h.m4
+++ b/gl/m4/stdlib_h.m4
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 15
+# 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,
@@ -33,16 +33,21 @@ AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
 
 AC_DEFUN([gl_STDLIB_H_DEFAULTS],
 [
-  GNULIB_MALLOC_POSIX=0;  AC_SUBST([GNULIB_MALLOC_POSIX])
-  GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX])
-  GNULIB_CALLOC_POSIX=0;  AC_SUBST([GNULIB_CALLOC_POSIX])
   GNULIB_ATOLL=0;         AC_SUBST([GNULIB_ATOLL])
+  GNULIB_CALLOC_POSIX=0;  AC_SUBST([GNULIB_CALLOC_POSIX])
+  GNULIB_CANONICALIZE_FILE_NAME=0;  AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME])
   GNULIB_GETLOADAVG=0;    AC_SUBST([GNULIB_GETLOADAVG])
   GNULIB_GETSUBOPT=0;     AC_SUBST([GNULIB_GETSUBOPT])
+  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])
+  GNULIB_REALPATH=0;      AC_SUBST([GNULIB_REALPATH])
   GNULIB_RPMATCH=0;       AC_SUBST([GNULIB_RPMATCH])
   GNULIB_SETENV=0;        AC_SUBST([GNULIB_SETENV])
   GNULIB_STRTOD=0;        AC_SUBST([GNULIB_STRTOD])
@@ -52,11 +57,17 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE_ATOLL=1;              AC_SUBST([HAVE_ATOLL])
   HAVE_CALLOC_POSIX=1;       AC_SUBST([HAVE_CALLOC_POSIX])
+  HAVE_CANONICALIZE_FILE_NAME=1;  AC_SUBST([HAVE_CANONICALIZE_FILE_NAME])
+  HAVE_DECL_GETLOADAVG=1;    AC_SUBST([HAVE_DECL_GETLOADAVG])
   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_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])
   HAVE_RPMATCH=1;            AC_SUBST([HAVE_RPMATCH])
   HAVE_SETENV=1;             AC_SUBST([HAVE_SETENV])
   HAVE_STRTOD=1;             AC_SUBST([HAVE_STRTOD])
@@ -65,9 +76,11 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA])
   HAVE_SYS_LOADAVG_H=0;      AC_SUBST([HAVE_SYS_LOADAVG_H])
   HAVE_UNSETENV=1;           AC_SUBST([HAVE_UNSETENV])
-  HAVE_DECL_GETLOADAVG=1;    AC_SUBST([HAVE_DECL_GETLOADAVG])
+  REPLACE_CANONICALIZE_FILE_NAME=0;  AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME])
   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/string_h.m4 b/gl/m4/string_h.m4
index 11f09c8..e870534 100644
--- a/gl/m4/string_h.m4
+++ b/gl/m4/string_h.m4
@@ -5,7 +5,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 7
+# serial 9
 
 # Written by Paul Eggert.
 
@@ -66,29 +66,31 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
   GNULIB_STRSIGNAL=0;   AC_SUBST([GNULIB_STRSIGNAL])
   GNULIB_STRVERSCMP=0;   AC_SUBST([GNULIB_STRVERSCMP])
   dnl Assume proper GNU behavior unless another module says otherwise.
-  HAVE_DECL_MEMMEM=1;          AC_SUBST([HAVE_DECL_MEMMEM])
-  HAVE_MEMPCPY=1;              AC_SUBST([HAVE_MEMPCPY])
-  HAVE_DECL_MEMRCHR=1;         AC_SUBST([HAVE_DECL_MEMRCHR])
-  HAVE_RAWMEMCHR=1;            AC_SUBST([HAVE_RAWMEMCHR])
-  HAVE_STPCPY=1;               AC_SUBST([HAVE_STPCPY])
-  HAVE_STPNCPY=1;              AC_SUBST([HAVE_STPNCPY])
-  HAVE_STRCHRNUL=1;            AC_SUBST([HAVE_STRCHRNUL])
-  HAVE_DECL_STRDUP=1;          AC_SUBST([HAVE_DECL_STRDUP])
-  HAVE_STRNDUP=1;              AC_SUBST([HAVE_STRNDUP])
-  HAVE_DECL_STRNDUP=1;         AC_SUBST([HAVE_DECL_STRNDUP])
-  HAVE_DECL_STRNLEN=1;         AC_SUBST([HAVE_DECL_STRNLEN])
-  HAVE_STRPBRK=1;              AC_SUBST([HAVE_STRPBRK])
-  HAVE_STRSEP=1;               AC_SUBST([HAVE_STRSEP])
-  HAVE_STRCASESTR=1;           AC_SUBST([HAVE_STRCASESTR])
-  HAVE_DECL_STRTOK_R=1;                AC_SUBST([HAVE_DECL_STRTOK_R])
-  HAVE_DECL_STRERROR=1;                AC_SUBST([HAVE_DECL_STRERROR])
-  HAVE_DECL_STRSIGNAL=1;       AC_SUBST([HAVE_DECL_STRSIGNAL])
-  HAVE_STRVERSCMP=1;           AC_SUBST([HAVE_STRVERSCMP])
-  REPLACE_MEMCHR=0;            AC_SUBST([REPLACE_MEMCHR])
-  REPLACE_MEMMEM=0;            AC_SUBST([REPLACE_MEMMEM])
-  REPLACE_STRDUP=0;            AC_SUBST([REPLACE_STRDUP])
-  REPLACE_STRSTR=0;            AC_SUBST([REPLACE_STRSTR])
-  REPLACE_STRCASESTR=0;                AC_SUBST([REPLACE_STRCASESTR])
-  REPLACE_STRERROR=0;          AC_SUBST([REPLACE_STRERROR])
-  REPLACE_STRSIGNAL=0;         AC_SUBST([REPLACE_STRSIGNAL])
+  HAVE_DECL_MEMMEM=1;           AC_SUBST([HAVE_DECL_MEMMEM])
+  HAVE_MEMPCPY=1;               AC_SUBST([HAVE_MEMPCPY])
+  HAVE_DECL_MEMRCHR=1;          AC_SUBST([HAVE_DECL_MEMRCHR])
+  HAVE_RAWMEMCHR=1;             AC_SUBST([HAVE_RAWMEMCHR])
+  HAVE_STPCPY=1;                AC_SUBST([HAVE_STPCPY])
+  HAVE_STPNCPY=1;               AC_SUBST([HAVE_STPNCPY])
+  HAVE_STRCHRNUL=1;             AC_SUBST([HAVE_STRCHRNUL])
+  HAVE_DECL_STRDUP=1;           AC_SUBST([HAVE_DECL_STRDUP])
+  HAVE_DECL_STRNDUP=1;          AC_SUBST([HAVE_DECL_STRNDUP])
+  HAVE_DECL_STRNLEN=1;          AC_SUBST([HAVE_DECL_STRNLEN])
+  HAVE_STRPBRK=1;               AC_SUBST([HAVE_STRPBRK])
+  HAVE_STRSEP=1;                AC_SUBST([HAVE_STRSEP])
+  HAVE_STRCASESTR=1;            AC_SUBST([HAVE_STRCASESTR])
+  HAVE_DECL_STRTOK_R=1;         AC_SUBST([HAVE_DECL_STRTOK_R])
+  HAVE_DECL_STRERROR=1;         AC_SUBST([HAVE_DECL_STRERROR])
+  HAVE_DECL_STRSIGNAL=1;        AC_SUBST([HAVE_DECL_STRSIGNAL])
+  HAVE_STRVERSCMP=1;            AC_SUBST([HAVE_STRVERSCMP])
+  REPLACE_MEMCHR=0;             AC_SUBST([REPLACE_MEMCHR])
+  REPLACE_MEMMEM=0;             AC_SUBST([REPLACE_MEMMEM])
+  REPLACE_STRDUP=0;             AC_SUBST([REPLACE_STRDUP])
+  REPLACE_STRSTR=0;             AC_SUBST([REPLACE_STRSTR])
+  REPLACE_STRCASESTR=0;         AC_SUBST([REPLACE_STRCASESTR])
+  REPLACE_STRERROR=0;           AC_SUBST([REPLACE_STRERROR])
+  REPLACE_STRNDUP=0;            AC_SUBST([REPLACE_STRNDUP])
+  REPLACE_STRSIGNAL=0;          AC_SUBST([REPLACE_STRSIGNAL])
+  REPLACE_STRTOK_R=0;           AC_SUBST([REPLACE_STRTOK_R])
+  UNDEFINE_STRTOK_R=0;          AC_SUBST([UNDEFINE_STRTOK_R])
 ])
diff --git a/gl/m4/strndup.m4 b/gl/m4/strndup.m4
index 4fa7d5a..f8ea8f2 100644
--- a/gl/m4/strndup.m4
+++ b/gl/m4/strndup.m4
@@ -1,4 +1,4 @@
-# strndup.m4 serial 16
+# strndup.m4 serial 17
 dnl Copyright (C) 2002-2003, 2005-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,
@@ -9,17 +9,20 @@ AC_DEFUN([gl_FUNC_STRNDUP],
   dnl Persuade glibc <string.h> to declare strndup().
   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
 
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
   AC_CHECK_DECLS_ONCE([strndup])
+  AC_CHECK_FUNCS_ONCE([strndup])
   if test $ac_cv_have_decl_strndup = no; then
     HAVE_DECL_STRNDUP=0
   fi
 
-  # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'.
-  AC_CACHE_CHECK([for working strndup], [gl_cv_func_strndup],
-    [AC_RUN_IFELSE([
-       AC_LANG_PROGRAM([[#include <string.h>
-                        #include <stdlib.h>]], [[
+  if test $ac_cv_func_strndup = yes; then
+    # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating 
'\0'.
+    AC_CACHE_CHECK([for working strndup], [gl_cv_func_strndup_works],
+      [AC_RUN_IFELSE([
+         AC_LANG_PROGRAM([[#include <string.h>
+                           #include <stdlib.h>]], [[
 #ifndef HAVE_DECL_STRNDUP
   extern char *strndup (const char *, size_t);
 #endif
@@ -28,26 +31,19 @@ AC_DEFUN([gl_FUNC_STRNDUP],
   free (s);
   s = strndup ("shorter string", 13);
   return s[13] != '\0';]])],
-       [gl_cv_func_strndup=yes],
-       [gl_cv_func_strndup=no],
-       [AC_CHECK_FUNC([strndup],
-          [AC_EGREP_CPP([too risky], [
-#ifdef _AIX
-               too risky
-#endif
-             ],
-             [gl_cv_func_strndup=no],
-             [gl_cv_func_strndup=yes])],
-          [gl_cv_func_strndup=no])])])
-  if test $gl_cv_func_strndup = yes; then
-    AC_DEFINE([HAVE_STRNDUP], [1],
-      [Define if you have the strndup() function and it works.])
+         [gl_cv_func_strndup_works=yes],
+         [gl_cv_func_strndup_works=no],
+         [case $host_os in
+            aix*) gl_cv_func_strndup_works="guessing no";;
+            *) gl_cv_func_strndup_works="guessing yes";;
+          esac])])
+    case $gl_cv_func_strndup_works in
+      *no)
+        REPLACE_STRNDUP=1
+        AC_LIBOBJ([strndup])
+        ;;
+    esac
   else
-    HAVE_STRNDUP=0
     AC_LIBOBJ([strndup])
-    gl_PREREQ_STRNDUP
   fi
 ])
-
-# Prerequisites of lib/strndup.c.
-AC_DEFUN([gl_PREREQ_STRNDUP], [:])
diff --git a/gl/m4/strtok_r.m4 b/gl/m4/strtok_r.m4
index b79c2ee..0e4acb9 100644
--- a/gl/m4/strtok_r.m4
+++ b/gl/m4/strtok_r.m4
@@ -1,4 +1,4 @@
-# strtok_r.m4 serial 8
+# strtok_r.m4 serial 9
 dnl Copyright (C) 2002, 2003, 2004, 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,
@@ -10,7 +10,55 @@ AC_DEFUN([gl_FUNC_STRTOK_R],
   AC_REQUIRE([AC_C_RESTRICT])
 
   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
-  AC_REPLACE_FUNCS([strtok_r])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_FUNCS([strtok_r])
+  if test $ac_cv_func_strtok_r = yes; then
+    dnl glibc 2.7 has a bug in strtok_r that causes a segmentation fault
+    dnl when the second argument to strtok_r is a constant string that has
+    dnl exactly one byte and compiling with optimization.  This bug is, for
+    dnl example, present in the glibc 2.7-18 package in Debian "lenny".
+    dnl See <http://sources.redhat.com/bugzilla/show_bug.cgi?id=5614>.
+    AC_CACHE_CHECK([whether strtok_r works], [gl_cv_func_strtok_r_works],
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM([[
+              #ifndef __OPTIMIZE__
+              # define __OPTIMIZE__ 1
+              #endif
+              #undef __OPTIMIZE_SIZE__
+              #undef __NO_INLINE__
+              #include <stdlib.h>
+              #include <string.h>
+            ]],
+            [[char delimiters[] = "xxxxxxxx";
+              char *save_ptr = (char *) 0xd0d0;
+              strtok_r (delimiters, "x", &save_ptr);
+              strtok_r (NULL, "x", &save_ptr);
+              return 0;
+            ]])
+         ],
+         [gl_cv_func_strtok_r_works=yes],
+         [gl_cv_func_strtok_r_works=no],
+         [
+changequote(,)dnl
+          case "$host_os" in
+                    # Guess no on glibc systems.
+            *-gnu*) gl_cv_func_strtok_r_works="guessing no";;
+            *)      gl_cv_func_strtok_r_works="guessing yes";;
+          esac
+changequote([,])dnl
+         ])
+      ])
+    case "$gl_cv_func_strtok_r_works" in
+      *no)
+        dnl We could set REPLACE_STRTOK_R=1 and AC_LIBOBJ([strtok_r]) here,
+        dnl but it's only the macro version in <bits/string2.h> which is wrong.
+        dnl The code compiled into libc is fine.
+        UNDEFINE_STRTOK_R=1
+        ;;
+    esac
+  else
+    AC_LIBOBJ([strtok_r])
+  fi
   AC_CHECK_DECLS_ONCE([strtok_r])
   if test $ac_cv_have_decl_strtok_r = no; then
     HAVE_DECL_STRTOK_R=0
diff --git a/gl/m4/sys_select_h.m4 b/gl/m4/sys_select_h.m4
index c48be2c..991c7b7 100644
--- a/gl/m4/sys_select_h.m4
+++ b/gl/m4/sys_select_h.m4
@@ -1,4 +1,4 @@
-# sys_select_h.m4 serial 7
+# sys_select_h.m4 serial 8
 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,
@@ -11,10 +11,39 @@ AC_DEFUN([gl_HEADER_SYS_SELECT],
   AC_CACHE_CHECK([whether <sys/select.h> is self-contained],
     [gl_cv_header_sys_select_h_selfcontained],
     [
+      dnl Test against two bugs:
+      dnl 1. On many platforms, <sys/select.h> assumes prior inclusion of
+      dnl    <sys/types.h>.
+      dnl 2. On OSF/1 4.0, <sys/select.h> provides only a forward declaration
+      dnl    of 'struct timeval', and no definition of this type.
       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/select.h>]],
-                                        [[struct timeval b;]])],
+                                         [[struct timeval b;]])],
         [gl_cv_header_sys_select_h_selfcontained=yes],
         [gl_cv_header_sys_select_h_selfcontained=no])
+      dnl Test against another bug:
+      dnl 3. On Solaris 10, <sys/select.h> provides an FD_ZERO implementation
+      dnl    that relies on memset(), but without including <string.h>.
+      if test $gl_cv_header_sys_select_h_selfcontained = yes; then
+        AC_COMPILE_IFELSE(
+          [AC_LANG_PROGRAM([[#include <sys/select.h>]],
+                           [[int memset; int bzero;]])
+          ],
+          [AC_LINK_IFELSE(
+             [AC_LANG_PROGRAM([[#include <sys/select.h>]], [[
+                  #undef memset
+                  #define memset nonexistent_memset
+                  extern void *memset (void *, int, unsigned long);
+                  #undef bzero
+                  #define bzero nonexistent_bzero
+                  extern void bzero (void *, unsigned long);
+                  fd_set fds;
+                  FD_ZERO (&fds);
+                ]])
+             ],
+             [],
+             [gl_cv_header_sys_select_h_selfcontained=no])
+          ])
+      fi
     ])
   if test $gl_cv_header_sys_select_h_selfcontained = yes; then
     SYS_SELECT_H=''
diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4
index 74e8110..e864b2c 100644
--- a/gl/m4/sys_socket_h.m4
+++ b/gl/m4/sys_socket_h.m4
@@ -1,4 +1,4 @@
-# sys_socket_h.m4 serial 12
+# sys_socket_h.m4 serial 13
 dnl Copyright (C) 2005-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,
@@ -92,7 +92,7 @@ AC_DEFUN([gl_PREREQ_SYS_H_SOCKET],
   AC_SUBST([HAVE_WS2TCPIP_H])
 ])
 
-# Common prerequisites of of the <sys/socket.h> replacement and of the
+# Common prerequisites of the <sys/socket.h> replacement and of the
 # <sys/select.h> replacement.
 # Sets and substitutes HAVE_WINSOCK2_H.
 AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2],
@@ -140,6 +140,8 @@ AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
   GNULIB_SENDTO=0;      AC_SUBST([GNULIB_SENDTO])
   GNULIB_SETSOCKOPT=0;  AC_SUBST([GNULIB_SETSOCKOPT])
   GNULIB_SHUTDOWN=0;    AC_SUBST([GNULIB_SHUTDOWN])
+  GNULIB_ACCEPT4=0;     AC_SUBST([GNULIB_ACCEPT4])
   HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE])
   HAVE_SA_FAMILY_T=1;   AC_SUBST([HAVE_SA_FAMILY_T])
+  HAVE_ACCEPT4=1;       AC_SUBST([HAVE_ACCEPT4])
 ])
diff --git a/gl/m4/sys_stat_h.m4 b/gl/m4/sys_stat_h.m4
index 20c82ed..838cf48 100644
--- a/gl/m4/sys_stat_h.m4
+++ b/gl/m4/sys_stat_h.m4
@@ -1,26 +1,16 @@
-# sys_stat_h.m4 serial 10   -*- Autoconf -*-
-dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
+# sys_stat_h.m4 serial 21   -*- Autoconf -*-
+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,
 dnl with or without modifications, as long as this notice is preserved.
 
 dnl From Eric Blake.
-dnl Test whether <sys/stat.h> contains lstat and mkdir or must be substituted.
+dnl Provide a GNU-like <sys/stat.h>.
 
 AC_DEFUN([gl_HEADER_SYS_STAT_H],
 [
   AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
 
-  dnl Check for lstat.  Systems that lack it (mingw) also lack symlinks, so
-  dnl stat is a good replacement.
-  AC_CHECK_FUNCS_ONCE([lstat])
-  if test $ac_cv_func_lstat = yes; then
-    HAVE_LSTAT=1
-  else
-    HAVE_LSTAT=0
-  fi
-  AC_SUBST([HAVE_LSTAT])
-
   dnl For the mkdir substitute.
   AC_REQUIRE([AC_C_INLINE])
 
@@ -28,8 +18,6 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H],
   AC_REQUIRE([AC_HEADER_STAT])
 
   gl_CHECK_NEXT_HEADERS([sys/stat.h])
-  SYS_STAT_H='sys/stat.h'
-  AC_SUBST([SYS_STAT_H])
 
   dnl Define types that are supposed to be defined in <sys/types.h> or
   dnl <sys/stat.h>.
@@ -50,10 +38,38 @@ AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
 
 AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
 [
-  GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD])
-  GNULIB_LSTAT=0;  AC_SUBST([GNULIB_LSTAT])
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR
+  GNULIB_FCHMODAT=0;    AC_SUBST([GNULIB_FCHMODAT])
+  GNULIB_FSTATAT=0;     AC_SUBST([GNULIB_FSTATAT])
+  GNULIB_FUTIMENS=0;    AC_SUBST([GNULIB_FUTIMENS])
+  GNULIB_LCHMOD=0;      AC_SUBST([GNULIB_LCHMOD])
+  GNULIB_LSTAT=0;       AC_SUBST([GNULIB_LSTAT])
+  GNULIB_MKDIRAT=0;     AC_SUBST([GNULIB_MKDIRAT])
+  GNULIB_MKFIFO=0;      AC_SUBST([GNULIB_MKFIFO])
+  GNULIB_MKFIFOAT=0;    AC_SUBST([GNULIB_MKFIFOAT])
+  GNULIB_MKNOD=0;       AC_SUBST([GNULIB_MKNOD])
+  GNULIB_MKNODAT=0;     AC_SUBST([GNULIB_MKNODAT])
+  GNULIB_STAT=0;        AC_SUBST([GNULIB_STAT])
+  GNULIB_UTIMENSAT=0;   AC_SUBST([GNULIB_UTIMENSAT])
   dnl Assume proper GNU behavior unless another module says otherwise.
-  HAVE_LCHMOD=1;   AC_SUBST([HAVE_LCHMOD])
-  REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT])
-  REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR])
+  HAVE_FCHMODAT=1;      AC_SUBST([HAVE_FCHMODAT])
+  HAVE_FSTATAT=1;       AC_SUBST([HAVE_FSTATAT])
+  HAVE_FUTIMENS=1;      AC_SUBST([HAVE_FUTIMENS])
+  HAVE_LCHMOD=1;        AC_SUBST([HAVE_LCHMOD])
+  HAVE_LSTAT=1;         AC_SUBST([HAVE_LSTAT])
+  HAVE_MKDIRAT=1;       AC_SUBST([HAVE_MKDIRAT])
+  HAVE_MKFIFO=1;        AC_SUBST([HAVE_MKFIFO])
+  HAVE_MKFIFOAT=1;      AC_SUBST([HAVE_MKFIFOAT])
+  HAVE_MKNOD=1;         AC_SUBST([HAVE_MKNOD])
+  HAVE_MKNODAT=1;       AC_SUBST([HAVE_MKNODAT])
+  HAVE_UTIMENSAT=1;     AC_SUBST([HAVE_UTIMENSAT])
+  REPLACE_FSTAT=0;      AC_SUBST([REPLACE_FSTAT])
+  REPLACE_FSTATAT=0;    AC_SUBST([REPLACE_FSTATAT])
+  REPLACE_FUTIMENS=0;   AC_SUBST([REPLACE_FUTIMENS])
+  REPLACE_LSTAT=0;      AC_SUBST([REPLACE_LSTAT])
+  REPLACE_MKDIR=0;      AC_SUBST([REPLACE_MKDIR])
+  REPLACE_MKFIFO=0;     AC_SUBST([REPLACE_MKFIFO])
+  REPLACE_MKNOD=0;      AC_SUBST([REPLACE_MKNOD])
+  REPLACE_STAT=0;       AC_SUBST([REPLACE_STAT])
+  REPLACE_UTIMENSAT=0;  AC_SUBST([REPLACE_UTIMENSAT])
 ])
diff --git a/gl/m4/sys_time_h.m4 b/gl/m4/sys_time_h.m4
index 13ac576..e2f7809 100644
--- a/gl/m4/sys_time_h.m4
+++ b/gl/m4/sys_time_h.m4
@@ -30,12 +30,12 @@ AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY],
   AC_CACHE_CHECK([for struct timeval], [gl_cv_sys_struct_timeval],
     [AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM(
-         [[#if HAVE_SYS_TIME_H
-            #include <sys/time.h>
-           #endif
-           #include <time.h>
-         ]],
-         [[static struct timeval x; x.tv_sec = x.tv_usec;]])],
+          [[#if HAVE_SYS_TIME_H
+             #include <sys/time.h>
+            #endif
+            #include <time.h>
+          ]],
+          [[static struct timeval x; x.tv_sec = x.tv_usec;]])],
        [gl_cv_sys_struct_timeval=yes],
        [gl_cv_sys_struct_timeval=no])])
   if test $gl_cv_sys_struct_timeval = yes; then
diff --git a/gl/m4/time_h.m4 b/gl/m4/time_h.m4
index d42a635..c038b17 100644
--- a/gl/m4/time_h.m4
+++ b/gl/m4/time_h.m4
@@ -1,7 +1,6 @@
 # Configure a more-standard replacement for <time.h>.
 
-# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007 Free Software
-# Foundation, Inc.
+# Copyright (C) 2000-2001, 2003-2007, 2009 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -30,6 +29,7 @@ AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
   dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK;
   dnl this lets maintainers check for portability.
   REPLACE_LOCALTIME_R=GNULIB_PORTCHECK;  AC_SUBST([REPLACE_LOCALTIME_R])
+  REPLACE_MKTIME=GNULIB_PORTCHECK;       AC_SUBST([REPLACE_MKTIME])
   REPLACE_NANOSLEEP=GNULIB_PORTCHECK;    AC_SUBST([REPLACE_NANOSLEEP])
   REPLACE_STRPTIME=GNULIB_PORTCHECK;     AC_SUBST([REPLACE_STRPTIME])
   REPLACE_TIMEGM=GNULIB_PORTCHECK;       AC_SUBST([REPLACE_TIMEGM])
@@ -45,9 +45,9 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
     [gl_cv_sys_struct_timespec_in_time_h],
     [AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM(
-         [[#include <time.h>
-         ]],
-         [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
+          [[#include <time.h>
+          ]],
+          [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
        [gl_cv_sys_struct_timespec_in_time_h=yes],
        [gl_cv_sys_struct_timespec_in_time_h=no])])
 
@@ -59,12 +59,12 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
     AC_CACHE_CHECK([for struct timespec in <sys/time.h>],
       [gl_cv_sys_struct_timespec_in_sys_time_h],
       [AC_COMPILE_IFELSE(
-        [AC_LANG_PROGRAM(
-           [[#include <sys/time.h>
-           ]],
-           [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
-        [gl_cv_sys_struct_timespec_in_sys_time_h=yes],
-        [gl_cv_sys_struct_timespec_in_sys_time_h=no])])
+         [AC_LANG_PROGRAM(
+            [[#include <sys/time.h>
+            ]],
+            [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
+         [gl_cv_sys_struct_timespec_in_sys_time_h=yes],
+         [gl_cv_sys_struct_timespec_in_sys_time_h=no])])
     if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then
       SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1
     fi
diff --git a/gl/m4/time_r.m4 b/gl/m4/time_r.m4
index c871b56..de22db9 100644
--- a/gl/m4/time_r.m4
+++ b/gl/m4/time_r.m4
@@ -1,6 +1,6 @@
 dnl Reentrant time functions like localtime_r.
 
-dnl Copyright (C) 2003, 2006, 2007, 2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2006, 2007, 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.
@@ -17,15 +17,15 @@ AC_DEFUN([gl_TIME_R],
 
   AC_CACHE_CHECK([whether localtime_r is compatible with its POSIX signature],
     [gl_cv_time_r_posix],
-    [AC_TRY_COMPILE(
-       [#include <time.h>],
-       [/* We don't need to append 'restrict's to the argument types,
-          even though the POSIX signature has the 'restrict's,
-          since C99 says they can't affect type compatibility.  */
-       struct tm * (*ptr) (time_t const *, struct tm *) = localtime_r;
-        if (ptr) return 0;
-        /* Check the return type is a pointer.  On HP-UX 10 it is 'int'.  */
-        *localtime_r (0, 0);],
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+         [[#include <time.h>]],
+         [[/* We don't need to append 'restrict's to the argument types,
+              even though the POSIX signature has the 'restrict's,
+              since C99 says they can't affect type compatibility.  */
+           struct tm * (*ptr) (time_t const *, struct tm *) = localtime_r;
+           if (ptr) return 0;
+           /* Check the return type is a pointer.  On HP-UX 10 it is 'int'.  */
+           *localtime_r (0, 0);]])],
        [gl_cv_time_r_posix=yes],
        [gl_cv_time_r_posix=no])])
   if test $gl_cv_time_r_posix = yes; then
diff --git a/gl/m4/timegm.m4 b/gl/m4/timegm.m4
index be323c9..f0fa0b6 100644
--- a/gl/m4/timegm.m4
+++ b/gl/m4/timegm.m4
@@ -34,7 +34,7 @@ AC_DEFUN([gl_PREREQ_TIMEGM], [
        # so we need to substitute our own mktime implementation.
        AC_LIBOBJ([mktime])
        AC_DEFINE([mktime], [rpl_mktime],
-        [Define to rpl_mktime if the replacement function should be used.])
+         [Define to rpl_mktime if the replacement function should be used.])
        gl_PREREQ_MKTIME])
   fi
 ])
diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4
index 96fddba..cb50d50 100644
--- a/gl/m4/unistd_h.m4
+++ b/gl/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 18
+# unistd_h.m4 serial 36
 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,
@@ -35,50 +35,94 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   GNULIB_CHOWN=0;            AC_SUBST([GNULIB_CHOWN])
   GNULIB_CLOSE=0;            AC_SUBST([GNULIB_CLOSE])
   GNULIB_DUP2=0;             AC_SUBST([GNULIB_DUP2])
+  GNULIB_DUP3=0;             AC_SUBST([GNULIB_DUP3])
   GNULIB_ENVIRON=0;          AC_SUBST([GNULIB_ENVIRON])
   GNULIB_EUIDACCESS=0;       AC_SUBST([GNULIB_EUIDACCESS])
+  GNULIB_FACCESSAT=0;        AC_SUBST([GNULIB_FACCESSAT])
   GNULIB_FCHDIR=0;           AC_SUBST([GNULIB_FCHDIR])
+  GNULIB_FCHOWNAT=0;         AC_SUBST([GNULIB_FCHOWNAT])
   GNULIB_FSYNC=0;            AC_SUBST([GNULIB_FSYNC])
   GNULIB_FTRUNCATE=0;        AC_SUBST([GNULIB_FTRUNCATE])
   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])
   GNULIB_GETUSERSHELL=0;     AC_SUBST([GNULIB_GETUSERSHELL])
   GNULIB_LCHOWN=0;           AC_SUBST([GNULIB_LCHOWN])
   GNULIB_LINK=0;             AC_SUBST([GNULIB_LINK])
+  GNULIB_LINKAT=0;           AC_SUBST([GNULIB_LINKAT])
   GNULIB_LSEEK=0;            AC_SUBST([GNULIB_LSEEK])
+  GNULIB_PIPE2=0;            AC_SUBST([GNULIB_PIPE2])
+  GNULIB_PREAD=0;            AC_SUBST([GNULIB_PREAD])
   GNULIB_READLINK=0;         AC_SUBST([GNULIB_READLINK])
+  GNULIB_READLINKAT=0;       AC_SUBST([GNULIB_READLINKAT])
+  GNULIB_RMDIR=0;            AC_SUBST([GNULIB_RMDIR])
   GNULIB_SLEEP=0;            AC_SUBST([GNULIB_SLEEP])
+  GNULIB_SYMLINK=0;          AC_SUBST([GNULIB_SYMLINK])
+  GNULIB_SYMLINKAT=0;        AC_SUBST([GNULIB_SYMLINKAT])
+  GNULIB_UNISTD_H_GETOPT=0;  AC_SUBST([GNULIB_UNISTD_H_GETOPT])
   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])
+  HAVE_FACCESSAT=1;       AC_SUBST([HAVE_FACCESSAT])
+  HAVE_FCHOWNAT=1;        AC_SUBST([HAVE_FCHOWNAT])
   HAVE_FSYNC=1;           AC_SUBST([HAVE_FSYNC])
   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])
+  HAVE_PREAD=1;           AC_SUBST([HAVE_PREAD])
   HAVE_READLINK=1;        AC_SUBST([HAVE_READLINK])
+  HAVE_READLINKAT=1;      AC_SUBST([HAVE_READLINKAT])
   HAVE_SLEEP=1;           AC_SUBST([HAVE_SLEEP])
+  HAVE_SYMLINK=1;         AC_SUBST([HAVE_SYMLINK])
+  HAVE_SYMLINKAT=1;       AC_SUBST([HAVE_SYMLINKAT])
   HAVE_DECL_ENVIRON=1;    AC_SUBST([HAVE_DECL_ENVIRON])
   HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R])
   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])
   REPLACE_DUP2=0;         AC_SUBST([REPLACE_DUP2])
   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])
+  REPLACE_LINKAT=0;       AC_SUBST([REPLACE_LINKAT])
   REPLACE_LSEEK=0;        AC_SUBST([REPLACE_LSEEK])
+  REPLACE_PREAD=0;        AC_SUBST([REPLACE_PREAD])
+  REPLACE_READLINK=0;     AC_SUBST([REPLACE_READLINK])
+  REPLACE_RMDIR=0;        AC_SUBST([REPLACE_RMDIR])
+  REPLACE_SLEEP=0;        AC_SUBST([REPLACE_SLEEP])
+  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;
+                           AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS])
 ])
diff --git a/gl/m4/warnings.m4 b/gl/m4/warnings.m4
index c32cf4e..1639c03 100644
--- a/gl/m4/warnings.m4
+++ b/gl/m4/warnings.m4
@@ -33,7 +33,7 @@ AC_CACHE_CHECK([whether compiler handles $1], [gl_Warn], [
   CPPFLAGS="${CPPFLAGS} $1"
   AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
                     [AS_VAR_SET([gl_Warn], [yes])],
-                   [AS_VAR_SET([gl_Warn], [no])])
+                    [AS_VAR_SET([gl_Warn], [no])])
   CPPFLAGS="$save_CPPFLAGS"
 ])
 AS_VAR_PUSHDEF([gl_Flags], m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]))dnl
diff --git a/gl/m4/wchar.m4 b/gl/m4/wchar.m4
index 2e52a82..ad19376 100644
--- a/gl/m4/wchar.m4
+++ b/gl/m4/wchar.m4
@@ -7,11 +7,12 @@ dnl with or without modifications, as long as this notice is 
preserved.
 
 dnl Written by Eric Blake.
 
-# wchar.m4 serial 23
+# wchar.m4 serial 27
 
 AC_DEFUN([gl_WCHAR_H],
 [
   AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_REQUIRE([gl_WCHAR_H_INLINE_OK])
   AC_CACHE_CHECK([whether <wchar.h> is standalone],
     [gl_cv_header_wchar_h_standalone],
     [AC_COMPILE_IFELSE([[#include <wchar.h>
@@ -27,7 +28,10 @@ wchar_t w;]],
   fi
   AC_SUBST([HAVE_WINT_T])
 
-  if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != 
yes; then
+  dnl If <stddef.h> is replaced, then <wchar.h> must also be replaced.
+  AC_REQUIRE([gl_STDDEF_H])
+
+  if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != 
yes || test -n "$STDDEF_H"; then
     WCHAR_H=wchar.h
   fi
 
@@ -42,9 +46,59 @@ wchar_t w;]],
     HAVE_WCHAR_H=0
   fi
   AC_SUBST([HAVE_WCHAR_H])
+  dnl Execute this unconditionally, because WCHAR_H may be set by other
+  dnl modules, after this code is executed.
   gl_CHECK_NEXT_HEADERS([wchar.h])
 ])
 
+dnl Check whether <wchar.h> is usable at all.
+AC_DEFUN([gl_WCHAR_H_INLINE_OK],
+[
+  dnl Test whether <wchar.h> suffers due to the transition from '__inline' to
+  dnl 'gnu_inline'. See <http://sourceware.org/bugzilla/show_bug.cgi?id=4022>
+  dnl and <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. In summary,
+  dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and
+  dnl the option -std=c99 or -std=gnu99, leads to a broken <wchar.h>.
+  AC_CACHE_CHECK([whether <wchar.h> uses 'inline' correctly],
+    [gl_cv_header_wchar_h_correct_inline],
+    [gl_cv_header_wchar_h_correct_inline=yes
+     AC_LANG_CONFTEST([
+       AC_LANG_SOURCE([[#define wcstod renamed_wcstod
+#include <wchar.h>
+extern int zero (void);
+int main () { return zero(); }
+]])])
+     if AC_TRY_EVAL([ac_compile]); then
+       mv conftest.$ac_objext conftest1.$ac_objext
+       AC_LANG_CONFTEST([
+         AC_LANG_SOURCE([[#define wcstod renamed_wcstod
+#include <wchar.h>
+int zero (void) { return 0; }
+]])])
+       if AC_TRY_EVAL([ac_compile]); then
+         mv conftest.$ac_objext conftest2.$ac_objext
+         if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext 
conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then
+           :
+         else
+           gl_cv_header_wchar_h_correct_inline=no
+         fi
+       fi
+     fi
+     rm -f conftest1.$ac_objext conftest2.$ac_objext conftest$ac_exeext
+    ])
+  if test $gl_cv_header_wchar_h_correct_inline = no; then
+    AC_MSG_ERROR([<wchar.h> cannot be used with this compiler ($CC $CFLAGS 
$CPPFLAGS).
+This is a known interoperability problem of glibc <= 2.5 with gcc >= 4.3 in
+C99 mode. You have four options:
+  - Add the flag -fgnu89-inline to CC and reconfigure, or
+  - Fix your include files, using parts of
+    
<http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b037a293a48718af30d706c2e18c929d0e69a621>,
 or
+  - Use a gcc version older than 4.3, or
+  - Don't use the flags -std=c99 or -std=gnu99.
+Configuration aborted.])
+  fi
+])
+
 dnl Unconditionally enables the replacement of <wchar.h>.
 AC_DEFUN([gl_REPLACE_WCHAR_H],
 [
diff --git a/gl/malloca.c b/gl/malloca.c
index 1f41078..c7d38a9 100644
--- a/gl/malloca.c
+++ b/gl/malloca.c
@@ -74,21 +74,21 @@ mmalloca (size_t n)
       char *p = (char *) malloc (nplus);
 
       if (p != NULL)
-       {
-         size_t slot;
+        {
+          size_t slot;
 
-         p += HEADER_SIZE;
+          p += HEADER_SIZE;
 
-         /* Put a magic number into the indicator word.  */
-         ((int *) p)[-1] = MAGIC_NUMBER;
+          /* Put a magic number into the indicator word.  */
+          ((int *) p)[-1] = MAGIC_NUMBER;
 
-         /* Enter p into the hash table.  */
-         slot = (unsigned long) p % HASH_TABLE_SIZE;
-         ((struct header *) (p - HEADER_SIZE))->next = mmalloca_results[slot];
-         mmalloca_results[slot] = p;
+          /* Enter p into the hash table.  */
+          slot = (unsigned long) p % HASH_TABLE_SIZE;
+          ((struct header *) (p - HEADER_SIZE))->next = mmalloca_results[slot];
+          mmalloca_results[slot] = p;
 
-         return p;
-       }
+          return p;
+        }
     }
   /* Out of memory.  */
   return NULL;
@@ -109,28 +109,28 @@ freea (void *p)
   if (p != NULL)
     {
       /* Attempt to quickly distinguish the mmalloca() result - which has
-        a magic indicator word - and the alloca() result - which has an
-        uninitialized indicator word.  It is for this test that sa_increment
-        additional bytes are allocated in the alloca() case.  */
+         a magic indicator word - and the alloca() result - which has an
+         uninitialized indicator word.  It is for this test that sa_increment
+         additional bytes are allocated in the alloca() case.  */
       if (((int *) p)[-1] == MAGIC_NUMBER)
-       {
-         /* Looks like a mmalloca() result.  To see whether it really is one,
-            perform a lookup in the hash table.  */
-         size_t slot = (unsigned long) p % HASH_TABLE_SIZE;
-         void **chain = &mmalloca_results[slot];
-         for (; *chain != NULL;)
-           {
-             if (*chain == p)
-               {
-                 /* Found it.  Remove it from the hash table and free it.  */
-                 char *p_begin = (char *) p - HEADER_SIZE;
-                 *chain = ((struct header *) p_begin)->next;
-                 free (p_begin);
-                 return;
-               }
-             chain = &((struct header *) ((char *) *chain - 
HEADER_SIZE))->next;
-           }
-       }
+        {
+          /* Looks like a mmalloca() result.  To see whether it really is one,
+             perform a lookup in the hash table.  */
+          size_t slot = (unsigned long) p % HASH_TABLE_SIZE;
+          void **chain = &mmalloca_results[slot];
+          for (; *chain != NULL;)
+            {
+              if (*chain == p)
+                {
+                  /* Found it.  Remove it from the hash table and free it.  */
+                  char *p_begin = (char *) p - HEADER_SIZE;
+                  *chain = ((struct header *) p_begin)->next;
+                  free (p_begin);
+                  return;
+                }
+              chain = &((struct header *) ((char *) *chain - 
HEADER_SIZE))->next;
+            }
+        }
       /* At this point, we know it was not a mmalloca() result.  */
     }
 }
diff --git a/gl/malloca.h b/gl/malloca.h
index 3be0a38..9c3c1a3 100644
--- a/gl/malloca.h
+++ b/gl/malloca.h
@@ -54,7 +54,7 @@ extern "C" {
    the function returns.  Upon failure, it returns NULL.  */
 #if HAVE_ALLOCA
 # define malloca(N) \
-  ((N) < 4032 - sa_increment                                       \
+  ((N) < 4032 - sa_increment                                        \
    ? (void *) ((char *) alloca ((N) + sa_increment) + sa_increment) \
    : mmalloca (N))
 #else
@@ -122,10 +122,10 @@ enum
   sa_alignment_longdouble = sa_alignof (long double),
   sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1)
 #if HAVE_LONG_LONG_INT
-                     | (sa_alignment_longlong - 1)
+                      | (sa_alignment_longlong - 1)
 #endif
-                     | (sa_alignment_longdouble - 1)
-                    ) + 1,
+                      | (sa_alignment_longdouble - 1)
+                     ) + 1,
 /* The increment that guarantees room for a magic word must be >= sizeof (int)
    and a multiple of sa_alignment_max.  */
   sa_increment = ((sizeof (int) + sa_alignment_max - 1) / sa_alignment_max) * 
sa_alignment_max
diff --git a/gl/md4.c b/gl/md4.c
index d2e4514..acae24d 100644
--- a/gl/md4.c
+++ b/gl/md4.c
@@ -26,6 +26,7 @@
 
 #include <stddef.h>
 #include <stdlib.h>
+#include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
 
@@ -34,13 +35,13 @@
 #endif
 
 #ifdef WORDS_BIGENDIAN
-# define SWAP(n)                                                       \
+# define SWAP(n)                                                        \
   (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
 #else
 # define SWAP(n) (n)
 #endif
 
-#define BLOCKSIZE 4096
+#define BLOCKSIZE 32768
 #if BLOCKSIZE % 64 != 0
 # error "invalid BLOCKSIZE"
 #endif
@@ -107,7 +108,7 @@ md4_finish_ctx (struct md4_ctx *ctx, void *resbuf)
   /* Put the 64-bit file length in *bits* at the end of the buffer.  */
   ctx->buffer[(bytes + pad) / 4] = SWAP (ctx->total[0] << 3);
   ctx->buffer[(bytes + pad) / 4 + 1] = SWAP ((ctx->total[1] << 3) |
-                                            (ctx->total[0] >> 29));
+                                             (ctx->total[0] >> 29));
 
   /* Process last bytes.  */
   md4_process_block (ctx->buffer, bytes + pad + 8, ctx);
@@ -122,9 +123,12 @@ int
 md4_stream (FILE * stream, void *resblock)
 {
   struct md4_ctx ctx;
-  char buffer[BLOCKSIZE + 72];
   size_t sum;
 
+  char *buffer = malloc (BLOCKSIZE + 72);
+  if (!buffer)
+    return 1;
+
   /* Initialize the computation context.  */
   md4_init_ctx (&ctx);
 
@@ -139,30 +143,33 @@ md4_stream (FILE * stream, void *resblock)
 
       /* Read block.  Take care for partial reads.  */
       while (1)
-       {
-         n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
-
-         sum += n;
-
-         if (sum == BLOCKSIZE)
-           break;
-
-         if (n == 0)
-           {
-             /* Check for the error flag IFF N == 0, so that we don't
-                exit the loop after a partial read due to e.g., EAGAIN
-                or EWOULDBLOCK.  */
-             if (ferror (stream))
-               return 1;
-             goto process_partial_block;
-           }
-
-         /* We've read at least one byte, so ignore errors.  But always
-            check for EOF, since feof may be true even though N > 0.
-            Otherwise, we could end up calling fread after EOF.  */
-         if (feof (stream))
-           goto process_partial_block;
-       }
+        {
+          n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
+
+          sum += n;
+
+          if (sum == BLOCKSIZE)
+            break;
+
+          if (n == 0)
+            {
+              /* Check for the error flag IFF N == 0, so that we don't
+                 exit the loop after a partial read due to e.g., EAGAIN
+                 or EWOULDBLOCK.  */
+              if (ferror (stream))
+                {
+                  free (buffer);
+                  return 1;
+                }
+              goto process_partial_block;
+            }
+
+          /* We've read at least one byte, so ignore errors.  But always
+             check for EOF, since feof may be true even though N > 0.
+             Otherwise, we could end up calling fread after EOF.  */
+          if (feof (stream))
+            goto process_partial_block;
+        }
 
       /* Process buffer with BLOCKSIZE bytes.  Note that
          BLOCKSIZE % 64 == 0
@@ -178,6 +185,7 @@ process_partial_block:;
 
   /* Construct result in desired memory.  */
   md4_finish_ctx (&ctx, resblock);
+  free (buffer);
   return 0;
 }
 
@@ -214,14 +222,14 @@ md4_process_bytes (const void *buffer, size_t len, struct 
md4_ctx *ctx)
       ctx->buflen += add;
 
       if (ctx->buflen > 64)
-       {
-         md4_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
+        {
+          md4_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
 
-         ctx->buflen &= 63;
-         /* The regions in the following copy operation cannot overlap.  */
-         memcpy (ctx->buffer, &((char*)ctx->buffer)[(left_over + add) & ~63],
-                 ctx->buflen);
-       }
+          ctx->buflen &= 63;
+          /* The regions in the following copy operation cannot overlap.  */
+          memcpy (ctx->buffer, &((char*)ctx->buffer)[(left_over + add) & ~63],
+                  ctx->buflen);
+        }
 
       buffer = (const char *) buffer + add;
       len -= add;
@@ -240,19 +248,19 @@ md4_process_bytes (const void *buffer, size_t len, struct 
md4_ctx *ctx)
 #  define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0)
 # endif
       if (UNALIGNED_P (buffer))
-       while (len > 64)
-         {
-           md4_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
-           buffer = (const char *) buffer + 64;
-           len -= 64;
-         }
+        while (len > 64)
+          {
+            md4_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
+            buffer = (const char *) buffer + 64;
+            len -= 64;
+          }
       else
 #endif
-       {
-         md4_process_block (buffer, len & ~63, ctx);
-         buffer = (const char *) buffer + (len & ~63);
-         len &= 63;
-       }
+        {
+          md4_process_block (buffer, len & ~63, ctx);
+          buffer = (const char *) buffer + (len & ~63);
+          len &= 63;
+        }
     }
 
   /* Move remaining bytes in internal buffer.  */
@@ -263,11 +271,11 @@ md4_process_bytes (const void *buffer, size_t len, struct 
md4_ctx *ctx)
       memcpy (&((char*)ctx->buffer)[left_over], buffer, len);
       left_over += len;
       if (left_over >= 64)
-       {
-         md4_process_block (ctx->buffer, 64, ctx);
-         left_over -= 64;
-         memcpy (ctx->buffer, &ctx->buffer[16], left_over);
-       }
+        {
+          md4_process_block (ctx->buffer, 64, ctx);
+          left_over -= 64;
+          memcpy (ctx->buffer, &ctx->buffer[16], left_over);
+        }
       ctx->buflen = left_over;
     }
 }
@@ -315,10 +323,10 @@ md4_process_block (const void *buffer, size_t len, struct 
md4_ctx *ctx)
     {
       int t;
       for (t = 0; t < 16; t++)
-       {
-         x[t] = SWAP (*words);
-         words++;
-       }
+        {
+          x[t] = SWAP (*words);
+          words++;
+        }
 
       /* Round 1.  */
       R1 (A, B, C, D, 0, 3);
diff --git a/gl/md4.h b/gl/md4.h
index f76372a..e8bd989 100644
--- a/gl/md4.h
+++ b/gl/md4.h
@@ -1,6 +1,7 @@
 /* Declarations of functions and data types used for MD4 sum
    library functions.
-   Copyright (C) 2000, 2001, 2003, 2005, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2003, 2005, 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 the
@@ -50,14 +51,14 @@ extern void md4_init_ctx (struct md4_ctx *ctx);
    starting at BUFFER.
    It is necessary that LEN is a multiple of 64!!! */
 extern void md4_process_block (const void *buffer, size_t len,
-                              struct md4_ctx *ctx);
+                               struct md4_ctx *ctx);
 
 /* Starting with the result of former calls of this function (or the
    initialization function update the context for the next LEN bytes
    starting at BUFFER.
    It is NOT required that LEN is a multiple of 64.  */
 extern void md4_process_bytes (const void *buffer, size_t len,
-                              struct md4_ctx *ctx);
+                               struct md4_ctx *ctx);
 
 /* Process the remaining bytes in the buffer and put result from CTX
    in first 16 bytes following RESBUF.  The result is always in little
diff --git a/gl/md5.c b/gl/md5.c
index 2e03bb9..805af73 100644
--- a/gl/md5.c
+++ b/gl/md5.c
@@ -1,7 +1,7 @@
 /* Functions to compute MD5 message digest of files or memory blocks.
    according to the definition of MD5 in RFC 1321 from April 1992.
    Copyright (C) 1995,1996,1997,1999,2000,2001,2005,2006,2008
-       Free Software Foundation, Inc.
+        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 it
@@ -50,13 +50,13 @@
 #endif
 
 #ifdef WORDS_BIGENDIAN
-# define SWAP(n)                                                       \
+# define SWAP(n)                                                        \
     (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
 #else
 # define SWAP(n) (n)
 #endif
 
-#define BLOCKSIZE 4096
+#define BLOCKSIZE 32768
 #if BLOCKSIZE % 64 != 0
 # error "invalid BLOCKSIZE"
 #endif
@@ -136,9 +136,12 @@ int
 md5_stream (FILE *stream, void *resblock)
 {
   struct md5_ctx ctx;
-  char buffer[BLOCKSIZE + 72];
   size_t sum;
 
+  char *buffer = malloc (BLOCKSIZE + 72);
+  if (!buffer)
+    return 1;
+
   /* Initialize the computation context.  */
   md5_init_ctx (&ctx);
 
@@ -153,30 +156,33 @@ md5_stream (FILE *stream, void *resblock)
 
       /* Read block.  Take care for partial reads.  */
       while (1)
-       {
-         n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
-
-         sum += n;
-
-         if (sum == BLOCKSIZE)
-           break;
-
-         if (n == 0)
-           {
-             /* Check for the error flag IFF N == 0, so that we don't
-                exit the loop after a partial read due to e.g., EAGAIN
-                or EWOULDBLOCK.  */
-             if (ferror (stream))
-               return 1;
-             goto process_partial_block;
-           }
-
-         /* We've read at least one byte, so ignore errors.  But always
-            check for EOF, since feof may be true even though N > 0.
-            Otherwise, we could end up calling fread after EOF.  */
-         if (feof (stream))
-           goto process_partial_block;
-       }
+        {
+          n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
+
+          sum += n;
+
+          if (sum == BLOCKSIZE)
+            break;
+
+          if (n == 0)
+            {
+              /* Check for the error flag IFF N == 0, so that we don't
+                 exit the loop after a partial read due to e.g., EAGAIN
+                 or EWOULDBLOCK.  */
+              if (ferror (stream))
+                {
+                  free (buffer);
+                  return 1;
+                }
+              goto process_partial_block;
+            }
+
+          /* We've read at least one byte, so ignore errors.  But always
+             check for EOF, since feof may be true even though N > 0.
+             Otherwise, we could end up calling fread after EOF.  */
+          if (feof (stream))
+            goto process_partial_block;
+        }
 
       /* Process buffer with BLOCKSIZE bytes.  Note that
          BLOCKSIZE % 64 == 0
@@ -192,6 +198,7 @@ process_partial_block:
 
   /* Construct result in desired memory.  */
   md5_finish_ctx (&ctx, resblock);
+  free (buffer);
   return 0;
 }
 
@@ -229,15 +236,15 @@ md5_process_bytes (const void *buffer, size_t len, struct 
md5_ctx *ctx)
       ctx->buflen += add;
 
       if (ctx->buflen > 64)
-       {
-         md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
+        {
+          md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
 
-         ctx->buflen &= 63;
-         /* The regions in the following copy operation cannot overlap.  */
-         memcpy (ctx->buffer,
-                 &((char *) ctx->buffer)[(left_over + add) & ~63],
-                 ctx->buflen);
-       }
+          ctx->buflen &= 63;
+          /* The regions in the following copy operation cannot overlap.  */
+          memcpy (ctx->buffer,
+                  &((char *) ctx->buffer)[(left_over + add) & ~63],
+                  ctx->buflen);
+        }
 
       buffer = (const char *) buffer + add;
       len -= add;
@@ -250,19 +257,19 @@ md5_process_bytes (const void *buffer, size_t len, struct 
md5_ctx *ctx)
 # define alignof(type) offsetof (struct { char c; type x; }, x)
 # define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0)
       if (UNALIGNED_P (buffer))
-       while (len > 64)
-         {
-           md5_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
-           buffer = (const char *) buffer + 64;
-           len -= 64;
-         }
+        while (len > 64)
+          {
+            md5_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
+            buffer = (const char *) buffer + 64;
+            len -= 64;
+          }
       else
 #endif
-       {
-         md5_process_block (buffer, len & ~63, ctx);
-         buffer = (const char *) buffer + (len & ~63);
-         len &= 63;
-       }
+        {
+          md5_process_block (buffer, len & ~63, ctx);
+          buffer = (const char *) buffer + (len & ~63);
+          len &= 63;
+        }
     }
 
   /* Move remaining bytes in internal buffer.  */
@@ -273,11 +280,11 @@ md5_process_bytes (const void *buffer, size_t len, struct 
md5_ctx *ctx)
       memcpy (&((char *) ctx->buffer)[left_over], buffer, len);
       left_over += len;
       if (left_over >= 64)
-       {
-         md5_process_block (ctx->buffer, 64, ctx);
-         left_over -= 64;
-         memcpy (ctx->buffer, &ctx->buffer[16], left_over);
-       }
+        {
+          md5_process_block (ctx->buffer, 64, ctx);
+          left_over -= 64;
+          memcpy (ctx->buffer, &ctx->buffer[16], left_over);
+        }
       ctx->buflen = left_over;
     }
 }
@@ -331,14 +338,14 @@ md5_process_block (const void *buffer, size_t len, struct 
md5_ctx *ctx)
          before the computation.  To reduce the work for the next steps
          we store the swapped words in the array CORRECT_WORDS.  */
 
-#define OP(a, b, c, d, s, T)                                           \
-      do                                                               \
-        {                                                              \
-         a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T;             \
-         ++words;                                                      \
-         CYCLIC (a, s);                                                \
-         a += b;                                                       \
-        }                                                              \
+#define OP(a, b, c, d, s, T)                                            \
+      do                                                                \
+        {                                                               \
+          a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T;             \
+          ++words;                                                      \
+          CYCLIC (a, s);                                                \
+          a += b;                                                       \
+        }                                                               \
       while (0)
 
       /* It is unfortunate that C does not provide an operator for
@@ -377,13 +384,13 @@ md5_process_block (const void *buffer, size_t len, struct 
md5_ctx *ctx)
          in CORRECT_WORDS.  Redefine the macro to take an additional first
          argument specifying the function to use.  */
 #undef OP
-#define OP(f, a, b, c, d, k, s, T)                                     \
-      do                                                               \
-       {                                                               \
-         a += f (b, c, d) + correct_words[k] + T;                      \
-         CYCLIC (a, s);                                                \
-         a += b;                                                       \
-       }                                                               \
+#define OP(f, a, b, c, d, k, s, T)                                      \
+      do                                                                \
+        {                                                               \
+          a += f (b, c, d) + correct_words[k] + T;                      \
+          CYCLIC (a, s);                                                \
+          a += b;                                                       \
+        }                                                               \
       while (0)
 
       /* Round 2.  */
diff --git a/gl/md5.h b/gl/md5.h
index f1a3513..63d6aae 100644
--- a/gl/md5.h
+++ b/gl/md5.h
@@ -1,6 +1,6 @@
 /* Declaration of functions and data types used for MD5 sum computing
    library functions.
-   Copyright (C) 1995-1997,1999,2000,2001,2004,2005,2006,2008
+   Copyright (C) 1995-1997,1999,2000,2001,2004,2005,2006,2008,2009
       Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -29,7 +29,7 @@
 
 #ifndef __GNUC_PREREQ
 # if defined __GNUC__ && defined __GNUC_MINOR__
-#  define __GNUC_PREREQ(maj, min)                                      \
+#  define __GNUC_PREREQ(maj, min)                                       \
   ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
 # else
 #  define __GNUC_PREREQ(maj, min) 0
@@ -38,7 +38,7 @@
 
 #ifndef __THROW
 # if defined __cplusplus && __GNUC_PREREQ (2,8)
-#  define __THROW      throw ()
+#  define __THROW       throw ()
 # else
 #  define __THROW
 # endif
@@ -85,14 +85,14 @@ extern void __md5_init_ctx (struct md5_ctx *ctx) __THROW;
    starting at BUFFER.
    It is necessary that LEN is a multiple of 64!!! */
 extern void __md5_process_block (const void *buffer, size_t len,
-                                struct md5_ctx *ctx) __THROW;
+                                 struct md5_ctx *ctx) __THROW;
 
 /* Starting with the result of former calls of this function (or the
    initialization function update the context for the next LEN bytes
    starting at BUFFER.
    It is NOT required that LEN is a multiple of 64.  */
 extern void __md5_process_bytes (const void *buffer, size_t len,
-                                struct md5_ctx *ctx) __THROW;
+                                 struct md5_ctx *ctx) __THROW;
 
 /* Process the remaining bytes in the buffer and put result from CTX
    in first 16 bytes following RESBUF.  The result is always in little
@@ -117,7 +117,7 @@ extern int __md5_stream (FILE *stream, void *resblock) 
__THROW;
    output yields to the wanted ASCII representation of the message
    digest.  */
 extern void *__md5_buffer (const char *buffer, size_t len,
-                          void *resblock) __THROW;
+                           void *resblock) __THROW;
 
 # ifdef __cplusplus
 }
diff --git a/gl/memchr.c b/gl/memchr.c
index 2253d2d..a23ff78 100644
--- a/gl/memchr.c
+++ b/gl/memchr.c
@@ -97,15 +97,15 @@ __memchr (void const *s, int c_in, size_t n)
       repeated_one |= repeated_one << 31 << 1;
       repeated_c |= repeated_c << 31 << 1;
       if (8 < sizeof (longword))
-       {
-         size_t i;
-
-         for (i = 64; i < sizeof (longword) * 8; i *= 2)
-           {
-             repeated_one |= repeated_one << i;
-             repeated_c |= repeated_c << i;
-           }
-       }
+        {
+          size_t i;
+
+          for (i = 64; i < sizeof (longword) * 8; i *= 2)
+            {
+              repeated_one |= repeated_one << i;
+              repeated_c |= repeated_c << i;
+            }
+        }
     }
 
   /* Instead of the traditional loop which tests each byte, we will test a
@@ -144,8 +144,8 @@ __memchr (void const *s, int c_in, size_t n)
       longword longword1 = *longword_ptr ^ repeated_c;
 
       if ((((longword1 - repeated_one) & ~longword1)
-          & (repeated_one << 7)) != 0)
-       break;
+           & (repeated_one << 7)) != 0)
+        break;
       longword_ptr++;
       n -= sizeof (longword);
     }
@@ -162,7 +162,7 @@ __memchr (void const *s, int c_in, size_t n)
   for (; n > 0; --n, ++char_ptr)
     {
       if (*char_ptr == c)
-       return (void *) char_ptr;
+        return (void *) char_ptr;
     }
 
   return NULL;
diff --git a/gl/mktime-internal.h b/gl/mktime-internal.h
new file mode 100644
index 0000000..4287acf
--- /dev/null
+++ b/gl/mktime-internal.h
@@ -0,0 +1,4 @@
+#include <time.h>
+time_t mktime_internal (struct tm *,
+                        struct tm * (*) (time_t const *, struct tm *),
+                        time_t *);
diff --git a/gl/mktime.c b/gl/mktime.c
index 0f30d43..5126204 100644
--- a/gl/mktime.c
+++ b/gl/mktime.c
@@ -1,5 +1,5 @@
 /* Convert a `struct tm' to a time_t value.
-   Copyright (C) 1993-1999, 2002-2005, 2006, 2007 Free Software Foundation, 
Inc.
+   Copyright (C) 1993-1999, 2002-2007, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Paul Eggert <address@hidden>.
 
@@ -36,7 +36,7 @@
 
 #include <limits.h>
 
-#include <string.h>            /* For the real memcpy prototype.  */
+#include <string.h>             /* For the real memcpy prototype.  */
 
 #if DEBUG
 # include <stdio.h>
@@ -55,9 +55,9 @@
    implementations (e.g., UNICOS 9.0 on a Cray Y-MP EL) don't shift
    right in the usual way when A < 0, so SHR falls back on division if
    ordinary A >> B doesn't seem to be the usual signed shift.  */
-#define SHR(a, b)      \
-  (-1 >> 1 == -1       \
-   ? (a) >> (b)                \
+#define SHR(a, b)       \
+  (-1 >> 1 == -1        \
+   ? (a) >> (b)         \
    : (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))
 
 /* The extra casts in the following macros work around compiler bugs,
@@ -84,14 +84,14 @@
    your host.  */
 #define TYPE_MINIMUM(t) \
   ((t) (! TYPE_SIGNED (t) \
-       ? (t) 0 \
-       : TYPE_SIGNED_MAGNITUDE (t) \
-       ? ~ (t) 0 \
-       : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
+        ? (t) 0 \
+        : TYPE_SIGNED_MAGNITUDE (t) \
+        ? ~ (t) 0 \
+        : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
 #define TYPE_MAXIMUM(t) \
   ((t) (! TYPE_SIGNED (t) \
-       ? (t) -1 \
-       : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
+        ? (t) -1 \
+        : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
 
 #ifndef TIME_T_MIN
 # define TIME_T_MIN TYPE_MINIMUM (time_t)
@@ -123,7 +123,7 @@ leapyear (long int year)
   return
     ((year & 3) == 0
      && (year % 100 != 0
-        || ((year / 100) & 3) == (- (TM_YEAR_BASE / 100) & 3)));
+         || ((year / 100) & 3) == (- (TM_YEAR_BASE / 100) & 3)));
 }
 
 /* How many days come before each month (0-12).  */
@@ -147,6 +147,7 @@ const unsigned short int __mon_yday[2][13] =
 # undef __localtime_r
 # define __localtime_r localtime_r
 # define __mktime_internal mktime_internal
+# include "mktime-internal.h"
 #endif
 
 /* Return an integer value measuring (YEAR1-YDAY1 HOUR1:MIN1:SEC1) -
@@ -162,11 +163,14 @@ const unsigned short int __mon_yday[2][13] =
 
 static inline time_t
 ydhms_diff (long int year1, long int yday1, int hour1, int min1, int sec1,
-           int year0, int yday0, int hour0, int min0, int sec0)
+            int year0, int yday0, int hour0, int min0, int sec0)
 {
   verify (C99_integer_division, -1 / 2 == 0);
+#if 0 /* This assertion fails on 32-bit systems with 64-bit time_t, such as
+         NetBSD 5 on i386.  */
   verify (long_int_year_and_yday_are_wide_enough,
-         INT_MAX <= LONG_MAX / 2 || TIME_T_MAX <= UINT_MAX);
+          INT_MAX <= LONG_MAX / 2 || TIME_T_MAX <= UINT_MAX);
+#endif
 
   /* Compute intervening leap days correctly even if year is negative.
      Take care to avoid integer overflow here.  */
@@ -198,16 +202,16 @@ ydhms_diff (long int year1, long int yday1, int hour1, 
int min1, int sec1,
    yield a value equal to *T.  */
 static time_t
 guess_time_tm (long int year, long int yday, int hour, int min, int sec,
-              const time_t *t, const struct tm *tp)
+               const time_t *t, const struct tm *tp)
 {
   if (tp)
     {
       time_t d = ydhms_diff (year, yday, hour, min, sec,
-                            tp->tm_year, tp->tm_yday,
-                            tp->tm_hour, tp->tm_min, tp->tm_sec);
+                             tp->tm_year, tp->tm_yday,
+                             tp->tm_hour, tp->tm_min, tp->tm_sec);
       time_t t1 = *t + d;
       if ((t1 < *t) == (TYPE_SIGNED (time_t) ? d < 0 : TIME_T_MAX / 2 < d))
-       return t1;
+        return t1;
     }
 
   /* Overflow occurred one way or another.  Return the nearest result
@@ -216,8 +220,8 @@ guess_time_tm (long int year, long int yday, int hour, int 
min, int sec,
      match; and don't oscillate between two values, as that would
      confuse the spring-forward gap detector.  */
   return (*t < TIME_T_MIDPOINT
-         ? (*t <= TIME_T_MIN + 1 ? *t + 1 : TIME_T_MIN)
-         : (TIME_T_MAX - 1 <= *t ? *t - 1 : TIME_T_MAX));
+          ? (*t <= TIME_T_MIN + 1 ? *t + 1 : TIME_T_MIN)
+          : (TIME_T_MAX - 1 <= *t ? *t - 1 : TIME_T_MAX));
 }
 
 /* Use CONVERT to convert *T to a broken down time in *TP.
@@ -225,7 +229,7 @@ guess_time_tm (long int year, long int yday, int hour, int 
min, int sec,
    it is the nearest in-range value and then convert that.  */
 static struct tm *
 ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
-               time_t *t, struct tm *tp)
+                time_t *t, struct tm *tp)
 {
   struct tm *r = convert (t, tp);
 
@@ -235,27 +239,27 @@ ranged_convert (struct tm *(*convert) (const time_t *, 
struct tm *),
       time_t ok = 0;
 
       /* BAD is a known unconvertible time_t, and OK is a known good one.
-        Use binary search to narrow the range between BAD and OK until
-        they differ by 1.  */
+         Use binary search to narrow the range between BAD and OK until
+         they differ by 1.  */
       while (bad != ok + (bad < 0 ? -1 : 1))
-       {
-         time_t mid = *t = (bad < 0
-                            ? bad + ((ok - bad) >> 1)
-                            : ok + ((bad - ok) >> 1));
-         r = convert (t, tp);
-         if (r)
-           ok = mid;
-         else
-           bad = mid;
-       }
+        {
+          time_t mid = *t = (bad < 0
+                             ? bad + ((ok - bad) >> 1)
+                             : ok + ((bad - ok) >> 1));
+          r = convert (t, tp);
+          if (r)
+            ok = mid;
+          else
+            bad = mid;
+        }
 
       if (!r && ok)
-       {
-         /* The last conversion attempt failed;
-            revert to the most recent successful attempt.  */
-         *t = ok;
-         r = convert (t, tp);
-       }
+        {
+          /* The last conversion attempt failed;
+             revert to the most recent successful attempt.  */
+          *t = ok;
+          r = convert (t, tp);
+        }
     }
 
   return r;
@@ -270,8 +274,8 @@ ranged_convert (struct tm *(*convert) (const time_t *, 
struct tm *),
    This function is external because it is used also by timegm.c.  */
 time_t
 __mktime_internal (struct tm *tp,
-                  struct tm *(*convert) (const time_t *, struct tm *),
-                  time_t *offset)
+                   struct tm *(*convert) (const time_t *, struct tm *),
+                   time_t *offset)
 {
   time_t t, gt, t0, t1, t2;
   struct tm tm;
@@ -292,7 +296,7 @@ __mktime_internal (struct tm *tp,
   int year_requested = tp->tm_year;
   /* Normalize the value.  */
   int isdst = ((tp->tm_isdst >> (8 * sizeof (tp->tm_isdst) - 1))
-              | (tp->tm_isdst != 0));
+               | (tp->tm_isdst != 0));
 
   /* 1 if the previous probe was DST.  */
   int dst2;
@@ -312,8 +316,8 @@ __mktime_internal (struct tm *tp,
   /* Calculate day of year from year, month, and day of month.
      The result need not be in range.  */
   int mon_yday = ((__mon_yday[leapyear (year)]
-                  [mon_remainder + 12 * negative_mon_remainder])
-                 - 1);
+                   [mon_remainder + 12 * negative_mon_remainder])
+                  - 1);
   long int lmday = mday;
   long int yday = mon_yday + lmday;
 
@@ -324,33 +328,33 @@ __mktime_internal (struct tm *tp,
   if (LEAP_SECONDS_POSSIBLE)
     {
       /* Handle out-of-range seconds specially,
-        since ydhms_tm_diff assumes every minute has 60 seconds.  */
+         since ydhms_tm_diff assumes every minute has 60 seconds.  */
       if (sec < 0)
-       sec = 0;
+        sec = 0;
       if (59 < sec)
-       sec = 59;
+        sec = 59;
     }
 
   /* Invert CONVERT by probing.  First assume the same offset as last
      time.  */
 
   t0 = ydhms_diff (year, yday, hour, min, sec,
-                  EPOCH_YEAR - TM_YEAR_BASE, 0, 0, 0, - guessed_offset);
+                   EPOCH_YEAR - TM_YEAR_BASE, 0, 0, 0, - guessed_offset);
 
   if (TIME_T_MAX / INT_MAX / 366 / 24 / 60 / 60 < 3)
     {
       /* time_t isn't large enough to rule out overflows, so check
-        for major overflows.  A gross check suffices, since if t0
-        has overflowed, it is off by a multiple of TIME_T_MAX -
-        TIME_T_MIN + 1.  So ignore any component of the difference
-        that is bounded by a small value.  */
+         for major overflows.  A gross check suffices, since if t0
+         has overflowed, it is off by a multiple of TIME_T_MAX -
+         TIME_T_MIN + 1.  So ignore any component of the difference
+         that is bounded by a small value.  */
 
       /* Approximate log base 2 of the number of time units per
-        biennium.  A biennium is 2 years; use this unit instead of
-        years to avoid integer overflow.  For example, 2 average
-        Gregorian years are 2 * 365.2425 * 24 * 60 * 60 seconds,
-        which is 63113904 seconds, and rint (log2 (63113904)) is
-        26.  */
+         biennium.  A biennium is 2 years; use this unit instead of
+         years to avoid integer overflow.  For example, 2 average
+         Gregorian years are 2 * 365.2425 * 24 * 60 * 60 seconds,
+         which is 63113904 seconds, and rint (log2 (63113904)) is
+         26.  */
       int ALOG2_SECONDS_PER_BIENNIUM = 26;
       int ALOG2_MINUTES_PER_BIENNIUM = 20;
       int ALOG2_HOURS_PER_BIENNIUM = 14;
@@ -358,64 +362,64 @@ __mktime_internal (struct tm *tp,
       int LOG2_YEARS_PER_BIENNIUM = 1;
 
       int approx_requested_biennia =
-       (SHR (year_requested, LOG2_YEARS_PER_BIENNIUM)
-        - SHR (EPOCH_YEAR - TM_YEAR_BASE, LOG2_YEARS_PER_BIENNIUM)
-        + SHR (mday, ALOG2_DAYS_PER_BIENNIUM)
-        + SHR (hour, ALOG2_HOURS_PER_BIENNIUM)
-        + SHR (min, ALOG2_MINUTES_PER_BIENNIUM)
-        + (LEAP_SECONDS_POSSIBLE
-           ? 0
-           : SHR (sec, ALOG2_SECONDS_PER_BIENNIUM)));
+        (SHR (year_requested, LOG2_YEARS_PER_BIENNIUM)
+         - SHR (EPOCH_YEAR - TM_YEAR_BASE, LOG2_YEARS_PER_BIENNIUM)
+         + SHR (mday, ALOG2_DAYS_PER_BIENNIUM)
+         + SHR (hour, ALOG2_HOURS_PER_BIENNIUM)
+         + SHR (min, ALOG2_MINUTES_PER_BIENNIUM)
+         + (LEAP_SECONDS_POSSIBLE
+            ? 0
+            : SHR (sec, ALOG2_SECONDS_PER_BIENNIUM)));
 
       int approx_biennia = SHR (t0, ALOG2_SECONDS_PER_BIENNIUM);
       int diff = approx_biennia - approx_requested_biennia;
       int abs_diff = diff < 0 ? - diff : diff;
 
       /* IRIX 4.0.5 cc miscaculates TIME_T_MIN / 3: it erroneously
-        gives a positive value of 715827882.  Setting a variable
-        first then doing math on it seems to work.
-        (address@hidden) */
+         gives a positive value of 715827882.  Setting a variable
+         first then doing math on it seems to work.
+         (address@hidden) */
       time_t time_t_max = TIME_T_MAX;
       time_t time_t_min = TIME_T_MIN;
       time_t overflow_threshold =
-       (time_t_max / 3 - time_t_min / 3) >> ALOG2_SECONDS_PER_BIENNIUM;
+        (time_t_max / 3 - time_t_min / 3) >> ALOG2_SECONDS_PER_BIENNIUM;
 
       if (overflow_threshold < abs_diff)
-       {
-         /* Overflow occurred.  Try repairing it; this might work if
-            the time zone offset is enough to undo the overflow.  */
-         time_t repaired_t0 = -1 - t0;
-         approx_biennia = SHR (repaired_t0, ALOG2_SECONDS_PER_BIENNIUM);
-         diff = approx_biennia - approx_requested_biennia;
-         abs_diff = diff < 0 ? - diff : diff;
-         if (overflow_threshold < abs_diff)
-           return -1;
-         guessed_offset += repaired_t0 - t0;
-         t0 = repaired_t0;
-       }
+        {
+          /* Overflow occurred.  Try repairing it; this might work if
+             the time zone offset is enough to undo the overflow.  */
+          time_t repaired_t0 = -1 - t0;
+          approx_biennia = SHR (repaired_t0, ALOG2_SECONDS_PER_BIENNIUM);
+          diff = approx_biennia - approx_requested_biennia;
+          abs_diff = diff < 0 ? - diff : diff;
+          if (overflow_threshold < abs_diff)
+            return -1;
+          guessed_offset += repaired_t0 - t0;
+          t0 = repaired_t0;
+        }
     }
 
   /* Repeatedly use the error to improve the guess.  */
 
   for (t = t1 = t2 = t0, dst2 = 0;
        (gt = guess_time_tm (year, yday, hour, min, sec, &t,
-                           ranged_convert (convert, &t, &tm)),
-       t != gt);
+                            ranged_convert (convert, &t, &tm)),
+        t != gt);
        t1 = t2, t2 = t, t = gt, dst2 = tm.tm_isdst != 0)
     if (t == t1 && t != t2
-       && (tm.tm_isdst < 0
-           || (isdst < 0
-               ? dst2 <= (tm.tm_isdst != 0)
-               : (isdst != 0) != (tm.tm_isdst != 0))))
+        && (tm.tm_isdst < 0
+            || (isdst < 0
+                ? dst2 <= (tm.tm_isdst != 0)
+                : (isdst != 0) != (tm.tm_isdst != 0))))
       /* We can't possibly find a match, as we are oscillating
-        between two values.  The requested time probably falls
-        within a spring-forward gap of size GT - T.  Follow the common
-        practice in this case, which is to return a time that is GT - T
-        away from the requested time, preferring a time whose
-        tm_isdst differs from the requested value.  (If no tm_isdst
-        was requested and only one of the two values has a nonzero
-        tm_isdst, prefer that value.)  In practice, this is more
-        useful than returning -1.  */
+         between two values.  The requested time probably falls
+         within a spring-forward gap of size GT - T.  Follow the common
+         practice in this case, which is to return a time that is GT - T
+         away from the requested time, preferring a time whose
+         tm_isdst differs from the requested value.  (If no tm_isdst
+         was requested and only one of the two values has a nonzero
+         tm_isdst, prefer that value.)  In practice, this is more
+         useful than returning -1.  */
       goto offset_found;
     else if (--remaining_probes == 0)
       return -1;
@@ -425,52 +429,52 @@ __mktime_internal (struct tm *tp,
   if (isdst != tm.tm_isdst && 0 <= isdst && 0 <= tm.tm_isdst)
     {
       /* tm.tm_isdst has the wrong value.  Look for a neighboring
-        time with the right value, and use its UTC offset.
+         time with the right value, and use its UTC offset.
 
-        Heuristic: probe the adjacent timestamps in both directions,
-        looking for the desired isdst.  This should work for all real
-        time zone histories in the tz database.  */
+         Heuristic: probe the adjacent timestamps in both directions,
+         looking for the desired isdst.  This should work for all real
+         time zone histories in the tz database.  */
 
       /* Distance between probes when looking for a DST boundary.  In
-        tzdata2003a, the shortest period of DST is 601200 seconds
-        (e.g., America/Recife starting 2000-10-08 01:00), and the
-        shortest period of non-DST surrounded by DST is 694800
-        seconds (Africa/Tunis starting 1943-04-17 01:00).  Use the
-        minimum of these two values, so we don't miss these short
-        periods when probing.  */
+         tzdata2003a, the shortest period of DST is 601200 seconds
+         (e.g., America/Recife starting 2000-10-08 01:00), and the
+         shortest period of non-DST surrounded by DST is 694800
+         seconds (Africa/Tunis starting 1943-04-17 01:00).  Use the
+         minimum of these two values, so we don't miss these short
+         periods when probing.  */
       int stride = 601200;
 
       /* The longest period of DST in tzdata2003a is 536454000 seconds
-        (e.g., America/Jujuy starting 1946-10-01 01:00).  The longest
-        period of non-DST is much longer, but it makes no real sense
-        to search for more than a year of non-DST, so use the DST
-        max.  */
+         (e.g., America/Jujuy starting 1946-10-01 01:00).  The longest
+         period of non-DST is much longer, but it makes no real sense
+         to search for more than a year of non-DST, so use the DST
+         max.  */
       int duration_max = 536454000;
 
       /* Search in both directions, so the maximum distance is half
-        the duration; add the stride to avoid off-by-1 problems.  */
+         the duration; add the stride to avoid off-by-1 problems.  */
       int delta_bound = duration_max / 2 + stride;
 
       int delta, direction;
 
       for (delta = stride; delta < delta_bound; delta += stride)
-       for (direction = -1; direction <= 1; direction += 2)
-         {
-           time_t ot = t + delta * direction;
-           if ((ot < t) == (direction < 0))
-             {
-               struct tm otm;
-               ranged_convert (convert, &ot, &otm);
-               if (otm.tm_isdst == isdst)
-                 {
-                   /* We found the desired tm_isdst.
-                      Extrapolate back to the desired time.  */
-                   t = guess_time_tm (year, yday, hour, min, sec, &ot, &otm);
-                   ranged_convert (convert, &t, &tm);
-                   goto offset_found;
-                 }
-             }
-         }
+        for (direction = -1; direction <= 1; direction += 2)
+          {
+            time_t ot = t + delta * direction;
+            if ((ot < t) == (direction < 0))
+              {
+                struct tm otm;
+                ranged_convert (convert, &ot, &otm);
+                if (otm.tm_isdst == isdst)
+                  {
+                    /* We found the desired tm_isdst.
+                       Extrapolate back to the desired time.  */
+                    t = guess_time_tm (year, yday, hour, min, sec, &ot, &otm);
+                    ranged_convert (convert, &t, &tm);
+                    goto offset_found;
+                  }
+              }
+          }
     }
 
  offset_found:
@@ -479,14 +483,14 @@ __mktime_internal (struct tm *tp,
   if (LEAP_SECONDS_POSSIBLE && sec_requested != tm.tm_sec)
     {
       /* Adjust time to reflect the tm_sec requested, not the normalized value.
-        Also, repair any damage from a false match due to a leap second.  */
+         Also, repair any damage from a false match due to a leap second.  */
       int sec_adjustment = (sec == 0 && tm.tm_sec == 60) - sec;
       t1 = t + sec_requested;
       t2 = t1 + sec_adjustment;
       if (((t1 < t) != (sec_requested < 0))
-         | ((t2 < t1) != (sec_adjustment < 0))
-         | ! convert (&t2, &tm))
-       return -1;
+          | ((t2 < t1) != (sec_adjustment < 0))
+          | ! convert (&t2, &tm))
+        return -1;
       t = t2;
     }
 
@@ -530,13 +534,13 @@ static int
 not_equal_tm (const struct tm *a, const struct tm *b)
 {
   return ((a->tm_sec ^ b->tm_sec)
-         | (a->tm_min ^ b->tm_min)
-         | (a->tm_hour ^ b->tm_hour)
-         | (a->tm_mday ^ b->tm_mday)
-         | (a->tm_mon ^ b->tm_mon)
-         | (a->tm_year ^ b->tm_year)
-         | (a->tm_yday ^ b->tm_yday)
-         | (a->tm_isdst ^ b->tm_isdst));
+          | (a->tm_min ^ b->tm_min)
+          | (a->tm_hour ^ b->tm_hour)
+          | (a->tm_mday ^ b->tm_mday)
+          | (a->tm_mon ^ b->tm_mon)
+          | (a->tm_year ^ b->tm_year)
+          | (a->tm_yday ^ b->tm_yday)
+          | (a->tm_isdst ^ b->tm_isdst));
 }
 
 static void
@@ -544,9 +548,9 @@ print_tm (const struct tm *tp)
 {
   if (tp)
     printf ("%04d-%02d-%02d %02d:%02d:%02d yday %03d wday %d isdst %d",
-           tp->tm_year + TM_YEAR_BASE, tp->tm_mon + 1, tp->tm_mday,
-           tp->tm_hour, tp->tm_min, tp->tm_sec,
-           tp->tm_yday, tp->tm_wday, tp->tm_isdst);
+            tp->tm_year + TM_YEAR_BASE, tp->tm_mon + 1, tp->tm_mday,
+            tp->tm_hour, tp->tm_min, tp->tm_sec,
+            tp->tm_yday, tp->tm_wday, tp->tm_isdst);
   else
     printf ("0");
 }
@@ -578,11 +582,11 @@ main (int argc, char **argv)
 
   if ((argc == 3 || argc == 4)
       && (sscanf (argv[1], "%d-%d-%d%c",
-                 &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &trailer)
-         == 3)
+                  &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &trailer)
+          == 3)
       && (sscanf (argv[2], "%d:%d:%d%c",
-                 &tm.tm_hour, &tm.tm_min, &tm.tm_sec, &trailer)
-         == 3))
+                  &tm.tm_hour, &tm.tm_min, &tm.tm_sec, &trailer)
+          == 3))
     {
       tm.tm_year -= TM_YEAR_BASE;
       tm.tm_mon--;
@@ -591,10 +595,10 @@ main (int argc, char **argv)
       tl = mktime (&tmk);
       lt = localtime (&tl);
       if (lt)
-       {
-         tml = *lt;
-         lt = &tml;
-       }
+        {
+          tml = *lt;
+          lt = &tml;
+        }
       printf ("mktime returns %ld == ", (long int) tl);
       print_tm (&tmk);
       printf ("\n");
@@ -607,51 +611,51 @@ main (int argc, char **argv)
       time_t to = atol (argv[3]);
 
       if (argc == 4)
-       for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
-         {
-           lt = localtime (&tl);
-           if (lt)
-             {
-               tmk = tml = *lt;
-               tk = mktime (&tmk);
-               status |= check_result (tk, tmk, tl, &tml);
-             }
-           else
-             {
-               printf ("localtime (%ld) yields 0\n", (long int) tl);
-               status = 1;
-             }
-           tl1 = tl + by;
-           if ((tl1 < tl) != (by < 0))
-             break;
-         }
+        for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
+          {
+            lt = localtime (&tl);
+            if (lt)
+              {
+                tmk = tml = *lt;
+                tk = mktime (&tmk);
+                status |= check_result (tk, tmk, tl, &tml);
+              }
+            else
+              {
+                printf ("localtime (%ld) yields 0\n", (long int) tl);
+                status = 1;
+              }
+            tl1 = tl + by;
+            if ((tl1 < tl) != (by < 0))
+              break;
+          }
       else
-       for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
-         {
-           /* Null benchmark.  */
-           lt = localtime (&tl);
-           if (lt)
-             {
-               tmk = tml = *lt;
-               tk = tl;
-               status |= check_result (tk, tmk, tl, &tml);
-             }
-           else
-             {
-               printf ("localtime (%ld) yields 0\n", (long int) tl);
-               status = 1;
-             }
-           tl1 = tl + by;
-           if ((tl1 < tl) != (by < 0))
-             break;
-         }
+        for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
+          {
+            /* Null benchmark.  */
+            lt = localtime (&tl);
+            if (lt)
+              {
+                tmk = tml = *lt;
+                tk = tl;
+                status |= check_result (tk, tmk, tl, &tml);
+              }
+            else
+              {
+                printf ("localtime (%ld) yields 0\n", (long int) tl);
+                status = 1;
+              }
+            tl1 = tl + by;
+            if ((tl1 < tl) != (by < 0))
+              break;
+          }
     }
   else
     printf ("Usage:\
 \t%s YYYY-MM-DD HH:MM:SS [ISDST] # Test given time.\n\
 \t%s FROM BY TO # Test values FROM, FROM+BY, ..., TO.\n\
 \t%s FROM BY TO - # Do not test those values (for benchmark).\n",
-           argv[0], argv[0], argv[0]);
+            argv[0], argv[0], argv[0]);
 
   return status;
 }
diff --git a/gl/netdb.in.h b/gl/netdb.in.h
index 363206d..c380da0 100644
--- a/gl/netdb.in.h
+++ b/gl/netdb.in.h
@@ -1,5 +1,5 @@
 /* Provide a netdb.h header file for systems lacking it (read: MinGW).
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008-2009 Free Software Foundation, Inc.
    Written by Simon Josefsson.
 
    This program is free software; you can redistribute it and/or modify
@@ -39,6 +39,8 @@
 /* Get netdb.h definitions such as struct hostent for MinGW.  */
 #include <sys/socket.h>
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 /* Declarations for a platform that lacks <netdb.h>, or where it is
    incomplete.  */
 
@@ -49,26 +51,26 @@
 /* Structure to contain information about address of a service provider.  */
 struct addrinfo
 {
-  int ai_flags;                        /* Input flags.  */
-  int ai_family;               /* Protocol family for socket.  */
-  int ai_socktype;             /* Socket type.  */
-  int ai_protocol;             /* Protocol for socket.  */
-  socklen_t ai_addrlen;                /* Length of socket address.  */
-  struct sockaddr *ai_addr;    /* Socket address for socket.  */
-  char *ai_canonname;          /* Canonical name for service location.  */
-  struct addrinfo *ai_next;    /* Pointer to next in list.  */
+  int ai_flags;                 /* Input flags.  */
+  int ai_family;                /* Protocol family for socket.  */
+  int ai_socktype;              /* Socket type.  */
+  int ai_protocol;              /* Protocol for socket.  */
+  socklen_t ai_addrlen;         /* Length of socket address.  */
+  struct sockaddr *ai_addr;     /* Socket address for socket.  */
+  char *ai_canonname;           /* Canonical name for service location.  */
+  struct addrinfo *ai_next;     /* Pointer to next in list.  */
 };
 # endif
 
 /* Possible values for `ai_flags' field in `addrinfo' structure.  */
 # ifndef AI_PASSIVE
-#  define AI_PASSIVE   0x0001  /* Socket address is intended for `bind'.  */
+#  define AI_PASSIVE    0x0001  /* Socket address is intended for `bind'.  */
 # endif
 # ifndef AI_CANONNAME
-#  define AI_CANONNAME 0x0002  /* Request for canonical name.  */
+#  define AI_CANONNAME  0x0002  /* Request for canonical name.  */
 # endif
 # ifndef AI_NUMERICSERV
-#  define AI_NUMERICSERV       0x0400  /* Don't use name resolution.  */
+#  define AI_NUMERICSERV        0x0400  /* Don't use name resolution.  */
 # endif
 
 # if 0
@@ -78,24 +80,24 @@ struct addrinfo
    define them.
 
    If they are restored, be sure to protect the definitions with #ifndef.  */
-#  define AI_NUMERICHOST       0x0004  /* Don't use name resolution.  */
-#  define AI_V4MAPPED  0x0008  /* IPv4 mapped addresses are acceptable.  */
-#  define AI_ALL               0x0010  /* Return IPv4 mapped and IPv6 
addresses.  */
-#  define AI_ADDRCONFIG        0x0020  /* Use configuration of this host to 
choose
-                                  returned address type..  */
+#  define AI_NUMERICHOST        0x0004  /* Don't use name resolution.  */
+#  define AI_V4MAPPED   0x0008  /* IPv4 mapped addresses are acceptable.  */
+#  define AI_ALL                0x0010  /* Return IPv4 mapped and IPv6 
addresses.  */
+#  define AI_ADDRCONFIG 0x0020  /* Use configuration of this host to choose
+                                   returned address type..  */
 # endif /* 0 */
 
 /* Error values for `getaddrinfo' function.  */
 # ifndef EAI_BADFLAGS
-#  define EAI_BADFLAGS   -1    /* Invalid value for `ai_flags' field.  */
-#  define EAI_NONAME     -2    /* NAME or SERVICE is unknown.  */
-#  define EAI_AGAIN      -3    /* Temporary failure in name resolution.  */
-#  define EAI_FAIL       -4    /* Non-recoverable failure in name res.  */
-#  define EAI_NODATA     -5    /* No address associated with NAME.  */
-#  define EAI_FAMILY     -6    /* `ai_family' not supported.  */
-#  define EAI_SOCKTYPE   -7    /* `ai_socktype' not supported.  */
-#  define EAI_SERVICE    -8    /* SERVICE not supported for `ai_socktype'.  */
-#  define EAI_MEMORY     -10   /* Memory allocation failure.  */
+#  define EAI_BADFLAGS    -1    /* Invalid value for `ai_flags' field.  */
+#  define EAI_NONAME      -2    /* NAME or SERVICE is unknown.  */
+#  define EAI_AGAIN       -3    /* Temporary failure in name resolution.  */
+#  define EAI_FAIL        -4    /* Non-recoverable failure in name res.  */
+#  define EAI_NODATA      -5    /* No address associated with NAME.  */
+#  define EAI_FAMILY      -6    /* `ai_family' not supported.  */
+#  define EAI_SOCKTYPE    -7    /* `ai_socktype' not supported.  */
+#  define EAI_SERVICE     -8    /* SERVICE not supported for `ai_socktype'.  */
+#  define EAI_MEMORY      -10   /* Memory allocation failure.  */
 # endif
 
 /* Since EAI_NODATA is deprecated by RFC3493, some systems (at least
@@ -107,15 +109,15 @@ struct addrinfo
 
 # ifndef EAI_OVERFLOW
 /* Not defined on mingw32 and Haiku. */
-#  define EAI_OVERFLOW   -12   /* Argument buffer overflow.  */
+#  define EAI_OVERFLOW    -12   /* Argument buffer overflow.  */
 # endif
 # ifndef EAI_ADDRFAMILY
 /* Not defined on mingw32. */
-#  define EAI_ADDRFAMILY  -9   /* Address family for NAME not supported.  */
+#  define EAI_ADDRFAMILY  -9    /* Address family for NAME not supported.  */
 # endif
 # ifndef EAI_SYSTEM
 /* Not defined on mingw32. */
-#  define EAI_SYSTEM     -11   /* System error returned in `errno'.  */
+#  define EAI_SYSTEM      -11   /* System error returned in `errno'.  */
 # endif
 
 # if 0
@@ -124,12 +126,12 @@ struct addrinfo
 
    If they are restored, be sure to protect the definitions with #ifndef.  */
 #  ifndef EAI_INPROGRESS
-#   define EAI_INPROGRESS      -100    /* Processing request in progress.  */
-#   define EAI_CANCELED                -101    /* Request canceled.  */
-#   define EAI_NOTCANCELED     -102    /* Request not canceled.  */
-#   define EAI_ALLDONE         -103    /* All requests done.  */
-#   define EAI_INTR            -104    /* Interrupted by a signal.  */
-#   define EAI_IDN_ENCODE      -105    /* IDN encoding failed.  */
+#   define EAI_INPROGRESS       -100    /* Processing request in progress.  */
+#   define EAI_CANCELED         -101    /* Request canceled.  */
+#   define EAI_NOTCANCELED      -102    /* Request not canceled.  */
+#   define EAI_ALLDONE          -103    /* All requests done.  */
+#   define EAI_INTR             -104    /* Interrupted by a signal.  */
+#   define EAI_IDN_ENCODE       -105    /* IDN encoding failed.  */
 #  endif
 # endif
 
@@ -139,16 +141,17 @@ struct addrinfo
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/getaddrinfo.html>.  */
 extern int getaddrinfo (const char *restrict nodename,
-                       const char *restrict servname,
-                       const struct addrinfo *restrict hints,
-                       struct addrinfo **restrict res);
+                        const char *restrict servname,
+                        const struct addrinfo *restrict hints,
+                        struct addrinfo **restrict res)
+     _GL_ARG_NONNULL ((4));
 # endif
 
 # if address@hidden@
 /* Free `addrinfo' structure AI including associated storage.
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/getaddrinfo.html>.  */
-extern void freeaddrinfo (struct addrinfo *ai);
+extern void freeaddrinfo (struct addrinfo *ai) _GL_ARG_NONNULL ((1));
 # endif
 
 # if address@hidden@
@@ -163,9 +166,10 @@ extern const char *gai_strerror (int ecode);
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/getnameinfo.html>.  */
 extern int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
-                      char *restrict node, socklen_t nodelen,
-                      char *restrict service, socklen_t servicelen,
-                      int flags);
+                       char *restrict node, socklen_t nodelen,
+                       char *restrict service, socklen_t servicelen,
+                       int flags)
+     _GL_ARG_NONNULL ((1));
 # endif
 
 /* Possible flags for getnameinfo.  */
diff --git a/gl/override/lib/gettext.h.diff b/gl/override/lib/gettext.h.diff
index fcd13cb..0265fe9 100644
--- a/gl/override/lib/gettext.h.diff
+++ b/gl/override/lib/gettext.h.diff
@@ -1,6 +1,6 @@
---- gl/gettext.h.orig  2008-11-17 17:12:20.000000000 +0100
-+++ gl/gettext.h       2008-11-17 17:12:29.000000000 +0100
-@@ -162,109 +162,4 @@
+--- gl/gettext.h.orig  2009-12-29 15:25:46.000000000 +0100
++++ gl/gettext.h       2009-12-29 15:25:52.000000000 +0100
+@@ -171,109 +171,4 @@
      return translation;
  }
  
@@ -32,8 +32,8 @@
 -#endif
 -static const char *
 -dcpgettext_expr (const char *domain,
--               const char *msgctxt, const char *msgid,
--               int category)
+-                 const char *msgctxt, const char *msgid,
+-                 int category)
 -{
 -  size_t msgctxt_len = strlen (msgctxt) + 1;
 -  size_t msgid_len = strlen (msgid) + 1;
@@ -55,10 +55,10 @@
 -      translation = dcgettext (domain, msg_ctxt_id, category);
 -#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
 -      if (msg_ctxt_id != buf)
--      free (msg_ctxt_id);
+-        free (msg_ctxt_id);
 -#endif
 -      if (translation != msg_ctxt_id)
--      return translation;
+-        return translation;
 -    }
 -  return msgid;
 -}
@@ -77,9 +77,9 @@
 -#endif
 -static const char *
 -dcnpgettext_expr (const char *domain,
--                const char *msgctxt, const char *msgid,
--                const char *msgid_plural, unsigned long int n,
--                int category)
+-                  const char *msgctxt, const char *msgid,
+-                  const char *msgid_plural, unsigned long int n,
+-                  int category)
 -{
 -  size_t msgctxt_len = strlen (msgctxt) + 1;
 -  size_t msgid_len = strlen (msgid) + 1;
@@ -101,10 +101,10 @@
 -      translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, 
category);
 -#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
 -      if (msg_ctxt_id != buf)
--      free (msg_ctxt_id);
+-        free (msg_ctxt_id);
 -#endif
 -      if (!(translation == msg_ctxt_id || translation == msgid_plural))
--      return translation;
+-        return translation;
 -    }
 -  return (n == 1 ? msgid : msgid_plural);
 -}
diff --git a/gl/printf-args.c b/gl/printf-args.c
index 871c720..3340b2c 100644
--- a/gl/printf-args.c
+++ b/gl/printf-args.c
@@ -1,5 +1,6 @@
 /* Decomposed printf argument list.
-   Copyright (C) 1999, 2002-2003, 2005-2007 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2003, 2005-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
@@ -42,146 +43,146 @@ PRINTF_FETCHARGS (va_list args, arguments *a)
     switch (ap->type)
       {
       case TYPE_SCHAR:
-       ap->a.a_schar = va_arg (args, /*signed char*/ int);
-       break;
+        ap->a.a_schar = va_arg (args, /*signed char*/ int);
+        break;
       case TYPE_UCHAR:
-       ap->a.a_uchar = va_arg (args, /*unsigned char*/ int);
-       break;
+        ap->a.a_uchar = va_arg (args, /*unsigned char*/ int);
+        break;
       case TYPE_SHORT:
-       ap->a.a_short = va_arg (args, /*short*/ int);
-       break;
+        ap->a.a_short = va_arg (args, /*short*/ int);
+        break;
       case TYPE_USHORT:
-       ap->a.a_ushort = va_arg (args, /*unsigned short*/ int);
-       break;
+        ap->a.a_ushort = va_arg (args, /*unsigned short*/ int);
+        break;
       case TYPE_INT:
-       ap->a.a_int = va_arg (args, int);
-       break;
+        ap->a.a_int = va_arg (args, int);
+        break;
       case TYPE_UINT:
-       ap->a.a_uint = va_arg (args, unsigned int);
-       break;
+        ap->a.a_uint = va_arg (args, unsigned int);
+        break;
       case TYPE_LONGINT:
-       ap->a.a_longint = va_arg (args, long int);
-       break;
+        ap->a.a_longint = va_arg (args, long int);
+        break;
       case TYPE_ULONGINT:
-       ap->a.a_ulongint = va_arg (args, unsigned long int);
-       break;
+        ap->a.a_ulongint = va_arg (args, unsigned long int);
+        break;
 #if HAVE_LONG_LONG_INT
       case TYPE_LONGLONGINT:
-       ap->a.a_longlongint = va_arg (args, long long int);
-       break;
+        ap->a.a_longlongint = va_arg (args, long long int);
+        break;
       case TYPE_ULONGLONGINT:
-       ap->a.a_ulonglongint = va_arg (args, unsigned long long int);
-       break;
+        ap->a.a_ulonglongint = va_arg (args, unsigned long long int);
+        break;
 #endif
       case TYPE_DOUBLE:
-       ap->a.a_double = va_arg (args, double);
-       break;
+        ap->a.a_double = va_arg (args, double);
+        break;
       case TYPE_LONGDOUBLE:
-       ap->a.a_longdouble = va_arg (args, long double);
-       break;
+        ap->a.a_longdouble = va_arg (args, long double);
+        break;
       case TYPE_CHAR:
-       ap->a.a_char = va_arg (args, int);
-       break;
+        ap->a.a_char = va_arg (args, int);
+        break;
 #if HAVE_WINT_T
       case TYPE_WIDE_CHAR:
-       /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by
-          default argument promotions", this is not the case in mingw32,
-          where wint_t is 'unsigned short'.  */
-       ap->a.a_wide_char =
-         (sizeof (wint_t) < sizeof (int)
-          ? va_arg (args, int)
-          : va_arg (args, wint_t));
-       break;
+        /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by
+           default argument promotions", this is not the case in mingw32,
+           where wint_t is 'unsigned short'.  */
+        ap->a.a_wide_char =
+          (sizeof (wint_t) < sizeof (int)
+           ? (wint_t) va_arg (args, int)
+           : va_arg (args, wint_t));
+        break;
 #endif
       case TYPE_STRING:
-       ap->a.a_string = va_arg (args, const char *);
-       /* A null pointer is an invalid argument for "%s", but in practice
-          it occurs quite frequently in printf statements that produce
-          debug output.  Use a fallback in this case.  */
-       if (ap->a.a_string == NULL)
-         ap->a.a_string = "(NULL)";
-       break;
+        ap->a.a_string = va_arg (args, const char *);
+        /* A null pointer is an invalid argument for "%s", but in practice
+           it occurs quite frequently in printf statements that produce
+           debug output.  Use a fallback in this case.  */
+        if (ap->a.a_string == NULL)
+          ap->a.a_string = "(NULL)";
+        break;
 #if HAVE_WCHAR_T
       case TYPE_WIDE_STRING:
-       ap->a.a_wide_string = va_arg (args, const wchar_t *);
-       /* A null pointer is an invalid argument for "%ls", but in practice
-          it occurs quite frequently in printf statements that produce
-          debug output.  Use a fallback in this case.  */
-       if (ap->a.a_wide_string == NULL)
-         {
-           static const wchar_t wide_null_string[] =
-             {
-               (wchar_t)'(',
-               (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L',
-               (wchar_t)')',
-               (wchar_t)0
-             };
-           ap->a.a_wide_string = wide_null_string;
-         }
-       break;
+        ap->a.a_wide_string = va_arg (args, const wchar_t *);
+        /* A null pointer is an invalid argument for "%ls", but in practice
+           it occurs quite frequently in printf statements that produce
+           debug output.  Use a fallback in this case.  */
+        if (ap->a.a_wide_string == NULL)
+          {
+            static const wchar_t wide_null_string[] =
+              {
+                (wchar_t)'(',
+                (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L',
+                (wchar_t)')',
+                (wchar_t)0
+              };
+            ap->a.a_wide_string = wide_null_string;
+          }
+        break;
 #endif
       case TYPE_POINTER:
-       ap->a.a_pointer = va_arg (args, void *);
-       break;
+        ap->a.a_pointer = va_arg (args, void *);
+        break;
       case TYPE_COUNT_SCHAR_POINTER:
-       ap->a.a_count_schar_pointer = va_arg (args, signed char *);
-       break;
+        ap->a.a_count_schar_pointer = va_arg (args, signed char *);
+        break;
       case TYPE_COUNT_SHORT_POINTER:
-       ap->a.a_count_short_pointer = va_arg (args, short *);
-       break;
+        ap->a.a_count_short_pointer = va_arg (args, short *);
+        break;
       case TYPE_COUNT_INT_POINTER:
-       ap->a.a_count_int_pointer = va_arg (args, int *);
-       break;
+        ap->a.a_count_int_pointer = va_arg (args, int *);
+        break;
       case TYPE_COUNT_LONGINT_POINTER:
-       ap->a.a_count_longint_pointer = va_arg (args, long int *);
-       break;
+        ap->a.a_count_longint_pointer = va_arg (args, long int *);
+        break;
 #if HAVE_LONG_LONG_INT
       case TYPE_COUNT_LONGLONGINT_POINTER:
-       ap->a.a_count_longlongint_pointer = va_arg (args, long long int *);
-       break;
+        ap->a.a_count_longlongint_pointer = va_arg (args, long long int *);
+        break;
 #endif
 #if ENABLE_UNISTDIO
       /* The unistdio extensions.  */
       case TYPE_U8_STRING:
-       ap->a.a_u8_string = va_arg (args, const uint8_t *);
-       /* A null pointer is an invalid argument for "%U", but in practice
-          it occurs quite frequently in printf statements that produce
-          debug output.  Use a fallback in this case.  */
-       if (ap->a.a_u8_string == NULL)
-         {
-           static const uint8_t u8_null_string[] =
-             { '(', 'N', 'U', 'L', 'L', ')', 0 };
-           ap->a.a_u8_string = u8_null_string;
-         }
-       break;
+        ap->a.a_u8_string = va_arg (args, const uint8_t *);
+        /* A null pointer is an invalid argument for "%U", but in practice
+           it occurs quite frequently in printf statements that produce
+           debug output.  Use a fallback in this case.  */
+        if (ap->a.a_u8_string == NULL)
+          {
+            static const uint8_t u8_null_string[] =
+              { '(', 'N', 'U', 'L', 'L', ')', 0 };
+            ap->a.a_u8_string = u8_null_string;
+          }
+        break;
       case TYPE_U16_STRING:
-       ap->a.a_u16_string = va_arg (args, const uint16_t *);
-       /* A null pointer is an invalid argument for "%lU", but in practice
-          it occurs quite frequently in printf statements that produce
-          debug output.  Use a fallback in this case.  */
-       if (ap->a.a_u16_string == NULL)
-         {
-           static const uint16_t u16_null_string[] =
-             { '(', 'N', 'U', 'L', 'L', ')', 0 };
-           ap->a.a_u16_string = u16_null_string;
-         }
-       break;
+        ap->a.a_u16_string = va_arg (args, const uint16_t *);
+        /* A null pointer is an invalid argument for "%lU", but in practice
+           it occurs quite frequently in printf statements that produce
+           debug output.  Use a fallback in this case.  */
+        if (ap->a.a_u16_string == NULL)
+          {
+            static const uint16_t u16_null_string[] =
+              { '(', 'N', 'U', 'L', 'L', ')', 0 };
+            ap->a.a_u16_string = u16_null_string;
+          }
+        break;
       case TYPE_U32_STRING:
-       ap->a.a_u32_string = va_arg (args, const uint32_t *);
-       /* A null pointer is an invalid argument for "%llU", but in practice
-          it occurs quite frequently in printf statements that produce
-          debug output.  Use a fallback in this case.  */
-       if (ap->a.a_u32_string == NULL)
-         {
-           static const uint32_t u32_null_string[] =
-             { '(', 'N', 'U', 'L', 'L', ')', 0 };
-           ap->a.a_u32_string = u32_null_string;
-         }
-       break;
+        ap->a.a_u32_string = va_arg (args, const uint32_t *);
+        /* A null pointer is an invalid argument for "%llU", but in practice
+           it occurs quite frequently in printf statements that produce
+           debug output.  Use a fallback in this case.  */
+        if (ap->a.a_u32_string == NULL)
+          {
+            static const uint32_t u32_null_string[] =
+              { '(', 'N', 'U', 'L', 'L', ')', 0 };
+            ap->a.a_u32_string = u32_null_string;
+          }
+        break;
 #endif
       default:
-       /* Unknown type.  */
-       return -1;
+        /* Unknown type.  */
+        return -1;
       }
   return 0;
 }
diff --git a/gl/printf-args.h b/gl/printf-args.h
index 67cb990..4166068 100644
--- a/gl/printf-args.h
+++ b/gl/printf-args.h
@@ -93,42 +93,42 @@ typedef struct
   arg_type type;
   union
   {
-    signed char                        a_schar;
-    unsigned char              a_uchar;
-    short                      a_short;
-    unsigned short             a_ushort;
-    int                                a_int;
-    unsigned int               a_uint;
-    long int                   a_longint;
-    unsigned long int          a_ulongint;
+    signed char                 a_schar;
+    unsigned char               a_uchar;
+    short                       a_short;
+    unsigned short              a_ushort;
+    int                         a_int;
+    unsigned int                a_uint;
+    long int                    a_longint;
+    unsigned long int           a_ulongint;
 #if HAVE_LONG_LONG_INT
-    long long int              a_longlongint;
-    unsigned long long int     a_ulonglongint;
+    long long int               a_longlongint;
+    unsigned long long int      a_ulonglongint;
 #endif
-    float                      a_float;
-    double                     a_double;
-    long double                        a_longdouble;
-    int                                a_char;
+    float                       a_float;
+    double                      a_double;
+    long double                 a_longdouble;
+    int                         a_char;
 #if HAVE_WINT_T
-    wint_t                     a_wide_char;
+    wint_t                      a_wide_char;
 #endif
-    const char*                        a_string;
+    const char*                 a_string;
 #if HAVE_WCHAR_T
-    const wchar_t*             a_wide_string;
+    const wchar_t*              a_wide_string;
 #endif
-    void*                      a_pointer;
-    signed char *              a_count_schar_pointer;
-    short *                    a_count_short_pointer;
-    int *                      a_count_int_pointer;
-    long int *                 a_count_longint_pointer;
+    void*                       a_pointer;
+    signed char *               a_count_schar_pointer;
+    short *                     a_count_short_pointer;
+    int *                       a_count_int_pointer;
+    long int *                  a_count_longint_pointer;
 #if HAVE_LONG_LONG_INT
-    long long int *            a_count_longlongint_pointer;
+    long long int *             a_count_longlongint_pointer;
 #endif
 #if ENABLE_UNISTDIO
     /* The unistdio extensions.  */
-    const uint8_t *            a_u8_string;
-    const uint16_t *           a_u16_string;
-    const uint32_t *           a_u32_string;
+    const uint8_t *             a_u8_string;
+    const uint16_t *            a_u16_string;
+    const uint32_t *            a_u32_string;
 #endif
   }
   a;
diff --git a/gl/printf-parse.c b/gl/printf-parse.c
index 28b9bd4..a4219dd 100644
--- a/gl/printf-parse.c
+++ b/gl/printf-parse.c
@@ -80,10 +80,10 @@ STATIC
 int
 PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
 {
-  const CHAR_T *cp = format;           /* pointer into format */
-  size_t arg_posn = 0;         /* number of regular arguments consumed */
-  size_t d_allocated;                  /* allocated elements of d->dir */
-  size_t a_allocated;                  /* allocated elements of a->arg */
+  const CHAR_T *cp = format;            /* pointer into format */
+  size_t arg_posn = 0;          /* number of regular arguments consumed */
+  size_t d_allocated;                   /* allocated elements of d->dir */
+  size_t a_allocated;                   /* allocated elements of a->arg */
   size_t max_width_length = 0;
   size_t max_precision_length = 0;
 
@@ -99,501 +99,501 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, 
arguments *a)
   a->arg = NULL;
 
 #define REGISTER_ARG(_index_,_type_) \
-  {                                                                    \
-    size_t n = (_index_);                                              \
-    if (n >= a_allocated)                                              \
-      {                                                                        
\
-       size_t memory_size;                                             \
-       argument *memory;                                               \
-                                                                       \
-       a_allocated = xtimes (a_allocated, 2);                          \
-       if (a_allocated <= n)                                           \
-         a_allocated = xsum (n, 1);                                    \
-       memory_size = xtimes (a_allocated, sizeof (argument));          \
-       if (size_overflow_p (memory_size))                              \
-         /* Overflow, would lead to out of memory.  */                 \
-         goto out_of_memory;                                           \
-       memory = (argument *) (a->arg                                   \
-                              ? realloc (a->arg, memory_size)          \
-                              : malloc (memory_size));                 \
-       if (memory == NULL)                                             \
-         /* Out of memory.  */                                         \
-         goto out_of_memory;                                           \
-       a->arg = memory;                                                \
-      }                                                                        
\
-    while (a->count <= n)                                              \
-      a->arg[a->count++].type = TYPE_NONE;                             \
-    if (a->arg[n].type == TYPE_NONE)                                   \
-      a->arg[n].type = (_type_);                                       \
-    else if (a->arg[n].type != (_type_))                               \
-      /* Ambiguous type for positional argument.  */                   \
-      goto error;                                                      \
+  {                                                                     \
+    size_t n = (_index_);                                               \
+    if (n >= a_allocated)                                               \
+      {                                                                 \
+        size_t memory_size;                                             \
+        argument *memory;                                               \
+                                                                        \
+        a_allocated = xtimes (a_allocated, 2);                          \
+        if (a_allocated <= n)                                           \
+          a_allocated = xsum (n, 1);                                    \
+        memory_size = xtimes (a_allocated, sizeof (argument));          \
+        if (size_overflow_p (memory_size))                              \
+          /* Overflow, would lead to out of memory.  */                 \
+          goto out_of_memory;                                           \
+        memory = (argument *) (a->arg                                   \
+                               ? realloc (a->arg, memory_size)          \
+                               : malloc (memory_size));                 \
+        if (memory == NULL)                                             \
+          /* Out of memory.  */                                         \
+          goto out_of_memory;                                           \
+        a->arg = memory;                                                \
+      }                                                                 \
+    while (a->count <= n)                                               \
+      a->arg[a->count++].type = TYPE_NONE;                              \
+    if (a->arg[n].type == TYPE_NONE)                                    \
+      a->arg[n].type = (_type_);                                        \
+    else if (a->arg[n].type != (_type_))                                \
+      /* Ambiguous type for positional argument.  */                    \
+      goto error;                                                       \
   }
 
   while (*cp != '\0')
     {
       CHAR_T c = *cp++;
       if (c == '%')
-       {
-         size_t arg_index = ARG_NONE;
-         DIRECTIVE *dp = &d->dir[d->count]; /* pointer to next directive */
-
-         /* Initialize the next directive.  */
-         dp->dir_start = cp - 1;
-         dp->flags = 0;
-         dp->width_start = NULL;
-         dp->width_end = NULL;
-         dp->width_arg_index = ARG_NONE;
-         dp->precision_start = NULL;
-         dp->precision_end = NULL;
-         dp->precision_arg_index = ARG_NONE;
-         dp->arg_index = ARG_NONE;
-
-         /* Test for positional argument.  */
-         if (*cp >= '0' && *cp <= '9')
-           {
-             const CHAR_T *np;
-
-             for (np = cp; *np >= '0' && *np <= '9'; np++)
-               ;
-             if (*np == '$')
-               {
-                 size_t n = 0;
-
-                 for (np = cp; *np >= '0' && *np <= '9'; np++)
-                   n = xsum (xtimes (n, 10), *np - '0');
-                 if (n == 0)
-                   /* Positional argument 0.  */
-                   goto error;
-                 if (size_overflow_p (n))
-                   /* n too large, would lead to out of memory later.  */
-                   goto error;
-                 arg_index = n - 1;
-                 cp = np + 1;
-               }
-           }
-
-         /* Read the flags.  */
-         for (;;)
-           {
-             if (*cp == '\'')
-               {
-                 dp->flags |= FLAG_GROUP;
-                 cp++;
-               }
-             else if (*cp == '-')
-               {
-                 dp->flags |= FLAG_LEFT;
-                 cp++;
-               }
-             else if (*cp == '+')
-               {
-                 dp->flags |= FLAG_SHOWSIGN;
-                 cp++;
-               }
-             else if (*cp == ' ')
-               {
-                 dp->flags |= FLAG_SPACE;
-                 cp++;
-               }
-             else if (*cp == '#')
-               {
-                 dp->flags |= FLAG_ALT;
-                 cp++;
-               }
-             else if (*cp == '0')
-               {
-                 dp->flags |= FLAG_ZERO;
-                 cp++;
-               }
-             else
-               break;
-           }
-
-         /* Parse the field width.  */
-         if (*cp == '*')
-           {
-             dp->width_start = cp;
-             cp++;
-             dp->width_end = cp;
-             if (max_width_length < 1)
-               max_width_length = 1;
-
-             /* Test for positional argument.  */
-             if (*cp >= '0' && *cp <= '9')
-               {
-                 const CHAR_T *np;
-
-                 for (np = cp; *np >= '0' && *np <= '9'; np++)
-                   ;
-                 if (*np == '$')
-                   {
-                     size_t n = 0;
-
-                     for (np = cp; *np >= '0' && *np <= '9'; np++)
-                       n = xsum (xtimes (n, 10), *np - '0');
-                     if (n == 0)
-                       /* Positional argument 0.  */
-                       goto error;
-                     if (size_overflow_p (n))
-                       /* n too large, would lead to out of memory later.  */
-                       goto error;
-                     dp->width_arg_index = n - 1;
-                     cp = np + 1;
-                   }
-               }
-             if (dp->width_arg_index == ARG_NONE)
-               {
-                 dp->width_arg_index = arg_posn++;
-                 if (dp->width_arg_index == ARG_NONE)
-                   /* arg_posn wrapped around.  */
-                   goto error;
-               }
-             REGISTER_ARG (dp->width_arg_index, TYPE_INT);
-           }
-         else if (*cp >= '0' && *cp <= '9')
-           {
-             size_t width_length;
-
-             dp->width_start = cp;
-             for (; *cp >= '0' && *cp <= '9'; cp++)
-               ;
-             dp->width_end = cp;
-             width_length = dp->width_end - dp->width_start;
-             if (max_width_length < width_length)
-               max_width_length = width_length;
-           }
-
-         /* Parse the precision.  */
-         if (*cp == '.')
-           {
-             cp++;
-             if (*cp == '*')
-               {
-                 dp->precision_start = cp - 1;
-                 cp++;
-                 dp->precision_end = cp;
-                 if (max_precision_length < 2)
-                   max_precision_length = 2;
-
-                 /* Test for positional argument.  */
-                 if (*cp >= '0' && *cp <= '9')
-                   {
-                     const CHAR_T *np;
-
-                     for (np = cp; *np >= '0' && *np <= '9'; np++)
-                       ;
-                     if (*np == '$')
-                       {
-                         size_t n = 0;
-
-                         for (np = cp; *np >= '0' && *np <= '9'; np++)
-                           n = xsum (xtimes (n, 10), *np - '0');
-                         if (n == 0)
-                           /* Positional argument 0.  */
-                           goto error;
-                         if (size_overflow_p (n))
-                           /* n too large, would lead to out of memory
-                              later.  */
-                           goto error;
-                         dp->precision_arg_index = n - 1;
-                         cp = np + 1;
-                       }
-                   }
-                 if (dp->precision_arg_index == ARG_NONE)
-                   {
-                     dp->precision_arg_index = arg_posn++;
-                     if (dp->precision_arg_index == ARG_NONE)
-                       /* arg_posn wrapped around.  */
-                       goto error;
-                   }
-                 REGISTER_ARG (dp->precision_arg_index, TYPE_INT);
-               }
-             else
-               {
-                 size_t precision_length;
-
-                 dp->precision_start = cp - 1;
-                 for (; *cp >= '0' && *cp <= '9'; cp++)
-                   ;
-                 dp->precision_end = cp;
-                 precision_length = dp->precision_end - dp->precision_start;
-                 if (max_precision_length < precision_length)
-                   max_precision_length = precision_length;
-               }
-           }
-
-         {
-           arg_type type;
-
-           /* Parse argument type/size specifiers.  */
-           {
-             int flags = 0;
-
-             for (;;)
-               {
-                 if (*cp == 'h')
-                   {
-                     flags |= (1 << (flags & 1));
-                     cp++;
-                   }
-                 else if (*cp == 'L')
-                   {
-                     flags |= 4;
-                     cp++;
-                   }
-                 else if (*cp == 'l')
-                   {
-                     flags += 8;
-                     cp++;
-                   }
-                 else if (*cp == 'j')
-                   {
-                     if (sizeof (intmax_t) > sizeof (long))
-                       {
-                         /* intmax_t = long long */
-                         flags += 16;
-                       }
-                     else if (sizeof (intmax_t) > sizeof (int))
-                       {
-                         /* intmax_t = long */
-                         flags += 8;
-                       }
-                     cp++;
-                   }
-                 else if (*cp == 'z' || *cp == 'Z')
-                   {
-                     /* 'z' is standardized in ISO C 99, but glibc uses 'Z'
-                        because the warning facility in gcc-2.95.2 understands
-                        only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784).  */
-                     if (sizeof (size_t) > sizeof (long))
-                       {
-                         /* size_t = long long */
-                         flags += 16;
-                       }
-                     else if (sizeof (size_t) > sizeof (int))
-                       {
-                         /* size_t = long */
-                         flags += 8;
-                       }
-                     cp++;
-                   }
-                 else if (*cp == 't')
-                   {
-                     if (sizeof (ptrdiff_t) > sizeof (long))
-                       {
-                         /* ptrdiff_t = long long */
-                         flags += 16;
-                       }
-                     else if (sizeof (ptrdiff_t) > sizeof (int))
-                       {
-                         /* ptrdiff_t = long */
-                         flags += 8;
-                       }
-                     cp++;
-                   }
+        {
+          size_t arg_index = ARG_NONE;
+          DIRECTIVE *dp = &d->dir[d->count]; /* pointer to next directive */
+
+          /* Initialize the next directive.  */
+          dp->dir_start = cp - 1;
+          dp->flags = 0;
+          dp->width_start = NULL;
+          dp->width_end = NULL;
+          dp->width_arg_index = ARG_NONE;
+          dp->precision_start = NULL;
+          dp->precision_end = NULL;
+          dp->precision_arg_index = ARG_NONE;
+          dp->arg_index = ARG_NONE;
+
+          /* Test for positional argument.  */
+          if (*cp >= '0' && *cp <= '9')
+            {
+              const CHAR_T *np;
+
+              for (np = cp; *np >= '0' && *np <= '9'; np++)
+                ;
+              if (*np == '$')
+                {
+                  size_t n = 0;
+
+                  for (np = cp; *np >= '0' && *np <= '9'; np++)
+                    n = xsum (xtimes (n, 10), *np - '0');
+                  if (n == 0)
+                    /* Positional argument 0.  */
+                    goto error;
+                  if (size_overflow_p (n))
+                    /* n too large, would lead to out of memory later.  */
+                    goto error;
+                  arg_index = n - 1;
+                  cp = np + 1;
+                }
+            }
+
+          /* Read the flags.  */
+          for (;;)
+            {
+              if (*cp == '\'')
+                {
+                  dp->flags |= FLAG_GROUP;
+                  cp++;
+                }
+              else if (*cp == '-')
+                {
+                  dp->flags |= FLAG_LEFT;
+                  cp++;
+                }
+              else if (*cp == '+')
+                {
+                  dp->flags |= FLAG_SHOWSIGN;
+                  cp++;
+                }
+              else if (*cp == ' ')
+                {
+                  dp->flags |= FLAG_SPACE;
+                  cp++;
+                }
+              else if (*cp == '#')
+                {
+                  dp->flags |= FLAG_ALT;
+                  cp++;
+                }
+              else if (*cp == '0')
+                {
+                  dp->flags |= FLAG_ZERO;
+                  cp++;
+                }
+              else
+                break;
+            }
+
+          /* Parse the field width.  */
+          if (*cp == '*')
+            {
+              dp->width_start = cp;
+              cp++;
+              dp->width_end = cp;
+              if (max_width_length < 1)
+                max_width_length = 1;
+
+              /* Test for positional argument.  */
+              if (*cp >= '0' && *cp <= '9')
+                {
+                  const CHAR_T *np;
+
+                  for (np = cp; *np >= '0' && *np <= '9'; np++)
+                    ;
+                  if (*np == '$')
+                    {
+                      size_t n = 0;
+
+                      for (np = cp; *np >= '0' && *np <= '9'; np++)
+                        n = xsum (xtimes (n, 10), *np - '0');
+                      if (n == 0)
+                        /* Positional argument 0.  */
+                        goto error;
+                      if (size_overflow_p (n))
+                        /* n too large, would lead to out of memory later.  */
+                        goto error;
+                      dp->width_arg_index = n - 1;
+                      cp = np + 1;
+                    }
+                }
+              if (dp->width_arg_index == ARG_NONE)
+                {
+                  dp->width_arg_index = arg_posn++;
+                  if (dp->width_arg_index == ARG_NONE)
+                    /* arg_posn wrapped around.  */
+                    goto error;
+                }
+              REGISTER_ARG (dp->width_arg_index, TYPE_INT);
+            }
+          else if (*cp >= '0' && *cp <= '9')
+            {
+              size_t width_length;
+
+              dp->width_start = cp;
+              for (; *cp >= '0' && *cp <= '9'; cp++)
+                ;
+              dp->width_end = cp;
+              width_length = dp->width_end - dp->width_start;
+              if (max_width_length < width_length)
+                max_width_length = width_length;
+            }
+
+          /* Parse the precision.  */
+          if (*cp == '.')
+            {
+              cp++;
+              if (*cp == '*')
+                {
+                  dp->precision_start = cp - 1;
+                  cp++;
+                  dp->precision_end = cp;
+                  if (max_precision_length < 2)
+                    max_precision_length = 2;
+
+                  /* Test for positional argument.  */
+                  if (*cp >= '0' && *cp <= '9')
+                    {
+                      const CHAR_T *np;
+
+                      for (np = cp; *np >= '0' && *np <= '9'; np++)
+                        ;
+                      if (*np == '$')
+                        {
+                          size_t n = 0;
+
+                          for (np = cp; *np >= '0' && *np <= '9'; np++)
+                            n = xsum (xtimes (n, 10), *np - '0');
+                          if (n == 0)
+                            /* Positional argument 0.  */
+                            goto error;
+                          if (size_overflow_p (n))
+                            /* n too large, would lead to out of memory
+                               later.  */
+                            goto error;
+                          dp->precision_arg_index = n - 1;
+                          cp = np + 1;
+                        }
+                    }
+                  if (dp->precision_arg_index == ARG_NONE)
+                    {
+                      dp->precision_arg_index = arg_posn++;
+                      if (dp->precision_arg_index == ARG_NONE)
+                        /* arg_posn wrapped around.  */
+                        goto error;
+                    }
+                  REGISTER_ARG (dp->precision_arg_index, TYPE_INT);
+                }
+              else
+                {
+                  size_t precision_length;
+
+                  dp->precision_start = cp - 1;
+                  for (; *cp >= '0' && *cp <= '9'; cp++)
+                    ;
+                  dp->precision_end = cp;
+                  precision_length = dp->precision_end - dp->precision_start;
+                  if (max_precision_length < precision_length)
+                    max_precision_length = precision_length;
+                }
+            }
+
+          {
+            arg_type type;
+
+            /* Parse argument type/size specifiers.  */
+            {
+              int flags = 0;
+
+              for (;;)
+                {
+                  if (*cp == 'h')
+                    {
+                      flags |= (1 << (flags & 1));
+                      cp++;
+                    }
+                  else if (*cp == 'L')
+                    {
+                      flags |= 4;
+                      cp++;
+                    }
+                  else if (*cp == 'l')
+                    {
+                      flags += 8;
+                      cp++;
+                    }
+                  else if (*cp == 'j')
+                    {
+                      if (sizeof (intmax_t) > sizeof (long))
+                        {
+                          /* intmax_t = long long */
+                          flags += 16;
+                        }
+                      else if (sizeof (intmax_t) > sizeof (int))
+                        {
+                          /* intmax_t = long */
+                          flags += 8;
+                        }
+                      cp++;
+                    }
+                  else if (*cp == 'z' || *cp == 'Z')
+                    {
+                      /* 'z' is standardized in ISO C 99, but glibc uses 'Z'
+                         because the warning facility in gcc-2.95.2 understands
+                         only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784).  */
+                      if (sizeof (size_t) > sizeof (long))
+                        {
+                          /* size_t = long long */
+                          flags += 16;
+                        }
+                      else if (sizeof (size_t) > sizeof (int))
+                        {
+                          /* size_t = long */
+                          flags += 8;
+                        }
+                      cp++;
+                    }
+                  else if (*cp == 't')
+                    {
+                      if (sizeof (ptrdiff_t) > sizeof (long))
+                        {
+                          /* ptrdiff_t = long long */
+                          flags += 16;
+                        }
+                      else if (sizeof (ptrdiff_t) > sizeof (int))
+                        {
+                          /* ptrdiff_t = long */
+                          flags += 8;
+                        }
+                      cp++;
+                    }
 #if defined __APPLE__ && defined __MACH__
-                 /* On MacOS X 10.3, PRIdMAX is defined as "qd".
-                    We cannot change it to "lld" because PRIdMAX must also
-                    be understood by the system's printf routines.  */
-                 else if (*cp == 'q')
-                   {
-                     if (64 / 8 > sizeof (long))
-                       {
-                         /* int64_t = long long */
-                         flags += 16;
-                       }
-                     else
-                       {
-                         /* int64_t = long */
-                         flags += 8;
-                       }
-                     cp++;
-                   }
+                  /* On MacOS X 10.3, PRIdMAX is defined as "qd".
+                     We cannot change it to "lld" because PRIdMAX must also
+                     be understood by the system's printf routines.  */
+                  else if (*cp == 'q')
+                    {
+                      if (64 / 8 > sizeof (long))
+                        {
+                          /* int64_t = long long */
+                          flags += 16;
+                        }
+                      else
+                        {
+                          /* int64_t = long */
+                          flags += 8;
+                        }
+                      cp++;
+                    }
 #endif
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-                 /* On native Win32, PRIdMAX is defined as "I64d".
-                    We cannot change it to "lld" because PRIdMAX must also
-                    be understood by the system's printf routines.  */
-                 else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4')
-                   {
-                     if (64 / 8 > sizeof (long))
-                       {
-                         /* __int64 = long long */
-                         flags += 16;
-                       }
-                     else
-                       {
-                         /* __int64 = long */
-                         flags += 8;
-                       }
-                     cp += 3;
-                   }
+                  /* On native Win32, PRIdMAX is defined as "I64d".
+                     We cannot change it to "lld" because PRIdMAX must also
+                     be understood by the system's printf routines.  */
+                  else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4')
+                    {
+                      if (64 / 8 > sizeof (long))
+                        {
+                          /* __int64 = long long */
+                          flags += 16;
+                        }
+                      else
+                        {
+                          /* __int64 = long */
+                          flags += 8;
+                        }
+                      cp += 3;
+                    }
 #endif
-                 else
-                   break;
-               }
-
-             /* Read the conversion character.  */
-             c = *cp++;
-             switch (c)
-               {
-               case 'd': case 'i':
+                  else
+                    break;
+                }
+
+              /* Read the conversion character.  */
+              c = *cp++;
+              switch (c)
+                {
+                case 'd': case 'i':
 #if HAVE_LONG_LONG_INT
-                 /* If 'long long' exists and is larger than 'long':  */
-                 if (flags >= 16 || (flags & 4))
-                   type = TYPE_LONGLONGINT;
-                 else
+                  /* If 'long long' exists and is larger than 'long':  */
+                  if (flags >= 16 || (flags & 4))
+                    type = TYPE_LONGLONGINT;
+                  else
 #endif
-                 /* If 'long long' exists and is the same as 'long', we parse
-                    "lld" into TYPE_LONGINT.  */
-                 if (flags >= 8)
-                   type = TYPE_LONGINT;
-                 else if (flags & 2)
-                   type = TYPE_SCHAR;
-                 else if (flags & 1)
-                   type = TYPE_SHORT;
-                 else
-                   type = TYPE_INT;
-                 break;
-               case 'o': case 'u': case 'x': case 'X':
+                  /* If 'long long' exists and is the same as 'long', we parse
+                     "lld" into TYPE_LONGINT.  */
+                  if (flags >= 8)
+                    type = TYPE_LONGINT;
+                  else if (flags & 2)
+                    type = TYPE_SCHAR;
+                  else if (flags & 1)
+                    type = TYPE_SHORT;
+                  else
+                    type = TYPE_INT;
+                  break;
+                case 'o': case 'u': case 'x': case 'X':
 #if HAVE_LONG_LONG_INT
-                 /* If 'long long' exists and is larger than 'long':  */
-                 if (flags >= 16 || (flags & 4))
-                   type = TYPE_ULONGLONGINT;
-                 else
+                  /* If 'long long' exists and is larger than 'long':  */
+                  if (flags >= 16 || (flags & 4))
+                    type = TYPE_ULONGLONGINT;
+                  else
 #endif
-                 /* If 'unsigned long long' exists and is the same as
-                    'unsigned long', we parse "llu" into TYPE_ULONGINT.  */
-                 if (flags >= 8)
-                   type = TYPE_ULONGINT;
-                 else if (flags & 2)
-                   type = TYPE_UCHAR;
-                 else if (flags & 1)
-                   type = TYPE_USHORT;
-                 else
-                   type = TYPE_UINT;
-                 break;
-               case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
-               case 'a': case 'A':
-                 if (flags >= 16 || (flags & 4))
-                   type = TYPE_LONGDOUBLE;
-                 else
-                   type = TYPE_DOUBLE;
-                 break;
-               case 'c':
-                 if (flags >= 8)
+                  /* If 'unsigned long long' exists and is the same as
+                     'unsigned long', we parse "llu" into TYPE_ULONGINT.  */
+                  if (flags >= 8)
+                    type = TYPE_ULONGINT;
+                  else if (flags & 2)
+                    type = TYPE_UCHAR;
+                  else if (flags & 1)
+                    type = TYPE_USHORT;
+                  else
+                    type = TYPE_UINT;
+                  break;
+                case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
+                case 'a': case 'A':
+                  if (flags >= 16 || (flags & 4))
+                    type = TYPE_LONGDOUBLE;
+                  else
+                    type = TYPE_DOUBLE;
+                  break;
+                case 'c':
+                  if (flags >= 8)
 #if HAVE_WINT_T
-                   type = TYPE_WIDE_CHAR;
+                    type = TYPE_WIDE_CHAR;
 #else
-                   goto error;
+                    goto error;
 #endif
-                 else
-                   type = TYPE_CHAR;
-                 break;
+                  else
+                    type = TYPE_CHAR;
+                  break;
 #if HAVE_WINT_T
-               case 'C':
-                 type = TYPE_WIDE_CHAR;
-                 c = 'c';
-                 break;
+                case 'C':
+                  type = TYPE_WIDE_CHAR;
+                  c = 'c';
+                  break;
 #endif
-               case 's':
-                 if (flags >= 8)
+                case 's':
+                  if (flags >= 8)
 #if HAVE_WCHAR_T
-                   type = TYPE_WIDE_STRING;
+                    type = TYPE_WIDE_STRING;
 #else
-                   goto error;
+                    goto error;
 #endif
-                 else
-                   type = TYPE_STRING;
-                 break;
+                  else
+                    type = TYPE_STRING;
+                  break;
 #if HAVE_WCHAR_T
-               case 'S':
-                 type = TYPE_WIDE_STRING;
-                 c = 's';
-                 break;
+                case 'S':
+                  type = TYPE_WIDE_STRING;
+                  c = 's';
+                  break;
 #endif
-               case 'p':
-                 type = TYPE_POINTER;
-                 break;
-               case 'n':
+                case 'p':
+                  type = TYPE_POINTER;
+                  break;
+                case 'n':
 #if HAVE_LONG_LONG_INT
-                 /* If 'long long' exists and is larger than 'long':  */
-                 if (flags >= 16 || (flags & 4))
-                   type = TYPE_COUNT_LONGLONGINT_POINTER;
-                 else
+                  /* If 'long long' exists and is larger than 'long':  */
+                  if (flags >= 16 || (flags & 4))
+                    type = TYPE_COUNT_LONGLONGINT_POINTER;
+                  else
 #endif
-                 /* If 'long long' exists and is the same as 'long', we parse
-                    "lln" into TYPE_COUNT_LONGINT_POINTER.  */
-                 if (flags >= 8)
-                   type = TYPE_COUNT_LONGINT_POINTER;
-                 else if (flags & 2)
-                   type = TYPE_COUNT_SCHAR_POINTER;
-                 else if (flags & 1)
-                   type = TYPE_COUNT_SHORT_POINTER;
-                 else
-                   type = TYPE_COUNT_INT_POINTER;
-                 break;
+                  /* If 'long long' exists and is the same as 'long', we parse
+                     "lln" into TYPE_COUNT_LONGINT_POINTER.  */
+                  if (flags >= 8)
+                    type = TYPE_COUNT_LONGINT_POINTER;
+                  else if (flags & 2)
+                    type = TYPE_COUNT_SCHAR_POINTER;
+                  else if (flags & 1)
+                    type = TYPE_COUNT_SHORT_POINTER;
+                  else
+                    type = TYPE_COUNT_INT_POINTER;
+                  break;
 #if ENABLE_UNISTDIO
-               /* The unistdio extensions.  */
-               case 'U':
-                 if (flags >= 16)
-                   type = TYPE_U32_STRING;
-                 else if (flags >= 8)
-                   type = TYPE_U16_STRING;
-                 else
-                   type = TYPE_U8_STRING;
-                 break;
+                /* The unistdio extensions.  */
+                case 'U':
+                  if (flags >= 16)
+                    type = TYPE_U32_STRING;
+                  else if (flags >= 8)
+                    type = TYPE_U16_STRING;
+                  else
+                    type = TYPE_U8_STRING;
+                  break;
 #endif
-               case '%':
-                 type = TYPE_NONE;
-                 break;
-               default:
-                 /* Unknown conversion character.  */
-                 goto error;
-               }
-           }
-
-           if (type != TYPE_NONE)
-             {
-               dp->arg_index = arg_index;
-               if (dp->arg_index == ARG_NONE)
-                 {
-                   dp->arg_index = arg_posn++;
-                   if (dp->arg_index == ARG_NONE)
-                     /* arg_posn wrapped around.  */
-                     goto error;
-                 }
-               REGISTER_ARG (dp->arg_index, type);
-             }
-           dp->conversion = c;
-           dp->dir_end = cp;
-         }
-
-         d->count++;
-         if (d->count >= d_allocated)
-           {
-             size_t memory_size;
-             DIRECTIVE *memory;
-
-             d_allocated = xtimes (d_allocated, 2);
-             memory_size = xtimes (d_allocated, sizeof (DIRECTIVE));
-             if (size_overflow_p (memory_size))
-               /* Overflow, would lead to out of memory.  */
-               goto out_of_memory;
-             memory = (DIRECTIVE *) realloc (d->dir, memory_size);
-             if (memory == NULL)
-               /* Out of memory.  */
-               goto out_of_memory;
-             d->dir = memory;
-           }
-       }
+                case '%':
+                  type = TYPE_NONE;
+                  break;
+                default:
+                  /* Unknown conversion character.  */
+                  goto error;
+                }
+            }
+
+            if (type != TYPE_NONE)
+              {
+                dp->arg_index = arg_index;
+                if (dp->arg_index == ARG_NONE)
+                  {
+                    dp->arg_index = arg_posn++;
+                    if (dp->arg_index == ARG_NONE)
+                      /* arg_posn wrapped around.  */
+                      goto error;
+                  }
+                REGISTER_ARG (dp->arg_index, type);
+              }
+            dp->conversion = c;
+            dp->dir_end = cp;
+          }
+
+          d->count++;
+          if (d->count >= d_allocated)
+            {
+              size_t memory_size;
+              DIRECTIVE *memory;
+
+              d_allocated = xtimes (d_allocated, 2);
+              memory_size = xtimes (d_allocated, sizeof (DIRECTIVE));
+              if (size_overflow_p (memory_size))
+                /* Overflow, would lead to out of memory.  */
+                goto out_of_memory;
+              memory = (DIRECTIVE *) realloc (d->dir, memory_size);
+              if (memory == NULL)
+                /* Out of memory.  */
+                goto out_of_memory;
+              d->dir = memory;
+            }
+        }
 #if CHAR_T_ONLY_ASCII
       else if (!c_isascii (c))
-       {
-         /* Non-ASCII character.  Not supported.  */
-         goto error;
-       }
+        {
+          /* Non-ASCII character.  Not supported.  */
+          goto error;
+        }
 #endif
     }
   d->dir[d->count].dir_start = cp;
diff --git a/gl/printf-parse.h b/gl/printf-parse.h
index e5d68d7..477f7ee 100644
--- a/gl/printf-parse.h
+++ b/gl/printf-parse.h
@@ -26,15 +26,15 @@
 
 
 /* Flags */
-#define FLAG_GROUP      1      /* ' flag */
-#define FLAG_LEFT       2      /* - flag */
-#define FLAG_SHOWSIGN   4      /* + flag */
-#define FLAG_SPACE      8      /* space flag */
-#define FLAG_ALT       16      /* # flag */
-#define FLAG_ZERO      32
+#define FLAG_GROUP       1      /* ' flag */
+#define FLAG_LEFT        2      /* - flag */
+#define FLAG_SHOWSIGN    4      /* + flag */
+#define FLAG_SPACE       8      /* space flag */
+#define FLAG_ALT        16      /* # flag */
+#define FLAG_ZERO       32
 
 /* arg_index value indicating that no argument is consumed.  */
-#define ARG_NONE       (~(size_t)0)
+#define ARG_NONE        (~(size_t)0)
 
 /* xxx_directive: A parsed directive.
    xxx_directives: A parsed format string.  */
@@ -163,10 +163,10 @@ extern int
        u8_printf_parse (const uint8_t *format, u8_directives *d, arguments *a);
 extern int
        u16_printf_parse (const uint16_t *format, u16_directives *d,
-                        arguments *a);
+                         arguments *a);
 extern int
        u32_printf_parse (const uint32_t *format, u32_directives *d,
-                        arguments *a);
+                         arguments *a);
 #else
 # ifdef STATIC
 STATIC
diff --git a/gl/read-file.c b/gl/read-file.c
index 0997b2e..366f22b 100644
--- a/gl/read-file.c
+++ b/gl/read-file.c
@@ -45,36 +45,36 @@ fread_file (FILE * stream, size_t * length)
       size_t requested;
 
       if (size + BUFSIZ + 1 > alloc)
-       {
-         char *new_buf;
+        {
+          char *new_buf;
 
-         alloc += alloc / 2;
-         if (alloc < size + BUFSIZ + 1)
-           alloc = size + BUFSIZ + 1;
+          alloc += alloc / 2;
+          if (alloc < size + BUFSIZ + 1)
+            alloc = size + BUFSIZ + 1;
 
-         new_buf = realloc (buf, alloc);
-         if (!new_buf)
-           {
-             save_errno = errno;
-             break;
-           }
+          new_buf = realloc (buf, alloc);
+          if (!new_buf)
+            {
+              save_errno = errno;
+              break;
+            }
 
-         buf = new_buf;
-       }
+          buf = new_buf;
+        }
 
       requested = alloc - size - 1;
       count = fread (buf + size, 1, requested, stream);
       size += count;
 
       if (count != requested)
-       {
-         save_errno = errno;
-         if (ferror (stream))
-           break;
-         buf[size] = '\0';
-         *length = size;
-         return buf;
-       }
+        {
+          save_errno = errno;
+          if (ferror (stream))
+            break;
+          buf[size] = '\0';
+          *length = size;
+          return buf;
+        }
     }
 
   free (buf);
@@ -99,10 +99,10 @@ internal_read_file (const char *filename, size_t * length, 
const char *mode)
   if (fclose (stream) != 0)
     {
       if (out)
-       {
-         save_errno = errno;
-         free (out);
-       }
+        {
+          save_errno = errno;
+          free (out);
+        }
       errno = save_errno;
       return NULL;
     }
diff --git a/gl/realloc.c b/gl/realloc.c
index b61c2ca..dc1adc9 100644
--- a/gl/realloc.c
+++ b/gl/realloc.c
@@ -71,7 +71,7 @@ rpl_realloc (void *p, size_t n)
     {
 #if GNULIB_REALLOC_GNU && !NEED_REALLOC_GNU && !SYSTEM_MALLOC_GLIBC_COMPATIBLE
       if (n == 0)
-       n = 1;
+        n = 1;
 #endif
       result = malloc (n);
     }
diff --git a/gl/recvfrom.c b/gl/recvfrom.c
index 52fa3c8..5da14ae 100644
--- a/gl/recvfrom.c
+++ b/gl/recvfrom.c
@@ -1,6 +1,6 @@
 /* recvfrom.c --- wrappers for Windows recvfrom 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
@@ -30,9 +30,9 @@
 
 int
 rpl_recvfrom (int fd, void *buf, int len, int flags, struct sockaddr *from,
-             int *fromlen)
+              int *fromlen)
 {
-  int frombufsize = *fromlen;
+  int frombufsize = (from != NULL ? *fromlen : 0);
   SOCKET sock = FD_TO_SOCKET (fd);
   int r = recvfrom (sock, buf, len, flags, from, fromlen);
 
@@ -41,7 +41,7 @@ rpl_recvfrom (int fd, void *buf, int len, int flags, struct 
sockaddr *from,
 
   /* Winsock recvfrom() only returns a valid 'from' when the socket is
      connectionless.  POSIX gives a valid 'from' for all types of sockets.  */
-  else if (*fromlen == frombufsize)
+  else if (from != NULL && *fromlen == frombufsize)
     rpl_getpeername (fd, from, fromlen);
 
   return r;
diff --git a/gl/select.c b/gl/select.c
index 82e438c..650c2ce 100644
--- a/gl/select.c
+++ b/gl/select.c
@@ -21,6 +21,7 @@
 
 #include <config.h>
 #include <alloca.h>
+#include <assert.h>
 
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 /* Native Win32.  */
@@ -70,17 +71,34 @@ typedef enum _FILE_INFORMATION_CLASS {
 } FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
 
 typedef DWORD (WINAPI *PNtQueryInformationFile)
-        (HANDLE, IO_STATUS_BLOCK *, VOID *, ULONG, FILE_INFORMATION_CLASS);
+         (HANDLE, IO_STATUS_BLOCK *, VOID *, ULONG, FILE_INFORMATION_CLASS);
 
 #ifndef PIPE_BUF
-#define PIPE_BUF       512
+#define PIPE_BUF        512
 #endif
 
+#define IsConsoleHandle(h) (((long) (h) & 3) == 3)
+
+static BOOL
+IsSocketHandle(HANDLE h)
+{
+  WSANETWORKEVENTS ev;
+
+  if (IsConsoleHandle (h))
+    return FALSE;
+
+  /* Under Wine, it seems that getsockopt returns 0 for pipes too.
+     WSAEnumNetworkEvents instead distinguishes the two correctly.  */
+  ev.lNetworkEvents = 0xDEADBEEF;
+  WSAEnumNetworkEvents ((SOCKET) h, NULL, &ev);
+  return ev.lNetworkEvents != 0xDEADBEEF;
+}
+
 /* Compute output fd_sets for libc descriptor FD (whose Win32 handle is H).  */
 
 static int
 win32_poll_handle (HANDLE h, int fd, struct bitset *rbits, struct bitset 
*wbits,
-                  struct bitset *xbits)
+                   struct bitset *xbits)
 {
   BOOL read, write, except;
   int i, ret;
@@ -102,60 +120,78 @@ win32_poll_handle (HANDLE h, int fd, struct bitset 
*rbits, struct bitset *wbits,
 
     case FILE_TYPE_PIPE:
       if (!once_only)
-       {
-         NtQueryInformationFile = (PNtQueryInformationFile)
-           GetProcAddress (GetModuleHandle ("ntdll.dll"),
-                           "NtQueryInformationFile");
-         once_only = TRUE;
-       }
+        {
+          NtQueryInformationFile = (PNtQueryInformationFile)
+            GetProcAddress (GetModuleHandle ("ntdll.dll"),
+                            "NtQueryInformationFile");
+          once_only = TRUE;
+        }
 
       if (PeekNamedPipe (h, NULL, 0, NULL, &avail, NULL) != 0)
-       {
-         if (avail)
-           read = TRUE;
-       }
+        {
+          if (avail)
+            read = TRUE;
+        }
 
       else
-       {
-         /* It was the write-end of the pipe.  Check if it is writable.
-            If NtQueryInformationFile fails, optimistically assume the pipe is
-            writable.  This could happen on Win9x, where NtQueryInformationFile
-            is not available, or if we inherit a pipe that doesn't permit
-            FILE_READ_ATTRIBUTES access on the write end (I think this should
-            not happen since WinXP SP2; WINE seems fine too).  Otherwise,
-            ensure that enough space is available for atomic writes.  */
+        {
+          /* It was the write-end of the pipe.  Check if it is writable.
+             If NtQueryInformationFile fails, optimistically assume the pipe is
+             writable.  This could happen on Win9x, where 
NtQueryInformationFile
+             is not available, or if we inherit a pipe that doesn't permit
+             FILE_READ_ATTRIBUTES access on the write end (I think this should
+             not happen since WinXP SP2; WINE seems fine too).  Otherwise,
+             ensure that enough space is available for atomic writes.  */
           memset (&iosb, 0, sizeof (iosb));
           memset (&fpli, 0, sizeof (fpli));
 
           if (!NtQueryInformationFile
               || NtQueryInformationFile (h, &iosb, &fpli, sizeof (fpli),
-                                        FilePipeLocalInformation)
-             || fpli.WriteQuotaAvailable >= PIPE_BUF
-             || (fpli.OutboundQuota < PIPE_BUF &&
-                 fpli.WriteQuotaAvailable == fpli.OutboundQuota))
-           write = TRUE;
-       }
+                                         FilePipeLocalInformation)
+              || fpli.WriteQuotaAvailable >= PIPE_BUF
+              || (fpli.OutboundQuota < PIPE_BUF &&
+                  fpli.WriteQuotaAvailable == fpli.OutboundQuota))
+            write = TRUE;
+        }
       break;
 
     case FILE_TYPE_CHAR:
-      ret = WaitForSingleObject (h, 0);
       write = TRUE;
+      if (!(rbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1)))))
+        break;
+
+      ret = WaitForSingleObject (h, 0);
       if (ret == WAIT_OBJECT_0)
         {
-         nbuffer = avail = 0;
-         bRet = GetNumberOfConsoleInputEvents (h, &nbuffer);
-         if (!bRet || nbuffer == 0)
-           except = TRUE;
-
-         irbuffer = (INPUT_RECORD *) alloca (nbuffer * sizeof (INPUT_RECORD));
-         bRet = PeekConsoleInput (h, irbuffer, nbuffer, &avail);
-         if (!bRet || avail == 0)
-           except = TRUE;
-
-         for (i = 0; i < avail; i++)
-           if (irbuffer[i].EventType == KEY_EVENT)
-             read = TRUE;
-       }
+          if (!IsConsoleHandle (h))
+            {
+              read = TRUE;
+              break;
+            }
+
+          nbuffer = avail = 0;
+          bRet = GetNumberOfConsoleInputEvents (h, &nbuffer);
+
+          /* Screen buffers handles are filtered earlier.  */
+          assert (bRet);
+          if (nbuffer == 0)
+            {
+              except = TRUE;
+              break;
+            }
+
+          irbuffer = (INPUT_RECORD *) alloca (nbuffer * sizeof (INPUT_RECORD));
+          bRet = PeekConsoleInput (h, irbuffer, nbuffer, &avail);
+          if (!bRet || avail == 0)
+            {
+              except = TRUE;
+              break;
+            }
+
+          for (i = 0; i < avail; i++)
+            if (irbuffer[i].EventType == KEY_EVENT)
+              read = TRUE;
+        }
       break;
 
     default:
@@ -199,7 +235,7 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set 
*xfds,
   fd_set handle_rfds, handle_wfds, handle_xfds;
   struct bitset rbits, wbits, xbits;
   unsigned char anyfds_in[FD_SETSIZE / CHAR_BIT];
-  DWORD ret, wait_timeout, nhandles, nsock;
+  DWORD ret, wait_timeout, nhandles, nsock, nbuffer;
   MSG msg;
   int i, fd, rc;
 
@@ -227,7 +263,10 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set 
*xfds,
   nhandles = 1;
   nsock = 0;
 
-  /* Copy descriptors to bitsets.  */
+  /* Copy descriptors to bitsets.  At the same time, eliminate
+     bits in the "wrong" direction for console input buffers
+     and screen buffers, because screen buffers are waitable
+     and they will block until a character is available.  */
   memset (&rbits, 0, sizeof (rbits));
   memset (&wbits, 0, sizeof (wbits));
   memset (&xbits, 0, sizeof (xbits));
@@ -236,6 +275,11 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set 
*xfds,
     for (i = 0; i < rfds->fd_count; i++)
       {
         fd = rfds->fd_array[i];
+        h = (HANDLE) _get_osfhandle (fd);
+        if (IsConsoleHandle (h)
+            && !GetNumberOfConsoleInputEvents (h, &nbuffer))
+          continue;
+
         rbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
         anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
       }
@@ -246,6 +290,11 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set 
*xfds,
     for (i = 0; i < wfds->fd_count; i++)
       {
         fd = wfds->fd_array[i];
+        h = (HANDLE) _get_osfhandle (fd);
+        if (IsConsoleHandle (h)
+            && GetNumberOfConsoleInputEvents (h, &nbuffer))
+          continue;
+
         wbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
         anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
       }
@@ -273,58 +322,52 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set 
*xfds,
   /* Classify handles.  Create fd sets for sockets, poll the others. */
   for (i = 0; i < nfds; i++)
     {
-      WSANETWORKEVENTS ev;
-
       if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0)
-       continue;
+        continue;
 
       h = (HANDLE) _get_osfhandle (i);
       if (!h)
         {
-         errno = EBADF;
-         return -1;
+          errno = EBADF;
+          return -1;
         }
 
-      /* Under Wine, it seems that getsockopt returns 0 for pipes too.
-        WSAEnumNetworkEvents instead distinguishes the two correctly.  */
-      ev.lNetworkEvents = 0xDEADBEEF;
-      WSAEnumNetworkEvents ((SOCKET) h, NULL, &ev);
-      if (ev.lNetworkEvents != 0xDEADBEEF)
+      if (IsSocketHandle (h))
         {
           int requested = FD_CLOSE;
 
           /* See above; socket handles are mapped onto select, but we
-            need to map descriptors to handles.  */
+             need to map descriptors to handles.  */
           if (rbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
-           {
+            {
               requested |= FD_READ | FD_ACCEPT;
-             FD_SET ((SOCKET) h, rfds);
-             FD_SET ((SOCKET) h, &handle_rfds);
-           }
+              FD_SET ((SOCKET) h, rfds);
+              FD_SET ((SOCKET) h, &handle_rfds);
+            }
           if (wbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
-           {
+            {
               requested |= FD_WRITE | FD_CONNECT;
-             FD_SET ((SOCKET) h, wfds);
-             FD_SET ((SOCKET) h, &handle_wfds);
-           }
+              FD_SET ((SOCKET) h, wfds);
+              FD_SET ((SOCKET) h, &handle_wfds);
+            }
           if (xbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
-           {
+            {
               requested |= FD_OOB;
-             FD_SET ((SOCKET) h, xfds);
-             FD_SET ((SOCKET) h, &handle_xfds);
-           }
+              FD_SET ((SOCKET) h, xfds);
+              FD_SET ((SOCKET) h, &handle_xfds);
+            }
 
           WSAEventSelect ((SOCKET) h, hEvent, requested);
-         nsock++;
+          nsock++;
         }
       else
         {
           handle_array[nhandles++] = h;
 
-         /* Poll now.  If we get an event, do not wait below.  */
+          /* Poll now.  If we get an event, do not wait below.  */
           if (wait_timeout != 0
-             && win32_poll_handle (h, i, &rbits, &wbits, &xbits))
-           wait_timeout = 0;
+              && win32_poll_handle (h, i, &rbits, &wbits, &xbits))
+            wait_timeout = 0;
         }
     }
 
@@ -337,12 +380,12 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set 
*xfds,
          no need to call select again.  */
       rc = select (0, &handle_rfds, &handle_wfds, &handle_xfds, &tv0);
       if (rc == 0)
-       {
-         /* Restore the fd_sets for the other select we do below.  */
+        {
+          /* Restore the fd_sets for the other select we do below.  */
           memcpy (&handle_rfds, rfds, sizeof (fd_set));
           memcpy (&handle_wfds, wfds, sizeof (fd_set));
           memcpy (&handle_xfds, xfds, sizeof (fd_set));
-       }
+        }
       else
         wait_timeout = 0;
     }
@@ -350,20 +393,20 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set 
*xfds,
   for (;;)
     {
       ret = MsgWaitForMultipleObjects (nhandles, handle_array, FALSE,
-                                      wait_timeout, QS_ALLINPUT);
+                                       wait_timeout, QS_ALLINPUT);
 
       if (ret == WAIT_OBJECT_0 + nhandles)
-       {
+        {
           /* new input of some other kind */
-         BOOL bRet;
+          BOOL bRet;
           while ((bRet = PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) != 0)
             {
               TranslateMessage (&msg);
               DispatchMessage (&msg);
             }
-       }
+        }
       else
-       break;
+        break;
     }
 
   /* If we haven't done it yet, check the status of the sockets.  */
@@ -381,13 +424,13 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set 
*xfds,
   for (i = 0; i < nfds; i++)
     {
       if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0)
-       continue;
+        continue;
 
       h = (HANDLE) _get_osfhandle (i);
       if (h != handle_array[nhandles])
-       {
-         /* Perform handle->descriptor mapping.  Don't update rc, as these
-            results are counted in the return value of Winsock's select.  */
+        {
+          /* Perform handle->descriptor mapping.  Don't update rc, as these
+             results are counted in the return value of Winsock's select.  */
           WSAEventSelect ((SOCKET) h, NULL, 0);
           if (FD_ISSET (h, &handle_rfds))
             FD_SET (i, rfds);
@@ -395,7 +438,7 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set 
*xfds,
             FD_SET (i, wfds);
           if (FD_ISSET (h, &handle_xfds))
             FD_SET (i, xfds);
-       }
+        }
       else
         {
           /* Not a socket.  */
@@ -403,19 +446,19 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set 
*xfds,
           win32_poll_handle (h, i, &rbits, &wbits, &xbits);
           if (rbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
             {
-             rc++;
-             FD_SET (i, rfds);
-           }
+              rc++;
+              FD_SET (i, rfds);
+            }
           if (wbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
             {
-             rc++;
-             FD_SET (i, wfds);
-           }
+              rc++;
+              FD_SET (i, wfds);
+            }
           if (xbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
             {
-             rc++;
-             FD_SET (i, xfds);
-           }
+              rc++;
+              FD_SET (i, xfds);
+            }
         }
     }
 
diff --git a/gl/sendto.c b/gl/sendto.c
index 888b0f6..b6cb8b9 100644
--- a/gl/sendto.c
+++ b/gl/sendto.c
@@ -30,7 +30,7 @@
 
 int
 rpl_sendto (int fd, const void *buf, int len, int flags,
-           struct sockaddr *to, int tolen)
+            struct sockaddr *to, int tolen)
 {
   SOCKET sock = FD_TO_SOCKET (fd);
   int r = sendto (sock, buf, len, flags, to, tolen);
diff --git a/gl/setenv.c b/gl/setenv.c
index 83b52b8..93a5ef9 100644
--- a/gl/setenv.c
+++ b/gl/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
@@ -17,6 +17,11 @@
 #if !_LIBC
 # include <config.h>
 #endif
+
+/* Don't use __attribute__ __nonnull__ in this compilation unit.  Otherwise gcc
+   optimizes away the name == NULL test below.  */
+#define _GL_ARG_NONNULL(params)
+
 #include <alloca.h>
 
 /* Specification.  */
@@ -32,22 +37,22 @@
 # include <unistd.h>
 #endif
 
-#if _LIBC || !HAVE_SETENV
-
 #if !_LIBC
 # include "malloca.h"
 #endif
 
+#if _LIBC || !HAVE_SETENV
+
 #if !_LIBC
-# define __environ     environ
+# define __environ      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)
+# define LOCK   __libc_lock_lock (envlock)
+# define UNLOCK __libc_lock_unlock (envlock)
 #else
 # define LOCK
 # define UNLOCK
@@ -66,8 +71,8 @@ __libc_lock_define_initialized (static, envlock)
    values are from a small set.  Outside glibc this will eat up all
    memory after a while.  */
 #if defined _LIBC || (defined HAVE_SEARCH_H && defined HAVE_TSEARCH \
-                     && defined __GNUC__)
-# define USE_TSEARCH   1
+                      && defined __GNUC__)
+# define USE_TSEARCH    1
 # include <search.h>
 typedef int (*compar_fn_t) (const void *, const void *);
 
@@ -76,9 +81,9 @@ typedef int (*compar_fn_t) (const void *, const void *);
 static void *known_values;
 
 # define KNOWN_VALUE(Str) \
-  ({                                                                         \
-    void *value = tfind (Str, &known_values, (compar_fn_t) strcmp);          \
-    value != NULL ? *(char **) value : NULL;                                 \
+  ({                                                                          \
+    void *value = tfind (Str, &known_values, (compar_fn_t) strcmp);           \
+    value != NULL ? *(char **) value : NULL;                                  \
   })
 # define STORE_VALUE(Str) \
   tsearch (Str, &known_values, (compar_fn_t) strcmp)
@@ -105,7 +110,7 @@ static char **last_environ;
    free the strings.  */
 int
 __add_to_environ (const char *name, const char *value, const char *combined,
-                 int replace)
+                  int replace)
 {
   register char **ep;
   register size_t size;
@@ -122,10 +127,10 @@ __add_to_environ (const char *name, const char *value, 
const char *combined,
   if (ep != NULL)
     {
       for (; *ep != NULL; ++ep)
-       if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=')
-         break;
-       else
-         ++size;
+        if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=')
+          break;
+        else
+          ++size;
     }
 
   if (ep == NULL || *ep == NULL)
@@ -137,76 +142,76 @@ __add_to_environ (const char *name, const char *value, 
const char *combined,
 
       /* We allocated this space; we can extend it.  */
       new_environ =
-       (char **) (last_environ == NULL
-                  ? malloc ((size + 2) * sizeof (char *))
-                  : realloc (last_environ, (size + 2) * sizeof (char *)));
+        (char **) (last_environ == NULL
+                   ? malloc ((size + 2) * sizeof (char *))
+                   : realloc (last_environ, (size + 2) * sizeof (char *)));
       if (new_environ == NULL)
-       {
-         UNLOCK;
-         return -1;
-       }
+        {
+          UNLOCK;
+          return -1;
+        }
 
       /* If the whole entry is given add it.  */
       if (combined != NULL)
-       /* We must not add the string to the search tree since it belongs
-          to the user.  */
-       new_environ[size] = (char *) combined;
+        /* We must not add the string to the search tree since it belongs
+           to the user.  */
+        new_environ[size] = (char *) combined;
       else
-       {
-         /* See whether the value is already known.  */
+        {
+          /* See whether the value is already known.  */
 #ifdef USE_TSEARCH
 # ifdef _LIBC
-         new_value = (char *) alloca (namelen + 1 + vallen);
-         __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
-                    value, vallen);
+          new_value = (char *) alloca (namelen + 1 + vallen);
+          __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
+                     value, vallen);
 # else
-         new_value = (char *) malloca (namelen + 1 + vallen);
-         if (new_value == NULL)
-           {
-             __set_errno (ENOMEM);
-             UNLOCK;
-             return -1;
-           }
-         memcpy (new_value, name, namelen);
-         new_value[namelen] = '=';
-         memcpy (&new_value[namelen + 1], value, vallen);
+          new_value = (char *) malloca (namelen + 1 + vallen);
+          if (new_value == NULL)
+            {
+              __set_errno (ENOMEM);
+              UNLOCK;
+              return -1;
+            }
+          memcpy (new_value, name, namelen);
+          new_value[namelen] = '=';
+          memcpy (&new_value[namelen + 1], value, vallen);
 # endif
 
-         new_environ[size] = KNOWN_VALUE (new_value);
-         if (new_environ[size] == NULL)
+          new_environ[size] = KNOWN_VALUE (new_value);
+          if (new_environ[size] == NULL)
 #endif
-           {
-             new_environ[size] = (char *) malloc (namelen + 1 + vallen);
-             if (new_environ[size] == NULL)
-               {
+            {
+              new_environ[size] = (char *) malloc (namelen + 1 + vallen);
+              if (new_environ[size] == NULL)
+                {
 #if defined USE_TSEARCH && !defined _LIBC
-                 freea (new_value);
+                  freea (new_value);
 #endif
-                 __set_errno (ENOMEM);
-                 UNLOCK;
-                 return -1;
-               }
+                  __set_errno (ENOMEM);
+                  UNLOCK;
+                  return -1;
+                }
 
 #ifdef USE_TSEARCH
-             memcpy (new_environ[size], new_value, namelen + 1 + vallen);
+              memcpy (new_environ[size], new_value, namelen + 1 + vallen);
 #else
-             memcpy (new_environ[size], name, namelen);
-             new_environ[size][namelen] = '=';
-             memcpy (&new_environ[size][namelen + 1], value, vallen);
+              memcpy (new_environ[size], name, namelen);
+              new_environ[size][namelen] = '=';
+              memcpy (&new_environ[size][namelen + 1], value, vallen);
 #endif
-             /* And save the value now.  We cannot do this when we remove
-                the string since then we cannot decide whether it is a
-                user string or not.  */
-             STORE_VALUE (new_environ[size]);
-           }
+              /* And save the value now.  We cannot do this when we remove
+                 the string since then we cannot decide whether it is a
+                 user string or not.  */
+              STORE_VALUE (new_environ[size]);
+            }
 #if defined USE_TSEARCH && !defined _LIBC
-         freea (new_value);
+          freea (new_value);
 #endif
-       }
+        }
 
       if (__environ != last_environ)
-       memcpy ((char *) new_environ, (char *) __environ,
-               size * sizeof (char *));
+        memcpy ((char *) new_environ, (char *) __environ,
+                size * sizeof (char *));
 
       new_environ[size + 1] = NULL;
 
@@ -218,57 +223,57 @@ __add_to_environ (const char *name, const char *value, 
const char *combined,
 
       /* Use the user string if given.  */
       if (combined != NULL)
-       np = (char *) combined;
+        np = (char *) combined;
       else
-       {
+        {
 #ifdef USE_TSEARCH
-         char *new_value;
+          char *new_value;
 # ifdef _LIBC
-         new_value = alloca (namelen + 1 + vallen);
-         __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
-                    value, vallen);
+          new_value = alloca (namelen + 1 + vallen);
+          __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
+                     value, vallen);
 # else
-         new_value = malloca (namelen + 1 + vallen);
-         if (new_value == NULL)
-           {
-             __set_errno (ENOMEM);
-             UNLOCK;
-             return -1;
-           }
-         memcpy (new_value, name, namelen);
-         new_value[namelen] = '=';
-         memcpy (&new_value[namelen + 1], value, vallen);
+          new_value = malloca (namelen + 1 + vallen);
+          if (new_value == NULL)
+            {
+              __set_errno (ENOMEM);
+              UNLOCK;
+              return -1;
+            }
+          memcpy (new_value, name, namelen);
+          new_value[namelen] = '=';
+          memcpy (&new_value[namelen + 1], value, vallen);
 # endif
 
-         np = KNOWN_VALUE (new_value);
-         if (np == NULL)
+          np = KNOWN_VALUE (new_value);
+          if (np == NULL)
 #endif
-           {
-             np = malloc (namelen + 1 + vallen);
-             if (np == NULL)
-               {
+            {
+              np = malloc (namelen + 1 + vallen);
+              if (np == NULL)
+                {
 #if defined USE_TSEARCH && !defined _LIBC
-                 freea (new_value);
+                  freea (new_value);
 #endif
-                 __set_errno (ENOMEM);
-                 UNLOCK;
-                 return -1;
-               }
+                  __set_errno (ENOMEM);
+                  UNLOCK;
+                  return -1;
+                }
 
 #ifdef USE_TSEARCH
-             memcpy (np, new_value, namelen + 1 + vallen);
+              memcpy (np, new_value, namelen + 1 + vallen);
 #else
-             memcpy (np, name, namelen);
-             np[namelen] = '=';
-             memcpy (&np[namelen + 1], value, vallen);
+              memcpy (np, name, namelen);
+              np[namelen] = '=';
+              memcpy (&np[namelen + 1], value, vallen);
 #endif
-             /* And remember the value.  */
-             STORE_VALUE (np);
-           }
+              /* And remember the value.  */
+              STORE_VALUE (np);
+            }
 #if defined USE_TSEARCH && !defined _LIBC
-         freea (new_value);
+          freea (new_value);
 #endif
-       }
+        }
 
       *ep = np;
     }
@@ -281,6 +286,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 +339,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/gl/sha1.c b/gl/sha1.c
index 1ad614d..d8e93a2 100644
--- a/gl/sha1.c
+++ b/gl/sha1.c
@@ -28,6 +28,7 @@
 #include "sha1.h"
 
 #include <stddef.h>
+#include <stdlib.h>
 #include <string.h>
 
 #if USE_UNLOCKED_IO
@@ -41,7 +42,7 @@
     (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
 #endif
 
-#define BLOCKSIZE 4096
+#define BLOCKSIZE 32768
 #if BLOCKSIZE % 64 != 0
 # error "invalid BLOCKSIZE"
 #endif
@@ -124,9 +125,12 @@ int
 sha1_stream (FILE *stream, void *resblock)
 {
   struct sha1_ctx ctx;
-  char buffer[BLOCKSIZE + 72];
   size_t sum;
 
+  char *buffer = malloc (BLOCKSIZE + 72);
+  if (!buffer)
+    return 1;
+
   /* Initialize the computation context.  */
   sha1_init_ctx (&ctx);
 
@@ -134,40 +138,43 @@ sha1_stream (FILE *stream, void *resblock)
   while (1)
     {
       /* We read the file in blocks of BLOCKSIZE bytes.  One call of the
-        computation function processes the whole buffer so that with the
-        next round of the loop another block can be read.  */
+         computation function processes the whole buffer so that with the
+         next round of the loop another block can be read.  */
       size_t n;
       sum = 0;
 
       /* Read block.  Take care for partial reads.  */
       while (1)
-       {
-         n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
-
-         sum += n;
-
-         if (sum == BLOCKSIZE)
-           break;
-
-         if (n == 0)
-           {
-             /* Check for the error flag IFF N == 0, so that we don't
-                exit the loop after a partial read due to e.g., EAGAIN
-                or EWOULDBLOCK.  */
-             if (ferror (stream))
-               return 1;
-             goto process_partial_block;
-           }
-
-         /* We've read at least one byte, so ignore errors.  But always
-            check for EOF, since feof may be true even though N > 0.
-            Otherwise, we could end up calling fread after EOF.  */
-         if (feof (stream))
-           goto process_partial_block;
-       }
+        {
+          n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
+
+          sum += n;
+
+          if (sum == BLOCKSIZE)
+            break;
+
+          if (n == 0)
+            {
+              /* Check for the error flag IFF N == 0, so that we don't
+                 exit the loop after a partial read due to e.g., EAGAIN
+                 or EWOULDBLOCK.  */
+              if (ferror (stream))
+                {
+                  free (buffer);
+                  return 1;
+                }
+              goto process_partial_block;
+            }
+
+          /* We've read at least one byte, so ignore errors.  But always
+             check for EOF, since feof may be true even though N > 0.
+             Otherwise, we could end up calling fread after EOF.  */
+          if (feof (stream))
+            goto process_partial_block;
+        }
 
       /* Process buffer with BLOCKSIZE bytes.  Note that
-                       BLOCKSIZE % 64 == 0
+                        BLOCKSIZE % 64 == 0
        */
       sha1_process_block (buffer, BLOCKSIZE, &ctx);
     }
@@ -180,6 +187,7 @@ sha1_stream (FILE *stream, void *resblock)
 
   /* Construct result in desired memory.  */
   sha1_finish_ctx (&ctx, resblock);
+  free (buffer);
   return 0;
 }
 
@@ -216,15 +224,15 @@ sha1_process_bytes (const void *buffer, size_t len, 
struct sha1_ctx *ctx)
       ctx->buflen += add;
 
       if (ctx->buflen > 64)
-       {
-         sha1_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
+        {
+          sha1_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
 
-         ctx->buflen &= 63;
-         /* The regions in the following copy operation cannot overlap.  */
-         memcpy (ctx->buffer,
-                 &((char *) ctx->buffer)[(left_over + add) & ~63],
-                 ctx->buflen);
-       }
+          ctx->buflen &= 63;
+          /* The regions in the following copy operation cannot overlap.  */
+          memcpy (ctx->buffer,
+                  &((char *) ctx->buffer)[(left_over + add) & ~63],
+                  ctx->buflen);
+        }
 
       buffer = (const char *) buffer + add;
       len -= add;
@@ -237,19 +245,19 @@ sha1_process_bytes (const void *buffer, size_t len, 
struct sha1_ctx *ctx)
 # define alignof(type) offsetof (struct { char c; type x; }, x)
 # define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0)
       if (UNALIGNED_P (buffer))
-       while (len > 64)
-         {
-           sha1_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
-           buffer = (const char *) buffer + 64;
-           len -= 64;
-         }
+        while (len > 64)
+          {
+            sha1_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
+            buffer = (const char *) buffer + 64;
+            len -= 64;
+          }
       else
 #endif
-       {
-         sha1_process_block (buffer, len & ~63, ctx);
-         buffer = (const char *) buffer + (len & ~63);
-         len &= 63;
-       }
+        {
+          sha1_process_block (buffer, len & ~63, ctx);
+          buffer = (const char *) buffer + (len & ~63);
+          len &= 63;
+        }
     }
 
   /* Move remaining bytes in internal buffer.  */
@@ -260,11 +268,11 @@ sha1_process_bytes (const void *buffer, size_t len, 
struct sha1_ctx *ctx)
       memcpy (&((char *) ctx->buffer)[left_over], buffer, len);
       left_over += len;
       if (left_over >= 64)
-       {
-         sha1_process_block (ctx->buffer, 64, ctx);
-         left_over -= 64;
-         memcpy (ctx->buffer, &ctx->buffer[16], left_over);
-       }
+        {
+          sha1_process_block (ctx->buffer, 64, ctx);
+          left_over -= 64;
+          memcpy (ctx->buffer, &ctx->buffer[16], left_over);
+        }
       ctx->buflen = left_over;
     }
 }
@@ -310,25 +318,25 @@ sha1_process_block (const void *buffer, size_t len, 
struct sha1_ctx *ctx)
 #define rol(x, n) (((x) << (n)) | ((uint32_t) (x) >> (32 - (n))))
 
 #define M(I) ( tm =   x[I&0x0f] ^ x[(I-14)&0x0f] \
-                   ^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \
-              , (x[I&0x0f] = rol(tm, 1)) )
+                    ^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \
+               , (x[I&0x0f] = rol(tm, 1)) )
 
 #define R(A,B,C,D,E,F,K,M)  do { E += rol( A, 5 )     \
-                                     + F( B, C, D )  \
-                                     + K             \
-                                     + M;            \
-                                B = rol( B, 30 );    \
-                              } while(0)
+                                      + F( B, C, D )  \
+                                      + K             \
+                                      + M;            \
+                                 B = rol( B, 30 );    \
+                               } while(0)
 
   while (words < endp)
     {
       uint32_t tm;
       int t;
       for (t = 0; t < 16; t++)
-       {
-         x[t] = SWAP (*words);
-         words++;
-       }
+        {
+          x[t] = SWAP (*words);
+          words++;
+        }
 
       R( a, b, c, d, e, F1, K1, x[ 0] );
       R( e, a, b, c, d, F1, K1, x[ 1] );
diff --git a/gl/sha1.h b/gl/sha1.h
index b1c51ce..9044d26 100644
--- a/gl/sha1.h
+++ b/gl/sha1.h
@@ -1,6 +1,6 @@
 /* Declarations of functions and data types used for SHA1 sum
    library functions.
-   Copyright (C) 2000, 2001, 2003, 2005, 2006, 2008
+   Copyright (C) 2000, 2001, 2003, 2005, 2006, 2008, 2009
    Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
@@ -52,14 +52,14 @@ extern void sha1_init_ctx (struct sha1_ctx *ctx);
    starting at BUFFER.
    It is necessary that LEN is a multiple of 64!!! */
 extern void sha1_process_block (const void *buffer, size_t len,
-                               struct sha1_ctx *ctx);
+                                struct sha1_ctx *ctx);
 
 /* Starting with the result of former calls of this function (or the
    initialization function update the context for the next LEN bytes
    starting at BUFFER.
    It is NOT required that LEN is a multiple of 64.  */
 extern void sha1_process_bytes (const void *buffer, size_t len,
-                               struct sha1_ctx *ctx);
+                                struct sha1_ctx *ctx);
 
 /* Process the remaining bytes in the buffer and put result from CTX
    in first 20 bytes following RESBUF.  The result is always in little
diff --git a/gl/signal.in.h b/gl/signal.in.h
index 5c42fe9..3a957cd 100644
--- a/gl/signal.in.h
+++ b/gl/signal.in.h
@@ -37,6 +37,8 @@
 
 /* The definition of GL_LINK_WARNING is copied here.  */
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 /* Define pid_t, uid_t.
    Also, mingw defines sigset_t not in <signal.h>, but in <sys/types.h>.  */
 #include <sys/types.h>
@@ -82,22 +84,22 @@ typedef unsigned int sigset_t;
 # endif
 
 /* Test whether a given signal is contained in a signal set.  */
-extern int sigismember (const sigset_t *set, int sig);
+extern int sigismember (const sigset_t *set, int sig) _GL_ARG_NONNULL ((1));
 
 /* Initialize a signal set to the empty set.  */
-extern int sigemptyset (sigset_t *set);
+extern int sigemptyset (sigset_t *set) _GL_ARG_NONNULL ((1));
 
 /* Add a signal to a signal set.  */
-extern int sigaddset (sigset_t *set, int sig);
+extern int sigaddset (sigset_t *set, int sig) _GL_ARG_NONNULL ((1));
 
 /* Remove a signal from a signal set.  */
-extern int sigdelset (sigset_t *set, int sig);
+extern int sigdelset (sigset_t *set, int sig) _GL_ARG_NONNULL ((1));
 
 /* Fill a signal set with all possible signals.  */
-extern int sigfillset (sigset_t *set);
+extern int sigfillset (sigset_t *set) _GL_ARG_NONNULL ((1));
 
 /* Return the set of those blocked signals that are pending.  */
-extern int sigpending (sigset_t *set);
+extern int sigpending (sigset_t *set) _GL_ARG_NONNULL ((1));
 
 /* If OLD_SET is not NULL, put the current set of blocked signals in *OLD_SET.
    Then, if SET is not NULL, affect the current set of blocked signals by
diff --git a/gl/snprintf.c b/gl/snprintf.c
index dafbda8..d8f4124 100644
--- a/gl/snprintf.c
+++ b/gl/snprintf.c
@@ -53,11 +53,11 @@ snprintf (char *str, size_t size, const char *format, ...)
   if (output != str)
     {
       if (size)
-       {
-         size_t pruned_len = (len < size ? len : size - 1);
-         memcpy (str, output, pruned_len);
-         str[pruned_len] = '\0';
-       }
+        {
+          size_t pruned_len = (len < size ? len : size - 1);
+          memcpy (str, output, pruned_len);
+          str[pruned_len] = '\0';
+        }
 
       free (output);
     }
diff --git a/gl/socket.c b/gl/socket.c
index 1fa6928..8ce4bae 100644
--- a/gl/socket.c
+++ b/gl/socket.c
@@ -1,6 +1,6 @@
 /* socket.c --- wrappers for Windows socket 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
@@ -26,12 +26,18 @@
 /* Get set_winsock_errno, FD_TO_SOCKET etc. */
 #include "w32sock.h"
 
+#include "sockets.h"
+
 int
 rpl_socket (int domain, int type, int protocol)
 {
+  SOCKET fh;
+
+  gl_sockets_startup (SOCKETS_1_1);
+
   /* We have to use WSASocket() to create non-overlapped IO sockets.
      Overlapped IO sockets cannot be used with read/write.  */
-  SOCKET fh = WSASocket (domain, type, protocol, NULL, 0, 0);
+  fh = WSASocket (domain, type, protocol, NULL, 0, 0);
 
   if (fh == INVALID_SOCKET)
     {
diff --git a/gl/sockets.c b/gl/sockets.c
index 9d5c547..3be3279 100644
--- a/gl/sockets.c
+++ b/gl/sockets.c
@@ -25,12 +25,12 @@
 #if WINDOWS_SOCKETS
 
 /* This includes winsock2.h on MinGW. */
-#include <sys/socket.h>
+# include <sys/socket.h>
 
-#include "close-hook.h"
+# include "close-hook.h"
 
 /* Get set_winsock_errno, FD_TO_SOCKET etc. */
-#include "w32sock.h"
+# include "w32sock.h"
 
 static int
 close_fd_maybe_socket (int fd, const struct close_hook *remaining_list)
@@ -46,21 +46,21 @@ close_fd_maybe_socket (int fd, const struct close_hook 
*remaining_list)
     {
       /* fd refers to a socket.  */
       /* FIXME: other applications, like squid, use an undocumented
-        _free_osfhnd free function.  But this is not enough: The 'osfile'
-        flags for fd also needs to be cleared, but it is hard to access it.
-        Instead, here we just close twice the file descriptor.  */
+         _free_osfhnd free function.  But this is not enough: The 'osfile'
+         flags for fd also needs to be cleared, but it is hard to access it.
+         Instead, here we just close twice the file descriptor.  */
       if (closesocket (sock))
-       {
-         set_winsock_errno ();
-         return -1;
-       }
+        {
+          set_winsock_errno ();
+          return -1;
+        }
       else
-       {
-         /* This call frees the file descriptor and does a
-            CloseHandle ((HANDLE) _get_osfhandle (fd)), which fails.  */
-         _close (fd);
-         return 0;
-       }
+        {
+          /* This call frees the file descriptor and does a
+             CloseHandle ((HANDLE) _get_osfhandle (fd)), which fails.  */
+          _close (fd);
+          return 0;
+        }
     }
   else
     /* Some other type of file descriptor.  */
@@ -69,23 +69,31 @@ close_fd_maybe_socket (int fd, const struct close_hook 
*remaining_list)
 
 static struct close_hook close_sockets_hook;
 
-#endif
+static int initialized_sockets_version /* = 0 */;
+
+#endif /* WINDOWS_SOCKETS */
 
 int
-gl_sockets_startup (int version)
+gl_sockets_startup (int version _GL_UNUSED)
 {
 #if WINDOWS_SOCKETS
-  WSADATA data;
-  int err;
+  if (version > initialized_sockets_version)
+    {
+      WSADATA data;
+      int err;
 
-  err = WSAStartup (version, &data);
-  if (err != 0)
-    return 1;
+      err = WSAStartup (version, &data);
+      if (err != 0)
+        return 1;
+
+      if (data.wVersion < version)
+        return 2;
 
-  if (data.wVersion < version)
-    return 2;
+      if (initialized_sockets_version == 0)
+        register_close_hook (close_fd_maybe_socket, &close_sockets_hook);
 
-  register_close_hook (close_fd_maybe_socket, &close_sockets_hook);
+      initialized_sockets_version = version;
+    }
 #endif
 
   return 0;
@@ -97,6 +105,8 @@ gl_sockets_cleanup (void)
 #if WINDOWS_SOCKETS
   int err;
 
+  initialized_sockets_version = 0;
+
   unregister_close_hook (&close_sockets_hook);
 
   err = WSACleanup ();
diff --git a/gl/stddef.in.h b/gl/stddef.in.h
new file mode 100644
index 0000000..aff3b94
--- /dev/null
+++ b/gl/stddef.in.h
@@ -0,0 +1,86 @@
+/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
+
+   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, 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 Eric Blake.  */
+
+/*
+ * POSIX 2008 <stddef.h> for platforms that have issues.
+ * <http://www.opengroup.org/susv3xbd/stddef.h.html>
+ */
+
+#if __GNUC__ >= 3
address@hidden@
+#endif
+
+#if defined __need_wchar_t || defined __need_size_t  \
+  || defined __need_ptrdiff_t || defined __need_NULL \
+  || defined __need_wint_t
+/* Special invocation convention inside gcc header files.  In
+   particular, gcc provides a version of <stddef.h> that blindly
+   redefines NULL even when __need_wint_t was defined, even though
+   wint_t is not normally provided by <stddef.h>.  Hence, we must
+   remember if special invocation has ever been used to obtain wint_t,
+   in which case we need to clean up NULL yet again.  */
+
+# if !(defined _GL_STDDEF_H && defined _GL_STDDEF_WINT_T)
+#  ifdef __need_wint_t
+#   undef _GL_STDDEF_H
+#   define _GL_STDDEF_WINT_T
+#  endif
+#  @INCLUDE_NEXT@ @NEXT_STDDEF_H@
+# endif
+
+#else
+/* Normal invocation convention.  */
+
+# ifndef _GL_STDDEF_H
+
+/* The include_next requires a split double-inclusion guard.  */
+
+#  @INCLUDE_NEXT@ @NEXT_STDDEF_H@
+
+#  ifndef _GL_STDDEF_H
+#   define _GL_STDDEF_H
+
+/* On NetBSD 5.0, the definition of NULL lacks proper parentheses.  */
+#if @REPLACE_NULL@
+# undef NULL
+# ifdef __cplusplus
+   /* ISO C++ says that the macro NULL must expand to an integer constant
+      expression, hence '((void *) 0)' is not allowed in C++.  */
+#  if __GNUG__ >= 3
+    /* GNU C++ has a __null macro that behaves like an integer ('int' or
+       'long') but has the same size as a pointer.  Use that, to avoid
+       warnings.  */
+#   define NULL __null
+#  else
+#   define NULL 0L
+#  endif
+# else
+#  define NULL ((void *) 0)
+# endif
+#endif
+
+/* Some platforms lack wchar_t.  */
+#if address@hidden@
+# define wchar_t int
+#endif
+
+#  endif /* _GL_STDDEF_H */
+# endif /* _GL_STDDEF_H */
+#endif /* __need_XXX */
diff --git a/gl/stdint.in.h b/gl/stdint.in.h
index 53aa34a..9467e75 100644
--- a/gl/stdint.in.h
+++ b/gl/stdint.in.h
@@ -102,8 +102,8 @@
   ((signed) \
    ? ~ _STDINT_MIN (signed, bits, zero) \
    : /* The expression for the unsigned case.  The subtraction of (signed) \
-       is a nop in the unsigned case and avoids "signed integer overflow" \
-       warnings in the signed case.  */ \
+        is a nop in the unsigned case and avoids "signed integer overflow" \
+        warnings in the signed case.  */ \
      ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
 
 /* 7.18.1.1. Exact-width integer types */
@@ -454,10 +454,10 @@ typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == 
sizeof (uintmax_t)) -
 #undef SIG_ATOMIC_MAX
 #define SIG_ATOMIC_MIN  \
    _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
-               address@hidden@)
+                address@hidden@)
 #define SIG_ATOMIC_MAX  \
    _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
-               address@hidden@)
+                address@hidden@)
 
 
 /* size_t limit */
diff --git a/gl/stdio-impl.h b/gl/stdio-impl.h
index c803e88..bc853c9 100644
--- a/gl/stdio-impl.h
+++ b/gl/stdio-impl.h
@@ -26,21 +26,21 @@
 # if defined __DragonFly__          /* DragonFly */
   /* See 
<http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdio/priv_stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>.
  */
 #  define fp_ ((struct { struct __FILE_public pub; \
-                        struct { unsigned char *_base; int _size; } _bf; \
-                        void *cookie; \
-                        void *_close; \
-                        void *_read; \
-                        void *_seek; \
-                        void *_write; \
-                        struct { unsigned char *_base; int _size; } _ub; \
-                        int _ur; \
-                        unsigned char _ubuf[3]; \
-                        unsigned char _nbuf[1]; \
-                        struct { unsigned char *_base; int _size; } _lb; \
-                        int _blksize; \
-                        fpos_t _offset; \
-                        /* More fields, not relevant here.  */ \
-                      } *) fp)
+                         struct { unsigned char *_base; int _size; } _bf; \
+                         void *cookie; \
+                         void *_close; \
+                         void *_read; \
+                         void *_seek; \
+                         void *_write; \
+                         struct { unsigned char *_base; int _size; } _ub; \
+                         int _ur; \
+                         unsigned char _ubuf[3]; \
+                         unsigned char _nbuf[1]; \
+                         struct { unsigned char *_base; int _size; } _lb; \
+                         int _blksize; \
+                         fpos_t _offset; \
+                         /* More fields, not relevant here.  */ \
+                       } *) fp)
   /* See 
<http://www.dragonflybsd.org/cvsweb/src/include/stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>.
  */
 #  define _p pub._p
 #  define _flags pub._flags
@@ -74,12 +74,12 @@
 
 # if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */
 #  define fp_ ((struct { unsigned char *_ptr; \
-                        unsigned char *_base; \
-                        unsigned char *_end; \
-                        long _cnt; \
-                        int _file; \
-                        unsigned int _flag; \
-                      } *) fp)
+                         unsigned char *_base; \
+                         unsigned char *_end; \
+                         long _cnt; \
+                         int _file; \
+                         unsigned int _flag; \
+                       } *) fp)
 # else
 #  define fp_ fp
 # endif
diff --git a/gl/stdio-write.c b/gl/stdio-write.c
index f1d0fcb..04fcfe6 100644
--- a/gl/stdio-write.c
+++ b/gl/stdio-write.c
@@ -1,5 +1,5 @@
 /* POSIX compatible FILE stream write function.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008-2009 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2008.
 
    This program is free software: you can redistribute it and/or modify
@@ -39,30 +39,31 @@
 #  include <windows.h>
 
 #  define CALL_WITH_SIGPIPE_EMULATION(RETTYPE, EXPRESSION, FAILED) \
-  if (ferror (stream))                                                       \
-    return (EXPRESSION);                                                     \
-  else                                                                       \
-    {                                                                        \
-      RETTYPE ret;                                                           \
-      SetLastError (0);                                                        
      \
-      ret = (EXPRESSION);                                                    \
+  if (ferror (stream))                                                        \
+    return (EXPRESSION);                                                      \
+  else                                                                        \
+    {                                                                         \
+      RETTYPE ret;                                                            \
+      SetLastError (0);                                                       \
+      ret = (EXPRESSION);                                                     \
       if (FAILED && GetLastError () == ERROR_NO_DATA && ferror (stream))      \
-       {                                                                     \
-         int fd = fileno (stream);                                           \
-         if (fd >= 0                                                         \
-             && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE)\
-           {                                                                 \
-             /* Try to raise signal SIGPIPE.  */                             \
-             raise (SIGPIPE);                                                \
-             /* If it is currently blocked or ignored, change errno from     \
-                EINVAL to EPIPE.  */                                         \
-             errno = EPIPE;                                                  \
-           }                                                                 \
-       }                                                                     \
-      return ret;                                                            \
+        {                                                                     \
+          int fd = fileno (stream);                                           \
+          if (fd >= 0                                                         \
+              && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE)\
+            {                                                                 \
+              /* Try to raise signal SIGPIPE.  */                             \
+              raise (SIGPIPE);                                                \
+              /* If it is currently blocked or ignored, change errno from     \
+                 EINVAL to EPIPE.  */                                         \
+              errno = EPIPE;                                                  \
+            }                                                                 \
+        }                                                                     \
+      return ret;                                                             \
     }
 
 #  if !REPLACE_PRINTF_POSIX /* avoid collision with printf.c */
+#   if !DEPENDS_ON_LIBINTL /* avoid collision with intl/printf.c */
 int
 printf (const char *format, ...)
 {
@@ -75,6 +76,7 @@ printf (const char *format, ...)
 
   return retval;
 }
+#   endif
 #  endif
 
 #  if !REPLACE_FPRINTF_POSIX /* avoid collision with fprintf.c */
@@ -92,7 +94,7 @@ fprintf (FILE *stream, const char *format, ...)
 }
 #  endif
 
-#  if !REPLACE_VFPRINTF_POSIX /* avoid collision with vprintf.c */
+#  if !REPLACE_VPRINTF_POSIX /* avoid collision with vprintf.c */
 int
 vprintf (const char *format, va_list args)
 {
@@ -100,7 +102,7 @@ vprintf (const char *format, va_list args)
 }
 #  endif
 
-#  if !REPLACE_VPRINTF_POSIX /* avoid collision with vfprintf.c */
+#  if !REPLACE_VFPRINTF_POSIX /* avoid collision with vfprintf.c */
 int
 vfprintf (FILE *stream, const char *format, va_list args)
 #undef vfprintf
diff --git a/gl/stdio.in.h b/gl/stdio.in.h
index 0445c6f..93d52a1 100644
--- a/gl/stdio.in.h
+++ b/gl/stdio.in.h
@@ -39,10 +39,11 @@
 #include <stdarg.h>
 #include <stddef.h>
 
-#if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \
-  || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \
-  || (@GNULIB_GETDELIM@ && address@hidden@) \
-  || (@GNULIB_GETLINE@ && (address@hidden@ || @REPLACE_GETLINE@))
+#if ((@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \
+     || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \
+     || (@GNULIB_GETDELIM@ && address@hidden@) \
+     || (@GNULIB_GETLINE@ && (address@hidden@ || @REPLACE_GETLINE@)) \
+     || defined GNULIB_POSIXCHECK)
 /* Get off_t and ssize_t.  */
 # include <sys/types.h>
 #endif
@@ -63,233 +64,70 @@
 
 /* The definition of GL_LINK_WARNING is copied here.  */
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-
-#if @GNULIB_FPRINTF_POSIX@
-# if @REPLACE_FPRINTF@
-#  define fprintf rpl_fprintf
-extern int fprintf (FILE *fp, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 2, 3)));
-# endif
-#elif @GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && 
@GNULIB_STDIO_H_SIGPIPE@
-# define fprintf rpl_fprintf
-extern int fprintf (FILE *fp, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 2, 3)));
-#elif defined GNULIB_POSIXCHECK
-# undef fprintf
-# define fprintf \
-    (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
-                      "use gnulib module fprintf-posix for portable " \
-                      "POSIX compliance"), \
-     fprintf)
-#endif
-
-#if @GNULIB_VFPRINTF_POSIX@
-# if @REPLACE_VFPRINTF@
-#  define vfprintf rpl_vfprintf
-extern int vfprintf (FILE *fp, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 2, 0)));
-# endif
-#elif @GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && 
@GNULIB_STDIO_H_SIGPIPE@
-# define vfprintf rpl_vfprintf
-extern int vfprintf (FILE *fp, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 2, 0)));
-#elif defined GNULIB_POSIXCHECK
-# undef vfprintf
-# define vfprintf(s,f,a) \
-    (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
-                      "use gnulib module vfprintf-posix for portable " \
-                      "POSIX compliance"), \
-     vfprintf (s, f, a))
-#endif
-
-#if @GNULIB_PRINTF_POSIX@
-# if @REPLACE_PRINTF@
-/* Don't break __attribute__((format(printf,M,N))).  */
-#  define printf __printf__
-extern int printf (const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 1, 2)));
-# endif
-#elif @GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && 
@GNULIB_STDIO_H_SIGPIPE@
-/* Don't break __attribute__((format(printf,M,N))).  */
-# define printf __printf__
-extern int printf (const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 1, 2)));
-#elif defined GNULIB_POSIXCHECK
-# undef printf
-# define printf \
-    (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
-                      "use gnulib module printf-posix for portable " \
-                      "POSIX compliance"), \
-     printf)
-/* Don't break __attribute__((format(printf,M,N))).  */
-# define format(kind,m,n) format (__##kind##__, m, n)
-# define __format__(kind,m,n) __format__ (__##kind##__, m, n)
-# define ____printf____ __printf__
-# define ____scanf____ __scanf__
-# define ____strftime____ __strftime__
-# define ____strfmon____ __strfmon__
-#endif
-
-#if @GNULIB_VPRINTF_POSIX@
-# if @REPLACE_VPRINTF@
-#  define vprintf rpl_vprintf
-extern int vprintf (const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 1, 0)));
-# endif
-#elif @GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && 
@GNULIB_STDIO_H_SIGPIPE@
-# define vprintf rpl_vprintf
-extern int vprintf (const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 1, 0)));
-#elif defined GNULIB_POSIXCHECK
-# undef vprintf
-# define vprintf(f,a) \
-    (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
-                      "use gnulib module vprintf-posix for portable " \
-                      "POSIX compliance"), \
-     vprintf (f, a))
-#endif
-
-#if @GNULIB_SNPRINTF@
-# if @REPLACE_SNPRINTF@
-#  define snprintf rpl_snprintf
-# endif
-# if @REPLACE_SNPRINTF@ || address@hidden@
-extern int snprintf (char *str, size_t size, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 3, 4)));
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef snprintf
-# define snprintf \
-    (GL_LINK_WARNING ("snprintf is unportable - " \
-                      "use gnulib module snprintf for portability"), \
-     snprintf)
-#endif
-
-#if @GNULIB_VSNPRINTF@
-# if @REPLACE_VSNPRINTF@
-#  define vsnprintf rpl_vsnprintf
-# endif
-# if @REPLACE_VSNPRINTF@ || address@hidden@
-extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 3, 0)));
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef vsnprintf
-# define vsnprintf(b,s,f,a) \
-    (GL_LINK_WARNING ("vsnprintf is unportable - " \
-                      "use gnulib module vsnprintf for portability"), \
-     vsnprintf (b, s, f, a))
-#endif
-
-#if @GNULIB_SPRINTF_POSIX@
-# if @REPLACE_SPRINTF@
-#  define sprintf rpl_sprintf
-extern int sprintf (char *str, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 2, 3)));
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef sprintf
-# define sprintf \
-    (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
-                      "use gnulib module sprintf-posix for portable " \
-                      "POSIX compliance"), \
-     sprintf)
-#endif
-
-#if @GNULIB_VSPRINTF_POSIX@
-# if @REPLACE_VSPRINTF@
-#  define vsprintf rpl_vsprintf
-extern int vsprintf (char *str, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 2, 0)));
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef vsprintf
-# define vsprintf(b,f,a) \
-    (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
-                      "use gnulib module vsprintf-posix for portable " \
-                      "POSIX compliance"), \
-     vsprintf (b, f, a))
-#endif
-
 #if @GNULIB_DPRINTF@
 # if @REPLACE_DPRINTF@
 #  define dprintf rpl_dprintf
 # endif
 # if @REPLACE_DPRINTF@ || address@hidden@
 extern int dprintf (int fd, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 2, 3)));
+       __attribute__ ((__format__ (__printf__, 2, 3))) _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef dprintf
-# define dprintf(d,f,a) \
+# define dprintf \
     (GL_LINK_WARNING ("dprintf is unportable - " \
                       "use gnulib module dprintf for portability"), \
-     dprintf (d, f, a))
+     dprintf)
 #endif
 
-#if @GNULIB_VDPRINTF@
-# if @REPLACE_VDPRINTF@
-#  define vdprintf rpl_vdprintf
-# endif
-# if @REPLACE_VDPRINTF@ || address@hidden@
-extern int vdprintf (int fd, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 2, 0)));
+#if @GNULIB_FCLOSE@
+# if @REPLACE_FCLOSE@
+#  define fclose rpl_fclose
+  /* Close STREAM and its underlying file descriptor.  */
+extern int fclose (FILE *stream) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
-# undef vdprintf
-# define vdprintf(d,f,a) \
-    (GL_LINK_WARNING ("vdprintf is unportable - " \
-                      "use gnulib module vdprintf for portability"), \
-     vdprintf (d, f, a))
-#endif
-
-#if @GNULIB_VASPRINTF@
-# if @REPLACE_VASPRINTF@
-#  define asprintf rpl_asprintf
-#  define vasprintf rpl_vasprintf
-# endif
-# if @REPLACE_VASPRINTF@ || address@hidden@
-  /* Write formatted output to a string dynamically allocated with malloc().
-     If the memory allocation succeeds, store the address of the string in
-     *RESULT and return the number of resulting bytes, excluding the trailing
-     NUL.  Upon memory allocation error, or some other error, return -1.  */
-  extern int asprintf (char **result, const char *format, ...)
-    __attribute__ ((__format__ (__printf__, 2, 3)));
-  extern int vasprintf (char **result, const char *format, va_list args)
-    __attribute__ ((__format__ (__printf__, 2, 0)));
-# endif
+# undef fclose
+# define fclose(f) \
+   (GL_LINK_WARNING ("fclose is not always POSIX compliant - " \
+                     "use gnulib module fclose for portable " \
+                     "POSIX compliance"), \
+    fclose (f))
 #endif
 
-#if @GNULIB_OBSTACK_PRINTF@
-# if @REPLACE_OBSTACK_PRINTF@
-#  define obstack_printf rpl_osbtack_printf
-#  define obstack_vprintf rpl_obstack_vprintf
-# endif
-# if @REPLACE_OBSTACK_PRINTF@ || address@hidden@
-  struct obstack;
-  /* Grow an obstack with formatted output.  Return the number of
-     bytes added to OBS.  No trailing nul byte is added, and the
-     object should be closed with obstack_finish before use.  Upon
-     memory allocation error, call obstack_alloc_failed_handler.  Upon
-     other error, return -1.  */
-  extern int obstack_printf (struct obstack *obs, const char *format, ...)
-    __attribute__ ((__format__ (__printf__, 2, 3)));
-  extern int obstack_vprintf (struct obstack *obs, const char *format,
-                             va_list args)
-    __attribute__ ((__format__ (__printf__, 2, 0)));
+#if @GNULIB_FFLUSH@
+# if @REPLACE_FFLUSH@
+#  define fflush rpl_fflush
+  /* Flush all pending data on STREAM according to POSIX rules.  Both
+     output and seekable input streams are supported.
+     Note! LOSS OF DATA can occur if fflush is applied on an input stream
+     that is _not_seekable_ or on an update stream that is _not_seekable_
+     and in which the most recent operation was input.  Seekability can
+     be tested with lseek(fileno(fp),0,SEEK_CUR).  */
+  extern int fflush (FILE *gl_stream);
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef fflush
+# define fflush(f) \
+   (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
+                     "use gnulib module fflush for portable " \
+                     "POSIX compliance"), \
+    fflush (f))
 #endif
 
 #if @GNULIB_FOPEN@
 # if @REPLACE_FOPEN@
 #  undef fopen
 #  define fopen rpl_fopen
-extern FILE * fopen (const char *filename, const char *mode);
+extern FILE * fopen (const char *filename, const char *mode)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fopen
@@ -299,11 +137,66 @@ extern FILE * fopen (const char *filename, const char 
*mode);
     fopen (f, m))
 #endif
 
+#if @GNULIB_FPRINTF_POSIX@
+# if @REPLACE_FPRINTF@
+#  define fprintf rpl_fprintf
+extern int fprintf (FILE *fp, const char *format, ...)
+       __attribute__ ((__format__ (__printf__, 2, 3)))
+       _GL_ARG_NONNULL ((1, 2));
+# endif
+#elif @GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && 
@GNULIB_STDIO_H_SIGPIPE@
+# define fprintf rpl_fprintf
+extern int fprintf (FILE *fp, const char *format, ...)
+       __attribute__ ((__format__ (__printf__, 2, 3)))
+       _GL_ARG_NONNULL ((1, 2));
+#elif defined GNULIB_POSIXCHECK
+# undef fprintf
+# define fprintf \
+    (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
+                      "use gnulib module fprintf-posix for portable " \
+                      "POSIX compliance"), \
+     fprintf)
+#endif
+
+#if @GNULIB_FPURGE@
+# if @REPLACE_FPURGE@
+#  define fpurge rpl_fpurge
+# endif
+# if @REPLACE_FPURGE@ || address@hidden@
+  /* Discard all pending buffered I/O data on STREAM.
+     STREAM must not be wide-character oriented.
+     When discarding pending output, the file position is set back to where it
+     was before the write calls.  When discarding pending input, the file
+     position is advanced to match the end of the previously read input.
+     Return 0 if successful.  Upon error, return -1 and set errno.  */
+  extern int fpurge (FILE *gl_stream) _GL_ARG_NONNULL ((1));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fpurge
+# define fpurge(f) \
+   (GL_LINK_WARNING ("fpurge is not always present - " \
+                     "use gnulib module fpurge for portability"), \
+    fpurge (f))
+#endif
+
+#if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# undef fputc
+# define fputc rpl_fputc
+extern int fputc (int c, FILE *stream) _GL_ARG_NONNULL ((2));
+#endif
+
+#if @GNULIB_FPUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# undef fputs
+# define fputs rpl_fputs
+extern int fputs (const char *string, FILE *stream) _GL_ARG_NONNULL ((1, 2));
+#endif
+
 #if @GNULIB_FREOPEN@
 # if @REPLACE_FREOPEN@
 #  undef freopen
 #  define freopen rpl_freopen
-extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
+extern FILE * freopen (const char *filename, const char *mode, FILE *stream)
+     _GL_ARG_NONNULL ((2, 3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef freopen
@@ -313,24 +206,8 @@ extern FILE * freopen (const char *filename, const char 
*mode, FILE *stream);
     freopen (f, m, s))
 #endif
 
-#if @GNULIB_FSEEKO@
-# if @REPLACE_FSEEKO@
-/* Provide fseek, fseeko functions that are aware of a preceding
-   fflush(), and which detect pipes.  */
-#  define fseeko rpl_fseeko
-extern int fseeko (FILE *fp, off_t offset, int whence);
-#  define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef fseeko
-# define fseeko(f,o,w) \
-   (GL_LINK_WARNING ("fseeko is unportable - " \
-                     "use gnulib module fseeko for portability"), \
-    fseeko (f, o, w))
-#endif
-
 #if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
-extern int rpl_fseek (FILE *fp, long offset, int whence);
+extern int rpl_fseek (FILE *fp, long offset, int whence) _GL_ARG_NONNULL ((1));
 # undef fseek
 # if defined GNULIB_POSIXCHECK
 #  define fseek(f,o,w) \
@@ -351,22 +228,31 @@ extern int rpl_fseek (FILE *fp, long offset, int whence);
 # endif
 #endif
 
-#if @GNULIB_FTELLO@
-# if @REPLACE_FTELLO@
-#  define ftello rpl_ftello
-extern off_t ftello (FILE *fp);
-#  define ftell(fp) ftello (fp)
+#if @GNULIB_FSEEKO@
+# if @REPLACE_FSEEKO@
+/* Provide fseek, fseeko functions that are aware of a preceding
+   fflush(), and which detect pipes.  */
+#  define fseeko rpl_fseeko
+extern int fseeko (FILE *fp, off_t offset, int whence) _GL_ARG_NONNULL ((1));
+#  if address@hidden@
+#   undef fseek
+#   define fseek(f,o,w) \
+     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
+                       "on 32-bit platforms - " \
+                       "use fseeko function for handling of large files"), \
+      fseeko (f, o, w))
+#  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
-# undef ftello
-# define ftello(f) \
-   (GL_LINK_WARNING ("ftello is unportable - " \
-                     "use gnulib module ftello for portability"), \
-    ftello (f))
+# undef fseeko
+# define fseeko(f,o,w) \
+   (GL_LINK_WARNING ("fseeko is unportable - " \
+                     "use gnulib module fseeko for portability"), \
+    fseeko (f, o, w))
 #endif
 
 #if @GNULIB_FTELL@ && @REPLACE_FTELL@
-extern long rpl_ftell (FILE *fp);
+extern long rpl_ftell (FILE *fp) _GL_ARG_NONNULL ((1));
 # undef ftell
 # if GNULIB_POSIXCHECK
 #  define ftell(f) \
@@ -387,93 +273,32 @@ extern long rpl_ftell (FILE *fp);
 # endif
 #endif
 
-#if @GNULIB_FFLUSH@
-# if @REPLACE_FFLUSH@
-#  define fflush rpl_fflush
-  /* Flush all pending data on STREAM according to POSIX rules.  Both
-     output and seekable input streams are supported.
-     Note! LOSS OF DATA can occur if fflush is applied on an input stream
-     that is _not_seekable_ or on an update stream that is _not_seekable_
-     and in which the most recent operation was input.  Seekability can
-     be tested with lseek(fileno(fp),0,SEEK_CUR).  */
-  extern int fflush (FILE *gl_stream);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef fflush
-# define fflush(f) \
-   (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
-                     "use gnulib module fflush for portable " \
-                     "POSIX compliance"), \
-    fflush (f))
-#endif
-
-#if @GNULIB_FPURGE@
-# if @REPLACE_FPURGE@
-#  define fpurge rpl_fpurge
-# endif
-# if @REPLACE_FPURGE@ || address@hidden@
-  /* Discard all pending buffered I/O data on STREAM.
-     STREAM must not be wide-character oriented.
-     Return 0 if successful.  Upon error, return -1 and set errno.  */
-  extern int fpurge (FILE *gl_stream);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef fpurge
-# define fpurge(f) \
-   (GL_LINK_WARNING ("fpurge is not always present - " \
-                     "use gnulib module fpurge for portability"), \
-    fpurge (f))
-#endif
-
-#if @GNULIB_FCLOSE@
-# if @REPLACE_FCLOSE@
-#  define fclose rpl_fclose
-  /* Close STREAM and its underlying file descriptor.  */
-extern int fclose (FILE *stream);
+#if @GNULIB_FTELLO@
+# if @REPLACE_FTELLO@
+#  define ftello rpl_ftello
+extern off_t ftello (FILE *fp) _GL_ARG_NONNULL ((1));
+#  if address@hidden@
+#   undef ftell
+#   define ftell(f) \
+     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
+                       "on 32-bit platforms - " \
+                       "use ftello function for handling of large files"), \
+      ftello (f))
+#  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
-# undef fclose
-# define fclose(f) \
-   (GL_LINK_WARNING ("fclose is not always POSIX compliant - " \
-                     "use gnulib module fclose for portable " \
-                     "POSIX compliance"), \
-    fclose (f))
-#endif
-
-#if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
-# undef fputc
-# define fputc rpl_fputc
-extern int fputc (int c, FILE *stream);
-#endif
-
-#if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
-# undef putc
-# define putc rpl_fputc
-extern int putc (int c, FILE *stream);
-#endif
-
-#if @GNULIB_PUTCHAR@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
-# undef putchar
-# define putchar rpl_putchar
-extern int putchar (int c);
-#endif
-
-#if @GNULIB_FPUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
-# undef fputs
-# define fputs rpl_fputs
-extern int fputs (const char *string, FILE *stream);
-#endif
-
-#if @GNULIB_PUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
-# undef puts
-# define puts rpl_puts
-extern int puts (const char *string);
+# undef ftello
+# define ftello(f) \
+   (GL_LINK_WARNING ("ftello is unportable - " \
+                     "use gnulib module ftello for portability"), \
+    ftello (f))
 #endif
 
 #if @GNULIB_FWRITE@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 # undef fwrite
 # define fwrite rpl_fwrite
-extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream);
+extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
+     _GL_ARG_NONNULL ((1, 4));
 #endif
 
 #if @GNULIB_GETDELIM@
@@ -485,13 +310,14 @@ extern size_t fwrite (const void *ptr, size_t s, size_t 
n, FILE *stream);
    Return the number of bytes read and stored at *LINEPTR (not including the
    NUL terminator), or -1 on error or EOF.  */
 extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
-                        FILE *stream);
+                         FILE *stream)
+     _GL_ARG_NONNULL ((1, 2, 4));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getdelim
-# define getdelim(l, s, d, f)                                      \
-  (GL_LINK_WARNING ("getdelim is unportable - "                            \
-                   "use gnulib module getdelim for portability"),  \
+# define getdelim(l, s, d, f)                                       \
+  (GL_LINK_WARNING ("getdelim is unportable - "                     \
+                    "use gnulib module getdelim for portability"),  \
    getdelim (l, s, d, f))
 #endif
 
@@ -507,16 +333,37 @@ extern ssize_t getdelim (char **lineptr, size_t 
*linesize, int delimiter,
    bytes of space.  It is realloc'd as necessary.
    Return the number of bytes read and stored at *LINEPTR (not including the
    NUL terminator), or -1 on error or EOF.  */
-extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
+extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream)
+     _GL_ARG_NONNULL ((1, 2, 3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getline
-# define getline(l, s, f)                                              \
-  (GL_LINK_WARNING ("getline is unportable - "                         \
-                   "use gnulib module getline for portability"),       \
+# define getline(l, s, f)                                               \
+  (GL_LINK_WARNING ("getline is unportable - "                          \
+                    "use gnulib module getline for portability"),       \
    getline (l, s, f))
 #endif
 
+#if @GNULIB_OBSTACK_PRINTF@
+# if @REPLACE_OBSTACK_PRINTF@
+#  define obstack_printf rpl_osbtack_printf
+#  define obstack_vprintf rpl_obstack_vprintf
+# endif
+# if @REPLACE_OBSTACK_PRINTF@ || address@hidden@
+  struct obstack;
+  /* Grow an obstack with formatted output.  Return the number of
+     bytes added to OBS.  No trailing nul byte is added, and the
+     object should be closed with obstack_finish before use.  Upon
+     memory allocation error, call obstack_alloc_failed_handler.  Upon
+     other error, return -1.  */
+  extern int obstack_printf (struct obstack *obs, const char *format, ...)
+    __attribute__ ((__format__ (__printf__, 2, 3))) _GL_ARG_NONNULL ((1, 2));
+  extern int obstack_vprintf (struct obstack *obs, const char *format,
+                              va_list args)
+    __attribute__ ((__format__ (__printf__, 2, 0))) _GL_ARG_NONNULL ((1, 2));
+# endif
+#endif
+
 #if @GNULIB_PERROR@
 # if @REPLACE_PERROR@
 #  define perror rpl_perror
@@ -533,6 +380,252 @@ extern void perror (const char *string);
      perror (s))
 #endif
 
+#if @GNULIB_POPEN@
+# if @REPLACE_POPEN@
+#  undef popen
+#  define popen rpl_popen
+extern FILE *popen (const char *cmd, const char *mode)
+     _GL_ARG_NONNULL ((1, 2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef popen
+# define popen(c,m) \
+   (GL_LINK_WARNING ("popen is buggy on some platforms - " \
+                     "use gnulib module popen or pipe for more portability"), \
+    popen (c, m))
+#endif
+
+#if @GNULIB_PRINTF_POSIX@
+# if @REPLACE_PRINTF@
+/* Don't break __attribute__((format(printf,M,N))).  */
+#  define printf __printf__
+extern int printf (const char *format, ...)
+       __attribute__ ((__format__ (__printf__, 1, 2))) _GL_ARG_NONNULL ((1));
+# endif
+#elif @GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && 
@GNULIB_STDIO_H_SIGPIPE@
+/* Don't break __attribute__((format(printf,M,N))).  */
+# define printf __printf__
+extern int printf (const char *format, ...)
+       __attribute__ ((__format__ (__printf__, 1, 2))) _GL_ARG_NONNULL ((1));
+#elif defined GNULIB_POSIXCHECK
+# undef printf
+# define printf \
+    (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
+                      "use gnulib module printf-posix for portable " \
+                      "POSIX compliance"), \
+     printf)
+/* Don't break __attribute__((format(printf,M,N))).  */
+# define format(kind,m,n) format (__##kind##__, m, n)
+# define __format__(kind,m,n) __format__ (__##kind##__, m, n)
+# define ____printf____ __printf__
+# define ____scanf____ __scanf__
+# define ____strftime____ __strftime__
+# define ____strfmon____ __strfmon__
+#endif
+
+#if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# undef putc
+# define putc rpl_fputc
+extern int putc (int c, FILE *stream) _GL_ARG_NONNULL ((2));
+#endif
+
+#if @GNULIB_PUTCHAR@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# undef putchar
+# define putchar rpl_putchar
+extern int putchar (int c);
+#endif
+
+#if @GNULIB_PUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# undef puts
+# define puts rpl_puts
+extern int puts (const char *string) _GL_ARG_NONNULL ((1));
+#endif
+
+#if @GNULIB_REMOVE@
+# if @REPLACE_REMOVE@
+#  undef remove
+#  define remove rpl_remove
+extern int remove (const char *name) _GL_ARG_NONNULL ((1));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef remove
+# define remove(n)                                         \
+   (GL_LINK_WARNING ("remove cannot handle directories on some platforms - " \
+                     "use gnulib module remove for more portability"), \
+    remove (n))
+#endif
+
+#if @GNULIB_RENAME@
+# if @REPLACE_RENAME@
+#  undef rename
+#  define rename rpl_rename
+extern int rename (const char *old_filename, const char *new_filename)
+     _GL_ARG_NONNULL ((1, 2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef rename
+# define rename(o,n)                                       \
+   (GL_LINK_WARNING ("rename is buggy on some platforms - " \
+                     "use gnulib module rename for more portability"), \
+    rename (o, n))
+#endif
+
+#if @GNULIB_RENAMEAT@
+# if @REPLACE_RENAMEAT@
+#  undef renameat
+#  define renameat rpl_renameat
+# endif
+# if address@hidden@ || @REPLACE_RENAMEAT@
+extern int renameat (int fd1, char const *file1, int fd2, char const *file2)
+     _GL_ARG_NONNULL ((2, 4));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef renameat
+# define renameat(d1,f1,d2,f2)             \
+    (GL_LINK_WARNING ("renameat is not portable - " \
+                      "use gnulib module renameat for portability"), \
+     renameat (d1, f1, d2, f2))
+#endif
+
+#if @GNULIB_SNPRINTF@
+# if @REPLACE_SNPRINTF@
+#  define snprintf rpl_snprintf
+# endif
+# if @REPLACE_SNPRINTF@ || address@hidden@
+extern int snprintf (char *str, size_t size, const char *format, ...)
+       __attribute__ ((__format__ (__printf__, 3, 4)))
+       _GL_ARG_NONNULL ((3));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef snprintf
+# define snprintf \
+    (GL_LINK_WARNING ("snprintf is unportable - " \
+                      "use gnulib module snprintf for portability"), \
+     snprintf)
+#endif
+
+#if @GNULIB_SPRINTF_POSIX@
+# if @REPLACE_SPRINTF@
+#  define sprintf rpl_sprintf
+extern int sprintf (char *str, const char *format, ...)
+       __attribute__ ((__format__ (__printf__, 2, 3)))
+       _GL_ARG_NONNULL ((1, 2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef sprintf
+# define sprintf \
+    (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
+                      "use gnulib module sprintf-posix for portable " \
+                      "POSIX compliance"), \
+     sprintf)
+#endif
+
+#if @GNULIB_VASPRINTF@
+# if @REPLACE_VASPRINTF@
+#  define asprintf rpl_asprintf
+#  define vasprintf rpl_vasprintf
+# endif
+# if @REPLACE_VASPRINTF@ || address@hidden@
+  /* Write formatted output to a string dynamically allocated with malloc().
+     If the memory allocation succeeds, store the address of the string in
+     *RESULT and return the number of resulting bytes, excluding the trailing
+     NUL.  Upon memory allocation error, or some other error, return -1.  */
+  extern int asprintf (char **result, const char *format, ...)
+    __attribute__ ((__format__ (__printf__, 2, 3))) _GL_ARG_NONNULL ((1, 2));
+  extern int vasprintf (char **result, const char *format, va_list args)
+    __attribute__ ((__format__ (__printf__, 2, 0))) _GL_ARG_NONNULL ((1, 2));
+# endif
+#endif
+
+#if @GNULIB_VDPRINTF@
+# if @REPLACE_VDPRINTF@
+#  define vdprintf rpl_vdprintf
+# endif
+# if @REPLACE_VDPRINTF@ || address@hidden@
+extern int vdprintf (int fd, const char *format, va_list args)
+       __attribute__ ((__format__ (__printf__, 2, 0))) _GL_ARG_NONNULL ((2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef vdprintf
+# define vdprintf(d,f,a) \
+    (GL_LINK_WARNING ("vdprintf is unportable - " \
+                      "use gnulib module vdprintf for portability"), \
+     vdprintf (d, f, a))
+#endif
+
+#if @GNULIB_VFPRINTF_POSIX@
+# if @REPLACE_VFPRINTF@
+#  define vfprintf rpl_vfprintf
+extern int vfprintf (FILE *fp, const char *format, va_list args)
+       __attribute__ ((__format__ (__printf__, 2, 0)))
+       _GL_ARG_NONNULL ((1, 2));
+# endif
+#elif @GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && 
@GNULIB_STDIO_H_SIGPIPE@
+# define vfprintf rpl_vfprintf
+extern int vfprintf (FILE *fp, const char *format, va_list args)
+       __attribute__ ((__format__ (__printf__, 2, 0)))
+       _GL_ARG_NONNULL ((1, 2));
+#elif defined GNULIB_POSIXCHECK
+# undef vfprintf
+# define vfprintf(s,f,a) \
+    (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
+                      "use gnulib module vfprintf-posix for portable " \
+                      "POSIX compliance"), \
+     vfprintf (s, f, a))
+#endif
+
+#if @GNULIB_VPRINTF_POSIX@
+# if @REPLACE_VPRINTF@
+#  define vprintf rpl_vprintf
+extern int vprintf (const char *format, va_list args)
+       __attribute__ ((__format__ (__printf__, 1, 0))) _GL_ARG_NONNULL ((1));
+# endif
+#elif @GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && 
@GNULIB_STDIO_H_SIGPIPE@
+# define vprintf rpl_vprintf
+extern int vprintf (const char *format, va_list args)
+       __attribute__ ((__format__ (__printf__, 1, 0))) _GL_ARG_NONNULL ((1));
+#elif defined GNULIB_POSIXCHECK
+# undef vprintf
+# define vprintf(f,a) \
+    (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
+                      "use gnulib module vprintf-posix for portable " \
+                      "POSIX compliance"), \
+     vprintf (f, a))
+#endif
+
+#if @GNULIB_VSNPRINTF@
+# if @REPLACE_VSNPRINTF@
+#  define vsnprintf rpl_vsnprintf
+# endif
+# if @REPLACE_VSNPRINTF@ || address@hidden@
+extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
+       __attribute__ ((__format__ (__printf__, 3, 0)))
+       _GL_ARG_NONNULL ((3));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef vsnprintf
+# define vsnprintf(b,s,f,a) \
+    (GL_LINK_WARNING ("vsnprintf is unportable - " \
+                      "use gnulib module vsnprintf for portability"), \
+     vsnprintf (b, s, f, a))
+#endif
+
+#if @GNULIB_VSPRINTF_POSIX@
+# if @REPLACE_VSPRINTF@
+#  define vsprintf rpl_vsprintf
+extern int vsprintf (char *str, const char *format, va_list args)
+       __attribute__ ((__format__ (__printf__, 2, 0)))
+       _GL_ARG_NONNULL ((1, 2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef vsprintf
+# define vsprintf(b,f,a) \
+    (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
+                      "use gnulib module vsprintf-posix for portable " \
+                      "POSIX compliance"), \
+     vsprintf (b, f, a))
+#endif
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/gl/stdlib.in.h b/gl/stdlib.in.h
index f99767f..edee74c 100644
--- a/gl/stdlib.in.h
+++ b/gl/stdlib.in.h
@@ -35,9 +35,11 @@
 #ifndef _GL_STDLIB_H
 #define _GL_STDLIB_H
 
+/* NetBSD 5.0 mis-defines NULL.  */
+#include <stddef.h>
 
 /* Solaris declares getloadavg() in <sys/loadavg.h>.  */
-#if @GNULIB_GETLOADAVG@ && @HAVE_SYS_LOADAVG_H@
+#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
 # include <sys/loadavg.h>
 #endif
 
@@ -47,25 +49,35 @@
 # include <random.h>
 #endif
 
-#if @GNULIB_RANDOM_R@ || address@hidden@
+#if address@hidden@ || (@GNULIB_RANDOM_R@ && address@hidden@) \
+    || defined GNULIB_POSIXCHECK
 # include <stdint.h>
 #endif
 
 #if address@hidden@
 struct random_data
 {
-  int32_t *fptr;               /* Front pointer.  */
-  int32_t *rptr;               /* Rear pointer.  */
-  int32_t *state;              /* Array of state values.  */
-  int rand_type;               /* Type of random number generator.  */
-  int rand_deg;                        /* Degree of random number generator.  
*/
-  int rand_sep;                        /* Distance between front and rear.  */
-  int32_t *end_ptr;            /* Pointer behind state table.  */
+  int32_t *fptr;                /* Front pointer.  */
+  int32_t *rptr;                /* Rear pointer.  */
+  int32_t *state;               /* Array of state values.  */
+  int rand_type;                /* Type of random number generator.  */
+  int rand_deg;                 /* Degree of random number generator.  */
+  int rand_sep;                 /* Distance between front and rear.  */
+  int32_t *end_ptr;             /* Pointer behind state table.  */
 };
 #endif
 
+#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! 
defined __GLIBC__
+/* On MacOS X 10.3, only <unistd.h> declares mkstemp.  */
+/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt.  */
+/* But avoid namespace pollution on glibc systems.  */
+# include <unistd.h>
+#endif
+
 /* The definition of GL_LINK_WARNING is copied here.  */
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 
 /* Some systems do not define EXIT_*, despite otherwise supporting C89.  */
 #ifndef EXIT_SUCCESS
@@ -85,37 +97,20 @@ struct random_data
 extern "C" {
 #endif
 
-
-#if @GNULIB_MALLOC_POSIX@
-# if address@hidden@
-#  undef malloc
-#  define malloc rpl_malloc
-extern void * malloc (size_t size);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef malloc
-# define malloc(s) \
-    (GL_LINK_WARNING ("malloc is not POSIX compliant everywhere - " \
-                      "use gnulib module malloc-posix for portability"), \
-     malloc (s))
-#endif
-
-
-#if @GNULIB_REALLOC_POSIX@
-# if address@hidden@
-#  undef realloc
-#  define realloc rpl_realloc
-extern void * realloc (void *ptr, size_t size);
+#if @GNULIB_ATOLL@
+# if address@hidden@
+/* Parse a signed decimal integer.
+   Returns the value of the integer.  Errors are not detected.  */
+extern long long atoll (const char *string) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
-# undef realloc
-# define realloc(p,s) \
-    (GL_LINK_WARNING ("realloc is not POSIX compliant everywhere - " \
-                      "use gnulib module realloc-posix for portability"), \
-     realloc (p, s))
+# undef atoll
+# define atoll(s) \
+    (GL_LINK_WARNING ("atoll is unportable - " \
+                      "use gnulib module atoll for portability"), \
+     atoll (s))
 #endif
 
-
 #if @GNULIB_CALLOC_POSIX@
 # if address@hidden@
 #  undef calloc
@@ -130,29 +125,28 @@ extern void * calloc (size_t nmemb, size_t size);
      calloc (n, s))
 #endif
 
-
-#if @GNULIB_ATOLL@
-# if address@hidden@
-/* Parse a signed decimal integer.
-   Returns the value of the integer.  Errors are not detected.  */
-extern long long atoll (const char *string);
+#if @GNULIB_CANONICALIZE_FILE_NAME@
+# if @REPLACE_CANONICALIZE_FILE_NAME@
+#  define canonicalize_file_name rpl_canonicalize_file_name
+# endif
+# if address@hidden@ || @REPLACE_CANONICALIZE_FILE_NAME@
+extern char *canonicalize_file_name (const char *name) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
-# undef atoll
-# define atoll(s) \
-    (GL_LINK_WARNING ("atoll is unportable - " \
-                      "use gnulib module atoll for portability"), \
-     atoll (s))
+# undef canonicalize_file_name
+# define canonicalize_file_name(n)                        \
+    (GL_LINK_WARNING ("canonicalize_file_name is unportable - " \
+                      "use gnulib module canonicalize-lgpl for portability"), \
+     canonicalize_file_name (n))
 #endif
 
-
 #if @GNULIB_GETLOADAVG@
 # if address@hidden@
 /* Store max(NELEM,3) load average numbers in LOADAVG[].
    The three numbers are the load average of the last 1 minute, the last 5
    minutes, and the last 15 minutes, respectively.
    LOADAVG is an array of NELEM numbers.  */
-extern int getloadavg (double loadavg[], int nelem);
+extern int getloadavg (double loadavg[], int nelem) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getloadavg
@@ -162,7 +156,6 @@ extern int getloadavg (double loadavg[], int nelem);
      getloadavg (l, n))
 #endif
 
-
 #if @GNULIB_GETSUBOPT@
 /* Assuming *OPTIONP is a comma separated list of elements of the form
    "token" or "token=value", getsubopt parses the first of these elements.
@@ -176,7 +169,8 @@ extern int getloadavg (double loadavg[], int nelem);
    For more details see the POSIX:2001 specification.
    http://www.opengroup.org/susv3xsh/getsubopt.html */
 # if address@hidden@
-extern int getsubopt (char **optionp, char *const *tokens, char **valuep);
+extern int getsubopt (char **optionp, char *const *tokens, char **valuep)
+     _GL_ARG_NONNULL ((1, 2, 3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getsubopt
@@ -186,6 +180,19 @@ extern int getsubopt (char **optionp, char *const *tokens, 
char **valuep);
      getsubopt (o, t, v))
 #endif
 
+#if @GNULIB_MALLOC_POSIX@
+# if address@hidden@
+#  undef malloc
+#  define malloc rpl_malloc
+extern void * malloc (size_t size);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef malloc
+# define malloc(s) \
+    (GL_LINK_WARNING ("malloc is not POSIX compliant everywhere - " \
+                      "use gnulib module malloc-posix for portability"), \
+     malloc (s))
+#endif
 
 #if @GNULIB_MKDTEMP@
 # if address@hidden@
@@ -194,7 +201,7 @@ extern int getsubopt (char **optionp, char *const *tokens, 
char **valuep);
    they are replaced with a string that makes the directory name unique.
    Returns TEMPLATE, or a null pointer if it cannot get a unique name.
    The directory is created mode 700.  */
-extern char * mkdtemp (char * /*template*/);
+extern char * mkdtemp (char * /*template*/) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkdtemp
@@ -204,6 +211,55 @@ extern char * mkdtemp (char * /*template*/);
      mkdtemp (t))
 #endif
 
+#if @GNULIB_MKOSTEMP@
+# if address@hidden@
+/* Create a unique temporary file from TEMPLATE.
+   The last six characters of TEMPLATE 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 mkostemp (char * /*template*/, int /*flags*/) _GL_ARG_NONNULL ((1));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mkostemp
+# define mkostemp(t,f) \
+    (GL_LINK_WARNING ("mkostemp is unportable - " \
+                      "use gnulib module mkostemp for portability"), \
+     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*/)
+     _GL_ARG_NONNULL ((1));
+# 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@
@@ -217,10 +273,7 @@ extern char * mkdtemp (char * /*template*/);
    Returns the open file descriptor if successful, otherwise -1 and errno
    set.  */
 #  define mkstemp rpl_mkstemp
-extern int mkstemp (char * /*template*/);
-# else
-/* On MacOS X 10.3, only <unistd.h> declares mkstemp.  */
-#  include <unistd.h>
+extern int mkstemp (char * /*template*/) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkstemp
@@ -230,16 +283,37 @@ 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*/)
+     _GL_ARG_NONNULL ((1));
+# 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
 #  define putenv rpl_putenv
-extern int putenv (char *string);
+extern int putenv (char *string) _GL_ARG_NONNULL ((1));
 # endif
 #endif
 
-
 #if @GNULIB_RANDOM_R@
 # if address@hidden@
 
@@ -247,41 +321,73 @@ extern int putenv (char *string);
 #   define RAND_MAX 2147483647
 #  endif
 
-int srandom_r (unsigned int seed, struct random_data *rand_state);
+int srandom_r (unsigned int seed, struct random_data *rand_state)
+     _GL_ARG_NONNULL ((2));
 int initstate_r (unsigned int seed, char *buf, size_t buf_size,
-                struct random_data *rand_state);
-int setstate_r (char *arg_state, struct random_data *rand_state);
-int random_r (struct random_data *buf, int32_t *result);
+                 struct random_data *rand_state)
+     _GL_ARG_NONNULL ((2, 4));
+int setstate_r (char *arg_state, struct random_data *rand_state)
+     _GL_ARG_NONNULL ((1, 2));
+int random_r (struct random_data *buf, int32_t *result)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef random_r
-# define random_r(b,r)                           \
+# define random_r(b,r)                            \
     (GL_LINK_WARNING ("random_r is unportable - " \
                       "use gnulib module random_r for portability"), \
      random_r (b,r))
 # undef initstate_r
-# define initstate_r(s,b,sz,r)                      \
+# define initstate_r(s,b,sz,r)                       \
     (GL_LINK_WARNING ("initstate_r is unportable - " \
                       "use gnulib module random_r for portability"), \
      initstate_r (s,b,sz,r))
 # undef srandom_r
-# define srandom_r(s,r)                                   \
+# define srandom_r(s,r)                            \
     (GL_LINK_WARNING ("srandom_r is unportable - " \
                       "use gnulib module random_r for portability"), \
      srandom_r (s,r))
 # undef setstate_r
-# define setstate_r(a,r)                                   \
+# define setstate_r(a,r)                                    \
     (GL_LINK_WARNING ("setstate_r is unportable - " \
                       "use gnulib module random_r for portability"), \
      setstate_r (a,r))
 #endif
 
+#if @GNULIB_REALLOC_POSIX@
+# if address@hidden@
+#  undef realloc
+#  define realloc rpl_realloc
+extern void * realloc (void *ptr, size_t size);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef realloc
+# define realloc(p,s) \
+    (GL_LINK_WARNING ("realloc is not POSIX compliant everywhere - " \
+                      "use gnulib module realloc-posix for portability"), \
+     realloc (p, s))
+#endif
+
+#if @GNULIB_REALPATH@
+# if @REPLACE_REALPATH@
+#  define realpath rpl_realpath
+# endif
+# if address@hidden@ || @REPLACE_REALPATH@
+extern char *realpath (const char *name, char *resolved) _GL_ARG_NONNULL ((1));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef realpath
+# define realpath(n,r)                        \
+    (GL_LINK_WARNING ("realpath is unportable - use gnulib module " \
+                      "canonicalize or canonicalize-lgpl for portability"), \
+     realpath (n, r))
+#endif
 
 #if @GNULIB_RPMATCH@
 # if address@hidden@
 /* Test a user response to a question.
    Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear.  */
-extern int rpmatch (const char *response);
+extern int rpmatch (const char *response) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef rpmatch
@@ -291,37 +397,32 @@ extern int rpmatch (const char *response);
      rpmatch (r))
 #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
-#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);
+extern int setenv (const char *name, const char *value, int replace)
+     _GL_ARG_NONNULL ((1));
 # 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@
 # if @REPLACE_STRTOD@
 #  define strtod rpl_strtod
 # endif
 # if address@hidden@ || @REPLACE_STRTOD@
  /* Parse a double from STRING, updating ENDP if appropriate.  */
-extern double strtod (const char *str, char **endp);
+extern double strtod (const char *str, char **endp) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtod
@@ -331,7 +432,6 @@ extern double strtod (const char *str, char **endp);
      strtod (s, e))
 #endif
 
-
 #if @GNULIB_STRTOLL@
 # if address@hidden@
 /* Parse a signed integer whose textual representation starts at STRING.
@@ -342,7 +442,8 @@ extern double strtod (const char *str, char **endp);
    stored in *ENDPTR.
    Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
    to ERANGE.  */
-extern long long strtoll (const char *string, char **endptr, int base);
+extern long long strtoll (const char *string, char **endptr, int base)
+     _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtoll
@@ -352,7 +453,6 @@ extern long long strtoll (const char *string, char 
**endptr, int base);
      strtoll (s, e, b))
 #endif
 
-
 #if @GNULIB_STRTOULL@
 # if address@hidden@
 /* Parse an unsigned integer whose textual representation starts at STRING.
@@ -363,7 +463,8 @@ extern long long strtoll (const char *string, char 
**endptr, int base);
    stored in *ENDPTR.
    Upon overflow, the return value is ULLONG_MAX, and errno is set to
    ERANGE.  */
-extern unsigned long long strtoull (const char *string, char **endptr, int 
base);
+extern unsigned long long strtoull (const char *string, char **endptr, int 
base)
+     _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtoull
@@ -373,6 +474,22 @@ extern unsigned long long strtoull (const char *string, 
char **endptr, int base)
      strtoull (s, e, b))
 #endif
 
+#if @GNULIB_UNSETENV@
+# 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) _GL_ARG_NONNULL ((1));
+# 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/gl/strcasecmp.c b/gl/strcasecmp.c
index bbfd570..122530f 100644
--- a/gl/strcasecmp.c
+++ b/gl/strcasecmp.c
@@ -46,7 +46,7 @@ strcasecmp (const char *s1, const char *s2)
       c2 = TOLOWER (*p2);
 
       if (c1 == '\0')
-       break;
+        break;
 
       ++p1;
       ++p2;
diff --git a/gl/strerror.c b/gl/strerror.c
index dfe6c25..fa0ed14 100644
--- a/gl/strerror.c
+++ b/gl/strerror.c
@@ -334,10 +334,10 @@ rpl_strerror (int n)
 
     if (result == NULL || result[0] == '\0')
       {
-       static char const fmt[] = "Unknown error (%d)";
-       static char msg_buf[sizeof fmt + INT_STRLEN_BOUND (n)];
-       sprintf (msg_buf, fmt, n);
-       return msg_buf;
+        static char const fmt[] = "Unknown error (%d)";
+        static char msg_buf[sizeof fmt + INT_STRLEN_BOUND (n)];
+        sprintf (msg_buf, fmt, n);
+        return msg_buf;
       }
 
     return result;
diff --git a/gl/string.in.h b/gl/string.in.h
index 97da28f..f7d8475 100644
--- a/gl/string.in.h
+++ b/gl/string.in.h
@@ -28,6 +28,8 @@
 #ifndef _GL_STRING_H
 #define _GL_STRING_H
 
+/* NetBSD 5.0 mis-defines NULL.  */
+#include <stddef.h>
 
 #ifndef __attribute__
 /* This feature is available in gcc versions 2.5 and later.  */
@@ -43,6 +45,8 @@
 
 /* The definition of GL_LINK_WARNING is copied here.  */
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 
 #ifdef __cplusplus
 extern "C" {
@@ -54,7 +58,7 @@ extern "C" {
 # if @REPLACE_MEMCHR@
 #  define memchr rpl_memchr
 extern void *memchr (void const *__s, int __c, size_t __n)
-  __attribute__ ((__pure__));
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef memchr
@@ -71,8 +75,8 @@ extern void *memchr (void const *__s, int __c, size_t __n)
 # endif
 # if ! @HAVE_DECL_MEMMEM@ || @REPLACE_MEMMEM@
 extern void *memmem (void const *__haystack, size_t __haystack_len,
-                    void const *__needle, size_t __needle_len)
-  __attribute__ ((__pure__));
+                     void const *__needle, size_t __needle_len)
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef memmem
@@ -88,7 +92,8 @@ extern void *memmem (void const *__haystack, size_t 
__haystack_len,
 #if @GNULIB_MEMPCPY@
 # if ! @HAVE_MEMPCPY@
 extern void *mempcpy (void *restrict __dest, void const *restrict __src,
-                     size_t __n);
+                      size_t __n)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mempcpy
@@ -102,7 +107,7 @@ extern void *mempcpy (void *restrict __dest, void const 
*restrict __src,
 #if @GNULIB_MEMRCHR@
 # if ! @HAVE_DECL_MEMRCHR@
 extern void *memrchr (void const *, int, size_t)
-  __attribute__ ((__pure__));
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef memrchr
@@ -118,7 +123,7 @@ extern void *memrchr (void const *, int, size_t)
 #if @GNULIB_RAWMEMCHR@
 # if ! @HAVE_RAWMEMCHR@
 extern void *rawmemchr (void const *__s, int __c_in)
-  __attribute__ ((__pure__));
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef rawmemchr
@@ -131,7 +136,8 @@ extern void *rawmemchr (void const *__s, int __c_in)
 /* Copy SRC to DST, returning the address of the terminating '\0' in DST.  */
 #if @GNULIB_STPCPY@
 # if ! @HAVE_STPCPY@
-extern char *stpcpy (char *restrict __dst, char const *restrict __src);
+extern char *stpcpy (char *restrict __dst, char const *restrict __src)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef stpcpy
@@ -147,7 +153,8 @@ extern char *stpcpy (char *restrict __dst, char const 
*restrict __src);
 # if ! @HAVE_STPNCPY@
 #  define stpncpy gnu_stpncpy
 extern char *stpncpy (char *restrict __dst, char const *restrict __src,
-                     size_t __n);
+                      size_t __n)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef stpncpy
@@ -172,7 +179,7 @@ extern char *stpncpy (char *restrict __dst, char const 
*restrict __src,
 #if @GNULIB_STRCHRNUL@
 # if ! @HAVE_STRCHRNUL@
 extern char *strchrnul (char const *__s, int __c_in)
-  __attribute__ ((__pure__));
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strchrnul
@@ -189,7 +196,7 @@ extern char *strchrnul (char const *__s, int __c_in)
 #  define strdup rpl_strdup
 # endif
 # if !(@HAVE_DECL_STRDUP@ || defined strdup) || @REPLACE_STRDUP@
-extern char *strdup (char const *__s);
+extern char *strdup (char const *__s) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strdup
@@ -201,12 +208,12 @@ extern char *strdup (char const *__s);
 
 /* Return a newly allocated copy of at most N bytes of STRING.  */
 #if @GNULIB_STRNDUP@
-# if ! @HAVE_STRNDUP@
+# if @REPLACE_STRNDUP@
 #  undef strndup
 #  define strndup rpl_strndup
 # endif
-# if ! @HAVE_STRNDUP@ || ! @HAVE_DECL_STRNDUP@
-extern char *strndup (char const *__string, size_t __n);
+# if @REPLACE_STRNDUP@ || ! @HAVE_DECL_STRNDUP@
+extern char *strndup (char const *__string, size_t __n) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strndup
@@ -222,7 +229,7 @@ extern char *strndup (char const *__string, size_t __n);
 #if @GNULIB_STRNLEN@
 # if ! @HAVE_DECL_STRNLEN@
 extern size_t strnlen (char const *__string, size_t __maxlen)
-  __attribute__ ((__pure__));
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strnlen
@@ -249,7 +256,7 @@ extern size_t strnlen (char const *__string, size_t 
__maxlen)
 #if @GNULIB_STRPBRK@
 # if ! @HAVE_STRPBRK@
 extern char *strpbrk (char const *__s, char const *__accept)
-  __attribute__ ((__pure__));
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2));
 # endif
 # if defined GNULIB_POSIXCHECK
 /* strpbrk() assumes the second argument is a list of single-byte characters.
@@ -311,7 +318,8 @@ extern char *strpbrk (char const *__s, char const *__accept)
    See also strtok_r().  */
 #if @GNULIB_STRSEP@
 # if ! @HAVE_STRSEP@
-extern char *strsep (char **restrict __stringp, char const *restrict __delim);
+extern char *strsep (char **restrict __stringp, char const *restrict __delim)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 # if defined GNULIB_POSIXCHECK
 #  undef strsep
@@ -332,8 +340,8 @@ extern char *strsep (char **restrict __stringp, char const 
*restrict __delim);
 #if @GNULIB_STRSTR@
 # if @REPLACE_STRSTR@
 #  define strstr rpl_strstr
-char *strstr (const char *haystack, const char *needle)
-  __attribute__ ((__pure__));
+extern char *strstr (const char *haystack, const char *needle)
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 /* strstr() does not work with multibyte strings if the locale encoding is
@@ -358,7 +366,7 @@ char *strstr (const char *haystack, const char *needle)
 # endif
 # if ! @HAVE_STRCASESTR@ || @REPLACE_STRCASESTR@
 extern char *strcasestr (const char *haystack, const char *needle)
-  __attribute__ ((__pure__));
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 /* strcasestr() does not work with multibyte strings:
@@ -377,12 +385,12 @@ extern char *strcasestr (const char *haystack, const char 
*needle)
 /* Parse S into tokens separated by characters in DELIM.
    If S is NULL, the saved pointer in SAVE_PTR is used as
    the next starting point.  For example:
-       char s[] = "-abc-=-def";
-       char *sp;
-       x = strtok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
-       x = strtok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
-       x = strtok_r(NULL, "=", &sp);   // x = NULL
-               // s = "abc\0-def\0"
+        char s[] = "-abc-=-def";
+        char *sp;
+        x = strtok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
+        x = strtok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
+        x = strtok_r(NULL, "=", &sp);   // x = NULL
+                // s = "abc\0-def\0"
 
    This is a variant of strtok() that is multithread-safe.
 
@@ -397,9 +405,16 @@ extern char *strcasestr (const char *haystack, const char 
*needle)
 
    See also strsep().  */
 #if @GNULIB_STRTOK_R@
-# if ! @HAVE_DECL_STRTOK_R@
+# if @REPLACE_STRTOK_R@
+#  undef strtok_r
+#  define strtok_r rpl_strtok_r
+# elif @UNDEFINE_STRTOK_R@
+#  undef strtok_r
+# endif
+# if ! @HAVE_DECL_STRTOK_R@ || @REPLACE_STRTOK_R@
 extern char *strtok_r (char *restrict s, char const *restrict delim,
-                      char **restrict save_ptr);
+                       char **restrict save_ptr)
+     _GL_ARG_NONNULL ((2, 3));
 # endif
 # if defined GNULIB_POSIXCHECK
 #  undef strtok_r
@@ -424,13 +439,13 @@ extern char *strtok_r (char *restrict s, char const 
*restrict delim,
 #if @GNULIB_MBSLEN@
 /* Return the number of multibyte characters in the character string STRING.
    This considers multibyte characters, unlike strlen, which counts bytes.  */
-extern size_t mbslen (const char *string);
+extern size_t mbslen (const char *string) _GL_ARG_NONNULL ((1));
 #endif
 
 #if @GNULIB_MBSNLEN@
 /* Return the number of multibyte characters in the character string starting
    at STRING and ending at STRING + LEN.  */
-extern size_t mbsnlen (const char *string, size_t len);
+extern size_t mbsnlen (const char *string, size_t len) _GL_ARG_NONNULL ((1));
 #endif
 
 #if @GNULIB_MBSCHR@
@@ -439,7 +454,7 @@ extern size_t mbsnlen (const char *string, size_t len);
    Unlike strchr(), this function works correctly in multibyte locales with
    encodings such as GB18030.  */
 # define mbschr rpl_mbschr /* avoid collision with HP-UX function */
-extern char * mbschr (const char *string, int c);
+extern char * mbschr (const char *string, int c) _GL_ARG_NONNULL ((1));
 #endif
 
 #if @GNULIB_MBSRCHR@
@@ -448,7 +463,7 @@ extern char * mbschr (const char *string, int c);
    Unlike strrchr(), this function works correctly in multibyte locales with
    encodings such as GB18030.  */
 # define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */
-extern char * mbsrchr (const char *string, int c);
+extern char * mbsrchr (const char *string, int c) _GL_ARG_NONNULL ((1));
 #endif
 
 #if @GNULIB_MBSSTR@
@@ -456,7 +471,8 @@ extern char * mbsrchr (const char *string, int c);
    string HAYSTACK.  Return NULL if NEEDLE is not found in HAYSTACK.
    Unlike strstr(), this function works correctly in multibyte locales with
    encodings different from UTF-8.  */
-extern char * mbsstr (const char *haystack, const char *needle);
+extern char * mbsstr (const char *haystack, const char *needle)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSCASECMP@
@@ -466,7 +482,8 @@ extern char * mbsstr (const char *haystack, const char 
*needle);
    Note: This function may, in multibyte locales, return 0 for strings of
    different lengths!
    Unlike strcasecmp(), this function works correctly in multibyte locales.  */
-extern int mbscasecmp (const char *s1, const char *s2);
+extern int mbscasecmp (const char *s1, const char *s2)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSNCASECMP@
@@ -479,7 +496,8 @@ extern int mbscasecmp (const char *s1, const char *s2);
    of different lengths!
    Unlike strncasecmp(), this function works correctly in multibyte locales.
    But beware that N is not a byte count but a character count!  */
-extern int mbsncasecmp (const char *s1, const char *s2, size_t n);
+extern int mbsncasecmp (const char *s1, const char *s2, size_t n)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSPCASECMP@
@@ -492,7 +510,8 @@ extern int mbsncasecmp (const char *s1, const char *s2, 
size_t n);
    smaller length than PREFIX!
    Unlike strncasecmp(), this function works correctly in multibyte
    locales.  */
-extern char * mbspcasecmp (const char *string, const char *prefix);
+extern char * mbspcasecmp (const char *string, const char *prefix)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSCASESTR@
@@ -501,7 +520,8 @@ extern char * mbspcasecmp (const char *string, const char 
*prefix);
    Note: This function may, in multibyte locales, return success even if
    strlen (haystack) < strlen (needle) !
    Unlike strcasestr(), this function works correctly in multibyte locales.  */
-extern char * mbscasestr (const char *haystack, const char *needle);
+extern char * mbscasestr (const char *haystack, const char *needle)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSCSPN@
@@ -510,7 +530,8 @@ extern char * mbscasestr (const char *haystack, const char 
*needle);
    beginning of the string to this occurrence, or to the end of the string
    if none exists.
    Unlike strcspn(), this function works correctly in multibyte locales.  */
-extern size_t mbscspn (const char *string, const char *accept);
+extern size_t mbscspn (const char *string, const char *accept)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSPBRK@
@@ -519,7 +540,8 @@ extern size_t mbscspn (const char *string, const char 
*accept);
    exists.
    Unlike strpbrk(), this function works correctly in multibyte locales.  */
 # define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
-extern char * mbspbrk (const char *string, const char *accept);
+extern char * mbspbrk (const char *string, const char *accept)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSSPN@
@@ -528,7 +550,8 @@ extern char * mbspbrk (const char *string, const char 
*accept);
    beginning of the string to this occurrence, or to the end of the string
    if none exists.
    Unlike strspn(), this function works correctly in multibyte locales.  */
-extern size_t mbsspn (const char *string, const char *reject);
+extern size_t mbsspn (const char *string, const char *reject)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSSEP@
@@ -546,7 +569,8 @@ extern size_t mbsspn (const char *string, const char 
*reject);
    Caveat: The identity of the delimiting character is lost.
 
    See also mbstok_r().  */
-extern char * mbssep (char **stringp, const char *delim);
+extern char * mbssep (char **stringp, const char *delim)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSTOK_R@
@@ -554,19 +578,20 @@ extern char * mbssep (char **stringp, const char *delim);
    the character string DELIM.
    If STRING is NULL, the saved pointer in SAVE_PTR is used as
    the next starting point.  For example:
-       char s[] = "-abc-=-def";
-       char *sp;
-       x = mbstok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
-       x = mbstok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
-       x = mbstok_r(NULL, "=", &sp);   // x = NULL
-               // s = "abc\0-def\0"
+        char s[] = "-abc-=-def";
+        char *sp;
+        x = mbstok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
+        x = mbstok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
+        x = mbstok_r(NULL, "=", &sp);   // x = NULL
+                // s = "abc\0-def\0"
 
    Caveat: It modifies the original string.
    Caveat: These functions cannot be used on constant strings.
    Caveat: The identity of the delimiting character is lost.
 
    See also mbssep().  */
-extern char * mbstok_r (char *string, const char *delim, char **save_ptr);
+extern char * mbstok_r (char *string, const char *delim, char **save_ptr)
+     _GL_ARG_NONNULL ((2, 3));
 #endif
 
 /* Map any int, typically from errno, into an error message.  */
@@ -601,7 +626,7 @@ extern char *strsignal (int __sig);
 
 #if @GNULIB_STRVERSCMP@
 # if address@hidden@
-extern int strverscmp (const char *, const char *);
+extern int strverscmp (const char *, const char *) _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strverscmp
diff --git a/gl/strings.in.h b/gl/strings.in.h
index 05e7152..2917a09 100644
--- a/gl/strings.in.h
+++ b/gl/strings.in.h
@@ -1,6 +1,6 @@
 /* A substitute <strings.h>.
 
-   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
@@ -31,6 +31,8 @@
 
 /* The definition of GL_LINK_WARNING is copied here.  */
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 
 #ifdef __cplusplus
 extern "C" {
@@ -42,7 +44,8 @@ extern "C" {
    than S2.
    Note: This function does not work in multibyte locales.  */
 #if ! @HAVE_STRCASECMP@
-extern int strcasecmp (char const *s1, char const *s2);
+extern int strcasecmp (char const *s1, char const *s2)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 #if defined GNULIB_POSIXCHECK
 /* strcasecmp() does not work with multibyte strings:
@@ -64,7 +67,8 @@ extern int strcasecmp (char const *s1, char const *s2);
    lexicographically less than, equal to or greater than S2.
    Note: This function cannot work correctly in multibyte locales.  */
 #if ! @HAVE_DECL_STRNCASECMP@
-extern int strncasecmp (char const *s1, char const *s2, size_t n);
+extern int strncasecmp (char const *s1, char const *s2, size_t n)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 #if defined GNULIB_POSIXCHECK
 /* strncasecmp() does not work with multibyte strings:
diff --git a/gl/strncasecmp.c b/gl/strncasecmp.c
index 5e29a0a..62459be 100644
--- a/gl/strncasecmp.c
+++ b/gl/strncasecmp.c
@@ -46,7 +46,7 @@ strncasecmp (const char *s1, const char *s2, size_t n)
       c2 = TOLOWER (*p2);
 
       if (--n == 0 || c1 == '\0')
-       break;
+        break;
 
       ++p1;
       ++p2;
diff --git a/gl/strtok_r.c b/gl/strtok_r.c
index 232474a..67c9d2d 100644
--- a/gl/strtok_r.c
+++ b/gl/strtok_r.c
@@ -1,5 +1,5 @@
 /* Reentrant string tokenizer.  Generic version.
-   Copyright (C) 1991,1996-1999,2001,2004,2007 Free Software Foundation, Inc.
+   Copyright (C) 1991,1996-1999,2001,2004,2007,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
@@ -21,10 +21,10 @@
 
 #include <string.h>
 
-#undef strtok_r
-#undef __strtok_r
-
-#ifndef _LIBC
+#ifdef _LIBC
+# undef strtok_r
+# undef __strtok_r
+#else
 # define __strtok_r strtok_r
 # define __rawmemchr strchr
 #endif
@@ -32,12 +32,12 @@
 /* Parse S into tokens separated by characters in DELIM.
    If S is NULL, the saved pointer in SAVE_PTR is used as
    the next starting point.  For example:
-       char s[] = "-abc-=-def";
-       char *sp;
-       x = strtok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
-       x = strtok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
-       x = strtok_r(NULL, "=", &sp);   // x = NULL
-               // s = "abc\0-def\0"
+        char s[] = "-abc-=-def";
+        char *sp;
+        x = strtok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
+        x = strtok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
+        x = strtok_r(NULL, "=", &sp);   // x = NULL
+                // s = "abc\0-def\0"
 */
 char *
 __strtok_r (char *s, const char *delim, char **save_ptr)
diff --git a/gl/strverscmp.c b/gl/strverscmp.c
index 1e5b1ab..80d9eaf 100644
--- a/gl/strverscmp.c
+++ b/gl/strverscmp.c
@@ -117,8 +117,8 @@ __strverscmp (const char *s1, const char *s2)
 
     case LEN:
       while (ISDIGIT (*p1++))
-       if (!ISDIGIT (*p2++))
-         return 1;
+        if (!ISDIGIT (*p2++))
+          return 1;
 
       return ISDIGIT (*p2) ? -1 : diff;
 
diff --git a/gl/sys_select.in.h b/gl/sys_select.in.h
index e87b7d0..cdcebf7 100644
--- a/gl/sys_select.in.h
+++ b/gl/sys_select.in.h
@@ -42,8 +42,18 @@
 # include <sys/types.h>
 
 /* On OSF/1 4.0, <sys/select.h> provides only a forward declaration
-   of 'struct timeval', and no definition of this type..  */
-# include <sys/time.h>
+   of 'struct timeval', and no definition of this type.
+   But avoid namespace pollution on glibc systems.  */
+# ifndef __GLIBC__
+#  include <sys/time.h>
+# endif
+
+/* On Solaris 10, <sys/select.h> provides an FD_ZERO implementation
+   that relies on memset(), but without including <string.h>.
+   But avoid namespace pollution on glibc systems.  */
+# ifndef __GLIBC__
+#  include <string.h>
+# endif
 
 /* The include_next requires a split double-inclusion guard.  */
 # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
diff --git a/gl/sys_socket.in.h b/gl/sys_socket.in.h
index 26577df..2f41078 100644
--- a/gl/sys_socket.in.h
+++ b/gl/sys_socket.in.h
@@ -43,6 +43,8 @@
 #ifndef _GL_SYS_SOCKET_H
 #define _GL_SYS_SOCKET_H
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 #if address@hidden@
 typedef unsigned short  sa_family_t;
 #endif
@@ -54,10 +56,10 @@ typedef unsigned short  sa_family_t;
 # define __ss_aligntype unsigned long int
 # define _SS_SIZE 256
 # define _SS_PADSIZE \
-    (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype)     \
-                 ? sizeof (sa_family_t)                                \
-                 : alignof (__ss_aligntype))                           \
-                + sizeof (__ss_aligntype)))
+    (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype)      \
+                  ? sizeof (sa_family_t)                                \
+                  : alignof (__ss_aligntype))                           \
+                 + sizeof (__ss_aligntype)))
 
 struct sockaddr_storage
 {
@@ -177,7 +179,7 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
 # if @GNULIB_SOCKET@
 #  if @HAVE_WINSOCK2_H@
 #   undef socket
-#   define socket              rpl_socket
+#   define socket               rpl_socket
 extern int rpl_socket (int, int, int protocol);
 #  endif
 # elif @HAVE_WINSOCK2_H@
@@ -194,8 +196,8 @@ extern int rpl_socket (int, int, int protocol);
 # if @GNULIB_CONNECT@
 #  if @HAVE_WINSOCK2_H@
 #   undef connect
-#   define connect             rpl_connect
-extern int rpl_connect (int, struct sockaddr *, int);
+#   define connect              rpl_connect
+extern int rpl_connect (int, struct sockaddr *, int) _GL_ARG_NONNULL ((2));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef connect
@@ -211,7 +213,7 @@ extern int rpl_connect (int, struct sockaddr *, int);
 # if @GNULIB_ACCEPT@
 #  if @HAVE_WINSOCK2_H@
 #   undef accept
-#   define accept              rpl_accept
+#   define accept               rpl_accept
 extern int rpl_accept (int, struct sockaddr *, int *);
 #  endif
 # elif @HAVE_WINSOCK2_H@
@@ -228,8 +230,8 @@ extern int rpl_accept (int, struct sockaddr *, int *);
 # if @GNULIB_BIND@
 #  if @HAVE_WINSOCK2_H@
 #   undef bind
-#   define bind                        rpl_bind
-extern int rpl_bind (int, struct sockaddr *, int);
+#   define bind                 rpl_bind
+extern int rpl_bind (int, struct sockaddr *, int) _GL_ARG_NONNULL ((2));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef bind
@@ -245,8 +247,9 @@ extern int rpl_bind (int, struct sockaddr *, int);
 # if @GNULIB_GETPEERNAME@
 #  if @HAVE_WINSOCK2_H@
 #   undef getpeername
-#   define getpeername         rpl_getpeername
-extern int rpl_getpeername (int, struct sockaddr *, int *);
+#   define getpeername          rpl_getpeername
+extern int rpl_getpeername (int, struct sockaddr *, int *)
+     _GL_ARG_NONNULL ((2, 3));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef getpeername
@@ -262,8 +265,9 @@ extern int rpl_getpeername (int, struct sockaddr *, int *);
 # if @GNULIB_GETSOCKNAME@
 #  if @HAVE_WINSOCK2_H@
 #   undef getsockname
-#   define getsockname         rpl_getsockname
-extern int rpl_getsockname (int, struct sockaddr *, int *);
+#   define getsockname          rpl_getsockname
+extern int rpl_getsockname (int, struct sockaddr *, int *)
+     _GL_ARG_NONNULL ((2, 3));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef getsockname
@@ -279,8 +283,9 @@ extern int rpl_getsockname (int, struct sockaddr *, int *);
 # if @GNULIB_GETSOCKOPT@
 #  if @HAVE_WINSOCK2_H@
 #   undef getsockopt
-#   define getsockopt          rpl_getsockopt
-extern int rpl_getsockopt (int, int, int, void *, socklen_t *);
+#   define getsockopt           rpl_getsockopt
+extern int rpl_getsockopt (int, int, int, void *, socklen_t *)
+     _GL_ARG_NONNULL ((4, 5));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef getsockopt
@@ -296,7 +301,7 @@ extern int rpl_getsockopt (int, int, int, void *, socklen_t 
*);
 # if @GNULIB_LISTEN@
 #  if @HAVE_WINSOCK2_H@
 #   undef listen
-#   define listen              rpl_listen
+#   define listen               rpl_listen
 extern int rpl_listen (int, int);
 #  endif
 # elif @HAVE_WINSOCK2_H@
@@ -313,8 +318,8 @@ extern int rpl_listen (int, int);
 # if @GNULIB_RECV@
 #  if @HAVE_WINSOCK2_H@
 #   undef recv
-#   define recv                        rpl_recv
-extern int rpl_recv (int, void *, int, int);
+#   define recv                 rpl_recv
+extern int rpl_recv (int, void *, int, int) _GL_ARG_NONNULL ((2));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef recv
@@ -330,8 +335,8 @@ extern int rpl_recv (int, void *, int, int);
 # if @GNULIB_SEND@
 #  if @HAVE_WINSOCK2_H@
 #   undef send
-#   define send                        rpl_send
-extern int rpl_send (int, const void *, int, int);
+#   define send                 rpl_send
+extern int rpl_send (int, const void *, int, int) _GL_ARG_NONNULL ((2));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef send
@@ -347,8 +352,9 @@ extern int rpl_send (int, const void *, int, int);
 # if @GNULIB_RECVFROM@
 #  if @HAVE_WINSOCK2_H@
 #   undef recvfrom
-#   define recvfrom            rpl_recvfrom
-extern int rpl_recvfrom (int, void *, int, int, struct sockaddr *, int *);
+#   define recvfrom             rpl_recvfrom
+extern int rpl_recvfrom (int, void *, int, int, struct sockaddr *, int *)
+     _GL_ARG_NONNULL ((2));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef recvfrom
@@ -364,8 +370,9 @@ extern int rpl_recvfrom (int, void *, int, int, struct 
sockaddr *, int *);
 # if @GNULIB_SENDTO@
 #  if @HAVE_WINSOCK2_H@
 #   undef sendto
-#   define sendto              rpl_sendto
-extern int rpl_sendto (int, const void *, int, int, struct sockaddr *, int);
+#   define sendto               rpl_sendto
+extern int rpl_sendto (int, const void *, int, int, struct sockaddr *, int)
+     _GL_ARG_NONNULL ((2));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef sendto
@@ -381,8 +388,9 @@ extern int rpl_sendto (int, const void *, int, int, struct 
sockaddr *, int);
 # if @GNULIB_SETSOCKOPT@
 #  if @HAVE_WINSOCK2_H@
 #   undef setsockopt
-#   define setsockopt          rpl_setsockopt
-extern int rpl_setsockopt (int, int, int, const void *, socklen_t);
+#   define setsockopt           rpl_setsockopt
+extern int rpl_setsockopt (int, int, int, const void *, socklen_t)
+     _GL_ARG_NONNULL ((4));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef setsockopt
@@ -398,7 +406,7 @@ extern int rpl_setsockopt (int, int, int, const void *, 
socklen_t);
 # if @GNULIB_SHUTDOWN@
 #  if @HAVE_WINSOCK2_H@
 #   undef shutdown
-#   define shutdown            rpl_shutdown
+#   define shutdown             rpl_shutdown
 extern int rpl_shutdown (int, int);
 #  endif
 # elif @HAVE_WINSOCK2_H@
@@ -414,7 +422,7 @@ extern int rpl_shutdown (int, int);
 
 # if @HAVE_WINSOCK2_H@
 #  undef select
-#  define select               select_used_without_including_sys_select_h
+#  define select                select_used_without_including_sys_select_h
 # endif
 
 # ifdef __cplusplus
@@ -423,5 +431,32 @@ extern int rpl_shutdown (int, int);
 
 #endif /* HAVE_SYS_SOCKET_H */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if @GNULIB_ACCEPT4@
+/* Accept a connection on a socket, with specific opening flags.
+   The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
+   and O_TEXT, O_BINARY (defined in "binary-io.h").
+   See also the Linux man page at
+   <http://www.kernel.org/doc/man-pages/online/pages/man2/accept4.2.html>.  */
+# if @HAVE_ACCEPT4@
+#  define accept4 rpl_accept4
+# endif
+extern int accept4 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
+                    int flags);
+#elif defined GNULIB_POSIXCHECK
+# undef accept4
+# define accept4(s,a,l,f) \
+    (GL_LINK_WARNING ("accept4 is unportable - " \
+                      "use gnulib module accept4 for portability"), \
+     accept4 (s, a, l, f))
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _GL_SYS_SOCKET_H */
 #endif /* _GL_SYS_SOCKET_H */
diff --git a/gl/sys_stat.in.h b/gl/sys_stat.in.h
index 1e6294d..5e51591 100644
--- a/gl/sys_stat.in.h
+++ b/gl/sys_stat.in.h
@@ -38,6 +38,9 @@
 /* Get nlink_t.  */
 #include <sys/types.h>
 
+/* Get struct timespec.  */
+#include <time.h>
+
 /* The include_next requires a split double-inclusion guard.  */
 address@hidden@ @NEXT_SYS_STAT_H@
 
@@ -46,6 +49,8 @@
 
 /* The definition of GL_LINK_WARNING is copied here.  */
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 /* Before doing "#define mkdir rpl_mkdir" below, we need to include all
    headers that may declare mkdir().  */
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
@@ -278,12 +283,98 @@
 # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
 #endif
 
+/* Macros for futimens and utimensat.  */
+#ifndef UTIME_NOW
+# define UTIME_NOW (-1)
+# define UTIME_OMIT (-2)
+#endif
+
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 
+#if @GNULIB_FCHMODAT@
+# if address@hidden@
+extern int fchmodat (int fd, char const *file, mode_t mode, int flag)
+     _GL_ARG_NONNULL ((2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fchmodat
+# define fchmodat(d,n,m,f)                         \
+    (GL_LINK_WARNING ("fchmodat is not portable - " \
+                      "use gnulib module openat for portability"), \
+     fchmodat (d, n, m, f))
+#endif
+
+
+#if @REPLACE_FSTAT@
+# define fstat rpl_fstat
+extern int fstat (int fd, struct stat *buf) _GL_ARG_NONNULL ((2));
+#endif
+
+
+#if @GNULIB_FSTATAT@
+# if @REPLACE_FSTATAT@
+#  undef fstatat
+#  define fstatat rpl_fstatat
+# endif
+# if address@hidden@ || @REPLACE_FSTATAT@
+extern int fstatat (int fd, char const *name, struct stat *st, int flags)
+     _GL_ARG_NONNULL ((2, 3));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fstatat
+# define fstatat(d,n,s,f)                         \
+    (GL_LINK_WARNING ("fstatat is not portable - " \
+                      "use gnulib module openat for portability"), \
+     fstatat (d, n, s, f))
+#endif
+
+
+#if @GNULIB_FUTIMENS@
+# if @REPLACE_FUTIMENS@
+#  undef futimens
+#  define futimens rpl_futimens
+# endif
+# if address@hidden@ || @REPLACE_FUTIMENS@
+extern int futimens (int fd, struct timespec const times[2]);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef futimens
+# define futimens(f,t)                         \
+    (GL_LINK_WARNING ("futimens is not portable - " \
+                      "use gnulib module futimens for portability"), \
+     futimens (f, t))
+#endif
+
+
+#if @GNULIB_LCHMOD@
+/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
+   denotes a symbolic link.  */
+# if address@hidden@
+/* The lchmod replacement follows symbolic links.  Callers should take
+   this into account; lchmod should be applied only to arguments that
+   are known to not be symbolic links.  On hosts that lack lchmod,
+   this can lead to race conditions between the check and the
+   invocation of lchmod, but we know of no workarounds that are
+   reliable in general.  You might try requesting support for lchmod
+   from your operating system supplier.  */
+#  define lchmod chmod
+# endif
+# if 0 /* assume already declared */
+extern int lchmod (const char *filename, mode_t mode) _GL_ARG_NONNULL ((1));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef lchmod
+# define lchmod(f,m) \
+    (GL_LINK_WARNING ("lchmod is unportable - " \
+                      "use gnulib module lchmod for portability"), \
+     lchmod (f, m))
+#endif
+
+
 #if @GNULIB_LSTAT@
 # if ! @HAVE_LSTAT@
 /* mingw does not support symlinks, therefore it does not have lstat.  But
@@ -292,13 +383,14 @@ extern "C" {
 # elif @REPLACE_LSTAT@
 #  undef lstat
 #  define lstat rpl_lstat
-extern int rpl_lstat (const char *name, struct stat *buf);
+extern int rpl_lstat (const char *name, struct stat *buf)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef lstat
-# define lstat(p,b)                                                    \
-  (GL_LINK_WARNING ("lstat is unportable - "                           \
-                   "use gnulib module lstat for portability"),         \
+# define lstat(p,b)                                                     \
+  (GL_LINK_WARNING ("lstat is unportable - "                            \
+                    "use gnulib module lstat for portability"),         \
    lstat (p, b))
 #endif
 
@@ -306,7 +398,7 @@ extern int rpl_lstat (const char *name, struct stat *buf);
 #if @REPLACE_MKDIR@
 # undef mkdir
 # define mkdir rpl_mkdir
-extern int mkdir (char const *name, mode_t mode);
+extern int mkdir (char const *name, mode_t mode) _GL_ARG_NONNULL ((1));
 #else
 /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
    Additionally, it declares _mkdir (and depending on compile flags, an
@@ -324,30 +416,125 @@ rpl_mkdir (char const *name, mode_t mode)
 #endif
 
 
-/* Declare BSD extensions.  */
+#if @GNULIB_MKDIRAT@
+# if address@hidden@
+extern int mkdirat (int fd, char const *file, mode_t mode)
+     _GL_ARG_NONNULL ((2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mkdirat
+# define mkdirat(d,n,m)                         \
+    (GL_LINK_WARNING ("mkdirat is not portable - " \
+                      "use gnulib module openat for portability"), \
+     mkdirat (d, n, m))
+#endif
 
-#if @GNULIB_LCHMOD@
-/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
-   denotes a symbolic link.  */
-# if address@hidden@
-/* The lchmod replacement follows symbolic links.  Callers should take
-   this into account; lchmod should be applied only to arguments that
-   are known to not be symbolic links.  On hosts that lack lchmod,
-   this can lead to race conditions between the check and the
-   invocation of lchmod, but we know of no workarounds that are
-   reliable in general.  You might try requesting support for lchmod
-   from your operating system supplier.  */
-#  define lchmod chmod
+
+#if @GNULIB_MKFIFO@
+# if @REPLACE_MKFIFO@
+#  undef mkfifo
+#  define mkfifo rpl_mkfifo
 # endif
-# if 0 /* assume already declared */
-extern int lchmod (const char *filename, mode_t mode);
+# if address@hidden@ || @REPLACE_MKFIFO@
+extern int mkfifo (char const *file, mode_t mode) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
-# undef lchmod
-# define lchmod(f,m) \
-    (GL_LINK_WARNING ("lchmod is unportable - " \
-                      "use gnulib module lchmod for portability"), \
-     lchmod (f, m))
+# undef mkfifo
+# define mkfifo(n,m)                                                    \
+    (GL_LINK_WARNING ("mkfifo is not portable - "                       \
+                      "use gnulib module mkfifo for portability"),      \
+     mkfifo (n, m))
+#endif
+
+
+#if @GNULIB_MKFIFOAT@
+# if address@hidden@
+extern int mkfifoat (int fd, char const *file, mode_t mode)
+     _GL_ARG_NONNULL ((2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mkfifoat
+# define mkfifoat(d,n,m)                                     \
+    (GL_LINK_WARNING ("mkfifoat is not portable - " \
+                      "use gnulib module mkfifoat for portability"), \
+     mkfifoat (d, n, m))
+#endif
+
+
+#if @GNULIB_MKNOD@
+# if @REPLACE_MKNOD@
+#  undef mknod
+#  define mknod rpl_mknod
+# endif
+# if address@hidden@ || @REPLACE_MKNOD@
+extern int mknod (char const *file, mode_t mode, dev_t dev)
+     _GL_ARG_NONNULL ((1));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mknod
+# define mknod(n,m,d)                                                   \
+    (GL_LINK_WARNING ("mknod is not portable - "                        \
+                      "use gnulib module mknod for portability"),       \
+     mknod (n, m, d))
+#endif
+
+
+#if @GNULIB_MKNODAT@
+# if address@hidden@
+extern int mknodat (int fd, char const *file, mode_t mode, dev_t dev)
+     _GL_ARG_NONNULL ((2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mknodat
+# define mknodat(f,n,m,d)                            \
+    (GL_LINK_WARNING ("mknodat is not portable - " \
+                      "use gnulib module mkfifoat for portability"), \
+     mknodat (f, n, m, d))
+#endif
+
+
+#if @GNULIB_STAT@
+# if @REPLACE_STAT@
+/* We can't use the object-like #define stat rpl_stat, because of
+   struct stat.  This means that rpl_stat will not be used if the user
+   does (stat)(a,b).  Oh well.  */
+#  undef stat
+#  ifdef _LARGE_FILES
+    /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
+       so we have to replace stat64() instead of stat(). */
+#   define stat stat64
+#   undef stat64
+#   define stat64(name, st) rpl_stat (name, st)
+#  else /* !_LARGE_FILES */
+#   define stat(name, st) rpl_stat (name, st)
+#  endif /* !_LARGE_FILES */
+extern int stat (const char *name, struct stat *buf) _GL_ARG_NONNULL ((1, 2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef stat
+# define stat(p,b)                                                      \
+  (GL_LINK_WARNING ("stat is unportable - "                             \
+                    "use gnulib module stat for portability"),          \
+   stat (p, b))
+#endif
+
+
+#if @GNULIB_UTIMENSAT@
+# if @REPLACE_UTIMENSAT@
+#  undef utimensat
+#  define utimensat rpl_utimensat
+# endif
+# if address@hidden@ || @REPLACE_UTIMENSAT@
+   extern int utimensat (int fd, char const *name,
+                         struct timespec const times[2], int flag)
+        _GL_ARG_NONNULL ((2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef utimensat
+# define utimensat(d,n,t,f)                          \
+    (GL_LINK_WARNING ("utimensat is not portable - " \
+                      "use gnulib module utimensat for portability"), \
+     utimensat (d, n, t, f))
 #endif
 
 
diff --git a/gl/sys_time.in.h b/gl/sys_time.in.h
index 454078f..9fc23d5 100644
--- a/gl/sys_time.in.h
+++ b/gl/sys_time.in.h
@@ -1,6 +1,6 @@
 /* Provide a more complete sys/time.h.
 
-   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
@@ -39,6 +39,8 @@
 #  include <time.h>
 # endif
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -54,7 +56,8 @@ struct timeval
 # if @REPLACE_GETTIMEOFDAY@
 #  undef gettimeofday
 #  define gettimeofday rpl_gettimeofday
-int gettimeofday (struct timeval *restrict, void *restrict);
+extern int gettimeofday (struct timeval *restrict, void *restrict)
+     _GL_ARG_NONNULL ((1));
 # endif
 
 #ifdef __cplusplus
diff --git a/gl/time.in.h b/gl/time.in.h
index dec37e8..3578534 100644
--- a/gl/time.in.h
+++ b/gl/time.in.h
@@ -1,6 +1,6 @@
 /* A more-standard <time.h>.
 
-   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,6 +37,11 @@
 
 # @INCLUDE_NEXT@ @NEXT_TIME_H@
 
+/* NetBSD 5.0 mis-defines NULL.  */
+#include <stddef.h>
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 # ifdef __cplusplus
 extern "C" {
 # endif
@@ -63,7 +68,14 @@ struct timespec
    <http://www.opengroup.org/susv3xsh/nanosleep.html>.  */
 # if @REPLACE_NANOSLEEP@
 #  define nanosleep rpl_nanosleep
-int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp);
+extern int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp)
+     _GL_ARG_NONNULL ((1));
+# endif
+
+/* Return the 'time_t' representation of TP and normalize TP.  */
+# if @REPLACE_MKTIME@
+#  define mktime rpl_mktime
+extern time_t mktime (struct tm *__tp) _GL_ARG_NONNULL ((1));
 # endif
 
 /* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
@@ -74,10 +86,12 @@ int nanosleep (struct timespec const *__rqtp, struct 
timespec *__rmtp);
 #  define localtime_r rpl_localtime_r
 #  undef gmtime_r
 #  define gmtime_r rpl_gmtime_r
-struct tm *localtime_r (time_t const *restrict __timer,
-                       struct tm *restrict __result);
-struct tm *gmtime_r (time_t const *restrict __timer,
-                    struct tm *restrict __result);
+extern struct tm *localtime_r (time_t const *restrict __timer,
+                               struct tm *restrict __result)
+     _GL_ARG_NONNULL ((1, 2));
+extern struct tm *gmtime_r (time_t const *restrict __timer,
+                            struct tm *restrict __result)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 
 /* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
@@ -86,15 +100,17 @@ struct tm *gmtime_r (time_t const *restrict __timer,
 # if @REPLACE_STRPTIME@
 #  undef strptime
 #  define strptime rpl_strptime
-char *strptime (char const *restrict __buf, char const *restrict __format,
-               struct tm *restrict __tm);
+extern char *strptime (char const *restrict __buf,
+                       char const *restrict __format,
+                       struct tm *restrict __tm)
+     _GL_ARG_NONNULL ((1, 2, 3));
 # endif
 
 /* Convert TM to a time_t value, assuming UTC.  */
 # if @REPLACE_TIMEGM@
 #  undef timegm
 #  define timegm rpl_timegm
-time_t timegm (struct tm *__tm);
+extern time_t timegm (struct tm *__tm) _GL_ARG_NONNULL ((1));
 # endif
 
 /* Encourage applications to avoid unsafe functions that can overrun
diff --git a/gl/timegm.c b/gl/timegm.c
index 057f645..83a56bb 100644
--- a/gl/timegm.c
+++ b/gl/timegm.c
@@ -1,6 +1,6 @@
 /* Convert UTC calendar time to simple time.  Like mktime but assumes UTC.
 
-   Copyright (C) 1994, 1997, 2003, 2004, 2006, 2007 Free Software
+   Copyright (C) 1994, 1997, 2003, 2004, 2006, 2007, 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
@@ -27,9 +27,7 @@
 # undef __gmtime_r
 # define __gmtime_r gmtime_r
 # define __mktime_internal mktime_internal
-time_t __mktime_internal (struct tm *,
-                         struct tm * (*) (time_t const *, struct tm *),
-                         time_t *);
+# include "mktime-internal.h"
 #endif
 
 time_t
diff --git a/gl/timespec.h b/gl/timespec.h
index 3f51db8..3e4c3fc 100644
--- a/gl/timespec.h
+++ b/gl/timespec.h
@@ -1,6 +1,6 @@
 /* timespec -- System time interface
 
-   Copyright (C) 2000, 2002, 2004, 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2002, 2004, 2005, 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
@@ -26,8 +26,10 @@ static inline int
 timespec_cmp (struct timespec a, struct timespec b)
 {
   return (a.tv_sec < b.tv_sec ? -1
-         : a.tv_sec > b.tv_sec ? 1
-         : a.tv_nsec - b.tv_nsec);
+          : a.tv_sec > b.tv_sec ? 1
+          : a.tv_nsec < b.tv_nsec ? -1
+          : a.tv_nsec > b.tv_nsec ? 1
+          : 0);
 }
 
 void gettime (struct timespec *);
diff --git a/gl/unistd.in.h b/gl/unistd.in.h
index 09e9039..3e02850 100644
--- a/gl/unistd.in.h
+++ b/gl/unistd.in.h
@@ -29,63 +29,97 @@
 #ifndef _GL_UNISTD_H
 #define _GL_UNISTD_H
 
+/* NetBSD 5.0 mis-defines NULL.  Also get size_t.  */
+#include <stddef.h>
+
 /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>.  */
-#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET)
+/* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>.  */
+/* But avoid namespace pollution on glibc systems.  */
+#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
+     || (@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK)) \
+    && ! defined __GLIBC__
 # include <stdio.h>
 #endif
 
+/* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>.  */
+/* But avoid namespace pollution on glibc systems.  */
+#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__
+# include <fcntl.h>
+#endif
+
 /* mingw fails to declare _exit in <unistd.h>.  */
 /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>.  */
-#include <stdlib.h>
+/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>.  */
+/* But avoid namespace pollution on glibc systems.  */
+#ifndef __GLIBC__
+# include <stdlib.h>
+#endif
 
-#if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
+/* mingw declares getcwd in <io.h>, not in <unistd.h>.  */
+#if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \
+     && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
+# include <io.h>
+#endif
+
+#if ((@GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@)   \
+     || (@GNULIB_READLINK@ && (address@hidden@ || @REPLACE_READLINK@)) \
+     || (@GNULIB_READLINKAT@ && address@hidden@) \
+     || defined GNULIB_POSIXCHECK)
 /* Get ssize_t.  */
 # include <sys/types.h>
 #endif
 
+/* Get getopt(), optarg, optind, opterr, optopt.
+   But avoid namespace pollution on glibc systems.  */
+#if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined 
_GL_SYSTEM_GETOPT
+# include <getopt.h>
+#endif
+
 #if @GNULIB_GETHOSTNAME@
 /* Get all possible declarations of gethostname().  */
 # if @UNISTD_H_HAVE_WINSOCK2_H@
 #  include <winsock2.h>
 #  if !defined _GL_SYS_SOCKET_H
 #   undef socket
-#   define socket              socket_used_without_including_sys_socket_h
+#   define socket               socket_used_without_including_sys_socket_h
 #   undef connect
-#   define connect             connect_used_without_including_sys_socket_h
+#   define connect              connect_used_without_including_sys_socket_h
 #   undef accept
-#   define accept              accept_used_without_including_sys_socket_h
+#   define accept               accept_used_without_including_sys_socket_h
 #   undef bind
-#   define bind                        bind_used_without_including_sys_socket_h
+#   define bind                 bind_used_without_including_sys_socket_h
 #   undef getpeername
-#   define getpeername         getpeername_used_without_including_sys_socket_h
+#   define getpeername          getpeername_used_without_including_sys_socket_h
 #   undef getsockname
-#   define getsockname         getsockname_used_without_including_sys_socket_h
+#   define getsockname          getsockname_used_without_including_sys_socket_h
 #   undef getsockopt
-#   define getsockopt          getsockopt_used_without_including_sys_socket_h
+#   define getsockopt           getsockopt_used_without_including_sys_socket_h
 #   undef listen
-#   define listen              listen_used_without_including_sys_socket_h
+#   define listen               listen_used_without_including_sys_socket_h
 #   undef recv
-#   define recv                        recv_used_without_including_sys_socket_h
+#   define recv                 recv_used_without_including_sys_socket_h
 #   undef send
-#   define send                        send_used_without_including_sys_socket_h
+#   define send                 send_used_without_including_sys_socket_h
 #   undef recvfrom
-#   define recvfrom            recvfrom_used_without_including_sys_socket_h
+#   define recvfrom             recvfrom_used_without_including_sys_socket_h
 #   undef sendto
-#   define sendto              sendto_used_without_including_sys_socket_h
+#   define sendto               sendto_used_without_including_sys_socket_h
 #   undef setsockopt
-#   define setsockopt          setsockopt_used_without_including_sys_socket_h
+#   define setsockopt           setsockopt_used_without_including_sys_socket_h
 #   undef shutdown
-#   define shutdown            shutdown_used_without_including_sys_socket_h
+#   define shutdown             shutdown_used_without_including_sys_socket_h
 #  endif
 #  if !defined _GL_SYS_SELECT_H
 #   undef select
-#   define select              select_used_without_including_sys_select_h
+#   define select               select_used_without_including_sys_select_h
 #  endif
 # endif
 #endif
 
 /* The definition of GL_LINK_WARNING is copied here.  */
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 
 /* OS/2 EMX lacks these macros.  */
 #ifndef STDIN_FILENO
@@ -98,6 +132,15 @@
 # define STDERR_FILENO 2
 #endif
 
+/* Ensure *_OK macros exist.  */
+#ifndef F_OK
+# define F_OK 0
+# define X_OK 1
+# define W_OK 2
+# define R_OK 4
+#endif
+
+
 /* Declare overridden functions.  */
 
 #ifdef __cplusplus
@@ -107,18 +150,17 @@ 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
+extern int chown (const char *file, uid_t uid, gid_t gid)
+     _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef chown
@@ -137,7 +179,7 @@ extern int chown (const char *file, uid_t uid, gid_t gid);
 #  define close rpl_close
 extern int close (int);
 # endif
-#elif @UNISTD_H_HAVE_WINSOCK2_H@
+#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
 # undef close
 # define close close_used_without_requesting_gnulib_module_close
 #elif defined GNULIB_POSIXCHECK
@@ -149,6 +191,12 @@ extern int close (int);
 #endif
 
 
+#if @REPLACE_DUP@
+# define dup rpl_dup
+extern int dup (int);
+#endif
+
+
 #if @GNULIB_DUP2@
 # if @REPLACE_DUP2@
 #  define dup2 rpl_dup2
@@ -170,6 +218,28 @@ extern int dup2 (int oldfd, int newfd);
 #endif
 
 
+#if @GNULIB_DUP3@
+/* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
+   specified flags.
+   The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
+   and O_TEXT, O_BINARY (defined in "binary-io.h").
+   Close NEWFD first if it is open.
+   Return newfd if successful, otherwise -1 and errno set.
+   See the Linux man page at
+   <http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>.  */
+# if @HAVE_DUP3@
+#  define dup3 rpl_dup3
+# endif
+extern int dup3 (int oldfd, int newfd, int flags);
+#elif defined GNULIB_POSIXCHECK
+# undef dup3
+# define dup3(o,n,f) \
+    (GL_LINK_WARNING ("dup3 is unportable - " \
+                      "use gnulib module dup3 for portability"), \
+     dup3 (o, n, f))
+#endif
+
+
 #if @GNULIB_ENVIRON@
 # if address@hidden@
 /* Set of environment variables and values.  An array of strings of the form
@@ -192,9 +262,9 @@ extern char **environ;
 
 #if @GNULIB_EUIDACCESS@
 # if address@hidden@
-/* Like access(), except that is uses the effective user id and group id of
+/* Like access(), except that it uses the effective user id and group id of
    the current process.  */
-extern int euidaccess (const char *filename, int mode);
+extern int euidaccess (const char *filename, int mode) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef euidaccess
@@ -205,9 +275,22 @@ extern int euidaccess (const char *filename, int mode);
 #endif
 
 
+#if @GNULIB_FACCESSAT@
+# if address@hidden@
+extern int faccessat (int fd, char const *file, int mode, int flag)
+     _GL_ARG_NONNULL ((2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef faccessat
+# define faccessat(d,n,m,f)                         \
+    (GL_LINK_WARNING ("faccessat is not portable - " \
+                      "use gnulib module faccessat for portability"), \
+     faccessat (d, n, m, f))
+#endif
+
+
 #if @GNULIB_FCHDIR@
 # if @REPLACE_FCHDIR@
-
 /* Change the process' current working directory to the directory on which
    the given file descriptor is open.
    Return 0 if successful, otherwise -1 and errno set.
@@ -215,14 +298,12 @@ extern int euidaccess (const char *filename, int mode);
    <http://www.opengroup.org/susv3xsh/fchdir.html>.  */
 extern int fchdir (int /*fd*/);
 
-#  define dup rpl_dup
-extern int dup (int);
-
-#  if @REPLACE_DUP2@
-#   undef dup2
-#  endif
-#  define dup2 rpl_dup2_fchdir
-extern int dup2 (int, int);
+/* Gnulib internal hooks needed to maintain the fchdir metadata.  */
+extern int _gl_register_fd (int fd, const char *filename)
+     _GL_ARG_NONNULL ((2));
+extern void _gl_unregister_fd (int fd);
+extern int _gl_register_dup (int oldfd, int newfd);
+extern const char *_gl_directory_name (int fd);
 
 # endif
 #elif defined GNULIB_POSIXCHECK
@@ -234,6 +315,24 @@ extern int dup2 (int, int);
 #endif
 
 
+#if @GNULIB_FCHOWNAT@
+# if @REPLACE_FCHOWNAT@
+#  undef fchownat
+#  define fchownat rpl_fchownat
+# endif
+# if address@hidden@ || @REPLACE_FCHOWNAT@
+extern int fchownat (int fd, char const *file, uid_t owner, gid_t group, int 
flag)
+     _GL_ARG_NONNULL ((2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fchownat
+# define fchownat(d,n,o,g,f)                        \
+    (GL_LINK_WARNING ("fchownat is not portable - " \
+                      "use gnulib module openat for portability"), \
+     fchownat (d, n, o, g, f))
+#endif
+
+
 #if @GNULIB_FSYNC@
 /* Synchronize changes to a file.
    Return 0 if successful, otherwise -1 and errno set.
@@ -269,9 +368,6 @@ extern int ftruncate (int fd, off_t length);
 
 
 #if @GNULIB_GETCWD@
-/* Include the headers that might declare getcwd so that they will not
-   cause confusion if included after this file.  */
-# include <stdlib.h>
 # if @REPLACE_GETCWD@
 /* Get the name of the current working directory, and put it in SIZE bytes
    of BUF.
@@ -307,7 +403,7 @@ extern char * getcwd (char *buf, size_t size);
    If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
    Return 0 if successful, otherwise set errno and return -1.  */
 # if address@hidden@
-extern int getdomainname(char *name, size_t len);
+extern int getdomainname(char *name, size_t len) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getdomainname
@@ -320,7 +416,8 @@ extern int getdomainname(char *name, size_t len);
 
 #if @GNULIB_GETDTABLESIZE@
 # if address@hidden@
-/* Return the maximum number of file descriptors in the current process.  */
+/* Return the maximum number of file descriptors in the current process.
+   In POSIX, this is same as sysconf (_SC_OPEN_MAX).  */
 extern int getdtablesize (void);
 # endif
 #elif defined GNULIB_POSIXCHECK
@@ -332,6 +429,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.
@@ -345,7 +464,7 @@ extern int getdtablesize (void);
 #  define gethostname rpl_gethostname
 # endif
 # if @UNISTD_H_HAVE_WINSOCK2_H@ || address@hidden@
-extern int gethostname(char *name, size_t len);
+extern int gethostname(char *name, size_t len) _GL_ARG_NONNULL ((1));
 # endif
 #elif @UNISTD_H_HAVE_WINSOCK2_H@
 # undef gethostname
@@ -370,8 +489,7 @@ extern int gethostname(char *name, size_t len);
    See <http://www.opengroup.org/susv3xsh/getlogin.html>.
  */
 # if address@hidden@
-#  include <stddef.h>
-extern int getlogin_r (char *name, size_t size);
+extern int getlogin_r (char *name, size_t size) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getlogin_r
@@ -472,13 +590,17 @@ 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);
+extern int lchown (char const *file, uid_t owner, gid_t group)
+     _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef lchown
@@ -490,12 +612,16 @@ extern int lchown (char const *file, uid_t owner, gid_t 
group);
 
 
 #if @GNULIB_LINK@
+# if @REPLACE_LINK@
+#  define link rpl_link
+# endif
 /* Create a new hard link for an existing file.
    Return 0 if successful, otherwise -1 and errno set.
    See POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/link.html>.  */
-# if address@hidden@
-extern int link (const char *path1, const char *path2);
+# if address@hidden@ || @REPLACE_LINK@
+extern int link (const char *path1, const char *path2)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef link
@@ -505,6 +631,26 @@ extern int link (const char *path1, const char *path2);
      link (path1, path2))
 #endif
 
+#if @GNULIB_LINKAT@
+# if @REPLACE_LINKAT@
+#  undef linkat
+#  define linkat rpl_linkat
+# endif
+/* Create a new hard link for an existing file, relative to two
+   directories.  FLAG controls whether symlinks are followed.
+   Return 0 if successful, otherwise -1 and errno set.  */
+# if address@hidden@ || @REPLACE_LINKAT@
+extern int linkat (int fd1, const char *path1, int fd2, const char *path2,
+                   int flag)
+     _GL_ARG_NONNULL ((2, 4));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef linkat
+# define link(f1,path1,f2,path2,f)              \
+    (GL_LINK_WARNING ("linkat is unportable - " \
+                      "use gnulib module linkat for portability"), \
+     linkat (f1, path1, f2, path2,f))
+#endif
 
 #if @GNULIB_LSEEK@
 # if @REPLACE_LSEEK@
@@ -524,15 +670,61 @@ extern int link (const char *path1, const char *path2);
 #endif
 
 
+#if @GNULIB_PIPE2@
+/* Create a pipe, applying the given flags when opening the read-end of the
+   pipe and the write-end of the pipe.
+   The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
+   and O_TEXT, O_BINARY (defined in "binary-io.h").
+   Store the read-end as fd[0] and the write-end as fd[1].
+   Return 0 upon success, or -1 with errno set upon failure.
+   See also the Linux man page at
+   <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>.  */
+# if @HAVE_PIPE2@
+#  define pipe2 rpl_pipe2
+# endif
+extern int pipe2 (int fd[2], int flags) _GL_ARG_NONNULL ((1));
+#elif defined GNULIB_POSIXCHECK
+# undef pipe2
+# define pipe2(f,o) \
+    (GL_LINK_WARNING ("pipe2 is unportable - " \
+                      "use gnulib module pipe2 for portability"), \
+     pipe2 (f, o))
+#endif
+
+
+#if @GNULIB_PREAD@
+# if @REPLACE_PREAD@
+#  define pread rpl_pread
+# endif
+/* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
+   Return the number of bytes placed into BUF if successful, otherwise
+   set errno and return -1.  0 indicates EOF.  See the POSIX:2001
+   specification <http://www.opengroup.org/susv3xsh/pread.html>.  */
+# if address@hidden@ || @REPLACE_PREAD@
+  extern ssize_t pread (int fd, void *buf, size_t bufsize, off_t offset)
+       _GL_ARG_NONNULL ((2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pread
+# define pread(f,b,s,o)                        \
+    (GL_LINK_WARNING ("pread is unportable - " \
+                      "use gnulib module pread for portability"), \
+     pread (f, b, s, o))
+#endif
+
+
 #if @GNULIB_READLINK@
+# if @REPLACE_READLINK@
+#  define readlink rpl_readlink
+# endif
 /* Read the contents of the symbolic link FILE and place the first BUFSIZE
    bytes of it into BUF.  Return the number of bytes placed into BUF if
    successful, otherwise -1 and errno set.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/readlink.html>.  */
-# if address@hidden@
-#  include <stddef.h>
-extern int readlink (const char *file, char *buf, size_t bufsize);
+# if address@hidden@ || @REPLACE_READLINK@
+extern ssize_t readlink (const char *file, char *buf, size_t bufsize)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef readlink
@@ -543,12 +735,45 @@ extern int readlink (const char *file, char *buf, size_t 
bufsize);
 #endif
 
 
+#if @GNULIB_READLINKAT@
+# if address@hidden@
+extern ssize_t readlinkat (int fd, char const *file, char *buf, size_t len)
+     _GL_ARG_NONNULL ((2, 3));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef readlinkat
+# define readlinkat(d,n,b,l)                         \
+    (GL_LINK_WARNING ("readlinkat is not portable - " \
+                      "use gnulib module symlinkat for portability"), \
+     readlinkat (d, n, b, l))
+#endif
+
+
+#if @GNULIB_RMDIR@
+# if @REPLACE_RMDIR@
+#  define rmdir rpl_rmdir
+/* Remove the directory DIR.  */
+extern int rmdir (char const *name) _GL_ARG_NONNULL ((1));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef rmdir
+# define rmdir(n) \
+    (GL_LINK_WARNING ("rmdir is unportable - " \
+                      "use gnulib module rmdir for portability"), \
+     rmdir (n))
+#endif
+
+
 #if @GNULIB_SLEEP@
+# if @REPLACE_SLEEP@
+#  undef sleep
+#  define sleep rpl_sleep
+# endif
 /* Pause the execution of the current thread for N seconds.
    Returns the number of seconds left to sleep.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/sleep.html>.  */
-# if address@hidden@
+# if address@hidden@ || @REPLACE_SLEEP@
 extern unsigned int sleep (unsigned int n);
 # endif
 #elif defined GNULIB_POSIXCHECK
@@ -560,19 +785,99 @@ extern unsigned int sleep (unsigned int n);
 #endif
 
 
+#if @GNULIB_SYMLINK@
+# if @REPLACE_SYMLINK@
+#  undef symlink
+#  define symlink rpl_symlink
+# endif
+# if address@hidden@ || @REPLACE_SYMLINK@
+extern int symlink (char const *contents, char const *file)
+     _GL_ARG_NONNULL ((1, 2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef symlink
+# define symlink(c,n)                        \
+    (GL_LINK_WARNING ("symlink is not portable - " \
+                      "use gnulib module symlink for portability"), \
+     symlink (c, n))
+#endif
+
+
+#if @GNULIB_SYMLINKAT@
+# if address@hidden@
+extern int symlinkat (char const *contents, int fd, char const *file)
+     _GL_ARG_NONNULL ((1, 3));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef symlinkat
+# define symlinkat(c,d,n)                            \
+    (GL_LINK_WARNING ("symlinkat is not portable - " \
+                      "use gnulib module symlinkat for portability"), \
+     symlinkat (c, d, n))
+#endif
+
+
+#if @GNULIB_UNLINK@
+# if @REPLACE_UNLINK@
+#  undef unlink
+#  define unlink rpl_unlink
+extern int unlink (char const *file) _GL_ARG_NONNULL ((1));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef unlink
+# define unlink(n)                         \
+    (GL_LINK_WARNING ("unlink is not portable - " \
+                      "use gnulib module unlink for portability"), \
+     unlink (n))
+#endif
+
+
+#if @GNULIB_UNLINKAT@
+# if @REPLACE_UNLINKAT@
+#  undef unlinkat
+#  define unlinkat rpl_unlinkat
+# endif
+# if address@hidden@ || @REPLACE_UNLINKAT@
+extern int unlinkat (int fd, char const *file, int flag) _GL_ARG_NONNULL ((2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef unlinkat
+# define unlinkat(d,n,f)                         \
+    (GL_LINK_WARNING ("unlinkat is not portable - " \
+                      "use gnulib module openat for portability"), \
+     unlinkat (d, n, f))
+#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
    <http://www.opengroup.org/susv3xsh/write.html>.  */
 # undef write
 # define write rpl_write
-extern ssize_t write (int fd, const void *buf, size_t count);
-#endif
-
-
-#ifdef FCHDIR_REPLACEMENT
-/* gnulib internal function.  */
-extern void _gl_unregister_fd (int fd);
+extern ssize_t write (int fd, const void *buf, size_t count)
+     _GL_ARG_NONNULL ((2));
 #endif
 
 
diff --git a/gl/unsetenv.c b/gl/unsetenv.c
index 73ea878..89ce64b 100644
--- a/gl/unsetenv.c
+++ b/gl/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
@@ -16,6 +16,10 @@
 
 #include <config.h>
 
+/* Don't use __attribute__ __nonnull__ in this compilation unit.  Otherwise gcc
+   optimizes away the name == NULL test below.  */
+#define _GL_ARG_NONNULL(params)
+
 /* Specification.  */
 #include <stdlib.h>
 
@@ -28,15 +32,15 @@
 #include <unistd.h>
 
 #if !_LIBC
-# define __environ     environ
+# define __environ      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)
+# define LOCK   __libc_lock_lock (envlock)
+# define UNLOCK __libc_lock_unlock (envlock)
 #else
 # define LOCK
 # define UNLOCK
@@ -47,6 +51,7 @@ __libc_lock_define_initialized (static, envlock)
 # define unsetenv __unsetenv
 #endif
 
+#if _LIBC || !HAVE_UNSETENV
 
 int
 unsetenv (const char *name)
@@ -68,13 +73,13 @@ unsetenv (const char *name)
   while (*ep != NULL)
     if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
       {
-       /* Found it.  Remove this pointer by moving later ones back.  */
-       char **dp = ep;
+        /* 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.  */
+        do
+          dp[0] = dp[1];
+        while (*dp++);
+        /* Continue the loop in case NAME appears again.  */
       }
     else
       ++ep;
@@ -88,3 +93,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/gl/vasnprintf.c b/gl/vasnprintf.c
index 7ac9f43..c28d203 100644
--- a/gl/vasnprintf.c
+++ b/gl/vasnprintf.c
@@ -67,13 +67,13 @@
 # endif
 #endif
 
-#include <locale.h>    /* localeconv() */
-#include <stdio.h>     /* snprintf(), sprintf() */
-#include <stdlib.h>    /* abort(), malloc(), realloc(), free() */
-#include <string.h>    /* memcpy(), strlen() */
-#include <errno.h>     /* errno */
-#include <limits.h>    /* CHAR_BIT */
-#include <float.h>     /* DBL_MAX_EXP, LDBL_MAX_EXP */
+#include <locale.h>     /* localeconv() */
+#include <stdio.h>      /* snprintf(), sprintf() */
+#include <stdlib.h>     /* abort(), malloc(), realloc(), free() */
+#include <string.h>     /* memcpy(), strlen() */
+#include <errno.h>      /* errno */
+#include <limits.h>     /* CHAR_BIT */
+#include <float.h>      /* DBL_MAX_EXP, LDBL_MAX_EXP */
 #if HAVE_NL_LANGINFO
 # include <langinfo.h>
 #endif
@@ -257,14 +257,14 @@ local_wcsnlen (const wchar_t *s, size_t maxlen)
 # ifndef decimal_point_char_defined
 #  define decimal_point_char_defined 1
 static char
-decimal_point_char ()
+decimal_point_char (void)
 {
   const char *point;
   /* Determine it in a multithread-safe way.  We know nl_langinfo is
-     multithread-safe on glibc systems, but is not required to be multithread-
-     safe by POSIX.  sprintf(), however, is multithread-safe.  localeconv()
-     is rarely multithread-safe.  */
-#  if HAVE_NL_LANGINFO && __GLIBC__
+     multithread-safe on glibc systems and MacOS X systems, but is not required
+     to be multithread-safe by POSIX.  sprintf(), however, is multithread-safe.
+     localeconv() is rarely multithread-safe.  */
+#  if HAVE_NL_LANGINFO && (__GLIBC__ || (defined __APPLE__ && defined 
__MACH__))
   point = nl_langinfo (RADIXCHAR);
 #  elif 1
   char pointbuf[5];
@@ -364,26 +364,26 @@ multiply (mpn_t src1, mpn_t src2, mpn_t *dest)
       dlen = len1 + len2;
       dp = (mp_limb_t *) malloc (dlen * sizeof (mp_limb_t));
       if (dp == NULL)
-       return NULL;
+        return NULL;
       for (k = len2; k > 0; )
-       dp[--k] = 0;
+        dp[--k] = 0;
       for (i = 0; i < len1; i++)
-       {
-         mp_limb_t digit1 = p1[i];
-         mp_twolimb_t carry = 0;
-         for (j = 0; j < len2; j++)
-           {
-             mp_limb_t digit2 = p2[j];
-             carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
-             carry += dp[i + j];
-             dp[i + j] = (mp_limb_t) carry;
-             carry = carry >> GMP_LIMB_BITS;
-           }
-         dp[i + len2] = (mp_limb_t) carry;
-       }
+        {
+          mp_limb_t digit1 = p1[i];
+          mp_twolimb_t carry = 0;
+          for (j = 0; j < len2; j++)
+            {
+              mp_limb_t digit2 = p2[j];
+              carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
+              carry += dp[i + j];
+              dp[i + j] = (mp_limb_t) carry;
+              carry = carry >> GMP_LIMB_BITS;
+            }
+          dp[i + len2] = (mp_limb_t) carry;
+        }
       /* Normalise.  */
       while (dlen > 0 && dp[dlen - 1] == 0)
-       dlen--;
+        dlen--;
       dest->nlimbs = dlen;
       dest->limbs = dp;
     }
@@ -477,12 +477,12 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
   for (;;)
     {
       if (b_len == 0)
-       /* Division by zero.  */
-       abort ();
+        /* Division by zero.  */
+        abort ();
       if (b_ptr[b_len - 1] == 0)
-       b_len--;
+        b_len--;
       else
-       break;
+        break;
     }
 
   /* Here m = a_len >= 0 and n = b_len > 0.  */
@@ -499,261 +499,261 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
   else if (b_len == 1)
     {
       /* n=1: single precision division.
-        beta^(m-1) <= a < beta^m  ==>  beta^(m-2) <= a/b < beta^m  */
+         beta^(m-1) <= a < beta^m  ==>  beta^(m-2) <= a/b < beta^m  */
       r_ptr = roomptr;
       q_ptr = roomptr + 1;
       {
-       mp_limb_t den = b_ptr[0];
-       mp_limb_t remainder = 0;
-       const mp_limb_t *sourceptr = a_ptr + a_len;
-       mp_limb_t *destptr = q_ptr + a_len;
-       size_t count;
-       for (count = a_len; count > 0; count--)
-         {
-           mp_twolimb_t num =
-             ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--sourceptr;
-           *--destptr = num / den;
-           remainder = num % den;
-         }
-       /* Normalise and store r.  */
-       if (remainder > 0)
-         {
-           r_ptr[0] = remainder;
-           r_len = 1;
-         }
-       else
-         r_len = 0;
-       /* Normalise q.  */
-       q_len = a_len;
-       if (q_ptr[q_len - 1] == 0)
-         q_len--;
+        mp_limb_t den = b_ptr[0];
+        mp_limb_t remainder = 0;
+        const mp_limb_t *sourceptr = a_ptr + a_len;
+        mp_limb_t *destptr = q_ptr + a_len;
+        size_t count;
+        for (count = a_len; count > 0; count--)
+          {
+            mp_twolimb_t num =
+              ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--sourceptr;
+            *--destptr = num / den;
+            remainder = num % den;
+          }
+        /* Normalise and store r.  */
+        if (remainder > 0)
+          {
+            r_ptr[0] = remainder;
+            r_len = 1;
+          }
+        else
+          r_len = 0;
+        /* Normalise q.  */
+        q_len = a_len;
+        if (q_ptr[q_len - 1] == 0)
+          q_len--;
       }
     }
   else
     {
       /* n>1: multiple precision division.
-        beta^(m-1) <= a < beta^m, beta^(n-1) <= b < beta^n  ==>
-        beta^(m-n-1) <= a/b < beta^(m-n+1).  */
+         beta^(m-1) <= a < beta^m, beta^(n-1) <= b < beta^n  ==>
+         beta^(m-n-1) <= a/b < beta^(m-n+1).  */
       /* Determine s.  */
       size_t s;
       {
-       mp_limb_t msd = b_ptr[b_len - 1]; /* = b[n-1], > 0 */
-       s = 31;
-       if (msd >= 0x10000)
-         {
-           msd = msd >> 16;
-           s -= 16;
-         }
-       if (msd >= 0x100)
-         {
-           msd = msd >> 8;
-           s -= 8;
-         }
-       if (msd >= 0x10)
-         {
-           msd = msd >> 4;
-           s -= 4;
-         }
-       if (msd >= 0x4)
-         {
-           msd = msd >> 2;
-           s -= 2;
-         }
-       if (msd >= 0x2)
-         {
-           msd = msd >> 1;
-           s -= 1;
-         }
+        mp_limb_t msd = b_ptr[b_len - 1]; /* = b[n-1], > 0 */
+        s = 31;
+        if (msd >= 0x10000)
+          {
+            msd = msd >> 16;
+            s -= 16;
+          }
+        if (msd >= 0x100)
+          {
+            msd = msd >> 8;
+            s -= 8;
+          }
+        if (msd >= 0x10)
+          {
+            msd = msd >> 4;
+            s -= 4;
+          }
+        if (msd >= 0x4)
+          {
+            msd = msd >> 2;
+            s -= 2;
+          }
+        if (msd >= 0x2)
+          {
+            msd = msd >> 1;
+            s -= 1;
+          }
       }
       /* 0 <= s < GMP_LIMB_BITS.
-        Copy b, shifting it left by s bits.  */
+         Copy b, shifting it left by s bits.  */
       if (s > 0)
-       {
-         tmp_roomptr = (mp_limb_t *) malloc (b_len * sizeof (mp_limb_t));
-         if (tmp_roomptr == NULL)
-           {
-             free (roomptr);
-             return NULL;
-           }
-         {
-           const mp_limb_t *sourceptr = b_ptr;
-           mp_limb_t *destptr = tmp_roomptr;
-           mp_twolimb_t accu = 0;
-           size_t count;
-           for (count = b_len; count > 0; count--)
-             {
-               accu += (mp_twolimb_t) *sourceptr++ << s;
-               *destptr++ = (mp_limb_t) accu;
-               accu = accu >> GMP_LIMB_BITS;
-             }
-           /* accu must be zero, since that was how s was determined.  */
-           if (accu != 0)
-             abort ();
-         }
-         b_ptr = tmp_roomptr;
-       }
+        {
+          tmp_roomptr = (mp_limb_t *) malloc (b_len * sizeof (mp_limb_t));
+          if (tmp_roomptr == NULL)
+            {
+              free (roomptr);
+              return NULL;
+            }
+          {
+            const mp_limb_t *sourceptr = b_ptr;
+            mp_limb_t *destptr = tmp_roomptr;
+            mp_twolimb_t accu = 0;
+            size_t count;
+            for (count = b_len; count > 0; count--)
+              {
+                accu += (mp_twolimb_t) *sourceptr++ << s;
+                *destptr++ = (mp_limb_t) accu;
+                accu = accu >> GMP_LIMB_BITS;
+              }
+            /* accu must be zero, since that was how s was determined.  */
+            if (accu != 0)
+              abort ();
+          }
+          b_ptr = tmp_roomptr;
+        }
       /* Copy a, shifting it left by s bits, yields r.
-        Memory layout:
-        At the beginning: r = roomptr[0..a_len],
-        at the end: r = roomptr[0..b_len-1], q = roomptr[b_len..a_len]  */
+         Memory layout:
+         At the beginning: r = roomptr[0..a_len],
+         at the end: r = roomptr[0..b_len-1], q = roomptr[b_len..a_len]  */
       r_ptr = roomptr;
       if (s == 0)
-       {
-         memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t));
-         r_ptr[a_len] = 0;
-       }
+        {
+          memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t));
+          r_ptr[a_len] = 0;
+        }
       else
-       {
-         const mp_limb_t *sourceptr = a_ptr;
-         mp_limb_t *destptr = r_ptr;
-         mp_twolimb_t accu = 0;
-         size_t count;
-         for (count = a_len; count > 0; count--)
-           {
-             accu += (mp_twolimb_t) *sourceptr++ << s;
-             *destptr++ = (mp_limb_t) accu;
-             accu = accu >> GMP_LIMB_BITS;
-           }
-         *destptr++ = (mp_limb_t) accu;
-       }
+        {
+          const mp_limb_t *sourceptr = a_ptr;
+          mp_limb_t *destptr = r_ptr;
+          mp_twolimb_t accu = 0;
+          size_t count;
+          for (count = a_len; count > 0; count--)
+            {
+              accu += (mp_twolimb_t) *sourceptr++ << s;
+              *destptr++ = (mp_limb_t) accu;
+              accu = accu >> GMP_LIMB_BITS;
+            }
+          *destptr++ = (mp_limb_t) accu;
+        }
       q_ptr = roomptr + b_len;
       q_len = a_len - b_len + 1; /* q will have m-n+1 limbs */
       {
-       size_t j = a_len - b_len; /* m-n */
-       mp_limb_t b_msd = b_ptr[b_len - 1]; /* b[n-1] */
-       mp_limb_t b_2msd = b_ptr[b_len - 2]; /* b[n-2] */
-       mp_twolimb_t b_msdd = /* b[n-1]*beta+b[n-2] */
-         ((mp_twolimb_t) b_msd << GMP_LIMB_BITS) | b_2msd;
-       /* Division loop, traversed m-n+1 times.
-          j counts down, b is unchanged, beta/2 <= b[n-1] < beta.  */
-       for (;;)
-         {
-           mp_limb_t q_star;
-           mp_limb_t c1;
-           if (r_ptr[j + b_len] < b_msd) /* r[j+n] < b[n-1] ? */
-             {
-               /* Divide r[j+n]*beta+r[j+n-1] by b[n-1], no overflow.  */
-               mp_twolimb_t num =
-                 ((mp_twolimb_t) r_ptr[j + b_len] << GMP_LIMB_BITS)
-                 | r_ptr[j + b_len - 1];
-               q_star = num / b_msd;
-               c1 = num % b_msd;
-             }
-           else
-             {
-               /* Overflow, hence r[j+n]*beta+r[j+n-1] >= beta*b[n-1].  */
-               q_star = (mp_limb_t)~(mp_limb_t)0; /* q* = beta-1 */
-               /* Test whether r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] >= beta
-                  <==> r[j+n]*beta+r[j+n-1] + b[n-1] >= beta*b[n-1]+beta
-                  <==> b[n-1] < floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta)
-                       {<= beta !}.
-                  If yes, jump directly to the subtraction loop.
-                  (Otherwise, r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] < beta
-                   <==> floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) = b[n-1] ) */
-               if (r_ptr[j + b_len] > b_msd
-                   || (c1 = r_ptr[j + b_len - 1] + b_msd) < b_msd)
-                 /* r[j+n] >= b[n-1]+1 or
-                    r[j+n] = b[n-1] and the addition r[j+n-1]+b[n-1] gives a
-                    carry.  */
-                 goto subtract;
-             }
-           /* q_star = q*,
-              c1 = (r[j+n]*beta+r[j+n-1]) - q* * b[n-1] (>=0, <beta).  */
-           {
-             mp_twolimb_t c2 = /* c1*beta+r[j+n-2] */
-               ((mp_twolimb_t) c1 << GMP_LIMB_BITS) | r_ptr[j + b_len - 2];
-             mp_twolimb_t c3 = /* b[n-2] * q* */
-               (mp_twolimb_t) b_2msd * (mp_twolimb_t) q_star;
-             /* While c2 < c3, increase c2 and decrease c3.
-                Consider c3-c2.  While it is > 0, decrease it by
-                b[n-1]*beta+b[n-2].  Because of b[n-1]*beta+b[n-2] >= beta^2/2
-                this can happen only twice.  */
-             if (c3 > c2)
-               {
-                 q_star = q_star - 1; /* q* := q* - 1 */
-                 if (c3 - c2 > b_msdd)
-                   q_star = q_star - 1; /* q* := q* - 1 */
-               }
-           }
-           if (q_star > 0)
-             subtract:
-             {
-               /* Subtract r := r - b * q* * beta^j.  */
-               mp_limb_t cr;
-               {
-                 const mp_limb_t *sourceptr = b_ptr;
-                 mp_limb_t *destptr = r_ptr + j;
-                 mp_twolimb_t carry = 0;
-                 size_t count;
-                 for (count = b_len; count > 0; count--)
-                   {
-                     /* Here 0 <= carry <= q*.  */
-                     carry =
-                       carry
-                       + (mp_twolimb_t) q_star * (mp_twolimb_t) *sourceptr++
-                       + (mp_limb_t) ~(*destptr);
-                     /* Here 0 <= carry <= beta*q* + beta-1.  */
-                     *destptr++ = ~(mp_limb_t) carry;
-                     carry = carry >> GMP_LIMB_BITS; /* <= q* */
-                   }
-                 cr = (mp_limb_t) carry;
-               }
-               /* Subtract cr from r_ptr[j + b_len], then forget about
-                  r_ptr[j + b_len].  */
-               if (cr > r_ptr[j + b_len])
-                 {
-                   /* Subtraction gave a carry.  */
-                   q_star = q_star - 1; /* q* := q* - 1 */
-                   /* Add b back.  */
-                   {
-                     const mp_limb_t *sourceptr = b_ptr;
-                     mp_limb_t *destptr = r_ptr + j;
-                     mp_limb_t carry = 0;
-                     size_t count;
-                     for (count = b_len; count > 0; count--)
-                       {
-                         mp_limb_t source1 = *sourceptr++;
-                         mp_limb_t source2 = *destptr;
-                         *destptr++ = source1 + source2 + carry;
-                         carry =
-                           (carry
-                            ? source1 >= (mp_limb_t) ~source2
-                            : source1 > (mp_limb_t) ~source2);
-                       }
-                   }
-                   /* Forget about the carry and about r[j+n].  */
-                 }
-             }
-           /* q* is determined.  Store it as q[j].  */
-           q_ptr[j] = q_star;
-           if (j == 0)
-             break;
-           j--;
-         }
+        size_t j = a_len - b_len; /* m-n */
+        mp_limb_t b_msd = b_ptr[b_len - 1]; /* b[n-1] */
+        mp_limb_t b_2msd = b_ptr[b_len - 2]; /* b[n-2] */
+        mp_twolimb_t b_msdd = /* b[n-1]*beta+b[n-2] */
+          ((mp_twolimb_t) b_msd << GMP_LIMB_BITS) | b_2msd;
+        /* Division loop, traversed m-n+1 times.
+           j counts down, b is unchanged, beta/2 <= b[n-1] < beta.  */
+        for (;;)
+          {
+            mp_limb_t q_star;
+            mp_limb_t c1;
+            if (r_ptr[j + b_len] < b_msd) /* r[j+n] < b[n-1] ? */
+              {
+                /* Divide r[j+n]*beta+r[j+n-1] by b[n-1], no overflow.  */
+                mp_twolimb_t num =
+                  ((mp_twolimb_t) r_ptr[j + b_len] << GMP_LIMB_BITS)
+                  | r_ptr[j + b_len - 1];
+                q_star = num / b_msd;
+                c1 = num % b_msd;
+              }
+            else
+              {
+                /* Overflow, hence r[j+n]*beta+r[j+n-1] >= beta*b[n-1].  */
+                q_star = (mp_limb_t)~(mp_limb_t)0; /* q* = beta-1 */
+                /* Test whether r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] >= beta
+                   <==> r[j+n]*beta+r[j+n-1] + b[n-1] >= beta*b[n-1]+beta
+                   <==> b[n-1] < floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta)
+                        {<= beta !}.
+                   If yes, jump directly to the subtraction loop.
+                   (Otherwise, r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] < beta
+                    <==> floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) = b[n-1] ) 
*/
+                if (r_ptr[j + b_len] > b_msd
+                    || (c1 = r_ptr[j + b_len - 1] + b_msd) < b_msd)
+                  /* r[j+n] >= b[n-1]+1 or
+                     r[j+n] = b[n-1] and the addition r[j+n-1]+b[n-1] gives a
+                     carry.  */
+                  goto subtract;
+              }
+            /* q_star = q*,
+               c1 = (r[j+n]*beta+r[j+n-1]) - q* * b[n-1] (>=0, <beta).  */
+            {
+              mp_twolimb_t c2 = /* c1*beta+r[j+n-2] */
+                ((mp_twolimb_t) c1 << GMP_LIMB_BITS) | r_ptr[j + b_len - 2];
+              mp_twolimb_t c3 = /* b[n-2] * q* */
+                (mp_twolimb_t) b_2msd * (mp_twolimb_t) q_star;
+              /* While c2 < c3, increase c2 and decrease c3.
+                 Consider c3-c2.  While it is > 0, decrease it by
+                 b[n-1]*beta+b[n-2].  Because of b[n-1]*beta+b[n-2] >= beta^2/2
+                 this can happen only twice.  */
+              if (c3 > c2)
+                {
+                  q_star = q_star - 1; /* q* := q* - 1 */
+                  if (c3 - c2 > b_msdd)
+                    q_star = q_star - 1; /* q* := q* - 1 */
+                }
+            }
+            if (q_star > 0)
+              subtract:
+              {
+                /* Subtract r := r - b * q* * beta^j.  */
+                mp_limb_t cr;
+                {
+                  const mp_limb_t *sourceptr = b_ptr;
+                  mp_limb_t *destptr = r_ptr + j;
+                  mp_twolimb_t carry = 0;
+                  size_t count;
+                  for (count = b_len; count > 0; count--)
+                    {
+                      /* Here 0 <= carry <= q*.  */
+                      carry =
+                        carry
+                        + (mp_twolimb_t) q_star * (mp_twolimb_t) *sourceptr++
+                        + (mp_limb_t) ~(*destptr);
+                      /* Here 0 <= carry <= beta*q* + beta-1.  */
+                      *destptr++ = ~(mp_limb_t) carry;
+                      carry = carry >> GMP_LIMB_BITS; /* <= q* */
+                    }
+                  cr = (mp_limb_t) carry;
+                }
+                /* Subtract cr from r_ptr[j + b_len], then forget about
+                   r_ptr[j + b_len].  */
+                if (cr > r_ptr[j + b_len])
+                  {
+                    /* Subtraction gave a carry.  */
+                    q_star = q_star - 1; /* q* := q* - 1 */
+                    /* Add b back.  */
+                    {
+                      const mp_limb_t *sourceptr = b_ptr;
+                      mp_limb_t *destptr = r_ptr + j;
+                      mp_limb_t carry = 0;
+                      size_t count;
+                      for (count = b_len; count > 0; count--)
+                        {
+                          mp_limb_t source1 = *sourceptr++;
+                          mp_limb_t source2 = *destptr;
+                          *destptr++ = source1 + source2 + carry;
+                          carry =
+                            (carry
+                             ? source1 >= (mp_limb_t) ~source2
+                             : source1 > (mp_limb_t) ~source2);
+                        }
+                    }
+                    /* Forget about the carry and about r[j+n].  */
+                  }
+              }
+            /* q* is determined.  Store it as q[j].  */
+            q_ptr[j] = q_star;
+            if (j == 0)
+              break;
+            j--;
+          }
       }
       r_len = b_len;
       /* Normalise q.  */
       if (q_ptr[q_len - 1] == 0)
-       q_len--;
+        q_len--;
 # if 0 /* Not needed here, since we need r only to compare it with b/2, and
-         b is shifted left by s bits.  */
+          b is shifted left by s bits.  */
       /* Shift r right by s bits.  */
       if (s > 0)
-       {
-         mp_limb_t ptr = r_ptr + r_len;
-         mp_twolimb_t accu = 0;
-         size_t count;
-         for (count = r_len; count > 0; count--)
-           {
-             accu = (mp_twolimb_t) (mp_limb_t) accu << GMP_LIMB_BITS;
-             accu += (mp_twolimb_t) *--ptr << (GMP_LIMB_BITS - s);
-             *ptr = (mp_limb_t) (accu >> GMP_LIMB_BITS);
-           }
-       }
+        {
+          mp_limb_t ptr = r_ptr + r_len;
+          mp_twolimb_t accu = 0;
+          size_t count;
+          for (count = r_len; count > 0; count--)
+            {
+              accu = (mp_twolimb_t) (mp_limb_t) accu << GMP_LIMB_BITS;
+              accu += (mp_twolimb_t) *--ptr << (GMP_LIMB_BITS - s);
+              *ptr = (mp_limb_t) (accu >> GMP_LIMB_BITS);
+            }
+        }
 # endif
       /* Normalise r.  */
       while (r_len > 0 && r_ptr[r_len - 1] == 0)
-       r_len--;
+        r_len--;
     }
   /* Compare r << 1 with b.  */
   if (r_len > b_len)
@@ -762,17 +762,17 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
     size_t i;
     for (i = b_len;;)
       {
-       mp_limb_t r_i =
-         (i <= r_len && i > 0 ? r_ptr[i - 1] >> (GMP_LIMB_BITS - 1) : 0)
-         | (i < r_len ? r_ptr[i] << 1 : 0);
-       mp_limb_t b_i = (i < b_len ? b_ptr[i] : 0);
-       if (r_i > b_i)
-         goto increment_q;
-       if (r_i < b_i)
-         goto keep_q;
-       if (i == 0)
-         break;
-       i--;
+        mp_limb_t r_i =
+          (i <= r_len && i > 0 ? r_ptr[i - 1] >> (GMP_LIMB_BITS - 1) : 0)
+          | (i < r_len ? r_ptr[i] << 1 : 0);
+        mp_limb_t b_i = (i < b_len ? b_ptr[i] : 0);
+        if (r_i > b_i)
+          goto increment_q;
+        if (r_i < b_i)
+          goto keep_q;
+        if (i == 0)
+          break;
+        i--;
       }
   }
   if (q_len > 0 && ((q_ptr[0] & 1) != 0))
@@ -781,8 +781,8 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
     {
       size_t i;
       for (i = 0; i < q_len; i++)
-       if (++(q_ptr[i]) != 0)
-         goto keep_q;
+        if (++(q_ptr[i]) != 0)
+          goto keep_q;
       q_ptr[q_len++] = 1;
     }
   keep_q:
@@ -811,36 +811,36 @@ convert_to_decimal (mpn_t a, size_t extra_zeroes)
     {
       char *d_ptr = c_ptr;
       for (; extra_zeroes > 0; extra_zeroes--)
-       *d_ptr++ = '0';
+        *d_ptr++ = '0';
       while (a_len > 0)
-       {
-         /* Divide a by 10^9, in-place.  */
-         mp_limb_t remainder = 0;
-         mp_limb_t *ptr = a_ptr + a_len;
-         size_t count;
-         for (count = a_len; count > 0; count--)
-           {
-             mp_twolimb_t num =
-               ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--ptr;
-             *ptr = num / 1000000000;
-             remainder = num % 1000000000;
-           }
-         /* Store the remainder as 9 decimal digits.  */
-         for (count = 9; count > 0; count--)
-           {
-             *d_ptr++ = '0' + (remainder % 10);
-             remainder = remainder / 10;
-           }
-         /* Normalize a.  */
-         if (a_ptr[a_len - 1] == 0)
-           a_len--;
-       }
+        {
+          /* Divide a by 10^9, in-place.  */
+          mp_limb_t remainder = 0;
+          mp_limb_t *ptr = a_ptr + a_len;
+          size_t count;
+          for (count = a_len; count > 0; count--)
+            {
+              mp_twolimb_t num =
+                ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--ptr;
+              *ptr = num / 1000000000;
+              remainder = num % 1000000000;
+            }
+          /* Store the remainder as 9 decimal digits.  */
+          for (count = 9; count > 0; count--)
+            {
+              *d_ptr++ = '0' + (remainder % 10);
+              remainder = remainder / 10;
+            }
+          /* Normalize a.  */
+          if (a_ptr[a_len - 1] == 0)
+            a_len--;
+        }
       /* Remove leading zeroes.  */
       while (d_ptr > c_ptr && d_ptr[-1] == '0')
-       d_ptr--;
+        d_ptr--;
       /* But keep at least one zero.  */
       if (d_ptr == c_ptr)
-       *d_ptr++ = '0';
+        *d_ptr++ = '0';
       /* Terminate the string.  */
       *d_ptr = '\0';
     }
@@ -885,12 +885,12 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
       hi = (int) y;
       y -= hi;
       if (!(y >= 0.0L && y < 1.0L))
-       abort ();
+        abort ();
       y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
       lo = (int) y;
       y -= lo;
       if (!(y >= 0.0L && y < 1.0L))
-       abort ();
+        abort ();
       m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | 
lo;
     }
 #   else
@@ -900,7 +900,7 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
       d = (int) y;
       y -= d;
       if (!(y >= 0.0L && y < 1.0L))
-       abort ();
+        abort ();
       m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = d;
     }
 #   endif
@@ -912,12 +912,12 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
       hi = (int) y;
       y -= hi;
       if (!(y >= 0.0L && y < 1.0L))
-       abort ();
+        abort ();
       y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
       lo = (int) y;
       y -= lo;
       if (!(y >= 0.0L && y < 1.0L))
-       abort ();
+        abort ();
       m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo;
     }
 #if 0 /* On FreeBSD 6.1/x86, 'long double' numbers sometimes have excess
@@ -973,12 +973,12 @@ decode_double (double x, int *ep, mpn_t *mp)
       hi = (int) y;
       y -= hi;
       if (!(y >= 0.0 && y < 1.0))
-       abort ();
+        abort ();
       y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
       lo = (int) y;
       y -= lo;
       if (!(y >= 0.0 && y < 1.0))
-       abort ();
+        abort ();
       m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo;
     }
 #   else
@@ -988,7 +988,7 @@ decode_double (double x, int *ep, mpn_t *mp)
       d = (int) y;
       y -= d;
       if (!(y >= 0.0 && y < 1.0))
-       abort ();
+        abort ();
       m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = d;
     }
 #   endif
@@ -1000,12 +1000,12 @@ decode_double (double x, int *ep, mpn_t *mp)
       hi = (int) y;
       y -= hi;
       if (!(y >= 0.0 && y < 1.0))
-       abort ();
+        abort ();
       y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
       lo = (int) y;
       y -= lo;
       if (!(y >= 0.0 && y < 1.0))
-       abort ();
+        abort ();
       m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo;
     }
   if (!(y == 0.0))
@@ -1063,8 +1063,8 @@ scale10_round_decimal_decoded (int e, mpn_t m, void 
*memory, int n)
   abs_n = (n >= 0 ? n : -n);
   abs_s = (s >= 0 ? s : -s);
   pow5_ptr = (mp_limb_t *) malloc (((int)(abs_n * (2.322f / GMP_LIMB_BITS)) + 1
-                                   + abs_s / GMP_LIMB_BITS + 1)
-                                  * sizeof (mp_limb_t));
+                                    + abs_s / GMP_LIMB_BITS + 1)
+                                   * sizeof (mp_limb_t));
   if (pow5_ptr == NULL)
     {
       free (memory);
@@ -1077,26 +1077,26 @@ scale10_round_decimal_decoded (int e, mpn_t m, void 
*memory, int n)
   if (abs_n > 0)
     {
       static mp_limb_t const small_pow5[13 + 1] =
-       {
-         1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625,
-         48828125, 244140625, 1220703125
-       };
+        {
+          1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625,
+          48828125, 244140625, 1220703125
+        };
       unsigned int n13;
       for (n13 = 0; n13 <= abs_n; n13 += 13)
-       {
-         mp_limb_t digit1 = small_pow5[n13 + 13 <= abs_n ? 13 : abs_n - n13];
-         size_t j;
-         mp_twolimb_t carry = 0;
-         for (j = 0; j < pow5_len; j++)
-           {
-             mp_limb_t digit2 = pow5_ptr[j];
-             carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
-             pow5_ptr[j] = (mp_limb_t) carry;
-             carry = carry >> GMP_LIMB_BITS;
-           }
-         if (carry > 0)
-           pow5_ptr[pow5_len++] = (mp_limb_t) carry;
-       }
+        {
+          mp_limb_t digit1 = small_pow5[n13 + 13 <= abs_n ? 13 : abs_n - n13];
+          size_t j;
+          mp_twolimb_t carry = 0;
+          for (j = 0; j < pow5_len; j++)
+            {
+              mp_limb_t digit2 = pow5_ptr[j];
+              carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
+              pow5_ptr[j] = (mp_limb_t) carry;
+              carry = carry >> GMP_LIMB_BITS;
+            }
+          if (carry > 0)
+            pow5_ptr[pow5_len++] = (mp_limb_t) carry;
+        }
     }
   s_limbs = abs_s / GMP_LIMB_BITS;
   s_bits = abs_s % GMP_LIMB_BITS;
@@ -1104,129 +1104,129 @@ scale10_round_decimal_decoded (int e, mpn_t m, void 
*memory, int n)
     {
       /* Multiply with 2^|s|.  */
       if (s_bits > 0)
-       {
-         mp_limb_t *ptr = pow5_ptr;
-         mp_twolimb_t accu = 0;
-         size_t count;
-         for (count = pow5_len; count > 0; count--)
-           {
-             accu += (mp_twolimb_t) *ptr << s_bits;
-             *ptr++ = (mp_limb_t) accu;
-             accu = accu >> GMP_LIMB_BITS;
-           }
-         if (accu > 0)
-           {
-             *ptr = (mp_limb_t) accu;
-             pow5_len++;
-           }
-       }
+        {
+          mp_limb_t *ptr = pow5_ptr;
+          mp_twolimb_t accu = 0;
+          size_t count;
+          for (count = pow5_len; count > 0; count--)
+            {
+              accu += (mp_twolimb_t) *ptr << s_bits;
+              *ptr++ = (mp_limb_t) accu;
+              accu = accu >> GMP_LIMB_BITS;
+            }
+          if (accu > 0)
+            {
+              *ptr = (mp_limb_t) accu;
+              pow5_len++;
+            }
+        }
       if (s_limbs > 0)
-       {
-         size_t count;
-         for (count = pow5_len; count > 0;)
-           {
-             count--;
-             pow5_ptr[s_limbs + count] = pow5_ptr[count];
-           }
-         for (count = s_limbs; count > 0;)
-           {
-             count--;
-             pow5_ptr[count] = 0;
-           }
-         pow5_len += s_limbs;
-       }
+        {
+          size_t count;
+          for (count = pow5_len; count > 0;)
+            {
+              count--;
+              pow5_ptr[s_limbs + count] = pow5_ptr[count];
+            }
+          for (count = s_limbs; count > 0;)
+            {
+              count--;
+              pow5_ptr[count] = 0;
+            }
+          pow5_len += s_limbs;
+        }
       pow5.limbs = pow5_ptr;
       pow5.nlimbs = pow5_len;
       if (n >= 0)
-       {
-         /* Multiply m with pow5.  No division needed.  */
-         z_memory = multiply (m, pow5, &z);
-       }
+        {
+          /* Multiply m with pow5.  No division needed.  */
+          z_memory = multiply (m, pow5, &z);
+        }
       else
-       {
-         /* Divide m by pow5 and round.  */
-         z_memory = divide (m, pow5, &z);
-       }
+        {
+          /* Divide m by pow5 and round.  */
+          z_memory = divide (m, pow5, &z);
+        }
     }
   else
     {
       pow5.limbs = pow5_ptr;
       pow5.nlimbs = pow5_len;
       if (n >= 0)
-       {
-         /* n >= 0, s < 0.
-            Multiply m with pow5, then divide by 2^|s|.  */
-         mpn_t numerator;
-         mpn_t denominator;
-         void *tmp_memory;
-         tmp_memory = multiply (m, pow5, &numerator);
-         if (tmp_memory == NULL)
-           {
-             free (pow5_ptr);
-             free (memory);
-             return NULL;
-           }
-         /* Construct 2^|s|.  */
-         {
-           mp_limb_t *ptr = pow5_ptr + pow5_len;
-           size_t i;
-           for (i = 0; i < s_limbs; i++)
-             ptr[i] = 0;
-           ptr[s_limbs] = (mp_limb_t) 1 << s_bits;
-           denominator.limbs = ptr;
-           denominator.nlimbs = s_limbs + 1;
-         }
-         z_memory = divide (numerator, denominator, &z);
-         free (tmp_memory);
-       }
+        {
+          /* n >= 0, s < 0.
+             Multiply m with pow5, then divide by 2^|s|.  */
+          mpn_t numerator;
+          mpn_t denominator;
+          void *tmp_memory;
+          tmp_memory = multiply (m, pow5, &numerator);
+          if (tmp_memory == NULL)
+            {
+              free (pow5_ptr);
+              free (memory);
+              return NULL;
+            }
+          /* Construct 2^|s|.  */
+          {
+            mp_limb_t *ptr = pow5_ptr + pow5_len;
+            size_t i;
+            for (i = 0; i < s_limbs; i++)
+              ptr[i] = 0;
+            ptr[s_limbs] = (mp_limb_t) 1 << s_bits;
+            denominator.limbs = ptr;
+            denominator.nlimbs = s_limbs + 1;
+          }
+          z_memory = divide (numerator, denominator, &z);
+          free (tmp_memory);
+        }
       else
-       {
-         /* n < 0, s > 0.
-            Multiply m with 2^s, then divide by pow5.  */
-         mpn_t numerator;
-         mp_limb_t *num_ptr;
-         num_ptr = (mp_limb_t *) malloc ((m.nlimbs + s_limbs + 1)
-                                         * sizeof (mp_limb_t));
-         if (num_ptr == NULL)
-           {
-             free (pow5_ptr);
-             free (memory);
-             return NULL;
-           }
-         {
-           mp_limb_t *destptr = num_ptr;
-           {
-             size_t i;
-             for (i = 0; i < s_limbs; i++)
-               *destptr++ = 0;
-           }
-           if (s_bits > 0)
-             {
-               const mp_limb_t *sourceptr = m.limbs;
-               mp_twolimb_t accu = 0;
-               size_t count;
-               for (count = m.nlimbs; count > 0; count--)
-                 {
-                   accu += (mp_twolimb_t) *sourceptr++ << s_bits;
-                   *destptr++ = (mp_limb_t) accu;
-                   accu = accu >> GMP_LIMB_BITS;
-                 }
-               if (accu > 0)
-                 *destptr++ = (mp_limb_t) accu;
-             }
-           else
-             {
-               const mp_limb_t *sourceptr = m.limbs;
-               size_t count;
-               for (count = m.nlimbs; count > 0; count--)
-                 *destptr++ = *sourceptr++;
-             }
-           numerator.limbs = num_ptr;
-           numerator.nlimbs = destptr - num_ptr;
-         }
-         z_memory = divide (numerator, pow5, &z);
-         free (num_ptr);
-       }
+        {
+          /* n < 0, s > 0.
+             Multiply m with 2^s, then divide by pow5.  */
+          mpn_t numerator;
+          mp_limb_t *num_ptr;
+          num_ptr = (mp_limb_t *) malloc ((m.nlimbs + s_limbs + 1)
+                                          * sizeof (mp_limb_t));
+          if (num_ptr == NULL)
+            {
+              free (pow5_ptr);
+              free (memory);
+              return NULL;
+            }
+          {
+            mp_limb_t *destptr = num_ptr;
+            {
+              size_t i;
+              for (i = 0; i < s_limbs; i++)
+                *destptr++ = 0;
+            }
+            if (s_bits > 0)
+              {
+                const mp_limb_t *sourceptr = m.limbs;
+                mp_twolimb_t accu = 0;
+                size_t count;
+                for (count = m.nlimbs; count > 0; count--)
+                  {
+                    accu += (mp_twolimb_t) *sourceptr++ << s_bits;
+                    *destptr++ = (mp_limb_t) accu;
+                    accu = accu >> GMP_LIMB_BITS;
+                  }
+                if (accu > 0)
+                  *destptr++ = (mp_limb_t) accu;
+              }
+            else
+              {
+                const mp_limb_t *sourceptr = m.limbs;
+                size_t count;
+                for (count = m.nlimbs; count > 0; count--)
+                  *destptr++ = *sourceptr++;
+              }
+            numerator.limbs = num_ptr;
+            numerator.nlimbs = destptr - num_ptr;
+          }
+          z_memory = divide (numerator, pow5, &z);
+          free (num_ptr);
+        }
     }
   free (pow5_ptr);
   free (memory);
@@ -1298,35 +1298,35 @@ floorlog10l (long double x)
   if (y < 0.5L)
     {
       while (y < (1.0L / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 
2))))
-       {
-         y *= 1.0L * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2));
-         exp -= GMP_LIMB_BITS;
-       }
+        {
+          y *= 1.0L * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2));
+          exp -= GMP_LIMB_BITS;
+        }
       if (y < (1.0L / (1 << 16)))
-       {
-         y *= 1.0L * (1 << 16);
-         exp -= 16;
-       }
+        {
+          y *= 1.0L * (1 << 16);
+          exp -= 16;
+        }
       if (y < (1.0L / (1 << 8)))
-       {
-         y *= 1.0L * (1 << 8);
-         exp -= 8;
-       }
+        {
+          y *= 1.0L * (1 << 8);
+          exp -= 8;
+        }
       if (y < (1.0L / (1 << 4)))
-       {
-         y *= 1.0L * (1 << 4);
-         exp -= 4;
-       }
+        {
+          y *= 1.0L * (1 << 4);
+          exp -= 4;
+        }
       if (y < (1.0L / (1 << 2)))
-       {
-         y *= 1.0L * (1 << 2);
-         exp -= 2;
-       }
+        {
+          y *= 1.0L * (1 << 2);
+          exp -= 2;
+        }
       if (y < (1.0L / (1 << 1)))
-       {
-         y *= 1.0L * (1 << 1);
-         exp -= 1;
-       }
+        {
+          y *= 1.0L * (1 << 1);
+          exp -= 1;
+        }
     }
   if (!(y >= 0.5L && y < 1.0L))
     abort ();
@@ -1389,35 +1389,35 @@ floorlog10 (double x)
   if (y < 0.5)
     {
       while (y < (1.0 / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 
2))))
-       {
-         y *= 1.0 * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2));
-         exp -= GMP_LIMB_BITS;
-       }
+        {
+          y *= 1.0 * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2));
+          exp -= GMP_LIMB_BITS;
+        }
       if (y < (1.0 / (1 << 16)))
-       {
-         y *= 1.0 * (1 << 16);
-         exp -= 16;
-       }
+        {
+          y *= 1.0 * (1 << 16);
+          exp -= 16;
+        }
       if (y < (1.0 / (1 << 8)))
-       {
-         y *= 1.0 * (1 << 8);
-         exp -= 8;
-       }
+        {
+          y *= 1.0 * (1 << 8);
+          exp -= 8;
+        }
       if (y < (1.0 / (1 << 4)))
-       {
-         y *= 1.0 * (1 << 4);
-         exp -= 4;
-       }
+        {
+          y *= 1.0 * (1 << 4);
+          exp -= 4;
+        }
       if (y < (1.0 / (1 << 2)))
-       {
-         y *= 1.0 * (1 << 2);
-         exp -= 2;
-       }
+        {
+          y *= 1.0 * (1 << 2);
+          exp -= 2;
+        }
       if (y < (1.0 / (1 << 1)))
-       {
-         y *= 1.0 * (1 << 1);
-         exp -= 1;
-       }
+        {
+          y *= 1.0 * (1 << 1);
+          exp -= 1;
+        }
     }
   if (!(y >= 0.5 && y < 1.0))
     abort ();
@@ -1476,7 +1476,7 @@ is_borderline (const char *digits, size_t precision)
 
 DCHAR_T *
 VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
-           const FCHAR_T *format, va_list args)
+            const FCHAR_T *format, va_list args)
 {
   DIRECTIVES d;
   arguments a;
@@ -1486,8 +1486,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
     return NULL;
 
 #define CLEANUP() \
-  free (d.dir);                                                                
\
-  if (a.arg)                                                           \
+  free (d.dir);                                                         \
+  if (a.arg)                                                            \
     free (a.arg);
 
   if (PRINTF_FETCHARGS (args, &a) < 0)
@@ -1516,30 +1516,30 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 #if HAVE_ALLOCA
     if (buf_neededlength < 4000 / sizeof (TCHAR_T))
       {
-       buf = (TCHAR_T *) alloca (buf_neededlength * sizeof (TCHAR_T));
-       buf_malloced = NULL;
+        buf = (TCHAR_T *) alloca (buf_neededlength * sizeof (TCHAR_T));
+        buf_malloced = NULL;
       }
     else
 #endif
       {
-       size_t buf_memsize = xtimes (buf_neededlength, sizeof (TCHAR_T));
-       if (size_overflow_p (buf_memsize))
-         goto out_of_memory_1;
-       buf = (TCHAR_T *) malloc (buf_memsize);
-       if (buf == NULL)
-         goto out_of_memory_1;
-       buf_malloced = buf;
+        size_t buf_memsize = xtimes (buf_neededlength, sizeof (TCHAR_T));
+        if (size_overflow_p (buf_memsize))
+          goto out_of_memory_1;
+        buf = (TCHAR_T *) malloc (buf_memsize);
+        if (buf == NULL)
+          goto out_of_memory_1;
+        buf_malloced = buf;
       }
 
     if (resultbuf != NULL)
       {
-       result = resultbuf;
-       allocated = *lengthp;
+        result = resultbuf;
+        allocated = *lengthp;
       }
     else
       {
-       result = NULL;
-       allocated = 0;
+        result = NULL;
+        allocated = 0;
       }
     length = 0;
     /* Invariants:
@@ -1549,3881 +1549,3881 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
     /* Ensures that allocated >= needed.  Aborts through a jump to
        out_of_memory if needed is SIZE_MAX or otherwise too big.  */
 #define ENSURE_ALLOCATION(needed) \
-    if ((needed) > allocated)                                               \
-      {                                                                        
     \
-       size_t memory_size;                                                  \
-       DCHAR_T *memory;                                                     \
-                                                                            \
-       allocated = (allocated > 0 ? xtimes (allocated, 2) : 12);            \
-       if ((needed) > allocated)                                            \
-         allocated = (needed);                                              \
-       memory_size = xtimes (allocated, sizeof (DCHAR_T));                  \
-       if (size_overflow_p (memory_size))                                   \
-         goto out_of_memory;                                                \
-       if (result == resultbuf || result == NULL)                           \
-         memory = (DCHAR_T *) malloc (memory_size);                         \
-       else                                                                 \
-         memory = (DCHAR_T *) realloc (result, memory_size);                \
-       if (memory == NULL)                                                  \
-         goto out_of_memory;                                                \
-       if (result == resultbuf && length > 0)                               \
-         DCHAR_CPY (memory, result, length);                                \
-       result = memory;                                                     \
+    if ((needed) > allocated)                                                \
+      {                                                                      \
+        size_t memory_size;                                                  \
+        DCHAR_T *memory;                                                     \
+                                                                             \
+        allocated = (allocated > 0 ? xtimes (allocated, 2) : 12);            \
+        if ((needed) > allocated)                                            \
+          allocated = (needed);                                              \
+        memory_size = xtimes (allocated, sizeof (DCHAR_T));                  \
+        if (size_overflow_p (memory_size))                                   \
+          goto out_of_memory;                                                \
+        if (result == resultbuf || result == NULL)                           \
+          memory = (DCHAR_T *) malloc (memory_size);                         \
+        else                                                                 \
+          memory = (DCHAR_T *) realloc (result, memory_size);                \
+        if (memory == NULL)                                                  \
+          goto out_of_memory;                                                \
+        if (result == resultbuf && length > 0)                               \
+          DCHAR_CPY (memory, result, length);                                \
+        result = memory;                                                     \
       }
 
     for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++)
       {
-       if (cp != dp->dir_start)
-         {
-           size_t n = dp->dir_start - cp;
-           size_t augmented_length = xsum (length, n);
-
-           ENSURE_ALLOCATION (augmented_length);
-           /* This copies a piece of FCHAR_T[] into a DCHAR_T[].  Here we
-              need that the format string contains only ASCII characters
-              if FCHAR_T and DCHAR_T are not the same type.  */
-           if (sizeof (FCHAR_T) == sizeof (DCHAR_T))
-             {
-               DCHAR_CPY (result + length, (const DCHAR_T *) cp, n);
-               length = augmented_length;
-             }
-           else
-             {
-               do
-                 result[length++] = (unsigned char) *cp++;
-               while (--n > 0);
-             }
-         }
-       if (i == d.count)
-         break;
-
-       /* Execute a single directive.  */
-       if (dp->conversion == '%')
-         {
-           size_t augmented_length;
-
-           if (!(dp->arg_index == ARG_NONE))
-             abort ();
-           augmented_length = xsum (length, 1);
-           ENSURE_ALLOCATION (augmented_length);
-           result[length] = '%';
-           length = augmented_length;
-         }
-       else
-         {
-           if (!(dp->arg_index != ARG_NONE))
-             abort ();
-
-           if (dp->conversion == 'n')
-             {
-               switch (a.arg[dp->arg_index].type)
-                 {
-                 case TYPE_COUNT_SCHAR_POINTER:
-                   *a.arg[dp->arg_index].a.a_count_schar_pointer = length;
-                   break;
-                 case TYPE_COUNT_SHORT_POINTER:
-                   *a.arg[dp->arg_index].a.a_count_short_pointer = length;
-                   break;
-                 case TYPE_COUNT_INT_POINTER:
-                   *a.arg[dp->arg_index].a.a_count_int_pointer = length;
-                   break;
-                 case TYPE_COUNT_LONGINT_POINTER:
-                   *a.arg[dp->arg_index].a.a_count_longint_pointer = length;
-                   break;
+        if (cp != dp->dir_start)
+          {
+            size_t n = dp->dir_start - cp;
+            size_t augmented_length = xsum (length, n);
+
+            ENSURE_ALLOCATION (augmented_length);
+            /* This copies a piece of FCHAR_T[] into a DCHAR_T[].  Here we
+               need that the format string contains only ASCII characters
+               if FCHAR_T and DCHAR_T are not the same type.  */
+            if (sizeof (FCHAR_T) == sizeof (DCHAR_T))
+              {
+                DCHAR_CPY (result + length, (const DCHAR_T *) cp, n);
+                length = augmented_length;
+              }
+            else
+              {
+                do
+                  result[length++] = (unsigned char) *cp++;
+                while (--n > 0);
+              }
+          }
+        if (i == d.count)
+          break;
+
+        /* Execute a single directive.  */
+        if (dp->conversion == '%')
+          {
+            size_t augmented_length;
+
+            if (!(dp->arg_index == ARG_NONE))
+              abort ();
+            augmented_length = xsum (length, 1);
+            ENSURE_ALLOCATION (augmented_length);
+            result[length] = '%';
+            length = augmented_length;
+          }
+        else
+          {
+            if (!(dp->arg_index != ARG_NONE))
+              abort ();
+
+            if (dp->conversion == 'n')
+              {
+                switch (a.arg[dp->arg_index].type)
+                  {
+                  case TYPE_COUNT_SCHAR_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_schar_pointer = length;
+                    break;
+                  case TYPE_COUNT_SHORT_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_short_pointer = length;
+                    break;
+                  case TYPE_COUNT_INT_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_int_pointer = length;
+                    break;
+                  case TYPE_COUNT_LONGINT_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_longint_pointer = length;
+                    break;
 #if HAVE_LONG_LONG_INT
-                 case TYPE_COUNT_LONGLONGINT_POINTER:
-                   *a.arg[dp->arg_index].a.a_count_longlongint_pointer = 
length;
-                   break;
+                  case TYPE_COUNT_LONGLONGINT_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_longlongint_pointer = 
length;
+                    break;
 #endif
-                 default:
-                   abort ();
-                 }
-             }
+                  default:
+                    abort ();
+                  }
+              }
 #if ENABLE_UNISTDIO
-           /* The unistdio extensions.  */
-           else if (dp->conversion == 'U')
-             {
-               arg_type type = a.arg[dp->arg_index].type;
-               int flags = dp->flags;
-               int has_width;
-               size_t width;
-               int has_precision;
-               size_t precision;
-
-               has_width = 0;
-               width = 0;
-               if (dp->width_start != dp->width_end)
-                 {
-                   if (dp->width_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->width_arg_index].a.a_int;
-                       if (arg < 0)
-                         {
-                           /* "A negative field width is taken as a '-' flag
-                               followed by a positive field width."  */
-                           flags |= FLAG_LEFT;
-                           width = (unsigned int) (-arg);
-                         }
-                       else
-                         width = arg;
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->width_start;
-
-                       do
-                         width = xsum (xtimes (width, 10), *digitp++ - '0');
-                       while (digitp != dp->width_end);
-                     }
-                   has_width = 1;
-                 }
-
-               has_precision = 0;
-               precision = 0;
-               if (dp->precision_start != dp->precision_end)
-                 {
-                   if (dp->precision_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->precision_arg_index].a.a_int;
-                       /* "A negative precision is taken as if the precision
-                           were omitted."  */
-                       if (arg >= 0)
-                         {
-                           precision = arg;
-                           has_precision = 1;
-                         }
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->precision_start + 1;
-
-                       precision = 0;
-                       while (digitp != dp->precision_end)
-                         precision = xsum (xtimes (precision, 10), *digitp++ - 
'0');
-                       has_precision = 1;
-                     }
-                 }
-
-               switch (type)
-                 {
-                 case TYPE_U8_STRING:
-                   {
-                     const uint8_t *arg = a.arg[dp->arg_index].a.a_u8_string;
-                     const uint8_t *arg_end;
-                     size_t characters;
-
-                     if (has_precision)
-                       {
-                         /* Use only PRECISION characters, from the left.  */
-                         arg_end = arg;
-                         characters = 0;
-                         for (; precision > 0; precision--)
-                           {
-                             int count = u8_strmblen (arg_end);
-                             if (count == 0)
-                               break;
-                             if (count < 0)
-                               {
-                                 if (!(result == resultbuf || result == NULL))
-                                   free (result);
-                                 if (buf_malloced != NULL)
-                                   free (buf_malloced);
-                                 CLEANUP ();
-                                 errno = EILSEQ;
-                                 return NULL;
-                               }
-                             arg_end += count;
-                             characters++;
-                           }
-                       }
-                     else if (has_width)
-                       {
-                         /* Use the entire string, and count the number of
-                            characters.  */
-                         arg_end = arg;
-                         characters = 0;
-                         for (;;)
-                           {
-                             int count = u8_strmblen (arg_end);
-                             if (count == 0)
-                               break;
-                             if (count < 0)
-                               {
-                                 if (!(result == resultbuf || result == NULL))
-                                   free (result);
-                                 if (buf_malloced != NULL)
-                                   free (buf_malloced);
-                                 CLEANUP ();
-                                 errno = EILSEQ;
-                                 return NULL;
-                               }
-                             arg_end += count;
-                             characters++;
-                           }
-                       }
-                     else
-                       {
-                         /* Use the entire string.  */
-                         arg_end = arg + u8_strlen (arg);
-                         /* The number of characters doesn't matter.  */
-                         characters = 0;
-                       }
-
-                     if (has_width && width > characters
-                         && !(dp->flags & FLAG_LEFT))
-                       {
-                         size_t n = width - characters;
-                         ENSURE_ALLOCATION (xsum (length, n));
-                         DCHAR_SET (result + length, ' ', n);
-                         length += n;
-                       }
+            /* The unistdio extensions.  */
+            else if (dp->conversion == 'U')
+              {
+                arg_type type = a.arg[dp->arg_index].type;
+                int flags = dp->flags;
+                int has_width;
+                size_t width;
+                int has_precision;
+                size_t precision;
+
+                has_width = 0;
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = (unsigned int) (-arg);
+                          }
+                        else
+                          width = arg;
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+                    has_width = 1;
+                  }
+
+                has_precision = 0;
+                precision = 0;
+                if (dp->precision_start != dp->precision_end)
+                  {
+                    if (dp->precision_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->precision_arg_index].a.a_int;
+                        /* "A negative precision is taken as if the precision
+                            were omitted."  */
+                        if (arg >= 0)
+                          {
+                            precision = arg;
+                            has_precision = 1;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->precision_start + 1;
+
+                        precision = 0;
+                        while (digitp != dp->precision_end)
+                          precision = xsum (xtimes (precision, 10), *digitp++ 
- '0');
+                        has_precision = 1;
+                      }
+                  }
+
+                switch (type)
+                  {
+                  case TYPE_U8_STRING:
+                    {
+                      const uint8_t *arg = a.arg[dp->arg_index].a.a_u8_string;
+                      const uint8_t *arg_end;
+                      size_t characters;
+
+                      if (has_precision)
+                        {
+                          /* Use only PRECISION characters, from the left.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (; precision > 0; precision--)
+                            {
+                              int count = u8_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                {
+                                  if (!(result == resultbuf || result == NULL))
+                                    free (result);
+                                  if (buf_malloced != NULL)
+                                    free (buf_malloced);
+                                  CLEANUP ();
+                                  errno = EILSEQ;
+                                  return NULL;
+                                }
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else if (has_width)
+                        {
+                          /* Use the entire string, and count the number of
+                             characters.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (;;)
+                            {
+                              int count = u8_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                {
+                                  if (!(result == resultbuf || result == NULL))
+                                    free (result);
+                                  if (buf_malloced != NULL)
+                                    free (buf_malloced);
+                                  CLEANUP ();
+                                  errno = EILSEQ;
+                                  return NULL;
+                                }
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else
+                        {
+                          /* Use the entire string.  */
+                          arg_end = arg + u8_strlen (arg);
+                          /* The number of characters doesn't matter.  */
+                          characters = 0;
+                        }
+
+                      if (has_width && width > characters
+                          && !(dp->flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
 
 # if DCHAR_IS_UINT8_T
-                     {
-                       size_t n = arg_end - arg;
-                       ENSURE_ALLOCATION (xsum (length, n));
-                       DCHAR_CPY (result + length, arg, n);
-                       length += n;
-                     }
+                      {
+                        size_t n = arg_end - arg;
+                        ENSURE_ALLOCATION (xsum (length, n));
+                        DCHAR_CPY (result + length, arg, n);
+                        length += n;
+                      }
 # else
-                     { /* Convert.  */
-                       DCHAR_T *converted = result + length;
-                       size_t converted_len = allocated - length;
+                      { /* Convert.  */
+                        DCHAR_T *converted = result + length;
+                        size_t converted_len = allocated - length;
 #  if DCHAR_IS_TCHAR
-                       /* Convert from UTF-8 to locale encoding.  */
-                       converted =
-                         u8_conv_to_encoding (locale_charset (),
-                                              iconveh_question_mark,
-                                              arg, arg_end - arg, NULL,
-                                              converted, &converted_len);
+                        /* Convert from UTF-8 to locale encoding.  */
+                        converted =
+                          u8_conv_to_encoding (locale_charset (),
+                                               iconveh_question_mark,
+                                               arg, arg_end - arg, NULL,
+                                               converted, &converted_len);
 #  else
-                       /* Convert from UTF-8 to UTF-16/UTF-32.  */
-                       converted =
-                         U8_TO_DCHAR (arg, arg_end - arg,
-                                      converted, &converted_len);
+                        /* Convert from UTF-8 to UTF-16/UTF-32.  */
+                        converted =
+                          U8_TO_DCHAR (arg, arg_end - arg,
+                                       converted, &converted_len);
 #  endif
-                       if (converted == NULL)
-                         {
-                           int saved_errno = errno;
-                           if (!(result == resultbuf || result == NULL))
-                             free (result);
-                           if (buf_malloced != NULL)
-                             free (buf_malloced);
-                           CLEANUP ();
-                           errno = saved_errno;
-                           return NULL;
-                         }
-                       if (converted != result + length)
-                         {
-                           ENSURE_ALLOCATION (xsum (length, converted_len));
-                           DCHAR_CPY (result + length, converted, 
converted_len);
-                           free (converted);
-                         }
-                       length += converted_len;
-                     }
+                        if (converted == NULL)
+                          {
+                            int saved_errno = errno;
+                            if (!(result == resultbuf || result == NULL))
+                              free (result);
+                            if (buf_malloced != NULL)
+                              free (buf_malloced);
+                            CLEANUP ();
+                            errno = saved_errno;
+                            return NULL;
+                          }
+                        if (converted != result + length)
+                          {
+                            ENSURE_ALLOCATION (xsum (length, converted_len));
+                            DCHAR_CPY (result + length, converted, 
converted_len);
+                            free (converted);
+                          }
+                        length += converted_len;
+                      }
 # endif
 
-                     if (has_width && width > characters
-                         && (dp->flags & FLAG_LEFT))
-                       {
-                         size_t n = width - characters;
-                         ENSURE_ALLOCATION (xsum (length, n));
-                         DCHAR_SET (result + length, ' ', n);
-                         length += n;
-                       }
-                   }
-                   break;
-
-                 case TYPE_U16_STRING:
-                   {
-                     const uint16_t *arg = a.arg[dp->arg_index].a.a_u16_string;
-                     const uint16_t *arg_end;
-                     size_t characters;
-
-                     if (has_precision)
-                       {
-                         /* Use only PRECISION characters, from the left.  */
-                         arg_end = arg;
-                         characters = 0;
-                         for (; precision > 0; precision--)
-                           {
-                             int count = u16_strmblen (arg_end);
-                             if (count == 0)
-                               break;
-                             if (count < 0)
-                               {
-                                 if (!(result == resultbuf || result == NULL))
-                                   free (result);
-                                 if (buf_malloced != NULL)
-                                   free (buf_malloced);
-                                 CLEANUP ();
-                                 errno = EILSEQ;
-                                 return NULL;
-                               }
-                             arg_end += count;
-                             characters++;
-                           }
-                       }
-                     else if (has_width)
-                       {
-                         /* Use the entire string, and count the number of
-                            characters.  */
-                         arg_end = arg;
-                         characters = 0;
-                         for (;;)
-                           {
-                             int count = u16_strmblen (arg_end);
-                             if (count == 0)
-                               break;
-                             if (count < 0)
-                               {
-                                 if (!(result == resultbuf || result == NULL))
-                                   free (result);
-                                 if (buf_malloced != NULL)
-                                   free (buf_malloced);
-                                 CLEANUP ();
-                                 errno = EILSEQ;
-                                 return NULL;
-                               }
-                             arg_end += count;
-                             characters++;
-                           }
-                       }
-                     else
-                       {
-                         /* Use the entire string.  */
-                         arg_end = arg + u16_strlen (arg);
-                         /* The number of characters doesn't matter.  */
-                         characters = 0;
-                       }
-
-                     if (has_width && width > characters
-                         && !(dp->flags & FLAG_LEFT))
-                       {
-                         size_t n = width - characters;
-                         ENSURE_ALLOCATION (xsum (length, n));
-                         DCHAR_SET (result + length, ' ', n);
-                         length += n;
-                       }
+                      if (has_width && width > characters
+                          && (dp->flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
+                    }
+                    break;
+
+                  case TYPE_U16_STRING:
+                    {
+                      const uint16_t *arg = 
a.arg[dp->arg_index].a.a_u16_string;
+                      const uint16_t *arg_end;
+                      size_t characters;
+
+                      if (has_precision)
+                        {
+                          /* Use only PRECISION characters, from the left.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (; precision > 0; precision--)
+                            {
+                              int count = u16_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                {
+                                  if (!(result == resultbuf || result == NULL))
+                                    free (result);
+                                  if (buf_malloced != NULL)
+                                    free (buf_malloced);
+                                  CLEANUP ();
+                                  errno = EILSEQ;
+                                  return NULL;
+                                }
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else if (has_width)
+                        {
+                          /* Use the entire string, and count the number of
+                             characters.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (;;)
+                            {
+                              int count = u16_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                {
+                                  if (!(result == resultbuf || result == NULL))
+                                    free (result);
+                                  if (buf_malloced != NULL)
+                                    free (buf_malloced);
+                                  CLEANUP ();
+                                  errno = EILSEQ;
+                                  return NULL;
+                                }
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else
+                        {
+                          /* Use the entire string.  */
+                          arg_end = arg + u16_strlen (arg);
+                          /* The number of characters doesn't matter.  */
+                          characters = 0;
+                        }
+
+                      if (has_width && width > characters
+                          && !(dp->flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
 
 # if DCHAR_IS_UINT16_T
-                     {
-                       size_t n = arg_end - arg;
-                       ENSURE_ALLOCATION (xsum (length, n));
-                       DCHAR_CPY (result + length, arg, n);
-                       length += n;
-                     }
+                      {
+                        size_t n = arg_end - arg;
+                        ENSURE_ALLOCATION (xsum (length, n));
+                        DCHAR_CPY (result + length, arg, n);
+                        length += n;
+                      }
 # else
-                     { /* Convert.  */
-                       DCHAR_T *converted = result + length;
-                       size_t converted_len = allocated - length;
+                      { /* Convert.  */
+                        DCHAR_T *converted = result + length;
+                        size_t converted_len = allocated - length;
 #  if DCHAR_IS_TCHAR
-                       /* Convert from UTF-16 to locale encoding.  */
-                       converted =
-                         u16_conv_to_encoding (locale_charset (),
-                                               iconveh_question_mark,
-                                               arg, arg_end - arg, NULL,
-                                               converted, &converted_len);
+                        /* Convert from UTF-16 to locale encoding.  */
+                        converted =
+                          u16_conv_to_encoding (locale_charset (),
+                                                iconveh_question_mark,
+                                                arg, arg_end - arg, NULL,
+                                                converted, &converted_len);
 #  else
-                       /* Convert from UTF-16 to UTF-8/UTF-32.  */
-                       converted =
-                         U16_TO_DCHAR (arg, arg_end - arg,
-                                       converted, &converted_len);
+                        /* Convert from UTF-16 to UTF-8/UTF-32.  */
+                        converted =
+                          U16_TO_DCHAR (arg, arg_end - arg,
+                                        converted, &converted_len);
 #  endif
-                       if (converted == NULL)
-                         {
-                           int saved_errno = errno;
-                           if (!(result == resultbuf || result == NULL))
-                             free (result);
-                           if (buf_malloced != NULL)
-                             free (buf_malloced);
-                           CLEANUP ();
-                           errno = saved_errno;
-                           return NULL;
-                         }
-                       if (converted != result + length)
-                         {
-                           ENSURE_ALLOCATION (xsum (length, converted_len));
-                           DCHAR_CPY (result + length, converted, 
converted_len);
-                           free (converted);
-                         }
-                       length += converted_len;
-                     }
+                        if (converted == NULL)
+                          {
+                            int saved_errno = errno;
+                            if (!(result == resultbuf || result == NULL))
+                              free (result);
+                            if (buf_malloced != NULL)
+                              free (buf_malloced);
+                            CLEANUP ();
+                            errno = saved_errno;
+                            return NULL;
+                          }
+                        if (converted != result + length)
+                          {
+                            ENSURE_ALLOCATION (xsum (length, converted_len));
+                            DCHAR_CPY (result + length, converted, 
converted_len);
+                            free (converted);
+                          }
+                        length += converted_len;
+                      }
 # endif
 
-                     if (has_width && width > characters
-                         && (dp->flags & FLAG_LEFT))
-                       {
-                         size_t n = width - characters;
-                         ENSURE_ALLOCATION (xsum (length, n));
-                         DCHAR_SET (result + length, ' ', n);
-                         length += n;
-                       }
-                   }
-                   break;
-
-                 case TYPE_U32_STRING:
-                   {
-                     const uint32_t *arg = a.arg[dp->arg_index].a.a_u32_string;
-                     const uint32_t *arg_end;
-                     size_t characters;
-
-                     if (has_precision)
-                       {
-                         /* Use only PRECISION characters, from the left.  */
-                         arg_end = arg;
-                         characters = 0;
-                         for (; precision > 0; precision--)
-                           {
-                             int count = u32_strmblen (arg_end);
-                             if (count == 0)
-                               break;
-                             if (count < 0)
-                               {
-                                 if (!(result == resultbuf || result == NULL))
-                                   free (result);
-                                 if (buf_malloced != NULL)
-                                   free (buf_malloced);
-                                 CLEANUP ();
-                                 errno = EILSEQ;
-                                 return NULL;
-                               }
-                             arg_end += count;
-                             characters++;
-                           }
-                       }
-                     else if (has_width)
-                       {
-                         /* Use the entire string, and count the number of
-                            characters.  */
-                         arg_end = arg;
-                         characters = 0;
-                         for (;;)
-                           {
-                             int count = u32_strmblen (arg_end);
-                             if (count == 0)
-                               break;
-                             if (count < 0)
-                               {
-                                 if (!(result == resultbuf || result == NULL))
-                                   free (result);
-                                 if (buf_malloced != NULL)
-                                   free (buf_malloced);
-                                 CLEANUP ();
-                                 errno = EILSEQ;
-                                 return NULL;
-                               }
-                             arg_end += count;
-                             characters++;
-                           }
-                       }
-                     else
-                       {
-                         /* Use the entire string.  */
-                         arg_end = arg + u32_strlen (arg);
-                         /* The number of characters doesn't matter.  */
-                         characters = 0;
-                       }
-
-                     if (has_width && width > characters
-                         && !(dp->flags & FLAG_LEFT))
-                       {
-                         size_t n = width - characters;
-                         ENSURE_ALLOCATION (xsum (length, n));
-                         DCHAR_SET (result + length, ' ', n);
-                         length += n;
-                       }
+                      if (has_width && width > characters
+                          && (dp->flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
+                    }
+                    break;
+
+                  case TYPE_U32_STRING:
+                    {
+                      const uint32_t *arg = 
a.arg[dp->arg_index].a.a_u32_string;
+                      const uint32_t *arg_end;
+                      size_t characters;
+
+                      if (has_precision)
+                        {
+                          /* Use only PRECISION characters, from the left.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (; precision > 0; precision--)
+                            {
+                              int count = u32_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                {
+                                  if (!(result == resultbuf || result == NULL))
+                                    free (result);
+                                  if (buf_malloced != NULL)
+                                    free (buf_malloced);
+                                  CLEANUP ();
+                                  errno = EILSEQ;
+                                  return NULL;
+                                }
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else if (has_width)
+                        {
+                          /* Use the entire string, and count the number of
+                             characters.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (;;)
+                            {
+                              int count = u32_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                {
+                                  if (!(result == resultbuf || result == NULL))
+                                    free (result);
+                                  if (buf_malloced != NULL)
+                                    free (buf_malloced);
+                                  CLEANUP ();
+                                  errno = EILSEQ;
+                                  return NULL;
+                                }
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else
+                        {
+                          /* Use the entire string.  */
+                          arg_end = arg + u32_strlen (arg);
+                          /* The number of characters doesn't matter.  */
+                          characters = 0;
+                        }
+
+                      if (has_width && width > characters
+                          && !(dp->flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
 
 # if DCHAR_IS_UINT32_T
-                     {
-                       size_t n = arg_end - arg;
-                       ENSURE_ALLOCATION (xsum (length, n));
-                       DCHAR_CPY (result + length, arg, n);
-                       length += n;
-                     }
+                      {
+                        size_t n = arg_end - arg;
+                        ENSURE_ALLOCATION (xsum (length, n));
+                        DCHAR_CPY (result + length, arg, n);
+                        length += n;
+                      }
 # else
-                     { /* Convert.  */
-                       DCHAR_T *converted = result + length;
-                       size_t converted_len = allocated - length;
+                      { /* Convert.  */
+                        DCHAR_T *converted = result + length;
+                        size_t converted_len = allocated - length;
 #  if DCHAR_IS_TCHAR
-                       /* Convert from UTF-32 to locale encoding.  */
-                       converted =
-                         u32_conv_to_encoding (locale_charset (),
-                                               iconveh_question_mark,
-                                               arg, arg_end - arg, NULL,
-                                               converted, &converted_len);
+                        /* Convert from UTF-32 to locale encoding.  */
+                        converted =
+                          u32_conv_to_encoding (locale_charset (),
+                                                iconveh_question_mark,
+                                                arg, arg_end - arg, NULL,
+                                                converted, &converted_len);
 #  else
-                       /* Convert from UTF-32 to UTF-8/UTF-16.  */
-                       converted =
-                         U32_TO_DCHAR (arg, arg_end - arg,
-                                       converted, &converted_len);
+                        /* Convert from UTF-32 to UTF-8/UTF-16.  */
+                        converted =
+                          U32_TO_DCHAR (arg, arg_end - arg,
+                                        converted, &converted_len);
 #  endif
-                       if (converted == NULL)
-                         {
-                           int saved_errno = errno;
-                           if (!(result == resultbuf || result == NULL))
-                             free (result);
-                           if (buf_malloced != NULL)
-                             free (buf_malloced);
-                           CLEANUP ();
-                           errno = saved_errno;
-                           return NULL;
-                         }
-                       if (converted != result + length)
-                         {
-                           ENSURE_ALLOCATION (xsum (length, converted_len));
-                           DCHAR_CPY (result + length, converted, 
converted_len);
-                           free (converted);
-                         }
-                       length += converted_len;
-                     }
+                        if (converted == NULL)
+                          {
+                            int saved_errno = errno;
+                            if (!(result == resultbuf || result == NULL))
+                              free (result);
+                            if (buf_malloced != NULL)
+                              free (buf_malloced);
+                            CLEANUP ();
+                            errno = saved_errno;
+                            return NULL;
+                          }
+                        if (converted != result + length)
+                          {
+                            ENSURE_ALLOCATION (xsum (length, converted_len));
+                            DCHAR_CPY (result + length, converted, 
converted_len);
+                            free (converted);
+                          }
+                        length += converted_len;
+                      }
 # endif
 
-                     if (has_width && width > characters
-                         && (dp->flags & FLAG_LEFT))
-                       {
-                         size_t n = width - characters;
-                         ENSURE_ALLOCATION (xsum (length, n));
-                         DCHAR_SET (result + length, ' ', n);
-                         length += n;
-                       }
-                   }
-                   break;
-
-                 default:
-                   abort ();
-                 }
-             }
+                      if (has_width && width > characters
+                          && (dp->flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
+                    }
+                    break;
+
+                  default:
+                    abort ();
+                  }
+              }
 #endif
 #if (!USE_SNPRINTF || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL)) && 
HAVE_WCHAR_T
-           else if (dp->conversion == 's'
+            else if (dp->conversion == 's'
 # if WIDE_CHAR_VERSION
-                    && a.arg[dp->arg_index].type != TYPE_WIDE_STRING
+                     && a.arg[dp->arg_index].type != TYPE_WIDE_STRING
 # else
-                    && a.arg[dp->arg_index].type == TYPE_WIDE_STRING
+                     && a.arg[dp->arg_index].type == TYPE_WIDE_STRING
 # endif
-                   )
-             {
-               /* The normal handling of the 's' directive below requires
-                  allocating a temporary buffer.  The determination of its
-                  length (tmp_length), in the case when a precision is
-                  specified, below requires a conversion between a char[]
-                  string and a wchar_t[] wide string.  It could be done, but
-                  we have no guarantee that the implementation of sprintf will
-                  use the exactly same algorithm.  Without this guarantee, it
-                  is possible to have buffer overrun bugs.  In order to avoid
-                  such bugs, we implement the entire processing of the 's'
-                  directive ourselves.  */
-               int flags = dp->flags;
-               int has_width;
-               size_t width;
-               int has_precision;
-               size_t precision;
-
-               has_width = 0;
-               width = 0;
-               if (dp->width_start != dp->width_end)
-                 {
-                   if (dp->width_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->width_arg_index].a.a_int;
-                       if (arg < 0)
-                         {
-                           /* "A negative field width is taken as a '-' flag
-                               followed by a positive field width."  */
-                           flags |= FLAG_LEFT;
-                           width = (unsigned int) (-arg);
-                         }
-                       else
-                         width = arg;
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->width_start;
-
-                       do
-                         width = xsum (xtimes (width, 10), *digitp++ - '0');
-                       while (digitp != dp->width_end);
-                     }
-                   has_width = 1;
-                 }
-
-               has_precision = 0;
-               precision = 6;
-               if (dp->precision_start != dp->precision_end)
-                 {
-                   if (dp->precision_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->precision_arg_index].a.a_int;
-                       /* "A negative precision is taken as if the precision
-                           were omitted."  */
-                       if (arg >= 0)
-                         {
-                           precision = arg;
-                           has_precision = 1;
-                         }
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->precision_start + 1;
-
-                       precision = 0;
-                       while (digitp != dp->precision_end)
-                         precision = xsum (xtimes (precision, 10), *digitp++ - 
'0');
-                       has_precision = 1;
-                     }
-                 }
+                    )
+              {
+                /* The normal handling of the 's' directive below requires
+                   allocating a temporary buffer.  The determination of its
+                   length (tmp_length), in the case when a precision is
+                   specified, below requires a conversion between a char[]
+                   string and a wchar_t[] wide string.  It could be done, but
+                   we have no guarantee that the implementation of sprintf will
+                   use the exactly same algorithm.  Without this guarantee, it
+                   is possible to have buffer overrun bugs.  In order to avoid
+                   such bugs, we implement the entire processing of the 's'
+                   directive ourselves.  */
+                int flags = dp->flags;
+                int has_width;
+                size_t width;
+                int has_precision;
+                size_t precision;
+
+                has_width = 0;
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = (unsigned int) (-arg);
+                          }
+                        else
+                          width = arg;
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+                    has_width = 1;
+                  }
+
+                has_precision = 0;
+                precision = 6;
+                if (dp->precision_start != dp->precision_end)
+                  {
+                    if (dp->precision_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->precision_arg_index].a.a_int;
+                        /* "A negative precision is taken as if the precision
+                            were omitted."  */
+                        if (arg >= 0)
+                          {
+                            precision = arg;
+                            has_precision = 1;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->precision_start + 1;
+
+                        precision = 0;
+                        while (digitp != dp->precision_end)
+                          precision = xsum (xtimes (precision, 10), *digitp++ 
- '0');
+                        has_precision = 1;
+                      }
+                  }
 
 # if WIDE_CHAR_VERSION
-               /* %s in vasnwprintf.  See the specification of fwprintf.  */
-               {
-                 const char *arg = a.arg[dp->arg_index].a.a_string;
-                 const char *arg_end;
-                 size_t characters;
-
-                 if (has_precision)
-                   {
-                     /* Use only as many bytes as needed to produce PRECISION
-                        wide characters, from the left.  */
+                /* %s in vasnwprintf.  See the specification of fwprintf.  */
+                {
+                  const char *arg = a.arg[dp->arg_index].a.a_string;
+                  const char *arg_end;
+                  size_t characters;
+
+                  if (has_precision)
+                    {
+                      /* Use only as many bytes as needed to produce PRECISION
+                         wide characters, from the left.  */
 #  if HAVE_MBRTOWC
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #  endif
-                     arg_end = arg;
-                     characters = 0;
-                     for (; precision > 0; precision--)
-                       {
-                         int count;
+                      arg_end = arg;
+                      characters = 0;
+                      for (; precision > 0; precision--)
+                        {
+                          int count;
 #  if HAVE_MBRTOWC
-                         count = mbrlen (arg_end, MB_CUR_MAX, &state);
+                          count = mbrlen (arg_end, MB_CUR_MAX, &state);
 #  else
-                         count = mblen (arg_end, MB_CUR_MAX);
+                          count = mblen (arg_end, MB_CUR_MAX);
 #  endif
-                         if (count == 0)
-                           /* Found the terminating NUL.  */
-                           break;
-                         if (count < 0)
-                           {
-                             /* Invalid or incomplete multibyte character.  */
-                             if (!(result == resultbuf || result == NULL))
-                               free (result);
-                             if (buf_malloced != NULL)
-                               free (buf_malloced);
-                             CLEANUP ();
-                             errno = EILSEQ;
-                             return NULL;
-                           }
-                         arg_end += count;
-                         characters++;
-                       }
-                   }
-                 else if (has_width)
-                   {
-                     /* Use the entire string, and count the number of wide
-                        characters.  */
+                          if (count == 0)
+                            /* Found the terminating NUL.  */
+                            break;
+                          if (count < 0)
+                            {
+                              /* Invalid or incomplete multibyte character.  */
+                              if (!(result == resultbuf || result == NULL))
+                                free (result);
+                              if (buf_malloced != NULL)
+                                free (buf_malloced);
+                              CLEANUP ();
+                              errno = EILSEQ;
+                              return NULL;
+                            }
+                          arg_end += count;
+                          characters++;
+                        }
+                    }
+                  else if (has_width)
+                    {
+                      /* Use the entire string, and count the number of wide
+                         characters.  */
 #  if HAVE_MBRTOWC
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #  endif
-                     arg_end = arg;
-                     characters = 0;
-                     for (;;)
-                       {
-                         int count;
+                      arg_end = arg;
+                      characters = 0;
+                      for (;;)
+                        {
+                          int count;
 #  if HAVE_MBRTOWC
-                         count = mbrlen (arg_end, MB_CUR_MAX, &state);
+                          count = mbrlen (arg_end, MB_CUR_MAX, &state);
 #  else
-                         count = mblen (arg_end, MB_CUR_MAX);
+                          count = mblen (arg_end, MB_CUR_MAX);
 #  endif
-                         if (count == 0)
-                           /* Found the terminating NUL.  */
-                           break;
-                         if (count < 0)
-                           {
-                             /* Invalid or incomplete multibyte character.  */
-                             if (!(result == resultbuf || result == NULL))
-                               free (result);
-                             if (buf_malloced != NULL)
-                               free (buf_malloced);
-                             CLEANUP ();
-                             errno = EILSEQ;
-                             return NULL;
-                           }
-                         arg_end += count;
-                         characters++;
-                       }
-                   }
-                 else
-                   {
-                     /* Use the entire string.  */
-                     arg_end = arg + strlen (arg);
-                     /* The number of characters doesn't matter.  */
-                     characters = 0;
-                   }
-
-                 if (has_width && width > characters
-                     && !(dp->flags & FLAG_LEFT))
-                   {
-                     size_t n = width - characters;
-                     ENSURE_ALLOCATION (xsum (length, n));
-                     DCHAR_SET (result + length, ' ', n);
-                     length += n;
-                   }
-
-                 if (has_precision || has_width)
-                   {
-                     /* We know the number of wide characters in advance.  */
-                     size_t remaining;
+                          if (count == 0)
+                            /* Found the terminating NUL.  */
+                            break;
+                          if (count < 0)
+                            {
+                              /* Invalid or incomplete multibyte character.  */
+                              if (!(result == resultbuf || result == NULL))
+                                free (result);
+                              if (buf_malloced != NULL)
+                                free (buf_malloced);
+                              CLEANUP ();
+                              errno = EILSEQ;
+                              return NULL;
+                            }
+                          arg_end += count;
+                          characters++;
+                        }
+                    }
+                  else
+                    {
+                      /* Use the entire string.  */
+                      arg_end = arg + strlen (arg);
+                      /* The number of characters doesn't matter.  */
+                      characters = 0;
+                    }
+
+                  if (has_width && width > characters
+                      && !(dp->flags & FLAG_LEFT))
+                    {
+                      size_t n = width - characters;
+                      ENSURE_ALLOCATION (xsum (length, n));
+                      DCHAR_SET (result + length, ' ', n);
+                      length += n;
+                    }
+
+                  if (has_precision || has_width)
+                    {
+                      /* We know the number of wide characters in advance.  */
+                      size_t remaining;
 #  if HAVE_MBRTOWC
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #  endif
-                     ENSURE_ALLOCATION (xsum (length, characters));
-                     for (remaining = characters; remaining > 0; remaining--)
-                       {
-                         wchar_t wc;
-                         int count;
+                      ENSURE_ALLOCATION (xsum (length, characters));
+                      for (remaining = characters; remaining > 0; remaining--)
+                        {
+                          wchar_t wc;
+                          int count;
 #  if HAVE_MBRTOWC
-                         count = mbrtowc (&wc, arg, arg_end - arg, &state);
+                          count = mbrtowc (&wc, arg, arg_end - arg, &state);
 #  else
-                         count = mbtowc (&wc, arg, arg_end - arg);
+                          count = mbtowc (&wc, arg, arg_end - arg);
 #  endif
-                         if (count <= 0)
-                           /* mbrtowc not consistent with mbrlen, or mbtowc
-                              not consistent with mblen.  */
-                           abort ();
-                         result[length++] = wc;
-                         arg += count;
-                       }
-                     if (!(arg == arg_end))
-                       abort ();
-                   }
-                 else
-                   {
+                          if (count <= 0)
+                            /* mbrtowc not consistent with mbrlen, or mbtowc
+                               not consistent with mblen.  */
+                            abort ();
+                          result[length++] = wc;
+                          arg += count;
+                        }
+                      if (!(arg == arg_end))
+                        abort ();
+                    }
+                  else
+                    {
 #  if HAVE_MBRTOWC
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #  endif
-                     while (arg < arg_end)
-                       {
-                         wchar_t wc;
-                         int count;
+                      while (arg < arg_end)
+                        {
+                          wchar_t wc;
+                          int count;
 #  if HAVE_MBRTOWC
-                         count = mbrtowc (&wc, arg, arg_end - arg, &state);
+                          count = mbrtowc (&wc, arg, arg_end - arg, &state);
 #  else
-                         count = mbtowc (&wc, arg, arg_end - arg);
+                          count = mbtowc (&wc, arg, arg_end - arg);
 #  endif
-                         if (count <= 0)
-                           /* mbrtowc not consistent with mbrlen, or mbtowc
-                              not consistent with mblen.  */
-                           abort ();
-                         ENSURE_ALLOCATION (xsum (length, 1));
-                         result[length++] = wc;
-                         arg += count;
-                       }
-                   }
-
-                 if (has_width && width > characters
-                     && (dp->flags & FLAG_LEFT))
-                   {
-                     size_t n = width - characters;
-                     ENSURE_ALLOCATION (xsum (length, n));
-                     DCHAR_SET (result + length, ' ', n);
-                     length += n;
-                   }
-               }
+                          if (count <= 0)
+                            /* mbrtowc not consistent with mbrlen, or mbtowc
+                               not consistent with mblen.  */
+                            abort ();
+                          ENSURE_ALLOCATION (xsum (length, 1));
+                          result[length++] = wc;
+                          arg += count;
+                        }
+                    }
+
+                  if (has_width && width > characters
+                      && (dp->flags & FLAG_LEFT))
+                    {
+                      size_t n = width - characters;
+                      ENSURE_ALLOCATION (xsum (length, n));
+                      DCHAR_SET (result + length, ' ', n);
+                      length += n;
+                    }
+                }
 # else
-               /* %ls in vasnprintf.  See the specification of fprintf.  */
-               {
-                 const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
-                 const wchar_t *arg_end;
-                 size_t characters;
+                /* %ls in vasnprintf.  See the specification of fprintf.  */
+                {
+                  const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
+                  const wchar_t *arg_end;
+                  size_t characters;
 #  if !DCHAR_IS_TCHAR
-                 /* This code assumes that TCHAR_T is 'char'.  */
-                 typedef int TCHAR_T_verify[2 * (sizeof (TCHAR_T) == 1) - 1];
-                 TCHAR_T *tmpsrc;
-                 DCHAR_T *tmpdst;
-                 size_t tmpdst_len;
+                  /* This code assumes that TCHAR_T is 'char'.  */
+                  typedef int TCHAR_T_verify[2 * (sizeof (TCHAR_T) == 1) - 1];
+                  TCHAR_T *tmpsrc;
+                  DCHAR_T *tmpdst;
+                  size_t tmpdst_len;
 #  endif
-                 size_t w;
+                  size_t w;
 
-                 if (has_precision)
-                   {
-                     /* Use only as many wide characters as needed to produce
-                        at most PRECISION bytes, from the left.  */
+                  if (has_precision)
+                    {
+                      /* Use only as many wide characters as needed to produce
+                         at most PRECISION bytes, from the left.  */
 #  if HAVE_WCRTOMB
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #  endif
-                     arg_end = arg;
-                     characters = 0;
-                     while (precision > 0)
-                       {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
-                         int count;
-
-                         if (*arg_end == 0)
-                           /* Found the terminating null wide character.  */
-                           break;
+                      arg_end = arg;
+                      characters = 0;
+                      while (precision > 0)
+                        {
+                          char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                          int count;
+
+                          if (*arg_end == 0)
+                            /* Found the terminating null wide character.  */
+                            break;
 #  if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg_end, &state);
+                          count = wcrtomb (cbuf, *arg_end, &state);
 #  else
-                         count = wctomb (buf, *arg_end);
+                          count = wctomb (cbuf, *arg_end);
 #  endif
-                         if (count < 0)
-                           {
-                             /* Cannot convert.  */
-                             if (!(result == resultbuf || result == NULL))
-                               free (result);
-                             if (buf_malloced != NULL)
-                               free (buf_malloced);
-                             CLEANUP ();
-                             errno = EILSEQ;
-                             return NULL;
-                           }
-                         if (precision < count)
-                           break;
-                         arg_end++;
-                         characters += count;
-                         precision -= count;
-                       }
-                   }
+                          if (count < 0)
+                            {
+                              /* Cannot convert.  */
+                              if (!(result == resultbuf || result == NULL))
+                                free (result);
+                              if (buf_malloced != NULL)
+                                free (buf_malloced);
+                              CLEANUP ();
+                              errno = EILSEQ;
+                              return NULL;
+                            }
+                          if (precision < count)
+                            break;
+                          arg_end++;
+                          characters += count;
+                          precision -= count;
+                        }
+                    }
 #  if DCHAR_IS_TCHAR
-                 else if (has_width)
+                  else if (has_width)
 #  else
-                 else
+                  else
 #  endif
-                   {
-                     /* Use the entire string, and count the number of
-                        bytes.  */
+                    {
+                      /* Use the entire string, and count the number of
+                         bytes.  */
 #  if HAVE_WCRTOMB
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #  endif
-                     arg_end = arg;
-                     characters = 0;
-                     for (;;)
-                       {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
-                         int count;
-
-                         if (*arg_end == 0)
-                           /* Found the terminating null wide character.  */
-                           break;
+                      arg_end = arg;
+                      characters = 0;
+                      for (;;)
+                        {
+                          char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                          int count;
+
+                          if (*arg_end == 0)
+                            /* Found the terminating null wide character.  */
+                            break;
 #  if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg_end, &state);
+                          count = wcrtomb (cbuf, *arg_end, &state);
 #  else
-                         count = wctomb (buf, *arg_end);
+                          count = wctomb (cbuf, *arg_end);
 #  endif
-                         if (count < 0)
-                           {
-                             /* Cannot convert.  */
-                             if (!(result == resultbuf || result == NULL))
-                               free (result);
-                             if (buf_malloced != NULL)
-                               free (buf_malloced);
-                             CLEANUP ();
-                             errno = EILSEQ;
-                             return NULL;
-                           }
-                         arg_end++;
-                         characters += count;
-                       }
-                   }
+                          if (count < 0)
+                            {
+                              /* Cannot convert.  */
+                              if (!(result == resultbuf || result == NULL))
+                                free (result);
+                              if (buf_malloced != NULL)
+                                free (buf_malloced);
+                              CLEANUP ();
+                              errno = EILSEQ;
+                              return NULL;
+                            }
+                          arg_end++;
+                          characters += count;
+                        }
+                    }
 #  if DCHAR_IS_TCHAR
-                 else
-                   {
-                     /* Use the entire string.  */
-                     arg_end = arg + local_wcslen (arg);
-                     /* The number of bytes doesn't matter.  */
-                     characters = 0;
-                   }
+                  else
+                    {
+                      /* Use the entire string.  */
+                      arg_end = arg + local_wcslen (arg);
+                      /* The number of bytes doesn't matter.  */
+                      characters = 0;
+                    }
 #  endif
 
 #  if !DCHAR_IS_TCHAR
-                 /* Convert the string into a piece of temporary memory.  */
-                 tmpsrc = (TCHAR_T *) malloc (characters * sizeof (TCHAR_T));
-                 if (tmpsrc == NULL)
-                   goto out_of_memory;
-                 {
-                   TCHAR_T *tmpptr = tmpsrc;
-                   size_t remaining;
+                  /* Convert the string into a piece of temporary memory.  */
+                  tmpsrc = (TCHAR_T *) malloc (characters * sizeof (TCHAR_T));
+                  if (tmpsrc == NULL)
+                    goto out_of_memory;
+                  {
+                    TCHAR_T *tmpptr = tmpsrc;
+                    size_t remaining;
 #   if HAVE_WCRTOMB
-                   mbstate_t state;
-                   memset (&state, '\0', sizeof (mbstate_t));
+                    mbstate_t state;
+                    memset (&state, '\0', sizeof (mbstate_t));
 #   endif
-                   for (remaining = characters; remaining > 0; )
-                     {
-                       char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
-                       int count;
+                    for (remaining = characters; remaining > 0; )
+                      {
+                        char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                        int count;
 
-                       if (*arg == 0)
-                         abort ();
+                        if (*arg == 0)
+                          abort ();
 #   if HAVE_WCRTOMB
-                       count = wcrtomb (buf, *arg, &state);
+                        count = wcrtomb (cbuf, *arg, &state);
 #   else
-                       count = wctomb (buf, *arg);
+                        count = wctomb (cbuf, *arg);
 #   endif
-                       if (count <= 0)
-                         /* Inconsistency.  */
-                         abort ();
-                       memcpy (tmpptr, buf, count);
-                       tmpptr += count;
-                       arg++;
-                       remaining -= count;
-                     }
-                   if (!(arg == arg_end))
-                     abort ();
-                 }
-
-                 /* Convert from TCHAR_T[] to DCHAR_T[].  */
-                 tmpdst =
-                   DCHAR_CONV_FROM_ENCODING (locale_charset (),
-                                             iconveh_question_mark,
-                                             tmpsrc, characters,
-                                             NULL,
-                                             NULL, &tmpdst_len);
-                 if (tmpdst == NULL)
-                   {
-                     int saved_errno = errno;
-                     free (tmpsrc);
-                     if (!(result == resultbuf || result == NULL))
-                       free (result);
-                     if (buf_malloced != NULL)
-                       free (buf_malloced);
-                     CLEANUP ();
-                     errno = saved_errno;
-                     return NULL;
-                   }
-                 free (tmpsrc);
+                        if (count <= 0)
+                          /* Inconsistency.  */
+                          abort ();
+                        memcpy (tmpptr, cbuf, count);
+                        tmpptr += count;
+                        arg++;
+                        remaining -= count;
+                      }
+                    if (!(arg == arg_end))
+                      abort ();
+                  }
+
+                  /* Convert from TCHAR_T[] to DCHAR_T[].  */
+                  tmpdst =
+                    DCHAR_CONV_FROM_ENCODING (locale_charset (),
+                                              iconveh_question_mark,
+                                              tmpsrc, characters,
+                                              NULL,
+                                              NULL, &tmpdst_len);
+                  if (tmpdst == NULL)
+                    {
+                      int saved_errno = errno;
+                      free (tmpsrc);
+                      if (!(result == resultbuf || result == NULL))
+                        free (result);
+                      if (buf_malloced != NULL)
+                        free (buf_malloced);
+                      CLEANUP ();
+                      errno = saved_errno;
+                      return NULL;
+                    }
+                  free (tmpsrc);
 #  endif
 
-                 if (has_width)
-                   {
+                  if (has_width)
+                    {
 #  if ENABLE_UNISTDIO
-                     /* Outside POSIX, it's preferrable to compare the width
-                        against the number of _characters_ of the converted
-                        value.  */
-                     w = DCHAR_MBSNLEN (result + length, characters);
+                      /* Outside POSIX, it's preferrable to compare the width
+                         against the number of _characters_ of the converted
+                         value.  */
+                      w = DCHAR_MBSNLEN (result + length, characters);
 #  else
-                     /* The width is compared against the number of _bytes_
-                        of the converted value, says POSIX.  */
-                     w = characters;
+                      /* The width is compared against the number of _bytes_
+                         of the converted value, says POSIX.  */
+                      w = characters;
 #  endif
-                   }
-                 else
-                   /* w doesn't matter.  */
-                   w = 0;
-
-                 if (has_width && width > w
-                     && !(dp->flags & FLAG_LEFT))
-                   {
-                     size_t n = width - w;
-                     ENSURE_ALLOCATION (xsum (length, n));
-                     DCHAR_SET (result + length, ' ', n);
-                     length += n;
-                   }
+                    }
+                  else
+                    /* w doesn't matter.  */
+                    w = 0;
+
+                  if (has_width && width > w
+                      && !(dp->flags & FLAG_LEFT))
+                    {
+                      size_t n = width - w;
+                      ENSURE_ALLOCATION (xsum (length, n));
+                      DCHAR_SET (result + length, ' ', n);
+                      length += n;
+                    }
 
 #  if DCHAR_IS_TCHAR
-                 if (has_precision || has_width)
-                   {
-                     /* We know the number of bytes in advance.  */
-                     size_t remaining;
+                  if (has_precision || has_width)
+                    {
+                      /* We know the number of bytes in advance.  */
+                      size_t remaining;
 #   if HAVE_WCRTOMB
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #   endif
-                     ENSURE_ALLOCATION (xsum (length, characters));
-                     for (remaining = characters; remaining > 0; )
-                       {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
-                         int count;
-
-                         if (*arg == 0)
-                           abort ();
+                      ENSURE_ALLOCATION (xsum (length, characters));
+                      for (remaining = characters; remaining > 0; )
+                        {
+                          char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                          int count;
+
+                          if (*arg == 0)
+                            abort ();
 #   if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg, &state);
+                          count = wcrtomb (cbuf, *arg, &state);
 #   else
-                         count = wctomb (buf, *arg);
+                          count = wctomb (cbuf, *arg);
 #   endif
-                         if (count <= 0)
-                           /* Inconsistency.  */
-                           abort ();
-                         memcpy (result + length, buf, count);
-                         length += count;
-                         arg++;
-                         remaining -= count;
-                       }
-                     if (!(arg == arg_end))
-                       abort ();
-                   }
-                 else
-                   {
+                          if (count <= 0)
+                            /* Inconsistency.  */
+                            abort ();
+                          memcpy (result + length, cbuf, count);
+                          length += count;
+                          arg++;
+                          remaining -= count;
+                        }
+                      if (!(arg == arg_end))
+                        abort ();
+                    }
+                  else
+                    {
 #   if HAVE_WCRTOMB
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #   endif
-                     while (arg < arg_end)
-                       {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
-                         int count;
+                      while (arg < arg_end)
+                        {
+                          char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                          int count;
 
-                         if (*arg == 0)
-                           abort ();
+                          if (*arg == 0)
+                            abort ();
 #   if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg, &state);
+                          count = wcrtomb (cbuf, *arg, &state);
 #   else
-                         count = wctomb (buf, *arg);
+                          count = wctomb (cbuf, *arg);
 #   endif
-                         if (count <= 0)
-                           /* Inconsistency.  */
-                           abort ();
-                         ENSURE_ALLOCATION (xsum (length, count));
-                         memcpy (result + length, buf, count);
-                         length += count;
-                         arg++;
-                       }
-                   }
+                          if (count <= 0)
+                            /* Inconsistency.  */
+                            abort ();
+                          ENSURE_ALLOCATION (xsum (length, count));
+                          memcpy (result + length, cbuf, count);
+                          length += count;
+                          arg++;
+                        }
+                    }
 #  else
-                 ENSURE_ALLOCATION (xsum (length, tmpdst_len));
-                 DCHAR_CPY (result + length, tmpdst, tmpdst_len);
-                 free (tmpdst);
-                 length += tmpdst_len;
+                  ENSURE_ALLOCATION (xsum (length, tmpdst_len));
+                  DCHAR_CPY (result + length, tmpdst, tmpdst_len);
+                  free (tmpdst);
+                  length += tmpdst_len;
 #  endif
 
-                 if (has_width && width > w
-                     && (dp->flags & FLAG_LEFT))
-                   {
-                     size_t n = width - w;
-                     ENSURE_ALLOCATION (xsum (length, n));
-                     DCHAR_SET (result + length, ' ', n);
-                     length += n;
-                   }
-               }
-             }
+                  if (has_width && width > w
+                      && (dp->flags & FLAG_LEFT))
+                    {
+                      size_t n = width - w;
+                      ENSURE_ALLOCATION (xsum (length, n));
+                      DCHAR_SET (result + length, ' ', n);
+                      length += n;
+                    }
+                }
+              }
 # endif
 #endif
 #if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) 
&& !defined IN_LIBINTL
-           else if ((dp->conversion == 'a' || dp->conversion == 'A')
+            else if ((dp->conversion == 'a' || dp->conversion == 'A')
 # if !(NEED_PRINTF_DIRECTIVE_A || (NEED_PRINTF_LONG_DOUBLE && 
NEED_PRINTF_DOUBLE))
-                    && (0
+                     && (0
 #  if NEED_PRINTF_DOUBLE
-                        || a.arg[dp->arg_index].type == TYPE_DOUBLE
+                         || a.arg[dp->arg_index].type == TYPE_DOUBLE
 #  endif
 #  if NEED_PRINTF_LONG_DOUBLE
-                        || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
+                         || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
 #  endif
-                       )
+                        )
 # endif
-                   )
-             {
-               arg_type type = a.arg[dp->arg_index].type;
-               int flags = dp->flags;
-               int has_width;
-               size_t width;
-               int has_precision;
-               size_t precision;
-               size_t tmp_length;
-               DCHAR_T tmpbuf[700];
-               DCHAR_T *tmp;
-               DCHAR_T *pad_ptr;
-               DCHAR_T *p;
-
-               has_width = 0;
-               width = 0;
-               if (dp->width_start != dp->width_end)
-                 {
-                   if (dp->width_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->width_arg_index].a.a_int;
-                       if (arg < 0)
-                         {
-                           /* "A negative field width is taken as a '-' flag
-                               followed by a positive field width."  */
-                           flags |= FLAG_LEFT;
-                           width = (unsigned int) (-arg);
-                         }
-                       else
-                         width = arg;
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->width_start;
-
-                       do
-                         width = xsum (xtimes (width, 10), *digitp++ - '0');
-                       while (digitp != dp->width_end);
-                     }
-                   has_width = 1;
-                 }
-
-               has_precision = 0;
-               precision = 0;
-               if (dp->precision_start != dp->precision_end)
-                 {
-                   if (dp->precision_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->precision_arg_index].a.a_int;
-                       /* "A negative precision is taken as if the precision
-                           were omitted."  */
-                       if (arg >= 0)
-                         {
-                           precision = arg;
-                           has_precision = 1;
-                         }
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->precision_start + 1;
-
-                       precision = 0;
-                       while (digitp != dp->precision_end)
-                         precision = xsum (xtimes (precision, 10), *digitp++ - 
'0');
-                       has_precision = 1;
-                     }
-                 }
-
-               /* Allocate a temporary buffer of sufficient size.  */
-               if (type == TYPE_LONGDOUBLE)
-                 tmp_length =
-                   (unsigned int) ((LDBL_DIG + 1)
-                                   * 0.831 /* decimal -> hexadecimal */
-                                  )
-                   + 1; /* turn floor into ceil */
-               else
-                 tmp_length =
-                   (unsigned int) ((DBL_DIG + 1)
-                                   * 0.831 /* decimal -> hexadecimal */
-                                  )
-                   + 1; /* turn floor into ceil */
-               if (tmp_length < precision)
-                 tmp_length = precision;
-               /* Account for sign, decimal point etc. */
-               tmp_length = xsum (tmp_length, 12);
-
-               if (tmp_length < width)
-                 tmp_length = width;
-
-               tmp_length = xsum (tmp_length, 1); /* account for trailing NUL 
*/
-
-               if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
-                 tmp = tmpbuf;
-               else
-                 {
-                   size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
-
-                   if (size_overflow_p (tmp_memsize))
-                     /* Overflow, would lead to out of memory.  */
-                     goto out_of_memory;
-                   tmp = (DCHAR_T *) malloc (tmp_memsize);
-                   if (tmp == NULL)
-                     /* Out of memory.  */
-                     goto out_of_memory;
-                 }
-
-               pad_ptr = NULL;
-               p = tmp;
-               if (type == TYPE_LONGDOUBLE)
-                 {
+                    )
+              {
+                arg_type type = a.arg[dp->arg_index].type;
+                int flags = dp->flags;
+                int has_width;
+                size_t width;
+                int has_precision;
+                size_t precision;
+                size_t tmp_length;
+                DCHAR_T tmpbuf[700];
+                DCHAR_T *tmp;
+                DCHAR_T *pad_ptr;
+                DCHAR_T *p;
+
+                has_width = 0;
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = (unsigned int) (-arg);
+                          }
+                        else
+                          width = arg;
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+                    has_width = 1;
+                  }
+
+                has_precision = 0;
+                precision = 0;
+                if (dp->precision_start != dp->precision_end)
+                  {
+                    if (dp->precision_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->precision_arg_index].a.a_int;
+                        /* "A negative precision is taken as if the precision
+                            were omitted."  */
+                        if (arg >= 0)
+                          {
+                            precision = arg;
+                            has_precision = 1;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->precision_start + 1;
+
+                        precision = 0;
+                        while (digitp != dp->precision_end)
+                          precision = xsum (xtimes (precision, 10), *digitp++ 
- '0');
+                        has_precision = 1;
+                      }
+                  }
+
+                /* Allocate a temporary buffer of sufficient size.  */
+                if (type == TYPE_LONGDOUBLE)
+                  tmp_length =
+                    (unsigned int) ((LDBL_DIG + 1)
+                                    * 0.831 /* decimal -> hexadecimal */
+                                   )
+                    + 1; /* turn floor into ceil */
+                else
+                  tmp_length =
+                    (unsigned int) ((DBL_DIG + 1)
+                                    * 0.831 /* decimal -> hexadecimal */
+                                   )
+                    + 1; /* turn floor into ceil */
+                if (tmp_length < precision)
+                  tmp_length = precision;
+                /* Account for sign, decimal point etc. */
+                tmp_length = xsum (tmp_length, 12);
+
+                if (tmp_length < width)
+                  tmp_length = width;
+
+                tmp_length = xsum (tmp_length, 1); /* account for trailing NUL 
*/
+
+                if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
+                  tmp = tmpbuf;
+                else
+                  {
+                    size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
+
+                    if (size_overflow_p (tmp_memsize))
+                      /* Overflow, would lead to out of memory.  */
+                      goto out_of_memory;
+                    tmp = (DCHAR_T *) malloc (tmp_memsize);
+                    if (tmp == NULL)
+                      /* Out of memory.  */
+                      goto out_of_memory;
+                  }
+
+                pad_ptr = NULL;
+                p = tmp;
+                if (type == TYPE_LONGDOUBLE)
+                  {
 # if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE
-                   long double arg = a.arg[dp->arg_index].a.a_longdouble;
-
-                   if (isnanl (arg))
-                     {
-                       if (dp->conversion == 'A')
-                         {
-                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
-                         }
-                       else
-                         {
-                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
-                         }
-                     }
-                   else
-                     {
-                       int sign = 0;
-                       DECL_LONG_DOUBLE_ROUNDING
-
-                       BEGIN_LONG_DOUBLE_ROUNDING ();
-
-                       if (signbit (arg)) /* arg < 0.0L or negative zero */
-                         {
-                           sign = -1;
-                           arg = -arg;
-                         }
-
-                       if (sign < 0)
-                         *p++ = '-';
-                       else if (flags & FLAG_SHOWSIGN)
-                         *p++ = '+';
-                       else if (flags & FLAG_SPACE)
-                         *p++ = ' ';
-
-                       if (arg > 0.0L && arg + arg == arg)
-                         {
-                           if (dp->conversion == 'A')
-                             {
-                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
-                             }
-                           else
-                             {
-                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
-                             }
-                         }
-                       else
-                         {
-                           int exponent;
-                           long double mantissa;
-
-                           if (arg > 0.0L)
-                             mantissa = printf_frexpl (arg, &exponent);
-                           else
-                             {
-                               exponent = 0;
-                               mantissa = 0.0L;
-                             }
-
-                           if (has_precision
-                               && precision < (unsigned int) ((LDBL_DIG + 1) * 
0.831) + 1)
-                             {
-                               /* Round the mantissa.  */
-                               long double tail = mantissa;
-                               size_t q;
-
-                               for (q = precision; ; q--)
-                                 {
-                                   int digit = (int) tail;
-                                   tail -= digit;
-                                   if (q == 0)
-                                     {
-                                       if (digit & 1 ? tail >= 0.5L : tail > 
0.5L)
-                                         tail = 1 - tail;
-                                       else
-                                         tail = - tail;
-                                       break;
-                                     }
-                                   tail *= 16.0L;
-                                 }
-                               if (tail != 0.0L)
-                                 for (q = precision; q > 0; q--)
-                                   tail *= 0.0625L;
-                               mantissa += tail;
-                             }
-
-                           *p++ = '0';
-                           *p++ = dp->conversion - 'A' + 'X';
-                           pad_ptr = p;
-                           {
-                             int digit;
-
-                             digit = (int) mantissa;
-                             mantissa -= digit;
-                             *p++ = '0' + digit;
-                             if ((flags & FLAG_ALT)
-                                 || mantissa > 0.0L || precision > 0)
-                               {
-                                 *p++ = decimal_point_char ();
-                                 /* This loop terminates because we assume
-                                    that FLT_RADIX is a power of 2.  */
-                                 while (mantissa > 0.0L)
-                                   {
-                                     mantissa *= 16.0L;
-                                     digit = (int) mantissa;
-                                     mantissa -= digit;
-                                     *p++ = digit
-                                            + (digit < 10
-                                               ? '0'
-                                               : dp->conversion - 10);
-                                     if (precision > 0)
-                                       precision--;
-                                   }
-                                 while (precision > 0)
-                                   {
-                                     *p++ = '0';
-                                     precision--;
-                                   }
-                               }
-                             }
-                             *p++ = dp->conversion - 'A' + 'P';
+                    long double arg = a.arg[dp->arg_index].a.a_longdouble;
+
+                    if (isnanl (arg))
+                      {
+                        if (dp->conversion == 'A')
+                          {
+                            *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
+                          }
+                        else
+                          {
+                            *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
+                          }
+                      }
+                    else
+                      {
+                        int sign = 0;
+                        DECL_LONG_DOUBLE_ROUNDING
+
+                        BEGIN_LONG_DOUBLE_ROUNDING ();
+
+                        if (signbit (arg)) /* arg < 0.0L or negative zero */
+                          {
+                            sign = -1;
+                            arg = -arg;
+                          }
+
+                        if (sign < 0)
+                          *p++ = '-';
+                        else if (flags & FLAG_SHOWSIGN)
+                          *p++ = '+';
+                        else if (flags & FLAG_SPACE)
+                          *p++ = ' ';
+
+                        if (arg > 0.0L && arg + arg == arg)
+                          {
+                            if (dp->conversion == 'A')
+                              {
+                                *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
+                              }
+                            else
+                              {
+                                *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
+                              }
+                          }
+                        else
+                          {
+                            int exponent;
+                            long double mantissa;
+
+                            if (arg > 0.0L)
+                              mantissa = printf_frexpl (arg, &exponent);
+                            else
+                              {
+                                exponent = 0;
+                                mantissa = 0.0L;
+                              }
+
+                            if (has_precision
+                                && precision < (unsigned int) ((LDBL_DIG + 1) 
* 0.831) + 1)
+                              {
+                                /* Round the mantissa.  */
+                                long double tail = mantissa;
+                                size_t q;
+
+                                for (q = precision; ; q--)
+                                  {
+                                    int digit = (int) tail;
+                                    tail -= digit;
+                                    if (q == 0)
+                                      {
+                                        if (digit & 1 ? tail >= 0.5L : tail > 
0.5L)
+                                          tail = 1 - tail;
+                                        else
+                                          tail = - tail;
+                                        break;
+                                      }
+                                    tail *= 16.0L;
+                                  }
+                                if (tail != 0.0L)
+                                  for (q = precision; q > 0; q--)
+                                    tail *= 0.0625L;
+                                mantissa += tail;
+                              }
+
+                            *p++ = '0';
+                            *p++ = dp->conversion - 'A' + 'X';
+                            pad_ptr = p;
+                            {
+                              int digit;
+
+                              digit = (int) mantissa;
+                              mantissa -= digit;
+                              *p++ = '0' + digit;
+                              if ((flags & FLAG_ALT)
+                                  || mantissa > 0.0L || precision > 0)
+                                {
+                                  *p++ = decimal_point_char ();
+                                  /* This loop terminates because we assume
+                                     that FLT_RADIX is a power of 2.  */
+                                  while (mantissa > 0.0L)
+                                    {
+                                      mantissa *= 16.0L;
+                                      digit = (int) mantissa;
+                                      mantissa -= digit;
+                                      *p++ = digit
+                                             + (digit < 10
+                                                ? '0'
+                                                : dp->conversion - 10);
+                                      if (precision > 0)
+                                        precision--;
+                                    }
+                                  while (precision > 0)
+                                    {
+                                      *p++ = '0';
+                                      precision--;
+                                    }
+                                }
+                              }
+                              *p++ = dp->conversion - 'A' + 'P';
 #  if WIDE_CHAR_VERSION
-                             {
-                               static const wchar_t decimal_format[] =
-                                 { '%', '+', 'd', '\0' };
-                               SNPRINTF (p, 6 + 1, decimal_format, exponent);
-                             }
-                             while (*p != '\0')
-                               p++;
+                              {
+                                static const wchar_t decimal_format[] =
+                                  { '%', '+', 'd', '\0' };
+                                SNPRINTF (p, 6 + 1, decimal_format, exponent);
+                              }
+                              while (*p != '\0')
+                                p++;
 #  else
-                             if (sizeof (DCHAR_T) == 1)
-                               {
-                                 sprintf ((char *) p, "%+d", exponent);
-                                 while (*p != '\0')
-                                   p++;
-                               }
-                             else
-                               {
-                                 char expbuf[6 + 1];
-                                 const char *ep;
-                                 sprintf (expbuf, "%+d", exponent);
-                                 for (ep = expbuf; (*p = *ep) != '\0'; ep++)
-                                   p++;
-                               }
+                              if (sizeof (DCHAR_T) == 1)
+                                {
+                                  sprintf ((char *) p, "%+d", exponent);
+                                  while (*p != '\0')
+                                    p++;
+                                }
+                              else
+                                {
+                                  char expbuf[6 + 1];
+                                  const char *ep;
+                                  sprintf (expbuf, "%+d", exponent);
+                                  for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+                                    p++;
+                                }
 #  endif
-                         }
+                          }
 
-                       END_LONG_DOUBLE_ROUNDING ();
-                     }
+                        END_LONG_DOUBLE_ROUNDING ();
+                      }
 # else
-                   abort ();
+                    abort ();
 # endif
-                 }
-               else
-                 {
+                  }
+                else
+                  {
 # if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE
-                   double arg = a.arg[dp->arg_index].a.a_double;
-
-                   if (isnand (arg))
-                     {
-                       if (dp->conversion == 'A')
-                         {
-                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
-                         }
-                       else
-                         {
-                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
-                         }
-                     }
-                   else
-                     {
-                       int sign = 0;
-
-                       if (signbit (arg)) /* arg < 0.0 or negative zero */
-                         {
-                           sign = -1;
-                           arg = -arg;
-                         }
-
-                       if (sign < 0)
-                         *p++ = '-';
-                       else if (flags & FLAG_SHOWSIGN)
-                         *p++ = '+';
-                       else if (flags & FLAG_SPACE)
-                         *p++ = ' ';
-
-                       if (arg > 0.0 && arg + arg == arg)
-                         {
-                           if (dp->conversion == 'A')
-                             {
-                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
-                             }
-                           else
-                             {
-                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
-                             }
-                         }
-                       else
-                         {
-                           int exponent;
-                           double mantissa;
-
-                           if (arg > 0.0)
-                             mantissa = printf_frexp (arg, &exponent);
-                           else
-                             {
-                               exponent = 0;
-                               mantissa = 0.0;
-                             }
-
-                           if (has_precision
-                               && precision < (unsigned int) ((DBL_DIG + 1) * 
0.831) + 1)
-                             {
-                               /* Round the mantissa.  */
-                               double tail = mantissa;
-                               size_t q;
-
-                               for (q = precision; ; q--)
-                                 {
-                                   int digit = (int) tail;
-                                   tail -= digit;
-                                   if (q == 0)
-                                     {
-                                       if (digit & 1 ? tail >= 0.5 : tail > 
0.5)
-                                         tail = 1 - tail;
-                                       else
-                                         tail = - tail;
-                                       break;
-                                     }
-                                   tail *= 16.0;
-                                 }
-                               if (tail != 0.0)
-                                 for (q = precision; q > 0; q--)
-                                   tail *= 0.0625;
-                               mantissa += tail;
-                             }
-
-                           *p++ = '0';
-                           *p++ = dp->conversion - 'A' + 'X';
-                           pad_ptr = p;
-                           {
-                             int digit;
-
-                             digit = (int) mantissa;
-                             mantissa -= digit;
-                             *p++ = '0' + digit;
-                             if ((flags & FLAG_ALT)
-                                 || mantissa > 0.0 || precision > 0)
-                               {
-                                 *p++ = decimal_point_char ();
-                                 /* This loop terminates because we assume
-                                    that FLT_RADIX is a power of 2.  */
-                                 while (mantissa > 0.0)
-                                   {
-                                     mantissa *= 16.0;
-                                     digit = (int) mantissa;
-                                     mantissa -= digit;
-                                     *p++ = digit
-                                            + (digit < 10
-                                               ? '0'
-                                               : dp->conversion - 10);
-                                     if (precision > 0)
-                                       precision--;
-                                   }
-                                 while (precision > 0)
-                                   {
-                                     *p++ = '0';
-                                     precision--;
-                                   }
-                               }
-                             }
-                             *p++ = dp->conversion - 'A' + 'P';
+                    double arg = a.arg[dp->arg_index].a.a_double;
+
+                    if (isnand (arg))
+                      {
+                        if (dp->conversion == 'A')
+                          {
+                            *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
+                          }
+                        else
+                          {
+                            *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
+                          }
+                      }
+                    else
+                      {
+                        int sign = 0;
+
+                        if (signbit (arg)) /* arg < 0.0 or negative zero */
+                          {
+                            sign = -1;
+                            arg = -arg;
+                          }
+
+                        if (sign < 0)
+                          *p++ = '-';
+                        else if (flags & FLAG_SHOWSIGN)
+                          *p++ = '+';
+                        else if (flags & FLAG_SPACE)
+                          *p++ = ' ';
+
+                        if (arg > 0.0 && arg + arg == arg)
+                          {
+                            if (dp->conversion == 'A')
+                              {
+                                *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
+                              }
+                            else
+                              {
+                                *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
+                              }
+                          }
+                        else
+                          {
+                            int exponent;
+                            double mantissa;
+
+                            if (arg > 0.0)
+                              mantissa = printf_frexp (arg, &exponent);
+                            else
+                              {
+                                exponent = 0;
+                                mantissa = 0.0;
+                              }
+
+                            if (has_precision
+                                && precision < (unsigned int) ((DBL_DIG + 1) * 
0.831) + 1)
+                              {
+                                /* Round the mantissa.  */
+                                double tail = mantissa;
+                                size_t q;
+
+                                for (q = precision; ; q--)
+                                  {
+                                    int digit = (int) tail;
+                                    tail -= digit;
+                                    if (q == 0)
+                                      {
+                                        if (digit & 1 ? tail >= 0.5 : tail > 
0.5)
+                                          tail = 1 - tail;
+                                        else
+                                          tail = - tail;
+                                        break;
+                                      }
+                                    tail *= 16.0;
+                                  }
+                                if (tail != 0.0)
+                                  for (q = precision; q > 0; q--)
+                                    tail *= 0.0625;
+                                mantissa += tail;
+                              }
+
+                            *p++ = '0';
+                            *p++ = dp->conversion - 'A' + 'X';
+                            pad_ptr = p;
+                            {
+                              int digit;
+
+                              digit = (int) mantissa;
+                              mantissa -= digit;
+                              *p++ = '0' + digit;
+                              if ((flags & FLAG_ALT)
+                                  || mantissa > 0.0 || precision > 0)
+                                {
+                                  *p++ = decimal_point_char ();
+                                  /* This loop terminates because we assume
+                                     that FLT_RADIX is a power of 2.  */
+                                  while (mantissa > 0.0)
+                                    {
+                                      mantissa *= 16.0;
+                                      digit = (int) mantissa;
+                                      mantissa -= digit;
+                                      *p++ = digit
+                                             + (digit < 10
+                                                ? '0'
+                                                : dp->conversion - 10);
+                                      if (precision > 0)
+                                        precision--;
+                                    }
+                                  while (precision > 0)
+                                    {
+                                      *p++ = '0';
+                                      precision--;
+                                    }
+                                }
+                              }
+                              *p++ = dp->conversion - 'A' + 'P';
 #  if WIDE_CHAR_VERSION
-                             {
-                               static const wchar_t decimal_format[] =
-                                 { '%', '+', 'd', '\0' };
-                               SNPRINTF (p, 6 + 1, decimal_format, exponent);
-                             }
-                             while (*p != '\0')
-                               p++;
+                              {
+                                static const wchar_t decimal_format[] =
+                                  { '%', '+', 'd', '\0' };
+                                SNPRINTF (p, 6 + 1, decimal_format, exponent);
+                              }
+                              while (*p != '\0')
+                                p++;
 #  else
-                             if (sizeof (DCHAR_T) == 1)
-                               {
-                                 sprintf ((char *) p, "%+d", exponent);
-                                 while (*p != '\0')
-                                   p++;
-                               }
-                             else
-                               {
-                                 char expbuf[6 + 1];
-                                 const char *ep;
-                                 sprintf (expbuf, "%+d", exponent);
-                                 for (ep = expbuf; (*p = *ep) != '\0'; ep++)
-                                   p++;
-                               }
+                              if (sizeof (DCHAR_T) == 1)
+                                {
+                                  sprintf ((char *) p, "%+d", exponent);
+                                  while (*p != '\0')
+                                    p++;
+                                }
+                              else
+                                {
+                                  char expbuf[6 + 1];
+                                  const char *ep;
+                                  sprintf (expbuf, "%+d", exponent);
+                                  for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+                                    p++;
+                                }
 #  endif
-                         }
-                     }
+                          }
+                      }
 # else
-                   abort ();
+                    abort ();
 # endif
-                 }
-               /* The generated string now extends from tmp to p, with the
-                  zero padding insertion point being at pad_ptr.  */
-               if (has_width && p - tmp < width)
-                 {
-                   size_t pad = width - (p - tmp);
-                   DCHAR_T *end = p + pad;
-
-                   if (flags & FLAG_LEFT)
-                     {
-                       /* Pad with spaces on the right.  */
-                       for (; pad > 0; pad--)
-                         *p++ = ' ';
-                     }
-                   else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
-                     {
-                       /* Pad with zeroes.  */
-                       DCHAR_T *q = end;
-
-                       while (p > pad_ptr)
-                         *--q = *--p;
-                       for (; pad > 0; pad--)
-                         *p++ = '0';
-                     }
-                   else
-                     {
-                       /* Pad with spaces on the left.  */
-                       DCHAR_T *q = end;
-
-                       while (p > tmp)
-                         *--q = *--p;
-                       for (; pad > 0; pad--)
-                         *p++ = ' ';
-                     }
-
-                   p = end;
-                 }
-
-               {
-                 size_t count = p - tmp;
-
-                 if (count >= tmp_length)
-                   /* tmp_length was incorrectly calculated - fix the
-                      code above!  */
-                   abort ();
-
-                 /* Make room for the result.  */
-                 if (count >= allocated - length)
-                   {
-                     size_t n = xsum (length, count);
-
-                     ENSURE_ALLOCATION (n);
-                   }
-
-                 /* Append the result.  */
-                 memcpy (result + length, tmp, count * sizeof (DCHAR_T));
-                 if (tmp != tmpbuf)
-                   free (tmp);
-                 length += count;
-               }
-             }
+                  }
+                /* The generated string now extends from tmp to p, with the
+                   zero padding insertion point being at pad_ptr.  */
+                if (has_width && p - tmp < width)
+                  {
+                    size_t pad = width - (p - tmp);
+                    DCHAR_T *end = p + pad;
+
+                    if (flags & FLAG_LEFT)
+                      {
+                        /* Pad with spaces on the right.  */
+                        for (; pad > 0; pad--)
+                          *p++ = ' ';
+                      }
+                    else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
+                      {
+                        /* Pad with zeroes.  */
+                        DCHAR_T *q = end;
+
+                        while (p > pad_ptr)
+                          *--q = *--p;
+                        for (; pad > 0; pad--)
+                          *p++ = '0';
+                      }
+                    else
+                      {
+                        /* Pad with spaces on the left.  */
+                        DCHAR_T *q = end;
+
+                        while (p > tmp)
+                          *--q = *--p;
+                        for (; pad > 0; pad--)
+                          *p++ = ' ';
+                      }
+
+                    p = end;
+                  }
+
+                {
+                  size_t count = p - tmp;
+
+                  if (count >= tmp_length)
+                    /* tmp_length was incorrectly calculated - fix the
+                       code above!  */
+                    abort ();
+
+                  /* Make room for the result.  */
+                  if (count >= allocated - length)
+                    {
+                      size_t n = xsum (length, count);
+
+                      ENSURE_ALLOCATION (n);
+                    }
+
+                  /* Append the result.  */
+                  memcpy (result + length, tmp, count * sizeof (DCHAR_T));
+                  if (tmp != tmpbuf)
+                    free (tmp);
+                  length += count;
+                }
+              }
 #endif
 #if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_DOUBLE || 
NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined 
IN_LIBINTL
-           else if ((dp->conversion == 'f' || dp->conversion == 'F'
-                     || dp->conversion == 'e' || dp->conversion == 'E'
-                     || dp->conversion == 'g' || dp->conversion == 'G'
-                     || dp->conversion == 'a' || dp->conversion == 'A')
-                    && (0
+            else if ((dp->conversion == 'f' || dp->conversion == 'F'
+                      || dp->conversion == 'e' || dp->conversion == 'E'
+                      || dp->conversion == 'g' || dp->conversion == 'G'
+                      || dp->conversion == 'a' || dp->conversion == 'A')
+                     && (0
 # if NEED_PRINTF_DOUBLE
-                        || a.arg[dp->arg_index].type == TYPE_DOUBLE
+                         || a.arg[dp->arg_index].type == TYPE_DOUBLE
 # elif NEED_PRINTF_INFINITE_DOUBLE
-                        || (a.arg[dp->arg_index].type == TYPE_DOUBLE
-                            /* The systems (mingw) which produce wrong output
-                               for Inf, -Inf, and NaN also do so for -0.0.
-                               Therefore we treat this case here as well.  */
-                            && is_infinite_or_zero 
(a.arg[dp->arg_index].a.a_double))
+                         || (a.arg[dp->arg_index].type == TYPE_DOUBLE
+                             /* The systems (mingw) which produce wrong output
+                                for Inf, -Inf, and NaN also do so for -0.0.
+                                Therefore we treat this case here as well.  */
+                             && is_infinite_or_zero 
(a.arg[dp->arg_index].a.a_double))
 # endif
 # if NEED_PRINTF_LONG_DOUBLE
-                        || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
+                         || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
 # elif NEED_PRINTF_INFINITE_LONG_DOUBLE
-                        || (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
-                            /* Some systems produce wrong output for Inf,
-                               -Inf, and NaN.  Some systems in this category
-                               (IRIX 5.3) also do so for -0.0.  Therefore we
-                               treat this case here as well.  */
-                            && is_infinite_or_zerol 
(a.arg[dp->arg_index].a.a_longdouble))
+                         || (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
+                             /* Some systems produce wrong output for Inf,
+                                -Inf, and NaN.  Some systems in this category
+                                (IRIX 5.3) also do so for -0.0.  Therefore we
+                                treat this case here as well.  */
+                             && is_infinite_or_zerol 
(a.arg[dp->arg_index].a.a_longdouble))
 # endif
-                       ))
-             {
+                        ))
+              {
 # if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && 
(NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE)
-               arg_type type = a.arg[dp->arg_index].type;
+                arg_type type = a.arg[dp->arg_index].type;
 # endif
-               int flags = dp->flags;
-               int has_width;
-               size_t width;
-               int has_precision;
-               size_t precision;
-               size_t tmp_length;
-               DCHAR_T tmpbuf[700];
-               DCHAR_T *tmp;
-               DCHAR_T *pad_ptr;
-               DCHAR_T *p;
-
-               has_width = 0;
-               width = 0;
-               if (dp->width_start != dp->width_end)
-                 {
-                   if (dp->width_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->width_arg_index].a.a_int;
-                       if (arg < 0)
-                         {
-                           /* "A negative field width is taken as a '-' flag
-                               followed by a positive field width."  */
-                           flags |= FLAG_LEFT;
-                           width = (unsigned int) (-arg);
-                         }
-                       else
-                         width = arg;
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->width_start;
-
-                       do
-                         width = xsum (xtimes (width, 10), *digitp++ - '0');
-                       while (digitp != dp->width_end);
-                     }
-                   has_width = 1;
-                 }
-
-               has_precision = 0;
-               precision = 0;
-               if (dp->precision_start != dp->precision_end)
-                 {
-                   if (dp->precision_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->precision_arg_index].a.a_int;
-                       /* "A negative precision is taken as if the precision
-                           were omitted."  */
-                       if (arg >= 0)
-                         {
-                           precision = arg;
-                           has_precision = 1;
-                         }
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->precision_start + 1;
-
-                       precision = 0;
-                       while (digitp != dp->precision_end)
-                         precision = xsum (xtimes (precision, 10), *digitp++ - 
'0');
-                       has_precision = 1;
-                     }
-                 }
-
-               /* POSIX specifies the default precision to be 6 for %f, %F,
-                  %e, %E, but not for %g, %G.  Implementations appear to use
-                  the same default precision also for %g, %G.  But for %a, %A,
-                  the default precision is 0.  */
-               if (!has_precision)
-                 if (!(dp->conversion == 'a' || dp->conversion == 'A'))
-                   precision = 6;
-
-               /* Allocate a temporary buffer of sufficient size.  */
+                int flags = dp->flags;
+                int has_width;
+                size_t width;
+                int has_precision;
+                size_t precision;
+                size_t tmp_length;
+                DCHAR_T tmpbuf[700];
+                DCHAR_T *tmp;
+                DCHAR_T *pad_ptr;
+                DCHAR_T *p;
+
+                has_width = 0;
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = (unsigned int) (-arg);
+                          }
+                        else
+                          width = arg;
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+                    has_width = 1;
+                  }
+
+                has_precision = 0;
+                precision = 0;
+                if (dp->precision_start != dp->precision_end)
+                  {
+                    if (dp->precision_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->precision_arg_index].a.a_int;
+                        /* "A negative precision is taken as if the precision
+                            were omitted."  */
+                        if (arg >= 0)
+                          {
+                            precision = arg;
+                            has_precision = 1;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->precision_start + 1;
+
+                        precision = 0;
+                        while (digitp != dp->precision_end)
+                          precision = xsum (xtimes (precision, 10), *digitp++ 
- '0');
+                        has_precision = 1;
+                      }
+                  }
+
+                /* POSIX specifies the default precision to be 6 for %f, %F,
+                   %e, %E, but not for %g, %G.  Implementations appear to use
+                   the same default precision also for %g, %G.  But for %a, %A,
+                   the default precision is 0.  */
+                if (!has_precision)
+                  if (!(dp->conversion == 'a' || dp->conversion == 'A'))
+                    precision = 6;
+
+                /* Allocate a temporary buffer of sufficient size.  */
 # if NEED_PRINTF_DOUBLE && NEED_PRINTF_LONG_DOUBLE
-               tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : DBL_DIG 
+ 1);
+                tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : DBL_DIG 
+ 1);
 # elif NEED_PRINTF_INFINITE_DOUBLE && NEED_PRINTF_LONG_DOUBLE
-               tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : 0);
+                tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : 0);
 # elif NEED_PRINTF_LONG_DOUBLE
-               tmp_length = LDBL_DIG + 1;
+                tmp_length = LDBL_DIG + 1;
 # elif NEED_PRINTF_DOUBLE
-               tmp_length = DBL_DIG + 1;
+                tmp_length = DBL_DIG + 1;
 # else
-               tmp_length = 0;
+                tmp_length = 0;
 # endif
-               if (tmp_length < precision)
-                 tmp_length = precision;
+                if (tmp_length < precision)
+                  tmp_length = precision;
 # if NEED_PRINTF_LONG_DOUBLE
 #  if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
-               if (type == TYPE_LONGDOUBLE)
+                if (type == TYPE_LONGDOUBLE)
 #  endif
-                 if (dp->conversion == 'f' || dp->conversion == 'F')
-                   {
-                     long double arg = a.arg[dp->arg_index].a.a_longdouble;
-                     if (!(isnanl (arg) || arg + arg == arg))
-                       {
-                         /* arg is finite and nonzero.  */
-                         int exponent = floorlog10l (arg < 0 ? -arg : arg);
-                         if (exponent >= 0 && tmp_length < exponent + 
precision)
-                           tmp_length = exponent + precision;
-                       }
-                   }
+                  if (dp->conversion == 'f' || dp->conversion == 'F')
+                    {
+                      long double arg = a.arg[dp->arg_index].a.a_longdouble;
+                      if (!(isnanl (arg) || arg + arg == arg))
+                        {
+                          /* arg is finite and nonzero.  */
+                          int exponent = floorlog10l (arg < 0 ? -arg : arg);
+                          if (exponent >= 0 && tmp_length < exponent + 
precision)
+                            tmp_length = exponent + precision;
+                        }
+                    }
 # endif
 # if NEED_PRINTF_DOUBLE
 #  if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE
-               if (type == TYPE_DOUBLE)
+                if (type == TYPE_DOUBLE)
 #  endif
-                 if (dp->conversion == 'f' || dp->conversion == 'F')
-                   {
-                     double arg = a.arg[dp->arg_index].a.a_double;
-                     if (!(isnand (arg) || arg + arg == arg))
-                       {
-                         /* arg is finite and nonzero.  */
-                         int exponent = floorlog10 (arg < 0 ? -arg : arg);
-                         if (exponent >= 0 && tmp_length < exponent + 
precision)
-                           tmp_length = exponent + precision;
-                       }
-                   }
+                  if (dp->conversion == 'f' || dp->conversion == 'F')
+                    {
+                      double arg = a.arg[dp->arg_index].a.a_double;
+                      if (!(isnand (arg) || arg + arg == arg))
+                        {
+                          /* arg is finite and nonzero.  */
+                          int exponent = floorlog10 (arg < 0 ? -arg : arg);
+                          if (exponent >= 0 && tmp_length < exponent + 
precision)
+                            tmp_length = exponent + precision;
+                        }
+                    }
 # endif
-               /* Account for sign, decimal point etc. */
-               tmp_length = xsum (tmp_length, 12);
+                /* Account for sign, decimal point etc. */
+                tmp_length = xsum (tmp_length, 12);
 
-               if (tmp_length < width)
-                 tmp_length = width;
+                if (tmp_length < width)
+                  tmp_length = width;
 
-               tmp_length = xsum (tmp_length, 1); /* account for trailing NUL 
*/
+                tmp_length = xsum (tmp_length, 1); /* account for trailing NUL 
*/
 
-               if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
-                 tmp = tmpbuf;
-               else
-                 {
-                   size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
+                if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
+                  tmp = tmpbuf;
+                else
+                  {
+                    size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
 
-                   if (size_overflow_p (tmp_memsize))
-                     /* Overflow, would lead to out of memory.  */
-                     goto out_of_memory;
-                   tmp = (DCHAR_T *) malloc (tmp_memsize);
-                   if (tmp == NULL)
-                     /* Out of memory.  */
-                     goto out_of_memory;
-                 }
+                    if (size_overflow_p (tmp_memsize))
+                      /* Overflow, would lead to out of memory.  */
+                      goto out_of_memory;
+                    tmp = (DCHAR_T *) malloc (tmp_memsize);
+                    if (tmp == NULL)
+                      /* Out of memory.  */
+                      goto out_of_memory;
+                  }
 
-               pad_ptr = NULL;
-               p = tmp;
+                pad_ptr = NULL;
+                p = tmp;
 
 # if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE
 #  if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
-               if (type == TYPE_LONGDOUBLE)
+                if (type == TYPE_LONGDOUBLE)
 #  endif
-                 {
-                   long double arg = a.arg[dp->arg_index].a.a_longdouble;
-
-                   if (isnanl (arg))
-                     {
-                       if (dp->conversion >= 'A' && dp->conversion <= 'Z')
-                         {
-                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
-                         }
-                       else
-                         {
-                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
-                         }
-                     }
-                   else
-                     {
-                       int sign = 0;
-                       DECL_LONG_DOUBLE_ROUNDING
-
-                       BEGIN_LONG_DOUBLE_ROUNDING ();
-
-                       if (signbit (arg)) /* arg < 0.0L or negative zero */
-                         {
-                           sign = -1;
-                           arg = -arg;
-                         }
-
-                       if (sign < 0)
-                         *p++ = '-';
-                       else if (flags & FLAG_SHOWSIGN)
-                         *p++ = '+';
-                       else if (flags & FLAG_SPACE)
-                         *p++ = ' ';
-
-                       if (arg > 0.0L && arg + arg == arg)
-                         {
-                           if (dp->conversion >= 'A' && dp->conversion <= 'Z')
-                             {
-                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
-                             }
-                           else
-                             {
-                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
-                             }
-                         }
-                       else
-                         {
+                  {
+                    long double arg = a.arg[dp->arg_index].a.a_longdouble;
+
+                    if (isnanl (arg))
+                      {
+                        if (dp->conversion >= 'A' && dp->conversion <= 'Z')
+                          {
+                            *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
+                          }
+                        else
+                          {
+                            *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
+                          }
+                      }
+                    else
+                      {
+                        int sign = 0;
+                        DECL_LONG_DOUBLE_ROUNDING
+
+                        BEGIN_LONG_DOUBLE_ROUNDING ();
+
+                        if (signbit (arg)) /* arg < 0.0L or negative zero */
+                          {
+                            sign = -1;
+                            arg = -arg;
+                          }
+
+                        if (sign < 0)
+                          *p++ = '-';
+                        else if (flags & FLAG_SHOWSIGN)
+                          *p++ = '+';
+                        else if (flags & FLAG_SPACE)
+                          *p++ = ' ';
+
+                        if (arg > 0.0L && arg + arg == arg)
+                          {
+                            if (dp->conversion >= 'A' && dp->conversion <= 'Z')
+                              {
+                                *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
+                              }
+                            else
+                              {
+                                *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
+                              }
+                          }
+                        else
+                          {
 #  if NEED_PRINTF_LONG_DOUBLE
-                           pad_ptr = p;
-
-                           if (dp->conversion == 'f' || dp->conversion == 'F')
-                             {
-                               char *digits;
-                               size_t ndigits;
-
-                               digits =
-                                 scale10_round_decimal_long_double (arg, 
precision);
-                               if (digits == NULL)
-                                 {
-                                   END_LONG_DOUBLE_ROUNDING ();
-                                   goto out_of_memory;
-                                 }
-                               ndigits = strlen (digits);
-
-                               if (ndigits > precision)
-                                 do
-                                   {
-                                     --ndigits;
-                                     *p++ = digits[ndigits];
-                                   }
-                                 while (ndigits > precision);
-                               else
-                                 *p++ = '0';
-                               /* Here ndigits <= precision.  */
-                               if ((flags & FLAG_ALT) || precision > 0)
-                                 {
-                                   *p++ = decimal_point_char ();
-                                   for (; precision > ndigits; precision--)
-                                     *p++ = '0';
-                                   while (ndigits > 0)
-                                     {
-                                       --ndigits;
-                                       *p++ = digits[ndigits];
-                                     }
-                                 }
-
-                               free (digits);
-                             }
-                           else if (dp->conversion == 'e' || dp->conversion == 
'E')
-                             {
-                               int exponent;
-
-                               if (arg == 0.0L)
-                                 {
-                                   exponent = 0;
-                                   *p++ = '0';
-                                   if ((flags & FLAG_ALT) || precision > 0)
-                                     {
-                                       *p++ = decimal_point_char ();
-                                       for (; precision > 0; precision--)
-                                         *p++ = '0';
-                                     }
-                                 }
-                               else
-                                 {
-                                   /* arg > 0.0L.  */
-                                   int adjusted;
-                                   char *digits;
-                                   size_t ndigits;
-
-                                   exponent = floorlog10l (arg);
-                                   adjusted = 0;
-                                   for (;;)
-                                     {
-                                       digits =
-                                         scale10_round_decimal_long_double 
(arg,
-                                                                            
(int)precision - exponent);
-                                       if (digits == NULL)
-                                         {
-                                           END_LONG_DOUBLE_ROUNDING ();
-                                           goto out_of_memory;
-                                         }
-                                       ndigits = strlen (digits);
-
-                                       if (ndigits == precision + 1)
-                                         break;
-                                       if (ndigits < precision
-                                           || ndigits > precision + 2)
-                                         /* The exponent was not guessed
-                                            precisely enough.  */
-                                         abort ();
-                                       if (adjusted)
-                                         /* None of two values of exponent is
-                                            the right one.  Prevent an endless
-                                            loop.  */
-                                         abort ();
-                                       free (digits);
-                                       if (ndigits == precision)
-                                         exponent -= 1;
-                                       else
-                                         exponent += 1;
-                                       adjusted = 1;
-                                     }
-                                   /* Here ndigits = precision+1.  */
-                                   if (is_borderline (digits, precision))
-                                     {
-                                       /* Maybe the exponent guess was too high
-                                          and a smaller exponent can be reached
-                                          by turning a 10...0 into 9...9x.  */
-                                       char *digits2 =
-                                         scale10_round_decimal_long_double 
(arg,
-                                                                            
(int)precision - exponent + 1);
-                                       if (digits2 == NULL)
-                                         {
-                                           free (digits);
-                                           END_LONG_DOUBLE_ROUNDING ();
-                                           goto out_of_memory;
-                                         }
-                                       if (strlen (digits2) == precision + 1)
-                                         {
-                                           free (digits);
-                                           digits = digits2;
-                                           exponent -= 1;
-                                         }
-                                       else
-                                         free (digits2);
-                                     }
-                                   /* Here ndigits = precision+1.  */
-
-                                   *p++ = digits[--ndigits];
-                                   if ((flags & FLAG_ALT) || precision > 0)
-                                     {
-                                       *p++ = decimal_point_char ();
-                                       while (ndigits > 0)
-                                         {
-                                           --ndigits;
-                                           *p++ = digits[ndigits];
-                                         }
-                                     }
-
-                                   free (digits);
-                                 }
-
-                               *p++ = dp->conversion; /* 'e' or 'E' */
+                            pad_ptr = p;
+
+                            if (dp->conversion == 'f' || dp->conversion == 'F')
+                              {
+                                char *digits;
+                                size_t ndigits;
+
+                                digits =
+                                  scale10_round_decimal_long_double (arg, 
precision);
+                                if (digits == NULL)
+                                  {
+                                    END_LONG_DOUBLE_ROUNDING ();
+                                    goto out_of_memory;
+                                  }
+                                ndigits = strlen (digits);
+
+                                if (ndigits > precision)
+                                  do
+                                    {
+                                      --ndigits;
+                                      *p++ = digits[ndigits];
+                                    }
+                                  while (ndigits > precision);
+                                else
+                                  *p++ = '0';
+                                /* Here ndigits <= precision.  */
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > ndigits; precision--)
+                                      *p++ = '0';
+                                    while (ndigits > 0)
+                                      {
+                                        --ndigits;
+                                        *p++ = digits[ndigits];
+                                      }
+                                  }
+
+                                free (digits);
+                              }
+                            else if (dp->conversion == 'e' || dp->conversion 
== 'E')
+                              {
+                                int exponent;
+
+                                if (arg == 0.0L)
+                                  {
+                                    exponent = 0;
+                                    *p++ = '0';
+                                    if ((flags & FLAG_ALT) || precision > 0)
+                                      {
+                                        *p++ = decimal_point_char ();
+                                        for (; precision > 0; precision--)
+                                          *p++ = '0';
+                                      }
+                                  }
+                                else
+                                  {
+                                    /* arg > 0.0L.  */
+                                    int adjusted;
+                                    char *digits;
+                                    size_t ndigits;
+
+                                    exponent = floorlog10l (arg);
+                                    adjusted = 0;
+                                    for (;;)
+                                      {
+                                        digits =
+                                          scale10_round_decimal_long_double 
(arg,
+                                                                             
(int)precision - exponent);
+                                        if (digits == NULL)
+                                          {
+                                            END_LONG_DOUBLE_ROUNDING ();
+                                            goto out_of_memory;
+                                          }
+                                        ndigits = strlen (digits);
+
+                                        if (ndigits == precision + 1)
+                                          break;
+                                        if (ndigits < precision
+                                            || ndigits > precision + 2)
+                                          /* The exponent was not guessed
+                                             precisely enough.  */
+                                          abort ();
+                                        if (adjusted)
+                                          /* None of two values of exponent is
+                                             the right one.  Prevent an endless
+                                             loop.  */
+                                          abort ();
+                                        free (digits);
+                                        if (ndigits == precision)
+                                          exponent -= 1;
+                                        else
+                                          exponent += 1;
+                                        adjusted = 1;
+                                      }
+                                    /* Here ndigits = precision+1.  */
+                                    if (is_borderline (digits, precision))
+                                      {
+                                        /* Maybe the exponent guess was too 
high
+                                           and a smaller exponent can be 
reached
+                                           by turning a 10...0 into 9...9x.  */
+                                        char *digits2 =
+                                          scale10_round_decimal_long_double 
(arg,
+                                                                             
(int)precision - exponent + 1);
+                                        if (digits2 == NULL)
+                                          {
+                                            free (digits);
+                                            END_LONG_DOUBLE_ROUNDING ();
+                                            goto out_of_memory;
+                                          }
+                                        if (strlen (digits2) == precision + 1)
+                                          {
+                                            free (digits);
+                                            digits = digits2;
+                                            exponent -= 1;
+                                          }
+                                        else
+                                          free (digits2);
+                                      }
+                                    /* Here ndigits = precision+1.  */
+
+                                    *p++ = digits[--ndigits];
+                                    if ((flags & FLAG_ALT) || precision > 0)
+                                      {
+                                        *p++ = decimal_point_char ();
+                                        while (ndigits > 0)
+                                          {
+                                            --ndigits;
+                                            *p++ = digits[ndigits];
+                                          }
+                                      }
+
+                                    free (digits);
+                                  }
+
+                                *p++ = dp->conversion; /* 'e' or 'E' */
 #   if WIDE_CHAR_VERSION
-                               {
-                                 static const wchar_t decimal_format[] =
-                                   { '%', '+', '.', '2', 'd', '\0' };
-                                 SNPRINTF (p, 6 + 1, decimal_format, exponent);
-                               }
-                               while (*p != '\0')
-                                 p++;
+                                {
+                                  static const wchar_t decimal_format[] =
+                                    { '%', '+', '.', '2', 'd', '\0' };
+                                  SNPRINTF (p, 6 + 1, decimal_format, 
exponent);
+                                }
+                                while (*p != '\0')
+                                  p++;
 #   else
-                               if (sizeof (DCHAR_T) == 1)
-                                 {
-                                   sprintf ((char *) p, "%+.2d", exponent);
-                                   while (*p != '\0')
-                                     p++;
-                                 }
-                               else
-                                 {
-                                   char expbuf[6 + 1];
-                                   const char *ep;
-                                   sprintf (expbuf, "%+.2d", exponent);
-                                   for (ep = expbuf; (*p = *ep) != '\0'; ep++)
-                                     p++;
-                                 }
+                                if (sizeof (DCHAR_T) == 1)
+                                  {
+                                    sprintf ((char *) p, "%+.2d", exponent);
+                                    while (*p != '\0')
+                                      p++;
+                                  }
+                                else
+                                  {
+                                    char expbuf[6 + 1];
+                                    const char *ep;
+                                    sprintf (expbuf, "%+.2d", exponent);
+                                    for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+                                      p++;
+                                  }
 #   endif
-                             }
-                           else if (dp->conversion == 'g' || dp->conversion == 
'G')
-                             {
-                               if (precision == 0)
-                                 precision = 1;
-                               /* precision >= 1.  */
-
-                               if (arg == 0.0L)
-                                 /* The exponent is 0, >= -4, < precision.
-                                    Use fixed-point notation.  */
-                                 {
-                                   size_t ndigits = precision;
-                                   /* Number of trailing zeroes that have to be
-                                      dropped.  */
-                                   size_t nzeroes =
-                                     (flags & FLAG_ALT ? 0 : precision - 1);
-
-                                   --ndigits;
-                                   *p++ = '0';
-                                   if ((flags & FLAG_ALT) || ndigits > nzeroes)
-                                     {
-                                       *p++ = decimal_point_char ();
-                                       while (ndigits > nzeroes)
-                                         {
-                                           --ndigits;
-                                           *p++ = '0';
-                                         }
-                                     }
-                                 }
-                               else
-                                 {
-                                   /* arg > 0.0L.  */
-                                   int exponent;
-                                   int adjusted;
-                                   char *digits;
-                                   size_t ndigits;
-                                   size_t nzeroes;
-
-                                   exponent = floorlog10l (arg);
-                                   adjusted = 0;
-                                   for (;;)
-                                     {
-                                       digits =
-                                         scale10_round_decimal_long_double 
(arg,
-                                                                            
(int)(precision - 1) - exponent);
-                                       if (digits == NULL)
-                                         {
-                                           END_LONG_DOUBLE_ROUNDING ();
-                                           goto out_of_memory;
-                                         }
-                                       ndigits = strlen (digits);
-
-                                       if (ndigits == precision)
-                                         break;
-                                       if (ndigits < precision - 1
-                                           || ndigits > precision + 1)
-                                         /* The exponent was not guessed
-                                            precisely enough.  */
-                                         abort ();
-                                       if (adjusted)
-                                         /* None of two values of exponent is
-                                            the right one.  Prevent an endless
-                                            loop.  */
-                                         abort ();
-                                       free (digits);
-                                       if (ndigits < precision)
-                                         exponent -= 1;
-                                       else
-                                         exponent += 1;
-                                       adjusted = 1;
-                                     }
-                                   /* Here ndigits = precision.  */
-                                   if (is_borderline (digits, precision - 1))
-                                     {
-                                       /* Maybe the exponent guess was too high
-                                          and a smaller exponent can be reached
-                                          by turning a 10...0 into 9...9x.  */
-                                       char *digits2 =
-                                         scale10_round_decimal_long_double 
(arg,
-                                                                            
(int)(precision - 1) - exponent + 1);
-                                       if (digits2 == NULL)
-                                         {
-                                           free (digits);
-                                           END_LONG_DOUBLE_ROUNDING ();
-                                           goto out_of_memory;
-                                         }
-                                       if (strlen (digits2) == precision)
-                                         {
-                                           free (digits);
-                                           digits = digits2;
-                                           exponent -= 1;
-                                         }
-                                       else
-                                         free (digits2);
-                                     }
-                                   /* Here ndigits = precision.  */
-
-                                   /* Determine the number of trailing zeroes
-                                      that have to be dropped.  */
-                                   nzeroes = 0;
-                                   if ((flags & FLAG_ALT) == 0)
-                                     while (nzeroes < ndigits
-                                            && digits[nzeroes] == '0')
-                                       nzeroes++;
-
-                                   /* The exponent is now determined.  */
-                                   if (exponent >= -4
-                                       && exponent < (long)precision)
-                                     {
-                                       /* Fixed-point notation:
-                                          max(exponent,0)+1 digits, then the
-                                          decimal point, then the remaining
-                                          digits without trailing zeroes.  */
-                                       if (exponent >= 0)
-                                         {
-                                           size_t count = exponent + 1;
-                                           /* Note: count <= precision = 
ndigits.  */
-                                           for (; count > 0; count--)
-                                             *p++ = digits[--ndigits];
-                                           if ((flags & FLAG_ALT) || ndigits > 
nzeroes)
-                                             {
-                                               *p++ = decimal_point_char ();
-                                               while (ndigits > nzeroes)
-                                                 {
-                                                   --ndigits;
-                                                   *p++ = digits[ndigits];
-                                                 }
-                                             }
-                                         }
-                                       else
-                                         {
-                                           size_t count = -exponent - 1;
-                                           *p++ = '0';
-                                           *p++ = decimal_point_char ();
-                                           for (; count > 0; count--)
-                                             *p++ = '0';
-                                           while (ndigits > nzeroes)
-                                             {
-                                               --ndigits;
-                                               *p++ = digits[ndigits];
-                                             }
-                                         }
-                                     }
-                                   else
-                                     {
-                                       /* Exponential notation.  */
-                                       *p++ = digits[--ndigits];
-                                       if ((flags & FLAG_ALT) || ndigits > 
nzeroes)
-                                         {
-                                           *p++ = decimal_point_char ();
-                                           while (ndigits > nzeroes)
-                                             {
-                                               --ndigits;
-                                               *p++ = digits[ndigits];
-                                             }
-                                         }
-                                       *p++ = dp->conversion - 'G' + 'E'; /* 
'e' or 'E' */
+                              }
+                            else if (dp->conversion == 'g' || dp->conversion 
== 'G')
+                              {
+                                if (precision == 0)
+                                  precision = 1;
+                                /* precision >= 1.  */
+
+                                if (arg == 0.0L)
+                                  /* The exponent is 0, >= -4, < precision.
+                                     Use fixed-point notation.  */
+                                  {
+                                    size_t ndigits = precision;
+                                    /* Number of trailing zeroes that have to 
be
+                                       dropped.  */
+                                    size_t nzeroes =
+                                      (flags & FLAG_ALT ? 0 : precision - 1);
+
+                                    --ndigits;
+                                    *p++ = '0';
+                                    if ((flags & FLAG_ALT) || ndigits > 
nzeroes)
+                                      {
+                                        *p++ = decimal_point_char ();
+                                        while (ndigits > nzeroes)
+                                          {
+                                            --ndigits;
+                                            *p++ = '0';
+                                          }
+                                      }
+                                  }
+                                else
+                                  {
+                                    /* arg > 0.0L.  */
+                                    int exponent;
+                                    int adjusted;
+                                    char *digits;
+                                    size_t ndigits;
+                                    size_t nzeroes;
+
+                                    exponent = floorlog10l (arg);
+                                    adjusted = 0;
+                                    for (;;)
+                                      {
+                                        digits =
+                                          scale10_round_decimal_long_double 
(arg,
+                                                                             
(int)(precision - 1) - exponent);
+                                        if (digits == NULL)
+                                          {
+                                            END_LONG_DOUBLE_ROUNDING ();
+                                            goto out_of_memory;
+                                          }
+                                        ndigits = strlen (digits);
+
+                                        if (ndigits == precision)
+                                          break;
+                                        if (ndigits < precision - 1
+                                            || ndigits > precision + 1)
+                                          /* The exponent was not guessed
+                                             precisely enough.  */
+                                          abort ();
+                                        if (adjusted)
+                                          /* None of two values of exponent is
+                                             the right one.  Prevent an endless
+                                             loop.  */
+                                          abort ();
+                                        free (digits);
+                                        if (ndigits < precision)
+                                          exponent -= 1;
+                                        else
+                                          exponent += 1;
+                                        adjusted = 1;
+                                      }
+                                    /* Here ndigits = precision.  */
+                                    if (is_borderline (digits, precision - 1))
+                                      {
+                                        /* Maybe the exponent guess was too 
high
+                                           and a smaller exponent can be 
reached
+                                           by turning a 10...0 into 9...9x.  */
+                                        char *digits2 =
+                                          scale10_round_decimal_long_double 
(arg,
+                                                                             
(int)(precision - 1) - exponent + 1);
+                                        if (digits2 == NULL)
+                                          {
+                                            free (digits);
+                                            END_LONG_DOUBLE_ROUNDING ();
+                                            goto out_of_memory;
+                                          }
+                                        if (strlen (digits2) == precision)
+                                          {
+                                            free (digits);
+                                            digits = digits2;
+                                            exponent -= 1;
+                                          }
+                                        else
+                                          free (digits2);
+                                      }
+                                    /* Here ndigits = precision.  */
+
+                                    /* Determine the number of trailing zeroes
+                                       that have to be dropped.  */
+                                    nzeroes = 0;
+                                    if ((flags & FLAG_ALT) == 0)
+                                      while (nzeroes < ndigits
+                                             && digits[nzeroes] == '0')
+                                        nzeroes++;
+
+                                    /* The exponent is now determined.  */
+                                    if (exponent >= -4
+                                        && exponent < (long)precision)
+                                      {
+                                        /* Fixed-point notation:
+                                           max(exponent,0)+1 digits, then the
+                                           decimal point, then the remaining
+                                           digits without trailing zeroes.  */
+                                        if (exponent >= 0)
+                                          {
+                                            size_t count = exponent + 1;
+                                            /* Note: count <= precision = 
ndigits.  */
+                                            for (; count > 0; count--)
+                                              *p++ = digits[--ndigits];
+                                            if ((flags & FLAG_ALT) || ndigits 
> nzeroes)
+                                              {
+                                                *p++ = decimal_point_char ();
+                                                while (ndigits > nzeroes)
+                                                  {
+                                                    --ndigits;
+                                                    *p++ = digits[ndigits];
+                                                  }
+                                              }
+                                          }
+                                        else
+                                          {
+                                            size_t count = -exponent - 1;
+                                            *p++ = '0';
+                                            *p++ = decimal_point_char ();
+                                            for (; count > 0; count--)
+                                              *p++ = '0';
+                                            while (ndigits > nzeroes)
+                                              {
+                                                --ndigits;
+                                                *p++ = digits[ndigits];
+                                              }
+                                          }
+                                      }
+                                    else
+                                      {
+                                        /* Exponential notation.  */
+                                        *p++ = digits[--ndigits];
+                                        if ((flags & FLAG_ALT) || ndigits > 
nzeroes)
+                                          {
+                                            *p++ = decimal_point_char ();
+                                            while (ndigits > nzeroes)
+                                              {
+                                                --ndigits;
+                                                *p++ = digits[ndigits];
+                                              }
+                                          }
+                                        *p++ = dp->conversion - 'G' + 'E'; /* 
'e' or 'E' */
 #   if WIDE_CHAR_VERSION
-                                       {
-                                         static const wchar_t decimal_format[] 
=
-                                           { '%', '+', '.', '2', 'd', '\0' };
-                                         SNPRINTF (p, 6 + 1, decimal_format, 
exponent);
-                                       }
-                                       while (*p != '\0')
-                                         p++;
+                                        {
+                                          static const wchar_t 
decimal_format[] =
+                                            { '%', '+', '.', '2', 'd', '\0' };
+                                          SNPRINTF (p, 6 + 1, decimal_format, 
exponent);
+                                        }
+                                        while (*p != '\0')
+                                          p++;
 #   else
-                                       if (sizeof (DCHAR_T) == 1)
-                                         {
-                                           sprintf ((char *) p, "%+.2d", 
exponent);
-                                           while (*p != '\0')
-                                             p++;
-                                         }
-                                       else
-                                         {
-                                           char expbuf[6 + 1];
-                                           const char *ep;
-                                           sprintf (expbuf, "%+.2d", exponent);
-                                           for (ep = expbuf; (*p = *ep) != 
'\0'; ep++)
-                                             p++;
-                                         }
+                                        if (sizeof (DCHAR_T) == 1)
+                                          {
+                                            sprintf ((char *) p, "%+.2d", 
exponent);
+                                            while (*p != '\0')
+                                              p++;
+                                          }
+                                        else
+                                          {
+                                            char expbuf[6 + 1];
+                                            const char *ep;
+                                            sprintf (expbuf, "%+.2d", 
exponent);
+                                            for (ep = expbuf; (*p = *ep) != 
'\0'; ep++)
+                                              p++;
+                                          }
 #   endif
-                                     }
+                                      }
 
-                                   free (digits);
-                                 }
-                             }
-                           else
-                             abort ();
+                                    free (digits);
+                                  }
+                              }
+                            else
+                              abort ();
 #  else
-                           /* arg is finite.  */
-                           if (!(arg == 0.0L))
-                             abort ();
-
-                           pad_ptr = p;
-
-                           if (dp->conversion == 'f' || dp->conversion == 'F')
-                             {
-                               *p++ = '0';
-                               if ((flags & FLAG_ALT) || precision > 0)
-                                 {
-                                   *p++ = decimal_point_char ();
-                                   for (; precision > 0; precision--)
-                                     *p++ = '0';
-                                 }
-                             }
-                           else if (dp->conversion == 'e' || dp->conversion == 
'E')
-                             {
-                               *p++ = '0';
-                               if ((flags & FLAG_ALT) || precision > 0)
-                                 {
-                                   *p++ = decimal_point_char ();
-                                   for (; precision > 0; precision--)
-                                     *p++ = '0';
-                                 }
-                               *p++ = dp->conversion; /* 'e' or 'E' */
-                               *p++ = '+';
-                               *p++ = '0';
-                               *p++ = '0';
-                             }
-                           else if (dp->conversion == 'g' || dp->conversion == 
'G')
-                             {
-                               *p++ = '0';
-                               if (flags & FLAG_ALT)
-                                 {
-                                   size_t ndigits =
-                                     (precision > 0 ? precision - 1 : 0);
-                                   *p++ = decimal_point_char ();
-                                   for (; ndigits > 0; --ndigits)
-                                     *p++ = '0';
-                                 }
-                             }
-                           else if (dp->conversion == 'a' || dp->conversion == 
'A')
-                             {
-                               *p++ = '0';
-                               *p++ = dp->conversion - 'A' + 'X';
-                               pad_ptr = p;
-                               *p++ = '0';
-                               if ((flags & FLAG_ALT) || precision > 0)
-                                 {
-                                   *p++ = decimal_point_char ();
-                                   for (; precision > 0; precision--)
-                                     *p++ = '0';
-                                 }
-                               *p++ = dp->conversion - 'A' + 'P';
-                               *p++ = '+';
-                               *p++ = '0';
-                             }
-                           else
-                             abort ();
+                            /* arg is finite.  */
+                            if (!(arg == 0.0L))
+                              abort ();
+
+                            pad_ptr = p;
+
+                            if (dp->conversion == 'f' || dp->conversion == 'F')
+                              {
+                                *p++ = '0';
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > 0; precision--)
+                                      *p++ = '0';
+                                  }
+                              }
+                            else if (dp->conversion == 'e' || dp->conversion 
== 'E')
+                              {
+                                *p++ = '0';
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > 0; precision--)
+                                      *p++ = '0';
+                                  }
+                                *p++ = dp->conversion; /* 'e' or 'E' */
+                                *p++ = '+';
+                                *p++ = '0';
+                                *p++ = '0';
+                              }
+                            else if (dp->conversion == 'g' || dp->conversion 
== 'G')
+                              {
+                                *p++ = '0';
+                                if (flags & FLAG_ALT)
+                                  {
+                                    size_t ndigits =
+                                      (precision > 0 ? precision - 1 : 0);
+                                    *p++ = decimal_point_char ();
+                                    for (; ndigits > 0; --ndigits)
+                                      *p++ = '0';
+                                  }
+                              }
+                            else if (dp->conversion == 'a' || dp->conversion 
== 'A')
+                              {
+                                *p++ = '0';
+                                *p++ = dp->conversion - 'A' + 'X';
+                                pad_ptr = p;
+                                *p++ = '0';
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > 0; precision--)
+                                      *p++ = '0';
+                                  }
+                                *p++ = dp->conversion - 'A' + 'P';
+                                *p++ = '+';
+                                *p++ = '0';
+                              }
+                            else
+                              abort ();
 #  endif
-                         }
+                          }
 
-                       END_LONG_DOUBLE_ROUNDING ();
-                     }
-                 }
+                        END_LONG_DOUBLE_ROUNDING ();
+                      }
+                  }
 #  if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
-               else
+                else
 #  endif
 # endif
 # if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
-                 {
-                   double arg = a.arg[dp->arg_index].a.a_double;
-
-                   if (isnand (arg))
-                     {
-                       if (dp->conversion >= 'A' && dp->conversion <= 'Z')
-                         {
-                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
-                         }
-                       else
-                         {
-                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
-                         }
-                     }
-                   else
-                     {
-                       int sign = 0;
-
-                       if (signbit (arg)) /* arg < 0.0 or negative zero */
-                         {
-                           sign = -1;
-                           arg = -arg;
-                         }
-
-                       if (sign < 0)
-                         *p++ = '-';
-                       else if (flags & FLAG_SHOWSIGN)
-                         *p++ = '+';
-                       else if (flags & FLAG_SPACE)
-                         *p++ = ' ';
-
-                       if (arg > 0.0 && arg + arg == arg)
-                         {
-                           if (dp->conversion >= 'A' && dp->conversion <= 'Z')
-                             {
-                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
-                             }
-                           else
-                             {
-                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
-                             }
-                         }
-                       else
-                         {
+                  {
+                    double arg = a.arg[dp->arg_index].a.a_double;
+
+                    if (isnand (arg))
+                      {
+                        if (dp->conversion >= 'A' && dp->conversion <= 'Z')
+                          {
+                            *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
+                          }
+                        else
+                          {
+                            *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
+                          }
+                      }
+                    else
+                      {
+                        int sign = 0;
+
+                        if (signbit (arg)) /* arg < 0.0 or negative zero */
+                          {
+                            sign = -1;
+                            arg = -arg;
+                          }
+
+                        if (sign < 0)
+                          *p++ = '-';
+                        else if (flags & FLAG_SHOWSIGN)
+                          *p++ = '+';
+                        else if (flags & FLAG_SPACE)
+                          *p++ = ' ';
+
+                        if (arg > 0.0 && arg + arg == arg)
+                          {
+                            if (dp->conversion >= 'A' && dp->conversion <= 'Z')
+                              {
+                                *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
+                              }
+                            else
+                              {
+                                *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
+                              }
+                          }
+                        else
+                          {
 #  if NEED_PRINTF_DOUBLE
-                           pad_ptr = p;
-
-                           if (dp->conversion == 'f' || dp->conversion == 'F')
-                             {
-                               char *digits;
-                               size_t ndigits;
-
-                               digits =
-                                 scale10_round_decimal_double (arg, precision);
-                               if (digits == NULL)
-                                 goto out_of_memory;
-                               ndigits = strlen (digits);
-
-                               if (ndigits > precision)
-                                 do
-                                   {
-                                     --ndigits;
-                                     *p++ = digits[ndigits];
-                                   }
-                                 while (ndigits > precision);
-                               else
-                                 *p++ = '0';
-                               /* Here ndigits <= precision.  */
-                               if ((flags & FLAG_ALT) || precision > 0)
-                                 {
-                                   *p++ = decimal_point_char ();
-                                   for (; precision > ndigits; precision--)
-                                     *p++ = '0';
-                                   while (ndigits > 0)
-                                     {
-                                       --ndigits;
-                                       *p++ = digits[ndigits];
-                                     }
-                                 }
-
-                               free (digits);
-                             }
-                           else if (dp->conversion == 'e' || dp->conversion == 
'E')
-                             {
-                               int exponent;
-
-                               if (arg == 0.0)
-                                 {
-                                   exponent = 0;
-                                   *p++ = '0';
-                                   if ((flags & FLAG_ALT) || precision > 0)
-                                     {
-                                       *p++ = decimal_point_char ();
-                                       for (; precision > 0; precision--)
-                                         *p++ = '0';
-                                     }
-                                 }
-                               else
-                                 {
-                                   /* arg > 0.0.  */
-                                   int adjusted;
-                                   char *digits;
-                                   size_t ndigits;
-
-                                   exponent = floorlog10 (arg);
-                                   adjusted = 0;
-                                   for (;;)
-                                     {
-                                       digits =
-                                         scale10_round_decimal_double (arg,
-                                                                       
(int)precision - exponent);
-                                       if (digits == NULL)
-                                         goto out_of_memory;
-                                       ndigits = strlen (digits);
-
-                                       if (ndigits == precision + 1)
-                                         break;
-                                       if (ndigits < precision
-                                           || ndigits > precision + 2)
-                                         /* The exponent was not guessed
-                                            precisely enough.  */
-                                         abort ();
-                                       if (adjusted)
-                                         /* None of two values of exponent is
-                                            the right one.  Prevent an endless
-                                            loop.  */
-                                         abort ();
-                                       free (digits);
-                                       if (ndigits == precision)
-                                         exponent -= 1;
-                                       else
-                                         exponent += 1;
-                                       adjusted = 1;
-                                     }
-                                   /* Here ndigits = precision+1.  */
-                                   if (is_borderline (digits, precision))
-                                     {
-                                       /* Maybe the exponent guess was too high
-                                          and a smaller exponent can be reached
-                                          by turning a 10...0 into 9...9x.  */
-                                       char *digits2 =
-                                         scale10_round_decimal_double (arg,
-                                                                       
(int)precision - exponent + 1);
-                                       if (digits2 == NULL)
-                                         {
-                                           free (digits);
-                                           goto out_of_memory;
-                                         }
-                                       if (strlen (digits2) == precision + 1)
-                                         {
-                                           free (digits);
-                                           digits = digits2;
-                                           exponent -= 1;
-                                         }
-                                       else
-                                         free (digits2);
-                                     }
-                                   /* Here ndigits = precision+1.  */
-
-                                   *p++ = digits[--ndigits];
-                                   if ((flags & FLAG_ALT) || precision > 0)
-                                     {
-                                       *p++ = decimal_point_char ();
-                                       while (ndigits > 0)
-                                         {
-                                           --ndigits;
-                                           *p++ = digits[ndigits];
-                                         }
-                                     }
-
-                                   free (digits);
-                                 }
-
-                               *p++ = dp->conversion; /* 'e' or 'E' */
+                            pad_ptr = p;
+
+                            if (dp->conversion == 'f' || dp->conversion == 'F')
+                              {
+                                char *digits;
+                                size_t ndigits;
+
+                                digits =
+                                  scale10_round_decimal_double (arg, 
precision);
+                                if (digits == NULL)
+                                  goto out_of_memory;
+                                ndigits = strlen (digits);
+
+                                if (ndigits > precision)
+                                  do
+                                    {
+                                      --ndigits;
+                                      *p++ = digits[ndigits];
+                                    }
+                                  while (ndigits > precision);
+                                else
+                                  *p++ = '0';
+                                /* Here ndigits <= precision.  */
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > ndigits; precision--)
+                                      *p++ = '0';
+                                    while (ndigits > 0)
+                                      {
+                                        --ndigits;
+                                        *p++ = digits[ndigits];
+                                      }
+                                  }
+
+                                free (digits);
+                              }
+                            else if (dp->conversion == 'e' || dp->conversion 
== 'E')
+                              {
+                                int exponent;
+
+                                if (arg == 0.0)
+                                  {
+                                    exponent = 0;
+                                    *p++ = '0';
+                                    if ((flags & FLAG_ALT) || precision > 0)
+                                      {
+                                        *p++ = decimal_point_char ();
+                                        for (; precision > 0; precision--)
+                                          *p++ = '0';
+                                      }
+                                  }
+                                else
+                                  {
+                                    /* arg > 0.0.  */
+                                    int adjusted;
+                                    char *digits;
+                                    size_t ndigits;
+
+                                    exponent = floorlog10 (arg);
+                                    adjusted = 0;
+                                    for (;;)
+                                      {
+                                        digits =
+                                          scale10_round_decimal_double (arg,
+                                                                        
(int)precision - exponent);
+                                        if (digits == NULL)
+                                          goto out_of_memory;
+                                        ndigits = strlen (digits);
+
+                                        if (ndigits == precision + 1)
+                                          break;
+                                        if (ndigits < precision
+                                            || ndigits > precision + 2)
+                                          /* The exponent was not guessed
+                                             precisely enough.  */
+                                          abort ();
+                                        if (adjusted)
+                                          /* None of two values of exponent is
+                                             the right one.  Prevent an endless
+                                             loop.  */
+                                          abort ();
+                                        free (digits);
+                                        if (ndigits == precision)
+                                          exponent -= 1;
+                                        else
+                                          exponent += 1;
+                                        adjusted = 1;
+                                      }
+                                    /* Here ndigits = precision+1.  */
+                                    if (is_borderline (digits, precision))
+                                      {
+                                        /* Maybe the exponent guess was too 
high
+                                           and a smaller exponent can be 
reached
+                                           by turning a 10...0 into 9...9x.  */
+                                        char *digits2 =
+                                          scale10_round_decimal_double (arg,
+                                                                        
(int)precision - exponent + 1);
+                                        if (digits2 == NULL)
+                                          {
+                                            free (digits);
+                                            goto out_of_memory;
+                                          }
+                                        if (strlen (digits2) == precision + 1)
+                                          {
+                                            free (digits);
+                                            digits = digits2;
+                                            exponent -= 1;
+                                          }
+                                        else
+                                          free (digits2);
+                                      }
+                                    /* Here ndigits = precision+1.  */
+
+                                    *p++ = digits[--ndigits];
+                                    if ((flags & FLAG_ALT) || precision > 0)
+                                      {
+                                        *p++ = decimal_point_char ();
+                                        while (ndigits > 0)
+                                          {
+                                            --ndigits;
+                                            *p++ = digits[ndigits];
+                                          }
+                                      }
+
+                                    free (digits);
+                                  }
+
+                                *p++ = dp->conversion; /* 'e' or 'E' */
 #   if WIDE_CHAR_VERSION
-                               {
-                                 static const wchar_t decimal_format[] =
-                                   /* Produce the same number of exponent 
digits
-                                      as the native printf implementation.  */
+                                {
+                                  static const wchar_t decimal_format[] =
+                                    /* Produce the same number of exponent 
digits
+                                       as the native printf implementation.  */
 #    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-                                   { '%', '+', '.', '3', 'd', '\0' };
+                                    { '%', '+', '.', '3', 'd', '\0' };
 #    else
-                                   { '%', '+', '.', '2', 'd', '\0' };
+                                    { '%', '+', '.', '2', 'd', '\0' };
 #    endif
-                                 SNPRINTF (p, 6 + 1, decimal_format, exponent);
-                               }
-                               while (*p != '\0')
-                                 p++;
+                                  SNPRINTF (p, 6 + 1, decimal_format, 
exponent);
+                                }
+                                while (*p != '\0')
+                                  p++;
 #   else
-                               {
-                                 static const char decimal_format[] =
-                                   /* Produce the same number of exponent 
digits
-                                      as the native printf implementation.  */
+                                {
+                                  static const char decimal_format[] =
+                                    /* Produce the same number of exponent 
digits
+                                       as the native printf implementation.  */
 #    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-                                   "%+.3d";
+                                    "%+.3d";
 #    else
-                                   "%+.2d";
+                                    "%+.2d";
 #    endif
-                                 if (sizeof (DCHAR_T) == 1)
-                                   {
-                                     sprintf ((char *) p, decimal_format, 
exponent);
-                                     while (*p != '\0')
-                                       p++;
-                                   }
-                                 else
-                                   {
-                                     char expbuf[6 + 1];
-                                     const char *ep;
-                                     sprintf (expbuf, decimal_format, 
exponent);
-                                     for (ep = expbuf; (*p = *ep) != '\0'; 
ep++)
-                                       p++;
-                                   }
-                               }
+                                  if (sizeof (DCHAR_T) == 1)
+                                    {
+                                      sprintf ((char *) p, decimal_format, 
exponent);
+                                      while (*p != '\0')
+                                        p++;
+                                    }
+                                  else
+                                    {
+                                      char expbuf[6 + 1];
+                                      const char *ep;
+                                      sprintf (expbuf, decimal_format, 
exponent);
+                                      for (ep = expbuf; (*p = *ep) != '\0'; 
ep++)
+                                        p++;
+                                    }
+                                }
 #   endif
-                             }
-                           else if (dp->conversion == 'g' || dp->conversion == 
'G')
-                             {
-                               if (precision == 0)
-                                 precision = 1;
-                               /* precision >= 1.  */
-
-                               if (arg == 0.0)
-                                 /* The exponent is 0, >= -4, < precision.
-                                    Use fixed-point notation.  */
-                                 {
-                                   size_t ndigits = precision;
-                                   /* Number of trailing zeroes that have to be
-                                      dropped.  */
-                                   size_t nzeroes =
-                                     (flags & FLAG_ALT ? 0 : precision - 1);
-
-                                   --ndigits;
-                                   *p++ = '0';
-                                   if ((flags & FLAG_ALT) || ndigits > nzeroes)
-                                     {
-                                       *p++ = decimal_point_char ();
-                                       while (ndigits > nzeroes)
-                                         {
-                                           --ndigits;
-                                           *p++ = '0';
-                                         }
-                                     }
-                                 }
-                               else
-                                 {
-                                   /* arg > 0.0.  */
-                                   int exponent;
-                                   int adjusted;
-                                   char *digits;
-                                   size_t ndigits;
-                                   size_t nzeroes;
-
-                                   exponent = floorlog10 (arg);
-                                   adjusted = 0;
-                                   for (;;)
-                                     {
-                                       digits =
-                                         scale10_round_decimal_double (arg,
-                                                                       
(int)(precision - 1) - exponent);
-                                       if (digits == NULL)
-                                         goto out_of_memory;
-                                       ndigits = strlen (digits);
-
-                                       if (ndigits == precision)
-                                         break;
-                                       if (ndigits < precision - 1
-                                           || ndigits > precision + 1)
-                                         /* The exponent was not guessed
-                                            precisely enough.  */
-                                         abort ();
-                                       if (adjusted)
-                                         /* None of two values of exponent is
-                                            the right one.  Prevent an endless
-                                            loop.  */
-                                         abort ();
-                                       free (digits);
-                                       if (ndigits < precision)
-                                         exponent -= 1;
-                                       else
-                                         exponent += 1;
-                                       adjusted = 1;
-                                     }
-                                   /* Here ndigits = precision.  */
-                                   if (is_borderline (digits, precision - 1))
-                                     {
-                                       /* Maybe the exponent guess was too high
-                                          and a smaller exponent can be reached
-                                          by turning a 10...0 into 9...9x.  */
-                                       char *digits2 =
-                                         scale10_round_decimal_double (arg,
-                                                                       
(int)(precision - 1) - exponent + 1);
-                                       if (digits2 == NULL)
-                                         {
-                                           free (digits);
-                                           goto out_of_memory;
-                                         }
-                                       if (strlen (digits2) == precision)
-                                         {
-                                           free (digits);
-                                           digits = digits2;
-                                           exponent -= 1;
-                                         }
-                                       else
-                                         free (digits2);
-                                     }
-                                   /* Here ndigits = precision.  */
-
-                                   /* Determine the number of trailing zeroes
-                                      that have to be dropped.  */
-                                   nzeroes = 0;
-                                   if ((flags & FLAG_ALT) == 0)
-                                     while (nzeroes < ndigits
-                                            && digits[nzeroes] == '0')
-                                       nzeroes++;
-
-                                   /* The exponent is now determined.  */
-                                   if (exponent >= -4
-                                       && exponent < (long)precision)
-                                     {
-                                       /* Fixed-point notation:
-                                          max(exponent,0)+1 digits, then the
-                                          decimal point, then the remaining
-                                          digits without trailing zeroes.  */
-                                       if (exponent >= 0)
-                                         {
-                                           size_t count = exponent + 1;
-                                           /* Note: count <= precision = 
ndigits.  */
-                                           for (; count > 0; count--)
-                                             *p++ = digits[--ndigits];
-                                           if ((flags & FLAG_ALT) || ndigits > 
nzeroes)
-                                             {
-                                               *p++ = decimal_point_char ();
-                                               while (ndigits > nzeroes)
-                                                 {
-                                                   --ndigits;
-                                                   *p++ = digits[ndigits];
-                                                 }
-                                             }
-                                         }
-                                       else
-                                         {
-                                           size_t count = -exponent - 1;
-                                           *p++ = '0';
-                                           *p++ = decimal_point_char ();
-                                           for (; count > 0; count--)
-                                             *p++ = '0';
-                                           while (ndigits > nzeroes)
-                                             {
-                                               --ndigits;
-                                               *p++ = digits[ndigits];
-                                             }
-                                         }
-                                     }
-                                   else
-                                     {
-                                       /* Exponential notation.  */
-                                       *p++ = digits[--ndigits];
-                                       if ((flags & FLAG_ALT) || ndigits > 
nzeroes)
-                                         {
-                                           *p++ = decimal_point_char ();
-                                           while (ndigits > nzeroes)
-                                             {
-                                               --ndigits;
-                                               *p++ = digits[ndigits];
-                                             }
-                                         }
-                                       *p++ = dp->conversion - 'G' + 'E'; /* 
'e' or 'E' */
+                              }
+                            else if (dp->conversion == 'g' || dp->conversion 
== 'G')
+                              {
+                                if (precision == 0)
+                                  precision = 1;
+                                /* precision >= 1.  */
+
+                                if (arg == 0.0)
+                                  /* The exponent is 0, >= -4, < precision.
+                                     Use fixed-point notation.  */
+                                  {
+                                    size_t ndigits = precision;
+                                    /* Number of trailing zeroes that have to 
be
+                                       dropped.  */
+                                    size_t nzeroes =
+                                      (flags & FLAG_ALT ? 0 : precision - 1);
+
+                                    --ndigits;
+                                    *p++ = '0';
+                                    if ((flags & FLAG_ALT) || ndigits > 
nzeroes)
+                                      {
+                                        *p++ = decimal_point_char ();
+                                        while (ndigits > nzeroes)
+                                          {
+                                            --ndigits;
+                                            *p++ = '0';
+                                          }
+                                      }
+                                  }
+                                else
+                                  {
+                                    /* arg > 0.0.  */
+                                    int exponent;
+                                    int adjusted;
+                                    char *digits;
+                                    size_t ndigits;
+                                    size_t nzeroes;
+
+                                    exponent = floorlog10 (arg);
+                                    adjusted = 0;
+                                    for (;;)
+                                      {
+                                        digits =
+                                          scale10_round_decimal_double (arg,
+                                                                        
(int)(precision - 1) - exponent);
+                                        if (digits == NULL)
+                                          goto out_of_memory;
+                                        ndigits = strlen (digits);
+
+                                        if (ndigits == precision)
+                                          break;
+                                        if (ndigits < precision - 1
+                                            || ndigits > precision + 1)
+                                          /* The exponent was not guessed
+                                             precisely enough.  */
+                                          abort ();
+                                        if (adjusted)
+                                          /* None of two values of exponent is
+                                             the right one.  Prevent an endless
+                                             loop.  */
+                                          abort ();
+                                        free (digits);
+                                        if (ndigits < precision)
+                                          exponent -= 1;
+                                        else
+                                          exponent += 1;
+                                        adjusted = 1;
+                                      }
+                                    /* Here ndigits = precision.  */
+                                    if (is_borderline (digits, precision - 1))
+                                      {
+                                        /* Maybe the exponent guess was too 
high
+                                           and a smaller exponent can be 
reached
+                                           by turning a 10...0 into 9...9x.  */
+                                        char *digits2 =
+                                          scale10_round_decimal_double (arg,
+                                                                        
(int)(precision - 1) - exponent + 1);
+                                        if (digits2 == NULL)
+                                          {
+                                            free (digits);
+                                            goto out_of_memory;
+                                          }
+                                        if (strlen (digits2) == precision)
+                                          {
+                                            free (digits);
+                                            digits = digits2;
+                                            exponent -= 1;
+                                          }
+                                        else
+                                          free (digits2);
+                                      }
+                                    /* Here ndigits = precision.  */
+
+                                    /* Determine the number of trailing zeroes
+                                       that have to be dropped.  */
+                                    nzeroes = 0;
+                                    if ((flags & FLAG_ALT) == 0)
+                                      while (nzeroes < ndigits
+                                             && digits[nzeroes] == '0')
+                                        nzeroes++;
+
+                                    /* The exponent is now determined.  */
+                                    if (exponent >= -4
+                                        && exponent < (long)precision)
+                                      {
+                                        /* Fixed-point notation:
+                                           max(exponent,0)+1 digits, then the
+                                           decimal point, then the remaining
+                                           digits without trailing zeroes.  */
+                                        if (exponent >= 0)
+                                          {
+                                            size_t count = exponent + 1;
+                                            /* Note: count <= precision = 
ndigits.  */
+                                            for (; count > 0; count--)
+                                              *p++ = digits[--ndigits];
+                                            if ((flags & FLAG_ALT) || ndigits 
> nzeroes)
+                                              {
+                                                *p++ = decimal_point_char ();
+                                                while (ndigits > nzeroes)
+                                                  {
+                                                    --ndigits;
+                                                    *p++ = digits[ndigits];
+                                                  }
+                                              }
+                                          }
+                                        else
+                                          {
+                                            size_t count = -exponent - 1;
+                                            *p++ = '0';
+                                            *p++ = decimal_point_char ();
+                                            for (; count > 0; count--)
+                                              *p++ = '0';
+                                            while (ndigits > nzeroes)
+                                              {
+                                                --ndigits;
+                                                *p++ = digits[ndigits];
+                                              }
+                                          }
+                                      }
+                                    else
+                                      {
+                                        /* Exponential notation.  */
+                                        *p++ = digits[--ndigits];
+                                        if ((flags & FLAG_ALT) || ndigits > 
nzeroes)
+                                          {
+                                            *p++ = decimal_point_char ();
+                                            while (ndigits > nzeroes)
+                                              {
+                                                --ndigits;
+                                                *p++ = digits[ndigits];
+                                              }
+                                          }
+                                        *p++ = dp->conversion - 'G' + 'E'; /* 
'e' or 'E' */
 #   if WIDE_CHAR_VERSION
-                                       {
-                                         static const wchar_t decimal_format[] 
=
-                                           /* Produce the same number of 
exponent digits
-                                              as the native printf 
implementation.  */
+                                        {
+                                          static const wchar_t 
decimal_format[] =
+                                            /* Produce the same number of 
exponent digits
+                                               as the native printf 
implementation.  */
 #    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-                                           { '%', '+', '.', '3', 'd', '\0' };
+                                            { '%', '+', '.', '3', 'd', '\0' };
 #    else
-                                           { '%', '+', '.', '2', 'd', '\0' };
+                                            { '%', '+', '.', '2', 'd', '\0' };
 #    endif
-                                         SNPRINTF (p, 6 + 1, decimal_format, 
exponent);
-                                       }
-                                       while (*p != '\0')
-                                         p++;
+                                          SNPRINTF (p, 6 + 1, decimal_format, 
exponent);
+                                        }
+                                        while (*p != '\0')
+                                          p++;
 #   else
-                                       {
-                                         static const char decimal_format[] =
-                                           /* Produce the same number of 
exponent digits
-                                              as the native printf 
implementation.  */
+                                        {
+                                          static const char decimal_format[] =
+                                            /* Produce the same number of 
exponent digits
+                                               as the native printf 
implementation.  */
 #    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-                                           "%+.3d";
+                                            "%+.3d";
 #    else
-                                           "%+.2d";
+                                            "%+.2d";
 #    endif
-                                         if (sizeof (DCHAR_T) == 1)
-                                           {
-                                             sprintf ((char *) p, 
decimal_format, exponent);
-                                             while (*p != '\0')
-                                               p++;
-                                           }
-                                         else
-                                           {
-                                             char expbuf[6 + 1];
-                                             const char *ep;
-                                             sprintf (expbuf, decimal_format, 
exponent);
-                                             for (ep = expbuf; (*p = *ep) != 
'\0'; ep++)
-                                               p++;
-                                           }
-                                       }
+                                          if (sizeof (DCHAR_T) == 1)
+                                            {
+                                              sprintf ((char *) p, 
decimal_format, exponent);
+                                              while (*p != '\0')
+                                                p++;
+                                            }
+                                          else
+                                            {
+                                              char expbuf[6 + 1];
+                                              const char *ep;
+                                              sprintf (expbuf, decimal_format, 
exponent);
+                                              for (ep = expbuf; (*p = *ep) != 
'\0'; ep++)
+                                                p++;
+                                            }
+                                        }
 #   endif
-                                     }
+                                      }
 
-                                   free (digits);
-                                 }
-                             }
-                           else
-                             abort ();
+                                    free (digits);
+                                  }
+                              }
+                            else
+                              abort ();
 #  else
-                           /* arg is finite.  */
-                           if (!(arg == 0.0))
-                             abort ();
-
-                           pad_ptr = p;
-
-                           if (dp->conversion == 'f' || dp->conversion == 'F')
-                             {
-                               *p++ = '0';
-                               if ((flags & FLAG_ALT) || precision > 0)
-                                 {
-                                   *p++ = decimal_point_char ();
-                                   for (; precision > 0; precision--)
-                                     *p++ = '0';
-                                 }
-                             }
-                           else if (dp->conversion == 'e' || dp->conversion == 
'E')
-                             {
-                               *p++ = '0';
-                               if ((flags & FLAG_ALT) || precision > 0)
-                                 {
-                                   *p++ = decimal_point_char ();
-                                   for (; precision > 0; precision--)
-                                     *p++ = '0';
-                                 }
-                               *p++ = dp->conversion; /* 'e' or 'E' */
-                               *p++ = '+';
-                               /* Produce the same number of exponent digits as
-                                  the native printf implementation.  */
+                            /* arg is finite.  */
+                            if (!(arg == 0.0))
+                              abort ();
+
+                            pad_ptr = p;
+
+                            if (dp->conversion == 'f' || dp->conversion == 'F')
+                              {
+                                *p++ = '0';
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > 0; precision--)
+                                      *p++ = '0';
+                                  }
+                              }
+                            else if (dp->conversion == 'e' || dp->conversion 
== 'E')
+                              {
+                                *p++ = '0';
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > 0; precision--)
+                                      *p++ = '0';
+                                  }
+                                *p++ = dp->conversion; /* 'e' or 'E' */
+                                *p++ = '+';
+                                /* Produce the same number of exponent digits 
as
+                                   the native printf implementation.  */
 #   if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-                               *p++ = '0';
+                                *p++ = '0';
 #   endif
-                               *p++ = '0';
-                               *p++ = '0';
-                             }
-                           else if (dp->conversion == 'g' || dp->conversion == 
'G')
-                             {
-                               *p++ = '0';
-                               if (flags & FLAG_ALT)
-                                 {
-                                   size_t ndigits =
-                                     (precision > 0 ? precision - 1 : 0);
-                                   *p++ = decimal_point_char ();
-                                   for (; ndigits > 0; --ndigits)
-                                     *p++ = '0';
-                                 }
-                             }
-                           else
-                             abort ();
+                                *p++ = '0';
+                                *p++ = '0';
+                              }
+                            else if (dp->conversion == 'g' || dp->conversion 
== 'G')
+                              {
+                                *p++ = '0';
+                                if (flags & FLAG_ALT)
+                                  {
+                                    size_t ndigits =
+                                      (precision > 0 ? precision - 1 : 0);
+                                    *p++ = decimal_point_char ();
+                                    for (; ndigits > 0; --ndigits)
+                                      *p++ = '0';
+                                  }
+                              }
+                            else
+                              abort ();
 #  endif
-                         }
-                     }
-                 }
+                          }
+                      }
+                  }
 # endif
 
-               /* The generated string now extends from tmp to p, with the
-                  zero padding insertion point being at pad_ptr.  */
-               if (has_width && p - tmp < width)
-                 {
-                   size_t pad = width - (p - tmp);
-                   DCHAR_T *end = p + pad;
-
-                   if (flags & FLAG_LEFT)
-                     {
-                       /* Pad with spaces on the right.  */
-                       for (; pad > 0; pad--)
-                         *p++ = ' ';
-                     }
-                   else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
-                     {
-                       /* Pad with zeroes.  */
-                       DCHAR_T *q = end;
-
-                       while (p > pad_ptr)
-                         *--q = *--p;
-                       for (; pad > 0; pad--)
-                         *p++ = '0';
-                     }
-                   else
-                     {
-                       /* Pad with spaces on the left.  */
-                       DCHAR_T *q = end;
-
-                       while (p > tmp)
-                         *--q = *--p;
-                       for (; pad > 0; pad--)
-                         *p++ = ' ';
-                     }
-
-                   p = end;
-                 }
-
-               {
-                 size_t count = p - tmp;
-
-                 if (count >= tmp_length)
-                   /* tmp_length was incorrectly calculated - fix the
-                      code above!  */
-                   abort ();
-
-                 /* Make room for the result.  */
-                 if (count >= allocated - length)
-                   {
-                     size_t n = xsum (length, count);
-
-                     ENSURE_ALLOCATION (n);
-                   }
-
-                 /* Append the result.  */
-                 memcpy (result + length, tmp, count * sizeof (DCHAR_T));
-                 if (tmp != tmpbuf)
-                   free (tmp);
-                 length += count;
-               }
-             }
+                /* The generated string now extends from tmp to p, with the
+                   zero padding insertion point being at pad_ptr.  */
+                if (has_width && p - tmp < width)
+                  {
+                    size_t pad = width - (p - tmp);
+                    DCHAR_T *end = p + pad;
+
+                    if (flags & FLAG_LEFT)
+                      {
+                        /* Pad with spaces on the right.  */
+                        for (; pad > 0; pad--)
+                          *p++ = ' ';
+                      }
+                    else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
+                      {
+                        /* Pad with zeroes.  */
+                        DCHAR_T *q = end;
+
+                        while (p > pad_ptr)
+                          *--q = *--p;
+                        for (; pad > 0; pad--)
+                          *p++ = '0';
+                      }
+                    else
+                      {
+                        /* Pad with spaces on the left.  */
+                        DCHAR_T *q = end;
+
+                        while (p > tmp)
+                          *--q = *--p;
+                        for (; pad > 0; pad--)
+                          *p++ = ' ';
+                      }
+
+                    p = end;
+                  }
+
+                {
+                  size_t count = p - tmp;
+
+                  if (count >= tmp_length)
+                    /* tmp_length was incorrectly calculated - fix the
+                       code above!  */
+                    abort ();
+
+                  /* Make room for the result.  */
+                  if (count >= allocated - length)
+                    {
+                      size_t n = xsum (length, count);
+
+                      ENSURE_ALLOCATION (n);
+                    }
+
+                  /* Append the result.  */
+                  memcpy (result + length, tmp, count * sizeof (DCHAR_T));
+                  if (tmp != tmpbuf)
+                    free (tmp);
+                  length += count;
+                }
+              }
 #endif
-           else
-             {
-               arg_type type = a.arg[dp->arg_index].type;
-               int flags = dp->flags;
+            else
+              {
+                arg_type type = a.arg[dp->arg_index].type;
+                int flags = dp->flags;
 #if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || 
NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || 
NEED_PRINTF_UNBOUNDED_PRECISION
-               int has_width;
-               size_t width;
+                int has_width;
+                size_t width;
 #endif
 #if !USE_SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION
-               int has_precision;
-               size_t precision;
+                int has_precision;
+                size_t precision;
 #endif
 #if NEED_PRINTF_UNBOUNDED_PRECISION
-               int prec_ourselves;
+                int prec_ourselves;
 #else
-#              define prec_ourselves 0
+#               define prec_ourselves 0
 #endif
 #if NEED_PRINTF_FLAG_LEFTADJUST
-#              define pad_ourselves 1
+#               define pad_ourselves 1
 #elif !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || 
NEED_PRINTF_UNBOUNDED_PRECISION
-               int pad_ourselves;
+                int pad_ourselves;
 #else
-#              define pad_ourselves 0
+#               define pad_ourselves 0
 #endif
-               TCHAR_T *fbp;
-               unsigned int prefix_count;
-               int prefixes[2] IF_LINT (= { 0 });
+                TCHAR_T *fbp;
+                unsigned int prefix_count;
+                int prefixes[2] IF_LINT (= { 0 });
 #if !USE_SNPRINTF
-               size_t tmp_length;
-               TCHAR_T tmpbuf[700];
-               TCHAR_T *tmp;
+                size_t tmp_length;
+                TCHAR_T tmpbuf[700];
+                TCHAR_T *tmp;
 #endif
 
 #if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || 
NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || 
NEED_PRINTF_UNBOUNDED_PRECISION
-               has_width = 0;
-               width = 0;
-               if (dp->width_start != dp->width_end)
-                 {
-                   if (dp->width_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->width_arg_index].a.a_int;
-                       if (arg < 0)
-                         {
-                           /* "A negative field width is taken as a '-' flag
-                               followed by a positive field width."  */
-                           flags |= FLAG_LEFT;
-                           width = (unsigned int) (-arg);
-                         }
-                       else
-                         width = arg;
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->width_start;
-
-                       do
-                         width = xsum (xtimes (width, 10), *digitp++ - '0');
-                       while (digitp != dp->width_end);
-                     }
-                   has_width = 1;
-                 }
+                has_width = 0;
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = (unsigned int) (-arg);
+                          }
+                        else
+                          width = arg;
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+                    has_width = 1;
+                  }
 #endif
 
 #if !USE_SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION
-               has_precision = 0;
-               precision = 6;
-               if (dp->precision_start != dp->precision_end)
-                 {
-                   if (dp->precision_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->precision_arg_index].a.a_int;
-                       /* "A negative precision is taken as if the precision
-                           were omitted."  */
-                       if (arg >= 0)
-                         {
-                           precision = arg;
-                           has_precision = 1;
-                         }
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->precision_start + 1;
-
-                       precision = 0;
-                       while (digitp != dp->precision_end)
-                         precision = xsum (xtimes (precision, 10), *digitp++ - 
'0');
-                       has_precision = 1;
-                     }
-                 }
+                has_precision = 0;
+                precision = 6;
+                if (dp->precision_start != dp->precision_end)
+                  {
+                    if (dp->precision_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->precision_arg_index].a.a_int;
+                        /* "A negative precision is taken as if the precision
+                            were omitted."  */
+                        if (arg >= 0)
+                          {
+                            precision = arg;
+                            has_precision = 1;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->precision_start + 1;
+
+                        precision = 0;
+                        while (digitp != dp->precision_end)
+                          precision = xsum (xtimes (precision, 10), *digitp++ 
- '0');
+                        has_precision = 1;
+                      }
+                  }
 #endif
 
-               /* Decide whether to handle the precision ourselves.  */
+                /* Decide whether to handle the precision ourselves.  */
 #if NEED_PRINTF_UNBOUNDED_PRECISION
-               switch (dp->conversion)
-                 {
-                 case 'd': case 'i': case 'u':
-                 case 'o':
-                 case 'x': case 'X': case 'p':
-                   prec_ourselves = has_precision && (precision > 0);
-                   break;
-                 default:
-                   prec_ourselves = 0;
-                   break;
-                 }
+                switch (dp->conversion)
+                  {
+                  case 'd': case 'i': case 'u':
+                  case 'o':
+                  case 'x': case 'X': case 'p':
+                    prec_ourselves = has_precision && (precision > 0);
+                    break;
+                  default:
+                    prec_ourselves = 0;
+                    break;
+                  }
 #endif
 
-               /* Decide whether to perform the padding ourselves.  */
+                /* Decide whether to perform the padding ourselves.  */
 #if !NEED_PRINTF_FLAG_LEFTADJUST && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || 
NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION)
-               switch (dp->conversion)
-                 {
+                switch (dp->conversion)
+                  {
 # if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
-                 /* If we need conversion from TCHAR_T[] to DCHAR_T[], we need
-                    to perform the padding after this conversion.  Functions
-                    with unistdio extensions perform the padding based on
-                    character count rather than element count.  */
-                 case 'c': case 's':
+                  /* If we need conversion from TCHAR_T[] to DCHAR_T[], we need
+                     to perform the padding after this conversion.  Functions
+                     with unistdio extensions perform the padding based on
+                     character count rather than element count.  */
+                  case 'c': case 's':
 # endif
 # if NEED_PRINTF_FLAG_ZERO
-                 case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
-                 case 'a': case 'A':
+                  case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
+                  case 'a': case 'A':
 # endif
-                   pad_ourselves = 1;
-                   break;
-                 default:
-                   pad_ourselves = prec_ourselves;
-                   break;
-                 }
+                    pad_ourselves = 1;
+                    break;
+                  default:
+                    pad_ourselves = prec_ourselves;
+                    break;
+                  }
 #endif
 
 #if !USE_SNPRINTF
-               /* Allocate a temporary buffer of sufficient size for calling
-                  sprintf.  */
-               {
-                 switch (dp->conversion)
-                   {
+                /* Allocate a temporary buffer of sufficient size for calling
+                   sprintf.  */
+                {
+                  switch (dp->conversion)
+                    {
 
-                   case 'd': case 'i': case 'u':
+                    case 'd': case 'i': case 'u':
 # if HAVE_LONG_LONG_INT
-                     if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
-                                         * 0.30103 /* binary -> decimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     else
+                      if (type == TYPE_LONGLONGINT || type == 
TYPE_ULONGLONGINT)
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned long long) * 
CHAR_BIT
+                                          * 0.30103 /* binary -> decimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      else
 # endif
-                     if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned long) * CHAR_BIT
-                                         * 0.30103 /* binary -> decimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     else
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned int) * CHAR_BIT
-                                         * 0.30103 /* binary -> decimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     if (tmp_length < precision)
-                       tmp_length = precision;
-                     /* Multiply by 2, as an estimate for FLAG_GROUP.  */
-                     tmp_length = xsum (tmp_length, tmp_length);
-                     /* Add 1, to account for a leading sign.  */
-                     tmp_length = xsum (tmp_length, 1);
-                     break;
-
-                   case 'o':
+                      if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned long) * CHAR_BIT
+                                          * 0.30103 /* binary -> decimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      else
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned int) * CHAR_BIT
+                                          * 0.30103 /* binary -> decimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      if (tmp_length < precision)
+                        tmp_length = precision;
+                      /* Multiply by 2, as an estimate for FLAG_GROUP.  */
+                      tmp_length = xsum (tmp_length, tmp_length);
+                      /* Add 1, to account for a leading sign.  */
+                      tmp_length = xsum (tmp_length, 1);
+                      break;
+
+                    case 'o':
 # if HAVE_LONG_LONG_INT
-                     if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
-                                         * 0.333334 /* binary -> octal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     else
+                      if (type == TYPE_LONGLONGINT || type == 
TYPE_ULONGLONGINT)
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned long long) * 
CHAR_BIT
+                                          * 0.333334 /* binary -> octal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      else
 # endif
-                     if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned long) * CHAR_BIT
-                                         * 0.333334 /* binary -> octal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     else
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned int) * CHAR_BIT
-                                         * 0.333334 /* binary -> octal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     if (tmp_length < precision)
-                       tmp_length = precision;
-                     /* Add 1, to account for a leading sign.  */
-                     tmp_length = xsum (tmp_length, 1);
-                     break;
-
-                   case 'x': case 'X':
+                      if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned long) * CHAR_BIT
+                                          * 0.333334 /* binary -> octal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      else
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned int) * CHAR_BIT
+                                          * 0.333334 /* binary -> octal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      if (tmp_length < precision)
+                        tmp_length = precision;
+                      /* Add 1, to account for a leading sign.  */
+                      tmp_length = xsum (tmp_length, 1);
+                      break;
+
+                    case 'x': case 'X':
 # if HAVE_LONG_LONG_INT
-                     if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
-                                         * 0.25 /* binary -> hexadecimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     else
+                      if (type == TYPE_LONGLONGINT || type == 
TYPE_ULONGLONGINT)
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned long long) * 
CHAR_BIT
+                                          * 0.25 /* binary -> hexadecimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      else
 # endif
-                     if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned long) * CHAR_BIT
-                                         * 0.25 /* binary -> hexadecimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     else
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned int) * CHAR_BIT
-                                         * 0.25 /* binary -> hexadecimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     if (tmp_length < precision)
-                       tmp_length = precision;
-                     /* Add 2, to account for a leading sign or alternate 
form.  */
-                     tmp_length = xsum (tmp_length, 2);
-                     break;
-
-                   case 'f': case 'F':
-                     if (type == TYPE_LONGDOUBLE)
-                       tmp_length =
-                         (unsigned int) (LDBL_MAX_EXP
-                                         * 0.30103 /* binary -> decimal */
-                                         * 2 /* estimate for FLAG_GROUP */
-                                        )
-                         + 1 /* turn floor into ceil */
-                         + 10; /* sign, decimal point etc. */
-                     else
-                       tmp_length =
-                         (unsigned int) (DBL_MAX_EXP
-                                         * 0.30103 /* binary -> decimal */
-                                         * 2 /* estimate for FLAG_GROUP */
-                                        )
-                         + 1 /* turn floor into ceil */
-                         + 10; /* sign, decimal point etc. */
-                     tmp_length = xsum (tmp_length, precision);
-                     break;
-
-                   case 'e': case 'E': case 'g': case 'G':
-                     tmp_length =
-                       12; /* sign, decimal point, exponent etc. */
-                     tmp_length = xsum (tmp_length, precision);
-                     break;
-
-                   case 'a': case 'A':
-                     if (type == TYPE_LONGDOUBLE)
-                       tmp_length =
-                         (unsigned int) (LDBL_DIG
-                                         * 0.831 /* decimal -> hexadecimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     else
-                       tmp_length =
-                         (unsigned int) (DBL_DIG
-                                         * 0.831 /* decimal -> hexadecimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     if (tmp_length < precision)
-                       tmp_length = precision;
-                     /* Account for sign, decimal point etc. */
-                     tmp_length = xsum (tmp_length, 12);
-                     break;
-
-                   case 'c':
+                      if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned long) * CHAR_BIT
+                                          * 0.25 /* binary -> hexadecimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      else
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned int) * CHAR_BIT
+                                          * 0.25 /* binary -> hexadecimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      if (tmp_length < precision)
+                        tmp_length = precision;
+                      /* Add 2, to account for a leading sign or alternate 
form.  */
+                      tmp_length = xsum (tmp_length, 2);
+                      break;
+
+                    case 'f': case 'F':
+                      if (type == TYPE_LONGDOUBLE)
+                        tmp_length =
+                          (unsigned int) (LDBL_MAX_EXP
+                                          * 0.30103 /* binary -> decimal */
+                                          * 2 /* estimate for FLAG_GROUP */
+                                         )
+                          + 1 /* turn floor into ceil */
+                          + 10; /* sign, decimal point etc. */
+                      else
+                        tmp_length =
+                          (unsigned int) (DBL_MAX_EXP
+                                          * 0.30103 /* binary -> decimal */
+                                          * 2 /* estimate for FLAG_GROUP */
+                                         )
+                          + 1 /* turn floor into ceil */
+                          + 10; /* sign, decimal point etc. */
+                      tmp_length = xsum (tmp_length, precision);
+                      break;
+
+                    case 'e': case 'E': case 'g': case 'G':
+                      tmp_length =
+                        12; /* sign, decimal point, exponent etc. */
+                      tmp_length = xsum (tmp_length, precision);
+                      break;
+
+                    case 'a': case 'A':
+                      if (type == TYPE_LONGDOUBLE)
+                        tmp_length =
+                          (unsigned int) (LDBL_DIG
+                                          * 0.831 /* decimal -> hexadecimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      else
+                        tmp_length =
+                          (unsigned int) (DBL_DIG
+                                          * 0.831 /* decimal -> hexadecimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      if (tmp_length < precision)
+                        tmp_length = precision;
+                      /* Account for sign, decimal point etc. */
+                      tmp_length = xsum (tmp_length, 12);
+                      break;
+
+                    case 'c':
 # if HAVE_WINT_T && !WIDE_CHAR_VERSION
-                     if (type == TYPE_WIDE_CHAR)
-                       tmp_length = MB_CUR_MAX;
-                     else
+                      if (type == TYPE_WIDE_CHAR)
+                        tmp_length = MB_CUR_MAX;
+                      else
 # endif
-                       tmp_length = 1;
-                     break;
+                        tmp_length = 1;
+                      break;
 
-                   case 's':
+                    case 's':
 # if HAVE_WCHAR_T
-                     if (type == TYPE_WIDE_STRING)
-                       {
+                      if (type == TYPE_WIDE_STRING)
+                        {
 #  if WIDE_CHAR_VERSION
-                         /* ISO C says about %ls in fwprintf:
-                              "If the precision is not specified or is greater
-                               than the size of the array, the array shall
-                               contain a null wide character."
-                            So if there is a precision, we must not use
-                            wcslen.  */
-                         const wchar_t *arg =
-                           a.arg[dp->arg_index].a.a_wide_string;
-
-                         if (has_precision)
-                           tmp_length = local_wcsnlen (arg, precision);
-                         else
-                           tmp_length = local_wcslen (arg);
+                          /* ISO C says about %ls in fwprintf:
+                               "If the precision is not specified or is greater
+                                than the size of the array, the array shall
+                                contain a null wide character."
+                             So if there is a precision, we must not use
+                             wcslen.  */
+                          const wchar_t *arg =
+                            a.arg[dp->arg_index].a.a_wide_string;
+
+                          if (has_precision)
+                            tmp_length = local_wcsnlen (arg, precision);
+                          else
+                            tmp_length = local_wcslen (arg);
 #  else
-                         /* ISO C says about %ls in fprintf:
-                              "If a precision is specified, no more than that
-                               many bytes are written (including shift
-                               sequences, if any), and the array shall contain
-                               a null wide character if, to equal the
-                               multibyte character sequence length given by
-                               the precision, the function would need to
-                               access a wide character one past the end of the
-                               array."
-                            So if there is a precision, we must not use
-                            wcslen.  */
-                         /* This case has already been handled above.  */
-                         abort ();
+                          /* ISO C says about %ls in fprintf:
+                               "If a precision is specified, no more than that
+                                many bytes are written (including shift
+                                sequences, if any), and the array shall contain
+                                a null wide character if, to equal the
+                                multibyte character sequence length given by
+                                the precision, the function would need to
+                                access a wide character one past the end of the
+                                array."
+                             So if there is a precision, we must not use
+                             wcslen.  */
+                          /* This case has already been handled above.  */
+                          abort ();
 #  endif
-                       }
-                     else
+                        }
+                      else
 # endif
-                       {
+                        {
 # if WIDE_CHAR_VERSION
-                         /* ISO C says about %s in fwprintf:
-                              "If the precision is not specified or is greater
-                               than the size of the converted array, the
-                               converted array shall contain a null wide
-                               character."
-                            So if there is a precision, we must not use
-                            strlen.  */
-                         /* This case has already been handled above.  */
-                         abort ();
+                          /* ISO C says about %s in fwprintf:
+                               "If the precision is not specified or is greater
+                                than the size of the converted array, the
+                                converted array shall contain a null wide
+                                character."
+                             So if there is a precision, we must not use
+                             strlen.  */
+                          /* This case has already been handled above.  */
+                          abort ();
 # else
-                         /* ISO C says about %s in fprintf:
-                              "If the precision is not specified or greater
-                               than the size of the array, the array shall
-                               contain a null character."
-                            So if there is a precision, we must not use
-                            strlen.  */
-                         const char *arg = a.arg[dp->arg_index].a.a_string;
-
-                         if (has_precision)
-                           tmp_length = local_strnlen (arg, precision);
-                         else
-                           tmp_length = strlen (arg);
+                          /* ISO C says about %s in fprintf:
+                               "If the precision is not specified or greater
+                                than the size of the array, the array shall
+                                contain a null character."
+                             So if there is a precision, we must not use
+                             strlen.  */
+                          const char *arg = a.arg[dp->arg_index].a.a_string;
+
+                          if (has_precision)
+                            tmp_length = local_strnlen (arg, precision);
+                          else
+                            tmp_length = strlen (arg);
 # endif
-                       }
-                     break;
-
-                   case 'p':
-                     tmp_length =
-                       (unsigned int) (sizeof (void *) * CHAR_BIT
-                                       * 0.25 /* binary -> hexadecimal */
-                                      )
-                         + 1 /* turn floor into ceil */
-                         + 2; /* account for leading 0x */
-                     break;
-
-                   default:
-                     abort ();
-                   }
-
-                 if (!pad_ourselves)
-                   {
+                        }
+                      break;
+
+                    case 'p':
+                      tmp_length =
+                        (unsigned int) (sizeof (void *) * CHAR_BIT
+                                        * 0.25 /* binary -> hexadecimal */
+                                       )
+                          + 1 /* turn floor into ceil */
+                          + 2; /* account for leading 0x */
+                      break;
+
+                    default:
+                      abort ();
+                    }
+
+                  if (!pad_ourselves)
+                    {
 # if ENABLE_UNISTDIO
-                     /* Padding considers the number of characters, therefore
-                        the number of elements after padding may be
-                          > max (tmp_length, width)
-                        but is certainly
-                          <= tmp_length + width.  */
-                     tmp_length = xsum (tmp_length, width);
+                      /* Padding considers the number of characters, therefore
+                         the number of elements after padding may be
+                           > max (tmp_length, width)
+                         but is certainly
+                           <= tmp_length + width.  */
+                      tmp_length = xsum (tmp_length, width);
 # else
-                     /* Padding considers the number of elements,
-                        says POSIX.  */
-                     if (tmp_length < width)
-                       tmp_length = width;
+                      /* Padding considers the number of elements,
+                         says POSIX.  */
+                      if (tmp_length < width)
+                        tmp_length = width;
 # endif
-                   }
-
-                 tmp_length = xsum (tmp_length, 1); /* account for trailing 
NUL */
-               }
-
-               if (tmp_length <= sizeof (tmpbuf) / sizeof (TCHAR_T))
-                 tmp = tmpbuf;
-               else
-                 {
-                   size_t tmp_memsize = xtimes (tmp_length, sizeof (TCHAR_T));
-
-                   if (size_overflow_p (tmp_memsize))
-                     /* Overflow, would lead to out of memory.  */
-                     goto out_of_memory;
-                   tmp = (TCHAR_T *) malloc (tmp_memsize);
-                   if (tmp == NULL)
-                     /* Out of memory.  */
-                     goto out_of_memory;
-                 }
+                    }
+
+                  tmp_length = xsum (tmp_length, 1); /* account for trailing 
NUL */
+                }
+
+                if (tmp_length <= sizeof (tmpbuf) / sizeof (TCHAR_T))
+                  tmp = tmpbuf;
+                else
+                  {
+                    size_t tmp_memsize = xtimes (tmp_length, sizeof (TCHAR_T));
+
+                    if (size_overflow_p (tmp_memsize))
+                      /* Overflow, would lead to out of memory.  */
+                      goto out_of_memory;
+                    tmp = (TCHAR_T *) malloc (tmp_memsize);
+                    if (tmp == NULL)
+                      /* Out of memory.  */
+                      goto out_of_memory;
+                  }
 #endif
 
-               /* Construct the format string for calling snprintf or
-                  sprintf.  */
-               fbp = buf;
-               *fbp++ = '%';
+                /* Construct the format string for calling snprintf or
+                   sprintf.  */
+                fbp = buf;
+                *fbp++ = '%';
 #if NEED_PRINTF_FLAG_GROUPING
-               /* The underlying implementation doesn't support the ' flag.
-                  Produce no grouping characters in this case; this is
-                  acceptable because the grouping is locale dependent.  */
+                /* The underlying implementation doesn't support the ' flag.
+                   Produce no grouping characters in this case; this is
+                   acceptable because the grouping is locale dependent.  */
 #else
-               if (flags & FLAG_GROUP)
-                 *fbp++ = '\'';
+                if (flags & FLAG_GROUP)
+                  *fbp++ = '\'';
 #endif
-               if (flags & FLAG_LEFT)
-                 *fbp++ = '-';
-               if (flags & FLAG_SHOWSIGN)
-                 *fbp++ = '+';
-               if (flags & FLAG_SPACE)
-                 *fbp++ = ' ';
-               if (flags & FLAG_ALT)
-                 *fbp++ = '#';
-               if (!pad_ourselves)
-                 {
-                   if (flags & FLAG_ZERO)
-                     *fbp++ = '0';
-                   if (dp->width_start != dp->width_end)
-                     {
-                       size_t n = dp->width_end - dp->width_start;
-                       /* The width specification is known to consist only
-                          of standard ASCII characters.  */
-                       if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
-                         {
-                           memcpy (fbp, dp->width_start, n * sizeof (TCHAR_T));
-                           fbp += n;
-                         }
-                       else
-                         {
-                           const FCHAR_T *mp = dp->width_start;
-                           do
-                             *fbp++ = (unsigned char) *mp++;
-                           while (--n > 0);
-                         }
-                     }
-                 }
-               if (!prec_ourselves)
-                 {
-                   if (dp->precision_start != dp->precision_end)
-                     {
-                       size_t n = dp->precision_end - dp->precision_start;
-                       /* The precision specification is known to consist only
-                          of standard ASCII characters.  */
-                       if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
-                         {
-                           memcpy (fbp, dp->precision_start, n * sizeof 
(TCHAR_T));
-                           fbp += n;
-                         }
-                       else
-                         {
-                           const FCHAR_T *mp = dp->precision_start;
-                           do
-                             *fbp++ = (unsigned char) *mp++;
-                           while (--n > 0);
-                         }
-                     }
-                 }
-
-               switch (type)
-                 {
+                if (flags & FLAG_LEFT)
+                  *fbp++ = '-';
+                if (flags & FLAG_SHOWSIGN)
+                  *fbp++ = '+';
+                if (flags & FLAG_SPACE)
+                  *fbp++ = ' ';
+                if (flags & FLAG_ALT)
+                  *fbp++ = '#';
+                if (!pad_ourselves)
+                  {
+                    if (flags & FLAG_ZERO)
+                      *fbp++ = '0';
+                    if (dp->width_start != dp->width_end)
+                      {
+                        size_t n = dp->width_end - dp->width_start;
+                        /* The width specification is known to consist only
+                           of standard ASCII characters.  */
+                        if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
+                          {
+                            memcpy (fbp, dp->width_start, n * sizeof 
(TCHAR_T));
+                            fbp += n;
+                          }
+                        else
+                          {
+                            const FCHAR_T *mp = dp->width_start;
+                            do
+                              *fbp++ = (unsigned char) *mp++;
+                            while (--n > 0);
+                          }
+                      }
+                  }
+                if (!prec_ourselves)
+                  {
+                    if (dp->precision_start != dp->precision_end)
+                      {
+                        size_t n = dp->precision_end - dp->precision_start;
+                        /* The precision specification is known to consist only
+                           of standard ASCII characters.  */
+                        if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
+                          {
+                            memcpy (fbp, dp->precision_start, n * sizeof 
(TCHAR_T));
+                            fbp += n;
+                          }
+                        else
+                          {
+                            const FCHAR_T *mp = dp->precision_start;
+                            do
+                              *fbp++ = (unsigned char) *mp++;
+                            while (--n > 0);
+                          }
+                      }
+                  }
+
+                switch (type)
+                  {
 #if HAVE_LONG_LONG_INT
-                 case TYPE_LONGLONGINT:
-                 case TYPE_ULONGLONGINT:
+                  case TYPE_LONGLONGINT:
+                  case TYPE_ULONGLONGINT:
 # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-                   *fbp++ = 'I';
-                   *fbp++ = '6';
-                   *fbp++ = '4';
-                   break;
+                    *fbp++ = 'I';
+                    *fbp++ = '6';
+                    *fbp++ = '4';
+                    break;
 # else
-                   *fbp++ = 'l';
-                   /*FALLTHROUGH*/
+                    *fbp++ = 'l';
+                    /*FALLTHROUGH*/
 # endif
 #endif
-                 case TYPE_LONGINT:
-                 case TYPE_ULONGINT:
+                  case TYPE_LONGINT:
+                  case TYPE_ULONGINT:
 #if HAVE_WINT_T
-                 case TYPE_WIDE_CHAR:
+                  case TYPE_WIDE_CHAR:
 #endif
 #if HAVE_WCHAR_T
-                 case TYPE_WIDE_STRING:
+                  case TYPE_WIDE_STRING:
 #endif
-                   *fbp++ = 'l';
-                   break;
-                 case TYPE_LONGDOUBLE:
-                   *fbp++ = 'L';
-                   break;
-                 default:
-                   break;
-                 }
+                    *fbp++ = 'l';
+                    break;
+                  case TYPE_LONGDOUBLE:
+                    *fbp++ = 'L';
+                    break;
+                  default:
+                    break;
+                  }
 #if NEED_PRINTF_DIRECTIVE_F
-               if (dp->conversion == 'F')
-                 *fbp = 'f';
-               else
+                if (dp->conversion == 'F')
+                  *fbp = 'f';
+                else
 #endif
-                 *fbp = dp->conversion;
+                  *fbp = dp->conversion;
 #if USE_SNPRINTF
 # if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) || ((defined 
_WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
-               fbp[1] = '%';
-               fbp[2] = 'n';
-               fbp[3] = '\0';
+                fbp[1] = '%';
+                fbp[2] = 'n';
+                fbp[3] = '\0';
 # else
-               /* On glibc2 systems from glibc >= 2.3 - probably also older
-                  ones - we know that snprintf's returns value conforms to
-                  ISO C 99: the gl_SNPRINTF_DIRECTIVE_N test passes.
-                  Therefore we can avoid using %n in this situation.
-                  On glibc2 systems from 2004-10-18 or newer, the use of %n
-                  in format strings in writable memory may crash the program
-                  (if compiled with _FORTIFY_SOURCE=2), so we should avoid it
-                  in this situation.  */
-               /* On native Win32 systems (such as mingw), we can avoid using
-                  %n because:
-                    - Although the gl_SNPRINTF_TRUNCATION_C99 test fails,
-                      snprintf does not write more than the specified number
-                      of bytes. (snprintf (buf, 3, "%d %d", 4567, 89) writes
-                      '4', '5', '6' into buf, not '4', '5', '\0'.)
-                    - Although the gl_SNPRINTF_RETVAL_C99 test fails, snprintf
-                      allows us to recognize the case of an insufficient
-                      buffer size: it returns -1 in this case.
-                  On native Win32 systems (such as mingw) where the OS is
-                  Windows Vista, the use of %n in format strings by default
-                  crashes the program. See
-                    <http://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and
-                    
<http://msdn2.microsoft.com/en-us/library/ms175782(VS.80).aspx>
-                  So we should avoid %n in this situation.  */
-               fbp[1] = '\0';
+                /* On glibc2 systems from glibc >= 2.3 - probably also older
+                   ones - we know that snprintf's returns value conforms to
+                   ISO C 99: the gl_SNPRINTF_DIRECTIVE_N test passes.
+                   Therefore we can avoid using %n in this situation.
+                   On glibc2 systems from 2004-10-18 or newer, the use of %n
+                   in format strings in writable memory may crash the program
+                   (if compiled with _FORTIFY_SOURCE=2), so we should avoid it
+                   in this situation.  */
+                /* On native Win32 systems (such as mingw), we can avoid using
+                   %n because:
+                     - Although the gl_SNPRINTF_TRUNCATION_C99 test fails,
+                       snprintf does not write more than the specified number
+                       of bytes. (snprintf (buf, 3, "%d %d", 4567, 89) writes
+                       '4', '5', '6' into buf, not '4', '5', '\0'.)
+                     - Although the gl_SNPRINTF_RETVAL_C99 test fails, snprintf
+                       allows us to recognize the case of an insufficient
+                       buffer size: it returns -1 in this case.
+                   On native Win32 systems (such as mingw) where the OS is
+                   Windows Vista, the use of %n in format strings by default
+                   crashes the program. See
+                     <http://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and
+                     
<http://msdn2.microsoft.com/en-us/library/ms175782(VS.80).aspx>
+                   So we should avoid %n in this situation.  */
+                fbp[1] = '\0';
 # endif
 #else
-               fbp[1] = '\0';
+                fbp[1] = '\0';
 #endif
 
-               /* Construct the arguments for calling snprintf or sprintf.  */
-               prefix_count = 0;
-               if (!pad_ourselves && dp->width_arg_index != ARG_NONE)
-                 {
-                   if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
-                     abort ();
-                   prefixes[prefix_count++] = 
a.arg[dp->width_arg_index].a.a_int;
-                 }
-               if (!prec_ourselves && dp->precision_arg_index != ARG_NONE)
-                 {
-                   if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
-                     abort ();
-                   prefixes[prefix_count++] = 
a.arg[dp->precision_arg_index].a.a_int;
-                 }
+                /* Construct the arguments for calling snprintf or sprintf.  */
+                prefix_count = 0;
+                if (!pad_ourselves && dp->width_arg_index != ARG_NONE)
+                  {
+                    if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                      abort ();
+                    prefixes[prefix_count++] = 
a.arg[dp->width_arg_index].a.a_int;
+                  }
+                if (!prec_ourselves && dp->precision_arg_index != ARG_NONE)
+                  {
+                    if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+                      abort ();
+                    prefixes[prefix_count++] = 
a.arg[dp->precision_arg_index].a.a_int;
+                  }
 
 #if USE_SNPRINTF
-               /* The SNPRINTF result is appended after result[0..length].
-                  The latter is an array of DCHAR_T; SNPRINTF appends an
-                  array of TCHAR_T to it.  This is possible because
-                  sizeof (TCHAR_T) divides sizeof (DCHAR_T) and
-                  alignof (TCHAR_T) <= alignof (DCHAR_T).  */
+                /* The SNPRINTF result is appended after result[0..length].
+                   The latter is an array of DCHAR_T; SNPRINTF appends an
+                   array of TCHAR_T to it.  This is possible because
+                   sizeof (TCHAR_T) divides sizeof (DCHAR_T) and
+                   alignof (TCHAR_T) <= alignof (DCHAR_T).  */
 # define TCHARS_PER_DCHAR (sizeof (DCHAR_T) / sizeof (TCHAR_T))
-               /* Ensure that maxlen below will be >= 2.  Needed on BeOS,
-                  where an snprintf() with maxlen==1 acts like sprintf().  */
-               ENSURE_ALLOCATION (xsum (length,
-                                        (2 + TCHARS_PER_DCHAR - 1)
-                                        / TCHARS_PER_DCHAR));
-               /* Prepare checking whether snprintf returns the count
-                  via %n.  */
-               *(TCHAR_T *) (result + length) = '\0';
+                /* Ensure that maxlen below will be >= 2.  Needed on BeOS,
+                   where an snprintf() with maxlen==1 acts like sprintf().  */
+                ENSURE_ALLOCATION (xsum (length,
+                                         (2 + TCHARS_PER_DCHAR - 1)
+                                         / TCHARS_PER_DCHAR));
+                /* Prepare checking whether snprintf returns the count
+                   via %n.  */
+                *(TCHAR_T *) (result + length) = '\0';
 #endif
 
-               for (;;)
-                 {
-                   int count = -1;
+                for (;;)
+                  {
+                    int count = -1;
 
 #if USE_SNPRINTF
-                   int retcount = 0;
-                   size_t maxlen = allocated - length;
-                   /* SNPRINTF can fail if its second argument is
-                      > INT_MAX.  */
-                   if (maxlen > INT_MAX / TCHARS_PER_DCHAR)
-                     maxlen = INT_MAX / TCHARS_PER_DCHAR;
-                   maxlen = maxlen * TCHARS_PER_DCHAR;
+                    int retcount = 0;
+                    size_t maxlen = allocated - length;
+                    /* SNPRINTF can fail if its second argument is
+                       > INT_MAX.  */
+                    if (maxlen > INT_MAX / TCHARS_PER_DCHAR)
+                      maxlen = INT_MAX / TCHARS_PER_DCHAR;
+                    maxlen = maxlen * TCHARS_PER_DCHAR;
 # define SNPRINTF_BUF(arg) \
-                   switch (prefix_count)                                   \
-                     {                                                     \
-                     case 0:                                               \
-                       retcount = SNPRINTF ((TCHAR_T *) (result + length), \
-                                            maxlen, buf,                   \
-                                            arg, &count);                  \
-                       break;                                              \
-                     case 1:                                               \
-                       retcount = SNPRINTF ((TCHAR_T *) (result + length), \
-                                            maxlen, buf,                   \
-                                            prefixes[0], arg, &count);     \
-                       break;                                              \
-                     case 2:                                               \
-                       retcount = SNPRINTF ((TCHAR_T *) (result + length), \
-                                            maxlen, buf,                   \
-                                            prefixes[0], prefixes[1], arg, \
-                                            &count);                       \
-                       break;                                              \
-                     default:                                              \
-                       abort ();                                           \
-                     }
+                    switch (prefix_count)                                   \
+                      {                                                     \
+                      case 0:                                               \
+                        retcount = SNPRINTF ((TCHAR_T *) (result + length), \
+                                             maxlen, buf,                   \
+                                             arg, &count);                  \
+                        break;                                              \
+                      case 1:                                               \
+                        retcount = SNPRINTF ((TCHAR_T *) (result + length), \
+                                             maxlen, buf,                   \
+                                             prefixes[0], arg, &count);     \
+                        break;                                              \
+                      case 2:                                               \
+                        retcount = SNPRINTF ((TCHAR_T *) (result + length), \
+                                             maxlen, buf,                   \
+                                             prefixes[0], prefixes[1], arg, \
+                                             &count);                       \
+                        break;                                              \
+                      default:                                              \
+                        abort ();                                           \
+                      }
 #else
 # define SNPRINTF_BUF(arg) \
-                   switch (prefix_count)                                   \
-                     {                                                     \
-                     case 0:                                               \
-                       count = sprintf (tmp, buf, arg);                    \
-                       break;                                              \
-                     case 1:                                               \
-                       count = sprintf (tmp, buf, prefixes[0], arg);       \
-                       break;                                              \
-                     case 2:                                               \
-                       count = sprintf (tmp, buf, prefixes[0], prefixes[1],\
-                                        arg);                              \
-                       break;                                              \
-                     default:                                              \
-                       abort ();                                           \
-                     }
+                    switch (prefix_count)                                   \
+                      {                                                     \
+                      case 0:                                               \
+                        count = sprintf (tmp, buf, arg);                    \
+                        break;                                              \
+                      case 1:                                               \
+                        count = sprintf (tmp, buf, prefixes[0], arg);       \
+                        break;                                              \
+                      case 2:                                               \
+                        count = sprintf (tmp, buf, prefixes[0], prefixes[1],\
+                                         arg);                              \
+                        break;                                              \
+                      default:                                              \
+                        abort ();                                           \
+                      }
 #endif
 
-                   switch (type)
-                     {
-                     case TYPE_SCHAR:
-                       {
-                         int arg = a.arg[dp->arg_index].a.a_schar;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_UCHAR:
-                       {
-                         unsigned int arg = a.arg[dp->arg_index].a.a_uchar;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_SHORT:
-                       {
-                         int arg = a.arg[dp->arg_index].a.a_short;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_USHORT:
-                       {
-                         unsigned int arg = a.arg[dp->arg_index].a.a_ushort;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_INT:
-                       {
-                         int arg = a.arg[dp->arg_index].a.a_int;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_UINT:
-                       {
-                         unsigned int arg = a.arg[dp->arg_index].a.a_uint;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_LONGINT:
-                       {
-                         long int arg = a.arg[dp->arg_index].a.a_longint;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_ULONGINT:
-                       {
-                         unsigned long int arg = 
a.arg[dp->arg_index].a.a_ulongint;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
+                    switch (type)
+                      {
+                      case TYPE_SCHAR:
+                        {
+                          int arg = a.arg[dp->arg_index].a.a_schar;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_UCHAR:
+                        {
+                          unsigned int arg = a.arg[dp->arg_index].a.a_uchar;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_SHORT:
+                        {
+                          int arg = a.arg[dp->arg_index].a.a_short;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_USHORT:
+                        {
+                          unsigned int arg = a.arg[dp->arg_index].a.a_ushort;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_INT:
+                        {
+                          int arg = a.arg[dp->arg_index].a.a_int;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_UINT:
+                        {
+                          unsigned int arg = a.arg[dp->arg_index].a.a_uint;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_LONGINT:
+                        {
+                          long int arg = a.arg[dp->arg_index].a.a_longint;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_ULONGINT:
+                        {
+                          unsigned long int arg = 
a.arg[dp->arg_index].a.a_ulongint;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
 #if HAVE_LONG_LONG_INT
-                     case TYPE_LONGLONGINT:
-                       {
-                         long long int arg = 
a.arg[dp->arg_index].a.a_longlongint;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_ULONGLONGINT:
-                       {
-                         unsigned long long int arg = 
a.arg[dp->arg_index].a.a_ulonglongint;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
+                      case TYPE_LONGLONGINT:
+                        {
+                          long long int arg = 
a.arg[dp->arg_index].a.a_longlongint;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_ULONGLONGINT:
+                        {
+                          unsigned long long int arg = 
a.arg[dp->arg_index].a.a_ulonglongint;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
 #endif
-                     case TYPE_DOUBLE:
-                       {
-                         double arg = a.arg[dp->arg_index].a.a_double;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_LONGDOUBLE:
-                       {
-                         long double arg = a.arg[dp->arg_index].a.a_longdouble;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_CHAR:
-                       {
-                         int arg = a.arg[dp->arg_index].a.a_char;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
+                      case TYPE_DOUBLE:
+                        {
+                          double arg = a.arg[dp->arg_index].a.a_double;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_LONGDOUBLE:
+                        {
+                          long double arg = 
a.arg[dp->arg_index].a.a_longdouble;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_CHAR:
+                        {
+                          int arg = a.arg[dp->arg_index].a.a_char;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
 #if HAVE_WINT_T
-                     case TYPE_WIDE_CHAR:
-                       {
-                         wint_t arg = a.arg[dp->arg_index].a.a_wide_char;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
+                      case TYPE_WIDE_CHAR:
+                        {
+                          wint_t arg = a.arg[dp->arg_index].a.a_wide_char;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
 #endif
-                     case TYPE_STRING:
-                       {
-                         const char *arg = a.arg[dp->arg_index].a.a_string;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
+                      case TYPE_STRING:
+                        {
+                          const char *arg = a.arg[dp->arg_index].a.a_string;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
 #if HAVE_WCHAR_T
-                     case TYPE_WIDE_STRING:
-                       {
-                         const wchar_t *arg = 
a.arg[dp->arg_index].a.a_wide_string;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
+                      case TYPE_WIDE_STRING:
+                        {
+                          const wchar_t *arg = 
a.arg[dp->arg_index].a.a_wide_string;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
 #endif
-                     case TYPE_POINTER:
-                       {
-                         void *arg = a.arg[dp->arg_index].a.a_pointer;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     default:
-                       abort ();
-                     }
+                      case TYPE_POINTER:
+                        {
+                          void *arg = a.arg[dp->arg_index].a.a_pointer;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      default:
+                        abort ();
+                      }
 
 #if USE_SNPRINTF
-                   /* Portability: Not all implementations of snprintf()
-                      are ISO C 99 compliant.  Determine the number of
-                      bytes that snprintf() has produced or would have
-                      produced.  */
-                   if (count >= 0)
-                     {
-                       /* Verify that snprintf() has NUL-terminated its
-                          result.  */
-                       if (count < maxlen
-                           && ((TCHAR_T *) (result + length)) [count] != '\0')
-                         abort ();
-                       /* Portability hack.  */
-                       if (retcount > count)
-                         count = retcount;
-                     }
-                   else
-                     {
-                       /* snprintf() doesn't understand the '%n'
-                          directive.  */
-                       if (fbp[1] != '\0')
-                         {
-                           /* Don't use the '%n' directive; instead, look
-                              at the snprintf() return value.  */
-                           fbp[1] = '\0';
-                           continue;
-                         }
-                       else
-                         {
-                           /* Look at the snprintf() return value.  */
-                           if (retcount < 0)
-                             {
-                               /* HP-UX 10.20 snprintf() is doubly deficient:
-                                  It doesn't understand the '%n' directive,
-                                  *and* it returns -1 (rather than the length
-                                  that would have been required) when the
-                                  buffer is too small.  */
-                               size_t bigger_need =
-                                 xsum (xtimes (allocated, 2), 12);
-                               ENSURE_ALLOCATION (bigger_need);
-                               continue;
-                             }
-                           else
-                             count = retcount;
-                         }
-                     }
+                    /* Portability: Not all implementations of snprintf()
+                       are ISO C 99 compliant.  Determine the number of
+                       bytes that snprintf() has produced or would have
+                       produced.  */
+                    if (count >= 0)
+                      {
+                        /* Verify that snprintf() has NUL-terminated its
+                           result.  */
+                        if (count < maxlen
+                            && ((TCHAR_T *) (result + length)) [count] != '\0')
+                          abort ();
+                        /* Portability hack.  */
+                        if (retcount > count)
+                          count = retcount;
+                      }
+                    else
+                      {
+                        /* snprintf() doesn't understand the '%n'
+                           directive.  */
+                        if (fbp[1] != '\0')
+                          {
+                            /* Don't use the '%n' directive; instead, look
+                               at the snprintf() return value.  */
+                            fbp[1] = '\0';
+                            continue;
+                          }
+                        else
+                          {
+                            /* Look at the snprintf() return value.  */
+                            if (retcount < 0)
+                              {
+                                /* HP-UX 10.20 snprintf() is doubly deficient:
+                                   It doesn't understand the '%n' directive,
+                                   *and* it returns -1 (rather than the length
+                                   that would have been required) when the
+                                   buffer is too small.  */
+                                size_t bigger_need =
+                                  xsum (xtimes (allocated, 2), 12);
+                                ENSURE_ALLOCATION (bigger_need);
+                                continue;
+                              }
+                            else
+                              count = retcount;
+                          }
+                      }
 #endif
 
-                   /* Attempt to handle failure.  */
-                   if (count < 0)
-                     {
-                       if (!(result == resultbuf || result == NULL))
-                         free (result);
-                       if (buf_malloced != NULL)
-                         free (buf_malloced);
-                       CLEANUP ();
-                       errno = EINVAL;
-                       return NULL;
-                     }
+                    /* Attempt to handle failure.  */
+                    if (count < 0)
+                      {
+                        if (!(result == resultbuf || result == NULL))
+                          free (result);
+                        if (buf_malloced != NULL)
+                          free (buf_malloced);
+                        CLEANUP ();
+                        errno = EINVAL;
+                        return NULL;
+                      }
 
 #if USE_SNPRINTF
-                   /* Handle overflow of the allocated buffer.
-                      If such an overflow occurs, a C99 compliant snprintf()
-                      returns a count >= maxlen.  However, a non-compliant
-                      snprintf() function returns only count = maxlen - 1.  To
-                      cover both cases, test whether count >= maxlen - 1.  */
-                   if ((unsigned int) count + 1 >= maxlen)
-                     {
-                       /* If maxlen already has attained its allowed maximum,
-                          allocating more memory will not increase maxlen.
-                          Instead of looping, bail out.  */
-                       if (maxlen == INT_MAX / TCHARS_PER_DCHAR)
-                         goto overflow;
-                       else
-                         {
-                           /* Need at least (count + 1) * sizeof (TCHAR_T)
-                              bytes.  (The +1 is for the trailing NUL.)
-                              But ask for (count + 2) * sizeof (TCHAR_T)
-                              bytes, so that in the next round, we likely get
-                                maxlen > (unsigned int) count + 1
-                              and so we don't get here again.
-                              And allocate proportionally, to avoid looping
-                              eternally if snprintf() reports a too small
-                              count.  */
-                           size_t n =
-                             xmax (xsum (length,
-                                         ((unsigned int) count + 2
-                                          + TCHARS_PER_DCHAR - 1)
-                                         / TCHARS_PER_DCHAR),
-                                   xtimes (allocated, 2));
-
-                           ENSURE_ALLOCATION (n);
-                           continue;
-                         }
-                     }
+                    /* Handle overflow of the allocated buffer.
+                       If such an overflow occurs, a C99 compliant snprintf()
+                       returns a count >= maxlen.  However, a non-compliant
+                       snprintf() function returns only count = maxlen - 1.  To
+                       cover both cases, test whether count >= maxlen - 1.  */
+                    if ((unsigned int) count + 1 >= maxlen)
+                      {
+                        /* If maxlen already has attained its allowed maximum,
+                           allocating more memory will not increase maxlen.
+                           Instead of looping, bail out.  */
+                        if (maxlen == INT_MAX / TCHARS_PER_DCHAR)
+                          goto overflow;
+                        else
+                          {
+                            /* Need at least (count + 1) * sizeof (TCHAR_T)
+                               bytes.  (The +1 is for the trailing NUL.)
+                               But ask for (count + 2) * sizeof (TCHAR_T)
+                               bytes, so that in the next round, we likely get
+                                 maxlen > (unsigned int) count + 1
+                               and so we don't get here again.
+                               And allocate proportionally, to avoid looping
+                               eternally if snprintf() reports a too small
+                               count.  */
+                            size_t n =
+                              xmax (xsum (length,
+                                          ((unsigned int) count + 2
+                                           + TCHARS_PER_DCHAR - 1)
+                                          / TCHARS_PER_DCHAR),
+                                    xtimes (allocated, 2));
+
+                            ENSURE_ALLOCATION (n);
+                            continue;
+                          }
+                      }
 #endif
 
 #if NEED_PRINTF_UNBOUNDED_PRECISION
-                   if (prec_ourselves)
-                     {
-                       /* Handle the precision.  */
-                       TCHAR_T *prec_ptr =
+                    if (prec_ourselves)
+                      {
+                        /* Handle the precision.  */
+                        TCHAR_T *prec_ptr =
 # if USE_SNPRINTF
-                         (TCHAR_T *) (result + length);
+                          (TCHAR_T *) (result + length);
 # else
-                         tmp;
+                          tmp;
 # endif
-                       size_t prefix_count;
-                       size_t move;
-
-                       prefix_count = 0;
-                       /* Put the additional zeroes after the sign.  */
-                       if (count >= 1
-                           && (*prec_ptr == '-' || *prec_ptr == '+'
-                               || *prec_ptr == ' '))
-                         prefix_count = 1;
-                       /* Put the additional zeroes after the 0x prefix if
-                          (flags & FLAG_ALT) || (dp->conversion == 'p').  */
-                       else if (count >= 2
-                                && prec_ptr[0] == '0'
-                                && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X'))
-                         prefix_count = 2;
-
-                       move = count - prefix_count;
-                       if (precision > move)
-                         {
-                           /* Insert zeroes.  */
-                           size_t insert = precision - move;
-                           TCHAR_T *prec_end;
+                        size_t prefix_count;
+                        size_t move;
+
+                        prefix_count = 0;
+                        /* Put the additional zeroes after the sign.  */
+                        if (count >= 1
+                            && (*prec_ptr == '-' || *prec_ptr == '+'
+                                || *prec_ptr == ' '))
+                          prefix_count = 1;
+                        /* Put the additional zeroes after the 0x prefix if
+                           (flags & FLAG_ALT) || (dp->conversion == 'p').  */
+                        else if (count >= 2
+                                 && prec_ptr[0] == '0'
+                                 && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X'))
+                          prefix_count = 2;
+
+                        move = count - prefix_count;
+                        if (precision > move)
+                          {
+                            /* Insert zeroes.  */
+                            size_t insert = precision - move;
+                            TCHAR_T *prec_end;
 
 # if USE_SNPRINTF
-                           size_t n =
-                             xsum (length,
-                                   (count + insert + TCHARS_PER_DCHAR - 1)
-                                   / TCHARS_PER_DCHAR);
-                           length += (count + TCHARS_PER_DCHAR - 1) / 
TCHARS_PER_DCHAR;
-                           ENSURE_ALLOCATION (n);
-                           length -= (count + TCHARS_PER_DCHAR - 1) / 
TCHARS_PER_DCHAR;
-                           prec_ptr = (TCHAR_T *) (result + length);
+                            size_t n =
+                              xsum (length,
+                                    (count + insert + TCHARS_PER_DCHAR - 1)
+                                    / TCHARS_PER_DCHAR);
+                            length += (count + TCHARS_PER_DCHAR - 1) / 
TCHARS_PER_DCHAR;
+                            ENSURE_ALLOCATION (n);
+                            length -= (count + TCHARS_PER_DCHAR - 1) / 
TCHARS_PER_DCHAR;
+                            prec_ptr = (TCHAR_T *) (result + length);
 # endif
 
-                           prec_end = prec_ptr + count;
-                           prec_ptr += prefix_count;
+                            prec_end = prec_ptr + count;
+                            prec_ptr += prefix_count;
 
-                           while (prec_end > prec_ptr)
-                             {
-                               prec_end--;
-                               prec_end[insert] = prec_end[0];
-                             }
+                            while (prec_end > prec_ptr)
+                              {
+                                prec_end--;
+                                prec_end[insert] = prec_end[0];
+                              }
 
-                           prec_end += insert;
-                           do
-                             *--prec_end = '0';
-                           while (prec_end > prec_ptr);
+                            prec_end += insert;
+                            do
+                              *--prec_end = '0';
+                            while (prec_end > prec_ptr);
 
-                           count += insert;
-                         }
-                     }
+                            count += insert;
+                          }
+                      }
 #endif
 
 #if !USE_SNPRINTF
-                   if (count >= tmp_length)
-                     /* tmp_length was incorrectly calculated - fix the
-                        code above!  */
-                     abort ();
+                    if (count >= tmp_length)
+                      /* tmp_length was incorrectly calculated - fix the
+                         code above!  */
+                      abort ();
 #endif
 
 #if !DCHAR_IS_TCHAR
-                   /* Convert from TCHAR_T[] to DCHAR_T[].  */
-                   if (dp->conversion == 'c' || dp->conversion == 's')
-                     {
-                       /* type = TYPE_CHAR or TYPE_WIDE_CHAR or TYPE_STRING
-                          TYPE_WIDE_STRING.
-                          The result string is not certainly ASCII.  */
-                       const TCHAR_T *tmpsrc;
-                       DCHAR_T *tmpdst;
-                       size_t tmpdst_len;
-                       /* This code assumes that TCHAR_T is 'char'.  */
-                       typedef int TCHAR_T_verify
-                                   [2 * (sizeof (TCHAR_T) == 1) - 1];
+                    /* Convert from TCHAR_T[] to DCHAR_T[].  */
+                    if (dp->conversion == 'c' || dp->conversion == 's')
+                      {
+                        /* type = TYPE_CHAR or TYPE_WIDE_CHAR or TYPE_STRING
+                           TYPE_WIDE_STRING.
+                           The result string is not certainly ASCII.  */
+                        const TCHAR_T *tmpsrc;
+                        DCHAR_T *tmpdst;
+                        size_t tmpdst_len;
+                        /* This code assumes that TCHAR_T is 'char'.  */
+                        typedef int TCHAR_T_verify
+                                    [2 * (sizeof (TCHAR_T) == 1) - 1];
 # if USE_SNPRINTF
-                       tmpsrc = (TCHAR_T *) (result + length);
+                        tmpsrc = (TCHAR_T *) (result + length);
 # else
-                       tmpsrc = tmp;
+                        tmpsrc = tmp;
 # endif
-                       tmpdst =
-                         DCHAR_CONV_FROM_ENCODING (locale_charset (),
-                                                   iconveh_question_mark,
-                                                   tmpsrc, count,
-                                                   NULL,
-                                                   NULL, &tmpdst_len);
-                       if (tmpdst == NULL)
-                         {
-                           int saved_errno = errno;
-                           if (!(result == resultbuf || result == NULL))
-                             free (result);
-                           if (buf_malloced != NULL)
-                             free (buf_malloced);
-                           CLEANUP ();
-                           errno = saved_errno;
-                           return NULL;
-                         }
-                       ENSURE_ALLOCATION (xsum (length, tmpdst_len));
-                       DCHAR_CPY (result + length, tmpdst, tmpdst_len);
-                       free (tmpdst);
-                       count = tmpdst_len;
-                     }
-                   else
-                     {
-                       /* The result string is ASCII.
-                          Simple 1:1 conversion.  */
+                        tmpdst =
+                          DCHAR_CONV_FROM_ENCODING (locale_charset (),
+                                                    iconveh_question_mark,
+                                                    tmpsrc, count,
+                                                    NULL,
+                                                    NULL, &tmpdst_len);
+                        if (tmpdst == NULL)
+                          {
+                            int saved_errno = errno;
+                            if (!(result == resultbuf || result == NULL))
+                              free (result);
+                            if (buf_malloced != NULL)
+                              free (buf_malloced);
+                            CLEANUP ();
+                            errno = saved_errno;
+                            return NULL;
+                          }
+                        ENSURE_ALLOCATION (xsum (length, tmpdst_len));
+                        DCHAR_CPY (result + length, tmpdst, tmpdst_len);
+                        free (tmpdst);
+                        count = tmpdst_len;
+                      }
+                    else
+                      {
+                        /* The result string is ASCII.
+                           Simple 1:1 conversion.  */
 # if USE_SNPRINTF
-                       /* If sizeof (DCHAR_T) == sizeof (TCHAR_T), it's a
-                          no-op conversion, in-place on the array starting
-                          at (result + length).  */
-                       if (sizeof (DCHAR_T) != sizeof (TCHAR_T))
+                        /* If sizeof (DCHAR_T) == sizeof (TCHAR_T), it's a
+                           no-op conversion, in-place on the array starting
+                           at (result + length).  */
+                        if (sizeof (DCHAR_T) != sizeof (TCHAR_T))
 # endif
-                         {
-                           const TCHAR_T *tmpsrc;
-                           DCHAR_T *tmpdst;
-                           size_t n;
+                          {
+                            const TCHAR_T *tmpsrc;
+                            DCHAR_T *tmpdst;
+                            size_t n;
 
 # if USE_SNPRINTF
-                           if (result == resultbuf)
-                             {
-                               tmpsrc = (TCHAR_T *) (result + length);
-                               /* ENSURE_ALLOCATION will not move tmpsrc
-                                  (because it's part of resultbuf).  */
-                               ENSURE_ALLOCATION (xsum (length, count));
-                             }
-                           else
-                             {
-                               /* ENSURE_ALLOCATION will move the array
-                                  (because it uses realloc().  */
-                               ENSURE_ALLOCATION (xsum (length, count));
-                               tmpsrc = (TCHAR_T *) (result + length);
-                             }
+                            if (result == resultbuf)
+                              {
+                                tmpsrc = (TCHAR_T *) (result + length);
+                                /* ENSURE_ALLOCATION will not move tmpsrc
+                                   (because it's part of resultbuf).  */
+                                ENSURE_ALLOCATION (xsum (length, count));
+                              }
+                            else
+                              {
+                                /* ENSURE_ALLOCATION will move the array
+                                   (because it uses realloc().  */
+                                ENSURE_ALLOCATION (xsum (length, count));
+                                tmpsrc = (TCHAR_T *) (result + length);
+                              }
 # else
-                           tmpsrc = tmp;
-                           ENSURE_ALLOCATION (xsum (length, count));
+                            tmpsrc = tmp;
+                            ENSURE_ALLOCATION (xsum (length, count));
 # endif
-                           tmpdst = result + length;
-                           /* Copy backwards, because of overlapping.  */
-                           tmpsrc += count;
-                           tmpdst += count;
-                           for (n = count; n > 0; n--)
-                             *--tmpdst = (unsigned char) *--tmpsrc;
-                         }
-                     }
+                            tmpdst = result + length;
+                            /* Copy backwards, because of overlapping.  */
+                            tmpsrc += count;
+                            tmpdst += count;
+                            for (n = count; n > 0; n--)
+                              *--tmpdst = (unsigned char) *--tmpsrc;
+                          }
+                      }
 #endif
 
 #if DCHAR_IS_TCHAR && !USE_SNPRINTF
-                   /* Make room for the result.  */
-                   if (count > allocated - length)
-                     {
-                       /* Need at least count elements.  But allocate
-                          proportionally.  */
-                       size_t n =
-                         xmax (xsum (length, count), xtimes (allocated, 2));
-
-                       ENSURE_ALLOCATION (n);
-                     }
+                    /* Make room for the result.  */
+                    if (count > allocated - length)
+                      {
+                        /* Need at least count elements.  But allocate
+                           proportionally.  */
+                        size_t n =
+                          xmax (xsum (length, count), xtimes (allocated, 2));
+
+                        ENSURE_ALLOCATION (n);
+                      }
 #endif
 
-                   /* Here count <= allocated - length.  */
+                    /* Here count <= allocated - length.  */
 
-                   /* Perform padding.  */
+                    /* Perform padding.  */
 #if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || 
NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
-                   if (pad_ourselves && has_width)
-                     {
-                       size_t w;
+                    if (pad_ourselves && has_width)
+                      {
+                        size_t w;
 # if ENABLE_UNISTDIO
-                       /* Outside POSIX, it's preferrable to compare the width
-                          against the number of _characters_ of the converted
-                          value.  */
-                       w = DCHAR_MBSNLEN (result + length, count);
+                        /* Outside POSIX, it's preferrable to compare the width
+                           against the number of _characters_ of the converted
+                           value.  */
+                        w = DCHAR_MBSNLEN (result + length, count);
 # else
-                       /* The width is compared against the number of _bytes_
-                          of the converted value, says POSIX.  */
-                       w = count;
+                        /* The width is compared against the number of _bytes_
+                           of the converted value, says POSIX.  */
+                        w = count;
 # endif
-                       if (w < width)
-                         {
-                           size_t pad = width - w;
-
-                           /* Make room for the result.  */
-                           if (xsum (count, pad) > allocated - length)
-                             {
-                               /* Need at least count + pad elements.  But
-                                  allocate proportionally.  */
-                               size_t n =
-                                 xmax (xsum3 (length, count, pad),
-                                       xtimes (allocated, 2));
+                        if (w < width)
+                          {
+                            size_t pad = width - w;
+
+                            /* Make room for the result.  */
+                            if (xsum (count, pad) > allocated - length)
+                              {
+                                /* Need at least count + pad elements.  But
+                                   allocate proportionally.  */
+                                size_t n =
+                                  xmax (xsum3 (length, count, pad),
+                                        xtimes (allocated, 2));
 
 # if USE_SNPRINTF
-                               length += count;
-                               ENSURE_ALLOCATION (n);
-                               length -= count;
+                                length += count;
+                                ENSURE_ALLOCATION (n);
+                                length -= count;
 # else
-                               ENSURE_ALLOCATION (n);
+                                ENSURE_ALLOCATION (n);
 # endif
-                             }
-                           /* Here count + pad <= allocated - length.  */
+                              }
+                            /* Here count + pad <= allocated - length.  */
 
-                           {
+                            {
 # if !DCHAR_IS_TCHAR || USE_SNPRINTF
-                             DCHAR_T * const rp = result + length;
+                              DCHAR_T * const rp = result + length;
 # else
-                             DCHAR_T * const rp = tmp;
+                              DCHAR_T * const rp = tmp;
 # endif
-                             DCHAR_T *p = rp + count;
-                             DCHAR_T *end = p + pad;
-                             DCHAR_T *pad_ptr;
+                              DCHAR_T *p = rp + count;
+                              DCHAR_T *end = p + pad;
+                              DCHAR_T *pad_ptr;
 # if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
-                             if (dp->conversion == 'c'
-                                 || dp->conversion == 's')
-                               /* No zero-padding for string directives.  */
-                               pad_ptr = NULL;
-                             else
+                              if (dp->conversion == 'c'
+                                  || dp->conversion == 's')
+                                /* No zero-padding for string directives.  */
+                                pad_ptr = NULL;
+                              else
 # endif
-                               {
-                                 pad_ptr = (*rp == '-' ? rp + 1 : rp);
-                                 /* No zero-padding of "inf" and "nan".  */
-                                 if ((*pad_ptr >= 'A' && *pad_ptr <= 'Z')
-                                     || (*pad_ptr >= 'a' && *pad_ptr <= 'z'))
-                                   pad_ptr = NULL;
-                               }
-                             /* The generated string now extends from rp to p,
-                                with the zero padding insertion point being at
-                                pad_ptr.  */
-
-                             count = count + pad; /* = end - rp */
-
-                             if (flags & FLAG_LEFT)
-                               {
-                                 /* Pad with spaces on the right.  */
-                                 for (; pad > 0; pad--)
-                                   *p++ = ' ';
-                               }
-                             else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
-                               {
-                                 /* Pad with zeroes.  */
-                                 DCHAR_T *q = end;
-
-                                 while (p > pad_ptr)
-                                   *--q = *--p;
-                                 for (; pad > 0; pad--)
-                                   *p++ = '0';
-                               }
-                             else
-                               {
-                                 /* Pad with spaces on the left.  */
-                                 DCHAR_T *q = end;
-
-                                 while (p > rp)
-                                   *--q = *--p;
-                                 for (; pad > 0; pad--)
-                                   *p++ = ' ';
-                               }
-                           }
-                         }
-                     }
+                                {
+                                  pad_ptr = (*rp == '-' ? rp + 1 : rp);
+                                  /* No zero-padding of "inf" and "nan".  */
+                                  if ((*pad_ptr >= 'A' && *pad_ptr <= 'Z')
+                                      || (*pad_ptr >= 'a' && *pad_ptr <= 'z'))
+                                    pad_ptr = NULL;
+                                }
+                              /* The generated string now extends from rp to p,
+                                 with the zero padding insertion point being at
+                                 pad_ptr.  */
+
+                              count = count + pad; /* = end - rp */
+
+                              if (flags & FLAG_LEFT)
+                                {
+                                  /* Pad with spaces on the right.  */
+                                  for (; pad > 0; pad--)
+                                    *p++ = ' ';
+                                }
+                              else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
+                                {
+                                  /* Pad with zeroes.  */
+                                  DCHAR_T *q = end;
+
+                                  while (p > pad_ptr)
+                                    *--q = *--p;
+                                  for (; pad > 0; pad--)
+                                    *p++ = '0';
+                                }
+                              else
+                                {
+                                  /* Pad with spaces on the left.  */
+                                  DCHAR_T *q = end;
+
+                                  while (p > rp)
+                                    *--q = *--p;
+                                  for (; pad > 0; pad--)
+                                    *p++ = ' ';
+                                }
+                            }
+                          }
+                      }
 #endif
 
-                   /* Here still count <= allocated - length.  */
+                    /* Here still count <= allocated - length.  */
 
 #if !DCHAR_IS_TCHAR || USE_SNPRINTF
-                   /* The snprintf() result did fit.  */
+                    /* The snprintf() result did fit.  */
 #else
-                   /* Append the sprintf() result.  */
-                   memcpy (result + length, tmp, count * sizeof (DCHAR_T));
+                    /* Append the sprintf() result.  */
+                    memcpy (result + length, tmp, count * sizeof (DCHAR_T));
 #endif
 #if !USE_SNPRINTF
-                   if (tmp != tmpbuf)
-                     free (tmp);
+                    if (tmp != tmpbuf)
+                      free (tmp);
 #endif
 
 #if NEED_PRINTF_DIRECTIVE_F
-                   if (dp->conversion == 'F')
-                     {
-                       /* Convert the %f result to upper case for %F.  */
-                       DCHAR_T *rp = result + length;
-                       size_t rc;
-                       for (rc = count; rc > 0; rc--, rp++)
-                         if (*rp >= 'a' && *rp <= 'z')
-                           *rp = *rp - 'a' + 'A';
-                     }
+                    if (dp->conversion == 'F')
+                      {
+                        /* Convert the %f result to upper case for %F.  */
+                        DCHAR_T *rp = result + length;
+                        size_t rc;
+                        for (rc = count; rc > 0; rc--, rp++)
+                          if (*rp >= 'a' && *rp <= 'z')
+                            *rp = *rp - 'a' + 'A';
+                      }
 #endif
 
-                   length += count;
-                   break;
-                 }
-             }
-         }
+                    length += count;
+                    break;
+                  }
+              }
+          }
       }
 
     /* Add the final NUL.  */
@@ -5432,12 +5432,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 
     if (result != resultbuf && length + 1 < allocated)
       {
-       /* Shrink the allocated memory if possible.  */
-       DCHAR_T *memory;
+        /* Shrink the allocated memory if possible.  */
+        DCHAR_T *memory;
 
-       memory = (DCHAR_T *) realloc (result, (length + 1) * sizeof (DCHAR_T));
-       if (memory != NULL)
-         result = memory;
+        memory = (DCHAR_T *) realloc (result, (length + 1) * sizeof (DCHAR_T));
+        if (memory != NULL)
+          result = memory;
       }
 
     if (buf_malloced != NULL)
@@ -5476,6 +5476,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 #undef TCHARS_PER_DCHAR
 #undef SNPRINTF
 #undef USE_SNPRINTF
+#undef DCHAR_SET
 #undef DCHAR_CPY
 #undef PRINTF_PARSE
 #undef DIRECTIVES
diff --git a/gl/verify.h b/gl/verify.h
index fac53f6..3fbb639 100644
--- a/gl/verify.h
+++ b/gl/verify.h
@@ -110,8 +110,8 @@
 
        #if 4 <= __GNUC__
        # define verify(R) \
-          extern int (* verify_function__ (void)) \
-                     [__builtin_constant_p (R) && (R) ? 1 : -1]
+           extern int (* verify_function__ (void)) \
+                      [__builtin_constant_p (R) && (R) ? 1 : -1]
        #endif
 
    * In C++, any struct definition inside sizeof is invalid.
diff --git a/gl/w32sock.h b/gl/w32sock.h
index 0622985..8705f8f 100644
--- a/gl/w32sock.h
+++ b/gl/w32sock.h
@@ -32,7 +32,6 @@ static inline void
 set_winsock_errno (void)
 {
   int err = WSAGetLastError ();
-  WSASetLastError (0);
 
   /* Map some WSAE* errors to the runtime library's error codes.  */
   switch (err)
diff --git a/gl/wchar.in.h b/gl/wchar.in.h
index cc5baad..df171d6 100644
--- a/gl/wchar.in.h
+++ b/gl/wchar.in.h
@@ -74,6 +74,8 @@
 
 /* The definition of GL_LINK_WARNING is copied here.  */
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -197,7 +199,8 @@ extern size_t mbrlen (const char *s, size_t n, mbstate_t 
*ps);
 #  define mbsrtowcs rpl_mbsrtowcs
 # endif
 # if address@hidden@ || @REPLACE_MBSRTOWCS@
-extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, 
mbstate_t *ps);
+extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, 
mbstate_t *ps)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsrtowcs
@@ -215,7 +218,8 @@ extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, 
size_t len, mbstate_t
 #  define mbsnrtowcs rpl_mbsnrtowcs
 # endif
 # if address@hidden@ || @REPLACE_MBSNRTOWCS@
-extern size_t mbsnrtowcs (wchar_t *dest, const char **srcp, size_t srclen, 
size_t len, mbstate_t *ps);
+extern size_t mbsnrtowcs (wchar_t *dest, const char **srcp, size_t srclen, 
size_t len, mbstate_t *ps)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsnrtowcs
@@ -251,7 +255,8 @@ extern size_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps);
 #  define wcsrtombs rpl_wcsrtombs
 # endif
 # if address@hidden@ || @REPLACE_WCSRTOMBS@
-extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, 
mbstate_t *ps);
+extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, 
mbstate_t *ps)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsrtombs
@@ -269,7 +274,8 @@ extern size_t wcsrtombs (char *dest, const wchar_t **srcp, 
size_t len, mbstate_t
 #  define wcsnrtombs rpl_wcsnrtombs
 # endif
 # if address@hidden@ || @REPLACE_WCSNRTOMBS@
-extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, 
size_t len, mbstate_t *ps);
+extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, 
size_t len, mbstate_t *ps)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsnrtombs
diff --git a/gl/xalloc.h b/gl/xalloc.h
index 57a13e0..f8fef8a 100644
--- a/gl/xalloc.h
+++ b/gl/xalloc.h
@@ -161,9 +161,9 @@ xnrealloc (void *p, size_t n, size_t s)
      void
      append_int (int value)
        {
-        if (used == allocated)
-          p = x2nrealloc (p, &allocated, sizeof *p);
-        p[used++] = value;
+         if (used == allocated)
+           p = x2nrealloc (p, &allocated, sizeof *p);
+         p[used++] = value;
        }
 
    This causes x2nrealloc to allocate a block of some nonzero size the
@@ -181,12 +181,12 @@ xnrealloc (void *p, size_t n, size_t s)
      void
      append_int (int value)
        {
-        if (used == allocated)
-          {
-            p = x2nrealloc (p, &allocated1, sizeof *p);
-            allocated = allocated1;
-          }
-        p[used++] = value;
+         if (used == allocated)
+           {
+             p = x2nrealloc (p, &allocated1, sizeof *p);
+             allocated = allocated1;
+           }
+         p[used++] = value;
        }
 
    */
@@ -199,25 +199,25 @@ x2nrealloc (void *p, size_t *pn, size_t s)
   if (! p)
     {
       if (! n)
-       {
-         /* The approximate size to use for initial small allocation
-            requests, when the invoking code specifies an old size of
-            zero.  64 bytes is the largest "small" request for the
-            GNU C library malloc.  */
-         enum { DEFAULT_MXFAST = 64 };
-
-         n = DEFAULT_MXFAST / s;
-         n += !n;
-       }
+        {
+          /* The approximate size to use for initial small allocation
+             requests, when the invoking code specifies an old size of
+             zero.  64 bytes is the largest "small" request for the
+             GNU C library malloc.  */
+          enum { DEFAULT_MXFAST = 64 };
+
+          n = DEFAULT_MXFAST / s;
+          n += !n;
+        }
     }
   else
     {
       /* Set N = ceil (1.5 * N) so that progress is made if N == 1.
-        Check for overflow, so that N * S stays in size_t range.
-        The check is slightly conservative, but an exact check isn't
-        worth the trouble.  */
+         Check for overflow, so that N * S stays in size_t range.
+         The check is slightly conservative, but an exact check isn't
+         worth the trouble.  */
       if ((size_t) -1 / 3 * 2 / s <= n)
-       xalloc_die ();
+        xalloc_die ();
       n += (n + 1) / 2;
     }
 
diff --git a/gl/xgetdomainname.c b/gl/xgetdomainname.c
index 1d557d6..aa764f2 100644
--- a/gl/xgetdomainname.c
+++ b/gl/xgetdomainname.c
@@ -61,14 +61,14 @@ xgetdomainname (void)
       domainname[k] = '\0';
       err = getdomainname (domainname, size);
       if (err >= 0 && domainname[k] == '\0')
-       break;
+        break;
       else if (err < 0 && errno != EINVAL)
-       {
-         int saved_errno = errno;
-         free (domainname);
-         errno = saved_errno;
-         return NULL;
-       }
+        {
+          int saved_errno = errno;
+          free (domainname);
+          errno = saved_errno;
+          return NULL;
+        }
       size *= 2;
       domainname = xrealloc (domainname, size);
     }
diff --git a/gl/xgethostname.c b/gl/xgethostname.c
index 875d497..136acbe 100644
--- a/gl/xgethostname.c
+++ b/gl/xgethostname.c
@@ -1,7 +1,7 @@
 /* xgethostname.c -- return current hostname with unlimited length
 
-   Copyright (C) 1992, 1996, 2000, 2001, 2003, 2004, 2005, 2006 Free
-   Software Foundation, Inc.
+   Copyright (C) 1992, 1996, 2000, 2001, 2003, 2004, 2005, 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
@@ -29,10 +29,6 @@
 
 #include "xalloc.h"
 
-#ifndef ENAMETOOLONG
-# define ENAMETOOLONG 0
-#endif
-
 #ifndef INITIAL_HOSTNAME_LENGTH
 # define INITIAL_HOSTNAME_LENGTH 34
 #endif
@@ -49,8 +45,8 @@ xgethostname (void)
   while (1)
     {
       /* Use SIZE_1 here rather than SIZE to work around the bug in
-        SunOS 5.5's gethostname whereby it NUL-terminates HOSTNAME
-        even when the name is as long as the supplied buffer.  */
+         SunOS 5.5's gethostname whereby it NUL-terminates HOSTNAME
+         even when the name is as long as the supplied buffer.  */
       size_t size_1;
 
       hostname = x2realloc (hostname, &size);
@@ -59,19 +55,19 @@ xgethostname (void)
       errno = 0;
 
       if (gethostname (hostname, size_1) == 0)
-       {
-         if (! hostname[size_1 - 1])
-           break;
-       }
+        {
+          if (! hostname[size_1 - 1])
+            break;
+        }
       else if (errno != 0 && errno != ENAMETOOLONG && errno != EINVAL
-              /* OSX/Darwin does this when the buffer is not large enough */
-              && errno != ENOMEM)
-       {
-         int saved_errno = errno;
-         free (hostname);
-         errno = saved_errno;
-         return NULL;
-       }
+               /* OSX/Darwin does this when the buffer is not large enough */
+               && errno != ENOMEM)
+        {
+          int saved_errno = errno;
+          free (hostname);
+          errno = saved_errno;
+          return NULL;
+        }
     }
 
   return hostname;
diff --git a/gl/xvasprintf.c b/gl/xvasprintf.c
index fd7f21b..f7f6cf4 100644
--- a/gl/xvasprintf.c
+++ b/gl/xvasprintf.c
@@ -86,23 +86,23 @@ xvasprintf (const char *format, va_list args)
 
     for (f = format;;)
       {
-       if (*f == '\0')
-         /* Recognized the special case of string concatenation.  */
-         return xstrcat (argcount, args);
-       if (*f != '%')
-         break;
-       f++;
-       if (*f != 's')
-         break;
-       f++;
-       argcount++;
+        if (*f == '\0')
+          /* Recognized the special case of string concatenation.  */
+          return xstrcat (argcount, args);
+        if (*f != '%')
+          break;
+        f++;
+        if (*f != 's')
+          break;
+        f++;
+        argcount++;
       }
   }
 
   if (vasprintf (&result, format, args) < 0)
     {
       if (errno == ENOMEM)
-       xalloc_die ();
+        xalloc_die ();
       return NULL;
     }
 
diff --git a/maint.mk b/maint.mk
index 073058d..be061a6 100644
--- a/maint.mk
+++ b/maint.mk
@@ -38,13 +38,14 @@ VC-tag = git tag -s -m '$(VERSION)' -u '$(gpg_key_ID)'
 VC_LIST = $(build_aux)/vc-list-files -C $(srcdir)
 
 VC_LIST_EXCEPT = \
-  $(VC_LIST) | if test -f $(srcdir)/.x-$@; then grep -vEf $(srcdir)/.x-$@; 
else grep -v ChangeLog; fi
+  $(VC_LIST) | if test -f $(srcdir)/.x-$@; then grep -vEf $(srcdir)/.x-$@; \
+              else grep -Ev "$${VC_LIST_EXCEPT_DEFAULT-ChangeLog}"; fi
 
 ifeq ($(origin prev_version_file), undefined)
   prev_version_file = $(srcdir)/.prev-version
 endif
 
-PREV_VERSION := $(shell cat $(prev_version_file))
+PREV_VERSION := $(shell cat $(prev_version_file) 2>/dev/null)
 VERSION_REGEXP = $(subst .,\.,$(VERSION))
 PREV_VERSION_REGEXP = $(subst .,\.,$(PREV_VERSION))
 
@@ -62,6 +63,25 @@ my_distdir = $(PACKAGE)-$(VERSION)
 # Old releases are stored here.
 release_archive_dir ?= ../release
 
+# Override gnu_rel_host and url_dir_list in cfg.mk if these are not right.
+# Use alpha.gnu.org for alpha and beta releases.
+# Use ftp.gnu.org for stable releases.
+gnu_ftp_host-alpha = alpha.gnu.org
+gnu_ftp_host-beta = alpha.gnu.org
+gnu_ftp_host-stable = ftp.gnu.org
+gnu_rel_host ?= $(gnu_ftp_host-$(RELEASE_TYPE))
+
+ifeq ($(gnu_rel_host),ftp.gnu.org)
+url_dir_list ?= http://ftpmirror.gnu.org/$(PACKAGE)
+else
+url_dir_list ?= ftp://$(gnu_rel_host)/gnu/$(PACKAGE)
+endif
+
+# Override this in cfg.mk if you are using a different format in your
+# NEWS file.
+today = $(shell date +%Y-%m-%d)
+news-check-regexp ?= '^\*.* $(VERSION_REGEXP) \($(today)\)'
+
 # Prevent programs like 'sort' from considering distinct strings to be equal.
 # Doing it here saves us from having to set LC_ALL elsewhere in this file.
 export LC_ALL = C
@@ -70,9 +90,11 @@ export LC_ALL = C
 ## Sanity checks.  ##
 ## --------------- ##
 
+_cfg_mk := $(shell test -f $(srcdir)/cfg.mk && echo '$(srcdir)/cfg.mk')
+
 # Collect the names of rules starting with `sc_'.
-syntax-check-rules := $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' \
-                       $(srcdir)/$(ME) $(srcdir)/cfg.mk)
+syntax-check-rules := $(sort $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' 
\
+                       $(srcdir)/$(ME) $(_cfg_mk)))
 .PHONY: $(syntax-check-rules)
 
 local-checks-available = \
@@ -153,6 +175,21 @@ 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)
+# Convert all uses automatically, via these two commands:
+# git grep -l '\<exit *(1)' \
+#  | grep -vEf .x-sc_prohibit_magic_number_exit \
+#  | xargs --no-run-if-empty \
+#      perl -pi -e 's/(^|[^.])\b(exit ?)\(1\)/$1$2(EXIT_FAILURE)/'
+# git grep -l '\<exit *(0)' \
+#  | grep -vEf .x-sc_prohibit_magic_number_exit \
+#  | xargs --no-run-if-empty \
+#      perl -pi -e 's/(^|[^.])\b(exit ?)\(0\)/$1$2(EXIT_SUCCESS)/'
+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:
@@ -232,7 +269,8 @@ sc_prohibit_HAVE_MBRTOWC:
 # h: the header, enclosed in <> or ""
 # re: a regular expression that matches IFF something provided by $h is used.
 define _header_without_use
-  h_esc=`echo "$$h"|sed 's/\./\\./g'`;                                 \
+  dummy=; : so we do not need a semicolon before each use;             \
+  h_esc=`echo "$$h"|sed 's/\./\\\\./g'`;                               \
   if $(VC_LIST_EXCEPT) | grep -l '\.c$$' > /dev/null; then             \
     files=$$(grep -l '^# *include '"$$h_esc"                           \
             $$($(VC_LIST_EXCEPT) | grep '\.c$$')) &&                   \
@@ -247,6 +285,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)
@@ -275,6 +317,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)
@@ -284,11 +343,21 @@ sc_prohibit_argmatch_without_use:
        
re='(\<(ARRAY_CARDINALITY|X?ARGMATCH(|_TO_ARGUMENT|_VERIFY))\>|\<argmatch(_exit_fn|_(in)?valid)
 *\()' \
          $(_header_without_use)
 
+sc_prohibit_canonicalize_without_use:
+       @h='"canonicalize.h"' \
+       
re='CAN_(EXISTING|ALL_BUT_LAST|MISSING)|canonicalize_(mode_t|filename_mode)' \
+         $(_header_without_use)
+
 sc_prohibit_root_dev_ino_without_use:
        @h='"root-dev-ino.h"' \
        re='(\<ROOT_DEV_INO_(CHECK|WARN)\>|\<get_root_dev_ino *\()' \
          $(_header_without_use)
 
+sc_prohibit_openat_without_use:
+       @h='"openat.h"' \
+       
re='\<(openat_(permissive|needs_fchdir|(save|restore)_fail)|l?(stat|ch(own|mod))at|(euid)?accessat)\>'
 \
+         $(_header_without_use)
+
 # Prohibit the inclusion of c-ctype.h without an actual use.
 ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
 |isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper
@@ -490,7 +559,7 @@ sc_immutable_NEWS:
 # Update the hash stored above.  Do this after each release and
 # for any corrections to old entries.
 update-NEWS-hash: NEWS
-       perl -pi -e 's/^(old_NEWS_hash = ).*/$${1}'"$(NEWS_hash)/" \
+       perl -pi -e 's/^(old_NEWS_hash[ \t]+:?=[ \t]+).*/$${1}'"$(NEWS_hash)/" \
          $(srcdir)/cfg.mk
 
 # Ensure that we use only the standard $(VAR) notation,
@@ -504,13 +573,12 @@ sc_makefile_check:
            $$($(VC_LIST_EXCEPT) | grep -E '(^|/)Makefile\.am$$')       \
          && { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || :
 
-news-date-check: NEWS
-       today=`date +%Y-%m-%d`;                                         \
-       if head $(srcdir)/NEWS | grep '^\*.* $(VERSION_REGEXP) ('$$today')' \
+news-check: NEWS
+       if head $(srcdir)/NEWS | grep -E $(news-check-regexp)           \
            >/dev/null; then                                            \
          :;                                                            \
        else                                                            \
-         echo "version or today's date is not in NEWS" 1>&2;           \
+         echo 'NEWS: $$(news-check-regexp) failed to match' 1>&2;      \
          exit 1;                                                       \
        fi
 
@@ -614,32 +682,6 @@ vc-diff-check:
          rm vc-diffs;                                          \
        fi
 
-cvs-check: vc-diff-check
-
-ALL_RECURSIVE_TARGETS += maintainer-distcheck
-maintainer-distcheck:
-       $(MAKE) distcheck
-       $(MAKE) taint-distcheck
-       $(MAKE) my-distcheck
-
-
-# Don't make a distribution if checks fail.
-# Also, make sure the NEWS file is up-to-date.
-ALL_RECURSIVE_TARGETS += vc-dist
-vc-dist: $(local-check) cvs-check maintainer-distcheck
-       XZ_OPT=-9ev $(MAKE) dist
-
-# Use this to make sure we don't run these programs when building
-# from a virgin tgz file, below.
-null_AM_MAKEFLAGS = \
-  ACLOCAL=false \
-  AUTOCONF=false \
-  AUTOMAKE=false \
-  AUTOHEADER=false \
-  MAKEINFO=false
-
-built_programs = $$(cd src && MAKEFLAGS= $(MAKE) -s built_programs.list)
-
 rel-files = $(DIST_ARCHIVES)
 
 gnulib_dir ?= $(srcdir)/gnulib
@@ -697,21 +739,32 @@ no-submodule-changes:
          : ;                                                           \
        fi
 
-.PHONY: alpha beta major
-ALL_RECURSIVE_TARGETS += alpha beta major
-alpha beta major: $(local-check) writable-files no-submodule-changes
-       test $@ = major                                         \
-         && { echo $(VERSION) | grep -E '^[0-9]+(\.[0-9]+)+$$' \
+.PHONY: alpha beta stable
+ALL_RECURSIVE_TARGETS += alpha beta stable
+alpha beta stable: $(local-check) writable-files no-submodule-changes
+       test $@ = stable                                                \
+         && { echo $(VERSION) | grep -E '^[0-9]+(\.[0-9]+)+$$'         \
               || { echo "invalid version string: $(VERSION)" 1>&2; exit 1;};}\
          || :
-       $(MAKE) vc-dist
-       $(MAKE) news-date-check
-       $(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir)
+       $(MAKE) vc-diff-check
+       $(MAKE) news-check
+       $(MAKE) distcheck
+       $(MAKE) dist XZ_OPT=-9ev
+       $(MAKE) $(release-prep-hook) RELEASE_TYPE=$@
+       $(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
+
+# Override this in cfg.mk if you follow different procedures.
+release-prep-hook ?= release-prep
+
+.PHONY: release-prep
+release-prep:
+       case $$RELEASE_TYPE in alpha|beta|stable) ;; \
+         *) echo "invalid RELEASE_TYPE: $$RELEASE_TYPE" 1>&2; exit 1;; esac
+       $(MAKE) -s announcement > /tmp/announce-$(my_distdir)
        if test -d $(release_archive_dir); then                 \
          ln $(rel-files) $(release_archive_dir);               \
          chmod a-w $(rel-files);                               \
        fi
-       $(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
        echo $(VERSION) > $(prev_version_file)
        $(MAKE) update-NEWS-hash
        perl -pi -e '$$. == 3 and print "$(noteworthy)\n\n\n"' NEWS
@@ -769,3 +822,20 @@ INDENT_SOURCES ?= $(C_SOURCES)
 .PHONY: indent
 indent:
        indent $(INDENT_SOURCES)
+
+# If you want to set UPDATE_COPYRIGHT_* environment variables,
+# put the assignments in this variable.
+update-copyright-env ?=
+
+# Run this rule once per year (usually early in January)
+# to update all FSF copyright year lists in your project.
+# If you have an additional project-specific rule,
+# add it in cfg.mk along with a line 'update-copyright: prereq'.
+# By default, exclude all variants of COPYING; you can also
+# add exemptions (such as ChangeLog..* for rotated change logs)
+# in the file .x-update-copyright.
+.PHONY: update-copyright
+update-copyright:
+       grep -l -w Copyright                                             \
+         $$(export VC_LIST_EXCEPT_DEFAULT=COPYING && $(VC_LIST_EXCEPT)) \
+         | $(update-copyright-env) xargs $(build_aux)/$@
diff --git a/src/gl/error.c b/src/gl/error.c
index af2287b..71963ce 100644
--- a/src/gl/error.c
+++ b/src/gl/error.c
@@ -70,8 +70,8 @@ unsigned int error_message_count;
 extern void __error (int status, int errnum, const char *message, ...)
      __attribute__ ((__format__ (__printf__, 3, 4)));
 extern void __error_at_line (int status, int errnum, const char *file_name,
-                            unsigned int line_number, const char *message,
-                            ...)
+                             unsigned int line_number, const char *message,
+                             ...)
      __attribute__ ((__format__ (__printf__, 5, 6)));;
 # define error __error
 # define error_at_line __error_at_line
@@ -86,6 +86,7 @@ extern void __error_at_line (int status, int errnum, const 
char *file_name,
 #else /* not _LIBC */
 
 # include <fcntl.h>
+# include <unistd.h>
 
 # if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P
 #  ifndef HAVE_DECL_STRERROR_R
@@ -100,8 +101,33 @@ extern char *program_name;
 
 # if HAVE_STRERROR_R || defined strerror_r
 #  define __strerror_r strerror_r
-# endif        /* HAVE_STRERROR_R || defined strerror_r */
-#endif /* not _LIBC */
+# endif /* HAVE_STRERROR_R || defined strerror_r */
+#endif  /* not _LIBC */
+
+static inline void
+flush_stdout (void)
+{
+#if !_LIBC && defined F_GETFL
+  int stdout_fd;
+
+# if GNULIB_FREOPEN_SAFER
+  /* Use of gnulib's freopen-safer module normally ensures that
+       fileno (stdout) == 1
+     whenever stdout is open.  */
+  stdout_fd = STDOUT_FILENO;
+# else
+  /* POSIX states that fileno (stdout) after fclose is unspecified.  But in
+     practice it is not a problem, because stdout is statically allocated and
+     the fd of a FILE stream is stored as a field in its allocated memory.  */
+  stdout_fd = fileno (stdout);
+# endif
+  /* POSIX states that fflush (stdout) after fclose is unspecified; it
+     is safe in glibc, but not on all other platforms.  fflush (NULL)
+     is always defined, but too draconian.  */
+  if (0 <= stdout_fd && 0 <= fcntl (stdout_fd, F_GETFL))
+#endif
+    fflush (stdout);
+}
 
 static void
 print_errno_message (int errnum)
@@ -149,58 +175,58 @@ error_tail (int status, int errnum, const char *message, 
va_list args)
       bool use_malloc = false;
 
       while (1)
-       {
-         if (__libc_use_alloca (len * sizeof (wchar_t)))
-           wmessage = (wchar_t *) alloca (len * sizeof (wchar_t));
-         else
-           {
-             if (!use_malloc)
-               wmessage = NULL;
-
-             wchar_t *p = (wchar_t *) realloc (wmessage,
-                                               len * sizeof (wchar_t));
-             if (p == NULL)
-               {
-                 free (wmessage);
-                 fputws_unlocked (L"out of memory\n", stderr);
-                 return;
-               }
-             wmessage = p;
-             use_malloc = true;
-           }
-
-         memset (&st, '\0', sizeof (st));
-         tmp = message;
-
-         res = mbsrtowcs (wmessage, &tmp, len, &st);
-         if (res != len)
-           break;
-
-         if (__builtin_expect (len >= SIZE_MAX / 2, 0))
-           {
-             /* This really should not happen if everything is fine.  */
-             res = (size_t) -1;
-             break;
-           }
-
-         len *= 2;
-       }
+        {
+          if (__libc_use_alloca (len * sizeof (wchar_t)))
+            wmessage = (wchar_t *) alloca (len * sizeof (wchar_t));
+          else
+            {
+              if (!use_malloc)
+                wmessage = NULL;
+
+              wchar_t *p = (wchar_t *) realloc (wmessage,
+                                                len * sizeof (wchar_t));
+              if (p == NULL)
+                {
+                  free (wmessage);
+                  fputws_unlocked (L"out of memory\n", stderr);
+                  return;
+                }
+              wmessage = p;
+              use_malloc = true;
+            }
+
+          memset (&st, '\0', sizeof (st));
+          tmp = message;
+
+          res = mbsrtowcs (wmessage, &tmp, len, &st);
+          if (res != len)
+            break;
+
+          if (__builtin_expect (len >= SIZE_MAX / 2, 0))
+            {
+              /* This really should not happen if everything is fine.  */
+              res = (size_t) -1;
+              break;
+            }
+
+          len *= 2;
+        }
 
       if (res == (size_t) -1)
-       {
-         /* The string cannot be converted.  */
-         if (use_malloc)
-           {
-             free (wmessage);
-             use_malloc = false;
-           }
-         wmessage = (wchar_t *) L"???";
-       }
+        {
+          /* The string cannot be converted.  */
+          if (use_malloc)
+            {
+              free (wmessage);
+              use_malloc = false;
+            }
+          wmessage = (wchar_t *) L"???";
+        }
 
       __vfwprintf (stderr, wmessage, args);
 
       if (use_malloc)
-       free (wmessage);
+        free (wmessage);
     }
   else
 #endif
@@ -235,16 +261,10 @@ error (int status, int errnum, const char *message, ...)
      cancellation.  Therefore disable cancellation for now.  */
   int state = PTHREAD_CANCEL_ENABLE;
   __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
-                  0);
+                   0);
 #endif
 
-#if !_LIBC && defined F_GETFL
-  /* POSIX states that fflush (stdout) after fclose is unspecified; it
-     is safe in glibc, but not on all other platforms.  fflush (NULL)
-     is always defined, but too draconian.  */
-  if (0 <= fcntl (1, F_GETFL))
-#endif
-  fflush (stdout);
+  flush_stdout ();
 #ifdef _LIBC
   _IO_flockfile (stderr);
 #endif
@@ -276,7 +296,7 @@ int error_one_per_line;
 
 void
 error_at_line (int status, int errnum, const char *file_name,
-              unsigned int line_number, const char *message, ...)
+               unsigned int line_number, const char *message, ...)
 {
   va_list args;
 
@@ -286,10 +306,10 @@ error_at_line (int status, int errnum, const char 
*file_name,
       static unsigned int old_line_number;
 
       if (old_line_number == line_number
-         && (file_name == old_file_name
-             || strcmp (old_file_name, file_name) == 0))
-       /* Simply return and print nothing.  */
-       return;
+          && (file_name == old_file_name
+              || strcmp (old_file_name, file_name) == 0))
+        /* Simply return and print nothing.  */
+        return;
 
       old_file_name = file_name;
       old_line_number = line_number;
@@ -300,16 +320,10 @@ error_at_line (int status, int errnum, const char 
*file_name,
      cancellation.  Therefore disable cancellation for now.  */
   int state = PTHREAD_CANCEL_ENABLE;
   __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
-                  0);
+                   0);
 #endif
 
-#if !_LIBC && defined F_GETFL
-  /* POSIX states that fflush (stdout) after fclose is unspecified; it
-     is safe in glibc, but not on all other platforms.  fflush (NULL)
-     is always defined, but too draconian.  */
-  if (0 <= fcntl (1, F_GETFL))
-#endif
-  fflush (stdout);
+  flush_stdout ();
 #ifdef _LIBC
   _IO_flockfile (stderr);
 #endif
@@ -326,10 +340,10 @@ error_at_line (int status, int errnum, const char 
*file_name,
 
 #if _LIBC
   __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ",
-             file_name, line_number);
+              file_name, line_number);
 #else
   fprintf (stderr, file_name != NULL ? "%s:%d: " : " ",
-          file_name, line_number);
+           file_name, line_number);
 #endif
 
   va_start (args, message);
diff --git a/src/gl/error.h b/src/gl/error.h
index 6d49681..1c7da3a 100644
--- a/src/gl/error.h
+++ b/src/gl/error.h
@@ -31,7 +31,7 @@
 # endif
 #endif
 
-#ifdef __cplusplus
+#ifdef __cplusplus
 extern "C" {
 #endif
 
@@ -43,7 +43,7 @@ extern void error (int __status, int __errnum, const char 
*__format, ...)
      __attribute__ ((__format__ (__printf__, 3, 4)));
 
 extern void error_at_line (int __status, int __errnum, const char *__fname,
-                          unsigned int __lineno, const char *__format, ...)
+                           unsigned int __lineno, const char *__format, ...)
      __attribute__ ((__format__ (__printf__, 5, 6)));
 
 /* If NULL, error will flush stdout, then print on stderr the program
@@ -58,7 +58,7 @@ extern unsigned int error_message_count;
    variable controls whether this mode is selected or not.  */
 extern int error_one_per_line;
 
-#ifdef __cplusplus
+#ifdef __cplusplus
 }
 #endif
 
diff --git a/src/gl/getopt.c b/src/gl/getopt.c
index f1e6d1f..f2a109f 100644
--- a/src/gl/getopt.c
+++ b/src/gl/getopt.c
@@ -1,9 +1,9 @@
 /* Getopt for GNU.
-   NOTE: getopt is now part of the C library, so if you don't know what
+   NOTE: getopt is 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
-       Free Software Foundation, Inc.
+   Copyright (C) 1987-1996,1998-2004,2006,2008-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
@@ -45,8 +45,9 @@
 # define attribute_hidden
 #endif
 
-/* Unlike standard Unix `getopt', functions like `getopt_long'
-   let the user intersperse the options with the other arguments.
+/* This version of `getopt' appears to the caller like standard Unix `getopt'
+   but it behaves differently for the user, since it allows the user
+   to intersperse the options with the other arguments.
 
    As `getopt_long' works, it permutes the elements of ARGV so that,
    when it is done, all the options precede everything else.  Thus
@@ -54,7 +55,7 @@
 
    Using `getopt' or setting the environment variable POSIXLY_CORRECT
    disables permutation.
-   Then the application's behavior is completely standard.
+   Then the behavior is completely standard.
 
    GNU application programs can use a third alternative mode in which
    they can distinguish the relative order of options and other arguments.  */
@@ -121,18 +122,18 @@ extern char *__getopt_nonoption_flags;
 
 # ifdef USE_NONOPTION_FLAGS
 #  define SWAP_FLAGS(ch1, ch2) \
-  if (d->__nonoption_flags_len > 0)                                          \
-    {                                                                        \
-      char __tmp = __getopt_nonoption_flags[ch1];                            \
-      __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2];         \
-      __getopt_nonoption_flags[ch2] = __tmp;                                 \
+  if (d->__nonoption_flags_len > 0)                                           \
+    {                                                                         \
+      char __tmp = __getopt_nonoption_flags[ch1];                             \
+      __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2];          \
+      __getopt_nonoption_flags[ch2] = __tmp;                                  \
     }
 # else
 #  define SWAP_FLAGS(ch1, ch2)
 # endif
-#else  /* !_LIBC */
+#else   /* !_LIBC */
 # define SWAP_FLAGS(ch1, ch2)
-#endif /* _LIBC */
+#endif  /* _LIBC */
 
 /* Exchange two adjacent subsequences of ARGV.
    One subsequence is elements [first_nonopt,last_nonopt)
@@ -163,57 +164,57 @@ exchange (char **argv, struct _getopt_data *d)
   if (d->__nonoption_flags_len > 0 && top >= d->__nonoption_flags_max_len)
     {
       /* We must extend the array.  The user plays games with us and
-        presents new arguments.  */
+         presents new arguments.  */
       char *new_str = malloc (top + 1);
       if (new_str == NULL)
-       d->__nonoption_flags_len = d->__nonoption_flags_max_len = 0;
+        d->__nonoption_flags_len = d->__nonoption_flags_max_len = 0;
       else
-       {
-         memset (__mempcpy (new_str, __getopt_nonoption_flags,
-                            d->__nonoption_flags_max_len),
-                 '\0', top + 1 - d->__nonoption_flags_max_len);
-         d->__nonoption_flags_max_len = top + 1;
-         __getopt_nonoption_flags = new_str;
-       }
+        {
+          memset (__mempcpy (new_str, __getopt_nonoption_flags,
+                             d->__nonoption_flags_max_len),
+                  '\0', top + 1 - d->__nonoption_flags_max_len);
+          d->__nonoption_flags_max_len = top + 1;
+          __getopt_nonoption_flags = new_str;
+        }
     }
 #endif
 
   while (top > middle && middle > bottom)
     {
       if (top - middle > middle - bottom)
-       {
-         /* Bottom segment is the short one.  */
-         int len = middle - bottom;
-         register int i;
-
-         /* Swap it with the top part of the top segment.  */
-         for (i = 0; i < len; i++)
-           {
-             tem = argv[bottom + i];
-             argv[bottom + i] = argv[top - (middle - bottom) + i];
-             argv[top - (middle - bottom) + i] = tem;
-             SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
-           }
-         /* Exclude the moved bottom segment from further swapping.  */
-         top -= len;
-       }
+        {
+          /* Bottom segment is the short one.  */
+          int len = middle - bottom;
+          register int i;
+
+          /* Swap it with the top part of the top segment.  */
+          for (i = 0; i < len; i++)
+            {
+              tem = argv[bottom + i];
+              argv[bottom + i] = argv[top - (middle - bottom) + i];
+              argv[top - (middle - bottom) + i] = tem;
+              SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
+            }
+          /* Exclude the moved bottom segment from further swapping.  */
+          top -= len;
+        }
       else
-       {
-         /* Top segment is the short one.  */
-         int len = top - middle;
-         register int i;
-
-         /* Swap it with the bottom part of the bottom segment.  */
-         for (i = 0; i < len; i++)
-           {
-             tem = argv[bottom + i];
-             argv[bottom + i] = argv[middle + i];
-             argv[middle + i] = tem;
-             SWAP_FLAGS (bottom + i, middle + i);
-           }
-         /* Exclude the moved top segment from further swapping.  */
-         bottom += len;
-       }
+        {
+          /* Top segment is the short one.  */
+          int len = top - middle;
+          register int i;
+
+          /* Swap it with the bottom part of the bottom segment.  */
+          for (i = 0; i < len; i++)
+            {
+              tem = argv[bottom + i];
+              argv[bottom + i] = argv[middle + i];
+              argv[middle + i] = tem;
+              SWAP_FLAGS (bottom + i, middle + i);
+            }
+          /* Exclude the moved top segment from further swapping.  */
+          bottom += len;
+        }
     }
 
   /* Update records for the slots the non-options now occupy.  */
@@ -225,8 +226,9 @@ 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,
-                   int posixly_correct, struct _getopt_data *d)
+_getopt_initialize (int argc _GL_UNUSED,
+                    char **argv _GL_UNUSED, const char *optstring,
+                    struct _getopt_data *d, int posixly_correct)
 {
   /* Start processing options with ARGV-element 1 (since ARGV-element 0
      is the program name); the sequence of previously skipped
@@ -260,25 +262,25 @@ _getopt_initialize (int argc, char **argv, const char 
*optstring,
       && argc == __libc_argc && argv == __libc_argv)
     {
       if (d->__nonoption_flags_max_len == 0)
-       {
-         if (__getopt_nonoption_flags == NULL
-             || __getopt_nonoption_flags[0] == '\0')
-           d->__nonoption_flags_max_len = -1;
-         else
-           {
-             const char *orig_str = __getopt_nonoption_flags;
-             int len = d->__nonoption_flags_max_len = strlen (orig_str);
-             if (d->__nonoption_flags_max_len < argc)
-               d->__nonoption_flags_max_len = argc;
-             __getopt_nonoption_flags =
-               (char *) malloc (d->__nonoption_flags_max_len);
-             if (__getopt_nonoption_flags == NULL)
-               d->__nonoption_flags_max_len = -1;
-             else
-               memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
-                       '\0', d->__nonoption_flags_max_len - len);
-           }
-       }
+        {
+          if (__getopt_nonoption_flags == NULL
+              || __getopt_nonoption_flags[0] == '\0')
+            d->__nonoption_flags_max_len = -1;
+          else
+            {
+              const char *orig_str = __getopt_nonoption_flags;
+              int len = d->__nonoption_flags_max_len = strlen (orig_str);
+              if (d->__nonoption_flags_max_len < argc)
+                d->__nonoption_flags_max_len = argc;
+              __getopt_nonoption_flags =
+                (char *) malloc (d->__nonoption_flags_max_len);
+              if (__getopt_nonoption_flags == NULL)
+                d->__nonoption_flags_max_len = -1;
+              else
+                memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
+                        '\0', d->__nonoption_flags_max_len - len);
+            }
+        }
       d->__nonoption_flags_len = d->__nonoption_flags_max_len;
     }
   else
@@ -330,6 +332,10 @@ _getopt_initialize (int argc, char **argv, const char 
*optstring,
    `flag' field is nonzero, the value of the option's `val' field
    if the `flag' field is zero.
 
+   The elements of ARGV aren't really const, because we permute them.
+   But we pretend they're const in the prototype to be compatible
+   with other systems.
+
    LONGOPTS is a vector of `struct option' terminated by an
    element containing a name which is zero.
 
@@ -338,15 +344,12 @@ _getopt_initialize (int argc, char **argv, const char 
*optstring,
    recent call.
 
    If LONG_ONLY is nonzero, '-' as well as '--' can introduce
-   long-named options.
-
-   If POSIXLY_CORRECT is nonzero, behave as if the POSIXLY_CORRECT
-   environment variable were set.  */
+   long-named options.  */
 
 int
 _getopt_internal_r (int argc, char **argv, const char *optstring,
-                   const struct option *longopts, int *longind,
-                   int long_only, int posixly_correct, struct _getopt_data *d)
+                    const struct option *longopts, int *longind,
+                    int long_only, struct _getopt_data *d, int posixly_correct)
 {
   int print_errors = d->opterr;
   if (optstring[0] == ':')
@@ -360,9 +363,9 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
   if (d->optind == 0 || !d->__initialized)
     {
       if (d->optind == 0)
-       d->optind = 1;  /* Don't scan ARGV[0], the program name.  */
-      optstring = _getopt_initialize (argc, argv, optstring,
-                                     posixly_correct, d);
+        d->optind = 1;  /* Don't scan ARGV[0], the program name.  */
+      optstring = _getopt_initialize (argc, argv, optstring, d,
+                                      posixly_correct);
       d->__initialized = 1;
     }
 
@@ -372,8 +375,8 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
      is only used when the used in the GNU libc.  */
 #if defined _LIBC && defined USE_NONOPTION_FLAGS
 # define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0' \
-                     || (d->optind < d->__nonoption_flags_len                \
-                         && __getopt_nonoption_flags[d->optind] == '1'))
+                      || (d->optind < d->__nonoption_flags_len                \
+                          && __getopt_nonoption_flags[d->optind] == '1'))
 #else
 # define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0')
 #endif
@@ -383,78 +386,78 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
       /* Advance to the next ARGV-element.  */
 
       /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
-        moved back by the user (who may also have changed the arguments).  */
+         moved back by the user (who may also have changed the arguments).  */
       if (d->__last_nonopt > d->optind)
-       d->__last_nonopt = d->optind;
+        d->__last_nonopt = d->optind;
       if (d->__first_nonopt > d->optind)
-       d->__first_nonopt = d->optind;
+        d->__first_nonopt = d->optind;
 
       if (d->__ordering == PERMUTE)
-       {
-         /* If we have just processed some options following some non-options,
-            exchange them so that the options come first.  */
+        {
+          /* If we have just processed some options following some non-options,
+             exchange them so that the options come first.  */
 
-         if (d->__first_nonopt != d->__last_nonopt
-             && d->__last_nonopt != d->optind)
-           exchange ((char **) argv, d);
-         else if (d->__last_nonopt != d->optind)
-           d->__first_nonopt = d->optind;
+          if (d->__first_nonopt != d->__last_nonopt
+              && d->__last_nonopt != d->optind)
+            exchange ((char **) argv, d);
+          else if (d->__last_nonopt != d->optind)
+            d->__first_nonopt = d->optind;
 
-         /* Skip any additional non-options
-            and extend the range of non-options previously skipped.  */
+          /* Skip any additional non-options
+             and extend the range of non-options previously skipped.  */
 
-         while (d->optind < argc && NONOPTION_P)
-           d->optind++;
-         d->__last_nonopt = d->optind;
-       }
+          while (d->optind < argc && NONOPTION_P)
+            d->optind++;
+          d->__last_nonopt = d->optind;
+        }
 
       /* The special ARGV-element `--' means premature end of options.
-        Skip it like a null option,
-        then exchange with previous non-options as if it were an option,
-        then skip everything else like a non-option.  */
+         Skip it like a null option,
+         then exchange with previous non-options as if it were an option,
+         then skip everything else like a non-option.  */
 
       if (d->optind != argc && !strcmp (argv[d->optind], "--"))
-       {
-         d->optind++;
+        {
+          d->optind++;
 
-         if (d->__first_nonopt != d->__last_nonopt
-             && d->__last_nonopt != d->optind)
-           exchange ((char **) argv, d);
-         else if (d->__first_nonopt == d->__last_nonopt)
-           d->__first_nonopt = d->optind;
-         d->__last_nonopt = argc;
+          if (d->__first_nonopt != d->__last_nonopt
+              && d->__last_nonopt != d->optind)
+            exchange ((char **) argv, d);
+          else if (d->__first_nonopt == d->__last_nonopt)
+            d->__first_nonopt = d->optind;
+          d->__last_nonopt = argc;
 
-         d->optind = argc;
-       }
+          d->optind = argc;
+        }
 
       /* If we have done all the ARGV-elements, stop the scan
-        and back over any non-options that we skipped and permuted.  */
+         and back over any non-options that we skipped and permuted.  */
 
       if (d->optind == argc)
-       {
-         /* Set the next-arg-index to point at the non-options
-            that we previously skipped, so the caller will digest them.  */
-         if (d->__first_nonopt != d->__last_nonopt)
-           d->optind = d->__first_nonopt;
-         return -1;
-       }
+        {
+          /* Set the next-arg-index to point at the non-options
+             that we previously skipped, so the caller will digest them.  */
+          if (d->__first_nonopt != d->__last_nonopt)
+            d->optind = d->__first_nonopt;
+          return -1;
+        }
 
       /* If we have come to a non-option and did not permute it,
-        either stop the scan or describe it to the caller and pass it by.  */
+         either stop the scan or describe it to the caller and pass it by.  */
 
       if (NONOPTION_P)
-       {
-         if (d->__ordering == REQUIRE_ORDER)
-           return -1;
-         d->optarg = argv[d->optind++];
-         return 1;
-       }
+        {
+          if (d->__ordering == REQUIRE_ORDER)
+            return -1;
+          d->optarg = argv[d->optind++];
+          return 1;
+        }
 
       /* We have found another option-ARGV-element.
-        Skip the initial punctuation.  */
+         Skip the initial punctuation.  */
 
       d->__nextchar = (argv[d->optind] + 1
-                 + (longopts != NULL && argv[d->optind][1] == '-'));
+                  + (longopts != NULL && argv[d->optind][1] == '-'));
     }
 
   /* Decode the current option-ARGV-element.  */
@@ -474,8 +477,8 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
 
   if (longopts != NULL
       && (argv[d->optind][1] == '-'
-         || (long_only && (argv[d->optind][2]
-                           || !strchr (optstring, argv[d->optind][1])))))
+          || (long_only && (argv[d->optind][2]
+                            || !strchr (optstring, argv[d->optind][1])))))
     {
       char *nameend;
       const struct option *p;
@@ -486,251 +489,251 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
       int option_index;
 
       for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++)
-       /* Do nothing.  */ ;
+        /* Do nothing.  */ ;
 
       /* Test all long options for either exact match
-        or abbreviated matches.  */
+         or abbreviated matches.  */
       for (p = longopts, option_index = 0; p->name; p++, option_index++)
-       if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar))
-         {
-           if ((unsigned int) (nameend - d->__nextchar)
-               == (unsigned int) strlen (p->name))
-             {
-               /* Exact match found.  */
-               pfound = p;
-               indfound = option_index;
-               exact = 1;
-               break;
-             }
-           else if (pfound == NULL)
-             {
-               /* First nonexact match found.  */
-               pfound = p;
-               indfound = option_index;
-             }
-           else if (long_only
-                    || pfound->has_arg != p->has_arg
-                    || pfound->flag != p->flag
-                    || pfound->val != p->val)
-             /* Second or later nonexact match found.  */
-             ambig = 1;
-         }
+        if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar))
+          {
+            if ((unsigned int) (nameend - d->__nextchar)
+                == (unsigned int) strlen (p->name))
+              {
+                /* Exact match found.  */
+                pfound = p;
+                indfound = option_index;
+                exact = 1;
+                break;
+              }
+            else if (pfound == NULL)
+              {
+                /* First nonexact match found.  */
+                pfound = p;
+                indfound = option_index;
+              }
+            else if (long_only
+                     || pfound->has_arg != p->has_arg
+                     || pfound->flag != p->flag
+                     || pfound->val != p->val)
+              /* Second or later nonexact match found.  */
+              ambig = 1;
+          }
 
       if (ambig && !exact)
-       {
-         if (print_errors)
-           {
+        {
+          if (print_errors)
+            {
 #if defined _LIBC && defined USE_IN_LIBIO
-             char *buf;
+              char *buf;
 
-             if (__asprintf (&buf, _("%s: option `%s' is ambiguous\n"),
-                             argv[0], argv[d->optind]) >= 0)
-               {
-                 _IO_flockfile (stderr);
+              if (__asprintf (&buf, _("%s: option '%s' is ambiguous\n"),
+                              argv[0], argv[d->optind]) >= 0)
+                {
+                  _IO_flockfile (stderr);
 
-                 int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
-                 ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+                  int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+                  ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
 
-                 __fxprintf (NULL, "%s", buf);
+                  __fxprintf (NULL, "%s", buf);
 
-                 ((_IO_FILE *) stderr)->_flags2 = old_flags2;
-                 _IO_funlockfile (stderr);
+                  ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+                  _IO_funlockfile (stderr);
 
-                 free (buf);
-               }
+                  free (buf);
+                }
 #else
-             fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
-                      argv[0], argv[d->optind]);
+              fprintf (stderr, _("%s: option '%s' is ambiguous\n"),
+                       argv[0], argv[d->optind]);
 #endif
-           }
-         d->__nextchar += strlen (d->__nextchar);
-         d->optind++;
-         d->optopt = 0;
-         return '?';
-       }
+            }
+          d->__nextchar += strlen (d->__nextchar);
+          d->optind++;
+          d->optopt = 0;
+          return '?';
+        }
 
       if (pfound != NULL)
-       {
-         option_index = indfound;
-         d->optind++;
-         if (*nameend)
-           {
-             /* Don't test has_arg with >, because some C compilers don't
-                allow it to be used on enums.  */
-             if (pfound->has_arg)
-               d->optarg = nameend + 1;
-             else
-               {
-                 if (print_errors)
-                   {
+        {
+          option_index = indfound;
+          d->optind++;
+          if (*nameend)
+            {
+              /* Don't test has_arg with >, because some C compilers don't
+                 allow it to be used on enums.  */
+              if (pfound->has_arg)
+                d->optarg = nameend + 1;
+              else
+                {
+                  if (print_errors)
+                    {
 #if defined _LIBC && defined USE_IN_LIBIO
-                     char *buf;
-                     int n;
+                      char *buf;
+                      int n;
 #endif
 
-                     if (argv[d->optind - 1][1] == '-')
-                       {
-                         /* --option */
+                      if (argv[d->optind - 1][1] == '-')
+                        {
+                          /* --option */
 #if defined _LIBC && defined USE_IN_LIBIO
-                         n = __asprintf (&buf, _("\
-%s: option `--%s' doesn't allow an argument\n"),
-                                         argv[0], pfound->name);
+                          n = __asprintf (&buf, _("\
+%s: option '--%s' doesn't allow an argument\n"),
+                                          argv[0], pfound->name);
 #else
-                         fprintf (stderr, _("\
-%s: option `--%s' doesn't allow an argument\n"),
-                                  argv[0], pfound->name);
+                          fprintf (stderr, _("\
+%s: option '--%s' doesn't allow an argument\n"),
+                                   argv[0], pfound->name);
 #endif
-                       }
-                     else
-                       {
-                         /* +option or -option */
+                        }
+                      else
+                        {
+                          /* +option or -option */
 #if defined _LIBC && defined USE_IN_LIBIO
-                         n = __asprintf (&buf, _("\
-%s: option `%c%s' doesn't allow an argument\n"),
-                                         argv[0], argv[d->optind - 1][0],
-                                         pfound->name);
+                          n = __asprintf (&buf, _("\
+%s: option '%c%s' doesn't allow an argument\n"),
+                                          argv[0], argv[d->optind - 1][0],
+                                          pfound->name);
 #else
-                         fprintf (stderr, _("\
-%s: option `%c%s' doesn't allow an argument\n"),
-                                  argv[0], argv[d->optind - 1][0],
-                                  pfound->name);
+                          fprintf (stderr, _("\
+%s: option '%c%s' doesn't allow an argument\n"),
+                                   argv[0], argv[d->optind - 1][0],
+                                   pfound->name);
 #endif
-                       }
+                        }
 
 #if defined _LIBC && defined USE_IN_LIBIO
-                     if (n >= 0)
-                       {
-                         _IO_flockfile (stderr);
+                      if (n >= 0)
+                        {
+                          _IO_flockfile (stderr);
 
-                         int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
-                         ((_IO_FILE *) stderr)->_flags2
-                           |= _IO_FLAGS2_NOTCANCEL;
+                          int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+                          ((_IO_FILE *) stderr)->_flags2
+                            |= _IO_FLAGS2_NOTCANCEL;
 
-                         __fxprintf (NULL, "%s", buf);
+                          __fxprintf (NULL, "%s", buf);
 
-                         ((_IO_FILE *) stderr)->_flags2 = old_flags2;
-                         _IO_funlockfile (stderr);
+                          ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+                          _IO_funlockfile (stderr);
 
-                         free (buf);
-                       }
+                          free (buf);
+                        }
 #endif
-                   }
-
-                 d->__nextchar += strlen (d->__nextchar);
-
-                 d->optopt = pfound->val;
-                 return '?';
-               }
-           }
-         else if (pfound->has_arg == 1)
-           {
-             if (d->optind < argc)
-               d->optarg = argv[d->optind++];
-             else
-               {
-                 if (print_errors)
-                   {
+                    }
+
+                  d->__nextchar += strlen (d->__nextchar);
+
+                  d->optopt = pfound->val;
+                  return '?';
+                }
+            }
+          else if (pfound->has_arg == 1)
+            {
+              if (d->optind < argc)
+                d->optarg = argv[d->optind++];
+              else
+                {
+                  if (print_errors)
+                    {
 #if defined _LIBC && defined USE_IN_LIBIO
-                     char *buf;
+                      char *buf;
 
-                     if (__asprintf (&buf, _("\
-%s: option `%s' requires an argument\n"),
-                                     argv[0], argv[d->optind - 1]) >= 0)
-                       {
-                         _IO_flockfile (stderr);
+                      if (__asprintf (&buf, _("\
+%s: option '%s' requires an argument\n"),
+                                      argv[0], argv[d->optind - 1]) >= 0)
+                        {
+                          _IO_flockfile (stderr);
 
-                         int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
-                         ((_IO_FILE *) stderr)->_flags2
-                           |= _IO_FLAGS2_NOTCANCEL;
+                          int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+                          ((_IO_FILE *) stderr)->_flags2
+                            |= _IO_FLAGS2_NOTCANCEL;
 
-                         __fxprintf (NULL, "%s", buf);
+                          __fxprintf (NULL, "%s", buf);
 
-                         ((_IO_FILE *) stderr)->_flags2 = old_flags2;
-                         _IO_funlockfile (stderr);
+                          ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+                          _IO_funlockfile (stderr);
 
-                         free (buf);
-                       }
+                          free (buf);
+                        }
 #else
-                     fprintf (stderr,
-                              _("%s: option `%s' requires an argument\n"),
-                              argv[0], argv[d->optind - 1]);
+                      fprintf (stderr,
+                               _("%s: option '%s' requires an argument\n"),
+                               argv[0], argv[d->optind - 1]);
 #endif
-                   }
-                 d->__nextchar += strlen (d->__nextchar);
-                 d->optopt = pfound->val;
-                 return optstring[0] == ':' ? ':' : '?';
-               }
-           }
-         d->__nextchar += strlen (d->__nextchar);
-         if (longind != NULL)
-           *longind = option_index;
-         if (pfound->flag)
-           {
-             *(pfound->flag) = pfound->val;
-             return 0;
-           }
-         return pfound->val;
-       }
+                    }
+                  d->__nextchar += strlen (d->__nextchar);
+                  d->optopt = pfound->val;
+                  return optstring[0] == ':' ? ':' : '?';
+                }
+            }
+          d->__nextchar += strlen (d->__nextchar);
+          if (longind != NULL)
+            *longind = option_index;
+          if (pfound->flag)
+            {
+              *(pfound->flag) = pfound->val;
+              return 0;
+            }
+          return pfound->val;
+        }
 
       /* Can't find it as a long option.  If this is not getopt_long_only,
-        or the option starts with '--' or is not a valid short
-        option, then it's an error.
-        Otherwise interpret it as a short option.  */
+         or the option starts with '--' or is not a valid short
+         option, then it's an error.
+         Otherwise interpret it as a short option.  */
       if (!long_only || argv[d->optind][1] == '-'
-         || strchr (optstring, *d->__nextchar) == NULL)
-       {
-         if (print_errors)
-           {
+          || strchr (optstring, *d->__nextchar) == NULL)
+        {
+          if (print_errors)
+            {
 #if defined _LIBC && defined USE_IN_LIBIO
-             char *buf;
-             int n;
+              char *buf;
+              int n;
 #endif
 
-             if (argv[d->optind][1] == '-')
-               {
-                 /* --option */
+              if (argv[d->optind][1] == '-')
+                {
+                  /* --option */
 #if defined _LIBC && defined USE_IN_LIBIO
-                 n = __asprintf (&buf, _("%s: unrecognized option `--%s'\n"),
-                                 argv[0], d->__nextchar);
+                  n = __asprintf (&buf, _("%s: unrecognized option '--%s'\n"),
+                                  argv[0], d->__nextchar);
 #else
-                 fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
-                          argv[0], d->__nextchar);
+                  fprintf (stderr, _("%s: unrecognized option '--%s'\n"),
+                           argv[0], d->__nextchar);
 #endif
-               }
-             else
-               {
-                 /* +option or -option */
+                }
+              else
+                {
+                  /* +option or -option */
 #if defined _LIBC && defined USE_IN_LIBIO
-                 n = __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"),
-                                 argv[0], argv[d->optind][0], d->__nextchar);
+                  n = __asprintf (&buf, _("%s: unrecognized option '%c%s'\n"),
+                                  argv[0], argv[d->optind][0], d->__nextchar);
 #else
-                 fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
-                          argv[0], argv[d->optind][0], d->__nextchar);
+                  fprintf (stderr, _("%s: unrecognized option '%c%s'\n"),
+                           argv[0], argv[d->optind][0], d->__nextchar);
 #endif
-               }
+                }
 
 #if defined _LIBC && defined USE_IN_LIBIO
-             if (n >= 0)
-               {
-                 _IO_flockfile (stderr);
+              if (n >= 0)
+                {
+                  _IO_flockfile (stderr);
 
-                 int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
-                 ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+                  int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+                  ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
 
-                 __fxprintf (NULL, "%s", buf);
+                  __fxprintf (NULL, "%s", buf);
 
-                 ((_IO_FILE *) stderr)->_flags2 = old_flags2;
-                 _IO_funlockfile (stderr);
+                  ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+                  _IO_funlockfile (stderr);
 
-                 free (buf);
-               }
+                  free (buf);
+                }
 #endif
-           }
-         d->__nextchar = (char *) "";
-         d->optind++;
-         d->optopt = 0;
-         return '?';
-       }
+            }
+          d->__nextchar = (char *) "";
+          d->optind++;
+          d->optopt = 0;
+          return '?';
+        }
     }
 
   /* Look at and handle the next short option-character.  */
@@ -745,335 +748,321 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
 
     if (temp == NULL || c == ':')
       {
-       if (print_errors)
-         {
+        if (print_errors)
+          {
 #if defined _LIBC && defined USE_IN_LIBIO
-             char *buf;
-             int n;
+              char *buf;
+              int n;
 #endif
 
-           if (d->__posixly_correct)
-             {
-               /* 1003.2 specifies the format of this message.  */
-#if defined _LIBC && defined USE_IN_LIBIO
-               n = __asprintf (&buf, _("%s: illegal option -- %c\n"),
-                               argv[0], c);
-#else
-               fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c);
-#endif
-             }
-           else
-             {
 #if defined _LIBC && defined USE_IN_LIBIO
-               n = __asprintf (&buf, _("%s: invalid option -- %c\n"),
-                               argv[0], c);
+              n = __asprintf (&buf, _("%s: invalid option -- '%c'\n"),
+                              argv[0], c);
 #else
-               fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c);
+              fprintf (stderr, _("%s: invalid option -- '%c'\n"), argv[0], c);
 #endif
-             }
 
 #if defined _LIBC && defined USE_IN_LIBIO
-           if (n >= 0)
-             {
-               _IO_flockfile (stderr);
+            if (n >= 0)
+              {
+                _IO_flockfile (stderr);
 
-               int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
-               ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+                int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+                ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
 
-               __fxprintf (NULL, "%s", buf);
+                __fxprintf (NULL, "%s", buf);
 
-               ((_IO_FILE *) stderr)->_flags2 = old_flags2;
-               _IO_funlockfile (stderr);
+                ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+                _IO_funlockfile (stderr);
 
-               free (buf);
-             }
+                free (buf);
+              }
 #endif
-         }
-       d->optopt = c;
-       return '?';
+          }
+        d->optopt = c;
+        return '?';
       }
     /* Convenience. Treat POSIX -W foo same as long option --foo */
     if (temp[0] == 'W' && temp[1] == ';')
       {
-       char *nameend;
-       const struct option *p;
-       const struct option *pfound = NULL;
-       int exact = 0;
-       int ambig = 0;
-       int indfound = 0;
-       int option_index;
-
-       /* This is an option that requires an argument.  */
-       if (*d->__nextchar != '\0')
-         {
-           d->optarg = d->__nextchar;
-           /* If we end this ARGV-element by taking the rest as an arg,
-              we must advance to the next element now.  */
-           d->optind++;
-         }
-       else if (d->optind == argc)
-         {
-           if (print_errors)
-             {
-               /* 1003.2 specifies the format of this message.  */
+        char *nameend;
+        const struct option *p;
+        const struct option *pfound = NULL;
+        int exact = 0;
+        int ambig = 0;
+        int indfound = 0;
+        int option_index;
+
+        /* This is an option that requires an argument.  */
+        if (*d->__nextchar != '\0')
+          {
+            d->optarg = d->__nextchar;
+            /* If we end this ARGV-element by taking the rest as an arg,
+               we must advance to the next element now.  */
+            d->optind++;
+          }
+        else if (d->optind == argc)
+          {
+            if (print_errors)
+              {
 #if defined _LIBC && defined USE_IN_LIBIO
-               char *buf;
+                char *buf;
 
-               if (__asprintf (&buf,
-                               _("%s: option requires an argument -- %c\n"),
-                               argv[0], c) >= 0)
-                 {
-                   _IO_flockfile (stderr);
+                if (__asprintf (&buf,
+                                _("%s: option requires an argument -- '%c'\n"),
+                                argv[0], c) >= 0)
+                  {
+                    _IO_flockfile (stderr);
 
-                   int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
-                   ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+                    int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+                    ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
 
-                   __fxprintf (NULL, "%s", buf);
+                    __fxprintf (NULL, "%s", buf);
 
-                   ((_IO_FILE *) stderr)->_flags2 = old_flags2;
-                   _IO_funlockfile (stderr);
+                    ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+                    _IO_funlockfile (stderr);
 
-                   free (buf);
-                 }
+                    free (buf);
+                  }
 #else
-               fprintf (stderr, _("%s: option requires an argument -- %c\n"),
-                        argv[0], c);
+                fprintf (stderr,
+                         _("%s: option requires an argument -- '%c'\n"),
+                         argv[0], c);
 #endif
-             }
-           d->optopt = c;
-           if (optstring[0] == ':')
-             c = ':';
-           else
-             c = '?';
-           return c;
-         }
-       else
-         /* We already incremented `d->optind' once;
-            increment it again when taking next ARGV-elt as argument.  */
-         d->optarg = argv[d->optind++];
-
-       /* optarg is now the argument, see if it's in the
-          table of longopts.  */
-
-       for (d->__nextchar = nameend = d->optarg; *nameend && *nameend != '=';
-            nameend++)
-         /* Do nothing.  */ ;
-
-       /* Test all long options for either exact match
-          or abbreviated matches.  */
-       for (p = longopts, option_index = 0; p->name; p++, option_index++)
-         if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar))
-           {
-             if ((unsigned int) (nameend - d->__nextchar) == strlen (p->name))
-               {
-                 /* Exact match found.  */
-                 pfound = p;
-                 indfound = option_index;
-                 exact = 1;
-                 break;
-               }
-             else if (pfound == NULL)
-               {
-                 /* First nonexact match found.  */
-                 pfound = p;
-                 indfound = option_index;
-               }
-             else
-               /* Second or later nonexact match found.  */
-               ambig = 1;
-           }
-       if (ambig && !exact)
-         {
-           if (print_errors)
-             {
+              }
+            d->optopt = c;
+            if (optstring[0] == ':')
+              c = ':';
+            else
+              c = '?';
+            return c;
+          }
+        else
+          /* We already incremented `d->optind' once;
+             increment it again when taking next ARGV-elt as argument.  */
+          d->optarg = argv[d->optind++];
+
+        /* optarg is now the argument, see if it's in the
+           table of longopts.  */
+
+        for (d->__nextchar = nameend = d->optarg; *nameend && *nameend != '=';
+             nameend++)
+          /* Do nothing.  */ ;
+
+        /* Test all long options for either exact match
+           or abbreviated matches.  */
+        for (p = longopts, option_index = 0; p->name; p++, option_index++)
+          if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar))
+            {
+              if ((unsigned int) (nameend - d->__nextchar) == strlen (p->name))
+                {
+                  /* Exact match found.  */
+                  pfound = p;
+                  indfound = option_index;
+                  exact = 1;
+                  break;
+                }
+              else if (pfound == NULL)
+                {
+                  /* First nonexact match found.  */
+                  pfound = p;
+                  indfound = option_index;
+                }
+              else
+                /* Second or later nonexact match found.  */
+                ambig = 1;
+            }
+        if (ambig && !exact)
+          {
+            if (print_errors)
+              {
 #if defined _LIBC && defined USE_IN_LIBIO
-               char *buf;
+                char *buf;
 
-               if (__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"),
-                               argv[0], argv[d->optind]) >= 0)
-                 {
-                   _IO_flockfile (stderr);
+                if (__asprintf (&buf, _("%s: option '-W %s' is ambiguous\n"),
+                                argv[0], argv[d->optind]) >= 0)
+                  {
+                    _IO_flockfile (stderr);
 
-                   int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
-                   ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+                    int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+                    ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
 
-                   __fxprintf (NULL, "%s", buf);
+                    __fxprintf (NULL, "%s", buf);
 
-                   ((_IO_FILE *) stderr)->_flags2 = old_flags2;
-                   _IO_funlockfile (stderr);
+                    ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+                    _IO_funlockfile (stderr);
 
-                   free (buf);
-                 }
+                    free (buf);
+                  }
 #else
-               fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
-                        argv[0], argv[d->optind]);
+                fprintf (stderr, _("%s: option '-W %s' is ambiguous\n"),
+                         argv[0], argv[d->optind]);
 #endif
-             }
-           d->__nextchar += strlen (d->__nextchar);
-           d->optind++;
-           return '?';
-         }
-       if (pfound != NULL)
-         {
-           option_index = indfound;
-           if (*nameend)
-             {
-               /* Don't test has_arg with >, because some C compilers don't
-                  allow it to be used on enums.  */
-               if (pfound->has_arg)
-                 d->optarg = nameend + 1;
-               else
-                 {
-                   if (print_errors)
-                     {
+              }
+            d->__nextchar += strlen (d->__nextchar);
+            d->optind++;
+            return '?';
+          }
+        if (pfound != NULL)
+          {
+            option_index = indfound;
+            if (*nameend)
+              {
+                /* Don't test has_arg with >, because some C compilers don't
+                   allow it to be used on enums.  */
+                if (pfound->has_arg)
+                  d->optarg = nameend + 1;
+                else
+                  {
+                    if (print_errors)
+                      {
 #if defined _LIBC && defined USE_IN_LIBIO
-                       char *buf;
+                        char *buf;
 
-                       if (__asprintf (&buf, _("\
-%s: option `-W %s' doesn't allow an argument\n"),
-                                       argv[0], pfound->name) >= 0)
-                         {
-                           _IO_flockfile (stderr);
+                        if (__asprintf (&buf, _("\
+%s: option '-W %s' doesn't allow an argument\n"),
+                                        argv[0], pfound->name) >= 0)
+                          {
+                            _IO_flockfile (stderr);
 
-                           int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
-                           ((_IO_FILE *) stderr)->_flags2
-                             |= _IO_FLAGS2_NOTCANCEL;
+                            int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+                            ((_IO_FILE *) stderr)->_flags2
+                              |= _IO_FLAGS2_NOTCANCEL;
 
-                           __fxprintf (NULL, "%s", buf);
+                            __fxprintf (NULL, "%s", buf);
 
-                           ((_IO_FILE *) stderr)->_flags2 = old_flags2;
-                           _IO_funlockfile (stderr);
+                            ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+                            _IO_funlockfile (stderr);
 
-                           free (buf);
-                         }
+                            free (buf);
+                          }
 #else
-                       fprintf (stderr, _("\
-%s: option `-W %s' doesn't allow an argument\n"),
-                                argv[0], pfound->name);
+                        fprintf (stderr, _("\
+%s: option '-W %s' doesn't allow an argument\n"),
+                                 argv[0], pfound->name);
 #endif
-                     }
-
-                   d->__nextchar += strlen (d->__nextchar);
-                   return '?';
-                 }
-             }
-           else if (pfound->has_arg == 1)
-             {
-               if (d->optind < argc)
-                 d->optarg = argv[d->optind++];
-               else
-                 {
-                   if (print_errors)
-                     {
+                      }
+
+                    d->__nextchar += strlen (d->__nextchar);
+                    return '?';
+                  }
+              }
+            else if (pfound->has_arg == 1)
+              {
+                if (d->optind < argc)
+                  d->optarg = argv[d->optind++];
+                else
+                  {
+                    if (print_errors)
+                      {
 #if defined _LIBC && defined USE_IN_LIBIO
-                       char *buf;
+                        char *buf;
 
-                       if (__asprintf (&buf, _("\
-%s: option `%s' requires an argument\n"),
-                                       argv[0], argv[d->optind - 1]) >= 0)
-                         {
-                           _IO_flockfile (stderr);
+                        if (__asprintf (&buf, _("\
+%s: option '%s' requires an argument\n"),
+                                        argv[0], argv[d->optind - 1]) >= 0)
+                          {
+                            _IO_flockfile (stderr);
 
-                           int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
-                           ((_IO_FILE *) stderr)->_flags2
-                             |= _IO_FLAGS2_NOTCANCEL;
+                            int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+                            ((_IO_FILE *) stderr)->_flags2
+                              |= _IO_FLAGS2_NOTCANCEL;
 
-                           __fxprintf (NULL, "%s", buf);
+                            __fxprintf (NULL, "%s", buf);
 
-                           ((_IO_FILE *) stderr)->_flags2 = old_flags2;
-                           _IO_funlockfile (stderr);
+                            ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+                            _IO_funlockfile (stderr);
 
-                           free (buf);
-                         }
+                            free (buf);
+                          }
 #else
-                       fprintf (stderr,
-                                _("%s: option `%s' requires an argument\n"),
-                                argv[0], argv[d->optind - 1]);
+                        fprintf (stderr,
+                                 _("%s: option '%s' requires an argument\n"),
+                                 argv[0], argv[d->optind - 1]);
 #endif
-                     }
-                   d->__nextchar += strlen (d->__nextchar);
-                   return optstring[0] == ':' ? ':' : '?';
-                 }
-             }
-           d->__nextchar += strlen (d->__nextchar);
-           if (longind != NULL)
-             *longind = option_index;
-           if (pfound->flag)
-             {
-               *(pfound->flag) = pfound->val;
-               return 0;
-             }
-           return pfound->val;
-         }
-         d->__nextchar = NULL;
-         return 'W';   /* Let the application handle it.   */
+                      }
+                    d->__nextchar += strlen (d->__nextchar);
+                    return optstring[0] == ':' ? ':' : '?';
+                  }
+              }
+            d->__nextchar += strlen (d->__nextchar);
+            if (longind != NULL)
+              *longind = option_index;
+            if (pfound->flag)
+              {
+                *(pfound->flag) = pfound->val;
+                return 0;
+              }
+            return pfound->val;
+          }
+          d->__nextchar = NULL;
+          return 'W';   /* Let the application handle it.   */
       }
     if (temp[1] == ':')
       {
-       if (temp[2] == ':')
-         {
-           /* This is an option that accepts an argument optionally.  */
-           if (*d->__nextchar != '\0')
-             {
-               d->optarg = d->__nextchar;
-               d->optind++;
-             }
-           else
-             d->optarg = NULL;
-           d->__nextchar = NULL;
-         }
-       else
-         {
-           /* This is an option that requires an argument.  */
-           if (*d->__nextchar != '\0')
-             {
-               d->optarg = d->__nextchar;
-               /* If we end this ARGV-element by taking the rest as an arg,
-                  we must advance to the next element now.  */
-               d->optind++;
-             }
-           else if (d->optind == argc)
-             {
-               if (print_errors)
-                 {
-                   /* 1003.2 specifies the format of this message.  */
+        if (temp[2] == ':')
+          {
+            /* This is an option that accepts an argument optionally.  */
+            if (*d->__nextchar != '\0')
+              {
+                d->optarg = d->__nextchar;
+                d->optind++;
+              }
+            else
+              d->optarg = NULL;
+            d->__nextchar = NULL;
+          }
+        else
+          {
+            /* This is an option that requires an argument.  */
+            if (*d->__nextchar != '\0')
+              {
+                d->optarg = d->__nextchar;
+                /* If we end this ARGV-element by taking the rest as an arg,
+                   we must advance to the next element now.  */
+                d->optind++;
+              }
+            else if (d->optind == argc)
+              {
+                if (print_errors)
+                  {
 #if defined _LIBC && defined USE_IN_LIBIO
-                   char *buf;
+                    char *buf;
 
-                   if (__asprintf (&buf, _("\
-%s: option requires an argument -- %c\n"),
-                                   argv[0], c) >= 0)
-                     {
-                       _IO_flockfile (stderr);
+                    if (__asprintf (&buf, _("\
+%s: option requires an argument -- '%c'\n"),
+                                    argv[0], c) >= 0)
+                      {
+                        _IO_flockfile (stderr);
 
-                       int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
-                       ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+                        int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+                        ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
 
-                       __fxprintf (NULL, "%s", buf);
+                        __fxprintf (NULL, "%s", buf);
 
-                       ((_IO_FILE *) stderr)->_flags2 = old_flags2;
-                       _IO_funlockfile (stderr);
+                        ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+                        _IO_funlockfile (stderr);
 
-                       free (buf);
-                     }
+                        free (buf);
+                      }
 #else
-                   fprintf (stderr,
-                            _("%s: option requires an argument -- %c\n"),
-                            argv[0], c);
+                    fprintf (stderr,
+                             _("%s: option requires an argument -- '%c'\n"),
+                             argv[0], c);
 #endif
-                 }
-               d->optopt = c;
-               if (optstring[0] == ':')
-                 c = ':';
-               else
-                 c = '?';
-             }
-           else
-             /* We already incremented `optind' once;
-                increment it again when taking next ARGV-elt as argument.  */
-             d->optarg = argv[d->optind++];
-           d->__nextchar = NULL;
-         }
+                  }
+                d->optopt = c;
+                if (optstring[0] == ':')
+                  c = ':';
+                else
+                  c = '?';
+              }
+            else
+              /* We already incremented `optind' once;
+                 increment it again when taking next ARGV-elt as argument.  */
+              d->optarg = argv[d->optind++];
+            d->__nextchar = NULL;
+          }
       }
     return c;
   }
@@ -1081,16 +1070,17 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
 
 int
 _getopt_internal (int argc, char **argv, const char *optstring,
-                 const struct option *longopts, int *longind,
-                 int long_only, int posixly_correct)
+                  const struct option *longopts, int *longind, int long_only,
+                  int posixly_correct)
 {
   int result;
 
   getopt_data.optind = optind;
   getopt_data.opterr = opterr;
 
-  result = _getopt_internal_r (argc, argv, optstring, longopts, longind,
-                              long_only, posixly_correct, &getopt_data);
+  result = _getopt_internal_r (argc, argv, optstring, longopts,
+                               longind, long_only, &getopt_data,
+                               posixly_correct);
 
   optind = getopt_data.optind;
   optarg = getopt_data.optarg;
@@ -1110,10 +1100,23 @@ enum { POSIXLY_CORRECT = 1 };
 int
 getopt (int argc, char *const *argv, const char *optstring)
 {
-  return _getopt_internal (argc, (char **) argv, optstring, NULL, NULL, 0,
-                          POSIXLY_CORRECT);
+  return _getopt_internal (argc, (char **) argv, optstring,
+                           (const struct option *) 0,
+                           (int *) 0,
+                           0, POSIXLY_CORRECT);
 }
 
+#ifdef _LIBC
+int
+__posix_getopt (int argc, char *const *argv, const char *optstring)
+{
+  return _getopt_internal (argc, argv, optstring,
+                           (const struct option *) 0,
+                           (int *) 0,
+                           0, 1);
+}
+#endif
+
 
 #ifdef TEST
 
@@ -1132,51 +1135,51 @@ main (int argc, char **argv)
 
       c = getopt (argc, argv, "abc:d:0123456789");
       if (c == -1)
-       break;
+        break;
 
       switch (c)
-       {
-       case '0':
-       case '1':
-       case '2':
-       case '3':
-       case '4':
-       case '5':
-       case '6':
-       case '7':
-       case '8':
-       case '9':
-         if (digit_optind != 0 && digit_optind != this_option_optind)
-           printf ("digits occur in two different argv-elements.\n");
-         digit_optind = this_option_optind;
-         printf ("option %c\n", c);
-         break;
-
-       case 'a':
-         printf ("option a\n");
-         break;
-
-       case 'b':
-         printf ("option b\n");
-         break;
-
-       case 'c':
-         printf ("option c with value `%s'\n", optarg);
-         break;
-
-       case '?':
-         break;
-
-       default:
-         printf ("?? getopt returned character code 0%o ??\n", c);
-       }
+        {
+        case '0':
+        case '1':
+        case '2':
+        case '3':
+        case '4':
+        case '5':
+        case '6':
+        case '7':
+        case '8':
+        case '9':
+          if (digit_optind != 0 && digit_optind != this_option_optind)
+            printf ("digits occur in two different argv-elements.\n");
+          digit_optind = this_option_optind;
+          printf ("option %c\n", c);
+          break;
+
+        case 'a':
+          printf ("option a\n");
+          break;
+
+        case 'b':
+          printf ("option b\n");
+          break;
+
+        case 'c':
+          printf ("option c with value '%s'\n", optarg);
+          break;
+
+        case '?':
+          break;
+
+        default:
+          printf ("?? getopt returned character code 0%o ??\n", c);
+        }
     }
 
   if (optind < argc)
     {
       printf ("non-option ARGV-elements: ");
       while (optind < argc)
-       printf ("%s ", argv[optind++]);
+        printf ("%s ", argv[optind++]);
       printf ("\n");
     }
 
diff --git a/src/gl/getopt.in.h b/src/gl/getopt.in.h
index d2d3e6e..7d74e36 100644
--- a/src/gl/getopt.in.h
+++ b/src/gl/getopt.in.h
@@ -1,5 +1,5 @@
 /* Declarations for getopt.
-   Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2005,2006,2007
+   Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2005,2006,2007,2009
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -16,24 +16,42 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#ifndef _GETOPT_H
+#ifndef _GL_GETOPT_H
+
+#if __GNUC__ >= 3
address@hidden@
+#endif
+
+/* The include_next requires a split double-inclusion guard.  We must
+   also inform the replacement unistd.h to not recursively use
+   <getopt.h>; our definitions will be present soon enough.  */
+#if @HAVE_GETOPT_H@
+# define _GL_SYSTEM_GETOPT
+# @INCLUDE_NEXT@ @NEXT_GETOPT_H@
+# undef _GL_SYSTEM_GETOPT
+#endif
+
+#ifndef _GL_GETOPT_H
 
 #ifndef __need_getopt
-# define _GETOPT_H 1
+# define _GL_GETOPT_H 1
 #endif
 
 /* Standalone applications should #define __GETOPT_PREFIX to an
    identifier that prefixes the external functions and variables
    defined in this header.  When this happens, include the
    headers that might declare getopt so that they will not cause
-   confusion if included after this file.  Then systematically rename
+   confusion if included after this file (if the system had <getopt.h>,
+   we have already included it).  Then systematically rename
    identifiers so that they do not collide with the system functions
    and variables.  Renaming avoids problems with some compilers and
    linkers.  */
 #if defined __GETOPT_PREFIX && !defined __need_getopt
-# include <stdlib.h>
-# include <stdio.h>
-# include <unistd.h>
+# if address@hidden@
+#  include <stdlib.h>
+#  include <stdio.h>
+#  include <unistd.h>
+# endif
 # undef __need_getopt
 # undef getopt
 # undef getopt_long
@@ -42,6 +60,7 @@
 # undef opterr
 # undef optind
 # undef optopt
+# undef option
 # define __GETOPT_CONCAT(x, y) x ## y
 # define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
 # define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
@@ -52,6 +71,8 @@
 # define opterr __GETOPT_ID (opterr)
 # define optind __GETOPT_ID (optind)
 # define optopt __GETOPT_ID (optopt)
+# define option __GETOPT_ID (option)
+# define _getopt_internal __GETOPT_ID (getopt_internal)
 #endif
 
 /* Standalone applications get correct prototypes for getopt_long and
@@ -94,12 +115,14 @@
 #  define __GNUC_PREREQ(maj, min) (0)
 # endif
 # if defined __cplusplus && __GNUC_PREREQ (2,8)
-#  define __THROW      throw ()
+#  define __THROW       throw ()
 # else
 #  define __THROW
 # endif
 #endif
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -142,9 +165,9 @@ extern int optopt;
    zero.
 
    The field `has_arg' is:
-   no_argument         (or 0) if the option does not take an argument,
-   required_argument   (or 1) if the option requires an argument,
-   optional_argument   (or 2) if the option takes an optional argument.
+   no_argument          (or 0) if the option does not take an argument,
+   required_argument    (or 1) if the option requires an argument,
+   optional_argument    (or 2) if the option takes an optional argument.
 
    If the field `flag' is not NULL, it points to a variable that is set
    to the value given in the field `val' when the option is found, but
@@ -169,10 +192,10 @@ struct option
 
 /* Names for the values of the `has_arg' field of `struct option'.  */
 
-# define no_argument           0
-# define required_argument     1
-# define optional_argument     2
-#endif /* need getopt */
+# define no_argument            0
+# define required_argument      1
+# define optional_argument      2
+#endif  /* need getopt */
 
 
 /* Get definitions and prototypes for functions to process the
@@ -201,17 +224,17 @@ struct option
    the environment, then do not permute arguments.  */
 
 extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
-       __THROW;
+       __THROW _GL_ARG_NONNULL ((2, 3));
 
 #ifndef __need_getopt
 extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
-                       const char *__shortopts,
-                       const struct option *__longopts, int *__longind)
-       __THROW;
+                        const char *__shortopts,
+                        const struct option *__longopts, int *__longind)
+       __THROW _GL_ARG_NONNULL ((2, 3));
 extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
-                            const char *__shortopts,
-                            const struct option *__longopts, int *__longind)
-       __THROW;
+                             const char *__shortopts,
+                             const struct option *__longopts, int *__longind)
+       __THROW _GL_ARG_NONNULL ((2, 3));
 
 #endif
 
@@ -223,3 +246,4 @@ extern int getopt_long_only (int ___argc, char 
*__getopt_argv_const *___argv,
 #undef __need_getopt
 
 #endif /* getopt.h */
+#endif /* getopt.h */
diff --git a/src/gl/getopt1.c b/src/gl/getopt1.c
index ba115c4..6ec0fc0 100644
--- a/src/gl/getopt1.c
+++ b/src/gl/getopt1.c
@@ -32,25 +32,25 @@
 #include <stdlib.h>
 #endif
 
-#ifndef        NULL
+#ifndef NULL
 #define NULL 0
 #endif
 
 int
 getopt_long (int argc, char *__getopt_argv_const *argv, const char *options,
-            const struct option *long_options, int *opt_index)
+             const struct option *long_options, int *opt_index)
 {
   return _getopt_internal (argc, (char **) argv, options, long_options,
-                          opt_index, 0, 0);
+                           opt_index, 0, 0);
 }
 
 int
 _getopt_long_r (int argc, char **argv, const char *options,
-               const struct option *long_options, int *opt_index,
-               struct _getopt_data *d)
+                const struct option *long_options, int *opt_index,
+                struct _getopt_data *d)
 {
   return _getopt_internal_r (argc, argv, options, long_options, opt_index,
-                            0, 0, d);
+                             0, d, 0);
 }
 
 /* Like getopt_long, but '-' as well as '--' can indicate a long option.
@@ -60,20 +60,20 @@ _getopt_long_r (int argc, char **argv, const char *options,
 
 int
 getopt_long_only (int argc, char *__getopt_argv_const *argv,
-                 const char *options,
-                 const struct option *long_options, int *opt_index)
+                  const char *options,
+                  const struct option *long_options, int *opt_index)
 {
   return _getopt_internal (argc, (char **) argv, options, long_options,
-                          opt_index, 1, 0);
+                           opt_index, 1, 0);
 }
 
 int
 _getopt_long_only_r (int argc, char **argv, const char *options,
-                    const struct option *long_options, int *opt_index,
-                    struct _getopt_data *d)
+                     const struct option *long_options, int *opt_index,
+                     struct _getopt_data *d)
 {
   return _getopt_internal_r (argc, argv, options, long_options, opt_index,
-                            1, 0, d);
+                             1, d, 0);
 }
 
 
@@ -93,74 +93,74 @@ main (int argc, char **argv)
       int option_index = 0;
       static const struct option long_options[] =
       {
-       {"add", 1, 0, 0},
-       {"append", 0, 0, 0},
-       {"delete", 1, 0, 0},
-       {"verbose", 0, 0, 0},
-       {"create", 0, 0, 0},
-       {"file", 1, 0, 0},
-       {0, 0, 0, 0}
+        {"add", 1, 0, 0},
+        {"append", 0, 0, 0},
+        {"delete", 1, 0, 0},
+        {"verbose", 0, 0, 0},
+        {"create", 0, 0, 0},
+        {"file", 1, 0, 0},
+        {0, 0, 0, 0}
       };
 
       c = getopt_long (argc, argv, "abc:d:0123456789",
-                      long_options, &option_index);
+                       long_options, &option_index);
       if (c == -1)
-       break;
+        break;
 
       switch (c)
-       {
-       case 0:
-         printf ("option %s", long_options[option_index].name);
-         if (optarg)
-           printf (" with arg %s", optarg);
-         printf ("\n");
-         break;
-
-       case '0':
-       case '1':
-       case '2':
-       case '3':
-       case '4':
-       case '5':
-       case '6':
-       case '7':
-       case '8':
-       case '9':
-         if (digit_optind != 0 && digit_optind != this_option_optind)
-           printf ("digits occur in two different argv-elements.\n");
-         digit_optind = this_option_optind;
-         printf ("option %c\n", c);
-         break;
-
-       case 'a':
-         printf ("option a\n");
-         break;
-
-       case 'b':
-         printf ("option b\n");
-         break;
-
-       case 'c':
-         printf ("option c with value `%s'\n", optarg);
-         break;
-
-       case 'd':
-         printf ("option d with value `%s'\n", optarg);
-         break;
-
-       case '?':
-         break;
-
-       default:
-         printf ("?? getopt returned character code 0%o ??\n", c);
-       }
+        {
+        case 0:
+          printf ("option %s", long_options[option_index].name);
+          if (optarg)
+            printf (" with arg %s", optarg);
+          printf ("\n");
+          break;
+
+        case '0':
+        case '1':
+        case '2':
+        case '3':
+        case '4':
+        case '5':
+        case '6':
+        case '7':
+        case '8':
+        case '9':
+          if (digit_optind != 0 && digit_optind != this_option_optind)
+            printf ("digits occur in two different argv-elements.\n");
+          digit_optind = this_option_optind;
+          printf ("option %c\n", c);
+          break;
+
+        case 'a':
+          printf ("option a\n");
+          break;
+
+        case 'b':
+          printf ("option b\n");
+          break;
+
+        case 'c':
+          printf ("option c with value `%s'\n", optarg);
+          break;
+
+        case 'd':
+          printf ("option d with value `%s'\n", optarg);
+          break;
+
+        case '?':
+          break;
+
+        default:
+          printf ("?? getopt returned character code 0%o ??\n", c);
+        }
     }
 
   if (optind < argc)
     {
       printf ("non-option ARGV-elements: ");
       while (optind < argc)
-       printf ("%s ", argv[optind++]);
+        printf ("%s ", argv[optind++]);
       printf ("\n");
     }
 
diff --git a/src/gl/getopt_int.h b/src/gl/getopt_int.h
index 3c6628b..c407898 100644
--- a/src/gl/getopt_int.h
+++ b/src/gl/getopt_int.h
@@ -1,5 +1,5 @@
 /* Internal declarations for getopt.
-   Copyright (C) 1989-1994,1996-1999,2001,2003,2004
+   Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2009
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -17,12 +17,14 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _GETOPT_INT_H
-#define _GETOPT_INT_H  1
+#define _GETOPT_INT_H   1
+
+#include <getopt.h>
 
 extern int _getopt_internal (int ___argc, char **___argv,
-                            const char *__shortopts,
-                            const struct option *__longopts, int *__longind,
-                            int __long_only, int __posixly_correct);
+                             const char *__shortopts,
+                             const struct option *__longopts, int *__longind,
+                             int __long_only, int __posixly_correct);
 
 
 /* Reentrant versions which can handle parsing multiple argument
@@ -108,23 +110,23 @@ struct _getopt_data
 
 /* The initializer is necessary to set OPTIND and OPTERR to their
    default values and to clear the initialization flag.  */
-#define _GETOPT_DATA_INITIALIZER       { 1, 1 }
+#define _GETOPT_DATA_INITIALIZER        { 1, 1 }
 
 extern int _getopt_internal_r (int ___argc, char **___argv,
-                              const char *__shortopts,
-                              const struct option *__longopts, int *__longind,
-                              int __long_only, int __posixly_correct,
-                              struct _getopt_data *__data);
+                               const char *__shortopts,
+                               const struct option *__longopts, int *__longind,
+                               int __long_only, struct _getopt_data *__data,
+                               int __posixly_correct);
 
 extern int _getopt_long_r (int ___argc, char **___argv,
-                          const char *__shortopts,
-                          const struct option *__longopts, int *__longind,
-                          struct _getopt_data *__data);
+                           const char *__shortopts,
+                           const struct option *__longopts, int *__longind,
+                           struct _getopt_data *__data);
 
 extern int _getopt_long_only_r (int ___argc, char **___argv,
-                               const char *__shortopts,
-                               const struct option *__longopts,
-                               int *__longind,
-                               struct _getopt_data *__data);
+                                const char *__shortopts,
+                                const struct option *__longopts,
+                                int *__longind,
+                                struct _getopt_data *__data);
 
 #endif /* getopt_int.h */
diff --git a/src/gl/gnulib.mk b/src/gl/gnulib.mk
index ce308a4..047203f 100644
--- a/src/gl/gnulib.mk
+++ b/src/gl/gnulib.mk
@@ -9,7 +9,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=src/gl 
--m4-base=src/gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux 
--avoid=extensions --avoid=gettext --avoid=gettext-h --avoid=include_next 
--avoid=intprops --avoid=stdarg --avoid=string --avoid=unistd 
--makefile-name=gnulib.mk --libtool --macro-prefix=gl2 --no-vc-files error 
getopt locale progname version-etc
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=src/gl 
--m4-base=src/gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux 
--avoid=extensions --avoid=gettext --avoid=gettext-h --avoid=include_next 
--avoid=intprops --avoid=stdarg --avoid=string --avoid=unistd 
--makefile-name=gnulib.mk --libtool --macro-prefix=gl2 --no-vc-files error 
getopt-gnu locale progname version-etc
 
 
 MOSTLYCLEANFILES += core *.stackdump
@@ -22,6 +22,30 @@ libgnu_la_DEPENDENCIES = $(gl2_LTLIBOBJS)
 EXTRA_libgnu_la_SOURCES =
 libgnu_la_LDFLAGS = $(AM_LDFLAGS)
 
+## begin gnulib module arg-nonnull
+
+# The BUILT_SOURCES created by this Makefile snippet are not used via #include
+# statements but through direct file reference. Therefore this snippet must be
+# present in all Makefile.am that need it. This is ensured by the applicability
+# 'all' defined above.
+
+BUILT_SOURCES += arg-nonnull.h
+# The arg-nonnull.h that gets inserted into generated .h files is the same as
+# build-aux/arg-nonnull.h, except that it has the copyright header cut off.
+arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       sed -n -e '/GL_ARG_NONNULL/,$$p' \
+         < $(top_srcdir)/build-aux/arg-nonnull.h \
+         > address@hidden && \
+       mv address@hidden $@
+MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t
+
+ARG_NONNULL_H=arg-nonnull.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h
+
+## end   gnulib module arg-nonnull
+
 ## begin gnulib module errno
 
 BUILT_SOURCES += $(ERRNO_H)
@@ -29,7 +53,7 @@ BUILT_SOURCES += $(ERRNO_H)
 # We need the following in order to create <errno.h> when the system
 # doesn't have one that is POSIX compliant.
 errno.h: errno.in.h
-       rm -f address@hidden $@
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
@@ -41,7 +65,7 @@ errno.h: errno.in.h
              -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \
              -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \
              < $(srcdir)/errno.in.h; \
-       } > address@hidden
+       } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += errno.h errno.h-t
 
@@ -58,16 +82,23 @@ EXTRA_libgnu_la_SOURCES += error.c
 
 ## end   gnulib module error
 
-## begin gnulib module getopt
+## begin gnulib module getopt-posix
 
 BUILT_SOURCES += $(GETOPT_H)
 
 # We need the following in order to create <getopt.h> when the system
 # doesn't have one that works with the given compiler.
-getopt.h: getopt.in.h
+getopt.h: getopt.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         cat $(srcdir)/getopt.in.h; \
-       } > address@hidden
+         sed -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \
+             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \
+             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             < $(srcdir)/getopt.in.h; \
+       } > address@hidden && \
        mv -f address@hidden $@
 MOSTLYCLEANFILES += getopt.h getopt.h-t
 
@@ -75,7 +106,7 @@ EXTRA_DIST += getopt.c getopt.in.h getopt1.c getopt_int.h
 
 EXTRA_libgnu_la_SOURCES += getopt.c getopt1.c
 
-## end   gnulib module getopt
+## end   gnulib module getopt-posix
 
 ## begin gnulib module locale
 
@@ -83,14 +114,18 @@ BUILT_SOURCES += $(LOCALE_H)
 
 # We need the following in order to create <locale.h> when the system
 # doesn't have one that provides all definitions.
-locale.h: locale.in.h
-       rm -f address@hidden $@
+locale.h: locale.in.h $(ARG_NONNULL_H)
+       $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \
+             -e 's|@''GNULIB_DUPLOCALE''@|$(GNULIB_DUPLOCALE)|g' \
+             -e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \
+             -e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              < $(srcdir)/locale.in.h; \
-       } > address@hidden
+       } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += locale.h locale.h-t
 
@@ -104,6 +139,29 @@ libgnu_la_SOURCES += progname.h progname.c
 
 ## end   gnulib module progname
 
+## begin gnulib module stddef
+
+BUILT_SOURCES += $(STDDEF_H)
+
+# We need the following in order to create <stddef.h> when the system
+# doesn't have one that works with the given compiler.
+stddef.h: stddef.in.h
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
+             -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \
+             -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
+             < $(srcdir)/stddef.in.h; \
+       } > address@hidden && \
+       mv address@hidden $@
+MOSTLYCLEANFILES += stddef.h stddef.h-t
+
+EXTRA_DIST += stddef.in.h
+
+## end   gnulib module stddef
+
 ## begin gnulib module strerror
 
 
diff --git a/src/gl/locale.in.h b/src/gl/locale.in.h
index 10629f6..478795a 100644
--- a/src/gl/locale.in.h
+++ b/src/gl/locale.in.h
@@ -1,5 +1,5 @@
 /* A POSIX <locale.h>.
-   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
@@ -26,11 +26,35 @@
 #ifndef _GL_LOCALE_H
 #define _GL_LOCALE_H
 
+/* NetBSD 5.0 mis-defines NULL.  */
+#include <stddef.h>
+
+/* MacOS X 10.5 defines the locale_t type in <xlocale.h>.  */
+#if @HAVE_XLOCALE_H@
+# include <xlocale.h>
+#endif
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 /* The LC_MESSAGES locale category is specified in POSIX, but not in ISO C.
    On systems that don't define it, use the same value as GNU libintl.  */
 #if !defined LC_MESSAGES
 # define LC_MESSAGES 1729
 #endif
 
+#if @GNULIB_DUPLOCALE@
+# if @REPLACE_DUPLOCALE@
+#  undef duplocale
+#  define duplocale rpl_duplocale
+extern locale_t duplocale (locale_t locale) _GL_ARG_NONNULL ((1));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef duplocale
+# define duplocale(l) \
+   (GL_LINK_WARNING ("duplocale is buggy on some glibc systems - " \
+                     "use gnulib module duplocale for portability"), \
+    duplocale (l))
+#endif
+
 #endif /* _GL_LOCALE_H */
 #endif /* _GL_LOCALE_H */
diff --git a/src/gl/m4/error.m4 b/src/gl/m4/error.m4
index 7c7746e..243dbda 100644
--- a/src/gl/m4/error.m4
+++ b/src/gl/m4/error.m4
@@ -1,6 +1,6 @@
-#serial 11
+#serial 12
 
-# Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2004 Free Software
+# Copyright (C) 1996-1998, 2001-2004, 2009 Free Software
 # Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
@@ -18,5 +18,6 @@ AC_DEFUN([gl_ERROR],
 AC_DEFUN([gl_PREREQ_ERROR],
 [
   AC_REQUIRE([AC_FUNC_STRERROR_R])
+  AC_REQUIRE([AC_C_INLINE])
   :
 ])
diff --git a/src/gl/m4/getopt.m4 b/src/gl/m4/getopt.m4
index 9b683c2..8b1bb8f 100644
--- a/src/gl/m4/getopt.m4
+++ b/src/gl/m4/getopt.m4
@@ -1,82 +1,272 @@
-# getopt.m4 serial 14
-dnl Copyright (C) 2002-2006, 2008 Free Software Foundation, Inc.
+# getopt.m4 serial 24
+dnl Copyright (C) 2002-2006, 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.
 
-# The getopt module assume you want GNU getopt, with getopt_long etc,
-# rather than vanilla POSIX getopt.  This means your code should
-# always include <getopt.h> for the getopt prototypes.
+# Request a POSIX compliant getopt function.
+AC_DEFUN([gl_FUNC_GETOPT_POSIX],
+[
+  m4_divert_text([DEFAULTS], [gl_getopt_required=POSIX])
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  gl_GETOPT_IFELSE([
+    gl_REPLACE_GETOPT
+  ],
+  [])
+])
+
+# Request a POSIX compliant getopt function with GNU extensions (such as
+# options with optional arguments) and the functions getopt_long,
+# getopt_long_only.
+AC_DEFUN([gl_FUNC_GETOPT_GNU],
+[
+  m4_divert_text([INIT_PREPARE], [gl_getopt_required=GNU])
+
+  AC_REQUIRE([gl_FUNC_GETOPT_POSIX])
+])
 
-AC_DEFUN([gl_GETOPT_SUBSTITUTE],
+# Request the gnulib implementation of the getopt functions unconditionally.
+# argp.m4 uses this.
+AC_DEFUN([gl_REPLACE_GETOPT],
 [
+  dnl Arrange for getopt.h to be created.
+  gl_GETOPT_SUBSTITUTE_HEADER
+  dnl Arrange for unistd.h to include getopt.h.
+  GNULIB_UNISTD_H_GETOPT=1
+  dnl Arrange to compile the getopt implementation.
   AC_LIBOBJ([getopt])
   AC_LIBOBJ([getopt1])
-  gl_GETOPT_SUBSTITUTE_HEADER
   gl_PREREQ_GETOPT
 ])
 
-AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
+# emacs' configure.in uses this.
+AC_DEFUN([gl_GETOPT_IFELSE],
 [
-  GETOPT_H=getopt.h
-  AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
-    [Define to rpl_ if the getopt replacement functions and variables
-     should be used.])
-  AC_SUBST([GETOPT_H])
+  AC_REQUIRE([gl_GETOPT_CHECK_HEADERS])
+  AS_IF([test -n "$gl_replace_getopt"], [$1], [$2])
 ])
 
+# Determine whether to replace the entire getopt facility.
 AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
 [
-  if test -z "$GETOPT_H"; then
-    AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  dnl Persuade Solaris <unistd.h> to declare optarg, optind, opterr, optopt.
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  gl_CHECK_NEXT_HEADERS([getopt.h])
+  AC_CHECK_HEADERS_ONCE([getopt.h])
+  if test $ac_cv_header_getopt_h = yes; then
+    HAVE_GETOPT_H=1
+  else
+    HAVE_GETOPT_H=0
+  fi
+  AC_SUBST([HAVE_GETOPT_H])
+
+  gl_replace_getopt=
+
+  dnl Test whether <getopt.h> is available.
+  if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then
+    AC_CHECK_HEADERS([getopt.h], [], [gl_replace_getopt=yes])
+  fi
+
+  dnl Test whether the function getopt_long is available.
+  if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then
+    AC_CHECK_FUNCS([getopt_long_only], [], [gl_replace_getopt=yes])
   fi
 
-  if test -z "$GETOPT_H"; then
-    AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h])
+  dnl BSD getopt_long uses an incompatible method to reset option processing.
+  dnl Existence of the variable, in and of itself, is not a reason to replace
+  dnl getopt, but knowledge of the variable is needed to determine how to
+  dnl reset and whether a reset reparses the environment.
+  if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then
+    AC_CHECK_DECLS([optreset], [], [],
+      [[#include <getopt.h>]])
   fi
 
-  dnl BSD getopt_long uses an incompatible method to reset option processing,
-  dnl and (as of 2004-10-15) mishandles optional option-arguments.
-  if test -z "$GETOPT_H"; then
-    AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include <getopt.h>])
+  dnl mingw's getopt (in libmingwex.a) does weird things when the options
+  dnl strings starts with '+' and it's not the first call.  Some internal state
+  dnl is left over from earlier calls, and neither setting optind = 0 nor
+  dnl setting optreset = 1 get rid of this internal state.
+  dnl POSIX is silent on optind vs. optreset, so we allow either behavior.
+  if test -z "$gl_replace_getopt"; then
+    AC_CACHE_CHECK([whether getopt is POSIX compatible],
+      [gl_cv_func_getopt_posix],
+      [
+        dnl This test fails on mingw and succeeds on all other platforms.
+        AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !HAVE_DECL_OPTRESET
+# define OPTIND_MIN 0
+#else
+# define OPTIND_MIN 1
+#endif
+
+int
+main ()
+{
+  {
+    int argc = 0;
+    char *argv[10];
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "-a";
+    argv[argc++] = "foo";
+    argv[argc++] = "bar";
+    argv[argc] = NULL;
+    optind = OPTIND_MIN;
+    opterr = 0;
+
+    c = getopt (argc, argv, "ab");
+    if (!(c == 'a'))
+      return 1;
+    c = getopt (argc, argv, "ab");
+    if (!(c == -1))
+      return 2;
+    if (!(optind == 2))
+      return 3;
+  }
+  /* Some internal state exists at this point.  */
+  {
+    int argc = 0;
+    char *argv[10];
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "donald";
+    argv[argc++] = "-p";
+    argv[argc++] = "billy";
+    argv[argc++] = "duck";
+    argv[argc++] = "-a";
+    argv[argc++] = "bar";
+    argv[argc] = NULL;
+    optind = OPTIND_MIN;
+    opterr = 0;
+
+    c = getopt (argc, argv, "+abp:q:");
+    if (!(c == -1))
+      return 4;
+    if (!(strcmp (argv[0], "program") == 0))
+      return 5;
+    if (!(strcmp (argv[1], "donald") == 0))
+      return 6;
+    if (!(strcmp (argv[2], "-p") == 0))
+      return 7;
+    if (!(strcmp (argv[3], "billy") == 0))
+      return 8;
+    if (!(strcmp (argv[4], "duck") == 0))
+      return 9;
+    if (!(strcmp (argv[5], "-a") == 0))
+      return 10;
+    if (!(strcmp (argv[6], "bar") == 0))
+      return 11;
+    if (!(optind == 1))
+      return 12;
+  }
+
+  return 0;
+}
+]])],
+          [gl_cv_func_getopt_posix=yes], [gl_cv_func_getopt_posix=no],
+          [case "$host_os" in
+             mingw*) gl_cv_func_getopt_posix="guessing no";;
+             *)      gl_cv_func_getopt_posix="guessing yes";;
+           esac
+          ])
+      ])
+    case "$gl_cv_func_getopt_posix" in
+      *no) gl_replace_getopt=yes ;;
+    esac
   fi
 
-  dnl Solaris 10 getopt doesn't handle `+' as a leading character in an
-  dnl option string (as of 2005-05-05).
-  if test -z "$GETOPT_H"; then
-    AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_gnu_getopt],
-      [AC_RUN_IFELSE(
-       [AC_LANG_PROGRAM([[#include <getopt.h>]],
-          [[
-            char *myargv[3];
-            myargv[0] = "conftest";
-            myargv[1] = "-+";
-            myargv[2] = 0;
-            return getopt (2, myargv, "+a") != '?';
-          ]])],
-       [gl_cv_func_gnu_getopt=yes],
-       [gl_cv_func_gnu_getopt=no],
-       [dnl cross compiling - pessimistically guess based on decls
-        dnl Solaris 10 getopt doesn't handle `+' as a leading character in an
-        dnl option string (as of 2005-05-05).
-        AC_CHECK_DECL([getopt_clip],
-          [gl_cv_func_gnu_getopt=no], [gl_cv_func_gnu_getopt=yes],
-          [#include <getopt.h>])])])
-    if test "$gl_cv_func_gnu_getopt" = "no"; then
-      GETOPT_H=getopt.h
+  if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then
+    AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_getopt_gnu],
+      [# Even with POSIXLY_CORRECT, the GNU extension of leading '-' in the
+       # optstring is necessary for programs like m4 that have POSIX-mandated
+       # semantics for supporting options interspersed with files.
+       # Also, since getopt_long is a GNU extension, we require optind=0.
+       gl_had_POSIXLY_CORRECT=${POSIXLY_CORRECT:+yes}
+       POSIXLY_CORRECT=1
+       export POSIXLY_CORRECT
+       AC_RUN_IFELSE(
+        [AC_LANG_PROGRAM([[#include <getopt.h>
+                           #include <stddef.h>
+                           #include <string.h>
+           ]], [[
+             /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw,
+                and fails on MacOS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5,
+                OSF/1 5.1, Solaris 10.  */
+             {
+               char *myargv[3];
+               myargv[0] = "conftest";
+               myargv[1] = "-+";
+               myargv[2] = 0;
+               opterr = 0;
+               if (getopt (2, myargv, "+a") != '?')
+                 return 1;
+             }
+             /* This code succeeds on glibc 2.8, mingw,
+                and fails on MacOS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11,
+                IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x.  */
+             {
+               char *argv[] = { "program", "-p", "foo", "bar", NULL };
+
+               optind = 1;
+               if (getopt (4, argv, "p::") != 'p')
+                 return 2;
+               if (optarg != NULL)
+                 return 3;
+               if (getopt (4, argv, "p::") != -1)
+                 return 4;
+               if (optind != 2)
+                 return 5;
+             }
+             /* This code succeeds on glibc 2.8 and fails on Cygwin 1.7.0.  */
+             {
+               char *argv[] = { "program", "foo", "-p", NULL };
+               optind = 0;
+               if (getopt (3, argv, "-p") != 1)
+                 return 6;
+               if (getopt (3, argv, "-p") != 'p')
+                 return 7;
+             }
+             return 0;
+           ]])],
+        [gl_cv_func_getopt_gnu=yes],
+        [gl_cv_func_getopt_gnu=no],
+        [dnl Cross compiling. Guess based on host and declarations.
+         case $host_os:$ac_cv_have_decl_optreset in
+           *-gnu*:* | mingw*:*) gl_cv_func_getopt_gnu=no;;
+           *:yes)               gl_cv_func_getopt_gnu=no;;
+           *)                   gl_cv_func_getopt_gnu=yes;;
+         esac
+        ])
+       if test "$gl_had_POSIXLY_CORRECT" != yes; then
+         AS_UNSET([POSIXLY_CORRECT])
+       fi
+      ])
+    if test "$gl_cv_func_getopt_gnu" = "no"; then
+      gl_replace_getopt=yes
     fi
   fi
 ])
 
-AC_DEFUN([gl_GETOPT_IFELSE],
+# emacs' configure.in uses this.
+AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
 [
-  AC_REQUIRE([gl_GETOPT_CHECK_HEADERS])
-  AS_IF([test -n "$GETOPT_H"], [$1], [$2])
+  GETOPT_H=getopt.h
+  AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
+    [Define to rpl_ if the getopt replacement functions and variables
+     should be used.])
+  AC_SUBST([GETOPT_H])
 ])
 
-AC_DEFUN([gl_GETOPT], [gl_GETOPT_IFELSE([gl_GETOPT_SUBSTITUTE])])
-
 # Prerequisites of lib/getopt*.
+# emacs' configure.in uses this.
 AC_DEFUN([gl_PREREQ_GETOPT],
 [
   AC_CHECK_DECLS_ONCE([getenv])
diff --git a/src/gl/m4/gnulib-cache.m4 b/src/gl/m4/gnulib-cache.m4
index a23036e..e09c37d 100644
--- a/src/gl/m4/gnulib-cache.m4
+++ b/src/gl/m4/gnulib-cache.m4
@@ -15,13 +15,13 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libgnu --source-base=src/gl 
--m4-base=src/gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux 
--avoid=extensions --avoid=gettext --avoid=gettext-h --avoid=include_next 
--avoid=intprops --avoid=stdarg --avoid=string --avoid=unistd 
--makefile-name=gnulib.mk --libtool --macro-prefix=gl2 --no-vc-files error 
getopt locale progname version-etc
+#   gnulib-tool --import --dir=. --lib=libgnu --source-base=src/gl 
--m4-base=src/gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux 
--avoid=extensions --avoid=gettext --avoid=gettext-h --avoid=include_next 
--avoid=intprops --avoid=stdarg --avoid=string --avoid=unistd 
--makefile-name=gnulib.mk --libtool --macro-prefix=gl2 --no-vc-files error 
getopt-gnu locale progname version-etc
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
 gl_MODULES([
   error
-  getopt
+  getopt-gnu
   locale
   progname
   version-etc
diff --git a/src/gl/m4/gnulib-common.m4 b/src/gl/m4/gnulib-common.m4
index c8fda20..63c6300 100644
--- a/src/gl/m4/gnulib-common.m4
+++ b/src/gl/m4/gnulib-common.m4
@@ -23,14 +23,17 @@ AC_DEFUN([gl_COMMON_BODY], [
 # define __GNUC_STDC_INLINE__ 1
 #endif])
   AH_VERBATIM([unused_parameter],
-[/* Define as a marker that can be attached to function parameter declarations
-   for parameters that are not used.  This helps to reduce warnings, such as
-   from GCC -Wunused-parameter.  */
+[/* Define as a marker that can be attached to declarations that might not
+    be used.  This helps to reduce warnings, such as from
+    GCC -Wunused-parameter.  */
 #if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _UNUSED_PARAMETER_ __attribute__ ((__unused__))
+# define _GL_UNUSED __attribute__ ((__unused__))
 #else
-# define _UNUSED_PARAMETER_
+# define _GL_UNUSED
 #endif
+/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name
+   is a misnomer outside of parameter lists.  */
+#define _UNUSED_PARAMETER_ _GL_UNUSED
 ])
 ])
 
@@ -70,13 +73,13 @@ AC_DEFUN([AC_C_RESTRICT],
    for ac_kw in __restrict __restrict__ _Restrict restrict; do
      AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
       [[typedef int * int_ptr;
-       int foo (int_ptr $ac_kw ip) {
-       return ip[0];
+        int foo (int_ptr $ac_kw ip) {
+        return ip[0];
        }]],
       [[int s[1];
-       int * $ac_kw t = s;
-       t[0] = 0;
-       return foo(t)]])],
+        int * $ac_kw t = s;
+        t[0] = 0;
+        return foo(t)]])],
       [ac_cv_c_restrict=$ac_kw])
      test "$ac_cv_c_restrict" != no && break
    done
diff --git a/src/gl/m4/gnulib-comp.m4 b/src/gl/m4/gnulib-comp.m4
index 62b0f03..1495ef8 100644
--- a/src/gl/m4/gnulib-comp.m4
+++ b/src/gl/m4/gnulib-comp.m4
@@ -43,10 +43,15 @@ AC_DEFUN([gl2_INIT],
   gl_HEADER_ERRNO_H
   gl_ERROR
   m4_ifdef([AM_XGETTEXT_OPTION],
-    [AM_XGETTEXT_OPTION([--flag=error:3:c-format])
-     AM_XGETTEXT_OPTION([--flag=error_at_line:5:c-format])])
-  gl_GETOPT
+    [AM_][XGETTEXT_OPTION([--flag=error:3:c-format])
+     AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])])
+  gl_FUNC_GETOPT_GNU
+  gl_MODULE_INDICATOR([getopt-gnu])
+  gl_FUNC_GETOPT_POSIX
   gl_LOCALE_H
+  AC_CHECK_DECLS([program_invocation_name], [], [], [#include <errno.h>])
+  AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include <errno.h>])
+  gl_STDDEF_H
   gl_FUNC_STRERROR
   gl_STRING_MODULE_INDICATOR([strerror])
   gl_VERSION_ETC
@@ -72,7 +77,7 @@ AC_DEFUN([gl2_INIT],
     if test -n "$gl2_LIBOBJS"; then
       # Remove the extension.
       sed_drop_objext='s/\.o$//;s/\.obj$//'
-      for i in `for i in $gl2_LIBOBJS; do echo "$i"; done | sed 
"$sed_drop_objext" | sort | uniq`; do
+      for i in `for i in $gl2_LIBOBJS; do echo "$i"; done | sed -e 
"$sed_drop_objext" | sort | uniq`; do
         gl2_libobjs="$gl2_libobjs $i.$ac_objext"
         gl2_ltlibobjs="$gl2_ltlibobjs $i.lo"
       done
@@ -111,7 +116,7 @@ AC_DEFUN([gl2_INIT],
     if test -n "$gl2tests_LIBOBJS"; then
       # Remove the extension.
       sed_drop_objext='s/\.o$//;s/\.obj$//'
-      for i in `for i in $gl2tests_LIBOBJS; do echo "$i"; done | sed 
"$sed_drop_objext" | sort | uniq`; do
+      for i in `for i in $gl2tests_LIBOBJS; do echo "$i"; done | sed -e 
"$sed_drop_objext" | sort | uniq`; do
         gl2tests_libobjs="$gl2tests_libobjs $i.$ac_objext"
         gl2tests_ltlibobjs="$gl2tests_ltlibobjs $i.lo"
       done
@@ -178,6 +183,7 @@ AC_DEFUN([gl2tests_LIBSOURCES], [
 # This macro records the list of files which have been installed by
 # gnulib-tool and may be removed by future gnulib-tool invocations.
 AC_DEFUN([gl2_FILE_LIST], [
+  build-aux/arg-nonnull.h
   lib/errno.in.h
   lib/error.c
   lib/error.h
@@ -188,6 +194,7 @@ AC_DEFUN([gl2_FILE_LIST], [
   lib/locale.in.h
   lib/progname.c
   lib/progname.h
+  lib/stddef.in.h
   lib/strerror.c
   lib/version-etc.c
   lib/version-etc.h
@@ -197,6 +204,8 @@ AC_DEFUN([gl2_FILE_LIST], [
   m4/getopt.m4
   m4/gnulib-common.m4
   m4/locale_h.m4
+  m4/stddef_h.m4
   m4/strerror.m4
   m4/version-etc.m4
+  m4/wchar_t.m4
 ])
diff --git a/src/gl/m4/locale_h.m4 b/src/gl/m4/locale_h.m4
index 2bf5abc..35b8b32 100644
--- a/src/gl/m4/locale_h.m4
+++ b/src/gl/m4/locale_h.m4
@@ -1,22 +1,82 @@
-# locale_h.m4 serial 2
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+# locale_h.m4 serial 5
+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.
 
 AC_DEFUN([gl_LOCALE_H],
 [
-  AC_CACHE_CHECK([whether locale.h conforms to POSIX],
-    [gl_cv_header_working_locale_h],
+  dnl Use AC_REQUIRE here, so that the default behavior below is expanded
+  dnl once only, before all statements that occur in other macros.
+  AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
+
+  dnl Persuade glibc <locale.h> to define locale_t.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  dnl If <stddef.h> is replaced, then <locale.h> must also be replaced.
+  AC_REQUIRE([gl_STDDEF_H])
+
+  AC_CACHE_CHECK([whether locale.h conforms to POSIX:2001],
+    [gl_cv_header_locale_h_posix2001],
     [AC_TRY_COMPILE([#include <locale.h>
 int x = LC_MESSAGES;], [],
-       [gl_cv_header_working_locale_h=yes],
-       [gl_cv_header_working_locale_h=no])])
-  if test $gl_cv_header_working_locale_h = yes; then
-    LOCALE_H=
+       [gl_cv_header_locale_h_posix2001=yes],
+       [gl_cv_header_locale_h_posix2001=no])])
+
+  dnl Check for <xlocale.h>.
+  AC_CHECK_HEADERS_ONCE([xlocale.h])
+  if test $ac_cv_header_xlocale_h = yes; then
+    HAVE_XLOCALE_H=1
+    dnl Check whether use of locale_t requires inclusion of <xlocale.h>,
+    dnl e.g. on MacOS X 10.5. If <locale.h> does not define locale_t by
+    dnl itself, we assume that <xlocale.h> will do so.
+    AC_CACHE_CHECK([whether locale.h defines locale_t],
+      [gl_cv_header_locale_has_locale_t],
+      [AC_TRY_COMPILE([#include <locale.h>
+locale_t x;], [],
+         [gl_cv_header_locale_has_locale_t=yes],
+         [gl_cv_header_locale_has_locale_t=no])
+      ])
+    if test $gl_cv_header_locale_has_locale_t = yes; then
+      gl_cv_header_locale_h_needs_xlocale_h=no
+    else
+      gl_cv_header_locale_h_needs_xlocale_h=yes
+    fi
   else
-    gl_CHECK_NEXT_HEADERS([locale.h])
-    LOCALE_H=locale.h
+    HAVE_XLOCALE_H=0
+    gl_cv_header_locale_h_needs_xlocale_h=no
   fi
-  AC_SUBST([LOCALE_H])
+  AC_SUBST([HAVE_XLOCALE_H])
+
+  dnl Execute this unconditionally, because LOCALE_H may be set by other
+  dnl modules, after this code is executed.
+  gl_CHECK_NEXT_HEADERS([locale.h])
+
+  if test -n "$STDDEF_H" \
+     || test $gl_cv_header_locale_h_posix2001 = no \
+     || test $gl_cv_header_locale_h_needs_xlocale_h = yes; then
+    gl_REPLACE_LOCALE_H
+  fi
+])
+
+dnl Unconditionally enables the replacement of <locale.h>.
+AC_DEFUN([gl_REPLACE_LOCALE_H],
+[
+  AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
+  LOCALE_H=locale.h
+])
+
+AC_DEFUN([gl_LOCALE_MODULE_INDICATOR],
+[
+  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+  AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
+  
GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
+])
+
+AC_DEFUN([gl_LOCALE_H_DEFAULTS],
+[
+  GNULIB_DUPLOCALE=0;  AC_SUBST([GNULIB_DUPLOCALE])
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE])
+  LOCALE_H='';         AC_SUBST([LOCALE_H])
 ])
diff --git a/src/gl/m4/stddef_h.m4 b/src/gl/m4/stddef_h.m4
new file mode 100644
index 0000000..682e9c6
--- /dev/null
+++ b/src/gl/m4/stddef_h.m4
@@ -0,0 +1,45 @@
+dnl A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues.
+# stddef_h.m4 serial 1
+dnl Copyright (C) 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_STDDEF_H],
+[
+  AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
+  AC_REQUIRE([gt_TYPE_WCHAR_T])
+  if test $gt_cv_c_wchar_t = no; then
+    HAVE_WCHAR_T=0
+    STDDEF_H=stddef.h
+  fi
+  AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions],
+    [gl_cv_decl_null_works],
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h>
+      int test[2 * (sizeof NULL == sizeof (void *)) -1];
+]])],
+      [gl_cv_decl_null_works=yes],
+      [gl_cv_decl_null_works=no])])
+  if test $gl_cv_decl_null_works = no; then
+    REPLACE_NULL=1
+    STDDEF_H=stddef.h
+  fi
+  if test -n "$STDDEF_H"; then
+    gl_CHECK_NEXT_HEADERS([stddef.h])
+  fi
+])
+
+AC_DEFUN([gl_STDDEF_MODULE_INDICATOR],
+[
+  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+  AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
+  
GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
+])
+
+AC_DEFUN([gl_STDDEF_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  REPLACE_NULL=0;                AC_SUBST([REPLACE_NULL])
+  HAVE_WCHAR_T=1;                AC_SUBST([HAVE_WCHAR_T])
+  STDDEF_H='';                   AC_SUBST([STDDEF_H])
+])
diff --git a/src/gl/m4/version-etc.m4 b/src/gl/m4/version-etc.m4
index 14d6eb6..87389de 100644
--- a/src/gl/m4/version-etc.m4
+++ b/src/gl/m4/version-etc.m4
@@ -11,8 +11,8 @@ m4_define([gl_VERSION_ETC_FLAG],
   AC_ARG_WITH([$1], [AS_HELP_STRING([--with-$1], [$2])],
     [dnl
       case $withval in
-       yes|no) ;;
-       *) AC_DEFINE_UNQUOTED(AS_TR_CPP([PACKAGE_$1]), ["$withval"], [$2]) ;;
+        yes|no) ;;
+        *) AC_DEFINE_UNQUOTED(AS_TR_CPP([PACKAGE_$1]), ["$withval"], [$2]) ;;
       esac
     ])
 ])
@@ -20,11 +20,11 @@ m4_define([gl_VERSION_ETC_FLAG],
 AC_DEFUN([gl_VERSION_ETC],
 [dnl
   gl_VERSION_ETC_FLAG([packager],
-                     [String identifying the packager of this software])
+                      [String identifying the packager of this software])
   gl_VERSION_ETC_FLAG([packager-version],
-                     [Packager-specific version information])
+                      [Packager-specific version information])
   gl_VERSION_ETC_FLAG([packager-bug-reports],
-                     [Packager info for bug reports (URL/e-mail/...)])
+                      [Packager info for bug reports (URL/e-mail/...)])
   if test "X$with_packager" = "X" && \
      test "X$with_packager_version$with_packager_bug_reports" != "X"
   then
diff --git a/gl/m4/wchar_t.m4 b/src/gl/m4/wchar_t.m4
similarity index 100%
copy from gl/m4/wchar_t.m4
copy to src/gl/m4/wchar_t.m4
diff --git a/src/gl/progname.c b/src/gl/progname.c
index 9854b5e..a5e5eaf 100644
--- a/src/gl/progname.c
+++ b/src/gl/progname.c
@@ -1,6 +1,6 @@
 /* Program name management.
    Copyright (C) 2001-2003, 2005-2009 Free Software Foundation, Inc.
-   Written by Bruno Haible <address@hidden>, 2001.
+   Written by Bruno Haible <address@hidden>, 2001.
 
    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,6 +22,9 @@
 #undef ENABLE_RELOCATABLE /* avoid defining set_program_name as a macro */
 #include "progname.h"
 
+#include <errno.h> /* get program_invocation_name declaration */
+#include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 
@@ -29,7 +32,9 @@
    To be initialized by main().  */
 const char *program_name = NULL;
 
-/* Set program_name, based on argv[0].  */
+/* Set program_name, based on argv[0].
+   argv0 must be a string allocated with indefinite extent, and must not be
+   modified after this call.  */
 void
 set_program_name (const char *argv0)
 {
@@ -41,13 +46,30 @@ set_program_name (const char *argv0)
   const char *slash;
   const char *base;
 
+  /* Sanity check.  POSIX requires the invoking process to pass a non-NULL
+     argv[0].  */
+  if (argv0 == NULL)
+    {
+      /* It's a bug in the invoking program.  Help diagnosing it.  */
+      fputs ("A NULL argv[0] was passed through an exec system call.\n",
+             stderr);
+      abort ();
+    }
+
   slash = strrchr (argv0, '/');
   base = (slash != NULL ? slash + 1 : argv0);
   if (base - argv0 >= 7 && strncmp (base - 7, "/.libs/", 7) == 0)
     {
       argv0 = base;
       if (strncmp (base, "lt-", 3) == 0)
-       argv0 = base + 3;
+        {
+          argv0 = base + 3;
+          /* On glibc systems, remove the "lt-" prefix from the variable
+             program_invocation_short_name.  */
+#if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
+          program_invocation_short_name = (char *) argv0;
+#endif
+        }
     }
 
   /* But don't strip off a leading <dirname>/ in general, because when the user
@@ -60,4 +82,11 @@ set_program_name (const char *argv0)
    */
 
   program_name = argv0;
+
+  /* On glibc systems, the error() function comes from libc and uses the
+     variable program_invocation_name, not program_name.  So set this variable
+     as well.  */
+#if HAVE_DECL_PROGRAM_INVOCATION_NAME
+  program_invocation_name = (char *) argv0;
+#endif
 }
diff --git a/src/gl/progname.h b/src/gl/progname.h
index 82615c6..da4ee7e 100644
--- a/src/gl/progname.h
+++ b/src/gl/progname.h
@@ -1,6 +1,6 @@
 /* Program name management.
-   Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc.
-   Written by Bruno Haible <address@hidden>, 2001.
+   Copyright (C) 2001-2004, 2006, 2009 Free Software Foundation, Inc.
+   Written by Bruno Haible <address@hidden>, 2001.
 
    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
@@ -31,7 +31,9 @@ extern "C" {
 /* String containing name the program is called with.  */
 extern const char *program_name;
 
-/* Set program_name, based on argv[0].  */
+/* Set program_name, based on argv[0].
+   argv0 must be a string allocated with indefinite extent, and must not be
+   modified after this call.  */
 extern void set_program_name (const char *argv0);
 
 #if ENABLE_RELOCATABLE
@@ -39,8 +41,8 @@ extern void set_program_name (const char *argv0);
 /* Set program_name, based on argv[0], and original installation prefix and
    directory, for relocatability.  */
 extern void set_program_name_and_installdir (const char *argv0,
-                                            const char *orig_installprefix,
-                                            const char *orig_installdir);
+                                             const char *orig_installprefix,
+                                             const char *orig_installdir);
 #undef set_program_name
 #define set_program_name(ARG0) \
   set_program_name_and_installdir (ARG0, INSTALLPREFIX, INSTALLDIR)
diff --git a/src/gl/stddef.in.h b/src/gl/stddef.in.h
new file mode 100644
index 0000000..aff3b94
--- /dev/null
+++ b/src/gl/stddef.in.h
@@ -0,0 +1,86 @@
+/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
+
+   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, 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 Eric Blake.  */
+
+/*
+ * POSIX 2008 <stddef.h> for platforms that have issues.
+ * <http://www.opengroup.org/susv3xbd/stddef.h.html>
+ */
+
+#if __GNUC__ >= 3
address@hidden@
+#endif
+
+#if defined __need_wchar_t || defined __need_size_t  \
+  || defined __need_ptrdiff_t || defined __need_NULL \
+  || defined __need_wint_t
+/* Special invocation convention inside gcc header files.  In
+   particular, gcc provides a version of <stddef.h> that blindly
+   redefines NULL even when __need_wint_t was defined, even though
+   wint_t is not normally provided by <stddef.h>.  Hence, we must
+   remember if special invocation has ever been used to obtain wint_t,
+   in which case we need to clean up NULL yet again.  */
+
+# if !(defined _GL_STDDEF_H && defined _GL_STDDEF_WINT_T)
+#  ifdef __need_wint_t
+#   undef _GL_STDDEF_H
+#   define _GL_STDDEF_WINT_T
+#  endif
+#  @INCLUDE_NEXT@ @NEXT_STDDEF_H@
+# endif
+
+#else
+/* Normal invocation convention.  */
+
+# ifndef _GL_STDDEF_H
+
+/* The include_next requires a split double-inclusion guard.  */
+
+#  @INCLUDE_NEXT@ @NEXT_STDDEF_H@
+
+#  ifndef _GL_STDDEF_H
+#   define _GL_STDDEF_H
+
+/* On NetBSD 5.0, the definition of NULL lacks proper parentheses.  */
+#if @REPLACE_NULL@
+# undef NULL
+# ifdef __cplusplus
+   /* ISO C++ says that the macro NULL must expand to an integer constant
+      expression, hence '((void *) 0)' is not allowed in C++.  */
+#  if __GNUG__ >= 3
+    /* GNU C++ has a __null macro that behaves like an integer ('int' or
+       'long') but has the same size as a pointer.  Use that, to avoid
+       warnings.  */
+#   define NULL __null
+#  else
+#   define NULL 0L
+#  endif
+# else
+#  define NULL ((void *) 0)
+# endif
+#endif
+
+/* Some platforms lack wchar_t.  */
+#if address@hidden@
+# define wchar_t int
+#endif
+
+#  endif /* _GL_STDDEF_H */
+# endif /* _GL_STDDEF_H */
+#endif /* __need_XXX */
diff --git a/src/gl/strerror.c b/src/gl/strerror.c
index dfe6c25..fa0ed14 100644
--- a/src/gl/strerror.c
+++ b/src/gl/strerror.c
@@ -334,10 +334,10 @@ rpl_strerror (int n)
 
     if (result == NULL || result[0] == '\0')
       {
-       static char const fmt[] = "Unknown error (%d)";
-       static char msg_buf[sizeof fmt + INT_STRLEN_BOUND (n)];
-       sprintf (msg_buf, fmt, n);
-       return msg_buf;
+        static char const fmt[] = "Unknown error (%d)";
+        static char msg_buf[sizeof fmt + INT_STRLEN_BOUND (n)];
+        sprintf (msg_buf, fmt, n);
+        return msg_buf;
       }
 
     return result;
diff --git a/src/gl/version-etc.c b/src/gl/version-etc.c
index a580140..abd5dbd 100644
--- a/src/gl/version-etc.c
+++ b/src/gl/version-etc.c
@@ -32,6 +32,12 @@
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
 
+/* If you use AM_INIT_AUTOMAKE's no-define option,
+   PACKAGE is not defined.  Use PACKAGE_TARNAME instead.  */
+#if ! defined PACKAGE && defined PACKAGE_TARNAME
+# define PACKAGE PACKAGE_TARNAME
+#endif
+
 enum { COPYRIGHT_YEAR = 2009 };
 
 /* The three functions below display the --version information the
@@ -54,9 +60,9 @@ enum { COPYRIGHT_YEAR = 2009 };
    number of elements in the array. */
 void
 version_etc_arn (FILE *stream,
-                const char *command_name, const char *package,
-                const char *version,
-                const char * const * authors, size_t n_authors)
+                 const char *command_name, const char *package,
+                 const char *version,
+                 const char * const * authors, size_t n_authors)
 {
   if (command_name)
     fprintf (stream, "%s (%s) %s\n", command_name, package, version);
@@ -66,7 +72,7 @@ version_etc_arn (FILE *stream,
 #ifdef PACKAGE_PACKAGER
 # ifdef PACKAGE_PACKAGER_VERSION
   fprintf (stream, _("Packaged by %s (%s)\n"), PACKAGE_PACKAGER,
-          PACKAGE_PACKAGER_VERSION);
+           PACKAGE_PACKAGER_VERSION);
 # else
   fprintf (stream, _("Packaged by %s\n"), PACKAGE_PACKAGER);
 # endif
@@ -84,7 +90,7 @@ This is free software: you are free to change and 
redistribute it.\n\
 There is NO WARRANTY, to the extent permitted by law.\n\
 \n\
 "),
-        stream);
+         stream);
 
   switch (n_authors)
     {
@@ -102,66 +108,66 @@ There is NO WARRANTY, to the extent permitted by law.\n\
     case 3:
       /* TRANSLATORS: Each %s denotes an author name.  */
       fprintf (stream, _("Written by %s, %s, and %s.\n"),
-              authors[0], authors[1], authors[2]);
+               authors[0], authors[1], authors[2]);
       break;
     case 4:
       /* TRANSLATORS: Each %s denotes an author name.
-        You can use line breaks, estimating that each author name occupies
-        ca. 16 screen columns and that a screen line has ca. 80 columns.  */
+         You can use line breaks, estimating that each author name occupies
+         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
       fprintf (stream, _("Written by %s, %s, %s,\nand %s.\n"),
-              authors[0], authors[1], authors[2], authors[3]);
+               authors[0], authors[1], authors[2], authors[3]);
       break;
     case 5:
       /* TRANSLATORS: Each %s denotes an author name.
-        You can use line breaks, estimating that each author name occupies
-        ca. 16 screen columns and that a screen line has ca. 80 columns.  */
+         You can use line breaks, estimating that each author name occupies
+         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
       fprintf (stream, _("Written by %s, %s, %s,\n%s, and %s.\n"),
-              authors[0], authors[1], authors[2], authors[3], authors[4]);
+               authors[0], authors[1], authors[2], authors[3], authors[4]);
       break;
     case 6:
       /* TRANSLATORS: Each %s denotes an author name.
-        You can use line breaks, estimating that each author name occupies
-        ca. 16 screen columns and that a screen line has ca. 80 columns.  */
+         You can use line breaks, estimating that each author name occupies
+         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
       fprintf (stream, _("Written by %s, %s, %s,\n%s, %s, and %s.\n"),
-              authors[0], authors[1], authors[2], authors[3], authors[4],
-              authors[5]);
+               authors[0], authors[1], authors[2], authors[3], authors[4],
+               authors[5]);
       break;
     case 7:
       /* TRANSLATORS: Each %s denotes an author name.
-        You can use line breaks, estimating that each author name occupies
-        ca. 16 screen columns and that a screen line has ca. 80 columns.  */
+         You can use line breaks, estimating that each author name occupies
+         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
       fprintf (stream, _("Written by %s, %s, %s,\n%s, %s, %s, and %s.\n"),
-              authors[0], authors[1], authors[2], authors[3], authors[4],
-              authors[5], authors[6]);
+               authors[0], authors[1], authors[2], authors[3], authors[4],
+               authors[5], authors[6]);
       break;
     case 8:
       /* TRANSLATORS: Each %s denotes an author name.
-        You can use line breaks, estimating that each author name occupies
-        ca. 16 screen columns and that a screen line has ca. 80 columns.  */
+         You can use line breaks, estimating that each author name occupies
+         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
       fprintf (stream, _("\
 Written by %s, %s, %s,\n%s, %s, %s, %s,\nand %s.\n"),
-               authors[0], authors[1], authors[2], authors[3], authors[4],
-               authors[5], authors[6], authors[7]);
+                authors[0], authors[1], authors[2], authors[3], authors[4],
+                authors[5], authors[6], authors[7]);
       break;
     case 9:
       /* TRANSLATORS: Each %s denotes an author name.
-        You can use line breaks, estimating that each author name occupies
-        ca. 16 screen columns and that a screen line has ca. 80 columns.  */
+         You can use line breaks, estimating that each author name occupies
+         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
       fprintf (stream, _("\
 Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, and %s.\n"),
-              authors[0], authors[1], authors[2], authors[3], authors[4],
-              authors[5], authors[6], authors[7], authors[8]);
+               authors[0], authors[1], authors[2], authors[3], authors[4],
+               authors[5], authors[6], authors[7], authors[8]);
       break;
     default:
       /* 10 or more authors.  Use an abbreviation, since the human reader
-        will probably not want to read the entire list anyway.  */
+         will probably not want to read the entire list anyway.  */
       /* TRANSLATORS: Each %s denotes an author name.
-        You can use line breaks, estimating that each author name occupies
-        ca. 16 screen columns and that a screen line has ca. 80 columns.  */
+         You can use line breaks, estimating that each author name occupies
+         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
       fprintf (stream, _("\
 Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, %s, and others.\n"),
-               authors[0], authors[1], authors[2], authors[3], authors[4],
-               authors[5], authors[6], authors[7], authors[8]);
+                authors[0], authors[1], authors[2], authors[3], authors[4],
+                authors[5], authors[6], authors[7], authors[8]);
       break;
     }
 }
@@ -172,8 +178,8 @@ Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, %s, and 
others.\n"),
    Author names are given in the NULL-terminated array AUTHORS. */
 void
 version_etc_ar (FILE *stream,
-               const char *command_name, const char *package,
-               const char *version, const char * const * authors)
+                const char *command_name, const char *package,
+                const char *version, const char * const * authors)
 {
   size_t n_authors;
 
@@ -188,19 +194,19 @@ version_etc_ar (FILE *stream,
    Author names are given in the NULL-terminated va_list AUTHORS. */
 void
 version_etc_va (FILE *stream,
-               const char *command_name, const char *package,
-               const char *version, va_list authors)
+                const char *command_name, const char *package,
+                const char *version, va_list authors)
 {
   size_t n_authors;
   const char *authtab[10];
 
   for (n_authors = 0;
        n_authors < 10
-        && (authtab[n_authors] = va_arg (authors, const char *)) != NULL;
+         && (authtab[n_authors] = va_arg (authors, const char *)) != NULL;
        n_authors++)
     ;
   version_etc_arn (stream, command_name, package, version,
-                  authtab, n_authors);
+                   authtab, n_authors);
 }
 
 
@@ -219,8 +225,8 @@ version_etc_va (FILE *stream,
    NULL argument at the end.  */
 void
 version_etc (FILE *stream,
-            const char *command_name, const char *package,
-            const char *version, /* const char *author1, ...*/ ...)
+             const char *command_name, const char *package,
+             const char *version, /* const char *author1, ...*/ ...)
 {
   va_list authors;
 
@@ -236,13 +242,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,
-         PACKAGE_PACKAGER_BUG_REPORTS);
+  printf (_("Report %s bugs to: %s\n"), PACKAGE_PACKAGER,
+          PACKAGE_PACKAGER_BUG_REPORTS);
+#endif
+#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);
 #endif
-  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"),
-        stdout);
+  fputs (_("General help using GNU software: <http://www.gnu.org/gethelp/>\n"),
+         stdout);
 }
diff --git a/src/gl/version-etc.h b/src/gl/version-etc.h
index 8ce02fe..75cd4b8 100644
--- a/src/gl/version-etc.h
+++ b/src/gl/version-etc.h
@@ -50,26 +50,26 @@ extern const char version_etc_copyright[];
 
 /* N_AUTHORS names are supplied in array AUTHORS.  */
 extern void version_etc_arn (FILE *stream,
-                            const char *command_name, const char *package,
-                            const char *version,
-                            const char * const * authors, size_t n_authors);
+                             const char *command_name, const char *package,
+                             const char *version,
+                             const char * const * authors, size_t n_authors);
 
 /* Names are passed in the NULL-terminated array AUTHORS.  */
 extern void version_etc_ar (FILE *stream,
-                           const char *command_name, const char *package,
-                           const char *version, const char * const * authors);
+                            const char *command_name, const char *package,
+                            const char *version, const char * const * authors);
 
 /* Names are passed in the NULL-terminated va_list.  */
 extern void version_etc_va (FILE *stream,
-                           const char *command_name, const char *package,
-                           const char *version, va_list authors);
+                            const char *command_name, const char *package,
+                            const char *version, va_list authors);
 
 /* Names are passed as separate arguments, with an additional
    NULL argument at the end.  */
 extern void version_etc (FILE *stream,
-                        const char *command_name, const char *package,
-                        const char *version,
-                        /* const char *author1, ..., NULL */ ...)
+                         const char *command_name, const char *package,
+                         const char *version,
+                         /* const char *author1, ..., NULL */ ...)
   ATTRIBUTE_SENTINEL;
 
 /* Display the usual `Report bugs to' stanza */


hooks/post-receive
-- 
GNU shishi




reply via email to

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