prelude-manager/master: Update GnuLib code

[email protected] Fri, 29 Jan 2010 18:39:22 +0100 (CET)
Newsgroups gmane.comp.security.ids.prelude.cvs
Message-ID <[email protected]>
commit 67046be2545e559375bdd6c18b496057430273ac
Author: Yoann Vandoorselaere <[email protected]>
Date:   Wed Jan 20 19:17:38 2010 +0100

    Update GnuLib code


========================================

 arg-nonnull.h                        |   26 +
 config.rpath                         |    2 +-
 libmissing/Makefile.am               |  469 ++-
 libmissing/alignof.h                 |    2 +-
 libmissing/alloca.in.h               |    4 +-
 libmissing/arpa_inet.in.h            |   35 +-
 libmissing/asnprintf.c               |    2 +-
 libmissing/errno.in.h                |    2 +-
 libmissing/fcntl.in.h                |  132 +-
 libmissing/float+.h                  |    2 +-
 libmissing/float.in.h                |    2 +-
 libmissing/ftw.c                     |    1 +
 libmissing/gai_strerror.c            |    3 +-
 libmissing/getaddrinfo.c             |  171 +-
 libmissing/getpagesize.c             |   39 -
 libmissing/gettext.h                 |   31 +-
 libmissing/gettimeofday.c            |    5 +-
 libmissing/glthread/cond.c           |  302 +-
 libmissing/glthread/cond.h           |    2 +-
 libmissing/glthread/lock.c           |  436 +-
 libmissing/glthread/lock.h           |    2 +-
 libmissing/glthread/thread.c         |   34 +-
 libmissing/glthread/thread.h         |    2 +-
 libmissing/glthread/threadlib.c      |   20 +-
 libmissing/inet_ntop.c               |   92 +-
 libmissing/m4/00gnulib.m4            |    2 +-
 libmissing/m4/alloca.m4              |    3 +-
 libmissing/m4/arpa_inet_h.m4         |   23 +-
 libmissing/m4/cond.m4                |    2 +-
 libmissing/m4/errno_h.m4             |    2 +-
 libmissing/m4/extensions.m4          |   22 +-
 libmissing/m4/fcntl_h.m4             |   89 +-
 libmissing/m4/float_h.m4             |    2 +-
 libmissing/m4/getaddrinfo.m4         |   25 +-
 libmissing/m4/getpagesize.m4         |   29 -
 libmissing/m4/gettimeofday.m4        |   52 +-
 libmissing/m4/gnulib-cache.m4        |    2 +-
 libmissing/m4/gnulib-common.m4       |   35 +-
 libmissing/m4/gnulib-comp.m4         |   77 +-
 libmissing/m4/gnulib-tool.m4         |    2 +-
 libmissing/m4/hostent.m4             |    2 +-
 libmissing/m4/include_next.m4        |   80 +-
 libmissing/m4/inet_ntop.m4           |   19 +-
 libmissing/m4/intmax_t.m4            |    3 +-
 libmissing/m4/inttypes_h.m4          |    2 +-
 libmissing/m4/lib-ld.m4              |    8 +-
 libmissing/m4/lib-link.m4            |    2 +-
 libmissing/m4/lib-prefix.m4          |    2 +-
 libmissing/m4/lock.m4                |    2 +-
 libmissing/m4/longlong.m4            |   66 +-
 libmissing/m4/memchr.m4              |   10 +-
 libmissing/m4/memset.m4              |    2 +-
 libmissing/m4/mmap-anon.m4           |    2 +-
 libmissing/m4/multiarch.m4           |    2 +-
 libmissing/m4/netdb_h.m4             |    5 +-
 libmissing/m4/netinet_in_h.m4        |    2 +-
 libmissing/m4/onceonly.m4            |    3 +-
 libmissing/m4/pathmax.m4             |    3 +-
 libmissing/m4/printf.m4              |    2 +-
 libmissing/m4/servent.m4             |    2 +-
 libmissing/m4/sigaction.m4           |    2 +-
 libmissing/m4/signal_h.m4            |   11 +-
 libmissing/m4/signalblocking.m4      |    2 +-
 libmissing/m4/size_max.m4            |    2 +-
 libmissing/m4/sleep.m4               |   37 +-
 libmissing/m4/snprintf.m4            |    2 +-
 libmissing/m4/socklen.m4             |   40 +-
 libmissing/m4/sockpfaf.m4            |   20 +-
 libmissing/m4/stdbool.m4             |  140 +-
 libmissing/m4/stdint.m4              |   14 +-
 libmissing/m4/stdint_h.m4            |    2 +-
 libmissing/m4/stdio_h.m4             |  121 +-
 libmissing/m4/strdup.m4              |    2 +-
 libmissing/m4/strerror.m4            |    2 +-
 libmissing/m4/string_h.m4            |   66 +-
 libmissing/m4/strsep.m4              |    3 +-
 libmissing/m4/sys_socket_h.m4        |   20 +-
 libmissing/m4/sys_time_h.m4          |   16 +-
 libmissing/m4/thread.m4              |    2 +-
 libmissing/m4/threadlib.m4           |   15 +-
 libmissing/m4/time_h.m4              |   22 +-
 libmissing/m4/time_r.m4              |   21 +-
 libmissing/m4/unistd_h.m4            |   70 +-
 libmissing/m4/vasnprintf.m4          |    2 +-
 libmissing/m4/vsnprintf.m4           |    2 +-
 libmissing/m4/wchar.m4               |  100 +-
 libmissing/m4/wchar_t.m4             |    2 +-
 libmissing/m4/wint_t.m4              |    2 +-
 libmissing/m4/xsize.m4               |    2 +-
 libmissing/m4/yield.m4               |    2 +-
 libmissing/memchr.c                  |   26 +-
 libmissing/memset.c                  |    2 +-
 libmissing/netdb.in.h                |   88 +-
 libmissing/netinet_in.in.h           |    2 +-
 libmissing/pathmax.h                 |    5 +-
 libmissing/printf-args.c             |  211 +-
 libmissing/printf-args.h             |   55 +-
 libmissing/printf-parse.c            |  940 ++--
 libmissing/printf-parse.h            |   21 +-
 libmissing/sig-handler.h             |    2 +-
 libmissing/sigaction.c               |    4 +-
 libmissing/signal.in.h               |  123 +-
 libmissing/sigprocmask.c             |  158 +-
 libmissing/size_max.h                |    2 +-
 libmissing/snprintf.c                |   12 +-
 libmissing/stdbool.in.h              |    2 +-
 libmissing/stdint.in.h               |   10 +-
 libmissing/stdio-write.c             |   48 +-
 libmissing/stdio.in.h                |  849 ++--
 libmissing/strdup.c                  |    4 +-
 libmissing/string.in.h               |  360 +-
 libmissing/strsep.c                  |    2 +-
 libmissing/sys_socket.in.h           |  209 +-
 libmissing/sys_time.in.h             |    7 +-
 libmissing/tests/Makefile.am         |  223 +-
 libmissing/tests/dummy.c             |    2 +-
 libmissing/tests/glthread/yield.h    |    2 +-
 libmissing/tests/intprops.h          |   50 +-
 libmissing/tests/sleep.c             |   33 +-
 libmissing/tests/strerror.c          |   10 +-
 libmissing/tests/test-alignof.c      |    2 +-
 libmissing/tests/test-alloca-opt.c   |    2 +-
 libmissing/tests/test-arpa_inet.c    |    4 +-
 libmissing/tests/test-cond.c         |    3 +-
 libmissing/tests/test-errno.c        |    2 +-
 libmissing/tests/test-fcntl.c        |  331 ++-
 libmissing/tests/test-getaddrinfo.c  |   83 +-
 libmissing/tests/test-gettimeofday.c |    8 +-
 libmissing/tests/test-lock.c         |   58 +-
 libmissing/tests/test-memchr.c       |   71 +-
 libmissing/tests/test-netdb.c        |    2 +-
 libmissing/tests/test-netinet_in.c   |    4 +-
 libmissing/tests/test-sigaction.c    |   32 +-
 libmissing/tests/test-signal.c       |  105 +-
 libmissing/tests/test-sleep.c        |   45 +-
 libmissing/tests/test-snprintf.c     |   46 +-
 libmissing/tests/test-stdbool.c      |    2 +-
 libmissing/tests/test-stdint.c       |    4 +-
 libmissing/tests/test-stdio.c        |   11 +-
 libmissing/tests/test-strerror.c     |   24 +-
 libmissing/tests/test-string.c       |    4 +-
 libmissing/tests/test-sys_socket.c   |    6 +-
 libmissing/tests/test-sys_time.c     |    4 +-
 libmissing/tests/test-time.c         |   10 +-
 libmissing/tests/test-unistd.c       |    4 +-
 libmissing/tests/test-vasnprintf.c   |   23 +-
 libmissing/tests/test-vsnprintf.c    |   46 +-
 libmissing/tests/test-wchar.c        |   10 +-
 libmissing/tests/verify.h            |    6 +-
 libmissing/tests/zerosize-ptr.h      |   10 +-
 libmissing/time.in.h                 |   34 +-
 libmissing/time_r.c                  |    2 +-
 libmissing/unistd.in.h               |  643 +++-
 libmissing/vasnprintf.c              | 8063 +++++++++++++++++-----------------
 libmissing/vasnprintf.h              |   17 +-
 libmissing/vsnprintf.c               |   12 +-
 libmissing/wchar.in.h                |  121 +-
 libmissing/xsize.h                   |    2 +-
 link-warning.h                       |   29 +-
 src/Makefile.am                      |   10 +-
 warn-on-use.h                        |   75 +
 161 files changed, 9220 insertions(+), 7360 deletions(-)

========================================

diff --git a/arg-nonnull.h b/arg-nonnull.h
new file mode 100644
index 0000000..7e3e2db
--- /dev/null
+++ b/arg-nonnull.h
@@ -0,0 +1,26 @@
+/* A C macro for declaring that specific arguments must not be NULL.
+   Copyright (C) 2009, 2010 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/config.rpath b/config.rpath
index 85c2f20..17298f2 100755
--- a/config.rpath
+++ b/config.rpath
@@ -2,7 +2,7 @@
 # Output a system dependent set of variables, describing how to set the
 # run time search path of shared libraries in an executable.
 #
-#   Copyright 1996-2008 Free Software Foundation, Inc.
+#   Copyright 1996-2010 Free Software Foundation, Inc.
 #   Taken from GNU libtool, 2001
 #   Originally by Gordon Matzigkeit <[email protected]>, 1996
 #
diff --git a/libmissing/Makefile.am b/libmissing/Makefile.am
index 5ee41f8..2c285db 100644
--- a/libmissing/Makefile.am
+++ b/libmissing/Makefile.am
@@ -1,6 +1,6 @@
 ## DO NOT EDIT! GENERATED AUTOMATICALLY!
 ## Process this file with automake to produce Makefile.in.
-# Copyright (C) 2002-2009 Free Software Foundation, Inc.
+# Copyright (C) 2002-2010 Free Software Foundation, Inc.
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
@@ -53,9 +53,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 $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  cat $(srcdir)/alloca.in.h; \
-	} > $@-t
+	} > $@-t && \
 	mv -f $@-t $@
 MOSTLYCLEANFILES += alloca.h alloca.h-t
 
@@ -63,15 +64,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)/./arg-nonnull.h
+	$(AM_V_GEN)rm -f $@-t $@ && \
+	sed -n -e '/GL_ARG_NONNULL/,$$p' \
+	  < $(top_srcdir)/./arg-nonnull.h \
+	  > $@-t && \
+	mv $@-t $@
+MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t
+
+ARG_NONNULL_H=arg-nonnull.h
+
+EXTRA_DIST += $(top_srcdir)/./arg-nonnull.h
+
+## end   gnulib module arg-nonnull
+
 ## begin gnulib module arpa_inet
 
-BUILT_SOURCES += $(ARPA_INET_H)
+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 $@-t $@
+arpa/inet.h: arpa_inet.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+	$(AM_V_at)$(MKDIR_P) arpa
+	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
 	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
@@ -81,9 +106,10 @@ arpa/inet.h: arpa_inet.in.h
 	      -e 's|@''GNULIB_INET_PTON''@|$(GNULIB_INET_PTON)|g' \
 	      -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)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/arpa_inet.in.h; \
-	} > $@-t
+	} > $@-t && \
 	mv $@-t $@
 MOSTLYCLEANFILES += arpa/inet.h arpa/inet.h-t
 MOSTLYCLEANDIRS += arpa
@@ -98,6 +124,15 @@ libmissing_la_SOURCES += glthread/cond.h glthread/cond.c
 
 ## end   gnulib module cond
 
+## begin gnulib module dup2
+
+
+EXTRA_DIST += dup2.c
+
+EXTRA_libmissing_la_SOURCES += dup2.c
+
+## end   gnulib module dup2
+
 ## begin gnulib module errno
 
 BUILT_SOURCES += $(ERRNO_H)
@@ -105,7 +140,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 $@-t $@
+	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
 	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
@@ -117,7 +152,7 @@ errno.h: errno.in.h
 	      -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \
 	      -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \
 	      < $(srcdir)/errno.in.h; \
-	} > $@-t
+	} > $@-t && \
 	mv $@-t $@
 MOSTLYCLEANFILES += errno.h errno.h-t
 
@@ -127,26 +162,43 @@ EXTRA_DIST += errno.in.h
 
 ## begin gnulib module fcntl
 
-BUILT_SOURCES += $(FCNTL_H)
+
+EXTRA_DIST += fcntl.c
+
+EXTRA_libmissing_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 $@-t $@
+fcntl.h: fcntl.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ 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_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/fcntl.in.h; \
-	} > $@-t
+	} > $@-t && \
 	mv $@-t $@
 MOSTLYCLEANFILES += fcntl.h fcntl.h-t
 
 EXTRA_DIST += fcntl.in.h
 
-## end   gnulib module fcntl
+## end   gnulib module fcntl-h
 
 ## begin gnulib module float
 
@@ -155,13 +207,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 $@-t $@
+	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ 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; \
-	} > $@-t
+	} > $@-t && \
 	mv $@-t $@
 MOSTLYCLEANFILES += float.h float.h-t
 
@@ -188,15 +240,6 @@ EXTRA_libmissing_la_SOURCES += gai_strerror.c getaddrinfo.c
 
 ## end   gnulib module getaddrinfo
 
-## begin gnulib module getpagesize
-
-
-EXTRA_DIST += getpagesize.c
-
-EXTRA_libmissing_la_SOURCES += getpagesize.c
-
-## end   gnulib module getpagesize
-
 ## begin gnulib module gettext-h
 
 libmissing_la_SOURCES += gettext.h
@@ -228,14 +271,6 @@ EXTRA_libmissing_la_SOURCES += inet_ntop.c
 
 ## end   gnulib module inet_ntop
 
-## begin gnulib module link-warning
-
-LINK_WARNING_H=$(top_srcdir)/./link-warning.h
-
-EXTRA_DIST += $(top_srcdir)/./link-warning.h
-
-## end   gnulib module link-warning
-
 ## begin gnulib module lock
 
 libmissing_la_SOURCES += glthread/lock.h glthread/lock.c
@@ -266,8 +301,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 $@-t $@
+netdb.h: netdb.in.h $(ARG_NONNULL_H)
+	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
 	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
@@ -279,8 +314,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; \
-	} > $@-t
+	} > $@-t && \
 	mv $@-t $@
 MOSTLYCLEANFILES += netdb.h netdb.h-t
 
@@ -295,15 +331,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 $@-t $@
+	$(AM_V_at)$(MKDIR_P) netinet
+	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ 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; \
-	} > $@-t
+	} > $@-t && \
 	mv $@-t $@
 MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t
 MOSTLYCLEANDIRS += netinet
@@ -334,8 +370,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 $@-t $@
+signal.h: signal.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
 	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
@@ -349,9 +385,10 @@ signal.h: signal.in.h
 	      -e 's|@''HAVE_SIGACTION''@|$(HAVE_SIGACTION)|g' \
 	      -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)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/signal.in.h; \
-	} > $@-t
+	} > $@-t && \
 	mv $@-t $@
 MOSTLYCLEANFILES += signal.h signal.h-t
 
@@ -383,6 +420,15 @@ EXTRA_libmissing_la_SOURCES += snprintf.c
 
 ## end   gnulib module snprintf
 
+## begin gnulib module stat
+
+
+EXTRA_DIST += stat.c
+
+EXTRA_libmissing_la_SOURCES += stat.c
+
+## end   gnulib module stat
+
 ## begin gnulib module stdbool
 
 BUILT_SOURCES += $(STDBOOL_H)
@@ -390,10 +436,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 $@-t $@
+	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \
-	} > $@-t
+	} > $@-t && \
 	mv $@-t $@
 MOSTLYCLEANFILES += stdbool.h stdbool.h-t
 
@@ -401,6 +447,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 $@-t $@ && \
+	{ 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; \
+	} > $@-t && \
+	mv $@-t $@
+MOSTLYCLEANFILES += stddef.h stddef.h-t
+
+EXTRA_DIST += stddef.in.h
+
+## end   gnulib module stddef
+
 ## begin gnulib module stdint
 
 BUILT_SOURCES += $(STDINT_H)
@@ -408,7 +477,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 $@-t $@
+	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
 	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -435,7 +504,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; \
-	} > $@-t
+	} > $@-t && \
 	mv $@-t $@
 MOSTLYCLEANFILES += stdint.h stdint.h-t
 
@@ -449,84 +518,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 $@-t $@
+stdio.h: stdio.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ 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' \
+	      < $(srcdir)/stdio.in.h | \
+	  sed -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 '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
-	      < $(srcdir)/stdio.in.h; \
-	} > $@-t
+	      -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_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
+	} > $@-t && \
 	mv $@-t $@
 MOSTLYCLEANFILES += stdio.h stdio.h-t
 
@@ -551,8 +630,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 $@-t $@
+string.h: string.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
 	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
@@ -590,6 +669,8 @@ string.h: string.in.h
 	      -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \
 	      -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \
 	      -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \
+	      < $(srcdir)/string.in.h | \
+	  sed -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
 	      -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
 	      -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
 	      -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
@@ -598,7 +679,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' \
@@ -614,10 +694,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 '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+	      -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \
+	      -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \
+	      -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
 	      < $(srcdir)/string.in.h; \
-	} > $@-t
+	} > $@-t && \
 	mv $@-t $@
 MOSTLYCLEANFILES += string.h string.h-t
 
@@ -636,12 +720,13 @@ EXTRA_libmissing_la_SOURCES += strsep.c
 
 ## begin gnulib module sys_socket
 
-BUILT_SOURCES += $(SYS_SOCKET_H)
+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 $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+	$(AM_V_at)$(MKDIR_P) sys
+	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
 	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
@@ -662,13 +747,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 '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+	      -e 's|@''HAVE_ACCEPT4''@|$(HAVE_ACCEPT4)|g' \
+	      -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/sys_socket.in.h; \
-	} > $@-t
+	} > $@-t && \
 	mv -f $@-t $@
 MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t
 MOSTLYCLEANDIRS += sys
@@ -677,15 +765,72 @@ EXTRA_DIST += sys_socket.in.h
 
 ## end   gnulib module sys_socket
 
+## 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 $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+	$(AM_V_at)$(MKDIR_P) sys
+	$(AM_V_GEN)rm -f $@-t $@ && \
+	{ 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_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
+	      < $(srcdir)/sys_stat.in.h; \
+	} > $@-t && \
+	mv $@-t $@
+MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t
+MOSTLYCLEANDIRS += sys
+
+EXTRA_DIST += sys_stat.in.h
+
+## end   gnulib module sys_stat
+
 ## begin gnulib module sys_time
 
 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 $@-t $@
+sys/time.h: sys_time.in.h $(ARG_NONNULL_H)
+	$(AM_V_at)$(MKDIR_P) sys
+	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ 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' \
@@ -693,8 +838,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; \
-	} > $@-t
+	} > $@-t && \
 	mv $@-t $@
 MOSTLYCLEANFILES += sys/time.h sys/time.h-t
 
@@ -722,20 +868,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 $@-t $@
+time.h: time.in.h $(ARG_NONNULL_H)
+	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ 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; \
-	} > $@-t
+	} > $@-t && \
 	mv $@-t $@
 MOSTLYCLEANFILES += time.h time.h-t
 
@@ -758,8 +906,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 $@-t $@
+unistd.h: unistd.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
 	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -768,53 +916,100 @@ 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''@|$(GNULIB_GETLOGIN)|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' \
+	      < $(srcdir)/unistd.in.h | \
+	  sed -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_GETLOGIN''@|$(HAVE_GETLOGIN)|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 '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
-	      < $(srcdir)/unistd.in.h; \
-	} > $@-t
+	      -e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \
+	      -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
+	} > $@-t && \
 	mv $@-t $@
 MOSTLYCLEANFILES += unistd.h unistd.h-t
 
@@ -840,14 +1035,33 @@ EXTRA_libmissing_la_SOURCES += vsnprintf.c
 
 ## end   gnulib module vsnprintf
 
+## begin gnulib module warn-on-use
+
+BUILT_SOURCES += warn-on-use.h
+# The warn-on-use.h that gets inserted into generated .h files is the same as
+# build-aux/warn-on-use.h, except that it has the copyright header cut off.
+warn-on-use.h: $(top_srcdir)/./warn-on-use.h
+	$(AM_V_GEN)rm -f $@-t $@ && \
+	sed -n -e '/^.ifndef/,$$p' \
+	  < $(top_srcdir)/./warn-on-use.h \
+	  > $@-t && \
+	mv $@-t $@
+MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t
+
+WARN_ON_USE_H=warn-on-use.h
+
+EXTRA_DIST += $(top_srcdir)/./warn-on-use.h
+
+## end   gnulib module warn-on-use
+
 ## begin gnulib module wchar
 
-BUILT_SOURCES += $(WCHAR_H)
+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 $@-t $@
+wchar.h: wchar.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
 	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
@@ -888,9 +1102,10 @@ wchar.h: wchar.in.h
 	      -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)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	    < $(srcdir)/wchar.in.h; \
-	} > $@-t
+	} > $@-t && \
 	mv $@-t $@
 MOSTLYCLEANFILES += wchar.h wchar.h-t
 
diff --git a/libmissing/alignof.h b/libmissing/alignof.h
index 28ce79c..13687ab 100644
--- a/libmissing/alignof.h
+++ b/libmissing/alignof.h
@@ -1,5 +1,5 @@
 /* Determine alignment of types.
-   Copyright (C) 2003-2004, 2006, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2003-2004, 2006, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/libmissing/alloca.in.h b/libmissing/alloca.in.h
index 3d4f88b..ee7aa9a 100644
--- a/libmissing/alloca.in.h
+++ b/libmissing/alloca.in.h
@@ -1,7 +1,7 @@
 /* Memory allocation on the stack.
 
-   Copyright (C) 1995, 1999, 2001-2004, 2006-2008 Free Software
-   Foundation, Inc.
+   Copyright (C) 1995, 1999, 2001-2004, 2006-2010 Free Software Foundation,
+   Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU Lesser General Public License as published
diff --git a/libmissing/arpa_inet.in.h b/libmissing/arpa_inet.in.h
index 85ea0d0..8e6c6c5 100644
--- a/libmissing/arpa_inet.in.h
+++ b/libmissing/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-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser 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@
 
@@ -36,7 +39,9 @@
 #ifndef _GL_ARPA_INET_H
 #define _GL_ARPA_INET_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 #ifdef __cplusplus
 extern "C" {
@@ -60,26 +65,28 @@ 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
-# define inet_ntop(af,src,dst,cnt) \
-    (GL_LINK_WARNING ("inet_ntop is unportable - " \
-                      "use gnulib module inet_ntop for portability"), \
-     inet_ntop (af, src, dst, cnt))
+# if HAVE_RAW_DECL_INET_NTOP
+_GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - "
+                 "use gnulib module inet_ntop for portability");
+# endif
 #endif
 
 #if @GNULIB_INET_PTON@
 # if !@HAVE_DECL_INET_PTON@
-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"), \
-   inet_pton (af, src, dst))
+# if HAVE_RAW_DECL_INET_PTON
+_GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - "
+                 "use gnulib module inet_pton for portability");
+# endif
 #endif
 
 #ifdef __cplusplus
diff --git a/libmissing/asnprintf.c b/libmissing/asnprintf.c
index 3b374a2..bc5a8af 100644
--- a/libmissing/asnprintf.c
+++ b/libmissing/asnprintf.c
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2006, 2009, 2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/libmissing/errno.in.h b/libmissing/errno.in.h
index a9b81d5..0e6fb7f 100644
--- a/libmissing/errno.in.h
+++ b/libmissing/errno.in.h
@@ -1,6 +1,6 @@
 /* A POSIX-like <errno.h>.
 
-   Copyright (C) 2008-2009 Free Software Foundation, Inc.
+   Copyright (C) 2008-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/libmissing/fcntl.in.h b/libmissing/fcntl.in.h
index 09163df..3bbee7c 100644
--- a/libmissing/fcntl.in.h
+++ b/libmissing/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-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -25,8 +25,9 @@
 /* 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>
+#endif
 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
 
 #else
@@ -35,14 +36,24 @@
 #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>
+#endif
 /* The include_next requires a split double-inclusion guard.  */
 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
 
 #ifndef _GL_FCNTL_H
 #define _GL_FCNTL_H
 
+#ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems.  */
+# include <unistd.h>
+#endif
+
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 
 /* Declare overridden functions.  */
 
@@ -50,23 +61,80 @@
 extern "C" {
 #endif
 
+#if @GNULIB_FCNTL@
+# if @REPLACE_FCNTL@
+#  undef fcntl
+#  define fcntl rpl_fcntl
+# endif
+# if !@HAVE_FCNTL@ || @REPLACE_FCNTL@
+extern int fcntl (int fd, int action, ...);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fcntl
+# if HAVE_RAW_DECL_FCNTL
+_GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - "
+                 "use gnulib module fcntl for portability");
+# endif
+#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
+/* Assume open is always declared.  */
+_GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
+                 "use gnulib module open for portability");
 #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 !@HAVE_OPENAT@ || @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
+# if HAVE_RAW_DECL_OPENAT
+_GL_WARN_ON_USE (openat, "openat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #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 +143,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 +193,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 +216,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/libmissing/float+.h b/libmissing/float+.h
index 2288e3d..956eb28 100644
--- a/libmissing/float+.h
+++ b/libmissing/float+.h
@@ -1,5 +1,5 @@
 /* Supplemental information about the floating-point formats.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
    Written by Bruno Haible <[email protected]>, 2007.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/libmissing/float.in.h b/libmissing/float.in.h
index 63d55f8..ad99af3 100644
--- a/libmissing/float.in.h
+++ b/libmissing/float.in.h
@@ -1,6 +1,6 @@
 /* A correct <float.h>.
 
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/libmissing/ftw.c b/libmissing/ftw.c
index 4b86fb3..3736aaf 100644
--- a/libmissing/ftw.c
+++ b/libmissing/ftw.c
@@ -24,6 +24,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
+#include <sys/stat.h>
 #include <dirent.h>
 #include <errno.h>
 
diff --git a/libmissing/gai_strerror.c b/libmissing/gai_strerror.c
index ab81d08..21e8076 100644
--- a/libmissing/gai_strerror.c
+++ b/libmissing/gai_strerror.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006, 2008, 2009, 2010 Free
+   Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Philip Blundell <[email protected]>, 1997.
 
diff --git a/libmissing/getaddrinfo.c b/libmissing/getaddrinfo.c
index 45366a5..475eaa0 100644
--- a/libmissing/getaddrinfo.c
+++ b/libmissing/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-2010 Free Software Foundation, Inc.
    Contributed by Simon Josefsson <[email protected]>.
 
    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/libmissing/getpagesize.c b/libmissing/getpagesize.c
deleted file mode 100644
index 82238df..0000000
--- a/libmissing/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 Lesser 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 Lesser 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/libmissing/gettext.h b/libmissing/gettext.h
index 72c8727..987009f 100644
--- a/libmissing/gettext.h
+++ b/libmissing/gettext.h
@@ -1,5 +1,6 @@
 /* Convenience header for conditional use of GNU <libintl.h>.
-   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2010 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -140,8 +141,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 +160,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);
@@ -199,8 +200,8 @@ inline
 #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;
@@ -222,10 +223,10 @@ dcpgettext_expr (const char *domain,
       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;
 }
@@ -244,9 +245,9 @@ inline
 #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;
@@ -268,10 +269,10 @@ dcnpgettext_expr (const char *domain,
       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/libmissing/gettimeofday.c b/libmissing/gettimeofday.c
index f90fc85..87821ee 100644
--- a/libmissing/gettimeofday.c
+++ b/libmissing/gettimeofday.c
@@ -1,7 +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
-   Foundation, Inc.
+   Copyright (C) 2001-2003, 2005-2007, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -111,7 +110,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/libmissing/glthread/cond.c b/libmissing/glthread/cond.c
index e5d2460..564901e 100644
--- a/libmissing/glthread/cond.c
+++ b/libmissing/glthread/cond.c
@@ -1,5 +1,5 @@
 /* Condition variables for multithreading.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -30,8 +30,8 @@
 
 int
 glthread_cond_timedwait_multithreaded (gl_cond_t *cond,
-				       gl_lock_t *lock,
-				       struct timespec *abstime)
+                                       gl_lock_t *lock,
+                                       struct timespec *abstime)
 {
   int ret, status;
   pth_event_t ev;
@@ -58,8 +58,8 @@ glthread_cond_timedwait_multithreaded (gl_cond_t *cond,
 
 int
 glthread_cond_timedwait_multithreaded (gl_cond_t *cond,
-				       gl_lock_t *lock,
-				       struct timespec *abstime)
+                                       gl_lock_t *lock,
+                                       struct timespec *abstime)
 {
   int ret;
 
@@ -160,7 +160,7 @@ gl_waitqueue_notify_first (gl_waitqueue_t *wq)
   if (wq->wq_list.wql_next != &wq->wq_list)
     {
       struct gl_waitqueue_element *elt =
-	(struct gl_waitqueue_element *) wq->wq_list.wql_next;
+        (struct gl_waitqueue_element *) wq->wq_list.wql_next;
       struct gl_waitqueue_link *prev;
       struct gl_waitqueue_link *next;
 
@@ -174,7 +174,7 @@ gl_waitqueue_notify_first (gl_waitqueue_t *wq)
 
       SetEvent (elt->event);
       /* After the SetEvent, this thread cannot access *elt any more, because
-	 the woken-up thread will quickly call  free (elt).  */
+         the woken-up thread will quickly call  free (elt).  */
     }
 }
 
@@ -200,7 +200,7 @@ gl_waitqueue_notify_all (gl_waitqueue_t *wq)
 
       SetEvent (elt->event);
       /* After the SetEvent, this thread cannot access *elt any more, because
-	 the woken-up thread will quickly call  free (elt).  */
+         the woken-up thread will quickly call  free (elt).  */
 
       l = next;
     }
@@ -225,14 +225,14 @@ glthread_cond_wait_func (gl_cond_t *cond, gl_lock_t *lock)
   if (!cond->guard.done)
     {
       if (InterlockedIncrement (&cond->guard.started) == 0)
-	/* This thread is the first one to need this condition variable.
-	   Initialize it.  */
-	glthread_cond_init (cond);
+        /* This thread is the first one to need this condition variable.
+           Initialize it.  */
+        glthread_cond_init (cond);
       else
-	/* Yield the CPU while waiting for another thread to finish
-	   initializing this condition variable.  */
-	while (!cond->guard.done)
-	  Sleep (0);
+        /* Yield the CPU while waiting for another thread to finish
+           initializing this condition variable.  */
+        while (!cond->guard.done)
+          Sleep (0);
     }
 
   EnterCriticalSection (&cond->lock);
@@ -241,43 +241,43 @@ glthread_cond_wait_func (gl_cond_t *cond, gl_lock_t *lock)
     LeaveCriticalSection (&cond->lock);
     if (elt == NULL)
       {
-	/* Allocation failure.  Weird.  */
-	return EAGAIN;
+        /* Allocation failure.  Weird.  */
+        return EAGAIN;
       }
     else
       {
-	HANDLE event = elt->event;
-	int err;
-	DWORD result;
-
-	/* Now release the lock and let any other thread take it.  */
-	err = glthread_lock_unlock (lock);
-	if (err != 0)
-	  {
-	    EnterCriticalSection (&cond->lock);
-	    gl_waitqueue_remove (&cond->waiters, elt);
-	    LeaveCriticalSection (&cond->lock);
-	    CloseHandle (event);
-	    free (elt);
-	    return err;
-	  }
-	/* POSIX says:
-	    "If another thread is able to acquire the mutex after the
-	     about-to-block thread has released it, then a subsequent call to
-	     pthread_cond_broadcast() or pthread_cond_signal() in that thread
-	     shall behave as if it were issued after the about-to-block thread
-	     has blocked."
-	   This is fulfilled here, because the thread signalling is done
-	   through SetEvent, not PulseEvent.  */
-	/* Wait until another thread signals this event.  */
-	result = WaitForSingleObject (event, INFINITE);
-	if (result == WAIT_FAILED || result == WAIT_TIMEOUT)
-	  abort ();
-	CloseHandle (event);
-	free (elt);
-	/* The thread which signalled the event already did the bookkeeping:
-	   removed us from the waiters.  */
-	return glthread_lock_lock (lock);
+        HANDLE event = elt->event;
+        int err;
+        DWORD result;
+
+        /* Now release the lock and let any other thread take it.  */
+        err = glthread_lock_unlock (lock);
+        if (err != 0)
+          {
+            EnterCriticalSection (&cond->lock);
+            gl_waitqueue_remove (&cond->waiters, elt);
+            LeaveCriticalSection (&cond->lock);
+            CloseHandle (event);
+            free (elt);
+            return err;
+          }
+        /* POSIX says:
+            "If another thread is able to acquire the mutex after the
+             about-to-block thread has released it, then a subsequent call to
+             pthread_cond_broadcast() or pthread_cond_signal() in that thread
+             shall behave as if it were issued after the about-to-block thread
+             has blocked."
+           This is fulfilled here, because the thread signalling is done
+           through SetEvent, not PulseEvent.  */
+        /* Wait until another thread signals this event.  */
+        result = WaitForSingleObject (event, INFINITE);
+        if (result == WAIT_FAILED || result == WAIT_TIMEOUT)
+          abort ();
+        CloseHandle (event);
+        free (elt);
+        /* The thread which signalled the event already did the bookkeeping:
+           removed us from the waiters.  */
+        return glthread_lock_lock (lock);
       }
   }
 }
@@ -290,20 +290,20 @@ glthread_cond_timedwait_func (gl_cond_t *cond, gl_lock_t *lock, struct timespec
   gettimeofday (&currtime, NULL);
   if (currtime.tv_sec > abstime->tv_sec
       || (currtime.tv_sec == abstime->tv_sec
-	  && currtime.tv_usec * 1000 >= abstime->tv_nsec))
+          && currtime.tv_usec * 1000 >= abstime->tv_nsec))
     return ETIMEDOUT;
 
   if (!cond->guard.done)
     {
       if (InterlockedIncrement (&cond->guard.started) == 0)
-	/* This thread is the first one to need this condition variable.
-	   Initialize it.  */
-	glthread_cond_init (cond);
+        /* This thread is the first one to need this condition variable.
+           Initialize it.  */
+        glthread_cond_init (cond);
       else
-	/* Yield the CPU while waiting for another thread to finish
-	   initializing this condition variable.  */
-	while (!cond->guard.done)
-	  Sleep (0);
+        /* Yield the CPU while waiting for another thread to finish
+           initializing this condition variable.  */
+        while (!cond->guard.done)
+          Sleep (0);
     }
 
   EnterCriticalSection (&cond->lock);
@@ -312,103 +312,103 @@ glthread_cond_timedwait_func (gl_cond_t *cond, gl_lock_t *lock, struct timespec
     LeaveCriticalSection (&cond->lock);
     if (elt == NULL)
       {
-	/* Allocation failure.  Weird.  */
-	return EAGAIN;
+        /* Allocation failure.  Weird.  */
+        return EAGAIN;
       }
     else
       {
-	HANDLE event = elt->event;
-	int err;
-	DWORD timeout;
-	DWORD result;
-
-	/* Now release the lock and let any other thread take it.  */
-	err = glthread_lock_unlock (lock);
-	if (err != 0)
-	  {
-	    EnterCriticalSection (&cond->lock);
-	    gl_waitqueue_remove (&cond->waiters, elt);
-	    LeaveCriticalSection (&cond->lock);
-	    CloseHandle (event);
-	    free (elt);
-	    return err;
-	  }
-	/* POSIX says:
-	    "If another thread is able to acquire the mutex after the
-	     about-to-block thread has released it, then a subsequent call to
-	     pthread_cond_broadcast() or pthread_cond_signal() in that thread
-	     shall behave as if it were issued after the about-to-block thread
-	     has blocked."
-	   This is fulfilled here, because the thread signalling is done
-	   through SetEvent, not PulseEvent.  */
-	/* Wait until another thread signals this event or until the abstime
-	   passes.  */
-	gettimeofday (&currtime, NULL);
-	if (currtime.tv_sec > abstime->tv_sec)
-	  timeout = 0;
-	else
-	  {
-	    unsigned long seconds = abstime->tv_sec - currtime.tv_sec;
-	    timeout = seconds * 1000;
-	    if (timeout / 1000 != seconds) /* overflow? */
-	      timeout = INFINITE;
-	    else
-	      {
-		long milliseconds =
-		  abstime->tv_nsec / 1000000 - currtime.tv_usec / 1000;
-		if (milliseconds >= 0)
-		  {
-		    timeout += milliseconds;
-		    if (timeout < milliseconds) /* overflow? */
-		      timeout = INFINITE;
-		  }
-		else
-		  {
-		    if (timeout >= - milliseconds)
-		      timeout -= (- milliseconds);
-		    else
-		      timeout = 0;
-		  }
-	      }
-	  }
-	result = WaitForSingleObject (event, timeout);
-	if (result == WAIT_FAILED)
-	  abort ();
-	if (result == WAIT_TIMEOUT)
-	  {
-	    EnterCriticalSection (&cond->lock);
-	    if (gl_waitqueue_remove (&cond->waiters, elt))
-	      {
-		/* The event was not signaled between the WaitForSingleObject
-		   call and the EnterCriticalSection call.  */
-		if (!(WaitForSingleObject (event, 0) == WAIT_TIMEOUT))
-		  abort ();
-	      }
-	    else
-	      {
-		/* The event was signaled between the WaitForSingleObject
-		   call and the EnterCriticalSection call.  */
-		if (!(WaitForSingleObject (event, 0) == WAIT_OBJECT_0))
-		  abort ();
-		/* Produce the right return value.  */
-		result = WAIT_OBJECT_0;
-	      }
-	    LeaveCriticalSection (&cond->lock);
-	  }
-	else
-	  {
-	    /* The thread which signalled the event already did the
-	       bookkeeping: removed us from the waiters.  */
-	  }
-	CloseHandle (event);
-	free (elt);
-	/* Take the lock again.  It does not matter whether this is done
-	   before or after the bookkeeping for WAIT_TIMEOUT.  */
-	err = glthread_lock_lock (lock);
-	return (err ? err :
-		result == WAIT_OBJECT_0 ? 0 :
-		result == WAIT_TIMEOUT ? ETIMEDOUT :
-		/* WAIT_FAILED shouldn't happen */ EAGAIN);
+        HANDLE event = elt->event;
+        int err;
+        DWORD timeout;
+        DWORD result;
+
+        /* Now release the lock and let any other thread take it.  */
+        err = glthread_lock_unlock (lock);
+        if (err != 0)
+          {
+            EnterCriticalSection (&cond->lock);
+            gl_waitqueue_remove (&cond->waiters, elt);
+            LeaveCriticalSection (&cond->lock);
+            CloseHandle (event);
+            free (elt);
+            return err;
+          }
+        /* POSIX says:
+            "If another thread is able to acquire the mutex after the
+             about-to-block thread has released it, then a subsequent call to
+             pthread_cond_broadcast() or pthread_cond_signal() in that thread
+             shall behave as if it were issued after the about-to-block thread
+             has blocked."
+           This is fulfilled here, because the thread signalling is done
+           through SetEvent, not PulseEvent.  */
+        /* Wait until another thread signals this event or until the abstime
+           passes.  */
+        gettimeofday (&currtime, NULL);
+        if (currtime.tv_sec > abstime->tv_sec)
+          timeout = 0;
+        else
+          {
+            unsigned long seconds = abstime->tv_sec - currtime.tv_sec;
+            timeout = seconds * 1000;
+            if (timeout / 1000 != seconds) /* overflow? */
+              timeout = INFINITE;
+            else
+              {
+                long milliseconds =
+                  abstime->tv_nsec / 1000000 - currtime.tv_usec / 1000;
+                if (milliseconds >= 0)
+                  {
+                    timeout += milliseconds;
+                    if (timeout < milliseconds) /* overflow? */
+                      timeout = INFINITE;
+                  }
+                else
+                  {
+                    if (timeout >= - milliseconds)
+                      timeout -= (- milliseconds);
+                    else
+                      timeout = 0;
+                  }
+              }
+          }
+        result = WaitForSingleObject (event, timeout);
+        if (result == WAIT_FAILED)
+          abort ();
+        if (result == WAIT_TIMEOUT)
+          {
+            EnterCriticalSection (&cond->lock);
+            if (gl_waitqueue_remove (&cond->waiters, elt))
+              {
+                /* The event was not signaled between the WaitForSingleObject
+                   call and the EnterCriticalSection call.  */
+                if (!(WaitForSingleObject (event, 0) == WAIT_TIMEOUT))
+                  abort ();
+              }
+            else
+              {
+                /* The event was signaled between the WaitForSingleObject
+                   call and the EnterCriticalSection call.  */
+                if (!(WaitForSingleObject (event, 0) == WAIT_OBJECT_0))
+                  abort ();
+                /* Produce the right return value.  */
+                result = WAIT_OBJECT_0;
+              }
+            LeaveCriticalSection (&cond->lock);
+          }
+        else
+          {
+            /* The thread which signalled the event already did the
+               bookkeeping: removed us from the waiters.  */
+          }
+        CloseHandle (event);
+        free (elt);
+        /* Take the lock again.  It does not matter whether this is done
+           before or after the bookkeeping for WAIT_TIMEOUT.  */
+        err = glthread_lock_lock (lock);
+        return (err ? err :
+                result == WAIT_OBJECT_0 ? 0 :
+                result == WAIT_TIMEOUT ? ETIMEDOUT :
+                /* WAIT_FAILED shouldn't happen */ EAGAIN);
       }
   }
 }
diff --git a/libmissing/glthread/cond.h b/libmissing/glthread/cond.h
index efc6c6f..b9d4cc1 100644
--- a/libmissing/glthread/cond.h
+++ b/libmissing/glthread/cond.h
@@ -1,5 +1,5 @@
 /* Condition variables for multithreading.
-   Copyright (C) 2005-2008 Free Software Foundation, Inc.
+   Copyright (C) 2005-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/libmissing/glthread/lock.c b/libmissing/glthread/lock.c
index a916316..2f4de9f 100644
--- a/libmissing/glthread/lock.c
+++ b/libmissing/glthread/lock.c
@@ -1,5 +1,5 @@
 /* Locking in multithreaded situations.
-   Copyright (C) 2005-2008 Free Software Foundation, Inc.
+   Copyright (C) 2005-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -56,19 +56,19 @@ glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock)
 
       err = pthread_mutex_lock (&lock->guard);
       if (err != 0)
-	return err;
+        return err;
       if (!lock->initialized)
-	{
-	  err = glthread_rwlock_init_multithreaded (lock);
-	  if (err != 0)
-	    {
-	      pthread_mutex_unlock (&lock->guard);
-	      return err;
-	    }
-	}
+        {
+          err = glthread_rwlock_init_multithreaded (lock);
+          if (err != 0)
+            {
+              pthread_mutex_unlock (&lock->guard);
+              return err;
+            }
+        }
       err = pthread_mutex_unlock (&lock->guard);
       if (err != 0)
-	return err;
+        return err;
     }
   return pthread_rwlock_rdlock (&lock->rwlock);
 }
@@ -82,19 +82,19 @@ glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock)
 
       err = pthread_mutex_lock (&lock->guard);
       if (err != 0)
-	return err;
+        return err;
       if (!lock->initialized)
-	{
-	  err = glthread_rwlock_init_multithreaded (lock);
-	  if (err != 0)
-	    {
-	      pthread_mutex_unlock (&lock->guard);
-	      return err;
-	    }
-	}
+        {
+          err = glthread_rwlock_init_multithreaded (lock);
+          if (err != 0)
+            {
+              pthread_mutex_unlock (&lock->guard);
+              return err;
+            }
+        }
       err = pthread_mutex_unlock (&lock->guard);
       if (err != 0)
-	return err;
+        return err;
     }
   return pthread_rwlock_wrlock (&lock->rwlock);
 }
@@ -161,13 +161,13 @@ glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock)
   while (!(lock->runcount + 1 > 0 && lock->waiting_writers_count == 0))
     {
       /* This thread has to wait for a while.  Enqueue it among the
-	 waiting_readers.  */
+         waiting_readers.  */
       err = pthread_cond_wait (&lock->waiting_readers, &lock->lock);
       if (err != 0)
-	{
-	  pthread_mutex_unlock (&lock->lock);
-	  return err;
-	}
+        {
+          pthread_mutex_unlock (&lock->lock);
+          return err;
+        }
     }
   lock->runcount++;
   return pthread_mutex_unlock (&lock->lock);
@@ -185,15 +185,15 @@ glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock)
   while (!(lock->runcount == 0))
     {
       /* This thread has to wait for a while.  Enqueue it among the
-	 waiting_writers.  */
+         waiting_writers.  */
       lock->waiting_writers_count++;
       err = pthread_cond_wait (&lock->waiting_writers, &lock->lock);
       if (err != 0)
-	{
-	  lock->waiting_writers_count--;
-	  pthread_mutex_unlock (&lock->lock);
-	  return err;
-	}
+        {
+          lock->waiting_writers_count--;
+          pthread_mutex_unlock (&lock->lock);
+          return err;
+        }
       lock->waiting_writers_count--;
     }
   lock->runcount--; /* runcount becomes -1 */
@@ -212,46 +212,46 @@ glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock)
     {
       /* Drop a writer lock.  */
       if (!(lock->runcount == -1))
-	{
-	  pthread_mutex_unlock (&lock->lock);
-	  return EINVAL;
-	}
+        {
+          pthread_mutex_unlock (&lock->lock);
+          return EINVAL;
+        }
       lock->runcount = 0;
     }
   else
     {
       /* Drop a reader lock.  */
       if (!(lock->runcount > 0))
-	{
-	  pthread_mutex_unlock (&lock->lock);
-	  return EINVAL;
-	}
+        {
+          pthread_mutex_unlock (&lock->lock);
+          return EINVAL;
+        }
       lock->runcount--;
     }
   if (lock->runcount == 0)
     {
       /* POSIX recommends that "write locks shall take precedence over read
-	 locks", to avoid "writer starvation".  */
+         locks", to avoid "writer starvation".  */
       if (lock->waiting_writers_count > 0)
-	{
-	  /* Wake up one of the waiting writers.  */
-	  err = pthread_cond_signal (&lock->waiting_writers);
-	  if (err != 0)
-	    {
-	      pthread_mutex_unlock (&lock->lock);
-	      return err;
-	    }
-	}
+        {
+          /* Wake up one of the waiting writers.  */
+          err = pthread_cond_signal (&lock->waiting_writers);
+          if (err != 0)
+            {
+              pthread_mutex_unlock (&lock->lock);
+              return err;
+            }
+        }
       else
-	{
-	  /* Wake up all waiting readers.  */
-	  err = pthread_cond_broadcast (&lock->waiting_readers);
-	  if (err != 0)
-	    {
-	      pthread_mutex_unlock (&lock->lock);
-	      return err;
-	    }
-	}
+        {
+          /* Wake up all waiting readers.  */
+          err = pthread_cond_broadcast (&lock->waiting_readers);
+          if (err != 0)
+            {
+              pthread_mutex_unlock (&lock->lock);
+              return err;
+            }
+        }
     }
   return pthread_mutex_unlock (&lock->lock);
 }
@@ -347,19 +347,19 @@ glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock)
 
       err = pthread_mutex_lock (&lock->guard);
       if (err != 0)
-	return err;
+        return err;
       if (!lock->initialized)
-	{
-	  err = glthread_recursive_lock_init_multithreaded (lock);
-	  if (err != 0)
-	    {
-	      pthread_mutex_unlock (&lock->guard);
-	      return err;
-	    }
-	}
+        {
+          err = glthread_recursive_lock_init_multithreaded (lock);
+          if (err != 0)
+            {
+              pthread_mutex_unlock (&lock->guard);
+              return err;
+            }
+        }
       err = pthread_mutex_unlock (&lock->guard);
       if (err != 0)
-	return err;
+        return err;
     }
   return pthread_mutex_lock (&lock->recmutex);
 }
@@ -413,7 +413,7 @@ glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock)
 
       err = pthread_mutex_lock (&lock->mutex);
       if (err != 0)
-	return err;
+        return err;
       lock->owner = self;
     }
   if (++(lock->depth) == 0) /* wraparound? */
@@ -552,7 +552,7 @@ glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock)
 
       err = mutex_lock (&lock->mutex);
       if (err != 0)
-	return err;
+        return err;
       lock->owner = self;
     }
   if (++(lock->depth) == 0) /* wraparound? */
@@ -597,15 +597,15 @@ glthread_once_multithreaded (gl_once_t *once_control, void (*initfunction) (void
       int err;
 
       /* Use the mutex to guarantee that if another thread is already calling
-	 the initfunction, this thread waits until it's finished.  */
+         the initfunction, this thread waits until it's finished.  */
       err = mutex_lock (&once_control->mutex);
       if (err != 0)
-	return err;
+        return err;
       if (!once_control->inited)
-	{
-	  once_control->inited = 1;
-	  initfunction ();
-	}
+        {
+          once_control->inited = 1;
+          initfunction ();
+        }
       return mutex_unlock (&once_control->mutex);
     }
   else
@@ -647,13 +647,13 @@ glthread_lock_lock_func (gl_lock_t *lock)
   if (!lock->guard.done)
     {
       if (InterlockedIncrement (&lock->guard.started) == 0)
-	/* This thread is the first one to need this lock.  Initialize it.  */
-	glthread_lock_init (lock);
+        /* This thread is the first one to need this lock.  Initialize it.  */
+        glthread_lock_init (lock);
       else
-	/* Yield the CPU while waiting for another thread to finish
-	   initializing this lock.  */
-	while (!lock->guard.done)
-	  Sleep (0);
+        /* Yield the CPU while waiting for another thread to finish
+           initializing this lock.  */
+        while (!lock->guard.done)
+          Sleep (0);
     }
   EnterCriticalSection (&lock->lock);
   return 0;
@@ -704,28 +704,28 @@ gl_waitqueue_add (gl_waitqueue_t *wq)
     {
       unsigned int new_alloc = 2 * wq->alloc + 1;
       HANDLE *new_array =
-	(HANDLE *) realloc (wq->array, new_alloc * sizeof (HANDLE));
+        (HANDLE *) realloc (wq->array, new_alloc * sizeof (HANDLE));
       if (new_array == NULL)
-	/* No more memory.  */
-	return INVALID_HANDLE_VALUE;
+        /* No more memory.  */
+        return INVALID_HANDLE_VALUE;
       /* Now is a good opportunity to rotate the array so that its contents
-	 starts at offset 0.  */
+         starts at offset 0.  */
       if (wq->offset > 0)
-	{
-	  unsigned int old_count = wq->count;
-	  unsigned int old_alloc = wq->alloc;
-	  unsigned int old_offset = wq->offset;
-	  unsigned int i;
-	  if (old_offset + old_count > old_alloc)
-	    {
-	      unsigned int limit = old_offset + old_count - old_alloc;
-	      for (i = 0; i < limit; i++)
-		new_array[old_alloc + i] = new_array[i];
-	    }
-	  for (i = 0; i < old_count; i++)
-	    new_array[i] = new_array[old_offset + i];
-	  wq->offset = 0;
-	}
+        {
+          unsigned int old_count = wq->count;
+          unsigned int old_alloc = wq->alloc;
+          unsigned int old_offset = wq->offset;
+          unsigned int i;
+          if (old_offset + old_count > old_alloc)
+            {
+              unsigned int limit = old_offset + old_count - old_alloc;
+              for (i = 0; i < limit; i++)
+                new_array[old_alloc + i] = new_array[i];
+            }
+          for (i = 0; i < old_count; i++)
+            new_array[i] = new_array[old_offset + i];
+          wq->offset = 0;
+        }
       wq->array = new_array;
       wq->alloc = new_alloc;
     }
@@ -764,7 +764,7 @@ gl_waitqueue_notify_all (gl_waitqueue_t *wq)
     {
       unsigned int index = wq->offset + i;
       if (index >= wq->alloc)
-	index -= wq->alloc;
+        index -= wq->alloc;
       SetEvent (wq->array[index]);
     }
   wq->count = 0;
@@ -787,13 +787,13 @@ glthread_rwlock_rdlock_func (gl_rwlock_t *lock)
   if (!lock->guard.done)
     {
       if (InterlockedIncrement (&lock->guard.started) == 0)
-	/* This thread is the first one to need this lock.  Initialize it.  */
-	glthread_rwlock_init (lock);
+        /* This thread is the first one to need this lock.  Initialize it.  */
+        glthread_rwlock_init (lock);
       else
-	/* Yield the CPU while waiting for another thread to finish
-	   initializing this lock.  */
-	while (!lock->guard.done)
-	  Sleep (0);
+        /* Yield the CPU while waiting for another thread to finish
+           initializing this lock.  */
+        while (!lock->guard.done)
+          Sleep (0);
     }
   EnterCriticalSection (&lock->lock);
   /* Test whether only readers are currently running, and whether the runcount
@@ -801,34 +801,34 @@ glthread_rwlock_rdlock_func (gl_rwlock_t *lock)
   if (!(lock->runcount + 1 > 0))
     {
       /* This thread has to wait for a while.  Enqueue it among the
-	 waiting_readers.  */
+         waiting_readers.  */
       HANDLE event = gl_waitqueue_add (&lock->waiting_readers);
       if (event != INVALID_HANDLE_VALUE)
-	{
-	  DWORD result;
-	  LeaveCriticalSection (&lock->lock);
-	  /* Wait until another thread signals this event.  */
-	  result = WaitForSingleObject (event, INFINITE);
-	  if (result == WAIT_FAILED || result == WAIT_TIMEOUT)
-	    abort ();
-	  CloseHandle (event);
-	  /* The thread which signalled the event already did the bookkeeping:
-	     removed us from the waiting_readers, incremented lock->runcount.  */
-	  if (!(lock->runcount > 0))
-	    abort ();
-	  return 0;
-	}
+        {
+          DWORD result;
+          LeaveCriticalSection (&lock->lock);
+          /* Wait until another thread signals this event.  */
+          result = WaitForSingleObject (event, INFINITE);
+          if (result == WAIT_FAILED || result == WAIT_TIMEOUT)
+            abort ();
+          CloseHandle (event);
+          /* The thread which signalled the event already did the bookkeeping:
+             removed us from the waiting_readers, incremented lock->runcount.  */
+          if (!(lock->runcount > 0))
+            abort ();
+          return 0;
+        }
       else
-	{
-	  /* Allocation failure.  Weird.  */
-	  do
-	    {
-	      LeaveCriticalSection (&lock->lock);
-	      Sleep (1);
-	      EnterCriticalSection (&lock->lock);
-	    }
-	  while (!(lock->runcount + 1 > 0));
-	}
+        {
+          /* Allocation failure.  Weird.  */
+          do
+            {
+              LeaveCriticalSection (&lock->lock);
+              Sleep (1);
+              EnterCriticalSection (&lock->lock);
+            }
+          while (!(lock->runcount + 1 > 0));
+        }
     }
   lock->runcount++;
   LeaveCriticalSection (&lock->lock);
@@ -841,47 +841,47 @@ glthread_rwlock_wrlock_func (gl_rwlock_t *lock)
   if (!lock->guard.done)
     {
       if (InterlockedIncrement (&lock->guard.started) == 0)
-	/* This thread is the first one to need this lock.  Initialize it.  */
-	glthread_rwlock_init (lock);
+        /* This thread is the first one to need this lock.  Initialize it.  */
+        glthread_rwlock_init (lock);
       else
-	/* Yield the CPU while waiting for another thread to finish
-	   initializing this lock.  */
-	while (!lock->guard.done)
-	  Sleep (0);
+        /* Yield the CPU while waiting for another thread to finish
+           initializing this lock.  */
+        while (!lock->guard.done)
+          Sleep (0);
     }
   EnterCriticalSection (&lock->lock);
   /* Test whether no readers or writers are currently running.  */
   if (!(lock->runcount == 0))
     {
       /* This thread has to wait for a while.  Enqueue it among the
-	 waiting_writers.  */
+         waiting_writers.  */
       HANDLE event = gl_waitqueue_add (&lock->waiting_writers);
       if (event != INVALID_HANDLE_VALUE)
-	{
-	  DWORD result;
-	  LeaveCriticalSection (&lock->lock);
-	  /* Wait until another thread signals this event.  */
-	  result = WaitForSingleObject (event, INFINITE);
-	  if (result == WAIT_FAILED || result == WAIT_TIMEOUT)
-	    abort ();
-	  CloseHandle (event);
-	  /* The thread which signalled the event already did the bookkeeping:
-	     removed us from the waiting_writers, set lock->runcount = -1.  */
-	  if (!(lock->runcount == -1))
-	    abort ();
-	  return 0;
-	}
+        {
+          DWORD result;
+          LeaveCriticalSection (&lock->lock);
+          /* Wait until another thread signals this event.  */
+          result = WaitForSingleObject (event, INFINITE);
+          if (result == WAIT_FAILED || result == WAIT_TIMEOUT)
+            abort ();
+          CloseHandle (event);
+          /* The thread which signalled the event already did the bookkeeping:
+             removed us from the waiting_writers, set lock->runcount = -1.  */
+          if (!(lock->runcount == -1))
+            abort ();
+          return 0;
+        }
       else
-	{
-	  /* Allocation failure.  Weird.  */
-	  do
-	    {
-	      LeaveCriticalSection (&lock->lock);
-	      Sleep (1);
-	      EnterCriticalSection (&lock->lock);
-	    }
-	  while (!(lock->runcount == 0));
-	}
+        {
+          /* Allocation failure.  Weird.  */
+          do
+            {
+              LeaveCriticalSection (&lock->lock);
+              Sleep (1);
+              EnterCriticalSection (&lock->lock);
+            }
+          while (!(lock->runcount == 0));
+        }
     }
   lock->runcount--; /* runcount becomes -1 */
   LeaveCriticalSection (&lock->lock);
@@ -898,35 +898,35 @@ glthread_rwlock_unlock_func (gl_rwlock_t *lock)
     {
       /* Drop a writer lock.  */
       if (!(lock->runcount == -1))
-	abort ();
+        abort ();
       lock->runcount = 0;
     }
   else
     {
       /* Drop a reader lock.  */
       if (!(lock->runcount > 0))
-	{
-	  LeaveCriticalSection (&lock->lock);
-	  return EPERM;
-	}
+        {
+          LeaveCriticalSection (&lock->lock);
+          return EPERM;
+        }
       lock->runcount--;
     }
   if (lock->runcount == 0)
     {
       /* POSIX recommends that "write locks shall take precedence over read
-	 locks", to avoid "writer starvation".  */
+         locks", to avoid "writer starvation".  */
       if (lock->waiting_writers.count > 0)
-	{
-	  /* Wake up one of the waiting writers.  */
-	  lock->runcount--;
-	  gl_waitqueue_notify_first (&lock->waiting_writers);
-	}
+        {
+          /* Wake up one of the waiting writers.  */
+          lock->runcount--;
+          gl_waitqueue_notify_first (&lock->waiting_writers);
+        }
       else
-	{
-	  /* Wake up all waiting readers.  */
-	  lock->runcount += lock->waiting_readers.count;
-	  gl_waitqueue_notify_all (&lock->waiting_readers);
-	}
+        {
+          /* Wake up all waiting readers.  */
+          lock->runcount += lock->waiting_readers.count;
+          gl_waitqueue_notify_all (&lock->waiting_readers);
+        }
     }
   LeaveCriticalSection (&lock->lock);
   return 0;
@@ -965,25 +965,25 @@ glthread_recursive_lock_lock_func (gl_recursive_lock_t *lock)
   if (!lock->guard.done)
     {
       if (InterlockedIncrement (&lock->guard.started) == 0)
-	/* This thread is the first one to need this lock.  Initialize it.  */
-	glthread_recursive_lock_init (lock);
+        /* This thread is the first one to need this lock.  Initialize it.  */
+        glthread_recursive_lock_init (lock);
       else
-	/* Yield the CPU while waiting for another thread to finish
-	   initializing this lock.  */
-	while (!lock->guard.done)
-	  Sleep (0);
+        /* Yield the CPU while waiting for another thread to finish
+           initializing this lock.  */
+        while (!lock->guard.done)
+          Sleep (0);
     }
   {
     DWORD self = GetCurrentThreadId ();
     if (lock->owner != self)
       {
-	EnterCriticalSection (&lock->lock);
-	lock->owner = self;
+        EnterCriticalSection (&lock->lock);
+        lock->owner = self;
       }
     if (++(lock->depth) == 0) /* wraparound? */
       {
-	lock->depth--;
-	return EAGAIN;
+        lock->depth--;
+        return EAGAIN;
       }
   }
   return 0;
@@ -1022,34 +1022,34 @@ glthread_once_func (gl_once_t *once_control, void (*initfunction) (void))
   if (once_control->inited <= 0)
     {
       if (InterlockedIncrement (&once_control->started) == 0)
-	{
-	  /* This thread is the first one to come to this once_control.  */
-	  InitializeCriticalSection (&once_control->lock);
-	  EnterCriticalSection (&once_control->lock);
-	  once_control->inited = 0;
-	  initfunction ();
-	  once_control->inited = 1;
-	  LeaveCriticalSection (&once_control->lock);
-	}
+        {
+          /* This thread is the first one to come to this once_control.  */
+          InitializeCriticalSection (&once_control->lock);
+          EnterCriticalSection (&once_control->lock);
+          once_control->inited = 0;
+          initfunction ();
+          once_control->inited = 1;
+          LeaveCriticalSection (&once_control->lock);
+        }
       else
-	{
-	  /* Undo last operation.  */
-	  InterlockedDecrement (&once_control->started);
-	  /* Some other thread has already started the initialization.
-	     Yield the CPU while waiting for the other thread to finish
-	     initializing and taking the lock.  */
-	  while (once_control->inited < 0)
-	    Sleep (0);
-	  if (once_control->inited <= 0)
-	    {
-	      /* Take the lock.  This blocks until the other thread has
-		 finished calling the initfunction.  */
-	      EnterCriticalSection (&once_control->lock);
-	      LeaveCriticalSection (&once_control->lock);
-	      if (!(once_control->inited > 0))
-		abort ();
-	    }
-	}
+        {
+          /* Undo last operation.  */
+          InterlockedDecrement (&once_control->started);
+          /* Some other thread has already started the initialization.
+             Yield the CPU while waiting for the other thread to finish
+             initializing and taking the lock.  */
+          while (once_control->inited < 0)
+            Sleep (0);
+          if (once_control->inited <= 0)
+            {
+              /* Take the lock.  This blocks until the other thread has
+                 finished calling the initfunction.  */
+              EnterCriticalSection (&once_control->lock);
+              LeaveCriticalSection (&once_control->lock);
+              if (!(once_control->inited > 0))
+                abort ();
+            }
+        }
     }
 }
 
diff --git a/libmissing/glthread/lock.h b/libmissing/glthread/lock.h
index 960c353..a6ae28e 100644
--- a/libmissing/glthread/lock.h
+++ b/libmissing/glthread/lock.h
@@ -1,5 +1,5 @@
 /* Locking in multithreaded situations.
-   Copyright (C) 2005-2008 Free Software Foundation, Inc.
+   Copyright (C) 2005-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/libmissing/glthread/thread.c b/libmissing/glthread/thread.c
index 4f10225..7ae57ba 100644
--- a/libmissing/glthread/thread.c
+++ b/libmissing/glthread/thread.c
@@ -1,5 +1,5 @@
 /* Creating and controlling threads.
-   Copyright (C) 2005-2008 Free Software Foundation, Inc.
+   Copyright (C) 2005-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -80,8 +80,8 @@ get_current_thread_handle (void)
   /* GetCurrentThread() returns a pseudo-handle, i.e. only a symbolic
      identifier, not a real handle.  */
   if (!DuplicateHandle (GetCurrentProcess (), GetCurrentThread (),
-			GetCurrentProcess (), &this_handle,
-			0, FALSE, DUPLICATE_SAME_ACCESS))
+                        GetCurrentProcess (), &this_handle,
+                        0, FALSE, DUPLICATE_SAME_ACCESS))
     abort ();
   return this_handle;
 }
@@ -97,18 +97,18 @@ gl_thread_self_func (void)
   if (thread == NULL)
     {
       /* This happens only in threads that have not been created through
-	 glthread_create(), such as the main thread.  */
+         glthread_create(), such as the main thread.  */
       for (;;)
-	{
-	  thread =
-	    (struct gl_thread_struct *)
-	    malloc (sizeof (struct gl_thread_struct));
-	  if (thread != NULL)
-	    break;
-	  /* Memory allocation failed.  There is not much we can do.  Have to
-	     busy-loop, waiting for the availability of memory.  */
-	  Sleep (1);
-	}
+        {
+          thread =
+            (struct gl_thread_struct *)
+            malloc (sizeof (struct gl_thread_struct));
+          if (thread != NULL)
+            break;
+          /* Memory allocation failed.  There is not much we can do.  Have to
+             busy-loop, waiting for the availability of memory.  */
+          Sleep (1);
+        }
 
       thread->handle = get_current_thread_handle ();
       InitializeCriticalSection (&thread->handle_lock);
@@ -164,9 +164,9 @@ glthread_create_func (gl_thread_t *threadp, void * (*func) (void *), void *arg)
       /* calls CreateThread with the same arguments */
     if (thread_handle == NULL)
       {
-	DeleteCriticalSection (&thread->handle_lock);
-	free (thread);
-	return EAGAIN;
+        DeleteCriticalSection (&thread->handle_lock);
+        free (thread);
+        return EAGAIN;
       }
 
     EnterCriticalSection (&thread->handle_lock);
diff --git a/libmissing/glthread/thread.h b/libmissing/glthread/thread.h
index 7644c40..24d24c4 100644
--- a/libmissing/glthread/thread.h
+++ b/libmissing/glthread/thread.h
@@ -1,5 +1,5 @@
 /* Creating and controlling threads.
-   Copyright (C) 2005-2008 Free Software Foundation, Inc.
+   Copyright (C) 2005-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/libmissing/glthread/threadlib.c b/libmissing/glthread/threadlib.c
index df82000..8cb1bb2 100644
--- a/libmissing/glthread/threadlib.c
+++ b/libmissing/glthread/threadlib.c
@@ -1,5 +1,5 @@
 /* Multithreading primitives.
-   Copyright (C) 2005-2009 Free Software Foundation, Inc.
+   Copyright (C) 2005-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -48,16 +48,16 @@ glthread_in_use (void)
       pthread_t thread;
 
       if (pthread_create (&thread, NULL, dummy_thread_func, NULL) != 0)
-	/* Thread creation failed.  */
-	result = 0;
+        /* Thread creation failed.  */
+        result = 0;
       else
-	{
-	  /* Thread creation works.  */
-	  void *retval;
-	  if (pthread_join (thread, &retval) != 0)
-	    abort ();
-	  result = 1;
-	}
+        {
+          /* Thread creation works.  */
+          void *retval;
+          if (pthread_join (thread, &retval) != 0)
+            abort ();
+          result = 1;
+        }
       tested = 1;
     }
   return result;
diff --git a/libmissing/inet_ntop.c b/libmissing/inet_ntop.c
index e5ef8f5..cd5dbf1 100644
--- a/libmissing/inet_ntop.c
+++ b/libmissing/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-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser 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/libmissing/m4/00gnulib.m4 b/libmissing/m4/00gnulib.m4
index d4d04d1..301469b 100644
--- a/libmissing/m4/00gnulib.m4
+++ b/libmissing/m4/00gnulib.m4
@@ -1,5 +1,5 @@
 # 00gnulib.m4 serial 2
-dnl Copyright (C) 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2010 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.
diff --git a/libmissing/m4/alloca.m4 b/libmissing/m4/alloca.m4
index 4b978e1..f3ee343 100644
--- a/libmissing/m4/alloca.m4
+++ b/libmissing/m4/alloca.m4
@@ -1,5 +1,6 @@
 # alloca.m4 serial 9
-dnl Copyright (C) 2002-2004, 2006, 2007, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2006-2007, 2009-2010 Free Software Foundation,
+dnl 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.
diff --git a/libmissing/m4/arpa_inet_h.m4 b/libmissing/m4/arpa_inet_h.m4
index a6e63df..4360dd8 100644
--- a/libmissing/m4/arpa_inet_h.m4
+++ b/libmissing/m4/arpa_inet_h.m4
@@ -1,5 +1,5 @@
-# arpa_inet_h.m4 serial 5
-dnl Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+# arpa_inet_h.m4 serial 7
+dnl Copyright (C) 2006, 2008, 2009, 2010 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.
@@ -16,20 +16,28 @@ AC_DEFUN([gl_HEADER_ARPA_INET],
   if test $ac_cv_header_arpa_inet_h = yes; then
     HAVE_ARPA_INET_H=1
   else
-    ARPA_INET_H='arpa/inet.h'
     HAVE_ARPA_INET_H=0
   fi
   AC_SUBST([HAVE_ARPA_INET_H])
-  dnl Execute this unconditionally, because ARPA_INET_H may be set by other
-  dnl modules, after this code is executed.
+  dnl <arpa/inet.h> is always overridden, because of GNULIB_POSIXCHECK.
   gl_CHECK_NEXT_HEADERS([arpa/inet.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+/* On some systems, this header is not self-consistent.  */
+#ifndef __GLIBC__
+# include <sys/socket.h>
+#endif
+#include <arpa/inet.h>
+    ]], [inet_ntop inet_pton])
 ])
 
 dnl Unconditionally enables the replacement of <arpa/inet.h>.
 AC_DEFUN([gl_REPLACE_ARPA_INET_H],
 [
-  AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
-  ARPA_INET_H='arpa/inet.h'
+  dnl This is a no-op, because <arpa/inet.h> is always overridden.
+  :
 ])
 
 AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR],
@@ -46,5 +54,4 @@ AC_DEFUN([gl_ARPA_INET_H_DEFAULTS],
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE_DECL_INET_NTOP=1;  AC_SUBST([HAVE_DECL_INET_NTOP])
   HAVE_DECL_INET_PTON=1;  AC_SUBST([HAVE_DECL_INET_PTON])
-  ARPA_INET_H='';         AC_SUBST([ARPA_INET_H])
 ])
diff --git a/libmissing/m4/cond.m4 b/libmissing/m4/cond.m4
index eefee8e..e8c84cf 100644
--- a/libmissing/m4/cond.m4
+++ b/libmissing/m4/cond.m4
@@ -1,5 +1,5 @@
 # cond.m4 serial 1
-dnl Copyright (C) 2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2008, 2009, 2010 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.
diff --git a/libmissing/m4/errno_h.m4 b/libmissing/m4/errno_h.m4
index 4ce1ccb..d02a039 100644
--- a/libmissing/m4/errno_h.m4
+++ b/libmissing/m4/errno_h.m4
@@ -1,5 +1,5 @@
 # errno_h.m4 serial 6
-dnl Copyright (C) 2004, 2006, 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2004, 2006, 2008, 2009, 2010 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.
diff --git a/libmissing/m4/extensions.m4 b/libmissing/m4/extensions.m4
index ba6d5e1..7d9458a 100644
--- a/libmissing/m4/extensions.m4
+++ b/libmissing/m4/extensions.m4
@@ -1,7 +1,7 @@
-# serial 8  -*- Autoconf -*-
+# serial 9  -*- Autoconf -*-
 # Enable extensions on systems that normally disable them.
 
-# Copyright (C) 2003, 2006-2009 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006-2010 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.
@@ -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/libmissing/m4/fcntl_h.m4 b/libmissing/m4/fcntl_h.m4
index 1ae0b15..ecd8fa3 100644
--- a/libmissing/m4/fcntl_h.m4
+++ b/libmissing/m4/fcntl_h.m4
@@ -1,5 +1,6 @@
+# serial 10
 # Configure fcntl.h.
-dnl Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2006, 2007, 2009, 2010 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.
@@ -9,76 +10,14 @@ 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])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, if it is not common
+  dnl enough to be declared everywhere.
+  gl_WARN_ON_USE_PREPARE([[#include <fcntl.h>
+    ]], [fcntl openat])
 ])
 
 AC_DEFUN([gl_FCNTL_MODULE_INDICATOR],
@@ -90,7 +29,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/libmissing/m4/float_h.m4 b/libmissing/m4/float_h.m4
index d36e3a4..a74a0d9 100644
--- a/libmissing/m4/float_h.m4
+++ b/libmissing/m4/float_h.m4
@@ -1,5 +1,5 @@
 # float_h.m4 serial 3
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009, 2010 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.
diff --git a/libmissing/m4/getaddrinfo.m4 b/libmissing/m4/getaddrinfo.m4
index 4088671..05fd2b6 100644
--- a/libmissing/m4/getaddrinfo.m4
+++ b/libmissing/m4/getaddrinfo.m4
@@ -1,5 +1,5 @@
-# getaddrinfo.m4 serial 20
-dnl Copyright (C) 2004-2009 Free Software Foundation, Inc.
+# getaddrinfo.m4 serial 22
+dnl Copyright (C) 2004-2010 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.
@@ -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/libmissing/m4/getpagesize.m4 b/libmissing/m4/getpagesize.m4
deleted file mode 100644
index 0d07a3a..0000000
--- a/libmissing/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/libmissing/m4/gettimeofday.m4 b/libmissing/m4/gettimeofday.m4
index 0fec7d4..735123e 100644
--- a/libmissing/m4/gettimeofday.m4
+++ b/libmissing/m4/gettimeofday.m4
@@ -1,6 +1,6 @@
 # serial 12
 
-# Copyright (C) 2001-2003, 2005, 2007, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2001-2003, 2005, 2007, 2009-2010 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.
@@ -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/libmissing/m4/gnulib-cache.m4 b/libmissing/m4/gnulib-cache.m4
index b484c16..822126d 100644
--- a/libmissing/m4/gnulib-cache.m4
+++ b/libmissing/m4/gnulib-cache.m4
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2009 Free Software Foundation, Inc.
+# Copyright (C) 2002-2010 Free Software Foundation, Inc.
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
diff --git a/libmissing/m4/gnulib-common.m4 b/libmissing/m4/gnulib-common.m4
index c8fda20..b7812a8 100644
--- a/libmissing/m4/gnulib-common.m4
+++ b/libmissing/m4/gnulib-common.m4
@@ -1,5 +1,5 @@
-# gnulib-common.m4 serial 11
-dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
+# gnulib-common.m4 serial 12
+dnl Copyright (C) 2007-2010 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.
@@ -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
 ])
 ])
 
@@ -49,6 +52,14 @@ m4_ifndef([m4_foreach_w],
   [m4_define([m4_foreach_w],
     [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
 
+# AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH])
+# ----------------------------------------------------
+# Backport of autoconf-2.63b's macro.
+# Remove this macro when we can assume autoconf >= 2.64.
+m4_ifndef([AS_VAR_IF],
+[m4_define([AS_VAR_IF],
+[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])])
+
 # AC_PROG_MKDIR_P
 # is a backport of autoconf-2.60's AC_PROG_MKDIR_P.
 # Remove this macro when we can assume autoconf >= 2.60.
@@ -70,13 +81,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/libmissing/m4/gnulib-comp.m4 b/libmissing/m4/gnulib-comp.m4
index d3fb748..b72b218 100644
--- a/libmissing/m4/gnulib-comp.m4
+++ b/libmissing/m4/gnulib-comp.m4
@@ -1,5 +1,5 @@
 # DO NOT EDIT! GENERATED AUTOMATICALLY!
-# Copyright (C) 2002-2009 Free Software Foundation, Inc.
+# Copyright (C) 2002-2010 Free Software Foundation, Inc.
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
@@ -47,14 +47,16 @@ AC_DEFUN([gl_INIT],
   gl_HEADER_ARPA_INET
   AC_PROG_MKDIR_P
   gl_COND
+  gl_FUNC_DUP2
+  gl_UNISTD_MODULE_INDICATOR([dup2])
   gl_HEADER_ERRNO_H
+  gl_FUNC_FCNTL
+  gl_FCNTL_MODULE_INDICATOR([fcntl])
   gl_FCNTL_H
   gl_FLOAT_H
   gl_FUNC_FTW
   gl_GETADDRINFO
   gl_NETDB_MODULE_INDICATOR([getaddrinfo])
-  gl_FUNC_GETPAGESIZE
-  gl_UNISTD_MODULE_INDICATOR([getpagesize])
   AC_SUBST([LIBINTL])
   AC_SUBST([LTLIBINTL])
   gl_FUNC_GETTIMEOFDAY
@@ -80,7 +82,10 @@ AC_DEFUN([gl_INIT],
   gl_FUNC_SNPRINTF
   gl_STDIO_MODULE_INDICATOR([snprintf])
   gl_TYPE_SOCKLEN_T
+  gl_FUNC_STAT
+  gl_SYS_STAT_MODULE_INDICATOR([stat])
   AM_STDBOOL_H
+  gl_STDDEF_H
   gl_STDINT_H
   gl_STDIO_H
   gl_FUNC_STRDUP
@@ -90,6 +95,8 @@ AC_DEFUN([gl_INIT],
   gl_STRING_MODULE_INDICATOR([strsep])
   gl_HEADER_SYS_SOCKET
   AC_PROG_MKDIR_P
+  gl_HEADER_SYS_STAT_H
+  AC_PROG_MKDIR_P
   gl_HEADER_SYS_TIME_H
   AC_PROG_MKDIR_P
   gl_THREAD
@@ -124,7 +131,7 @@ AC_DEFUN([gl_INIT],
     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
@@ -141,13 +148,24 @@ AC_DEFUN([gl_INIT],
   m4_pushdef([gltests_LIBSOURCES_DIR], [])
   gl_COMMON
   gl_source_base='libmissing/tests'
+  gl_FUNC_GETDTABLESIZE
+  gl_UNISTD_MODULE_INDICATOR([getdtablesize])
+  AC_C_BIGENDIAN
+  gl_FUNC_LSTAT
+  gl_SYS_STAT_MODULE_INDICATOR([lstat])
+  gl_FUNC_OPEN
+  gl_MODULE_INDICATOR([open])
+  gl_FCNTL_MODULE_INDICATOR([open])
   gl_FUNC_SLEEP
   gl_UNISTD_MODULE_INDICATOR([sleep])
+  AC_CHECK_DECLS_ONCE([alarm])
   gt_TYPE_WCHAR_T
   gt_TYPE_WINT_T
   gl_FUNC_STRERROR
   gl_STRING_MODULE_INDICATOR([strerror])
-  AC_CHECK_FUNCS([shutdown])
+  gl_FUNC_SYMLINK
+  gl_UNISTD_MODULE_INDICATOR([symlink])
+  AC_CHECK_FUNCS_ONCE([shutdown])
   gl_YIELD
   m4_ifval(gltests_LIBSOURCES_LIST, [
     m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ ||
@@ -171,7 +189,7 @@ AC_DEFUN([gl_INIT],
     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
@@ -240,13 +258,16 @@ 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/link-warning.h
+  build-aux/warn-on-use.h
   lib/alignof.h
   lib/alloca.in.h
   lib/arpa_inet.in.h
   lib/asnprintf.c
+  lib/dup2.c
   lib/errno.in.h
+  lib/fcntl.c
   lib/fcntl.in.h
   lib/float+.h
   lib/float.in.h
@@ -254,7 +275,6 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/ftw_.h
   lib/gai_strerror.c
   lib/getaddrinfo.c
-  lib/getpagesize.c
   lib/gettext.h
   lib/gettimeofday.c
   lib/glthread/cond.c
@@ -281,7 +301,9 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/sigprocmask.c
   lib/size_max.h
   lib/snprintf.c
+  lib/stat.c
   lib/stdbool.in.h
+  lib/stddef.in.h
   lib/stdint.in.h
   lib/stdio-write.c
   lib/stdio.in.h
@@ -289,6 +311,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/string.in.h
   lib/strsep.c
   lib/sys_socket.in.h
+  lib/sys_stat.in.h
   lib/sys_time.in.h
   lib/time.in.h
   lib/time_r.c
@@ -302,13 +325,17 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/alloca.m4
   m4/arpa_inet_h.m4
   m4/cond.m4
+  m4/dos.m4
+  m4/dup2.m4
   m4/errno_h.m4
   m4/extensions.m4
+  m4/fcntl-o.m4
+  m4/fcntl.m4
   m4/fcntl_h.m4
   m4/float_h.m4
   m4/ftw.m4
   m4/getaddrinfo.m4
-  m4/getpagesize.m4
+  m4/getdtablesize.m4
   m4/gettimeofday.m4
   m4/gnulib-common.m4
   m4/hostent.m4
@@ -321,13 +348,16 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/lib-prefix.m4
   m4/lock.m4
   m4/longlong.m4
+  m4/lstat.m4
   m4/memchr.m4
   m4/memset.m4
   m4/mmap-anon.m4
+  m4/mode_t.m4
   m4/multiarch.m4
   m4/netdb_h.m4
   m4/netinet_in_h.m4
   m4/onceonly.m4
+  m4/open.m4
   m4/pathmax.m4
   m4/printf.m4
   m4/servent.m4
@@ -339,7 +369,9 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/snprintf.m4
   m4/socklen.m4
   m4/sockpfaf.m4
+  m4/stat.m4
   m4/stdbool.m4
+  m4/stddef_h.m4
   m4/stdint.m4
   m4/stdint_h.m4
   m4/stdio_h.m4
@@ -347,7 +379,9 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/strerror.m4
   m4/string_h.m4
   m4/strsep.m4
+  m4/symlink.m4
   m4/sys_socket_h.m4
+  m4/sys_stat_h.m4
   m4/sys_time_h.m4
   m4/thread.m4
   m4/threadlib.m4
@@ -356,33 +390,52 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/unistd_h.m4
   m4/vasnprintf.m4
   m4/vsnprintf.m4
+  m4/warn-on-use.m4
   m4/wchar.m4
   m4/wchar_t.m4
   m4/wint_t.m4
   m4/xsize.m4
   m4/yield.m4
+  tests/macros.h
+  tests/signature.h
   tests/test-alignof.c
   tests/test-alloca-opt.c
   tests/test-arpa_inet.c
+  tests/test-binary-io.c
+  tests/test-binary-io.sh
   tests/test-cond.c
+  tests/test-dup2.c
   tests/test-errno.c
+  tests/test-fcntl-h.c
   tests/test-fcntl.c
   tests/test-getaddrinfo.c
+  tests/test-getdtablesize.c
   tests/test-gettimeofday.c
+  tests/test-inet_ntop.c
   tests/test-lock.c
+  tests/test-lstat.c
+  tests/test-lstat.h
   tests/test-memchr.c
   tests/test-netdb.c
   tests/test-netinet_in.c
+  tests/test-open.c
+  tests/test-open.h
   tests/test-sigaction.c
   tests/test-signal.c
   tests/test-sleep.c
   tests/test-snprintf.c
+  tests/test-stat.c
+  tests/test-stat.h
   tests/test-stdbool.c
+  tests/test-stddef.c
   tests/test-stdint.c
   tests/test-stdio.c
   tests/test-strerror.c
   tests/test-string.c
+  tests/test-symlink.c
+  tests/test-symlink.h
   tests/test-sys_socket.c
+  tests/test-sys_stat.c
   tests/test-sys_time.c
   tests/test-time.c
   tests/test-unistd.c
@@ -390,10 +443,16 @@ AC_DEFUN([gl_FILE_LIST], [
   tests/test-vsnprintf.c
   tests/test-wchar.c
   tests/zerosize-ptr.h
+  tests=lib/binary-io.h
   tests=lib/dummy.c
+  tests=lib/getdtablesize.c
   tests=lib/glthread/yield.h
   tests=lib/intprops.h
+  tests=lib/lstat.c
+  tests=lib/open.c
+  tests=lib/same-inode.h
   tests=lib/sleep.c
   tests=lib/strerror.c
+  tests=lib/symlink.c
   tests=lib/verify.h
 ])
diff --git a/libmissing/m4/gnulib-tool.m4 b/libmissing/m4/gnulib-tool.m4
index 4438d48..69e7733 100644
--- a/libmissing/m4/gnulib-tool.m4
+++ b/libmissing/m4/gnulib-tool.m4
@@ -1,5 +1,5 @@
 # gnulib-tool.m4 serial 2
-dnl Copyright (C) 2004-2005 Free Software Foundation, Inc.
+dnl Copyright (C) 2004-2005, 2009-2010 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.
diff --git a/libmissing/m4/hostent.m4 b/libmissing/m4/hostent.m4
index 4a96af7..1111041 100644
--- a/libmissing/m4/hostent.m4
+++ b/libmissing/m4/hostent.m4
@@ -1,5 +1,5 @@
 # hostent.m4 serial 1
-dnl Copyright (C) 2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2008, 2009, 2010 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.
diff --git a/libmissing/m4/include_next.m4 b/libmissing/m4/include_next.m4
index 5e22ded..c7e0672 100644
--- a/libmissing/m4/include_next.m4
+++ b/libmissing/m4/include_next.m4
@@ -1,5 +1,5 @@
 # include_next.m4 serial 14
-dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2010 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.
@@ -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:
-#	#@INCLUDE_NEXT@ @NEXT_FOO_H@
+#       #@INCLUDE_NEXT@ @NEXT_FOO_H@
 # or
-#	#@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@
+#       #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @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/libmissing/m4/inet_ntop.m4 b/libmissing/m4/inet_ntop.m4
index 2bbdca1..20e8d7c 100644
--- a/libmissing/m4/inet_ntop.m4
+++ b/libmissing/m4/inet_ntop.m4
@@ -1,5 +1,5 @@
-# inet_ntop.m4 serial 9
-dnl Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+# inet_ntop.m4 serial 11
+dnl Copyright (C) 2005, 2006, 2008, 2009, 2010 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,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/libmissing/m4/intmax_t.m4 b/libmissing/m4/intmax_t.m4
index 264cb57..975caac 100644
--- a/libmissing/m4/intmax_t.m4
+++ b/libmissing/m4/intmax_t.m4
@@ -1,5 +1,6 @@
 # intmax_t.m4 serial 7
-dnl Copyright (C) 1997-2004, 2006-2007, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1997-2004, 2006-2007, 2009-2010 Free Software Foundation,
+dnl 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.
diff --git a/libmissing/m4/inttypes_h.m4 b/libmissing/m4/inttypes_h.m4
index f4ca160..782d77e 100644
--- a/libmissing/m4/inttypes_h.m4
+++ b/libmissing/m4/inttypes_h.m4
@@ -1,5 +1,5 @@
 # inttypes_h.m4 serial 9
-dnl Copyright (C) 1997-2004, 2006, 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1997-2004, 2006, 2008-2010 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.
diff --git a/libmissing/m4/lib-ld.m4 b/libmissing/m4/lib-ld.m4
index e4863f2..ebb3052 100644
--- a/libmissing/m4/lib-ld.m4
+++ b/libmissing/m4/lib-ld.m4
@@ -1,5 +1,5 @@
 # lib-ld.m4 serial 4 (gettext-0.18)
-dnl Copyright (C) 1996-2003, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1996-2003, 2009-2010 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.
@@ -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/libmissing/m4/lib-link.m4 b/libmissing/m4/lib-link.m4
index 2f8b7ff..90e1ac9 100644
--- a/libmissing/m4/lib-link.m4
+++ b/libmissing/m4/lib-link.m4
@@ -1,5 +1,5 @@
 # lib-link.m4 serial 20 (gettext-0.18)
-dnl Copyright (C) 2001-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2010 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.
diff --git a/libmissing/m4/lib-prefix.m4 b/libmissing/m4/lib-prefix.m4
index 4b7ee33..1601cea 100644
--- a/libmissing/m4/lib-prefix.m4
+++ b/libmissing/m4/lib-prefix.m4
@@ -1,5 +1,5 @@
 # lib-prefix.m4 serial 7 (gettext-0.18)
-dnl Copyright (C) 2001-2005, 2008-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2005, 2008-2010 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.
diff --git a/libmissing/m4/lock.m4 b/libmissing/m4/lock.m4
index b416e31..9da8465 100644
--- a/libmissing/m4/lock.m4
+++ b/libmissing/m4/lock.m4
@@ -1,5 +1,5 @@
 # lock.m4 serial 10 (gettext-0.18)
-dnl Copyright (C) 2005-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2005-2010 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.
diff --git a/libmissing/m4/longlong.m4 b/libmissing/m4/longlong.m4
index eedc8d5..cca3c1a 100644
--- a/libmissing/m4/longlong.m4
+++ b/libmissing/m4/longlong.m4
@@ -1,5 +1,5 @@
 # longlong.m4 serial 14
-dnl Copyright (C) 1999-2007, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1999-2007, 2009-2010 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([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(
-	     [[@%:@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(
+             [[@%:@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/libmissing/m4/memchr.m4 b/libmissing/m4/memchr.m4
index 1194bac..94596ef 100644
--- a/libmissing/m4/memchr.m4
+++ b/libmissing/m4/memchr.m4
@@ -1,5 +1,5 @@
 # memchr.m4 serial 7
-dnl Copyright (C) 2002, 2003, 2004, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2009-2010 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.
@@ -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/libmissing/m4/memset.m4 b/libmissing/m4/memset.m4
index 38609dc..2e778a9 100644
--- a/libmissing/m4/memset.m4
+++ b/libmissing/m4/memset.m4
@@ -1,5 +1,5 @@
 # memset.m4 serial 3
-dnl Copyright (C) 2002, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2009-2010 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.
diff --git a/libmissing/m4/mmap-anon.m4 b/libmissing/m4/mmap-anon.m4
index 14b6270..a6b7b9a 100644
--- a/libmissing/m4/mmap-anon.m4
+++ b/libmissing/m4/mmap-anon.m4
@@ -1,5 +1,5 @@
 # mmap-anon.m4 serial 8
-dnl Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2007, 2009-2010 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.
diff --git a/libmissing/m4/multiarch.m4 b/libmissing/m4/multiarch.m4
index ec377ba..389bd2b 100644
--- a/libmissing/m4/multiarch.m4
+++ b/libmissing/m4/multiarch.m4
@@ -1,5 +1,5 @@
 # multiarch.m4 serial 5
-dnl Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2008, 2009, 2010 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.
diff --git a/libmissing/m4/netdb_h.m4 b/libmissing/m4/netdb_h.m4
index 5a12251..84afce6 100644
--- a/libmissing/m4/netdb_h.m4
+++ b/libmissing/m4/netdb_h.m4
@@ -1,5 +1,5 @@
-# netdb_h.m4 serial 5
-dnl Copyright (C) 2008 Free Software Foundation, Inc.
+# netdb_h.m4 serial 6
+dnl Copyright (C) 2008, 2009, 2010 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.
@@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_HEADER_NETDB],
 [
   AC_REQUIRE([gl_NETDB_H_DEFAULTS])
+  AC_CHECK_HEADERS_ONCE([netdb.h])
   gl_CHECK_NEXT_HEADERS([netdb.h])
   if test $ac_cv_header_netdb_h = yes; then
     AC_COMPILE_IFELSE(
diff --git a/libmissing/m4/netinet_in_h.m4 b/libmissing/m4/netinet_in_h.m4
index 47fd9cc..cc7a44c 100644
--- a/libmissing/m4/netinet_in_h.m4
+++ b/libmissing/m4/netinet_in_h.m4
@@ -1,5 +1,5 @@
 # netinet_in_h.m4 serial 4
-dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2010 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.
diff --git a/libmissing/m4/onceonly.m4 b/libmissing/m4/onceonly.m4
index 108cd6c..4a3cd84 100644
--- a/libmissing/m4/onceonly.m4
+++ b/libmissing/m4/onceonly.m4
@@ -1,5 +1,6 @@
 # onceonly.m4 serial 6
-dnl Copyright (C) 2002-2003, 2005-2006, 2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2003, 2005-2006, 2008-2010 Free Software Foundation,
+dnl Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
 dnl Public License, this file may be distributed as part of a program
diff --git a/libmissing/m4/pathmax.m4 b/libmissing/m4/pathmax.m4
index 4651801..6a3f857 100644
--- a/libmissing/m4/pathmax.m4
+++ b/libmissing/m4/pathmax.m4
@@ -1,5 +1,6 @@
 # pathmax.m4 serial 8
-dnl Copyright (C) 2002, 2003, 2005, 2006, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2010 Free Software Foundation,
+dnl 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.
diff --git a/libmissing/m4/printf.m4 b/libmissing/m4/printf.m4
index 87aa45c..ebca536 100644
--- a/libmissing/m4/printf.m4
+++ b/libmissing/m4/printf.m4
@@ -1,5 +1,5 @@
 # printf.m4 serial 33
-dnl Copyright (C) 2003, 2007-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2007-2010 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.
diff --git a/libmissing/m4/servent.m4 b/libmissing/m4/servent.m4
index 242f9e3..2ed961a 100644
--- a/libmissing/m4/servent.m4
+++ b/libmissing/m4/servent.m4
@@ -1,5 +1,5 @@
 # servent.m4 serial 1
-dnl Copyright (C) 2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2008, 2009, 2010 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.
diff --git a/libmissing/m4/sigaction.m4 b/libmissing/m4/sigaction.m4
index 3a3ed9f..8f0d450 100644
--- a/libmissing/m4/sigaction.m4
+++ b/libmissing/m4/sigaction.m4
@@ -1,5 +1,5 @@
 # sigaction.m4 serial 5
-dnl Copyright (C) 2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2008, 2009, 2010 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.
diff --git a/libmissing/m4/signal_h.m4 b/libmissing/m4/signal_h.m4
index e69befd..7f61e0b 100644
--- a/libmissing/m4/signal_h.m4
+++ b/libmissing/m4/signal_h.m4
@@ -1,5 +1,5 @@
-# signal_h.m4 serial 7
-dnl Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+# signal_h.m4 serial 9
+dnl Copyright (C) 2007, 2008, 2009, 2010 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.
@@ -14,6 +14,13 @@ AC_DEFUN([gl_SIGNAL_H],
     [HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=0], [[
 #include <signal.h>
     ]])
+  AC_REQUIRE([AC_TYPE_UID_T])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <signal.h>
+    ]], [sigaction sigaddset sigdelset sigemptyset sigfillset sigismember
+    sigpending sigprocmask])
 ])
 
 AC_DEFUN([gl_SIGNAL_MODULE_INDICATOR],
diff --git a/libmissing/m4/signalblocking.m4 b/libmissing/m4/signalblocking.m4
index 82b0404..4459815 100644
--- a/libmissing/m4/signalblocking.m4
+++ b/libmissing/m4/signalblocking.m4
@@ -1,5 +1,5 @@
 # signalblocking.m4 serial 10
-dnl Copyright (C) 2001-2002, 2006-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2002, 2006-2010 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.
diff --git a/libmissing/m4/size_max.m4 b/libmissing/m4/size_max.m4
index 35bd3d6..ce992db 100644
--- a/libmissing/m4/size_max.m4
+++ b/libmissing/m4/size_max.m4
@@ -1,5 +1,5 @@
 # size_max.m4 serial 9
-dnl Copyright (C) 2003, 2005-2006, 2008-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2005-2006, 2008-2010 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.
diff --git a/libmissing/m4/sleep.m4 b/libmissing/m4/sleep.m4
index 474ba07..a5ec655 100644
--- a/libmissing/m4/sleep.m4
+++ b/libmissing/m4/sleep.m4
@@ -1,5 +1,5 @@
-# sleep.m4 serial 2
-dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
+# sleep.m4 serial 3
+dnl Copyright (C) 2007-2010 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.
@@ -13,12 +13,37 @@ AC_DEFUN([gl_FUNC_SLEEP],
   dnl it takes the number of milliseconds as argument and returns void.
   dnl mingw does not declare this function.
   AC_CHECK_DECLS([sleep], , , [#include <unistd.h>])
+  AC_CHECK_FUNCS_ONCE([sleep])
   if test $ac_cv_have_decl_sleep != yes; then
     HAVE_SLEEP=0
     AC_LIBOBJ([sleep])
-    gl_PREREQ_SLEEP
+  else
+    dnl Cygwin 1.5.x has a bug where sleep can't exceed 49.7 days.
+    AC_CACHE_CHECK([for working sleep], [gl_cv_func_sleep_works],
+      [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <errno.h>
+#include <unistd.h>
+#include <signal.h>
+static void
+handle_alarm (int sig)
+{
+  if (sig != SIGALRM)
+    _exit (2);
+}
+]], [[
+    /* Failure to compile this test due to missing alarm is okay,
+       since all such platforms (mingw) also lack sleep.  */
+    unsigned int pentecost = 50 * 24 * 60 * 60; /* 50 days.  */
+    unsigned int remaining;
+    signal (SIGALRM, handle_alarm);
+    alarm (1);
+    remaining = sleep (pentecost);
+    return !(pentecost - 10 < remaining && remaining <= pentecost);]])],
+      [gl_cv_func_sleep_works=yes], [gl_cv_func_sleep_works=no],
+      [gl_cv_func_sleep_works="guessing no"])])
+    if test "$gl_cv_func_sleep_works" != yes; then
+      REPLACE_SLEEP=1
+      AC_LIBOBJ([sleep])
+    fi
   fi
 ])
-
-# Prerequisites of lib/sleep.c.
-AC_DEFUN([gl_PREREQ_SLEEP], [:])
diff --git a/libmissing/m4/snprintf.m4 b/libmissing/m4/snprintf.m4
index 6021786..522b107 100644
--- a/libmissing/m4/snprintf.m4
+++ b/libmissing/m4/snprintf.m4
@@ -1,5 +1,5 @@
 # snprintf.m4 serial 5
-dnl Copyright (C) 2002-2004, 2007-2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2007-2010 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.
diff --git a/libmissing/m4/socklen.m4 b/libmissing/m4/socklen.m4
index b755757..2933d4b 100644
--- a/libmissing/m4/socklen.m4
+++ b/libmissing/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, 2010 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/libmissing/m4/sockpfaf.m4 b/libmissing/m4/sockpfaf.m4
index 99ea06f..8a0c236 100644
--- a/libmissing/m4/sockpfaf.m4
+++ b/libmissing/m4/sockpfaf.m4
@@ -1,5 +1,5 @@
-# sockpfaf.m4 serial 6
-dnl Copyright (C) 2004, 2006, 2009 Free Software Foundation, Inc.
+# sockpfaf.m4 serial 7
+dnl Copyright (C) 2004, 2006, 2009, 2010 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.
@@ -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/libmissing/m4/stdbool.m4 b/libmissing/m4/stdbool.m4
index 57c804a..3d672d7 100644
--- a/libmissing/m4/stdbool.m4
+++ b/libmissing/m4/stdbool.m4
@@ -1,6 +1,6 @@
 # Check for stdbool.h that conforms to C99.
 
-dnl Copyright (C) 2002-2006, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2009-2010 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.
@@ -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/libmissing/m4/stdint.m4 b/libmissing/m4/stdint.m4
index a2e8bdd..1cc57e6 100644
--- a/libmissing/m4/stdint.m4
+++ b/libmissing/m4/stdint.m4
@@ -1,5 +1,5 @@
 # stdint.m4 serial 34
-dnl Copyright (C) 2001-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2010 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.
@@ -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/libmissing/m4/stdint_h.m4 b/libmissing/m4/stdint_h.m4
index 82f0c24..b8e3c6c 100644
--- a/libmissing/m4/stdint_h.m4
+++ b/libmissing/m4/stdint_h.m4
@@ -1,5 +1,5 @@
 # stdint_h.m4 serial 8
-dnl Copyright (C) 1997-2004, 2006, 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1997-2004, 2006, 2008-2010 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.
diff --git a/libmissing/m4/stdio_h.m4 b/libmissing/m4/stdio_h.m4
index fcbe68f..20af579 100644
--- a/libmissing/m4/stdio_h.m4
+++ b/libmissing/m4/stdio_h.m4
@@ -1,5 +1,5 @@
-# stdio_h.m4 serial 16
-dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
+# stdio_h.m4 serial 24
+dnl Copyright (C) 2007-2010 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.
@@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_STDIO_H],
 [
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([AC_C_INLINE])
   gl_CHECK_NEXT_HEADERS([stdio.h])
   dnl No need to create extra modules for these functions. Everyone who uses
   dnl <stdio.h> likely needs them.
@@ -30,6 +31,13 @@ AC_DEFUN([gl_STDIO_H],
       AC_LIBOBJ([stdio-write])
     fi
   ])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, and which is not
+  dnl guaranteed by C89.
+  gl_WARN_ON_USE_PREPARE([[#include <stdio.h>
+    ]], [dprintf fpurge fseeko ftello getdelim getline popen renameat
+    snprintf vdprintf vsnprintf])
 ])
 
 AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
@@ -41,78 +49,85 @@ 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_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 +146,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/libmissing/m4/strdup.m4 b/libmissing/m4/strdup.m4
index d7daac2..3a3b07d 100644
--- a/libmissing/m4/strdup.m4
+++ b/libmissing/m4/strdup.m4
@@ -1,6 +1,6 @@
 # strdup.m4 serial 11
 
-dnl Copyright (C) 2002-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2010 Free Software Foundation, Inc.
 
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
diff --git a/libmissing/m4/strerror.m4 b/libmissing/m4/strerror.m4
index 8c16ca9..1649b24 100644
--- a/libmissing/m4/strerror.m4
+++ b/libmissing/m4/strerror.m4
@@ -1,5 +1,5 @@
 # strerror.m4 serial 9
-dnl Copyright (C) 2002, 2007-2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2007-2010 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.
diff --git a/libmissing/m4/string_h.m4 b/libmissing/m4/string_h.m4
index 11f09c8..73c6d83 100644
--- a/libmissing/m4/string_h.m4
+++ b/libmissing/m4/string_h.m4
@@ -1,11 +1,11 @@
 # Configure a GNU-like replacement for <string.h>.
 
-# Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2007-2010 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.
 
-# serial 7
+# serial 11
 
 # Written by Paul Eggert.
 
@@ -21,6 +21,13 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY],
   AC_REQUIRE([AC_C_RESTRICT])
   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
   gl_CHECK_NEXT_HEADERS([string.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, and which is not
+  dnl guaranteed by C89.
+  gl_WARN_ON_USE_PREPARE([[#include <string.h>
+    ]], [memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup
+    strndup strnlen strpbrk strsep strcasestr strtok_r strsignal strverscmp])
 ])
 
 AC_DEFUN([gl_STRING_MODULE_INDICATOR],
@@ -64,31 +71,34 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
   GNULIB_MBSTOK_R=0;    AC_SUBST([GNULIB_MBSTOK_R])
   GNULIB_STRERROR=0;    AC_SUBST([GNULIB_STRERROR])
   GNULIB_STRSIGNAL=0;   AC_SUBST([GNULIB_STRSIGNAL])
-  GNULIB_STRVERSCMP=0;   AC_SUBST([GNULIB_STRVERSCMP])
+  GNULIB_STRVERSCMP=0;  AC_SUBST([GNULIB_STRVERSCMP])
+  HAVE_MBSLEN=0;        AC_SUBST([HAVE_MBSLEN])
   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/libmissing/m4/strsep.m4 b/libmissing/m4/strsep.m4
index 887d688..fb4d396 100644
--- a/libmissing/m4/strsep.m4
+++ b/libmissing/m4/strsep.m4
@@ -1,5 +1,6 @@
 # strsep.m4 serial 9
-dnl Copyright (C) 2002, 2003, 2004, 2007, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2003, 2004, 2007, 2009, 2010 Free Software Foundation,
+dnl 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.
diff --git a/libmissing/m4/sys_socket_h.m4 b/libmissing/m4/sys_socket_h.m4
index 74e8110..1d47656 100644
--- a/libmissing/m4/sys_socket_h.m4
+++ b/libmissing/m4/sys_socket_h.m4
@@ -1,5 +1,5 @@
-# sys_socket_h.m4 serial 12
-dnl Copyright (C) 2005-2009 Free Software Foundation, Inc.
+# sys_socket_h.m4 serial 14
+dnl Copyright (C) 2005-2010 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.
@@ -66,6 +66,18 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET],
     gl_PREREQ_SYS_H_WINSOCK2
   fi
   AC_SUBST([SYS_SOCKET_H])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+/* Some systems require prerequisite headers.  */
+#include <sys/types.h>
+#if !defined __GLIBC__ && HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#include <sys/select.h>
+    ]], [socket connect accept bind getpeername getsockname getsockopt
+    listen recv send recvfrom sendto setsockopt shutdown accept4])
 ])
 
 AC_DEFUN([gl_PREREQ_SYS_H_SOCKET],
@@ -92,7 +104,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 +152,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/libmissing/m4/sys_time_h.m4 b/libmissing/m4/sys_time_h.m4
index 13ac576..9c16487 100644
--- a/libmissing/m4/sys_time_h.m4
+++ b/libmissing/m4/sys_time_h.m4
@@ -1,6 +1,7 @@
 # Configure a replacement for <sys/time.h>.
+# serial 2
 
-# Copyright (C) 2007 Free Software Foundation, Inc.
+# Copyright (C) 2007, 2009, 2010 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.
@@ -18,6 +19,7 @@ AC_DEFUN([gl_HEADER_SYS_TIME_H],
 AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY],
 [
   AC_REQUIRE([AC_C_RESTRICT])
+  AC_CHECK_HEADERS_ONCE([sys/time.h])
   gl_CHECK_NEXT_HEADERS([sys/time.h])
 
   if test $ac_cv_header_sys_time_h = yes; then
@@ -30,12 +32,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/libmissing/m4/thread.m4 b/libmissing/m4/thread.m4
index 4ad533c..8e79075 100644
--- a/libmissing/m4/thread.m4
+++ b/libmissing/m4/thread.m4
@@ -1,5 +1,5 @@
 # thread.m4 serial 2
-dnl Copyright (C) 2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2008, 2009, 2010 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.
diff --git a/libmissing/m4/threadlib.m4 b/libmissing/m4/threadlib.m4
index 3dd38aa..bba460e 100644
--- a/libmissing/m4/threadlib.m4
+++ b/libmissing/m4/threadlib.m4
@@ -1,5 +1,5 @@
-# threadlib.m4 serial 3 (gettext-0.18)
-dnl Copyright (C) 2005-2009 Free Software Foundation, Inc.
+# threadlib.m4 serial 4 (gettext-0.18)
+dnl Copyright (C) 2005-2010 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.
@@ -52,13 +52,24 @@ AC_HELP_STRING([--disable-threads], [build without multithread safety]),
     [if test -n "$gl_use_threads_default"; then
        gl_use_threads="$gl_use_threads_default"
      else
+changequote(,)dnl
        case "$host_os" in
          dnl Disable multithreading by default on OSF/1, because it interferes
          dnl with fork()/exec(): When msgexec is linked with -lpthread, its
          dnl child process gets an endless segmentation fault inside execvp().
+         dnl Disable multithreading by default on Cygwin 1.5.x, because it has
+         dnl bugs that lead to endless loops or crashes. See
+         dnl <http://cygwin.com/ml/cygwin/2009-08/msg00283.html>.
          osf*) gl_use_threads=no ;;
+         cygwin*)
+               case `uname -r` in
+                 1.[0-5].*) gl_use_threads=no ;;
+                 *)         gl_use_threads=yes ;;
+               esac
+               ;;
          *)    gl_use_threads=yes ;;
        esac
+changequote([,])dnl
      fi
     ])
   if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
diff --git a/libmissing/m4/time_h.m4 b/libmissing/m4/time_h.m4
index d42a635..c00bfae 100644
--- a/libmissing/m4/time_h.m4
+++ b/libmissing/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-2010 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/libmissing/m4/time_r.m4 b/libmissing/m4/time_r.m4
index c871b56..b5938e7 100644
--- a/libmissing/m4/time_r.m4
+++ b/libmissing/m4/time_r.m4
@@ -1,6 +1,7 @@
 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, 2010 Free Software Foundation,
+dnl 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 +18,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/libmissing/m4/unistd_h.m4 b/libmissing/m4/unistd_h.m4
index ff9a4ea..31d31c1 100644
--- a/libmissing/m4/unistd_h.m4
+++ b/libmissing/m4/unistd_h.m4
@@ -1,5 +1,5 @@
-# unistd_h.m4 serial 17
-dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
+# unistd_h.m4 serial 39
+dnl Copyright (C) 2006-2010 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,6 +11,7 @@ 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])
+  AC_REQUIRE([AC_C_INLINE])
 
   gl_CHECK_NEXT_HEADERS([unistd.h])
 
@@ -21,6 +22,24 @@ AC_DEFUN([gl_UNISTD_H],
     HAVE_UNISTD_H=0
   fi
   AC_SUBST([HAVE_UNISTD_H])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <unistd.h>
+/* Some systems declare various items in the wrong headers.  */
+#ifndef __GLIBC__
+# include <fcntl.h>
+# include <stdio.h>
+# include <stdlib.h>
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+#  include <io.h>
+# endif
+#endif
+    ]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat
+    fsync ftruncate getcwd getdomainname getdtablesize getgroups
+    gethostname getlogin getlogin_r getpagesize getusershell setusershell
+    endusershell lchown link linkat lseek pipe2 pread readlink readlinkat
+    rmdir sleep symlink symlinkat unlink unlinkat usleep])
 ])
 
 AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
@@ -35,49 +54,96 @@ 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=0;         AC_SUBST([GNULIB_GETLOGIN])
   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_GETLOGIN=1;        AC_SUBST([HAVE_GETLOGIN])
   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/libmissing/m4/vasnprintf.m4 b/libmissing/m4/vasnprintf.m4
index 3a1d1e0..50a20cc 100644
--- a/libmissing/m4/vasnprintf.m4
+++ b/libmissing/m4/vasnprintf.m4
@@ -1,5 +1,5 @@
 # vasnprintf.m4 serial 29
-dnl Copyright (C) 2002-2004, 2006-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2006-2010 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.
diff --git a/libmissing/m4/vsnprintf.m4 b/libmissing/m4/vsnprintf.m4
index 3b37d46..ed189c2 100644
--- a/libmissing/m4/vsnprintf.m4
+++ b/libmissing/m4/vsnprintf.m4
@@ -1,5 +1,5 @@
 # vsnprintf.m4 serial 5
-dnl Copyright (C) 2002-2004, 2007-2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2007-2010 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.
diff --git a/libmissing/m4/wchar.m4 b/libmissing/m4/wchar.m4
index 2e52a82..e81485d 100644
--- a/libmissing/m4/wchar.m4
+++ b/libmissing/m4/wchar.m4
@@ -1,23 +1,30 @@
 dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
 
-dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2010 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 23
+# wchar.m4 serial 31
 
 AC_DEFUN([gl_WCHAR_H],
 [
   AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
-  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([gl_WCHAR_H_INLINE_OK])
+  dnl Prepare for creating substitute <wchar.h>.
+  dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
+  dnl character support).
+  dnl <wchar.h> is always overridden, because of GNULIB_POSIXCHECK.
+  AC_CHECK_HEADERS_ONCE([wchar.h])
+  gl_CHECK_NEXT_HEADERS([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])
 
   AC_REQUIRE([gt_TYPE_WINT_T])
   if test $gt_cv_c_wint_t = yes; then
@@ -27,29 +34,73 @@ 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
-    WCHAR_H=wchar.h
-  fi
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+/* Some systems require additional headers.  */
+#ifndef __GLIBC__
+# include <stddef.h>
+# include <stdio.h>
+# include <time.h>
+#endif
+#include <wchar.h>
+    ]], [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb
+    wcsrtombs wcsnrtombs wcwidth])
+])
 
-  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
+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
-  AC_SUBST([HAVE_WCHAR_H])
-  gl_CHECK_NEXT_HEADERS([wchar.h])
 ])
 
 dnl Unconditionally enables the replacement of <wchar.h>.
 AC_DEFUN([gl_REPLACE_WCHAR_H],
 [
-  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
-  WCHAR_H=wchar.h
+  dnl This is a no-op, because <wchar.h> is always overridden.
+  :
 ])
 
 AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
@@ -96,5 +147,4 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
   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/libmissing/m4/wchar_t.m4 b/libmissing/m4/wchar_t.m4
index fb27a7f..ed804e6 100644
--- a/libmissing/m4/wchar_t.m4
+++ b/libmissing/m4/wchar_t.m4
@@ -1,5 +1,5 @@
 # wchar_t.m4 serial 3 (gettext-0.18)
-dnl Copyright (C) 2002-2003, 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2003, 2008-2010 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.
diff --git a/libmissing/m4/wint_t.m4 b/libmissing/m4/wint_t.m4
index 47a4363..a6c7d15 100644
--- a/libmissing/m4/wint_t.m4
+++ b/libmissing/m4/wint_t.m4
@@ -1,5 +1,5 @@
 # wint_t.m4 serial 4 (gettext-0.18)
-dnl Copyright (C) 2003, 2007-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2007-2010 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.
diff --git a/libmissing/m4/xsize.m4 b/libmissing/m4/xsize.m4
index 631893c..b653693 100644
--- a/libmissing/m4/xsize.m4
+++ b/libmissing/m4/xsize.m4
@@ -1,5 +1,5 @@
 # xsize.m4 serial 4
-dnl Copyright (C) 2003-2004, 2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2003-2004, 2008-2010 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.
diff --git a/libmissing/m4/yield.m4 b/libmissing/m4/yield.m4
index bbd9199..7a543e4 100644
--- a/libmissing/m4/yield.m4
+++ b/libmissing/m4/yield.m4
@@ -1,5 +1,5 @@
 # yield.m4 serial 2
-dnl Copyright (C) 2005-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2005-2010 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.
diff --git a/libmissing/memchr.c b/libmissing/memchr.c
index 3ea1d5b..1e897cd 100644
--- a/libmissing/memchr.c
+++ b/libmissing/memchr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1996, 1997, 1999, 2000, 2003, 2004, 2006, 2008
+/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2010
    Free Software Foundation, Inc.
 
    Based on strlen implementation by Torbjorn Granlund ([email protected]),
@@ -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/libmissing/memset.c b/libmissing/memset.c
index ad5763e..1ec3d52 100644
--- a/libmissing/memset.c
+++ b/libmissing/memset.c
@@ -1,5 +1,5 @@
 /* memset.c -- set an area of memory to a given value
-   Copyright (C) 1991, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1991, 2003, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/libmissing/netdb.in.h b/libmissing/netdb.in.h
index ce9f237..981a432 100644
--- a/libmissing/netdb.in.h
+++ b/libmissing/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-2010 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 !@HAVE_DECL_FREEADDRINFO@
 /* 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 !@HAVE_DECL_GAI_STRERROR@
@@ -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/libmissing/netinet_in.in.h b/libmissing/netinet_in.in.h
index 8c94f6a..8a86bca 100644
--- a/libmissing/netinet_in.in.h
+++ b/libmissing/netinet_in.in.h
@@ -1,5 +1,5 @@
 /* Substitute for <netinet/in.h>.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/libmissing/pathmax.h b/libmissing/pathmax.h
index a5d4335..c53aa9d 100644
--- a/libmissing/pathmax.h
+++ b/libmissing/pathmax.h
@@ -1,5 +1,6 @@
 /* Define PATH_MAX somehow.  Requires sys/types.h.
-   Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2010 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -28,7 +29,7 @@
 
 # if !defined PATH_MAX && defined _PC_PATH_MAX && defined HAVE_PATHCONF
 #  define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 \
-		    : pathconf ("/", _PC_PATH_MAX))
+                    : pathconf ("/", _PC_PATH_MAX))
 # endif
 
 /* Don't include sys/param.h if it already has been.  */
diff --git a/libmissing/printf-args.c b/libmissing/printf-args.c
index c31d204..597bba9 100644
--- a/libmissing/printf-args.c
+++ b/libmissing/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-2010 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser 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/libmissing/printf-args.h b/libmissing/printf-args.h
index 4c68f11..d76352d 100644
--- a/libmissing/printf-args.h
+++ b/libmissing/printf-args.h
@@ -1,5 +1,6 @@
 /* Decomposed printf argument list.
-   Copyright (C) 1999, 2002-2003, 2006-2007 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2003, 2006-2007, 2009-2010 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -93,42 +94,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/libmissing/printf-parse.c b/libmissing/printf-parse.c
index 85c454b..d88ddf3 100644
--- a/libmissing/printf-parse.c
+++ b/libmissing/printf-parse.c
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999-2000, 2002-2003, 2006-2008 Free Software Foundation, Inc.
+   Copyright (C) 1999-2000, 2002-2003, 2006-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -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/libmissing/printf-parse.h b/libmissing/printf-parse.h
index 0a496cb..2cf965b 100644
--- a/libmissing/printf-parse.h
+++ b/libmissing/printf-parse.h
@@ -1,5 +1,6 @@
 /* Parse printf format string.
-   Copyright (C) 1999, 2002-2003, 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2003, 2005, 2007, 2009-2010 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -26,15 +27,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 +164,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/libmissing/sig-handler.h b/libmissing/sig-handler.h
index 6a3c162..228ff38 100644
--- a/libmissing/sig-handler.h
+++ b/libmissing/sig-handler.h
@@ -1,6 +1,6 @@
 /* Convenience declarations when working with <signal.h>.
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/libmissing/sigaction.c b/libmissing/sigaction.c
index 9727f58..b4b2e59 100644
--- a/libmissing/sigaction.c
+++ b/libmissing/sigaction.c
@@ -1,5 +1,5 @@
 /* POSIX compatible signal blocking.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
    Written by Eric Blake <[email protected]>, 2008.
 
    This program is free software: you can redistribute it and/or modify
@@ -91,7 +91,7 @@ sigaction_handler (int sig)
     {
       /* Unexpected situation; be careful to avoid recursive abort.  */
       if (sig == SIGABRT)
-	signal (SIGABRT, SIG_DFL);
+        signal (SIGABRT, SIG_DFL);
       abort ();
     }
 
diff --git a/libmissing/signal.in.h b/libmissing/signal.in.h
index 6dc922d..3cc6d77 100644
--- a/libmissing/signal.in.h
+++ b/libmissing/signal.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <signal.h>.
 
-   Copyright (C) 2006-2009 Free Software Foundation, Inc.
+   Copyright (C) 2006-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -35,7 +35,9 @@
 #ifndef _GL_SIGNAL_H
 #define _GL_SIGNAL_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 /* Define pid_t, uid_t.
    Also, mingw defines sigset_t not in <signal.h>, but in <sys/types.h>.  */
@@ -50,6 +52,11 @@ typedef int rpl_sig_atomic_t;
 # define sig_atomic_t rpl_sig_atomic_t
 #endif
 
+/* A set or mask of signals.  */
+#if !@HAVE_SIGSET_T@
+typedef unsigned int sigset_t;
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -66,69 +73,103 @@ extern "C" {
 #endif
 
 
-#if !@HAVE_POSIX_SIGNALBLOCKING@
+#if @GNULIB_SIGPROCMASK@
+# if !@HAVE_POSIX_SIGNALBLOCKING@
 
 /* Maximum signal number + 1.  */
-# ifndef NSIG
-#  define NSIG 32
-# endif
+#  ifndef NSIG
+#   define NSIG 32
+#  endif
 
 /* This code supports only 32 signals.  */
 typedef int verify_NSIG_constraint[2 * (NSIG <= 32) - 1];
 
-/* A set or mask of signals.  */
-# if !@HAVE_SIGSET_T@
-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
    combining it with *SET as indicated in OPERATION.
    In this implementation, you are not allowed to change a signal handler
    while the signal is blocked.  */
-# define SIG_BLOCK   0  /* blocked_set = blocked_set | *set; */
-# define SIG_SETMASK 1  /* blocked_set = *set; */
-# define SIG_UNBLOCK 2  /* blocked_set = blocked_set & ~*set; */
+#  define SIG_BLOCK   0  /* blocked_set = blocked_set | *set; */
+#  define SIG_SETMASK 1  /* blocked_set = *set; */
+#  define SIG_UNBLOCK 2  /* blocked_set = blocked_set & ~*set; */
 extern int sigprocmask (int operation, const sigset_t *set, sigset_t *old_set);
 
-# define signal rpl_signal
+#  define signal rpl_signal
 /* Install the handler FUNC for signal SIG, and return the previous
    handler.  */
 extern void (*signal (int sig, void (*func) (int))) (int);
 
-# if GNULIB_defined_SIGPIPE
+#  if GNULIB_defined_SIGPIPE
 
 /* Raise signal SIG.  */
-#  undef raise
-#  define raise rpl_raise
+#   undef raise
+#   define raise rpl_raise
 extern int raise (int sig);
 
-# endif
+#  endif
 
-#endif /* !@HAVE_POSIX_SIGNALBLOCKING@ */
+# endif /* !@HAVE_POSIX_SIGNALBLOCKING@ */
+#elif defined GNULIB_POSIXCHECK
+# undef sigaddset
+# if HAVE_RAW_DECL_SIGADDSET
+_GL_WARN_ON_USE (sigaddset, "sigaddset is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
+# undef sigdelset
+# if HAVE_RAW_DECL_SIGDELSET
+_GL_WARN_ON_USE (sigdelset, "sigdelset is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
+# undef sigemptyset
+# if HAVE_RAW_DECL_SIGEMPTYSET
+_GL_WARN_ON_USE (sigemptyset, "sigemptyset is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
+# undef sigfillset
+# if HAVE_RAW_DECL_SIGFILLSET
+_GL_WARN_ON_USE (sigfillset, "sigfillset is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
+# undef sigismember
+# if HAVE_RAW_DECL_SIGISMEMBER
+_GL_WARN_ON_USE (sigismember, "sigismember is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
+# undef sigpending
+# if HAVE_RAW_DECL_SIGPENDING
+_GL_WARN_ON_USE (sigpending, "sigpending is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
+# undef sigprocmask
+# if HAVE_RAW_DECL_SIGPROCMASK
+_GL_WARN_ON_USE (sigprocmask, "sigprocmask is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
+#endif /* @GNULIB_SIGPROCMASK@ */
 
 
-#if !@HAVE_SIGACTION@
+#if @GNULIB_SIGACTION@
+# if !@HAVE_SIGACTION@
 
-# if !@HAVE_SIGINFO_T@
+#  if !@HAVE_SIGINFO_T@
 /* Present to allow compilation, but unsupported by gnulib.  */
 union sigval
 {
@@ -150,7 +191,7 @@ struct siginfo_t
   union sigval si_value;
 };
 typedef struct siginfo_t siginfo_t;
-# endif /* !@HAVE_SIGINFO_T@ */
+#  endif /* !@HAVE_SIGINFO_T@ */
 
 /* We assume that platforms which lack the sigaction() function also lack
    the 'struct sigaction' type, and vice versa.  */
@@ -170,22 +211,28 @@ struct sigaction
   /* Not all POSIX flags are supported.  */
   int sa_flags;
 };
-# define sa_handler _sa_func._sa_handler
-# define sa_sigaction _sa_func._sa_sigaction
+#  define sa_handler _sa_func._sa_handler
+#  define sa_sigaction _sa_func._sa_sigaction
 /* Unsupported flags are not present.  */
-# define SA_RESETHAND 1
-# define SA_NODEFER 2
-# define SA_RESTART 4
+#  define SA_RESETHAND 1
+#  define SA_NODEFER 2
+#  define SA_RESTART 4
 
 extern int sigaction (int, const struct sigaction *restrict,
                       struct sigaction *restrict);
 
-#elif !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@
-
-# define sa_sigaction sa_handler
+# elif !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@
 
-#endif /* !@HAVE_SIGACTION@, !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@ */
+#  define sa_sigaction sa_handler
 
+# endif /* !@HAVE_SIGACTION@, !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@ */
+#elif defined GNULIB_POSIXCHECK
+# undef sigaction
+# if HAVE_RAW_DECL_SIGACTION
+_GL_WARN_ON_USE (sigaction, "sigaction is unportable - "
+                 "use the gnulib module sigaction for portability");
+# endif
+#endif
 
 /* Some systems don't have SA_NODEFER.  */
 #ifndef SA_NODEFER
diff --git a/libmissing/sigprocmask.c b/libmissing/sigprocmask.c
index b46d4f3..c72294f 100644
--- a/libmissing/sigprocmask.c
+++ b/libmissing/sigprocmask.c
@@ -1,5 +1,5 @@
 /* POSIX compatible signal blocking.
-   Copyright (C) 2006-2008 Free Software Foundation, Inc.
+   Copyright (C) 2006-2010 Free Software Foundation, Inc.
    Written by Bruno Haible <[email protected]>, 2006.
 
    This program is free software: you can redistribute it and/or modify
@@ -72,9 +72,9 @@ ext_signal (int sig, handler_t handler)
     {
     case SIGPIPE:
       {
-	handler_t old_handler = SIGPIPE_handler;
-	SIGPIPE_handler = handler;
-	return old_handler;
+        handler_t old_handler = SIGPIPE_handler;
+        SIGPIPE_handler = handler;
+        return old_handler;
       }
     default: /* System defined signal */
       return signal (sig, handler);
@@ -90,7 +90,7 @@ sigismember (const sigset_t *set, int sig)
     {
       #ifdef SIGABRT_COMPAT
       if (sig == SIGABRT_COMPAT)
-	sig = SIGABRT;
+        sig = SIGABRT;
       #endif
 
       return (*set >> sig) & 1;
@@ -113,7 +113,7 @@ sigaddset (sigset_t *set, int sig)
     {
       #ifdef SIGABRT_COMPAT
       if (sig == SIGABRT_COMPAT)
-	sig = SIGABRT;
+        sig = SIGABRT;
       #endif
 
       *set |= 1U << sig;
@@ -133,7 +133,7 @@ sigdelset (sigset_t *set, int sig)
     {
       #ifdef SIGABRT_COMPAT
       if (sig == SIGABRT_COMPAT)
-	sig = SIGABRT;
+        sig = SIGABRT;
       #endif
 
       *set &= ~(1U << sig);
@@ -204,60 +204,60 @@ sigprocmask (int operation, const sigset_t *set, sigset_t *old_set)
       sigset_t to_block;
 
       switch (operation)
-	{
-	case SIG_BLOCK:
-	  new_blocked_set = blocked_set | *set;
-	  break;
-	case SIG_SETMASK:
-	  new_blocked_set = *set;
-	  break;
-	case SIG_UNBLOCK:
-	  new_blocked_set = blocked_set & ~*set;
-	  break;
-	default:
-	  errno = EINVAL;
-	  return -1;
-	}
+        {
+        case SIG_BLOCK:
+          new_blocked_set = blocked_set | *set;
+          break;
+        case SIG_SETMASK:
+          new_blocked_set = *set;
+          break;
+        case SIG_UNBLOCK:
+          new_blocked_set = blocked_set & ~*set;
+          break;
+        default:
+          errno = EINVAL;
+          return -1;
+        }
       to_unblock = blocked_set & ~new_blocked_set;
       to_block = new_blocked_set & ~blocked_set;
 
       if (to_block != 0)
-	{
-	  int sig;
-
-	  for (sig = 0; sig < NSIG; sig++)
-	    if ((to_block >> sig) & 1)
-	      {
-		pending_array[sig] = 0;
-		if ((old_handlers[sig] = signal (sig, blocked_handler)) != SIG_ERR)
-		  blocked_set |= 1U << sig;
-	      }
-	}
+        {
+          int sig;
+
+          for (sig = 0; sig < NSIG; sig++)
+            if ((to_block >> sig) & 1)
+              {
+                pending_array[sig] = 0;
+                if ((old_handlers[sig] = signal (sig, blocked_handler)) != SIG_ERR)
+                  blocked_set |= 1U << sig;
+              }
+        }
 
       if (to_unblock != 0)
-	{
-	  sig_atomic_t received[NSIG];
-	  int sig;
-
-	  for (sig = 0; sig < NSIG; sig++)
-	    if ((to_unblock >> sig) & 1)
-	      {
-		if (signal (sig, old_handlers[sig]) != blocked_handler)
-		  /* The application changed a signal handler while the signal
-		     was blocked, bypassing our rpl_signal replacement.
-		     We don't support this.  */
-		  abort ();
-		received[sig] = pending_array[sig];
-		blocked_set &= ~(1U << sig);
-		pending_array[sig] = 0;
-	      }
-	    else
-	      received[sig] = 0;
-
-	  for (sig = 0; sig < NSIG; sig++)
-	    if (received[sig])
-	      raise (sig);
-	}
+        {
+          sig_atomic_t received[NSIG];
+          int sig;
+
+          for (sig = 0; sig < NSIG; sig++)
+            if ((to_unblock >> sig) & 1)
+              {
+                if (signal (sig, old_handlers[sig]) != blocked_handler)
+                  /* The application changed a signal handler while the signal
+                     was blocked, bypassing our rpl_signal replacement.
+                     We don't support this.  */
+                  abort ();
+                received[sig] = pending_array[sig];
+                blocked_set &= ~(1U << sig);
+                pending_array[sig] = 0;
+              }
+            else
+              received[sig] = 0;
+
+          for (sig = 0; sig < NSIG; sig++)
+            if (received[sig])
+              raise (sig);
+        }
     }
   return 0;
 }
@@ -274,26 +274,26 @@ rpl_signal (int sig, handler_t handler)
     {
       #ifdef SIGABRT_COMPAT
       if (sig == SIGABRT_COMPAT)
-	sig = SIGABRT;
+        sig = SIGABRT;
       #endif
 
       if (blocked_set & (1U << sig))
-	{
-	  /* POSIX states that sigprocmask and signal are both
-	     async-signal-safe.  This is not true of our
-	     implementation - there is a slight data race where an
-	     asynchronous interrupt on signal A can occur after we
-	     install blocked_handler but before we have updated
-	     old_handlers for signal B, such that handler A can see
-	     stale information if it calls signal(B).  Oh well -
-	     signal handlers really shouldn't try to manipulate the
-	     installed handlers of unrelated signals.  */
-	  handler_t result = old_handlers[sig];
-	  old_handlers[sig] = handler;
-	  return result;
-	}
+        {
+          /* POSIX states that sigprocmask and signal are both
+             async-signal-safe.  This is not true of our
+             implementation - there is a slight data race where an
+             asynchronous interrupt on signal A can occur after we
+             install blocked_handler but before we have updated
+             old_handlers for signal B, such that handler A can see
+             stale information if it calls signal(B).  Oh well -
+             signal handlers really shouldn't try to manipulate the
+             installed handlers of unrelated signals.  */
+          handler_t result = old_handlers[sig];
+          old_handlers[sig] = handler;
+          return result;
+        }
       else
-	return signal (sig, handler);
+        return signal (sig, handler);
     }
   else
     {
@@ -312,15 +312,15 @@ rpl_raise (int sig)
     {
     case SIGPIPE:
       if (blocked_set & (1U << sig))
-	pending_array[sig] = 1;
+        pending_array[sig] = 1;
       else
-	{
-	  handler_t handler = SIGPIPE_handler;
-	  if (handler == SIG_DFL)
-	    exit (128 + SIGPIPE);
-	  else if (handler != SIG_IGN)
-	    (*handler) (sig);
-	}
+        {
+          handler_t handler = SIGPIPE_handler;
+          if (handler == SIG_DFL)
+            exit (128 + SIGPIPE);
+          else if (handler != SIG_IGN)
+            (*handler) (sig);
+        }
       return 0;
     default: /* System defined signal */
       return raise (sig);
diff --git a/libmissing/size_max.h b/libmissing/size_max.h
index 419d73a..381eea1 100644
--- a/libmissing/size_max.h
+++ b/libmissing/size_max.h
@@ -1,5 +1,5 @@
 /* size_max.h -- declare SIZE_MAX through system headers
-   Copyright (C) 2005-2006 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc.
    Written by Simon Josefsson.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/libmissing/snprintf.c b/libmissing/snprintf.c
index c41bff9..4243679 100644
--- a/libmissing/snprintf.c
+++ b/libmissing/snprintf.c
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 2004, 2006-2008 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006-2010 Free Software Foundation, Inc.
    Written by Simon Josefsson and Paul Eggert.
 
    This program is free software; you can redistribute it and/or modify
@@ -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/libmissing/stdbool.in.h b/libmissing/stdbool.in.h
index 3390484..7b681f6 100644
--- a/libmissing/stdbool.in.h
+++ b/libmissing/stdbool.in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2003, 2006-2008 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2003, 2006-2010 Free Software Foundation, Inc.
    Written by Bruno Haible <[email protected]>, 2001.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/libmissing/stdint.in.h b/libmissing/stdint.in.h
index 11a2117..a1162d4 100644
--- a/libmissing/stdint.in.h
+++ b/libmissing/stdint.in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2002, 2004-2009 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2002, 2004-2010 Free Software Foundation, Inc.
    Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
    This file is part of gnulib.
 
@@ -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@, \
-		0@SIG_ATOMIC_T_SUFFIX@)
+                0@SIG_ATOMIC_T_SUFFIX@)
 #define SIG_ATOMIC_MAX  \
    _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
-		0@SIG_ATOMIC_T_SUFFIX@)
+                0@SIG_ATOMIC_T_SUFFIX@)
 
 
 /* size_t limit */
diff --git a/libmissing/stdio-write.c b/libmissing/stdio-write.c
index 8f275ff..61bba92 100644
--- a/libmissing/stdio-write.c
+++ b/libmissing/stdio-write.c
@@ -1,5 +1,5 @@
 /* POSIX compatible FILE stream write function.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008-2010 Free Software Foundation, Inc.
    Written by Bruno Haible <[email protected]>, 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/libmissing/stdio.in.h b/libmissing/stdio.in.h
index ae681fc..5454245 100644
--- a/libmissing/stdio.in.h
+++ b/libmissing/stdio.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <stdio.h>.
 
-   Copyright (C) 2004, 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2007-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -36,232 +36,349 @@
 #ifndef _GL_STDIO_H
 #define _GL_STDIO_H
 
+/* Get va_list.  Needed on many systems, including glibc 2.8.  */
 #include <stdarg.h>
+
 #include <stddef.h>
 
-#if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \
-  || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \
-  || (@GNULIB_GETDELIM@ && !@HAVE_DECL_GETDELIM@) \
-  || (@GNULIB_GETLINE@ && (!@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@))
-/* Get off_t and ssize_t.  */
-# include <sys/types.h>
-#endif
+/* Get off_t and ssize_t.  Needed on many systems, including glibc 2.8.  */
+#include <sys/types.h>
 
 #ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-#  define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
-   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The __-protected variants of the attributes 'format' and 'printf' are
+   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
+   We enable __attribute__ only if these are supported too, because
+   gnulib and libintl do '#define printf __printf__' when they override
+   the 'printf' function.  */
 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __format__ format
-#  define __printf__ printf
+#  define __attribute__(Spec)   /* empty */
 # endif
 #endif
 
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+#if @GNULIB_DPRINTF@
+# if @REPLACE_DPRINTF@
+#  define dprintf rpl_dprintf
+# endif
+# if @REPLACE_DPRINTF@ || !@HAVE_DPRINTF@
+extern int dprintf (int fd, const char *format, ...)
+       __attribute__ ((__format__ (__printf__, 2, 3))) _GL_ARG_NONNULL ((2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef dprintf
+# if HAVE_RAW_DECL_DPRINTF
+_GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
+                 "use gnulib module dprintf for portability");
+# endif
+#endif
+
+#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 fclose
+/* Assume fclose is always declared.  */
+_GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
+                 "use gnulib module fclose for portable POSIX compliance");
+#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
+/* Assume fflush is always declared.  */
+_GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
+                 "use gnulib module fflush for portable POSIX compliance");
+#endif
+
+/* It is very rare that the developer ever has full control of stdin,
+   so any use of gets warrants an unconditional warning.  Assume it is
+   always declared, since it is required by C89.  */
+#undef gets
+_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+
+#if @GNULIB_FOPEN@
+# if @REPLACE_FOPEN@
+#  undef fopen
+#  define fopen rpl_fopen
+extern FILE * fopen (const char *filename, const char *mode)
+     _GL_ARG_NONNULL ((1, 2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fopen
+/* Assume fopen is always declared.  */
+_GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - "
+                 "use gnulib module fopen for portability");
+#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)));
+       __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)));
+       __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)
+/* Assume fprintf is always declared.  */
+_GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - "
+                 "use gnulib module fprintf-posix for portable "
+                 "POSIX compliance");
 #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)));
+#if @GNULIB_FPURGE@
+# if @REPLACE_FPURGE@
+#  define fpurge rpl_fpurge
+# endif
+# if @REPLACE_FPURGE@ || !@HAVE_DECL_FPURGE@
+  /* 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 @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))
+# undef fpurge
+# if HAVE_RAW_DECL_FPURGE
+_GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
+                 "use gnulib module fpurge for portability");
+# endif
 #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__
+#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_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))
+#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_SNPRINTF@
-# if @REPLACE_SNPRINTF@
-#  define snprintf rpl_snprintf
-# endif
-# if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
-extern int snprintf (char *str, size_t size, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 3, 4)));
+#if @GNULIB_FREOPEN@
+# if @REPLACE_FREOPEN@
+#  undef freopen
+#  define freopen rpl_freopen
+extern FILE * freopen (const char *filename, const char *mode, FILE *stream)
+     _GL_ARG_NONNULL ((2, 3));
 # endif
 #elif defined GNULIB_POSIXCHECK
-# undef snprintf
-# define snprintf \
-    (GL_LINK_WARNING ("snprintf is unportable - " \
-                      "use gnulib module snprintf for portability"), \
-     snprintf)
+# undef freopen
+/* Assume freopen is always declared.  */
+_GL_WARN_ON_USE (freopen, "freopen on Win32 platforms is not POSIX compatible - "
+                 "use gnulib module freopen for portability");
+#endif
+
+/* Set up the following warnings, based on which modules are in use.
+   GNU Coding Standards discourage the use of fseek, since it imposes
+   an arbitrary limitation on some 32-bit hosts.  Remember that the
+   fseek module depends on the fseeko module, so we only have three
+   cases to consider:
+
+   1. The developer is not using either module.  Issue a warning under
+   GNULIB_POSIXCHECK for both functions, to remind them that both
+   functions have bugs on some systems.  _GL_NO_LARGE_FILES has no
+   impact on this warning.
+
+   2. The developer is using both modules.  They may be unaware of the
+   arbitrary limitations of fseek, so issue a warning under
+   GNULIB_POSIXCHECK.  On the other hand, they may be using both
+   modules intentionally, so the developer can define
+   _GL_NO_LARGE_FILES in the compilation units where the use of fseek
+   is safe, to silence the warning.
+
+   3. The developer is using the fseeko module, but not fseek.  Gnulib
+   guarantees that fseek will still work around platform bugs in that
+   case, but we presume that the developer is aware of the pitfalls of
+   fseek and was trying to avoid it, so issue a warning even when
+   GNULIB_POSIXCHECK is undefined.  Again, _GL_NO_LARGE_FILES can be
+   defined to silence the warning in particular compilation units.
+
+   Most gnulib clients that perform stream operations should fall into
+   category three.  */
+
+#if @GNULIB_FSEEK@
+# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
+#  define _GL_FSEEK_WARN /* Category 2, above.  */
+#  undef fseek
+# endif
+# if @REPLACE_FSEEK@
+#  undef fseek
+#  define fseek rpl_fseek
+extern int fseek (FILE *fp, long offset, int whence) _GL_ARG_NONNULL ((1));
+# endif
 #endif
 
-#if @GNULIB_VSNPRINTF@
-# if @REPLACE_VSNPRINTF@
-#  define vsnprintf rpl_vsnprintf
+#if @GNULIB_FSEEKO@
+# if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES
+#  define _GL_FSEEK_WARN /* Category 3, above.  */
+#  undef fseek
 # endif
-# if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
-extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 3, 0)));
+# if @REPLACE_FSEEKO@
+/* Provide fseek, fseeko functions that are aware of a preceding
+   fflush(), and which detect pipes.  */
+#  undef fseeko
+#  define fseeko rpl_fseeko
+extern int fseeko (FILE *fp, off_t offset, int whence) _GL_ARG_NONNULL ((1));
+#  if !@GNULIB_FSEEK@
+#   undef fseek
+#   define fseek rpl_fseek
+static inline int _GL_ARG_NONNULL ((1))
+rpl_fseek (FILE *fp, long offset, int whence)
+{
+  return fseeko (fp, offset, whence);
+}
+#  endif
 # 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))
+# define _GL_FSEEK_WARN /* Category 1, above.  */
+# undef fseek
+# undef fseeko
+# if HAVE_RAW_DECL_FSEEKO
+_GL_WARN_ON_USE (fseeko, "fseeko is unportable - "
+                 "use gnulib module fseeko for portability");
+# endif
 #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)
+#ifdef _GL_FSEEK_WARN
+# undef _GL_FSEEK_WARN
+/* Here, either fseek is undefined (but C89 guarantees that it is
+   declared), or it is defined as rpl_fseek (declared above).  */
+_GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB "
+                 "on 32-bit platforms - "
+                 "use fseeko function for handling of large files");
 #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)));
+/* See the comments on fseek/fseeko.  */
+
+#if @GNULIB_FTELL@
+# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
+#  define _GL_FTELL_WARN /* Category 2, above.  */
+#  undef ftell
+# endif
+# if @REPLACE_FTELL@
+#  undef ftell
+#  define ftell rpl_ftell
+extern long ftell (FILE *fp) _GL_ARG_NONNULL ((1));
 # 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
+#if @GNULIB_FTELLO@
+# if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES
+#  define _GL_FTELL_WARN /* Category 3, above.  */
+#  undef ftell
 # endif
-# if @REPLACE_DPRINTF@ || !@HAVE_DPRINTF@
-extern int dprintf (int fd, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 2, 3)));
+# if @REPLACE_FTELLO@
+#  undef ftello
+#  define ftello rpl_ftello
+extern off_t ftello (FILE *fp) _GL_ARG_NONNULL ((1));
+#  if !@GNULIB_FTELL@
+#   undef ftell
+#   define ftell rpl_ftell
+static inline long _GL_ARG_NONNULL ((1))
+rpl_ftell (FILE *f)
+{
+  return ftello (f);
+}
+#  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
-# undef dprintf
-# define dprintf(d,f,a) \
-    (GL_LINK_WARNING ("dprintf is unportable - " \
-                      "use gnulib module dprintf for portability"), \
-     dprintf (d, f, a))
+# define _GL_FTELL_WARN /* Category 1, above.  */
+# undef ftell
+# undef ftello
+# if HAVE_RAW_DECL_FTELLO
+_GL_WARN_ON_USE (ftello, "ftello is unportable - "
+                 "use gnulib module ftello for portability");
+# endif
 #endif
 
-#if @GNULIB_VDPRINTF@
-# if @REPLACE_VDPRINTF@
-#  define vdprintf rpl_vdprintf
-# endif
-# if @REPLACE_VDPRINTF@ || !@HAVE_VDPRINTF@
-extern int vdprintf (int fd, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 2, 0)));
+#ifdef _GL_FTELL_WARN
+# undef _GL_FTELL_WARN
+/* Here, either ftell is undefined (but C89 guarantees that it is
+   declared), or it is defined as rpl_ftell (declared above).  */
+_GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
+                 "on 32-bit platforms - "
+                 "use ftello function for handling of large files");
+#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)
+     _GL_ARG_NONNULL ((1, 4));
+#endif
+
+#if @GNULIB_GETDELIM@
+# if !@HAVE_DECL_GETDELIM@
+/* Read input, up to (and including) the next occurrence of DELIMITER, from
+   STREAM, store it in *LINEPTR (and NUL-terminate it).
+   *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
+   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 getdelim (char **lineptr, size_t *linesize, int delimiter,
+                         FILE *stream)
+     _GL_ARG_NONNULL ((1, 2, 4));
 # 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))
+# undef getdelim
+# if HAVE_RAW_DECL_GETDELIM
+_GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
+                 "use gnulib module getdelim for portability");
+# endif
 #endif
 
-#if @GNULIB_VASPRINTF@
-# if @REPLACE_VASPRINTF@
-#  define asprintf rpl_asprintf
-#  define vasprintf rpl_vasprintf
+#if @GNULIB_GETLINE@
+# if @REPLACE_GETLINE@
+#  undef getline
+#  define getline rpl_getline
 # endif
-# if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@
-  /* 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)));
+# if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@
+/* Read a line, up to (and including) the next newline, from STREAM, store it
+   in *LINEPTR (and NUL-terminate it).
+   *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
+   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)
+     _GL_ARG_NONNULL ((1, 2, 3));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getline
+# if HAVE_RAW_DECL_GETLINE
+_GL_WARN_ON_USE (getline, "getline is unportable - "
+                 "use gnulib module getline for portability");
 # endif
 #endif
 
@@ -278,259 +395,267 @@ extern int vdprintf (int fd, const char *format, va_list args)
      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)));
+    __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)));
+                              va_list args)
+    __attribute__ ((__format__ (__printf__, 2, 0))) _GL_ARG_NONNULL ((1, 2));
 # endif
 #endif
 
-#if @GNULIB_FOPEN@
-# if @REPLACE_FOPEN@
-#  undef fopen
-#  define fopen rpl_fopen
-extern FILE * fopen (const char *filename, const char *mode);
+#if @GNULIB_PERROR@
+# if @REPLACE_PERROR@
+#  define perror rpl_perror
+/* Print a message to standard error, describing the value of ERRNO,
+   (if STRING is not NULL and not empty) prefixed with STRING and ": ",
+   and terminated with a newline.  */
+extern void perror (const char *string);
 # endif
 #elif defined GNULIB_POSIXCHECK
-# undef fopen
-# define fopen(f,m) \
-   (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
-                     "use gnulib module fopen for portability"), \
-    fopen (f, m))
+# undef perror
+/* Assume perror is always declared.  */
+_GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
+                 "use gnulib module perror for portability");
 #endif
 
-#if @GNULIB_FREOPEN@
-# if @REPLACE_FREOPEN@
-#  undef freopen
-#  define freopen rpl_freopen
-extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
+#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 freopen
-# define freopen(f,m,s) \
-   (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
-                     "use gnulib module freopen for portability"), \
-    freopen (f, m, s))
+# undef popen
+# if HAVE_RAW_DECL_POPEN
+_GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
+                 "use gnulib module popen or pipe for more portability");
+# endif
 #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)
+#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 fseeko
-# define fseeko(f,o,w) \
-   (GL_LINK_WARNING ("fseeko is unportable - " \
-                     "use gnulib module fseeko for portability"), \
-    fseeko (f, o, w))
+# undef printf
+/* Assume printf is always declared.  */
+_GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
+                 "use gnulib module printf-posix for portable "
+                 "POSIX compliance");
 #endif
 
-#if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
-extern int rpl_fseek (FILE *fp, long offset, int whence);
-# undef fseek
-# if defined GNULIB_POSIXCHECK
-#  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"), \
-      rpl_fseek (f, o, w))
-# else
-#  define fseek rpl_fseek
-# endif
-#elif defined GNULIB_POSIXCHECK
-# ifndef 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"), \
-      fseek (f, o, w))
-# 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_FTELLO@
-# if @REPLACE_FTELLO@
-#  define ftello rpl_ftello
-extern off_t ftello (FILE *fp);
-#  define ftell(fp) ftello (fp)
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef ftello
-# define ftello(f) \
-   (GL_LINK_WARNING ("ftello is unportable - " \
-                     "use gnulib module ftello for portability"), \
-    ftello (f))
+#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_FTELL@ && @REPLACE_FTELL@
-extern long rpl_ftell (FILE *fp);
-# undef ftell
-# if GNULIB_POSIXCHECK
-#  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"), \
-      rpl_ftell (f))
-# else
-#  define ftell rpl_ftell
+#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
-# ifndef 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"), \
-      ftell (f))
-# endif
+# undef remove
+/* Assume remove is always declared.  */
+_GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - "
+                 "use gnulib module remove for more portability");
 #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);
+#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 fflush
-# define fflush(f) \
-   (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
-                     "use gnulib module fflush for portable " \
-                     "POSIX compliance"), \
-    fflush (f))
+# undef rename
+/* Assume rename is always declared.  */
+_GL_WARN_ON_USE (rename, "rename is buggy on some platforms - "
+                 "use gnulib module rename for more portability");
 #endif
 
-#if @GNULIB_FPURGE@
-# if @REPLACE_FPURGE@
-#  define fpurge rpl_fpurge
+#if @GNULIB_RENAMEAT@
+# if @REPLACE_RENAMEAT@
+#  undef renameat
+#  define renameat rpl_renameat
 # endif
-# if @REPLACE_FPURGE@ || !@HAVE_DECL_FPURGE@
-  /* 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);
+# if !@HAVE_RENAMEAT@ || @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 fpurge
-# define fpurge(f) \
-   (GL_LINK_WARNING ("fpurge is not always present - " \
-                     "use gnulib module fpurge for portability"), \
-    fpurge (f))
+# undef renameat
+# if HAVE_RAW_DECL_RENAMEAT
+_GL_WARN_ON_USE (renameat, "renameat is not portable - "
+                 "use gnulib module renameat for portability");
+# endif
 #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_SNPRINTF@
+# if @REPLACE_SNPRINTF@
+#  define snprintf rpl_snprintf
+# endif
+# if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
+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 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);
+# undef snprintf
+# if HAVE_RAW_DECL_SNPRINTF
+_GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
+                 "use gnulib module snprintf for portability");
+# endif
 #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
+/* Some people would argue that sprintf should be handled like gets
+   (for example, OpenBSD issues a link warning for both functions),
+   since both can cause security holes due to buffer overruns.
+   However, we believe that sprintf can be used safely, and is more
+   efficient than snprintf in those safe cases; and as proof of our
+   belief, we use sprintf in several gnulib modules.  So this header
+   intentionally avoids adding a warning to sprintf except when
+   GNULIB_POSIXCHECK is defined.  */
 
-#if @GNULIB_PUTCHAR@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
-# undef putchar
-# define putchar rpl_putchar
-extern int putchar (int c);
+#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
+/* Assume sprintf is always declared.  */
+_GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
+                 "use gnulib module sprintf-posix for portable "
+                 "POSIX compliance");
 #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);
+#if @GNULIB_VASPRINTF@
+# if @REPLACE_VASPRINTF@
+#  define asprintf rpl_asprintf
+#  define vasprintf rpl_vasprintf
+# endif
+# if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@
+  /* 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_PUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
-# undef puts
-# define puts rpl_puts
-extern int puts (const char *string);
+#if @GNULIB_VDPRINTF@
+# if @REPLACE_VDPRINTF@
+#  define vdprintf rpl_vdprintf
+# endif
+# if @REPLACE_VDPRINTF@ || !@HAVE_VDPRINTF@
+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
+# if HAVE_RAW_DECL_VDPRINTF
+_GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
+                 "use gnulib module vdprintf for portability");
+# endif
 #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);
+#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
+/* Assume vfprintf is always declared.  */
+_GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
+                 "use gnulib module vfprintf-posix for portable "
+                      "POSIX compliance");
 #endif
 
-#if @GNULIB_GETDELIM@
-# if !@HAVE_DECL_GETDELIM@
-/* Read input, up to (and including) the next occurrence of DELIMITER, from
-   STREAM, store it in *LINEPTR (and NUL-terminate it).
-   *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
-   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 getdelim (char **lineptr, size_t *linesize, int delimiter,
-			 FILE *stream);
+#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 getdelim
-# define getdelim(l, s, d, f)					    \
-  (GL_LINK_WARNING ("getdelim is unportable - "			    \
-		    "use gnulib module getdelim for portability"),  \
-   getdelim (l, s, d, f))
+# undef vprintf
+/* Assume vprintf is always declared.  */
+_GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
+                 "use gnulib module vprintf-posix for portable "
+                 "POSIX compliance");
 #endif
 
-#if @GNULIB_GETLINE@
-# if @REPLACE_GETLINE@
-#  undef getline
-#  define getline rpl_getline
+#if @GNULIB_VSNPRINTF@
+# if @REPLACE_VSNPRINTF@
+#  define vsnprintf rpl_vsnprintf
 # endif
-# if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@
-/* Read a line, up to (and including) the next newline, from STREAM, store it
-   in *LINEPTR (and NUL-terminate it).
-   *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
-   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);
+# if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
+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 getline
-# define getline(l, s, f)						\
-  (GL_LINK_WARNING ("getline is unportable - "				\
-		    "use gnulib module getline for portability"),	\
-   getline (l, s, f))
+# undef vsnprintf
+# if HAVE_RAW_DECL_VSNPRINTF
+_GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
+                 "use gnulib module vsnprintf for portability");
+# endif
 #endif
 
-#if @GNULIB_PERROR@
-# if @REPLACE_PERROR@
-#  define perror rpl_perror
-/* Print a message to standard error, describing the value of ERRNO,
-   (if STRING is not NULL and not empty) prefixed with STRING and ": ",
-   and terminated with a newline.  */
-extern void perror (const char *string);
+#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 perror
-# define perror(s) \
-    (GL_LINK_WARNING ("perror is not always POSIX compliant - " \
-                      "use gnulib module perror for portability"), \
-     perror (s))
+# undef vsprintf
+/* Assume vsprintf is always declared.  */
+_GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
+                 "use gnulib module vsprintf-posix for portable "
+                      "POSIX compliance");
 #endif
 
 #ifdef __cplusplus
diff --git a/libmissing/strdup.c b/libmissing/strdup.c
index e4067c0..b442256 100644
--- a/libmissing/strdup.c
+++ b/libmissing/strdup.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1991, 1996, 1997, 1998, 2002, 2003, 2004, 2006, 2007 Free
-   Software Foundation, Inc.
+/* Copyright (C) 1991, 1996, 1997, 1998, 2002, 2003, 2004, 2006, 2007, 2009,
+   2010 Free Software Foundation, Inc.
 
    This file is part of the GNU C Library.
 
diff --git a/libmissing/string.in.h b/libmissing/string.in.h
index fe11425..002088a 100644
--- a/libmissing/string.in.h
+++ b/libmissing/string.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <string.h>.
 
-   Copyright (C) 1995-1996, 2001-2009 Free Software Foundation, Inc.
+   Copyright (C) 1995-1996, 2001-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -28,6 +28,13 @@
 #ifndef _GL_STRING_H
 #define _GL_STRING_H
 
+/* NetBSD 5.0 mis-defines NULL.  */
+#include <stddef.h>
+
+/* MirBSD defines mbslen as a macro.  */
+#if @GNULIB_MBSLEN@ && defined __MirBSD__
+# include <wchar.h>
+#endif
 
 #ifndef __attribute__
 /* This feature is available in gcc versions 2.5 and later.  */
@@ -41,7 +48,9 @@
 #endif
 
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
 #ifdef __cplusplus
@@ -54,14 +63,13 @@ 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
-# define memchr(s,c,n) \
-    (GL_LINK_WARNING ("memchr has platform-specific bugs - " \
-                      "use gnulib module memchr for portability" ), \
-     memchr (s, c, n))
+/* Assume memchr is always declared.  */
+_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
+                 "use gnulib module memchr for portability" );
 #endif
 
 /* Return the first occurrence of NEEDLE in HAYSTACK.  */
@@ -71,16 +79,16 @@ 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
-# define memmem(a,al,b,bl) \
-    (GL_LINK_WARNING ("memmem is unportable and often quadratic - " \
-                      "use gnulib module memmem-simple for portability, " \
-                      "and module memmem for speed" ), \
-     memmem (a, al, b, bl))
+# if HAVE_RAW_DECL_MEMMEM
+_GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - "
+                 "use gnulib module memmem-simple for portability, "
+                 "and module memmem for speed" );
+# endif
 #endif
 
 /* Copy N bytes of SRC to DEST, return pointer to bytes after the
@@ -88,28 +96,29 @@ 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
-# define mempcpy(a,b,n) \
-    (GL_LINK_WARNING ("mempcpy is unportable - " \
-                      "use gnulib module mempcpy for portability"), \
-     mempcpy (a, b, n))
+# if HAVE_RAW_DECL_MEMPCPY
+_GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
+                 "use gnulib module mempcpy for portability");
+# endif
 #endif
 
 /* Search backwards through a block for a byte (specified as an int).  */
 #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
-# define memrchr(a,b,c) \
-    (GL_LINK_WARNING ("memrchr is unportable - " \
-                      "use gnulib module memrchr for portability"), \
-     memrchr (a, b, c))
+# if HAVE_RAW_DECL_MEMRCHR
+_GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
+                 "use gnulib module memrchr for portability");
+# endif
 #endif
 
 /* Find the first occurrence of C in S.  More efficient than
@@ -118,27 +127,28 @@ 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
-# define rawmemchr(a,b) \
-    (GL_LINK_WARNING ("rawmemchr is unportable - " \
-                      "use gnulib module rawmemchr for portability"), \
-     rawmemchr (a, b))
+# if HAVE_RAW_DECL_RAWMEMCHR
+_GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
+                 "use gnulib module rawmemchr for portability");
+# endif
 #endif
 
 /* 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
-# define stpcpy(a,b) \
-    (GL_LINK_WARNING ("stpcpy is unportable - " \
-                      "use gnulib module stpcpy for portability"), \
-     stpcpy (a, b))
+# if HAVE_RAW_DECL_STPCPY
+_GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
+                 "use gnulib module stpcpy for portability");
+# endif
 #endif
 
 /* Copy no more than N bytes of SRC to DST, returning a pointer past the
@@ -147,39 +157,39 @@ 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
-# define stpncpy(a,b,n) \
-    (GL_LINK_WARNING ("stpncpy is unportable - " \
-                      "use gnulib module stpncpy for portability"), \
-     stpncpy (a, b, n))
+# if HAVE_RAW_DECL_STPNCPY
+_GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - "
+                 "use gnulib module stpncpy for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strchr() does not work with multibyte strings if the locale encoding is
    GB18030 and the character to be searched is a digit.  */
 # undef strchr
-# define strchr(s,c) \
-    (GL_LINK_WARNING ("strchr cannot work correctly on character strings " \
-                      "in some multibyte locales - " \
-                      "use mbschr if you care about internationalization"), \
-     strchr (s, c))
+/* Assume strchr is always declared.  */
+_GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings "
+                 "in some multibyte locales - "
+                 "use mbschr if you care about internationalization");
 #endif
 
 /* Find the first occurrence of C in S or the final NUL byte.  */
 #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
-# define strchrnul(a,b) \
-    (GL_LINK_WARNING ("strchrnul is unportable - " \
-                      "use gnulib module strchrnul for portability"), \
-     strchrnul (a, b))
+# if HAVE_RAW_DECL_STRCHRNUL
+_GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
+                 "use gnulib module strchrnul for portability");
+# endif
 #endif
 
 /* Duplicate S, returning an identical malloc'd string.  */
@@ -189,31 +199,31 @@ 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
-# define strdup(a) \
-    (GL_LINK_WARNING ("strdup is unportable - " \
-                      "use gnulib module strdup for portability"), \
-     strdup (a))
+# if HAVE_RAW_DECL_STRDUP
+_GL_WARN_ON_USE (strdup, "strdup is unportable - "
+                 "use gnulib module strdup for portability");
+# endif
 #endif
 
 /* 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
-# define strndup(a,n) \
-    (GL_LINK_WARNING ("strndup is unportable - " \
-                      "use gnulib module strndup for portability"), \
-     strndup (a, n))
+# if HAVE_RAW_DECL_STRNDUP
+_GL_WARN_ON_USE (strndup, "strndup is unportable - "
+                 "use gnulib module strndup for portability");
+# endif
 #endif
 
 /* Find the length (number of bytes) of STRING, but scan at most
@@ -222,14 +232,14 @@ 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
-# define strnlen(a,n) \
-    (GL_LINK_WARNING ("strnlen is unportable - " \
-                      "use gnulib module strnlen for portability"), \
-     strnlen (a, n))
+# if HAVE_RAW_DECL_STRNLEN
+_GL_WARN_ON_USE (strnlen, "strnlen is unportable - "
+                 "use gnulib module strnlen for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
@@ -238,18 +248,17 @@ extern size_t strnlen (char const *__string, size_t __maxlen)
    locale encoding is GB18030 and one of the characters to be searched is a
    digit.  */
 # undef strcspn
-# define strcspn(s,a) \
-    (GL_LINK_WARNING ("strcspn cannot work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbscspn if you care about internationalization"), \
-     strcspn (s, a))
+/* Assume strcspn is always declared.  */
+_GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbscspn if you care about internationalization");
 #endif
 
 /* Find the first occurrence in S of any character in ACCEPT.  */
 #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.
@@ -257,40 +266,36 @@ extern char *strpbrk (char const *__s, char const *__accept)
    locale encoding is GB18030 and one of the characters to be searched is a
    digit.  */
 #  undef strpbrk
-#  define strpbrk(s,a) \
-     (GL_LINK_WARNING ("strpbrk cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbspbrk if you care about internationalization"), \
-      strpbrk (s, a))
+_GL_WARN_ON_USE (strpbrk, "strpbrk cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbspbrk if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strpbrk
-# define strpbrk(s,a) \
-    (GL_LINK_WARNING ("strpbrk is unportable - " \
-                      "use gnulib module strpbrk for portability"), \
-     strpbrk (s, a))
+# if HAVE_RAW_DECL_STRPBRK
+_GL_WARN_ON_USE (strpbrk, "strpbrk is unportable - "
+                 "use gnulib module strpbrk for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strspn() assumes the second argument is a list of single-byte characters.
    Even in this simple case, it cannot work with multibyte strings.  */
 # undef strspn
-# define strspn(s,a) \
-    (GL_LINK_WARNING ("strspn cannot work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbsspn if you care about internationalization"), \
-     strspn (s, a))
+/* Assume strspn is always declared.  */
+_GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbsspn if you care about internationalization");
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strrchr() does not work with multibyte strings if the locale encoding is
    GB18030 and the character to be searched is a digit.  */
 # undef strrchr
-# define strrchr(s,c) \
-    (GL_LINK_WARNING ("strrchr cannot work correctly on character strings " \
-                      "in some multibyte locales - " \
-                      "use mbsrchr if you care about internationalization"), \
-     strrchr (s, c))
+/* Assume strrchr is always declared.  */
+_GL_WARN_ON_USE (strrchr, "strrchr cannot work correctly on character strings "
+                 "in some multibyte locales - "
+                 "use mbsrchr if you care about internationalization");
 #endif
 
 /* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
@@ -311,29 +316,28 @@ 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
-#  define strsep(s,d) \
-     (GL_LINK_WARNING ("strsep cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbssep if you care about internationalization"), \
-      strsep (s, d))
+_GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbssep if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strsep
-# define strsep(s,d) \
-    (GL_LINK_WARNING ("strsep is unportable - " \
-                      "use gnulib module strsep for portability"), \
-     strsep (s, d))
+# if HAVE_RAW_DECL_STRSEP
+_GL_WARN_ON_USE (strsep, "strsep is unportable - "
+                 "use gnulib module strsep for portability");
+# endif
 #endif
 
 #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
@@ -341,13 +345,12 @@ char *strstr (const char *haystack, const char *needle)
    POSIX says that it operates on "strings", and "string" in POSIX is defined
    as a sequence of bytes, not of characters.  */
 # undef strstr
-# define strstr(a,b) \
-    (GL_LINK_WARNING ("strstr is quadratic on many systems, and cannot " \
-                      "work correctly on character strings in most "    \
-                      "multibyte locales - " \
-                      "use mbsstr if you care about internationalization, " \
-                      "or use strstr if you care about speed"), \
-     strstr (a, b))
+/* Assume strstr is always declared.  */
+_GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot "
+                 "work correctly on character strings in most "
+                 "multibyte locales - "
+                 "use mbsstr if you care about internationalization, "
+                 "or use strstr if you care about speed");
 #endif
 
 /* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
@@ -358,31 +361,31 @@ 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:
    It is a glibc extension, and glibc implements it only for unibyte
    locales.  */
 # undef strcasestr
-# define strcasestr(a,b) \
-    (GL_LINK_WARNING ("strcasestr does work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbscasestr if you care about " \
-                      "internationalization, or use c-strcasestr if you want " \
-                      "a locale independent function"), \
-     strcasestr (a, b))
+# if HAVE_RAW_DECL_STRCASESTR
+_GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbscasestr if you care about "
+                 "internationalization, or use c-strcasestr if you want "
+                 "a locale independent function");
+# endif
 #endif
 
 /* 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,24 +400,28 @@ 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@ || defined GNULIB_POSIXCHECK
+#  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
-#  define strtok_r(s,d,p) \
-     (GL_LINK_WARNING ("strtok_r cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbstok_r if you care about internationalization"), \
-      strtok_r (s, d, p))
+_GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbstok_r if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtok_r
-# define strtok_r(s,d,p) \
-    (GL_LINK_WARNING ("strtok_r is unportable - " \
-                      "use gnulib module strtok_r for portability"), \
-     strtok_r (s, d, p))
+# if HAVE_RAW_DECL_STRTOK_R
+_GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
+                 "use gnulib module strtok_r for portability");
+# endif
 #endif
 
 
@@ -424,13 +431,19 @@ 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);
+# ifdef __MirBSD__  /* MirBSD defines mbslen as a macro.  Override it.  */
+#  undef mbslen
+# endif
+# if @HAVE_MBSLEN@  /* AIX, OSF/1, MirBSD define mbslen already in libc.  */
+#  define mbslen rpl_mbslen
+# endif
+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 +452,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 +461,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 +469,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 +480,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 +494,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 +508,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 +518,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 +528,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 +538,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 +548,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 +567,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 +576,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.  */
@@ -578,10 +601,9 @@ extern char *strerror (int);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strerror
-# define strerror(e) \
-    (GL_LINK_WARNING ("strerror is unportable - " \
-                      "use gnulib module strerror to guarantee non-NULL result"), \
-     strerror (e))
+/* Assume strerror is always declared.  */
+_GL_WARN_ON_USE (strerror, "strerror is unportable - "
+                 "use gnulib module strerror to guarantee non-NULL result");
 #endif
 
 #if @GNULIB_STRSIGNAL@
@@ -593,22 +615,22 @@ extern char *strsignal (int __sig);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strsignal
-# define strsignal(a) \
-    (GL_LINK_WARNING ("strsignal is unportable - " \
-                      "use gnulib module strsignal for portability"), \
-     strsignal (a))
+# if HAVE_RAW_DECL_STRSIGNAL
+_GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
+                 "use gnulib module strsignal for portability");
+# endif
 #endif
 
 #if @GNULIB_STRVERSCMP@
 # if !@HAVE_STRVERSCMP@
-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
-# define strverscmp(a, b) \
-    (GL_LINK_WARNING ("strverscmp is unportable - " \
-                      "use gnulib module strverscmp for portability"), \
-     strverscmp (a, b))
+# if HAVE_RAW_DECL_STRVERSCMP
+_GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
+                 "use gnulib module strverscmp for portability");
+# endif
 #endif
 
 
diff --git a/libmissing/strsep.c b/libmissing/strsep.c
index 82809eb..3a200e3 100644
--- a/libmissing/strsep.c
+++ b/libmissing/strsep.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2007, 2009, 2010 Free Software Foundation, Inc.
 
    Written by Yoann Vandoorselaere <[email protected]>.
 
diff --git a/libmissing/sys_socket.in.h b/libmissing/sys_socket.in.h
index 67b926e..20583c0 100644
--- a/libmissing/sys_socket.in.h
+++ b/libmissing/sys_socket.in.h
@@ -1,6 +1,6 @@
 /* Provide a sys/socket header file for systems lacking it (read: MinGW)
    and for systems where it is incomplete.
-   Copyright (C) 2005-2009 Free Software Foundation, Inc.
+   Copyright (C) 2005-2010 Free Software Foundation, Inc.
    Written by Simon Josefsson.
 
    This program is free software; you can redistribute it and/or modify
@@ -43,6 +43,8 @@
 #ifndef _GL_SYS_SOCKET_H
 #define _GL_SYS_SOCKET_H
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 #if !@HAVE_SA_FAMILY_T@
 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
 {
@@ -124,7 +126,7 @@ struct sockaddr_storage
 #  define SHUT_RDWR SD_BOTH
 # endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 # if @HAVE_WINSOCK2_H@
 /* Include headers needed by the emulation code.  */
@@ -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@
@@ -185,33 +187,33 @@ extern int rpl_socket (int, int, int protocol);
 #  define socket socket_used_without_requesting_gnulib_module_socket
 # elif defined GNULIB_POSIXCHECK
 #  undef socket
-#  define socket(d,t,p) \
-     (GL_LINK_WARNING ("socket is not always POSIX compliant - " \
-                       "use gnulib module socket for portability"), \
-      socket (d, t, p))
+#  if HAVE_RAW_DECL_SOCKET
+_GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - "
+                 "use gnulib module socket for portability");
+#  endif
 # endif
 
 # 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
 #  define connect socket_used_without_requesting_gnulib_module_connect
 # elif defined GNULIB_POSIXCHECK
 #  undef connect
-#  define connect(s,a,l) \
-     (GL_LINK_WARNING ("connect is not always POSIX compliant - " \
-                       "use gnulib module connect for portability"), \
-      connect (s, a, l))
+#  if HAVE_RAW_DECL_CONNECT
+_GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - "
+                 "use gnulib module connect for portability");
+#  endif
 # endif
 
 # 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@
@@ -219,84 +221,87 @@ extern int rpl_accept (int, struct sockaddr *, int *);
 #  define accept accept_used_without_requesting_gnulib_module_accept
 # elif defined GNULIB_POSIXCHECK
 #  undef accept
-#  define accept(s,a,l) \
-     (GL_LINK_WARNING ("accept is not always POSIX compliant - " \
-                       "use gnulib module accept for portability"), \
-      accept (s, a, l))
+# if HAVE_RAW_DECL_ACCEPT
+_GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - "
+                 "use gnulib module accept for portability");
+#  endif
 # endif
 
 # 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
 #  define bind bind_used_without_requesting_gnulib_module_bind
 # elif defined GNULIB_POSIXCHECK
 #  undef bind
-#  define bind(s,a,l) \
-     (GL_LINK_WARNING ("bind is not always POSIX compliant - " \
-                       "use gnulib module bind for portability"), \
-      bind (s, a, l))
+#  if HAVE_RAW_DECL_BIND
+_GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - "
+                 "use gnulib module bind for portability");
+#  endif
 # endif
 
 # 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
 #  define getpeername getpeername_used_without_requesting_gnulib_module_getpeername
 # elif defined GNULIB_POSIXCHECK
 #  undef getpeername
-#  define getpeername(s,a,l) \
-     (GL_LINK_WARNING ("getpeername is not always POSIX compliant - " \
-                       "use gnulib module getpeername for portability"), \
-      getpeername (s, a, l))
+#  if HAVE_RAW_DECL_GETPEERNAME
+_GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - "
+                 "use gnulib module getpeername for portability");
+#  endif
 # endif
 
 # 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
 #  define getsockname getsockname_used_without_requesting_gnulib_module_getsockname
 # elif defined GNULIB_POSIXCHECK
 #  undef getsockname
-#  define getsockname(s,a,l) \
-     (GL_LINK_WARNING ("getsockname is not always POSIX compliant - " \
-                       "use gnulib module getsockname for portability"), \
-      getsockname (s, a, l))
+#  if HAVE_RAW_DECL_GETSOCKNAME
+_GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - "
+                 "use gnulib module getsockname for portability");
+#  endif
 # endif
 
 # 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
 #  define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
 # elif defined GNULIB_POSIXCHECK
 #  undef getsockopt
-#  define getsockopt(s,lvl,o,v,l) \
-     (GL_LINK_WARNING ("getsockopt is not always POSIX compliant - " \
-                       "use gnulib module getsockopt for portability"), \
-      getsockopt (s, lvl, o, v, l))
+#  if HAVE_RAW_DECL_GETSOCKOPT
+_GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - "
+                 "use gnulib module getsockopt for portability");
+#  endif
 # endif
 
 # 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@
@@ -304,101 +309,104 @@ extern int rpl_listen (int, int);
 #  define listen listen_used_without_requesting_gnulib_module_listen
 # elif defined GNULIB_POSIXCHECK
 #  undef listen
-#  define listen(s,b) \
-     (GL_LINK_WARNING ("listen is not always POSIX compliant - " \
-                       "use gnulib module listen for portability"), \
-      listen (s, b))
+#  if HAVE_RAW_DECL_LISTEN
+_GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - "
+                 "use gnulib module listen for portability");
+#  endif
 # endif
 
 # 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
 #  define recv recv_used_without_requesting_gnulib_module_recv
 # elif defined GNULIB_POSIXCHECK
 #  undef recv
-#  define recv(s,b,n,f) \
-     (GL_LINK_WARNING ("recv is not always POSIX compliant - " \
-                       "use gnulib module recv for portability"), \
-      recv (s, b, n, f))
+#  if HAVE_RAW_DECL_RECV
+_GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - "
+                 "use gnulib module recv for portability");
+#  endif
 # endif
 
 # 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
 #  define send send_used_without_requesting_gnulib_module_send
 # elif defined GNULIB_POSIXCHECK
 #  undef send
-#  define send(s,b,n,f) \
-     (GL_LINK_WARNING ("send is not always POSIX compliant - " \
-                       "use gnulib module send for portability"), \
-      send (s, b, n, f))
+#  if HAVE_RAW_DECL_SEND
+_GL_WARN_ON_USE (send, "send is not always POSIX compliant - "
+                 "use gnulib module send for portability");
+#  endif
 # endif
 
 # 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
 #  define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
 # elif defined GNULIB_POSIXCHECK
 #  undef recvfrom
-#  define recvfrom(s,b,n,f,a,l) \
-     (GL_LINK_WARNING ("recvfrom is not always POSIX compliant - " \
-                       "use gnulib module recvfrom for portability"), \
-      recvfrom (s, b, n, f, a, l))
+#  if HAVE_RAW_DECL_RECVFROM
+_GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - "
+                 "use gnulib module recvfrom for portability");
+#  endif
 # endif
 
 # 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
 #  define sendto sendto_used_without_requesting_gnulib_module_sendto
 # elif defined GNULIB_POSIXCHECK
 #  undef sendto
-#  define sendto(s,b,n,f,a,l) \
-     (GL_LINK_WARNING ("sendto is not always POSIX compliant - " \
-                       "use gnulib module sendto for portability"), \
-      sendto (s, b, n, f, a, l))
+#  if HAVE_RAW_DECL_SENDTO
+_GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - "
+                 "use gnulib module sendto for portability");
+#  endif
 # endif
 
 # 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
 #  define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
 # elif defined GNULIB_POSIXCHECK
 #  undef setsockopt
-#  define setsockopt(s,lvl,o,v,l) \
-     (GL_LINK_WARNING ("setsockopt is not always POSIX compliant - " \
-                       "use gnulib module setsockopt for portability"), \
-      setsockopt (s, lvl, o, v, l))
+#  if HAVE_RAW_DECL_SETSOCKOPT
+_GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - "
+                 "use gnulib module setsockopt for portability");
+#  endif
 # endif
 
 # 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@
@@ -406,15 +414,15 @@ extern int rpl_shutdown (int, int);
 #  define shutdown shutdown_used_without_requesting_gnulib_module_shutdown
 # elif defined GNULIB_POSIXCHECK
 #  undef shutdown
-#  define shutdown(s,h) \
-     (GL_LINK_WARNING ("shutdown is not always POSIX compliant - " \
-                       "use gnulib module shutdown for portability"), \
-      shutdown (s, h))
+#  if HAVE_RAW_DECL_SHUTDOWN
+_GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
+                 "use gnulib module shutdown for portability");
+#  endif
 # endif
 
 # 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
+# if HAVE_RAW_DECL_ACCEPT4
+_GL_WARN_ON_USE (accept4, "accept4 is unportable - "
+                 "use gnulib module accept4 for portability");
+# endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _GL_SYS_SOCKET_H */
 #endif /* _GL_SYS_SOCKET_H */
diff --git a/libmissing/sys_time.in.h b/libmissing/sys_time.in.h
index 44f9b59..544a725 100644
--- a/libmissing/sys_time.in.h
+++ b/libmissing/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-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser 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/libmissing/tests/Makefile.am b/libmissing/tests/Makefile.am
index 898f6ed..e3aac06 100644
--- a/libmissing/tests/Makefile.am
+++ b/libmissing/tests/Makefile.am
@@ -1,6 +1,6 @@
 ## DO NOT EDIT! GENERATED AUTOMATICALLY!
 ## Process this file with automake to produce Makefile.in.
-# Copyright (C) 2002-2009 Free Software Foundation, Inc.
+# Copyright (C) 2002-2010 Free Software Foundation, Inc.
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
@@ -14,6 +14,7 @@ AUTOMAKE_OPTIONS = 1.5 foreign
 
 SUBDIRS =
 TESTS =
+XFAIL_TESTS =
 TESTS_ENVIRONMENT =
 noinst_PROGRAMS =
 check_PROGRAMS =
@@ -42,6 +43,8 @@ libtests_a_DEPENDENCIES = $(gltests_LIBOBJS)
 EXTRA_libtests_a_SOURCES =
 AM_LIBTOOLFLAGS = --preserve-dup-deps
 
+TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
+
 ## begin gnulib module alignof-tests
 
 TESTS += test-alignof
@@ -60,15 +63,53 @@ EXTRA_DIST += test-alloca-opt.c
 
 ## end   gnulib module alloca-opt-tests
 
+## 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)/./arg-nonnull.h
+	$(AM_V_GEN)rm -f $@-t $@ && \
+	sed -n -e '/GL_ARG_NONNULL/,$$p' \
+	  < $(top_srcdir)/./arg-nonnull.h \
+	  > $@-t && \
+	mv $@-t $@
+MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t
+
+ARG_NONNULL_H=arg-nonnull.h
+
+EXTRA_DIST += $(top_srcdir)/./arg-nonnull.h
+
+## end   gnulib module arg-nonnull
+
 ## begin gnulib module arpa_inet-tests
 
 TESTS += test-arpa_inet
 check_PROGRAMS += test-arpa_inet
-
 EXTRA_DIST += test-arpa_inet.c
 
 ## end   gnulib module arpa_inet-tests
 
+## begin gnulib module binary-io
+
+libtests_a_SOURCES += binary-io.h
+
+## end   gnulib module binary-io
+
+## begin gnulib module binary-io-tests
+
+TESTS += test-binary-io.sh
+check_PROGRAMS += test-binary-io
+
+EXTRA_DIST += test-binary-io.sh test-binary-io.c macros.h
+
+## end   gnulib module binary-io-tests
+
 ## begin gnulib module cond-tests
 
 TESTS += test-cond
@@ -78,6 +119,14 @@ EXTRA_DIST += test-cond.c
 
 ## end   gnulib module cond-tests
 
+## begin gnulib module dup2-tests
+
+TESTS += test-dup2
+check_PROGRAMS += test-dup2
+EXTRA_DIST += test-dup2.c signature.h macros.h
+
+## end   gnulib module dup2-tests
+
 ## begin gnulib module errno-tests
 
 TESTS += test-errno
@@ -87,12 +136,19 @@ EXTRA_DIST += test-errno.c
 
 ## end   gnulib module errno-tests
 
+## begin gnulib module fcntl-h-tests
+
+TESTS += test-fcntl-h
+check_PROGRAMS += test-fcntl-h
+EXTRA_DIST += test-fcntl-h.c
+
+## end   gnulib module fcntl-h-tests
+
 ## begin gnulib module fcntl-tests
 
 TESTS += test-fcntl
 check_PROGRAMS += test-fcntl
-
-EXTRA_DIST += test-fcntl.c
+EXTRA_DIST += test-fcntl.c signature.h macros.h
 
 ## end   gnulib module fcntl-tests
 
@@ -101,20 +157,45 @@ EXTRA_DIST += test-fcntl.c
 TESTS += test-getaddrinfo
 check_PROGRAMS += test-getaddrinfo
 test_getaddrinfo_LDADD = $(LDADD) @GETADDRINFO_LIB@ @LIBINTL@
-
-EXTRA_DIST += test-getaddrinfo.c
+EXTRA_DIST += signature.h test-getaddrinfo.c
 
 ## end   gnulib module getaddrinfo-tests
 
+## begin gnulib module getdtablesize
+
+
+EXTRA_DIST += getdtablesize.c
+
+EXTRA_libtests_a_SOURCES += getdtablesize.c
+
+## end   gnulib module getdtablesize
+
+## begin gnulib module getdtablesize-tests
+
+TESTS += test-getdtablesize
+check_PROGRAMS += test-getdtablesize
+EXTRA_DIST += test-getdtablesize.c signature.h macros.h
+
+## end   gnulib module getdtablesize-tests
+
 ## begin gnulib module gettimeofday-tests
 
 TESTS += test-gettimeofday
 check_PROGRAMS += test-gettimeofday
 
-EXTRA_DIST += test-gettimeofday.c
+EXTRA_DIST += signature.h test-gettimeofday.c
 
 ## end   gnulib module gettimeofday-tests
 
+## begin gnulib module inet_ntop-tests
+
+TESTS += test-inet_ntop
+check_PROGRAMS += test-inet_ntop
+test_inet_ntop_LDADD = $(LDADD) @INET_NTOP_LIB@
+EXTRA_DIST += test-inet_ntop.c signature.h macros.h
+
+## end   gnulib module inet_ntop-tests
+
 ## begin gnulib module intprops
 
 
@@ -131,11 +212,28 @@ EXTRA_DIST += test-lock.c
 
 ## end   gnulib module lock-tests
 
+## begin gnulib module lstat
+
+
+EXTRA_DIST += lstat.c
+
+EXTRA_libtests_a_SOURCES += lstat.c
+
+## end   gnulib module lstat
+
+## begin gnulib module lstat-tests
+
+TESTS += test-lstat
+check_PROGRAMS += test-lstat
+EXTRA_DIST += test-lstat.h test-lstat.c signature.h macros.h
+
+## end   gnulib module lstat-tests
+
 ## begin gnulib module memchr-tests
 
 TESTS += test-memchr
 check_PROGRAMS += test-memchr
-EXTRA_DIST += test-memchr.c zerosize-ptr.h
+EXTRA_DIST += test-memchr.c zerosize-ptr.h signature.h macros.h
 
 ## end   gnulib module memchr-tests
 
@@ -143,7 +241,6 @@ EXTRA_DIST += test-memchr.c zerosize-ptr.h
 
 TESTS += test-netdb
 check_PROGRAMS += test-netdb
-
 EXTRA_DIST += test-netdb.c
 
 ## end   gnulib module netdb-tests
@@ -152,16 +249,39 @@ EXTRA_DIST += test-netdb.c
 
 TESTS += test-netinet_in
 check_PROGRAMS += test-netinet_in
-
 EXTRA_DIST += test-netinet_in.c
 
 ## end   gnulib module netinet_in-tests
 
+## begin gnulib module open
+
+
+EXTRA_DIST += open.c
+
+EXTRA_libtests_a_SOURCES += open.c
+
+## end   gnulib module open
+
+## begin gnulib module open-tests
+
+TESTS += test-open
+check_PROGRAMS += test-open
+EXTRA_DIST += test-open.h test-open.c signature.h macros.h
+
+## end   gnulib module open-tests
+
+## begin gnulib module same-inode
+
+
+EXTRA_DIST += same-inode.h
+
+## end   gnulib module same-inode
+
 ## begin gnulib module sigaction-tests
 
 TESTS += test-sigaction
 check_PROGRAMS += test-sigaction
-EXTRA_DIST += test-sigaction.c
+EXTRA_DIST += test-sigaction.c signature.h macros.h
 
 ## end   gnulib module sigaction-tests
 
@@ -169,7 +289,6 @@ EXTRA_DIST += test-sigaction.c
 
 TESTS += test-signal
 check_PROGRAMS += test-signal
-
 EXTRA_DIST += test-signal.c
 
 ## end   gnulib module signal-tests
@@ -187,8 +306,7 @@ EXTRA_libtests_a_SOURCES += sleep.c
 
 TESTS += test-sleep
 check_PROGRAMS += test-sleep
-
-EXTRA_DIST += test-sleep.c
+EXTRA_DIST += test-sleep.c signature.h macros.h
 
 ## end   gnulib module sleep-tests
 
@@ -197,24 +315,38 @@ EXTRA_DIST += test-sleep.c
 TESTS += test-snprintf
 check_PROGRAMS += test-snprintf
 
-EXTRA_DIST += test-snprintf.c
+EXTRA_DIST += test-snprintf.c signature.h macros.h
 
 ## end   gnulib module snprintf-tests
 
+## begin gnulib module stat-tests
+
+TESTS += test-stat
+check_PROGRAMS += test-stat
+EXTRA_DIST += test-stat.h test-stat.c signature.h macros.h
+
+## end   gnulib module stat-tests
+
 ## begin gnulib module stdbool-tests
 
 TESTS += test-stdbool
 check_PROGRAMS += test-stdbool
-
 EXTRA_DIST += test-stdbool.c
 
 ## end   gnulib module stdbool-tests
 
+## begin gnulib module stddef-tests
+
+TESTS += test-stddef
+check_PROGRAMS += test-stddef
+EXTRA_DIST += test-stddef.c
+
+## end   gnulib module stddef-tests
+
 ## begin gnulib module stdint-tests
 
 TESTS += test-stdint
 check_PROGRAMS += test-stdint
-
 EXTRA_DIST += test-stdint.c
 
 ## end   gnulib module stdint-tests
@@ -223,7 +355,6 @@ EXTRA_DIST += test-stdint.c
 
 TESTS += test-stdio
 check_PROGRAMS += test-stdio
-
 EXTRA_DIST += test-stdio.c
 
 ## end   gnulib module stdio-tests
@@ -241,7 +372,7 @@ EXTRA_libtests_a_SOURCES += strerror.c
 
 TESTS += test-strerror
 check_PROGRAMS += test-strerror
-EXTRA_DIST += test-strerror.c
+EXTRA_DIST += test-strerror.c signature.h macros.h
 
 ## end   gnulib module strerror-tests
 
@@ -249,25 +380,47 @@ EXTRA_DIST += test-strerror.c
 
 TESTS += test-string
 check_PROGRAMS += test-string
-
 EXTRA_DIST += test-string.c
 
 ## end   gnulib module string-tests
 
+## begin gnulib module symlink
+
+
+EXTRA_DIST += symlink.c
+
+EXTRA_libtests_a_SOURCES += symlink.c
+
+## end   gnulib module symlink
+
+## begin gnulib module symlink-tests
+
+TESTS += test-symlink
+check_PROGRAMS += test-symlink
+EXTRA_DIST += test-symlink.h test-symlink.c signature.h macros.h
+
+## end   gnulib module symlink-tests
+
 ## begin gnulib module sys_socket-tests
 
 TESTS += test-sys_socket
 check_PROGRAMS += test-sys_socket
-
 EXTRA_DIST += test-sys_socket.c
 
 ## end   gnulib module sys_socket-tests
 
+## begin gnulib module sys_stat-tests
+
+TESTS += test-sys_stat
+check_PROGRAMS += test-sys_stat
+EXTRA_DIST += test-sys_stat.c
+
+## end   gnulib module sys_stat-tests
+
 ## begin gnulib module sys_time-tests
 
 TESTS += test-sys_time
 check_PROGRAMS += test-sys_time
-
 EXTRA_DIST += test-sys_time.c
 
 ## end   gnulib module sys_time-tests
@@ -276,7 +429,6 @@ EXTRA_DIST += test-sys_time.c
 
 TESTS += test-time
 check_PROGRAMS += test-time
-
 EXTRA_DIST += test-time.c
 
 ## end   gnulib module time-tests
@@ -285,7 +437,6 @@ EXTRA_DIST += test-time.c
 
 TESTS += test-unistd
 check_PROGRAMS += test-unistd
-
 EXTRA_DIST += test-unistd.c
 
 ## end   gnulib module unistd-tests
@@ -295,7 +446,7 @@ EXTRA_DIST += test-unistd.c
 TESTS += test-vasnprintf
 check_PROGRAMS += test-vasnprintf
 
-EXTRA_DIST += test-vasnprintf.c
+EXTRA_DIST += test-vasnprintf.c macros.h
 
 ## end   gnulib module vasnprintf-tests
 
@@ -310,15 +461,33 @@ libtests_a_SOURCES += verify.h
 TESTS += test-vsnprintf
 check_PROGRAMS += test-vsnprintf
 
-EXTRA_DIST += test-vsnprintf.c
+EXTRA_DIST += test-vsnprintf.c signature.h macros.h
 
 ## end   gnulib module vsnprintf-tests
 
+## begin gnulib module warn-on-use
+
+BUILT_SOURCES += warn-on-use.h
+# The warn-on-use.h that gets inserted into generated .h files is the same as
+# build-aux/warn-on-use.h, except that it has the copyright header cut off.
+warn-on-use.h: $(top_srcdir)/./warn-on-use.h
+	$(AM_V_GEN)rm -f $@-t $@ && \
+	sed -n -e '/^.ifndef/,$$p' \
+	  < $(top_srcdir)/./warn-on-use.h \
+	  > $@-t && \
+	mv $@-t $@
+MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t
+
+WARN_ON_USE_H=warn-on-use.h
+
+EXTRA_DIST += $(top_srcdir)/./warn-on-use.h
+
+## end   gnulib module warn-on-use
+
 ## begin gnulib module wchar-tests
 
 TESTS += test-wchar
 check_PROGRAMS += test-wchar
-
 EXTRA_DIST += test-wchar.c
 
 ## end   gnulib module wchar-tests
diff --git a/libmissing/tests/dummy.c b/libmissing/tests/dummy.c
index ccb5c26..0f9a277 100644
--- a/libmissing/tests/dummy.c
+++ b/libmissing/tests/dummy.c
@@ -1,5 +1,5 @@
 /* A dummy file, to prevent empty libraries from breaking builds.
-   Copyright (C) 2004, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2007, 2009, 2010 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
diff --git a/libmissing/tests/glthread/yield.h b/libmissing/tests/glthread/yield.h
index 45e42ab..df61ac4 100644
--- a/libmissing/tests/glthread/yield.h
+++ b/libmissing/tests/glthread/yield.h
@@ -1,5 +1,5 @@
 /* Yielding the processor to other threads and processes.
-   Copyright (C) 2005-2008 Free Software Foundation, Inc.
+   Copyright (C) 2005-2010 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
diff --git a/libmissing/tests/intprops.h b/libmissing/tests/intprops.h
index 002161e..46f4d47 100644
--- a/libmissing/tests/intprops.h
+++ b/libmissing/tests/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, 2010 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/libmissing/tests/sleep.c b/libmissing/tests/sleep.c
index 9c56b9b..213e5bd 100644
--- a/libmissing/tests/sleep.c
+++ b/libmissing/tests/sleep.c
@@ -1,5 +1,5 @@
 /* Pausing execution of the current thread.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
    Written by Bruno Haible <[email protected]>, 2007.
 
    This program is free software: you can redistribute it and/or modify
@@ -20,6 +20,10 @@
 /* Specification.  */
 #include <unistd.h>
 
+#include <limits.h>
+
+#include "verify.h"
+
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 
 # define WIN32_LEAN_AND_MEAN  /* avoid including junk */
@@ -39,7 +43,32 @@ sleep (unsigned int seconds)
   return remaining;
 }
 
-#else
+#elif HAVE_SLEEP
+
+# undef sleep
+
+/* Guarantee unlimited sleep and a reasonable return value.  Cygwin
+   1.5.x rejects attempts to sleep more than 49.7 days (2**32
+   milliseconds), but uses uninitialized memory which results in a
+   garbage answer.  */
+unsigned int
+rpl_sleep (unsigned int seconds)
+{
+  /* This requires int larger than 16 bits.  */
+  verify (UINT_MAX / 49 / 24 / 60 / 60);
+  const unsigned int limit = 49 * 24 * 60 * 60;
+  while (limit < seconds)
+    {
+      unsigned int result;
+      seconds -= limit;
+      result = sleep (limit);
+      if (result)
+        return seconds + result;
+    }
+  return sleep (seconds);
+}
+
+#else /* !HAVE_SLEEP */
 
  #error "Please port gnulib sleep.c to your platform, possibly using usleep() or select(), then report this to bug-gnulib."
 
diff --git a/libmissing/tests/strerror.c b/libmissing/tests/strerror.c
index dfe6c25..b0df778 100644
--- a/libmissing/tests/strerror.c
+++ b/libmissing/tests/strerror.c
@@ -1,6 +1,6 @@
 /* strerror.c --- POSIX compatible system error routine
 
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
@@ -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/libmissing/tests/test-alignof.c b/libmissing/tests/test-alignof.c
index d42bdf5..a8b6d18 100644
--- a/libmissing/tests/test-alignof.c
+++ b/libmissing/tests/test-alignof.c
@@ -1,5 +1,5 @@
 /* Test of <alignof.h>.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 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
diff --git a/libmissing/tests/test-alloca-opt.c b/libmissing/tests/test-alloca-opt.c
index 68d906d..cfbecaf 100644
--- a/libmissing/tests/test-alloca-opt.c
+++ b/libmissing/tests/test-alloca-opt.c
@@ -1,5 +1,5 @@
 /* Test of optional automatic memory allocation.
-   Copyright (C) 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007, 2009, 2010 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
diff --git a/libmissing/tests/test-arpa_inet.c b/libmissing/tests/test-arpa_inet.c
index fc2d8ba..262686a 100644
--- a/libmissing/tests/test-arpa_inet.c
+++ b/libmissing/tests/test-arpa_inet.c
@@ -1,5 +1,5 @@
 /* Test of <arpa/inet.h> substitute.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 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,7 +21,7 @@
 #include <arpa/inet.h>
 
 int
-main ()
+main (void)
 {
   return 0;
 }
diff --git a/libmissing/tests/test-cond.c b/libmissing/tests/test-cond.c
index 4981708..f9ca22a 100644
--- a/libmissing/tests/test-cond.c
+++ b/libmissing/tests/test-cond.c
@@ -1,5 +1,5 @@
 /* Test of condition variables in multithreaded situations.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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
@@ -201,6 +201,7 @@ main ()
 int
 main ()
 {
+  fputs ("Skipping test: multithreading not enabled\n", stderr);
   return 77;
 }
 
diff --git a/libmissing/tests/test-errno.c b/libmissing/tests/test-errno.c
index 4642027..129b236 100644
--- a/libmissing/tests/test-errno.c
+++ b/libmissing/tests/test-errno.c
@@ -1,5 +1,5 @@
 /* Test of <errno.h> substitute.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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
diff --git a/libmissing/tests/test-fcntl.c b/libmissing/tests/test-fcntl.c
index 449984c..71dfb98 100644
--- a/libmissing/tests/test-fcntl.c
+++ b/libmissing/tests/test-fcntl.c
@@ -1,5 +1,5 @@
-/* Test of <fcntl.h> substitute.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+/* Test of fcntl(2).
+   Copyright (C) 2009, 2010 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
@@ -14,22 +14,333 @@
    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 <[email protected]>, 2007.  */
+/* Written by Eric Blake <[email protected]>, 2009.  */
 
 #include <config.h>
 
+/* Specification.  */
 #include <fcntl.h>
 
-/* Check that the various O_* macros are defined.  */
-int o = O_DIRECT | O_DIRECTORY | O_DSYNC | O_NDELAY | O_NOATIME | O_NONBLOCK
-	| O_NOCTTY | O_NOFOLLOW | O_NOLINKS | O_RSYNC | O_SYNC
-	| O_BINARY | O_TEXT;
+#include "signature.h"
+SIGNATURE_CHECK (fcntl, int, (int, int, ...));
 
-/* Check that the various SEEK_* macros are defined.  */
-int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
+/* Helpers.  */
+#include <errno.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <unistd.h>
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+/* Get declarations of the Win32 API functions.  */
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+#endif
+
+#include "binary-io.h"
+#include "macros.h"
+
+/* Use O_CLOEXEC if available, but test works without it.  */
+#ifndef O_CLOEXEC
+# define O_CLOEXEC 0
+#endif
+
+#if !O_BINARY
+# define setmode(f,m) zero ()
+static int zero (void) { return 0; }
+#endif
+
+/* Return true if FD is open.  */
+static bool
+is_open (int fd)
+{
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+  /* On Win32, the initial state of unassigned standard file
+     descriptors is that they are open but point to an
+     INVALID_HANDLE_VALUE, and there is no fcntl.  */
+  return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE;
+#else
+# ifndef F_GETFL
+#  error Please port fcntl to your platform
+# endif
+  return 0 <= fcntl (fd, F_GETFL);
+#endif
+}
+
+/* Return true if FD is open and inheritable across exec/spawn.  */
+static bool
+is_inheritable (int fd)
+{
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+  /* On Win32, the initial state of unassigned standard file
+     descriptors is that they are open but point to an
+     INVALID_HANDLE_VALUE, and there is no fcntl.  */
+  HANDLE h = (HANDLE) _get_osfhandle (fd);
+  DWORD flags;
+  if (h == INVALID_HANDLE_VALUE || GetHandleInformation (h, &flags) == 0)
+    return false;
+  return (flags & HANDLE_FLAG_INHERIT) != 0;
+#else
+# ifndef F_GETFD
+#  error Please port fcntl to your platform
+# endif
+  int i = fcntl (fd, F_GETFD);
+  return 0 <= i && (i & FD_CLOEXEC) == 0;
+#endif
+}
+
+/* Return non-zero if FD is open in the given MODE, which is either
+   O_TEXT or O_BINARY.  */
+static bool
+is_mode (int fd, int mode)
+{
+  int value = setmode (fd, O_BINARY);
+  setmode (fd, value);
+  return mode == value;
+}
+
+/* Since native fcntl can have more supported operations than our
+   replacement is aware of, and since various operations assign
+   different types to the vararg argument, a wrapper around fcntl must
+   be able to pass a vararg of unknown type on through to the original
+   fcntl.  Make sure that this works properly: func1 behaves like the
+   original fcntl interpreting the vararg as an int or a pointer to a
+   struct, and func2 behaves like rpl_fcntl that doesn't know what
+   type to forward.  */
+struct dummy_struct
+{
+  long filler;
+  int value;
+};
+static int
+func1 (int a, ...)
+{
+  va_list arg;
+  int i;
+  va_start (arg, a);
+  if (a < 4)
+    i = va_arg (arg, int);
+  else
+    {
+      struct dummy_struct *s = va_arg (arg, struct dummy_struct *);
+      i = s->value;
+    }
+  va_end (arg);
+  return i;
+}
+static int
+func2 (int a, ...)
+{
+  va_list arg;
+  void *p;
+  va_start (arg, a);
+  p = va_arg (arg, void *);
+  va_end (arg);
+  return func1 (a, p);
+}
+
+/* Ensure that all supported fcntl actions are distinct, and
+   usable in preprocessor expressions.  */
+static void
+check_flags (void)
+{
+  switch (0)
+    {
+    case F_DUPFD:
+#if F_DUPFD
+#endif
+
+    case F_DUPFD_CLOEXEC:
+#if F_DUPFD_CLOEXEC
+#endif
+
+    case F_GETFD:
+#if F_GETFD
+#endif
+
+#ifdef F_SETFD
+    case F_SETFD:
+# if F_SETFD
+# endif
+#endif
+
+#ifdef F_GETFL
+    case F_GETFL:
+# if F_GETFL
+# endif
+#endif
+
+#ifdef F_SETFL
+    case F_SETFL:
+# if F_SETFL
+# endif
+#endif
+
+#ifdef F_GETOWN
+    case F_GETOWN:
+# if F_GETOWN
+# endif
+#endif
+
+#ifdef F_SETOWN
+    case F_SETOWN:
+# if F_SETOWN
+# endif
+#endif
+
+#ifdef F_GETLK
+    case F_GETLK:
+# if F_GETLK
+# endif
+#endif
+
+#ifdef F_SETLK
+    case F_SETLK:
+# if F_SETLK
+# endif
+#endif
+
+#ifdef F_SETLKW
+    case F_SETLKW:
+# if F_SETLKW
+# endif
+#endif
+
+      ;
+    }
+}
 
 int
-main ()
+main (void)
 {
+  const char *file = "test-fcntl.tmp";
+  int fd;
+
+  /* Sanity check that rpl_fcntl is likely to work.  */
+  ASSERT (func2 (1, 2) == 2);
+  ASSERT (func2 (2, -2) == -2);
+  ASSERT (func2 (3, 0x80000000) == 0x80000000);
+  {
+    struct dummy_struct s = { 0L, 4 };
+    ASSERT (func2 (4, &s) == 4);
+  }
+  check_flags ();
+
+  /* Assume std descriptors were provided by invoker, and ignore fds
+     that might have been inherited.  */
+  fd = creat (file, 0600);
+  ASSERT (STDERR_FILENO < fd);
+  close (fd + 1);
+  close (fd + 2);
+
+  /* For F_DUPFD*, the source must be valid.  */
+  errno = 0;
+  ASSERT (fcntl (-1, F_DUPFD, 0) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (fd + 1, F_DUPFD, 0) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (10000000, F_DUPFD, 0) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (-1, F_DUPFD_CLOEXEC, 0) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (fd + 1, F_DUPFD_CLOEXEC, 0) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (10000000, F_DUPFD_CLOEXEC, 0) == -1);
+  ASSERT (errno == EBADF);
+
+  /* For F_DUPFD*, the destination must be valid.  */
+  ASSERT (getdtablesize () < 10000000);
+  errno = 0;
+  ASSERT (fcntl (fd, F_DUPFD, -1) == -1);
+  ASSERT (errno == EINVAL);
+  errno = 0;
+  ASSERT (fcntl (fd, F_DUPFD, 10000000) == -1);
+  ASSERT (errno == EINVAL);
+  ASSERT (getdtablesize () < 10000000);
+  errno = 0;
+  ASSERT (fcntl (fd, F_DUPFD_CLOEXEC, -1) == -1);
+  ASSERT (errno == EINVAL);
+  errno = 0;
+  ASSERT (fcntl (fd, F_DUPFD_CLOEXEC, 10000000) == -1);
+  ASSERT (errno == EINVAL);
+
+  /* For F_DUPFD*, check for correct inheritance, as well as
+     preservation of text vs. binary.  */
+  setmode (fd, O_BINARY);
+  ASSERT (is_open (fd));
+  ASSERT (!is_open (fd + 1));
+  ASSERT (!is_open (fd + 2));
+  ASSERT (is_inheritable (fd));
+  ASSERT (is_mode (fd, O_BINARY));
+
+  ASSERT (fcntl (fd, F_DUPFD, fd) == fd + 1);
+  ASSERT (is_open (fd));
+  ASSERT (is_open (fd + 1));
+  ASSERT (!is_open (fd + 2));
+  ASSERT (is_inheritable (fd + 1));
+  ASSERT (is_mode (fd, O_BINARY));
+  ASSERT (is_mode (fd + 1, O_BINARY));
+  ASSERT (close (fd + 1) == 0);
+
+  ASSERT (fcntl (fd, F_DUPFD_CLOEXEC, fd + 2) == fd + 2);
+  ASSERT (is_open (fd));
+  ASSERT (!is_open (fd + 1));
+  ASSERT (is_open (fd + 2));
+  ASSERT (is_inheritable (fd));
+  ASSERT (!is_inheritable (fd + 2));
+  ASSERT (is_mode (fd, O_BINARY));
+  ASSERT (is_mode (fd + 2, O_BINARY));
+  ASSERT (close (fd) == 0);
+
+  setmode (fd + 2, O_TEXT);
+  ASSERT (fcntl (fd + 2, F_DUPFD, fd + 1) == fd + 1);
+  ASSERT (!is_open (fd));
+  ASSERT (is_open (fd + 1));
+  ASSERT (is_open (fd + 2));
+  ASSERT (is_inheritable (fd + 1));
+  ASSERT (!is_inheritable (fd + 2));
+  ASSERT (is_mode (fd + 1, O_TEXT));
+  ASSERT (is_mode (fd + 2, O_TEXT));
+  ASSERT (close (fd + 1) == 0);
+
+  ASSERT (fcntl (fd + 2, F_DUPFD_CLOEXEC, 0) == fd);
+  ASSERT (is_open (fd));
+  ASSERT (!is_open (fd + 1));
+  ASSERT (is_open (fd + 2));
+  ASSERT (!is_inheritable (fd));
+  ASSERT (!is_inheritable (fd + 2));
+  ASSERT (is_mode (fd, O_TEXT));
+  ASSERT (is_mode (fd + 2, O_TEXT));
+  ASSERT (close (fd + 2) == 0);
+
+  /* Test F_GETFD.  */
+  errno = 0;
+  ASSERT (fcntl (-1, F_GETFD) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (fd + 1, F_GETFD) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (10000000, F_GETFD) == -1);
+  ASSERT (errno == EBADF);
+  {
+    int result = fcntl (fd, F_GETFD);
+    ASSERT (0 <= result);
+    ASSERT ((result & FD_CLOEXEC) == FD_CLOEXEC);
+    ASSERT (dup (fd) == fd + 1);
+    result = fcntl (fd + 1, F_GETFD);
+    ASSERT (0 <= result);
+    ASSERT ((result & FD_CLOEXEC) == 0);
+    ASSERT (close (fd + 1) == 0);
+  }
+
+  /* Cleanup.  */
+  ASSERT (close (fd) == 0);
+  ASSERT (unlink (file) == 0);
+
   return 0;
 }
diff --git a/libmissing/tests/test-getaddrinfo.c b/libmissing/tests/test-getaddrinfo.c
index eeea3f7..bd245b4 100644
--- a/libmissing/tests/test-getaddrinfo.c
+++ b/libmissing/tests/test-getaddrinfo.c
@@ -1,6 +1,6 @@
 /* Test the getaddrinfo module.
 
-   Copyright (C) 2006-2009 Free Software Foundation, Inc.
+   Copyright (C) 2006-2010 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
@@ -18,8 +18,16 @@
 /* Written by Simon Josefsson.  */
 
 #include <config.h>
+
 #include <netdb.h>
 
+#include "signature.h"
+SIGNATURE_CHECK (freeaddrinfo, void, (struct addrinfo *));
+SIGNATURE_CHECK (gai_strerror, char const *, (int));
+SIGNATURE_CHECK (getaddrinfo, int, (char const *, char const *,
+                                    struct addrinfo const *,
+                                    struct addrinfo **));
+
 #include <arpa/inet.h>
 #include <errno.h>
 #include <netinet/in.h>
@@ -44,7 +52,8 @@
 # define EAI_SERVICE 0
 #endif
 
-int simple (char *host, char *service)
+static int
+simple (char const *host, char const *service)
 {
   char buf[BUFSIZ];
   static int skip = 0;
@@ -74,29 +83,31 @@ int simple (char *host, char *service)
   if (res != 0)
     {
       /* EAI_AGAIN is returned if no network is available. Don't fail
-	 the test merely because someone is down the country on their
-	 in-law's farm. */
+         the test merely because someone is down the country on their
+         in-law's farm. */
       if (res == EAI_AGAIN)
-	{
-	  skip++;
-	  fprintf (stderr, "skipping getaddrinfo test: no network?\n");
-	  return 77;
-	}
+        {
+          skip++;
+          fprintf (stderr, "skipping getaddrinfo test: no network?\n");
+          return 77;
+        }
       /* IRIX reports EAI_NONAME for "https".  Don't fail the test
-	 merely because of this.  */
+         merely because of this.  */
       if (res == EAI_NONAME)
-	return 0;
+        return 0;
       /* Solaris reports EAI_SERVICE for "http" and "https".  Don't
-	 fail the test merely because of this.  */
+         fail the test merely because of this.  */
       if (res == EAI_SERVICE)
-	return 0;
+        return 0;
+#ifdef EAI_NODATA
       /* AIX reports EAI_NODATA for "https".  Don't fail the test
-	 merely because of this.  */
+         merely because of this.  */
       if (res == EAI_NODATA)
-	return 0;
+        return 0;
+#endif
       /* Provide details if errno was set.  */
       if (res == EAI_SYSTEM)
-	dbgprintf ("system error: %s\n", strerror (err));
+        dbgprintf ("system error: %s\n", strerror (err));
 
       return 1;
     }
@@ -109,27 +120,27 @@ int simple (char *host, char *service)
       dbgprintf ("\tprotocol %x\n", ai->ai_protocol);
       dbgprintf ("\taddrlen %ld: ", (unsigned long) ai->ai_addrlen);
       dbgprintf ("\tFound %s\n",
-		 inet_ntop (ai->ai_family,
-			    &((struct sockaddr_in *)
-			      ai->ai_addr)->sin_addr,
-			    buf, sizeof (buf) - 1));
+                 inet_ntop (ai->ai_family,
+                            &((struct sockaddr_in *)
+                              ai->ai_addr)->sin_addr,
+                            buf, sizeof (buf) - 1));
       if (ai->ai_canonname)
-	dbgprintf ("\tFound %s...\n", ai->ai_canonname);
+        dbgprintf ("\tFound %s...\n", ai->ai_canonname);
 
       {
-	char ipbuf[BUFSIZ];
-	char portbuf[BUFSIZ];
-
-	res = getnameinfo (ai->ai_addr, ai->ai_addrlen,
-			   ipbuf, sizeof (ipbuf) - 1,
-			   portbuf, sizeof (portbuf) - 1,
-			   NI_NUMERICHOST|NI_NUMERICSERV);
-	dbgprintf ("\t\tgetnameinfo %d: %s\n", res, gai_strerror (res));
-	if (res == 0)
-	  {
-	    dbgprintf ("\t\tip %s\n", ipbuf);
-	    dbgprintf ("\t\tport %s\n", portbuf);
-	  }
+        char ipbuf[BUFSIZ];
+        char portbuf[BUFSIZ];
+
+        res = getnameinfo (ai->ai_addr, ai->ai_addrlen,
+                           ipbuf, sizeof (ipbuf) - 1,
+                           portbuf, sizeof (portbuf) - 1,
+                           NI_NUMERICHOST|NI_NUMERICSERV);
+        dbgprintf ("\t\tgetnameinfo %d: %s\n", res, gai_strerror (res));
+        if (res == 0)
+          {
+            dbgprintf ("\t\tip %s\n", ipbuf);
+            dbgprintf ("\t\tport %s\n", portbuf);
+          }
       }
 
     }
@@ -163,8 +174,8 @@ int main (void)
 
     if (data.wVersion < requested)
       {
-	WSACleanup ();
-	return 2;
+        WSACleanup ();
+        return 2;
       }
   }
 #endif
diff --git a/libmissing/tests/test-gettimeofday.c b/libmissing/tests/test-gettimeofday.c
index 892b188..2a07814 100644
--- a/libmissing/tests/test-gettimeofday.c
+++ b/libmissing/tests/test-gettimeofday.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2007 Free Software Foundation
+ * Copyright (C) 2005, 2007, 2009, 2010 Free Software Foundation, Inc.
  * Written by Jim Meyering.
  *
  * This program is free software: you can redistribute it and/or modify
@@ -18,13 +18,17 @@
 #include <config.h>
 
 #include <sys/time.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (gettimeofday, int, (struct timeval *, void *));
+
 #include <time.h>
 
 #include <stdio.h>
 #include <string.h>
 
 int
-main (int argc, char *argv[])
+main (void)
 {
   time_t t = 0;
   struct tm *lt;
diff --git a/libmissing/tests/test-lock.c b/libmissing/tests/test-lock.c
index 58db085..aaa4cd3 100644
--- a/libmissing/tests/test-lock.c
+++ b/libmissing/tests/test-lock.c
@@ -1,5 +1,5 @@
 /* Test of locking in multithreaded situations.
-   Copyright (C) 2005, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2008, 2009, 2010 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
@@ -441,10 +441,10 @@ once_contender_thread (void *arg)
       gl_lock_unlock (ready_lock[id]);
 
       if (repeat == REPEAT_COUNT)
-	break;
+        break;
 
       dbgprintf ("Contender %p waiting for signal for round %d\n",
-		 gl_thread_self (), repeat);
+                 gl_thread_self (), repeat);
 #if ENABLE_LOCKING
       /* Wait for the signal to go.  */
       gl_rwlock_rdlock (fire_signal[repeat]);
@@ -453,10 +453,10 @@ once_contender_thread (void *arg)
 #else
       /* Wait for the signal to go.  */
       while (fire_signal_state <= repeat)
-	yield ();
+        yield ();
 #endif
       dbgprintf ("Contender %p got the     signal for round %d\n",
-		 gl_thread_self (), repeat);
+                 gl_thread_self (), repeat);
 
       /* Contend for execution.  */
       gl_once (once_control, once_execute);
@@ -497,30 +497,30 @@ test_once (void)
       /* Wait until every thread is ready.  */
       dbgprintf ("Main thread before synchonizing for round %d\n", repeat);
       for (;;)
-	{
-	  int ready_count = 0;
-	  for (i = 0; i < THREAD_COUNT; i++)
-	    {
-	      gl_lock_lock (ready_lock[i]);
-	      ready_count += ready[i];
-	      gl_lock_unlock (ready_lock[i]);
-	    }
-	  if (ready_count == THREAD_COUNT)
-	    break;
-	  yield ();
-	}
+        {
+          int ready_count = 0;
+          for (i = 0; i < THREAD_COUNT; i++)
+            {
+              gl_lock_lock (ready_lock[i]);
+              ready_count += ready[i];
+              gl_lock_unlock (ready_lock[i]);
+            }
+          if (ready_count == THREAD_COUNT)
+            break;
+          yield ();
+        }
       dbgprintf ("Main thread after  synchonizing for round %d\n", repeat);
 
       if (repeat > 0)
-	{
-	  /* Check that exactly one thread executed the once_execute()
-	     function.  */
-	  if (performed != 1)
-	    abort ();
-	}
+        {
+          /* Check that exactly one thread executed the once_execute()
+             function.  */
+          if (performed != 1)
+            abort ();
+        }
 
       if (repeat == REPEAT_COUNT)
-	break;
+        break;
 
       /* Preparation for the next round: Initialize once_control.  */
       memcpy (&once_control, &fresh_once, sizeof (gl_once_t));
@@ -530,11 +530,11 @@ test_once (void)
 
       /* Preparation for the next round: Reset the ready flags.  */
       for (i = 0; i < THREAD_COUNT; i++)
-	{
-	  gl_lock_lock (ready_lock[i]);
-	  ready[i] = 0;
-	  gl_lock_unlock (ready_lock[i]);
-	}
+        {
+          gl_lock_lock (ready_lock[i]);
+          ready[i] = 0;
+          gl_lock_unlock (ready_lock[i]);
+        }
 
       /* Signal all threads simultaneously.  */
       dbgprintf ("Main thread giving signal for round %d\n", repeat);
diff --git a/libmissing/tests/test-memchr.c b/libmissing/tests/test-memchr.c
index 1124f8b..a801614 100644
--- a/libmissing/tests/test-memchr.c
+++ b/libmissing/tests/test-memchr.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2009 Free Software Foundation
+ * Copyright (C) 2008-2010 Free Software Foundation, Inc.
  * Written by Eric Blake and Bruno Haible
  *
  * This program is free software: you can redistribute it and/or modify
@@ -19,29 +19,20 @@
 
 #include <string.h>
 
-#include <stdio.h>
+#include "signature.h"
+SIGNATURE_CHECK (memchr, void *, (void const *, int, size_t));
+
 #include <stdlib.h>
 
 #include "zerosize-ptr.h"
-
-#define ASSERT(expr) \
-  do									     \
-    {									     \
-      if (!(expr))							     \
-	{								     \
-	  fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-	  fflush (stderr);						     \
-	  abort ();							     \
-	}								     \
-    }									     \
-  while (0)
+#include "macros.h"
 
 /* Calculating void * + int is not portable, so this wrapper converts
    to char * to make the tests easier to write.  */
 #define MEMCHR (char *) memchr
 
 int
-main ()
+main (void)
 {
   size_t n = 0x100000;
   char *input = malloc (n);
@@ -76,7 +67,7 @@ main ()
     size_t repeat = 10000;
     for (; repeat > 0; repeat--)
       {
-	ASSERT (MEMCHR (input, 'c', n) == input + 2);
+        ASSERT (MEMCHR (input, 'c', n) == input + 2);
       }
   }
 
@@ -85,12 +76,12 @@ main ()
     int i, j;
     for (i = 0; i < 32; i++)
       {
-	for (j = 0; j < 256; j++)
-	  input[i + j] = j;
-	for (j = 0; j < 256; j++)
-	  {
-	    ASSERT (MEMCHR (input + i, j, 256) == input + i + j);
-	  }
+        for (j = 0; j < 256; j++)
+          input[i + j] = j;
+        for (j = 0; j < 256; j++)
+          {
+            ASSERT (MEMCHR (input + i, j, 256) == input + i + j);
+          }
       }
   }
 
@@ -102,25 +93,23 @@ main ()
 
     if (page_boundary != NULL)
       {
-	int n;
-
-	for (n = 1; n <= 500; n++)
-	  {
-	    char *mem = page_boundary - n;
-	    memset (mem, 'X', n);
-	    ASSERT (MEMCHR (mem, 'U', n) == NULL);
-
-	    {
-	      int i;
-
-	      for (i = 0; i < n; i++)
-		{
-		  mem[i] = 'U';
-		  ASSERT (MEMCHR (mem, 'U', 4000) == mem + i);
-		  mem[i] = 'X';
-		}
-	    }
-	  }
+        for (n = 1; n <= 500; n++)
+          {
+            char *mem = page_boundary - n;
+            memset (mem, 'X', n);
+            ASSERT (MEMCHR (mem, 'U', n) == NULL);
+
+            {
+              size_t i;
+
+              for (i = 0; i < n; i++)
+                {
+                  mem[i] = 'U';
+                  ASSERT (MEMCHR (mem, 'U', 4000) == mem + i);
+                  mem[i] = 'X';
+                }
+            }
+          }
       }
   }
 
diff --git a/libmissing/tests/test-netdb.c b/libmissing/tests/test-netdb.c
index cde9105..5f2bcd4 100644
--- a/libmissing/tests/test-netdb.c
+++ b/libmissing/tests/test-netdb.c
@@ -1,5 +1,5 @@
 /* Test of <netdb.h> substitute.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
diff --git a/libmissing/tests/test-netinet_in.c b/libmissing/tests/test-netinet_in.c
index b195719..af403ed 100644
--- a/libmissing/tests/test-netinet_in.c
+++ b/libmissing/tests/test-netinet_in.c
@@ -1,5 +1,5 @@
 /* Test of <netinet/in.h> substitute.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 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,7 +21,7 @@
 #include <netinet/in.h>
 
 int
-main ()
+main (void)
 {
   return 0;
 }
diff --git a/libmissing/tests/test-sigaction.c b/libmissing/tests/test-sigaction.c
index c06e6f7..73579d9 100644
--- a/libmissing/tests/test-sigaction.c
+++ b/libmissing/tests/test-sigaction.c
@@ -1,5 +1,5 @@
 /* Test of sigaction() function.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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,21 +20,13 @@
 
 #include <signal.h>
 
-#include <stdio.h>
-#include <stdlib.h>
-
-#define ASSERT(expr) \
-  do									     \
-    {									     \
-      if (!(expr))							     \
-        {								     \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);						     \
-          signal (SIGABRT, SIG_DFL);					     \
-          abort ();							     \
-        }								     \
-    }									     \
-  while (0)
+#include "signature.h"
+SIGNATURE_CHECK (sigaction, int, (int, struct sigaction const *,
+                                  struct sigaction *));
+
+#include <stddef.h>
+
+#include "macros.h"
 
 #ifndef SA_NOCLDSTOP
 # define SA_NOCLDSTOP 0
@@ -53,7 +45,7 @@
    provide other flags as extensions, such as SA_RESTORER, that we
    must ignore in this test.  */
 #define MASK_SA_FLAGS (SA_NOCLDSTOP | SA_ONSTACK | SA_RESETHAND | SA_RESTART \
-		       | SA_SIGINFO | SA_NOCLDWAIT | SA_NODEFER)
+                       | SA_SIGINFO | SA_NOCLDWAIT | SA_NODEFER)
 
 /* This test is unsafe in the presence of an asynchronous SIGABRT,
    because we install a signal-handler that is intentionally not
@@ -77,8 +69,8 @@ handler (int sig)
       break;
     case 1:
       /* This assertion fails on glibc-2.3.6 systems with LinuxThreads,
-	 when this program is linked with -lpthread, due to the sigaction()
-	 override in libpthread.so.  */
+         when this program is linked with -lpthread, due to the sigaction()
+         override in libpthread.so.  */
 #if !defined __GLIBC__
       ASSERT (sa.sa_handler == SIG_DFL);
 #endif
@@ -89,7 +81,7 @@ handler (int sig)
 }
 
 int
-main (int argc, char *argv[])
+main (void)
 {
   struct sigaction sa;
   struct sigaction old_sa;
diff --git a/libmissing/tests/test-signal.c b/libmissing/tests/test-signal.c
index 4bc13ab..e4258d3 100644
--- a/libmissing/tests/test-signal.c
+++ b/libmissing/tests/test-signal.c
@@ -1,5 +1,5 @@
 /* Test of <signal.h> substitute.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 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,9 +20,106 @@
 
 #include <signal.h>
 
-volatile sig_atomic_t s;
+/* Check for required types.  */
+struct
+{
+  size_t a;
+  uid_t b;
+  volatile sig_atomic_t c;
+  sigset_t d;
+  pid_t e;
+#if 0
+  /* Not guaranteed by gnulib.  */
+  pthread_t f;
+  struct timespec g;
+#endif
+} s;
 
-int main ()
+int
+main (void)
 {
-  return s;
+  switch (0)
+    {
+      /* The following are guaranteed by C.  */
+    case 0:
+    case SIGABRT:
+    case SIGFPE:
+    case SIGILL:
+    case SIGINT:
+    case SIGSEGV:
+    case SIGTERM:
+      /* The following is guaranteed by gnulib.  */
+#if GNULIB_SIGPIPE || defined SIGPIPE
+    case SIGPIPE:
+#endif
+      /* Ensure no conflict with other standardized names.  */
+#ifdef SIGALRM
+    case SIGALRM:
+#endif
+#ifdef SIGBUS
+    case SIGBUS:
+#endif
+#ifdef SIGCHLD
+    case SIGCHLD:
+#endif
+#ifdef SIGCONT
+    case SIGCONT:
+#endif
+#ifdef SIGHUP
+    case SIGHUP:
+#endif
+#ifdef SIGKILL
+    case SIGKILL:
+#endif
+#ifdef SIGQUIT
+    case SIGQUIT:
+#endif
+#ifdef SIGSTOP
+    case SIGSTOP:
+#endif
+#ifdef SIGTSTP
+    case SIGTSTP:
+#endif
+#ifdef SIGTTIN
+    case SIGTTIN:
+#endif
+#ifdef SIGTTOU
+    case SIGTTOU:
+#endif
+#ifdef SIGUSR1
+    case SIGUSR1:
+#endif
+#ifdef SIGUSR2
+    case SIGUSR2:
+#endif
+#ifdef SIGSYS
+    case SIGSYS:
+#endif
+#ifdef SIGTRAP
+    case SIGTRAP:
+#endif
+#ifdef SIGURG
+    case SIGURG:
+#endif
+#ifdef SIGVTALRM
+    case SIGVTALRM:
+#endif
+#ifdef SIGXCPU
+    case SIGXCPU:
+#endif
+#ifdef SIGXFSZ
+    case SIGXFSZ:
+#endif
+      /* SIGRTMIN and SIGRTMAX need not be compile-time constants.  */
+#if 0
+# ifdef SIGRTMIN
+    case SIGRTMIN:
+# endif
+# ifdef SIGRTMAX
+    case SIGRTMAX:
+# endif
+#endif
+      ;
+    }
+  return s.a + s.b + s.c + s.e;
 }
diff --git a/libmissing/tests/test-sleep.c b/libmissing/tests/test-sleep.c
index ed5a5a0..6878ccf 100644
--- a/libmissing/tests/test-sleep.c
+++ b/libmissing/tests/test-sleep.c
@@ -1,5 +1,5 @@
 /* Test of sleep() function.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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,28 +20,39 @@
 
 #include <unistd.h>
 
-#include <stdio.h>
-#include <stdlib.h>
-
-#define ASSERT(expr) \
-  do									     \
-    {									     \
-      if (!(expr))							     \
-        {								     \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);						     \
-          abort ();							     \
-        }								     \
-    }									     \
-  while (0)
+#include "signature.h"
+SIGNATURE_CHECK (sleep, unsigned int, (unsigned int));
+
+#include <signal.h>
+
+#include "macros.h"
+
+#if HAVE_DECL_ALARM
+static void
+handle_alarm (int sig)
+{
+  if (sig != SIGALRM)
+    _exit (1);
+}
+#endif
 
 int
-main()
+main (void)
 {
   ASSERT (sleep (1) <= 1);
 
   ASSERT (sleep (0) == 0);
 
+#if HAVE_DECL_ALARM
+  {
+    const unsigned int pentecost = 50 * 24 * 60 * 60; /* 50 days.  */
+    unsigned int remaining;
+    signal (SIGALRM, handle_alarm);
+    alarm (1);
+    remaining = sleep (pentecost);
+    ASSERT (pentecost - 10 < remaining && remaining <= pentecost);
+  }
+#endif
+
   return 0;
 }
-
diff --git a/libmissing/tests/test-snprintf.c b/libmissing/tests/test-snprintf.c
index 790c999..62a411b 100644
--- a/libmissing/tests/test-snprintf.c
+++ b/libmissing/tests/test-snprintf.c
@@ -1,5 +1,5 @@
 /* Test of snprintf() function.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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,20 +20,12 @@
 
 #include <stdio.h>
 
-#include <stdlib.h>
+#include "signature.h"
+SIGNATURE_CHECK (snprintf, int, (char *, size_t, char const *, ...));
+
 #include <string.h>
 
-#define ASSERT(expr) \
-  do									     \
-    {									     \
-      if (!(expr))							     \
-        {								     \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);						     \
-          abort ();							     \
-        }								     \
-    }									     \
-  while (0)
+#include "macros.h"
 
 int
 main (int argc, char *argv[])
@@ -47,25 +39,25 @@ main (int argc, char *argv[])
       memcpy (buf, "DEADBEEF", 8);
       retval = snprintf (buf, size, "%d", 12345);
       if (size < 6)
-	{
+        {
 #if CHECK_SNPRINTF_POSIX
-	  ASSERT (retval < 0 || retval >= size);
+          ASSERT (retval < 0 || retval >= size);
 #endif
-	  if (size > 0)
-	    {
-	      ASSERT (memcmp (buf, "12345", size - 1) == 0);
-	      ASSERT (buf[size - 1] == '\0' || buf[size - 1] == '0' + size);
-	    }
+          if (size > 0)
+            {
+              ASSERT (memcmp (buf, "12345", size - 1) == 0);
+              ASSERT (buf[size - 1] == '\0' || buf[size - 1] == '0' + size);
+            }
 #if !CHECK_SNPRINTF_POSIX
-	  if (size > 0)
+          if (size > 0)
 #endif
-	    ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
-	}
+            ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
+        }
       else
-	{
-	  ASSERT (retval == 5);
-	  ASSERT (memcmp (buf, "12345\0EF", 8) == 0);
-	}
+        {
+          ASSERT (retval == 5);
+          ASSERT (memcmp (buf, "12345\0EF", 8) == 0);
+        }
     }
 
   return 0;
diff --git a/libmissing/tests/test-stdbool.c b/libmissing/tests/test-stdbool.c
index 30d5321..560e0e5 100644
--- a/libmissing/tests/test-stdbool.c
+++ b/libmissing/tests/test-stdbool.c
@@ -1,5 +1,5 @@
 /* Test of <stdbool.h> substitute.
-   Copyright (C) 2002-2007 Free Software Foundation, Inc.
+   Copyright (C) 2002-2007, 2009-2010 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
diff --git a/libmissing/tests/test-stdint.c b/libmissing/tests/test-stdint.c
index a2bf42a..9cec2e2 100644
--- a/libmissing/tests/test-stdint.c
+++ b/libmissing/tests/test-stdint.c
@@ -1,5 +1,5 @@
 /* Test of <stdint.h> substitute.
-   Copyright (C) 2006-2008 Free Software Foundation, Inc.
+   Copyright (C) 2006-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -354,7 +354,7 @@ verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0);
 
 
 int
-main ()
+main (void)
 {
   return 0;
 }
diff --git a/libmissing/tests/test-stdio.c b/libmissing/tests/test-stdio.c
index dcfe38d..8710057 100644
--- a/libmissing/tests/test-stdio.c
+++ b/libmissing/tests/test-stdio.c
@@ -1,5 +1,5 @@
 /* Test of <stdio.h> substitute.
-   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2010 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,8 +29,15 @@ int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
    per POSIX 2008.  */
 verify (sizeof NULL == sizeof (void *));
 
+/* Check that the types are all defined.  */
+fpos_t t1;
+off_t t2;
+size_t t3;
+ssize_t t4;
+va_list t5;
+
 int
-main ()
+main (void)
 {
   return 0;
 }
diff --git a/libmissing/tests/test-strerror.c b/libmissing/tests/test-strerror.c
index 3d9814d..11ab7e3 100644
--- a/libmissing/tests/test-strerror.c
+++ b/libmissing/tests/test-strerror.c
@@ -1,5 +1,5 @@
 /* Test of strerror() function.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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,25 +19,17 @@
 
 #include <config.h>
 
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
 
-#define ASSERT(expr) \
-  do									     \
-    {									     \
-      if (!(expr))							     \
-        {								     \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);						     \
-          abort ();							     \
-        }								     \
-    }									     \
-  while (0)
+#include "signature.h"
+SIGNATURE_CHECK (strerror, char *, (int));
+
+#include <errno.h>
+
+#include "macros.h"
 
 int
-main (int argc, char **argv)
+main (void)
 {
   char *str;
 
diff --git a/libmissing/tests/test-string.c b/libmissing/tests/test-string.c
index fe53cd9..019a817 100644
--- a/libmissing/tests/test-string.c
+++ b/libmissing/tests/test-string.c
@@ -1,5 +1,5 @@
 /* Test of <string.h> substitute.
-   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 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
@@ -27,7 +27,7 @@
 verify (sizeof NULL == sizeof (void *));
 
 int
-main ()
+main (void)
 {
   return 0;
 }
diff --git a/libmissing/tests/test-sys_socket.c b/libmissing/tests/test-sys_socket.c
index 3d946a8..badf308 100644
--- a/libmissing/tests/test-sys_socket.c
+++ b/libmissing/tests/test-sys_socket.c
@@ -1,5 +1,5 @@
 /* Test of <sys/socket.h> substitute.
-   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 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
@@ -28,7 +28,7 @@ int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };
 #endif
 
 int
-main ()
+main (void)
 {
   struct sockaddr_storage x;
   sa_family_t i;
@@ -47,7 +47,7 @@ main ()
     }
 
   x.ss_family = 42;
-  i = 4711;
+  i = 42;
 
   return 0;
 }
diff --git a/libmissing/tests/test-sys_time.c b/libmissing/tests/test-sys_time.c
index bae4108..2ab849e 100644
--- a/libmissing/tests/test-sys_time.c
+++ b/libmissing/tests/test-sys_time.c
@@ -1,5 +1,5 @@
 /* Test of <sys/time.h> substitute.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 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
@@ -23,7 +23,7 @@
 struct timeval a;
 
 int
-main ()
+main (void)
 {
   return 0;
 }
diff --git a/libmissing/tests/test-time.c b/libmissing/tests/test-time.c
index 9238ac4..8e250bd 100644
--- a/libmissing/tests/test-time.c
+++ b/libmissing/tests/test-time.c
@@ -1,5 +1,5 @@
 /* Test of <time.h> substitute.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 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,10 +20,16 @@
 
 #include <time.h>
 
+#include "verify.h"
+
 struct timespec a;
 
+/* Check that NULL can be passed through varargs as a pointer type,
+   per POSIX 2008.  */
+verify (sizeof NULL == sizeof (void *));
+
 int
-main ()
+main (void)
 {
   return 0;
 }
diff --git a/libmissing/tests/test-unistd.c b/libmissing/tests/test-unistd.c
index 129367b..ec02eee 100644
--- a/libmissing/tests/test-unistd.c
+++ b/libmissing/tests/test-unistd.c
@@ -1,5 +1,5 @@
 /* Test of <unistd.h> substitute.
-   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 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
@@ -50,7 +50,7 @@ intptr_t t8;
 #endif
 
 int
-main ()
+main (void)
 {
   return 0;
 }
diff --git a/libmissing/tests/test-vasnprintf.c b/libmissing/tests/test-vasnprintf.c
index 2f3f890..e283142 100644
--- a/libmissing/tests/test-vasnprintf.c
+++ b/libmissing/tests/test-vasnprintf.c
@@ -1,5 +1,5 @@
 /* Test of vasnprintf() and asnprintf() functions.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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,21 +21,10 @@
 #include "vasnprintf.h"
 
 #include <stdarg.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
-#define ASSERT(expr) \
-  do									     \
-    {									     \
-      if (!(expr))							     \
-        {								     \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);						     \
-          abort ();							     \
-        }								     \
-    }									     \
-  while (0)
+#include "macros.h"
 
 static char *
 my_asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
@@ -77,10 +66,10 @@ test_vasnprintf ()
       ASSERT (strcmp (result, "12345") == 0);
       ASSERT (length == 5);
       if (size < 6)
-	ASSERT (result != buf);
+        ASSERT (result != buf);
       ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
       if (result != buf)
-	free (result);
+        free (result);
     }
 }
 
@@ -112,10 +101,10 @@ test_asnprintf ()
       ASSERT (strcmp (result, "12345") == 0);
       ASSERT (length == 5);
       if (size < 6)
-	ASSERT (result != buf);
+        ASSERT (result != buf);
       ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
       if (result != buf)
-	free (result);
+        free (result);
     }
 }
 
diff --git a/libmissing/tests/test-vsnprintf.c b/libmissing/tests/test-vsnprintf.c
index 9c1be8d..1bfa554 100644
--- a/libmissing/tests/test-vsnprintf.c
+++ b/libmissing/tests/test-vsnprintf.c
@@ -1,5 +1,5 @@
 /* Test of vsnprintf() function.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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,21 +20,13 @@
 
 #include <stdio.h>
 
+#include "signature.h"
+SIGNATURE_CHECK (vsnprintf, int, (char *, size_t, char const *, va_list));
+
 #include <stdarg.h>
-#include <stdlib.h>
 #include <string.h>
 
-#define ASSERT(expr) \
-  do									     \
-    {									     \
-      if (!(expr))							     \
-        {								     \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);						     \
-          abort ();							     \
-        }								     \
-    }									     \
-  while (0)
+#include "macros.h"
 
 static int
 my_snprintf (char *buf, int size, const char *format, ...)
@@ -60,25 +52,25 @@ main (int argc, char *argv[])
       memcpy (buf, "DEADBEEF", 8);
       retval = my_snprintf (buf, size, "%d", 12345);
       if (size < 6)
-	{
+        {
 #if CHECK_VSNPRINTF_POSIX
-	  ASSERT (retval < 0 || retval >= size);
+          ASSERT (retval < 0 || retval >= size);
 #endif
-	  if (size > 0)
-	    {
-	      ASSERT (memcmp (buf, "12345", size - 1) == 0);
-	      ASSERT (buf[size - 1] == '\0' || buf[size - 1] == '0' + size);
-	    }
+          if (size > 0)
+            {
+              ASSERT (memcmp (buf, "12345", size - 1) == 0);
+              ASSERT (buf[size - 1] == '\0' || buf[size - 1] == '0' + size);
+            }
 #if !CHECK_VSNPRINTF_POSIX
-	  if (size > 0)
+          if (size > 0)
 #endif
-	    ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
-	}
+            ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
+        }
       else
-	{
-	  ASSERT (retval == 5);
-	  ASSERT (memcmp (buf, "12345\0EF", 8) == 0);
-	}
+        {
+          ASSERT (retval == 5);
+          ASSERT (memcmp (buf, "12345\0EF", 8) == 0);
+        }
     }
 
   return 0;
diff --git a/libmissing/tests/test-wchar.c b/libmissing/tests/test-wchar.c
index 19da7d9..2a03d6b 100644
--- a/libmissing/tests/test-wchar.c
+++ b/libmissing/tests/test-wchar.c
@@ -1,5 +1,5 @@
 /* Test of <wchar.h> substitute.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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,12 +20,18 @@
 
 #include <wchar.h>
 
+#include "verify.h"
+
 /* Check that the types wchar_t and wint_t are defined.  */
 wchar_t a = 'c';
 wint_t b = 'x';
 
+/* Check that NULL can be passed through varargs as a pointer type,
+   per POSIX 2008.  */
+verify (sizeof NULL == sizeof (void *));
+
 int
-main ()
+main (void)
 {
   return 0;
 }
diff --git a/libmissing/tests/verify.h b/libmissing/tests/verify.h
index fac53f6..bcd3f5a 100644
--- a/libmissing/tests/verify.h
+++ b/libmissing/tests/verify.h
@@ -1,6 +1,6 @@
 /* Compile-time assert-like macros.
 
-   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2009-2010 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
@@ -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/libmissing/tests/zerosize-ptr.h b/libmissing/tests/zerosize-ptr.h
index a38a2cf..cfab200 100644
--- a/libmissing/tests/zerosize-ptr.h
+++ b/libmissing/tests/zerosize-ptr.h
@@ -1,5 +1,5 @@
 /* Return a pointer to a zero-size object in memory.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 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
@@ -57,11 +57,11 @@ zerosize_ptr (void)
     {
       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)
-	return two_pages + pagesize;
+          && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
+        return two_pages + pagesize;
     }
 #endif
   return NULL;
diff --git a/libmissing/time.in.h b/libmissing/time.in.h
index 7da429a..e5f1a38 100644
--- a/libmissing/time.in.h
+++ b/libmissing/time.in.h
@@ -1,6 +1,6 @@
 /* A more-standard <time.h>.
 
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser 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/libmissing/time_r.c b/libmissing/time_r.c
index 90dcf00..a4f2b4d 100644
--- a/libmissing/time_r.c
+++ b/libmissing/time_r.c
@@ -1,6 +1,6 @@
 /* Reentrant time functions like localtime_r.
 
-   Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/libmissing/unistd.in.h b/libmissing/unistd.in.h
index 2e42c0b..3257251 100644
--- a/libmissing/unistd.in.h
+++ b/libmissing/unistd.in.h
@@ -1,5 +1,5 @@
 /* Substitute for and wrapper around <unistd.h>.
-   Copyright (C) 2003-2009 Free Software Foundation, Inc.
+   Copyright (C) 2003-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -29,62 +29,94 @@
 #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@ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
+     || @GNULIB_PREAD@ || 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.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
 /* OS/2 EMX lacks these macros.  */
@@ -98,6 +130,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,26 +148,25 @@ 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 !@HAVE_CHOWN@ || @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
-# define chown(f,u,g) \
-    (GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \
-                      "doesn't treat a uid or gid of -1 on some systems - " \
-                      "use gnulib module chown for portability"), \
-     chown (f, u, g))
+# if HAVE_RAW_DECL_CHOWN
+_GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
+                 "doesn't treat a uid or gid of -1 on some systems - "
+                 "use gnulib module chown for portability");
+# endif
 #endif
 
 
@@ -137,33 +177,63 @@ 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
 # undef close
-# define close(f) \
-    (GL_LINK_WARNING ("close does not portably work on sockets - " \
-                      "use gnulib module close for portability"), \
-     close (f))
+/* Assume close is always declared.  */
+_GL_WARN_ON_USE (close, "close does not portably work on sockets - "
+                 "use gnulib module close for portability");
+#endif
+
+
+#if @REPLACE_DUP@
+# define dup rpl_dup
+extern int dup (int);
 #endif
 
 
 #if @GNULIB_DUP2@
-# if !@HAVE_DUP2@
+# if @REPLACE_DUP2@
+#  define dup2 rpl_dup2
+# endif
+# if !@HAVE_DUP2@ || @REPLACE_DUP2@
 /* Copy the file descriptor OLDFD into file descriptor NEWFD.  Do nothing if
    NEWFD = OLDFD, otherwise close NEWFD first if it is open.
-   Return 0 if successful, otherwise -1 and errno set.
+   Return newfd if successful, otherwise -1 and errno set.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/dup2.html>.  */
 extern int dup2 (int oldfd, int newfd);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef dup2
-# define dup2(o,n) \
-    (GL_LINK_WARNING ("dup2 is unportable - " \
-                      "use gnulib module dup2 for portability"), \
-     dup2 (o, n))
+# if HAVE_RAW_DECL_DUP2
+_GL_WARN_ON_USE (dup2, "dup2 is unportable - "
+                 "use gnulib module dup2 for portability");
+# endif
+#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
+# if HAVE_RAW_DECL_DUP3
+_GL_WARN_ON_USE (dup3, "dup3 is unportable - "
+                 "use gnulib module dup3 for portability");
+# endif
 #endif
 
 
@@ -179,32 +249,51 @@ extern char **environ;
 #  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
-# undef environ
-# define environ \
-    (GL_LINK_WARNING ("environ is unportable - " \
-                      "use gnulib module environ for portability"), \
-     environ)
+# if HAVE_RAW_DECL_ENVIRON
+static inline char ***
+rpl_environ (void)
+{
+  return &environ;
+}
+_GL_WARN_ON_USE (rpl_environ, "environ is unportable - "
+                 "use gnulib module environ for portability");
+#  undef environ
+#  define environ (*rpl_environ ())
+# endif
 #endif
 
 
 #if @GNULIB_EUIDACCESS@
 # if !@HAVE_EUIDACCESS@
-/* 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
-# define euidaccess(f,m) \
-    (GL_LINK_WARNING ("euidaccess is unportable - " \
-                      "use gnulib module euidaccess for portability"), \
-     euidaccess (f, m))
+# if HAVE_RAW_DECL_EUIDACCESS
+_GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
+                 "use gnulib module euidaccess for portability");
+# endif
+#endif
+
+
+#if @GNULIB_FACCESSAT@
+# if !@HAVE_FACCESSAT@
+extern int faccessat (int fd, char const *file, int mode, int flag)
+     _GL_ARG_NONNULL ((2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef faccessat
+# if HAVE_RAW_DECL_FACCESSAT
+_GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
+                 "use gnulib module faccessat for portability");
+# endif
 #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.
@@ -212,18 +301,38 @@ 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);
-#  define dup2 rpl_dup2
-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
 # undef fchdir
-# define fchdir(f) \
-    (GL_LINK_WARNING ("fchdir is unportable - " \
-                      "use gnulib module fchdir for portability"), \
-     fchdir (f))
+# if HAVE_RAW_DECL_FCHDIR
+_GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
+                 "use gnulib module fchdir for portability");
+# endif
+#endif
+
+
+#if @GNULIB_FCHOWNAT@
+# if @REPLACE_FCHOWNAT@
+#  undef fchownat
+#  define fchownat rpl_fchownat
+# endif
+# if !@HAVE_FCHOWNAT@ || @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
+# if HAVE_RAW_DECL_FCHOWNAT
+_GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
@@ -237,10 +346,10 @@ extern int fsync (int fd);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fsync
-# define fsync(fd) \
-    (GL_LINK_WARNING ("fsync is unportable - " \
-                      "use gnulib module fsync for portability"), \
-     fsync (fd))
+# if HAVE_RAW_DECL_FSYNC
+_GL_WARN_ON_USE (fsync, "fsync is unportable - "
+                 "use gnulib module fsync for portability");
+# endif
 #endif
 
 
@@ -254,17 +363,14 @@ extern int ftruncate (int fd, off_t length);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef ftruncate
-# define ftruncate(f,l) \
-    (GL_LINK_WARNING ("ftruncate is unportable - " \
-                      "use gnulib module ftruncate for portability"), \
-     ftruncate (f, l))
+# if HAVE_RAW_DECL_FTRUNCATE
+_GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
+                 "use gnulib module ftruncate for portability");
+# endif
 #endif
 
 
 #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.
@@ -281,10 +387,10 @@ extern char * getcwd (char *buf, size_t size);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getcwd
-# define getcwd(b,s) \
-    (GL_LINK_WARNING ("getcwd is unportable - " \
-                      "use gnulib module getcwd for portability"), \
-     getcwd (b, s))
+# if HAVE_RAW_DECL_GETCWD
+_GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
+                 "use gnulib module getcwd for portability");
+# endif
 #endif
 
 
@@ -300,28 +406,51 @@ 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 !@HAVE_GETDOMAINNAME@
-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
-# define getdomainname(n,l) \
-    (GL_LINK_WARNING ("getdomainname is unportable - " \
-                      "use gnulib module getdomainname for portability"), \
-     getdomainname (n, l))
+# if HAVE_RAW_DECL_GETDOMAINNAME
+_GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
+                 "use gnulib module getdomainname for portability");
+# endif
 #endif
 
 
 #if @GNULIB_GETDTABLESIZE@
 # if !@HAVE_GETDTABLESIZE@
-/* 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
 # undef getdtablesize
-# define getdtablesize() \
-    (GL_LINK_WARNING ("getdtablesize is unportable - " \
-                      "use gnulib module getdtablesize for portability"), \
-     getdtablesize ())
+# if HAVE_RAW_DECL_GETDTABLESIZE
+_GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
+                 "use gnulib module getdtablesize for portability");
+# endif
+#endif
+
+
+#if @GNULIB_GETGROUPS@
+# if @REPLACE_GETGROUPS@
+#  undef getgroups
+#  define getgroups rpl_getgroups
+# endif
+# if !@HAVE_GETGROUPS@ || @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
+# if HAVE_RAW_DECL_GETGROUPS
+_GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
+                 "use gnulib module getgroups for portability");
+# endif
 #endif
 
 
@@ -338,17 +467,40 @@ extern int getdtablesize (void);
 #  define gethostname rpl_gethostname
 # endif
 # if @UNISTD_H_HAVE_WINSOCK2_H@ || !@HAVE_GETHOSTNAME@
-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
 # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
 #elif defined GNULIB_POSIXCHECK
 # undef gethostname
-# define gethostname(n,l) \
-    (GL_LINK_WARNING ("gethostname is unportable - " \
-                      "use gnulib module gethostname for portability"), \
-     gethostname (n, l))
+# if HAVE_RAW_DECL_GETHOSTNAME
+_GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
+                 "use gnulib module gethostname for portability");
+# endif
+#endif
+
+
+#if @GNULIB_GETLOGIN@
+/* Returns the user's login name, or NULL if it cannot be found.  Upon error,
+   returns NULL with errno set.
+
+   See <http://www.opengroup.org/susv3xsh/getlogin.html>.
+
+   Most programs don't need to use this function, because the information is
+   available through environment variables:
+     ${LOGNAME-$USER}        on Unix platforms,
+     $USERNAME               on native Windows platforms.
+ */
+# if !@HAVE_GETLOGIN@
+extern char *getlogin (void);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getlogin
+# if HAVE_RAW_DECL_GETLOGIN
+_GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
+                 "use gnulib module getlogin for portability");
+# endif
 #endif
 
 
@@ -361,17 +513,21 @@ extern int gethostname(char *name, size_t len);
    provided (this case is hopefully rare but is left open by the POSIX spec).
 
    See <http://www.opengroup.org/susv3xsh/getlogin.html>.
+
+   Most programs don't need to use this function, because the information is
+   available through environment variables:
+     ${LOGNAME-$USER}        on Unix platforms,
+     $USERNAME               on native Windows platforms.
  */
 # if !@HAVE_DECL_GETLOGIN_R@
-#  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
-# define getlogin_r(n,s) \
-    (GL_LINK_WARNING ("getlogin_r is unportable - " \
-                      "use gnulib module getlogin_r for portability"), \
-     getlogin_r (n, s))
+# if HAVE_RAW_DECL_GETLOGIN_R
+_GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
+                 "use gnulib module getlogin_r for portability");
+# endif
 #endif
 
 
@@ -426,10 +582,10 @@ extern int getpagesize (void);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getpagesize
-# define getpagesize() \
-    (GL_LINK_WARNING ("getpagesize is unportable - " \
-                      "use gnulib module getpagesize for portability"), \
-     getpagesize ())
+# if HAVE_RAW_DECL_GETPAGESIZE
+_GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
+                 "use gnulib module getpagesize for portability");
+# endif
 #endif
 
 
@@ -446,58 +602,86 @@ extern void endusershell (void);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getusershell
-# define getusershell() \
-    (GL_LINK_WARNING ("getusershell is unportable - " \
-                      "use gnulib module getusershell for portability"), \
-     getusershell ())
+# if HAVE_RAW_DECL_GETUSERSHELL
+_GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
 # undef setusershell
-# define setusershell() \
-    (GL_LINK_WARNING ("setusershell is unportable - " \
-                      "use gnulib module getusershell for portability"), \
-     setusershell ())
+# if HAVE_RAW_DECL_SETUSERSHELL
+_GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
 # undef endusershell
-# define endusershell() \
-    (GL_LINK_WARNING ("endusershell is unportable - " \
-                      "use gnulib module getusershell for portability"), \
-     endusershell ())
+# if HAVE_RAW_DECL_ENDUSERSHELL
+_GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
 #endif
 
 
 #if @GNULIB_LCHOWN@
 # if @REPLACE_LCHOWN@
+#  undef lchown
+#  define lchown rpl_lchown
+# endif
+# if !@HAVE_LCHOWN@ || @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
-# define lchown(f,u,g) \
-    (GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \
-                      "systems - use gnulib module lchown for portability"), \
-     lchown (f, u, g))
+# if HAVE_RAW_DECL_LCHOWN
+_GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
+                 "use gnulib module lchown for portability");
+# endif
 #endif
 
 
 #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 !@HAVE_LINK@
-extern int link (const char *path1, const char *path2);
+# if !@HAVE_LINK@ || @REPLACE_LINK@
+extern int link (const char *path1, const char *path2)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef link
-# define link(path1,path2) \
-    (GL_LINK_WARNING ("link is unportable - " \
-                      "use gnulib module link for portability"), \
-     link (path1, path2))
+# if HAVE_RAW_DECL_LINK
+_GL_WARN_ON_USE (link, "link is unportable - "
+                 "use gnulib module link for portability");
+# endif
 #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 !@HAVE_LINKAT@ || @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
+# if HAVE_RAW_DECL_LINKAT
+_GL_WARN_ON_USE (linkat, "linkat is unportable - "
+                 "use gnulib module linkat for portability");
+# endif
+#endif
 
 #if @GNULIB_LSEEK@
 # if @REPLACE_LSEEK@
@@ -510,46 +694,210 @@ extern int link (const char *path1, const char *path2);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef lseek
-# define lseek(f,o,w) \
-    (GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \
-                      "systems - use gnulib module lseek for portability"), \
-     lseek (f, o, w))
+# if HAVE_RAW_DECL_LSEEK
+_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
+                 "systems - use gnulib module lseek for portability");
+# endif
+#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
+# if HAVE_RAW_DECL_PIPE2
+_GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
+                 "use gnulib module pipe2 for portability");
+# endif
+#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 !@HAVE_PREAD@ || @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
+# if HAVE_RAW_DECL_PREAD
+_GL_WARN_ON_USE (pread, "pread is unportable - "
+                 "use gnulib module pread for portability");
+# endif
 #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 !@HAVE_READLINK@
-#  include <stddef.h>
-extern int readlink (const char *file, char *buf, size_t bufsize);
+# if !@HAVE_READLINK@ || @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
-# define readlink(f,b,s) \
-    (GL_LINK_WARNING ("readlink is unportable - " \
-                      "use gnulib module readlink for portability"), \
-     readlink (f, b, s))
+# if HAVE_RAW_DECL_READLINK
+_GL_WARN_ON_USE (readlink, "readlink is unportable - "
+                 "use gnulib module readlink for portability");
+# endif
+#endif
+
+
+#if @GNULIB_READLINKAT@
+# if !@HAVE_READLINKAT@
+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
+# if HAVE_RAW_DECL_READLINKAT
+_GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
+                 "use gnulib module symlinkat for portability");
+# endif
+#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
+# if HAVE_RAW_DECL_RMDIR
+_GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
+                 "use gnulib module rmdir for portability");
+# endif
 #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 !@HAVE_SLEEP@
+# if !@HAVE_SLEEP@ || @REPLACE_SLEEP@
 extern unsigned int sleep (unsigned int n);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef sleep
-# define sleep(n) \
-    (GL_LINK_WARNING ("sleep is unportable - " \
-                      "use gnulib module sleep for portability"), \
-     sleep (n))
+# if HAVE_RAW_DECL_SLEEP
+_GL_WARN_ON_USE (sleep, "sleep is unportable - "
+                 "use gnulib module sleep for portability");
+# endif
+#endif
+
+
+#if @GNULIB_SYMLINK@
+# if @REPLACE_SYMLINK@
+#  undef symlink
+#  define symlink rpl_symlink
+# endif
+# if !@HAVE_SYMLINK@ || @REPLACE_SYMLINK@
+extern int symlink (char const *contents, char const *file)
+     _GL_ARG_NONNULL ((1, 2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef symlink
+# if HAVE_RAW_DECL_SYMLINK
+_GL_WARN_ON_USE (symlink, "symlink is not portable - "
+                 "use gnulib module symlink for portability");
+# endif
+#endif
+
+
+#if @GNULIB_SYMLINKAT@
+# if !@HAVE_SYMLINKAT@
+extern int symlinkat (char const *contents, int fd, char const *file)
+     _GL_ARG_NONNULL ((1, 3));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef symlinkat
+# if HAVE_RAW_DECL_SYMLINKAT
+_GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
+                 "use gnulib module symlinkat for portability");
+# endif
+#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
+# if HAVE_RAW_DECL_UNLINK
+_GL_WARN_ON_USE (unlink, "unlink is not portable - "
+                 "use gnulib module unlink for portability");
+# endif
+#endif
+
+
+#if @GNULIB_UNLINKAT@
+# if @REPLACE_UNLINKAT@
+#  undef unlinkat
+#  define unlinkat rpl_unlinkat
+# endif
+# if !@HAVE_UNLINKAT@ || @REPLACE_UNLINKAT@
+extern int unlinkat (int fd, char const *file, int flag) _GL_ARG_NONNULL ((2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef unlinkat
+# if HAVE_RAW_DECL_UNLINKAT
+_GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
+#endif
+
+
+#if @GNULIB_USLEEP@
+# if @REPLACE_USLEEP@
+#  undef usleep
+#  define usleep rpl_usleep
+# endif
+# if !@HAVE_USLEEP@ || @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
+# if HAVE_RAW_DECL_USLEEP
+_GL_WARN_ON_USE (usleep, "usleep is unportable - "
+                 "use gnulib module usleep for portability");
+# endif
 #endif
 
 
@@ -559,13 +907,8 @@ extern unsigned int sleep (unsigned int n);
    <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/libmissing/vasnprintf.c b/libmissing/vasnprintf.c
index c620b4c..3d7955b 100644
--- a/libmissing/vasnprintf.c
+++ b/libmissing/vasnprintf.c
@@ -1,5 +1,5 @@
 /* vsprintf with automatic memory allocation.
-   Copyright (C) 1999, 2002-2009 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -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;
-
-		  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));
+                  size_t w;
+
+                  if (has_precision)
+                    {
+                      /* Use only as many wide characters as needed to produce
+                         at most PRECISION bytes, from the left.  */
+#  if HAVE_WCRTOMB && !defined GNULIB_defined_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;
-#  if HAVE_WCRTOMB
-			  count = wcrtomb (buf, *arg_end, &state);
+                      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 && !defined GNULIB_defined_mbstate_t
+                          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.  */
-#  if HAVE_WCRTOMB
-		      mbstate_t state;
-		      memset (&state, '\0', sizeof (mbstate_t));
+                    {
+                      /* Use the entire string, and count the number of
+                         bytes.  */
+#  if HAVE_WCRTOMB && !defined GNULIB_defined_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;
-#  if HAVE_WCRTOMB
-			  count = wcrtomb (buf, *arg_end, &state);
+                      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 && !defined GNULIB_defined_mbstate_t
+                          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;
-#   if HAVE_WCRTOMB
-		    mbstate_t state;
-		    memset (&state, '\0', sizeof (mbstate_t));
+                  /* 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 && !defined GNULIB_defined_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;
-
-			if (*arg == 0)
-			  abort ();
-#   if HAVE_WCRTOMB
-			count = wcrtomb (buf, *arg, &state);
+                    for (remaining = characters; remaining > 0; )
+                      {
+                        char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                        int count;
+
+                        if (*arg == 0)
+                          abort ();
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                        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 HAVE_WCRTOMB
-		      mbstate_t state;
-		      memset (&state, '\0', sizeof (mbstate_t));
+                  if (has_precision || has_width)
+                    {
+                      /* We know the number of bytes in advance.  */
+                      size_t remaining;
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_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 ();
-#   if HAVE_WCRTOMB
-			  count = wcrtomb (buf, *arg, &state);
+                      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 && !defined GNULIB_defined_mbstate_t
+                          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 HAVE_WCRTOMB
-		      mbstate_t state;
-		      memset (&state, '\0', sizeof (mbstate_t));
+                          if (count <= 0)
+                            /* Inconsistency.  */
+                            abort ();
+                          memcpy (result + length, cbuf, count);
+                          length += count;
+                          arg++;
+                          remaining -= count;
+                        }
+                      if (!(arg == arg_end))
+                        abort ();
+                    }
+                  else
+                    {
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_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;
-
-			  if (*arg == 0)
-			    abort ();
-#   if HAVE_WCRTOMB
-			  count = wcrtomb (buf, *arg, &state);
+                      while (arg < arg_end)
+                        {
+                          char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                          int count;
+
+                          if (*arg == 0)
+                            abort ();
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                          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/libmissing/vasnprintf.h b/libmissing/vasnprintf.h
index 5ceab44..b55faf5 100644
--- a/libmissing/vasnprintf.h
+++ b/libmissing/vasnprintf.h
@@ -1,5 +1,5 @@
 /* vsprintf with automatic memory allocation.
-   Copyright (C) 2002-2004, 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2002-2004, 2007-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -25,15 +25,14 @@
 #include <stddef.h>
 
 #ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-#  define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
-   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The __-protected variants of the attributes 'format' and 'printf' are
+   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
+   We enable __attribute__ only if these are supported too, because
+   gnulib and libintl do '#define printf __printf__' when they override
+   the 'printf' function.  */
 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __format__ format
-#  define __printf__ printf
+#  define __attribute__(Spec)   /* empty */
 # endif
 #endif
 
diff --git a/libmissing/vsnprintf.c b/libmissing/vsnprintf.c
index 1fdfb6b..35eba15 100644
--- a/libmissing/vsnprintf.c
+++ b/libmissing/vsnprintf.c
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 2004, 2006-2008 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006-2010 Free Software Foundation, Inc.
    Written by Simon Josefsson and Yoann Vandoorselaere <[email protected]>.
 
    This program is free software; you can redistribute it and/or modify
@@ -52,11 +52,11 @@ vsnprintf (char *str, size_t size, const char *format, va_list args)
   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/libmissing/wchar.in.h b/libmissing/wchar.in.h
index 1f1f130..4fb02cd 100644
--- a/libmissing/wchar.in.h
+++ b/libmissing/wchar.in.h
@@ -1,6 +1,6 @@
 /* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
 
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -30,9 +30,9 @@
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#if defined __need_mbstate_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H
+#if defined __need_mbstate_t || defined __need_wint_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H
 /* Special invocation convention:
-   - Inside uClibc header files.
+   - Inside glibc and uClibc header files.
    - On HP-UX 11.00 we have a sequence of nested includes
      <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>,
      once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
@@ -55,10 +55,13 @@
 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
    <wchar.h>.
    BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
-   included before <wchar.h>.  */
-#include <stddef.h>
-#include <stdio.h>
-#include <time.h>
+   included before <wchar.h>.
+   But avoid namespace pollution on glibc systems.  */
+#ifndef __GLIBC__
+# include <stddef.h>
+# include <stdio.h>
+# include <time.h>
+#endif
 
 /* Include the original <wchar.h> if it exists.
    Some builds of uClibc lack it.  */
@@ -72,7 +75,9 @@
 #ifndef _GL_WCHAR_H
 #define _GL_WCHAR_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 #ifdef __cplusplus
 extern "C" {
@@ -110,10 +115,10 @@ extern wint_t btowc (int c);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef btowc
-# define btowc(c) \
-    (GL_LINK_WARNING ("btowc is unportable - " \
-                      "use gnulib module btowc for portability"), \
-     btowc (c))
+# if HAVE_RAW_DECL_BTOWC
+_GL_WARN_ON_USE (btowc, "btowc is unportable - "
+                 "use gnulib module btowc for portability");
+# endif
 #endif
 
 
@@ -129,10 +134,10 @@ extern int wctob (wint_t wc);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wctob
-# define wctob(w) \
-    (GL_LINK_WARNING ("wctob is unportable - " \
-                      "use gnulib module wctob for portability"), \
-     wctob (w))
+# if HAVE_RAW_DECL_WCTOB
+_GL_WARN_ON_USE (wctob, "wctob is unportable - "
+                 "use gnulib module wctob for portability");
+# endif
 #endif
 
 
@@ -147,10 +152,10 @@ extern int mbsinit (const mbstate_t *ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsinit
-# define mbsinit(p) \
-    (GL_LINK_WARNING ("mbsinit is unportable - " \
-                      "use gnulib module mbsinit for portability"), \
-     mbsinit (p))
+# if HAVE_RAW_DECL_MBSINIT
+_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
+                 "use gnulib module mbsinit for portability");
+# endif
 #endif
 
 
@@ -165,10 +170,10 @@ extern size_t mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbrtowc
-# define mbrtowc(w,s,n,p) \
-    (GL_LINK_WARNING ("mbrtowc is unportable - " \
-                      "use gnulib module mbrtowc for portability"), \
-     mbrtowc (w, s, n, p))
+# if HAVE_RAW_DECL_MBRTOWC
+_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
+                 "use gnulib module mbrtowc for portability");
+# endif
 #endif
 
 
@@ -183,10 +188,10 @@ extern size_t mbrlen (const char *s, size_t n, mbstate_t *ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbrlen
-# define mbrlen(s,n,p) \
-    (GL_LINK_WARNING ("mbrlen is unportable - " \
-                      "use gnulib module mbrlen for portability"), \
-     mbrlen (s, n, p))
+# if HAVE_RAW_DECL_MBRLEN
+_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
+                 "use gnulib module mbrlen for portability");
+# endif
 #endif
 
 
@@ -197,14 +202,15 @@ extern size_t mbrlen (const char *s, size_t n, mbstate_t *ps);
 #  define mbsrtowcs rpl_mbsrtowcs
 # endif
 # if !@HAVE_MBSRTOWCS@ || @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
-# define mbsrtowcs(d,s,l,p) \
-    (GL_LINK_WARNING ("mbsrtowcs is unportable - " \
-                      "use gnulib module mbsrtowcs for portability"), \
-     mbsrtowcs (d, s, l, p))
+# if HAVE_RAW_DECL_MBSRTOWCS
+_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
+                 "use gnulib module mbsrtowcs for portability");
+# endif
 #endif
 
 
@@ -215,14 +221,15 @@ extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t
 #  define mbsnrtowcs rpl_mbsnrtowcs
 # endif
 # if !@HAVE_MBSNRTOWCS@ || @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
-# define mbsnrtowcs(d,s,n,l,p) \
-    (GL_LINK_WARNING ("mbsnrtowcs is unportable - " \
-                      "use gnulib module mbsnrtowcs for portability"), \
-     mbsnrtowcs (d, s, n, l, p))
+# if HAVE_RAW_DECL_MBSNRTOWCS
+_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
+                 "use gnulib module mbsnrtowcs for portability");
+# endif
 #endif
 
 
@@ -237,10 +244,10 @@ extern size_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcrtomb
-# define wcrtomb(s,w,p) \
-    (GL_LINK_WARNING ("wcrtomb is unportable - " \
-                      "use gnulib module wcrtomb for portability"), \
-     wcrtomb (s, w, p))
+# if HAVE_RAW_DECL_WCRTOMB
+_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
+                 "use gnulib module wcrtomb for portability");
+# endif
 #endif
 
 
@@ -251,14 +258,15 @@ extern size_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps);
 #  define wcsrtombs rpl_wcsrtombs
 # endif
 # if !@HAVE_WCSRTOMBS@ || @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
-# define wcsrtombs(d,s,l,p) \
-    (GL_LINK_WARNING ("wcsrtombs is unportable - " \
-                      "use gnulib module wcsrtombs for portability"), \
-     wcsrtombs (d, s, l, p))
+# if HAVE_RAW_DECL_WCSRTOMBS
+_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
+                 "use gnulib module wcsrtombs for portability");
+# endif
 #endif
 
 
@@ -269,14 +277,15 @@ extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t
 #  define wcsnrtombs rpl_wcsnrtombs
 # endif
 # if !@HAVE_WCSNRTOMBS@ || @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
-# define wcsnrtombs(d,s,n,l,p) \
-    (GL_LINK_WARNING ("wcsnrtombs is unportable - " \
-                      "use gnulib module wcsnrtombs for portability"), \
-     wcsnrtombs (d, s, n, l, p))
+# if HAVE_RAW_DECL_WCSNRTOMBS
+_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
+                 "use gnulib module wcsnrtombs for portability");
+# endif
 #endif
 
 
@@ -294,10 +303,10 @@ extern int wcwidth (int /* actually wchar_t */);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcwidth
-# define wcwidth(w) \
-    (GL_LINK_WARNING ("wcwidth is unportable - " \
-                      "use gnulib module wcwidth for portability"), \
-     wcwidth (w))
+# if HAVE_RAW_DECL_WCWIDTH
+_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
+                 "use gnulib module wcwidth for portability");
+# endif
 #endif
 
 
diff --git a/libmissing/xsize.h b/libmissing/xsize.h
index 0b30045..3382280 100644
--- a/libmissing/xsize.h
+++ b/libmissing/xsize.h
@@ -1,6 +1,6 @@
 /* xsize.h -- Checked size_t computations.
 
-   Copyright (C) 2003, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2008, 2009, 2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/link-warning.h b/link-warning.h
index fda0194..0725e78 100644
--- a/link-warning.h
+++ b/link-warning.h
@@ -1,3 +1,20 @@
+/* A C macro for emitting link time warnings.
+   Copyright (C) 1995, 1997, 2000, 2002-2003, 2007, 2009-2010 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/src/Makefile.am b/src/Makefile.am
index 21b30ea..efa20b8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,7 +4,15 @@ AM_CPPFLAGS = -I$(srcdir)/include/ -I$(top_srcdir)/libmissing -I$(top_srcdir)/li
 AM_CFLAGS = @PRELUDE_MANAGER_CFLAGS@ @GLOBAL_CFLAGS@
 
 bin_PROGRAMS = prelude-manager
-prelude_manager_LDADD = @LIBPRELUDE_LIBS@ @LIBWRAP_LIBS@ $(top_builddir)/libev/libev.la $(top_builddir)/libmissing/libmissing.la @LTLIBMULTITHREAD@
+prelude_manager_LDADD = @LIBPRELUDE_LIBS@ @LIBWRAP_LIBS@ $(top_builddir)/libev/libev.la \
+			$(top_builddir)/libmissing/libmissing.la 	\
+			$(GETADDRINFOLIB) 				\
+			$(HOSTENTLIB)					\
+			$(INET_NTOP_LIB)				\
+			$(LTLIBINTL)					\
+			$(LTLIBMULTITHREAD)				\
+			$(LTLIBTHREAD)	 				\
+			$(SERVENTLIB)
 
 if HAVE_XML2
  XML_OBJS= -dlopen $(top_builddir)/plugins/reports/xmlmod/xmlmod.la
diff --git a/warn-on-use.h b/warn-on-use.h
new file mode 100644
index 0000000..b314d36
--- /dev/null
+++ b/warn-on-use.h
@@ -0,0 +1,75 @@
+/* A C macro for emitting warnings if a function is used.
+   Copyright (C) 2010 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_WARN_ON_USE(function, "literal string") issues a declaration
+   for FUNCTION which will then trigger a compiler warning containing
+   the text of "literal string" anywhere that function is called, if
+   supported by the compiler.  If the compiler does not support this
+   feature, the macro expands to an unused extern declaration.
+
+   This macro is useful for marking a function as a potential
+   portability trap, with the intent that "literal string" include
+   instructions on the replacement function that should be used
+   instead.  However, one of the reasons that a function is a
+   portability trap is if it has the wrong signature.  Declaring
+   FUNCTION with a different signature in C is a compilation error, so
+   this macro must use the same type as any existing declaration so
+   that programs that avoid the problematic FUNCTION do not fail to
+   compile merely because they included a header that poisoned the
+   function.  But this implies that _GL_WARN_ON_USE is only safe to
+   use if FUNCTION is known to already have a declaration.  Use of
+   this macro implies that there must not be any other macro hiding
+   the declaration of FUNCTION; but undefining FUNCTION first is part
+   of the poisoning process anyway (although for symbols that are
+   provided only via a macro, the result is a compilation error rather
+   than a warning containing "literal string").  Also note that in
+   C++, it is only safe to use if FUNCTION has no overloads.
+
+   For an example, it is possible to poison 'getline' by:
+   - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
+     [getline]) in configure.ac, which potentially defines
+     HAVE_RAW_DECL_GETLINE
+   - adding this code to a header that wraps the system <stdio.h>:
+     #undef getline
+     #if HAVE_RAW_DECL_GETLINE
+     _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
+       "not universally present; use the gnulib module getline");
+     #endif
+
+   It is not possible to directly poison global variables.  But it is
+   possible to write a wrapper accessor function, and poison that
+   (less common usage, like &environ, will cause a compilation error
+   rather than issue the nice warning, but the end result of informing
+   the developer about their portability problem is still achieved):
+   #if HAVE_RAW_DECL_ENVIRON
+   static inline char ***rpl_environ (void) { return &environ; }
+   _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
+   # undef environ
+   # define environ (*rpl_environ ())
+   #endif
+   */
+#ifndef _GL_WARN_ON_USE
+
+# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
+/* A compiler attribute is available in gcc versions 4.3.0 and later.  */
+#  define _GL_WARN_ON_USE(function, message) \
+extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
+
+# else /* Unsupported.  */
+#  define _GL_WARN_ON_USE(function, message) \
+extern int _gl_warn_on_use
+# endif
+#endif
_______________________________________________
Prelude-cvslog site list
[email protected]
http://lists.prelude-ids.org/mailman/listinfo/prelude-cvslog