Просмотр исходного кода

remove backed-up files, add to gitignore

madlohe 6 лет назад
Родитель
Сommit
334e502dff
100 измененных файлов с 1 добавлено и 36387 удалено
  1. 1 0
      .gitignore
  2. 0 2386
      gl/Makefile.am~
  3. 0 63
      gl/alloca.in.h~
  4. 0 140
      gl/arpa_inet.in.h~
  5. 0 34
      gl/asnprintf.c~
  6. 0 39
      gl/asprintf.c~
  7. 0 574
      gl/base64.c~
  8. 0 68
      gl/base64.h~
  9. 0 75
      gl/basename-lgpl.c~
  10. 0 58
      gl/basename.c~
  11. 0 39
      gl/btowc.c~
  12. 0 684
      gl/config.charset~
  13. 0 86
      gl/dirname-lgpl.c~
  14. 0 38
      gl/dirname.c~
  15. 0 46
      gl/dirname.h~
  16. 0 53
      gl/dosname.h~
  17. 0 279
      gl/errno.in.h~
  18. 0 401
      gl/error.c~
  19. 0 65
      gl/error.h~
  20. 0 24
      gl/exitfail.c~
  21. 0 18
      gl/exitfail.h~
  22. 0 116
      gl/fd-hook.c~
  23. 0 119
      gl/fd-hook.h~
  24. 0 147
      gl/float+.h~
  25. 0 33
      gl/float.c~
  26. 0 188
      gl/float.in.h~
  27. 0 105
      gl/floor.c~
  28. 0 20
      gl/floorf.c~
  29. 0 331
      gl/fsusage.c~
  30. 0 40
      gl/fsusage.h~
  31. 0 18
      gl/full-read.c~
  32. 0 24
      gl/full-read.h~
  33. 0 79
      gl/full-write.c~
  34. 0 92
      gl/gai_strerror.c~
  35. 0 443
      gl/getaddrinfo.c~
  36. 0 104
      gl/gethostname.c~
  37. 0 1024
      gl/getloadavg.c~
  38. 0 1253
      gl/getopt.c~
  39. 0 255
      gl/getopt.in.h~
  40. 0 170
      gl/getopt1.c~
  41. 0 135
      gl/getopt_int.h~
  42. 0 288
      gl/gettext.h~
  43. 0 204
      gl/idpriv-droptemp.c~
  44. 0 116
      gl/idpriv.h~
  45. 0 260
      gl/inet_ntop.c~
  46. 0 319
      gl/intprops.h~
  47. 0 28
      gl/itold.c~
  48. 0 176
      gl/langinfo.in.h~
  49. 0 558
      gl/localcharset.c~
  50. 0 40
      gl/localcharset.h~
  51. 0 216
      gl/locale.in.h~
  52. 0 103
      gl/localeconv.c~
  53. 0 56
      gl/malloc.c~
  54. 0 149
      gl/malloca.c~
  55. 0 133
      gl/malloca.h~
  56. 0 2275
      gl/math.in.h~
  57. 0 402
      gl/mbrtowc.c~
  58. 0 61
      gl/mbsinit.c~
  59. 0 44
      gl/mbtowc-impl.h~
  60. 0 26
      gl/mbtowc.c~
  61. 0 172
      gl/memchr.c~
  62. 0 741
      gl/mktime.c~
  63. 0 982
      gl/mountlist.c~
  64. 0 41
      gl/mountlist.h~
  65. 0 129
      gl/msvc-inval.c~
  66. 0 222
      gl/msvc-inval.h~
  67. 0 49
      gl/msvc-nothrow.c~
  68. 0 43
      gl/msvc-nothrow.h~
  69. 0 265
      gl/netdb.in.h~
  70. 0 47
      gl/netinet_in.in.h~
  71. 0 271
      gl/nl_langinfo.c~
  72. 0 187
      gl/printf-args.c~
  73. 0 158
      gl/printf-args.h~
  74. 0 638
      gl/printf-parse.c~
  75. 0 193
      gl/printf-parse.h~
  76. 0 85
      gl/read.c~
  77. 0 29
      gl/ref-add.sin~
  78. 0 24
      gl/ref-del.sin~
  79. 0 3922
      gl/regcomp.c~
  80. 0 81
      gl/regex.c~
  81. 0 667
      gl/regex.h~
  82. 0 1741
      gl/regex_internal.c~
  83. 0 909
      gl/regex_internal.h~
  84. 0 4410
      gl/regexec.c~
  85. 0 77
      gl/safe-read.c~
  86. 0 47
      gl/safe-read.h~
  87. 0 390
      gl/setenv.c~
  88. 0 426
      gl/sha1.c~
  89. 0 91
      gl/sha1.h~
  90. 0 30
      gl/size_max.h~
  91. 0 71
      gl/snprintf.c~
  92. 0 154
      gl/sockets.c~
  93. 0 62
      gl/sockets.h~
  94. 0 109
      gl/stdalign.in.h~
  95. 0 132
      gl/stdbool.in.h~
  96. 0 86
      gl/stddef.in.h~
  97. 0 636
      gl/stdint.in.h~
  98. 0 1344
      gl/stdio.in.h~
  99. 0 954
      gl/stdlib.in.h~
  100. 0 452
      gl/str-two-way.h~

+ 1 - 0
.gitignore

@@ -101,6 +101,7 @@ NP-VERSION-FILE
 /gl/warn-on-use.h
 /gl/wchar.h
 /gl/wctype.h
+/gl/*~
 
 # /lib/
 /lib/.deps

+ 0 - 2386
gl/Makefile.am~

@@ -1,2386 +0,0 @@
-## DO NOT EDIT! GENERATED AUTOMATICALLY!
-## Process this file with automake to produce Makefile.in.
-# Copyright (C) 2002-2015 Free Software Foundation, Inc.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This file is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this file.  If not, see <http://www.gnu.org/licenses/>.
-#
-# As a special exception to the GNU General Public License,
-# this file may be distributed as part of a program that
-# contains a configuration script generated by Autoconf, under
-# the same distribution terms as the rest of that program.
-#
-# Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files base64 crypto/sha1 dirname environ floorf fsusage getaddrinfo gethostname getloadavg getopt-gnu gettext idpriv-droptemp mountlist regex setenv strcase strcasestr strsep timegm unsetenv vasprintf vsnprintf
-
-AUTOMAKE_OPTIONS = 1.9.6 gnits subdir-objects
-
-SUBDIRS =
-noinst_HEADERS =
-noinst_LIBRARIES =
-noinst_LTLIBRARIES =
-EXTRA_DIST =
-BUILT_SOURCES =
-SUFFIXES =
-MOSTLYCLEANFILES = core *.stackdump
-MOSTLYCLEANDIRS =
-CLEANFILES =
-DISTCLEANFILES =
-MAINTAINERCLEANFILES =
-EXTRA_DIST += m4/gnulib-cache.m4
-
-AM_CPPFLAGS =
-AM_CFLAGS =
-
-noinst_LIBRARIES += libgnu.a
-
-libgnu_a_SOURCES =
-libgnu_a_LIBADD = $(gl_LIBOBJS)
-libgnu_a_DEPENDENCIES = $(gl_LIBOBJS)
-EXTRA_libgnu_a_SOURCES =
-
-## begin gnulib module absolute-header
-
-# Use this preprocessor expression to decide whether #include_next works.
-# Do not rely on a 'configure'-time test for this, since the expression
-# might appear in an installed header, which is used by some other compiler.
-HAVE_INCLUDE_NEXT = (__GNUC__ || 60000000 <= __DECC_VER)
-
-## end   gnulib module absolute-header
-
-## begin gnulib module alloca-opt
-
-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.
-if GL_GENERATE_ALLOCA_H
-alloca.h: alloca.in.h $(top_builddir)/config.status
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-	  cat $(srcdir)/alloca.in.h; \
-	} > $@-t && \
-	mv -f $@-t $@
-else
-alloca.h: $(top_builddir)/config.status
-	rm -f $@
-endif
-MOSTLYCLEANFILES += alloca.h alloca.h-t
-
-EXTRA_DIST += alloca.in.h
-
-## end   gnulib module alloca-opt
-
-## begin gnulib module arpa_inet
-
-BUILT_SOURCES += arpa/inet.h
-
-# We need the following in order to create <arpa/inet.h> when the system
-# doesn't have one.
-arpa/inet.h: arpa_inet.in.h $(top_builddir)/config.status $(CXXDEFS_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|@''GUARD_PREFIX''@|GL|g' \
-	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-	      -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \
-	      -e 's|@''NEXT_ARPA_INET_H''@|$(NEXT_ARPA_INET_H)|g' \
-	      -e 's|@''HAVE_ARPA_INET_H''@|$(HAVE_ARPA_INET_H)|g' \
-	      -e 's/@''GNULIB_INET_NTOP''@/$(GNULIB_INET_NTOP)/g' \
-	      -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 's|@''REPLACE_INET_NTOP''@|$(REPLACE_INET_NTOP)|g' \
-	      -e 's|@''REPLACE_INET_PTON''@|$(REPLACE_INET_PTON)|g' \
-	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_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 && \
-	mv $@-t $@
-MOSTLYCLEANFILES += arpa/inet.h arpa/inet.h-t
-MOSTLYCLEANDIRS += arpa
-
-EXTRA_DIST += arpa_inet.in.h
-
-## end   gnulib module arpa_inet
-
-## begin gnulib module base64
-
-libgnu_a_SOURCES += base64.h base64.c
-
-## end   gnulib module base64
-
-## begin gnulib module btowc
-
-
-EXTRA_DIST += btowc.c
-
-EXTRA_libgnu_a_SOURCES += btowc.c
-
-## end   gnulib module btowc
-
-## begin gnulib module configmake
-
-# Listed in the same order as the GNU makefile conventions, and
-# provided by autoconf 2.59c+ or 2.70.
-# The Automake-defined pkg* macros are appended, in the order
-# listed in the Automake 1.10a+ documentation.
-configmake.h: Makefile
-	$(AM_V_GEN)rm -f $@-t && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-	  echo '#define PREFIX "$(prefix)"'; \
-	  echo '#define EXEC_PREFIX "$(exec_prefix)"'; \
-	  echo '#define BINDIR "$(bindir)"'; \
-	  echo '#define SBINDIR "$(sbindir)"'; \
-	  echo '#define LIBEXECDIR "$(libexecdir)"'; \
-	  echo '#define DATAROOTDIR "$(datarootdir)"'; \
-	  echo '#define DATADIR "$(datadir)"'; \
-	  echo '#define SYSCONFDIR "$(sysconfdir)"'; \
-	  echo '#define SHAREDSTATEDIR "$(sharedstatedir)"'; \
-	  echo '#define LOCALSTATEDIR "$(localstatedir)"'; \
-	  echo '#define RUNSTATEDIR "$(runstatedir)"'; \
-	  echo '#define INCLUDEDIR "$(includedir)"'; \
-	  echo '#define OLDINCLUDEDIR "$(oldincludedir)"'; \
-	  echo '#define DOCDIR "$(docdir)"'; \
-	  echo '#define INFODIR "$(infodir)"'; \
-	  echo '#define HTMLDIR "$(htmldir)"'; \
-	  echo '#define DVIDIR "$(dvidir)"'; \
-	  echo '#define PDFDIR "$(pdfdir)"'; \
-	  echo '#define PSDIR "$(psdir)"'; \
-	  echo '#define LIBDIR "$(libdir)"'; \
-	  echo '#define LISPDIR "$(lispdir)"'; \
-	  echo '#define LOCALEDIR "$(localedir)"'; \
-	  echo '#define MANDIR "$(mandir)"'; \
-	  echo '#define MANEXT "$(manext)"'; \
-	  echo '#define PKGDATADIR "$(pkgdatadir)"'; \
-	  echo '#define PKGINCLUDEDIR "$(pkgincludedir)"'; \
-	  echo '#define PKGLIBDIR "$(pkglibdir)"'; \
-	  echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \
-	} | sed '/""/d' > $@-t && \
-	mv -f $@-t $@
-
-BUILT_SOURCES += configmake.h
-CLEANFILES += configmake.h configmake.h-t
-
-## end   gnulib module configmake
-
-## begin gnulib module crypto/sha1
-
-libgnu_a_SOURCES += sha1.c
-
-EXTRA_DIST += gl_openssl.h sha1.h
-
-## end   gnulib module crypto/sha1
-
-## begin gnulib module dirname
-
-libgnu_a_SOURCES += dirname.c basename.c
-
-EXTRA_DIST += stripslash.c
-
-EXTRA_libgnu_a_SOURCES += stripslash.c
-
-## end   gnulib module dirname
-
-## begin gnulib module dirname-lgpl
-
-libgnu_a_SOURCES += dirname-lgpl.c basename-lgpl.c stripslash.c
-
-EXTRA_DIST += dirname.h
-
-## end   gnulib module dirname-lgpl
-
-## begin gnulib module dosname
-
-
-EXTRA_DIST += dosname.h
-
-## end   gnulib module dosname
-
-## begin gnulib module errno
-
-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.
-if GL_GENERATE_ERRNO_H
-errno.h: errno.in.h $(top_builddir)/config.status
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-	      -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \
-	      -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \
-	      -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \
-	      -e 's|@''ENOLINK_HIDDEN''@|$(ENOLINK_HIDDEN)|g' \
-	      -e 's|@''ENOLINK_VALUE''@|$(ENOLINK_VALUE)|g' \
-	      -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \
-	      -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \
-	      < $(srcdir)/errno.in.h; \
-	} > $@-t && \
-	mv $@-t $@
-else
-errno.h: $(top_builddir)/config.status
-	rm -f $@
-endif
-MOSTLYCLEANFILES += errno.h errno.h-t
-
-EXTRA_DIST += errno.in.h
-
-## end   gnulib module errno
-
-## begin gnulib module error
-
-
-EXTRA_DIST += error.c error.h
-
-EXTRA_libgnu_a_SOURCES += error.c
-
-## end   gnulib module error
-
-## begin gnulib module exitfail
-
-libgnu_a_SOURCES += exitfail.c
-
-EXTRA_DIST += exitfail.h
-
-## end   gnulib module exitfail
-
-## begin gnulib module fd-hook
-
-libgnu_a_SOURCES += fd-hook.c
-
-EXTRA_DIST += fd-hook.h
-
-## end   gnulib module fd-hook
-
-## begin gnulib module float
-
-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.
-if GL_GENERATE_FLOAT_H
-float.h: float.in.h $(top_builddir)/config.status
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-	      -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \
-	      -e 's|@''REPLACE_ITOLD''@|$(REPLACE_ITOLD)|g' \
-	      < $(srcdir)/float.in.h; \
-	} > $@-t && \
-	mv $@-t $@
-else
-float.h: $(top_builddir)/config.status
-	rm -f $@
-endif
-MOSTLYCLEANFILES += float.h float.h-t
-
-EXTRA_DIST += float.c float.in.h itold.c
-
-EXTRA_libgnu_a_SOURCES += float.c itold.c
-
-## end   gnulib module float
-
-## begin gnulib module floorf
-
-
-EXTRA_DIST += floor.c floorf.c
-
-EXTRA_libgnu_a_SOURCES += floor.c floorf.c
-
-## end   gnulib module floorf
-
-## begin gnulib module fsusage
-
-
-EXTRA_DIST += fsusage.c fsusage.h
-
-EXTRA_libgnu_a_SOURCES += fsusage.c
-
-## end   gnulib module fsusage
-
-## begin gnulib module full-read
-
-libgnu_a_SOURCES += full-read.h full-read.c
-
-EXTRA_DIST += full-write.c
-
-EXTRA_libgnu_a_SOURCES += full-write.c
-
-## end   gnulib module full-read
-
-## begin gnulib module getaddrinfo
-
-
-EXTRA_DIST += gai_strerror.c getaddrinfo.c
-
-EXTRA_libgnu_a_SOURCES += gai_strerror.c getaddrinfo.c
-
-## end   gnulib module getaddrinfo
-
-## begin gnulib module gethostname
-
-
-EXTRA_DIST += gethostname.c w32sock.h
-
-EXTRA_libgnu_a_SOURCES += gethostname.c
-
-## end   gnulib module gethostname
-
-## begin gnulib module getloadavg
-
-
-EXTRA_DIST += getloadavg.c
-
-EXTRA_libgnu_a_SOURCES += getloadavg.c
-
-## end   gnulib module getloadavg
-
-## begin gnulib module getopt-posix
-
-BUILT_SOURCES += $(GETOPT_H)
-
-# We need the following in order to create <getopt.h> when the system
-# doesn't have one that works with the given compiler.
-getopt.h: getopt.in.h $(top_builddir)/config.status $(ARG_NONNULL_H)
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-	      -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \
-	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-	      -e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \
-	      -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-	      < $(srcdir)/getopt.in.h; \
-	} > $@-t && \
-	mv -f $@-t $@
-MOSTLYCLEANFILES += getopt.h getopt.h-t
-
-EXTRA_DIST += getopt.c getopt.in.h getopt1.c getopt_int.h
-
-EXTRA_libgnu_a_SOURCES += getopt.c getopt1.c
-
-## end   gnulib module getopt-posix
-
-## begin gnulib module gettext
-
-# If your project uses "gettextize --intl" to put a source-code
-# copy of libintl into the package, every Makefile.am needs
-# -I$(top_builddir)/intl, so that <libintl.h> can be found in this directory.
-# Here's one way to do this:
-#AM_CPPFLAGS += -I$(top_builddir)/intl
-# This option has no effect when the user disables NLS (because then
-# the intl directory contains no libintl.h file).  This option is not
-# enabled by default because the intl directory might not exist if
-# your project does not use "gettext --intl", and some compilers
-# complain about -I options applied to nonexistent directories.
-
-EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath
-
-## end   gnulib module gettext
-
-## begin gnulib module gettext-h
-
-libgnu_a_SOURCES += gettext.h
-
-## end   gnulib module gettext-h
-
-## begin gnulib module gettimeofday
-
-
-EXTRA_DIST += gettimeofday.c
-
-EXTRA_libgnu_a_SOURCES += gettimeofday.c
-
-## end   gnulib module gettimeofday
-
-## begin gnulib module havelib
-
-
-EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath
-
-## end   gnulib module havelib
-
-## begin gnulib module idpriv-droptemp
-
-libgnu_a_SOURCES += idpriv-droptemp.c
-
-EXTRA_DIST += idpriv.h
-
-## end   gnulib module idpriv-droptemp
-
-## begin gnulib module inet_ntop
-
-
-EXTRA_DIST += inet_ntop.c
-
-EXTRA_libgnu_a_SOURCES += inet_ntop.c
-
-## end   gnulib module inet_ntop
-
-## begin gnulib module intprops
-
-
-EXTRA_DIST += intprops.h
-
-## end   gnulib module intprops
-
-## begin gnulib module langinfo
-
-BUILT_SOURCES += langinfo.h
-
-# We need the following in order to create an empty placeholder for
-# <langinfo.h> when the system doesn't have one.
-langinfo.h: langinfo.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-	      -e 's|@''HAVE_LANGINFO_H''@|$(HAVE_LANGINFO_H)|g' \
-	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-	      -e 's|@''NEXT_LANGINFO_H''@|$(NEXT_LANGINFO_H)|g' \
-	      -e 's/@''GNULIB_NL_LANGINFO''@/$(GNULIB_NL_LANGINFO)/g' \
-	      -e 's|@''HAVE_LANGINFO_CODESET''@|$(HAVE_LANGINFO_CODESET)|g' \
-	      -e 's|@''HAVE_LANGINFO_T_FMT_AMPM''@|$(HAVE_LANGINFO_T_FMT_AMPM)|g' \
-	      -e 's|@''HAVE_LANGINFO_ERA''@|$(HAVE_LANGINFO_ERA)|g' \
-	      -e 's|@''HAVE_LANGINFO_YESEXPR''@|$(HAVE_LANGINFO_YESEXPR)|g' \
-	      -e 's|@''HAVE_NL_LANGINFO''@|$(HAVE_NL_LANGINFO)|g' \
-	      -e 's|@''REPLACE_NL_LANGINFO''@|$(REPLACE_NL_LANGINFO)|g' \
-	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-	      < $(srcdir)/langinfo.in.h; \
-	} > $@-t && \
-	mv $@-t $@
-MOSTLYCLEANFILES += langinfo.h langinfo.h-t
-
-EXTRA_DIST += langinfo.in.h
-
-## end   gnulib module langinfo
-
-## begin gnulib module localcharset
-
-libgnu_a_SOURCES += localcharset.h localcharset.c
-
-# We need the following in order to install a simple file in $(libdir)
-# which is shared with other installed packages. We use a list of referencing
-# packages so that "make uninstall" will remove the file if and only if it
-# is not used by another installed package.
-# On systems with glibc-2.1 or newer, the file is redundant, therefore we
-# avoid installing it.
-
-all-local: charset.alias ref-add.sed ref-del.sed
-
-charset_alias = $(DESTDIR)$(libdir)/charset.alias
-charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
-install-exec-local: install-exec-localcharset
-install-exec-localcharset: all-local
-	if test $(GLIBC21) = no; then \
-	  case '$(host_os)' in \
-	    darwin[56]*) \
-	      need_charset_alias=true ;; \
-	    darwin* | cygwin* | mingw* | pw32* | cegcc*) \
-	      need_charset_alias=false ;; \
-	    *) \
-	      need_charset_alias=true ;; \
-	  esac ; \
-	else \
-	  need_charset_alias=false ; \
-	fi ; \
-	if $$need_charset_alias; then \
-	  $(mkinstalldirs) $(DESTDIR)$(libdir) ; \
-	fi ; \
-	if test -f $(charset_alias); then \
-	  sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
-	  $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
-	  rm -f $(charset_tmp) ; \
-	else \
-	  if $$need_charset_alias; then \
-	    sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
-	    $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
-	    rm -f $(charset_tmp) ; \
-	  fi ; \
-	fi
-
-uninstall-local: uninstall-localcharset
-uninstall-localcharset: all-local
-	if test -f $(charset_alias); then \
-	  sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
-	  if grep '^# Packages using this file: $$' $(charset_tmp) \
-	      > /dev/null; then \
-	    rm -f $(charset_alias); \
-	  else \
-	    $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
-	  fi; \
-	  rm -f $(charset_tmp); \
-	fi
-
-charset.alias: config.charset
-	$(AM_V_GEN)rm -f t-$@ $@ && \
-	$(SHELL) $(srcdir)/config.charset '$(host)' > t-$@ && \
-	mv t-$@ $@
-
-SUFFIXES += .sed .sin
-.sin.sed:
-	$(AM_V_GEN)rm -f t-$@ $@ && \
-	sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@ && \
-	mv t-$@ $@
-
-CLEANFILES += charset.alias ref-add.sed ref-del.sed
-
-EXTRA_DIST += config.charset ref-add.sin ref-del.sin
-
-## end   gnulib module localcharset
-
-## begin gnulib module locale
-
-BUILT_SOURCES += locale.h
-
-# We need the following in order to create <locale.h> when the system
-# doesn't have one that provides all definitions.
-locale.h: locale.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-	      -e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \
-	      -e 's/@''GNULIB_LOCALECONV''@/$(GNULIB_LOCALECONV)/g' \
-	      -e 's/@''GNULIB_SETLOCALE''@/$(GNULIB_SETLOCALE)/g' \
-	      -e 's/@''GNULIB_DUPLOCALE''@/$(GNULIB_DUPLOCALE)/g' \
-	      -e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \
-	      -e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \
-	      -e 's|@''REPLACE_LOCALECONV''@|$(REPLACE_LOCALECONV)|g' \
-	      -e 's|@''REPLACE_SETLOCALE''@|$(REPLACE_SETLOCALE)|g' \
-	      -e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \
-	      -e 's|@''REPLACE_STRUCT_LCONV''@|$(REPLACE_STRUCT_LCONV)|g' \
-	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-	      -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-	      < $(srcdir)/locale.in.h; \
-	} > $@-t && \
-	mv $@-t $@
-MOSTLYCLEANFILES += locale.h locale.h-t
-
-EXTRA_DIST += locale.in.h
-
-## end   gnulib module locale
-
-## begin gnulib module localeconv
-
-
-EXTRA_DIST += localeconv.c
-
-EXTRA_libgnu_a_SOURCES += localeconv.c
-
-## end   gnulib module localeconv
-
-## begin gnulib module lock
-
-libgnu_a_SOURCES += glthread/lock.h glthread/lock.c
-
-## end   gnulib module lock
-
-## begin gnulib module malloc-posix
-
-
-EXTRA_DIST += malloc.c
-
-EXTRA_libgnu_a_SOURCES += malloc.c
-
-## end   gnulib module malloc-posix
-
-## begin gnulib module malloca
-
-libgnu_a_SOURCES += malloca.c
-
-EXTRA_DIST += malloca.h malloca.valgrind
-
-## end   gnulib module malloca
-
-## begin gnulib module math
-
-BUILT_SOURCES += math.h
-libgnu_a_SOURCES += math.c
-
-# We need the following in order to create <math.h> when the system
-# doesn't have one that works with the given compiler.
-math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-	      -e 's|@''INCLUDE_NEXT_AS_FIRST_DIRECTIVE''@|$(INCLUDE_NEXT_AS_FIRST_DIRECTIVE)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-	      -e 's|@''NEXT_AS_FIRST_DIRECTIVE_MATH_H''@|$(NEXT_AS_FIRST_DIRECTIVE_MATH_H)|g' \
-	      -e 's/@''GNULIB_ACOSF''@/$(GNULIB_ACOSF)/g' \
-	      -e 's/@''GNULIB_ACOSL''@/$(GNULIB_ACOSL)/g' \
-	      -e 's/@''GNULIB_ASINF''@/$(GNULIB_ASINF)/g' \
-	      -e 's/@''GNULIB_ASINL''@/$(GNULIB_ASINL)/g' \
-	      -e 's/@''GNULIB_ATANF''@/$(GNULIB_ATANF)/g' \
-	      -e 's/@''GNULIB_ATANL''@/$(GNULIB_ATANL)/g' \
-	      -e 's/@''GNULIB_ATAN2F''@/$(GNULIB_ATAN2F)/g' \
-	      -e 's/@''GNULIB_CBRT''@/$(GNULIB_CBRT)/g' \
-	      -e 's/@''GNULIB_CBRTF''@/$(GNULIB_CBRTF)/g' \
-	      -e 's/@''GNULIB_CBRTL''@/$(GNULIB_CBRTL)/g' \
-	      -e 's/@''GNULIB_CEIL''@/$(GNULIB_CEIL)/g' \
-	      -e 's/@''GNULIB_CEILF''@/$(GNULIB_CEILF)/g' \
-	      -e 's/@''GNULIB_CEILL''@/$(GNULIB_CEILL)/g' \
-	      -e 's/@''GNULIB_COPYSIGN''@/$(GNULIB_COPYSIGN)/g' \
-	      -e 's/@''GNULIB_COPYSIGNF''@/$(GNULIB_COPYSIGNF)/g' \
-	      -e 's/@''GNULIB_COPYSIGNL''@/$(GNULIB_COPYSIGNL)/g' \
-	      -e 's/@''GNULIB_COSF''@/$(GNULIB_COSF)/g' \
-	      -e 's/@''GNULIB_COSL''@/$(GNULIB_COSL)/g' \
-	      -e 's/@''GNULIB_COSHF''@/$(GNULIB_COSHF)/g' \
-	      -e 's/@''GNULIB_EXPF''@/$(GNULIB_EXPF)/g' \
-	      -e 's/@''GNULIB_EXPL''@/$(GNULIB_EXPL)/g' \
-	      -e 's/@''GNULIB_EXP2''@/$(GNULIB_EXP2)/g' \
-	      -e 's/@''GNULIB_EXP2F''@/$(GNULIB_EXP2F)/g' \
-	      -e 's/@''GNULIB_EXP2L''@/$(GNULIB_EXP2L)/g' \
-	      -e 's/@''GNULIB_EXPM1''@/$(GNULIB_EXPM1)/g' \
-	      -e 's/@''GNULIB_EXPM1F''@/$(GNULIB_EXPM1F)/g' \
-	      -e 's/@''GNULIB_EXPM1L''@/$(GNULIB_EXPM1L)/g' \
-	      -e 's/@''GNULIB_FABSF''@/$(GNULIB_FABSF)/g' \
-	      -e 's/@''GNULIB_FABSL''@/$(GNULIB_FABSL)/g' \
-	      -e 's/@''GNULIB_FLOOR''@/$(GNULIB_FLOOR)/g' \
-	      -e 's/@''GNULIB_FLOORF''@/$(GNULIB_FLOORF)/g' \
-	      -e 's/@''GNULIB_FLOORL''@/$(GNULIB_FLOORL)/g' \
-	      -e 's/@''GNULIB_FMA''@/$(GNULIB_FMA)/g' \
-	      -e 's/@''GNULIB_FMAF''@/$(GNULIB_FMAF)/g' \
-	      -e 's/@''GNULIB_FMAL''@/$(GNULIB_FMAL)/g' \
-	      -e 's/@''GNULIB_FMOD''@/$(GNULIB_FMOD)/g' \
-	      -e 's/@''GNULIB_FMODF''@/$(GNULIB_FMODF)/g' \
-	      -e 's/@''GNULIB_FMODL''@/$(GNULIB_FMODL)/g' \
-	      -e 's/@''GNULIB_FREXPF''@/$(GNULIB_FREXPF)/g' \
-	      -e 's/@''GNULIB_FREXP''@/$(GNULIB_FREXP)/g' \
-	      -e 's/@''GNULIB_FREXPL''@/$(GNULIB_FREXPL)/g' \
-	      -e 's/@''GNULIB_HYPOT''@/$(GNULIB_HYPOT)/g' \
-	      -e 's/@''GNULIB_HYPOTF''@/$(GNULIB_HYPOTF)/g' \
-	      -e 's/@''GNULIB_HYPOTL''@/$(GNULIB_HYPOTL)/g' \
-	      < $(srcdir)/math.in.h | \
-	  sed -e 's/@''GNULIB_ILOGB''@/$(GNULIB_ILOGB)/g' \
-	      -e 's/@''GNULIB_ILOGBF''@/$(GNULIB_ILOGBF)/g' \
-	      -e 's/@''GNULIB_ILOGBL''@/$(GNULIB_ILOGBL)/g' \
-	      -e 's/@''GNULIB_ISFINITE''@/$(GNULIB_ISFINITE)/g' \
-	      -e 's/@''GNULIB_ISINF''@/$(GNULIB_ISINF)/g' \
-	      -e 's/@''GNULIB_ISNAN''@/$(GNULIB_ISNAN)/g' \
-	      -e 's/@''GNULIB_ISNANF''@/$(GNULIB_ISNANF)/g' \
-	      -e 's/@''GNULIB_ISNAND''@/$(GNULIB_ISNAND)/g' \
-	      -e 's/@''GNULIB_ISNANL''@/$(GNULIB_ISNANL)/g' \
-	      -e 's/@''GNULIB_LDEXPF''@/$(GNULIB_LDEXPF)/g' \
-	      -e 's/@''GNULIB_LDEXPL''@/$(GNULIB_LDEXPL)/g' \
-	      -e 's/@''GNULIB_LOG''@/$(GNULIB_LOG)/g' \
-	      -e 's/@''GNULIB_LOGF''@/$(GNULIB_LOGF)/g' \
-	      -e 's/@''GNULIB_LOGL''@/$(GNULIB_LOGL)/g' \
-	      -e 's/@''GNULIB_LOG10''@/$(GNULIB_LOG10)/g' \
-	      -e 's/@''GNULIB_LOG10F''@/$(GNULIB_LOG10F)/g' \
-	      -e 's/@''GNULIB_LOG10L''@/$(GNULIB_LOG10L)/g' \
-	      -e 's/@''GNULIB_LOG1P''@/$(GNULIB_LOG1P)/g' \
-	      -e 's/@''GNULIB_LOG1PF''@/$(GNULIB_LOG1PF)/g' \
-	      -e 's/@''GNULIB_LOG1PL''@/$(GNULIB_LOG1PL)/g' \
-	      -e 's/@''GNULIB_LOG2''@/$(GNULIB_LOG2)/g' \
-	      -e 's/@''GNULIB_LOG2F''@/$(GNULIB_LOG2F)/g' \
-	      -e 's/@''GNULIB_LOG2L''@/$(GNULIB_LOG2L)/g' \
-	      -e 's/@''GNULIB_LOGB''@/$(GNULIB_LOGB)/g' \
-	      -e 's/@''GNULIB_LOGBF''@/$(GNULIB_LOGBF)/g' \
-	      -e 's/@''GNULIB_LOGBL''@/$(GNULIB_LOGBL)/g' \
-	      -e 's/@''GNULIB_MODF''@/$(GNULIB_MODF)/g' \
-	      -e 's/@''GNULIB_MODFF''@/$(GNULIB_MODFF)/g' \
-	      -e 's/@''GNULIB_MODFL''@/$(GNULIB_MODFL)/g' \
-	      -e 's/@''GNULIB_POWF''@/$(GNULIB_POWF)/g' \
-	      -e 's/@''GNULIB_REMAINDER''@/$(GNULIB_REMAINDER)/g' \
-	      -e 's/@''GNULIB_REMAINDERF''@/$(GNULIB_REMAINDERF)/g' \
-	      -e 's/@''GNULIB_REMAINDERL''@/$(GNULIB_REMAINDERL)/g' \
-	      -e 's/@''GNULIB_RINT''@/$(GNULIB_RINT)/g' \
-	      -e 's/@''GNULIB_RINTF''@/$(GNULIB_RINTF)/g' \
-	      -e 's/@''GNULIB_RINTL''@/$(GNULIB_RINTL)/g' \
-	      -e 's/@''GNULIB_ROUND''@/$(GNULIB_ROUND)/g' \
-	      -e 's/@''GNULIB_ROUNDF''@/$(GNULIB_ROUNDF)/g' \
-	      -e 's/@''GNULIB_ROUNDL''@/$(GNULIB_ROUNDL)/g' \
-	      -e 's/@''GNULIB_SIGNBIT''@/$(GNULIB_SIGNBIT)/g' \
-	      -e 's/@''GNULIB_SINF''@/$(GNULIB_SINF)/g' \
-	      -e 's/@''GNULIB_SINL''@/$(GNULIB_SINL)/g' \
-	      -e 's/@''GNULIB_SINHF''@/$(GNULIB_SINHF)/g' \
-	      -e 's/@''GNULIB_SQRTF''@/$(GNULIB_SQRTF)/g' \
-	      -e 's/@''GNULIB_SQRTL''@/$(GNULIB_SQRTL)/g' \
-	      -e 's/@''GNULIB_TANF''@/$(GNULIB_TANF)/g' \
-	      -e 's/@''GNULIB_TANL''@/$(GNULIB_TANL)/g' \
-	      -e 's/@''GNULIB_TANHF''@/$(GNULIB_TANHF)/g' \
-	      -e 's/@''GNULIB_TRUNC''@/$(GNULIB_TRUNC)/g' \
-	      -e 's/@''GNULIB_TRUNCF''@/$(GNULIB_TRUNCF)/g' \
-	      -e 's/@''GNULIB_TRUNCL''@/$(GNULIB_TRUNCL)/g' \
-	  | \
-	  sed -e 's|@''HAVE_ACOSF''@|$(HAVE_ACOSF)|g' \
-	      -e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \
-	      -e 's|@''HAVE_ASINF''@|$(HAVE_ASINF)|g' \
-	      -e 's|@''HAVE_ASINL''@|$(HAVE_ASINL)|g' \
-	      -e 's|@''HAVE_ATANF''@|$(HAVE_ATANF)|g' \
-	      -e 's|@''HAVE_ATANL''@|$(HAVE_ATANL)|g' \
-	      -e 's|@''HAVE_ATAN2F''@|$(HAVE_ATAN2F)|g' \
-	      -e 's|@''HAVE_CBRT''@|$(HAVE_CBRT)|g' \
-	      -e 's|@''HAVE_CBRTF''@|$(HAVE_CBRTF)|g' \
-	      -e 's|@''HAVE_CBRTL''@|$(HAVE_CBRTL)|g' \
-	      -e 's|@''HAVE_COPYSIGN''@|$(HAVE_COPYSIGN)|g' \
-	      -e 's|@''HAVE_COPYSIGNL''@|$(HAVE_COPYSIGNL)|g' \
-	      -e 's|@''HAVE_COSF''@|$(HAVE_COSF)|g' \
-	      -e 's|@''HAVE_COSL''@|$(HAVE_COSL)|g' \
-	      -e 's|@''HAVE_COSHF''@|$(HAVE_COSHF)|g' \
-	      -e 's|@''HAVE_EXPF''@|$(HAVE_EXPF)|g' \
-	      -e 's|@''HAVE_EXPL''@|$(HAVE_EXPL)|g' \
-	      -e 's|@''HAVE_EXPM1''@|$(HAVE_EXPM1)|g' \
-	      -e 's|@''HAVE_EXPM1F''@|$(HAVE_EXPM1F)|g' \
-	      -e 's|@''HAVE_FABSF''@|$(HAVE_FABSF)|g' \
-	      -e 's|@''HAVE_FABSL''@|$(HAVE_FABSL)|g' \
-	      -e 's|@''HAVE_FMA''@|$(HAVE_FMA)|g' \
-	      -e 's|@''HAVE_FMAF''@|$(HAVE_FMAF)|g' \
-	      -e 's|@''HAVE_FMAL''@|$(HAVE_FMAL)|g' \
-	      -e 's|@''HAVE_FMODF''@|$(HAVE_FMODF)|g' \
-	      -e 's|@''HAVE_FMODL''@|$(HAVE_FMODL)|g' \
-	      -e 's|@''HAVE_FREXPF''@|$(HAVE_FREXPF)|g' \
-	      -e 's|@''HAVE_HYPOTF''@|$(HAVE_HYPOTF)|g' \
-	      -e 's|@''HAVE_HYPOTL''@|$(HAVE_HYPOTL)|g' \
-	      -e 's|@''HAVE_ILOGB''@|$(HAVE_ILOGB)|g' \
-	      -e 's|@''HAVE_ILOGBF''@|$(HAVE_ILOGBF)|g' \
-	      -e 's|@''HAVE_ILOGBL''@|$(HAVE_ILOGBL)|g' \
-	      -e 's|@''HAVE_ISNANF''@|$(HAVE_ISNANF)|g' \
-	      -e 's|@''HAVE_ISNAND''@|$(HAVE_ISNAND)|g' \
-	      -e 's|@''HAVE_ISNANL''@|$(HAVE_ISNANL)|g' \
-	      -e 's|@''HAVE_LDEXPF''@|$(HAVE_LDEXPF)|g' \
-	      -e 's|@''HAVE_LOGF''@|$(HAVE_LOGF)|g' \
-	      -e 's|@''HAVE_LOGL''@|$(HAVE_LOGL)|g' \
-	      -e 's|@''HAVE_LOG10F''@|$(HAVE_LOG10F)|g' \
-	      -e 's|@''HAVE_LOG10L''@|$(HAVE_LOG10L)|g' \
-	      -e 's|@''HAVE_LOG1P''@|$(HAVE_LOG1P)|g' \
-	      -e 's|@''HAVE_LOG1PF''@|$(HAVE_LOG1PF)|g' \
-	      -e 's|@''HAVE_LOG1PL''@|$(HAVE_LOG1PL)|g' \
-	      -e 's|@''HAVE_LOGBF''@|$(HAVE_LOGBF)|g' \
-	      -e 's|@''HAVE_LOGBL''@|$(HAVE_LOGBL)|g' \
-	      -e 's|@''HAVE_MODFF''@|$(HAVE_MODFF)|g' \
-	      -e 's|@''HAVE_MODFL''@|$(HAVE_MODFL)|g' \
-	      -e 's|@''HAVE_POWF''@|$(HAVE_POWF)|g' \
-	      -e 's|@''HAVE_REMAINDER''@|$(HAVE_REMAINDER)|g' \
-	      -e 's|@''HAVE_REMAINDERF''@|$(HAVE_REMAINDERF)|g' \
-	      -e 's|@''HAVE_RINT''@|$(HAVE_RINT)|g' \
-	      -e 's|@''HAVE_RINTL''@|$(HAVE_RINTL)|g' \
-	      -e 's|@''HAVE_SINF''@|$(HAVE_SINF)|g' \
-	      -e 's|@''HAVE_SINL''@|$(HAVE_SINL)|g' \
-	      -e 's|@''HAVE_SINHF''@|$(HAVE_SINHF)|g' \
-	      -e 's|@''HAVE_SQRTF''@|$(HAVE_SQRTF)|g' \
-	      -e 's|@''HAVE_SQRTL''@|$(HAVE_SQRTL)|g' \
-	      -e 's|@''HAVE_TANF''@|$(HAVE_TANF)|g' \
-	      -e 's|@''HAVE_TANL''@|$(HAVE_TANL)|g' \
-	      -e 's|@''HAVE_TANHF''@|$(HAVE_TANHF)|g' \
-	      -e 's|@''HAVE_DECL_ACOSL''@|$(HAVE_DECL_ACOSL)|g' \
-	      -e 's|@''HAVE_DECL_ASINL''@|$(HAVE_DECL_ASINL)|g' \
-	      -e 's|@''HAVE_DECL_ATANL''@|$(HAVE_DECL_ATANL)|g' \
-	      -e 's|@''HAVE_DECL_CBRTF''@|$(HAVE_DECL_CBRTF)|g' \
-	      -e 's|@''HAVE_DECL_CBRTL''@|$(HAVE_DECL_CBRTL)|g' \
-	      -e 's|@''HAVE_DECL_CEILF''@|$(HAVE_DECL_CEILF)|g' \
-	      -e 's|@''HAVE_DECL_CEILL''@|$(HAVE_DECL_CEILL)|g' \
-	      -e 's|@''HAVE_DECL_COPYSIGNF''@|$(HAVE_DECL_COPYSIGNF)|g' \
-	      -e 's|@''HAVE_DECL_COSL''@|$(HAVE_DECL_COSL)|g' \
-	      -e 's|@''HAVE_DECL_EXPL''@|$(HAVE_DECL_EXPL)|g' \
-	      -e 's|@''HAVE_DECL_EXP2''@|$(HAVE_DECL_EXP2)|g' \
-	      -e 's|@''HAVE_DECL_EXP2F''@|$(HAVE_DECL_EXP2F)|g' \
-	      -e 's|@''HAVE_DECL_EXP2L''@|$(HAVE_DECL_EXP2L)|g' \
-	      -e 's|@''HAVE_DECL_EXPM1L''@|$(HAVE_DECL_EXPM1L)|g' \
-	      -e 's|@''HAVE_DECL_FLOORF''@|$(HAVE_DECL_FLOORF)|g' \
-	      -e 's|@''HAVE_DECL_FLOORL''@|$(HAVE_DECL_FLOORL)|g' \
-	      -e 's|@''HAVE_DECL_FREXPL''@|$(HAVE_DECL_FREXPL)|g' \
-	      -e 's|@''HAVE_DECL_LDEXPL''@|$(HAVE_DECL_LDEXPL)|g' \
-	      -e 's|@''HAVE_DECL_LOGL''@|$(HAVE_DECL_LOGL)|g' \
-	      -e 's|@''HAVE_DECL_LOG10L''@|$(HAVE_DECL_LOG10L)|g' \
-	      -e 's|@''HAVE_DECL_LOG2''@|$(HAVE_DECL_LOG2)|g' \
-	      -e 's|@''HAVE_DECL_LOG2F''@|$(HAVE_DECL_LOG2F)|g' \
-	      -e 's|@''HAVE_DECL_LOG2L''@|$(HAVE_DECL_LOG2L)|g' \
-	      -e 's|@''HAVE_DECL_LOGB''@|$(HAVE_DECL_LOGB)|g' \
-	      -e 's|@''HAVE_DECL_REMAINDER''@|$(HAVE_DECL_REMAINDER)|g' \
-	      -e 's|@''HAVE_DECL_REMAINDERL''@|$(HAVE_DECL_REMAINDERL)|g' \
-	      -e 's|@''HAVE_DECL_RINTF''@|$(HAVE_DECL_RINTF)|g' \
-	      -e 's|@''HAVE_DECL_ROUND''@|$(HAVE_DECL_ROUND)|g' \
-	      -e 's|@''HAVE_DECL_ROUNDF''@|$(HAVE_DECL_ROUNDF)|g' \
-	      -e 's|@''HAVE_DECL_ROUNDL''@|$(HAVE_DECL_ROUNDL)|g' \
-	      -e 's|@''HAVE_DECL_SINL''@|$(HAVE_DECL_SINL)|g' \
-	      -e 's|@''HAVE_DECL_SQRTL''@|$(HAVE_DECL_SQRTL)|g' \
-	      -e 's|@''HAVE_DECL_TANL''@|$(HAVE_DECL_TANL)|g' \
-	      -e 's|@''HAVE_DECL_TRUNC''@|$(HAVE_DECL_TRUNC)|g' \
-	      -e 's|@''HAVE_DECL_TRUNCF''@|$(HAVE_DECL_TRUNCF)|g' \
-	      -e 's|@''HAVE_DECL_TRUNCL''@|$(HAVE_DECL_TRUNCL)|g' \
-	  | \
-	  sed -e 's|@''REPLACE_CBRTF''@|$(REPLACE_CBRTF)|g' \
-	      -e 's|@''REPLACE_CBRTL''@|$(REPLACE_CBRTL)|g' \
-	      -e 's|@''REPLACE_CEIL''@|$(REPLACE_CEIL)|g' \
-	      -e 's|@''REPLACE_CEILF''@|$(REPLACE_CEILF)|g' \
-	      -e 's|@''REPLACE_CEILL''@|$(REPLACE_CEILL)|g' \
-	      -e 's|@''REPLACE_EXPM1''@|$(REPLACE_EXPM1)|g' \
-	      -e 's|@''REPLACE_EXPM1F''@|$(REPLACE_EXPM1F)|g' \
-	      -e 's|@''REPLACE_EXP2''@|$(REPLACE_EXP2)|g' \
-	      -e 's|@''REPLACE_EXP2L''@|$(REPLACE_EXP2L)|g' \
-	      -e 's|@''REPLACE_FABSL''@|$(REPLACE_FABSL)|g' \
-	      -e 's|@''REPLACE_FLOOR''@|$(REPLACE_FLOOR)|g' \
-	      -e 's|@''REPLACE_FLOORF''@|$(REPLACE_FLOORF)|g' \
-	      -e 's|@''REPLACE_FLOORL''@|$(REPLACE_FLOORL)|g' \
-	      -e 's|@''REPLACE_FMA''@|$(REPLACE_FMA)|g' \
-	      -e 's|@''REPLACE_FMAF''@|$(REPLACE_FMAF)|g' \
-	      -e 's|@''REPLACE_FMAL''@|$(REPLACE_FMAL)|g' \
-	      -e 's|@''REPLACE_FMOD''@|$(REPLACE_FMOD)|g' \
-	      -e 's|@''REPLACE_FMODF''@|$(REPLACE_FMODF)|g' \
-	      -e 's|@''REPLACE_FMODL''@|$(REPLACE_FMODL)|g' \
-	      -e 's|@''REPLACE_FREXPF''@|$(REPLACE_FREXPF)|g' \
-	      -e 's|@''REPLACE_FREXP''@|$(REPLACE_FREXP)|g' \
-	      -e 's|@''REPLACE_FREXPL''@|$(REPLACE_FREXPL)|g' \
-	      -e 's|@''REPLACE_HUGE_VAL''@|$(REPLACE_HUGE_VAL)|g' \
-	      -e 's|@''REPLACE_HYPOT''@|$(REPLACE_HYPOT)|g' \
-	      -e 's|@''REPLACE_HYPOTF''@|$(REPLACE_HYPOTF)|g' \
-	      -e 's|@''REPLACE_HYPOTL''@|$(REPLACE_HYPOTL)|g' \
-	      -e 's|@''REPLACE_ILOGB''@|$(REPLACE_ILOGB)|g' \
-	      -e 's|@''REPLACE_ILOGBF''@|$(REPLACE_ILOGBF)|g' \
-	      -e 's|@''REPLACE_ISFINITE''@|$(REPLACE_ISFINITE)|g' \
-	      -e 's|@''REPLACE_ISINF''@|$(REPLACE_ISINF)|g' \
-	      -e 's|@''REPLACE_ISNAN''@|$(REPLACE_ISNAN)|g' \
-	      -e 's|@''REPLACE_ITOLD''@|$(REPLACE_ITOLD)|g' \
-	      -e 's|@''REPLACE_LDEXPL''@|$(REPLACE_LDEXPL)|g' \
-	      -e 's|@''REPLACE_LOG''@|$(REPLACE_LOG)|g' \
-	      -e 's|@''REPLACE_LOGF''@|$(REPLACE_LOGF)|g' \
-	      -e 's|@''REPLACE_LOGL''@|$(REPLACE_LOGL)|g' \
-	      -e 's|@''REPLACE_LOG10''@|$(REPLACE_LOG10)|g' \
-	      -e 's|@''REPLACE_LOG10F''@|$(REPLACE_LOG10F)|g' \
-	      -e 's|@''REPLACE_LOG10L''@|$(REPLACE_LOG10L)|g' \
-	      -e 's|@''REPLACE_LOG1P''@|$(REPLACE_LOG1P)|g' \
-	      -e 's|@''REPLACE_LOG1PF''@|$(REPLACE_LOG1PF)|g' \
-	      -e 's|@''REPLACE_LOG1PL''@|$(REPLACE_LOG1PL)|g' \
-	      -e 's|@''REPLACE_LOG2''@|$(REPLACE_LOG2)|g' \
-	      -e 's|@''REPLACE_LOG2F''@|$(REPLACE_LOG2F)|g' \
-	      -e 's|@''REPLACE_LOG2L''@|$(REPLACE_LOG2L)|g' \
-	      -e 's|@''REPLACE_LOGB''@|$(REPLACE_LOGB)|g' \
-	      -e 's|@''REPLACE_LOGBF''@|$(REPLACE_LOGBF)|g' \
-	      -e 's|@''REPLACE_LOGBL''@|$(REPLACE_LOGBL)|g' \
-	      -e 's|@''REPLACE_MODF''@|$(REPLACE_MODF)|g' \
-	      -e 's|@''REPLACE_MODFF''@|$(REPLACE_MODFF)|g' \
-	      -e 's|@''REPLACE_MODFL''@|$(REPLACE_MODFL)|g' \
-	      -e 's|@''REPLACE_NAN''@|$(REPLACE_NAN)|g' \
-	      -e 's|@''REPLACE_REMAINDER''@|$(REPLACE_REMAINDER)|g' \
-	      -e 's|@''REPLACE_REMAINDERF''@|$(REPLACE_REMAINDERF)|g' \
-	      -e 's|@''REPLACE_REMAINDERL''@|$(REPLACE_REMAINDERL)|g' \
-	      -e 's|@''REPLACE_ROUND''@|$(REPLACE_ROUND)|g' \
-	      -e 's|@''REPLACE_ROUNDF''@|$(REPLACE_ROUNDF)|g' \
-	      -e 's|@''REPLACE_ROUNDL''@|$(REPLACE_ROUNDL)|g' \
-	      -e 's|@''REPLACE_SIGNBIT''@|$(REPLACE_SIGNBIT)|g' \
-	      -e 's|@''REPLACE_SIGNBIT_USING_GCC''@|$(REPLACE_SIGNBIT_USING_GCC)|g' \
-	      -e 's|@''REPLACE_SQRTL''@|$(REPLACE_SQRTL)|g' \
-	      -e 's|@''REPLACE_TRUNC''@|$(REPLACE_TRUNC)|g' \
-	      -e 's|@''REPLACE_TRUNCF''@|$(REPLACE_TRUNCF)|g' \
-	      -e 's|@''REPLACE_TRUNCL''@|$(REPLACE_TRUNCL)|g' \
-	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-	      -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 += math.h math.h-t
-
-EXTRA_DIST += math.in.h
-
-## end   gnulib module math
-
-## begin gnulib module mbrtowc
-
-
-EXTRA_DIST += mbrtowc.c
-
-EXTRA_libgnu_a_SOURCES += mbrtowc.c
-
-## end   gnulib module mbrtowc
-
-## begin gnulib module mbsinit
-
-
-EXTRA_DIST += mbsinit.c
-
-EXTRA_libgnu_a_SOURCES += mbsinit.c
-
-## end   gnulib module mbsinit
-
-## begin gnulib module mbtowc
-
-
-EXTRA_DIST += mbtowc-impl.h mbtowc.c
-
-EXTRA_libgnu_a_SOURCES += mbtowc.c
-
-## end   gnulib module mbtowc
-
-## begin gnulib module memchr
-
-
-EXTRA_DIST += memchr.c memchr.valgrind
-
-EXTRA_libgnu_a_SOURCES += memchr.c
-
-## end   gnulib module memchr
-
-## begin gnulib module mktime
-
-
-EXTRA_DIST += mktime-internal.h mktime.c
-
-EXTRA_libgnu_a_SOURCES += mktime.c
-
-## end   gnulib module mktime
-
-## begin gnulib module mktime-internal
-
-
-EXTRA_DIST += mktime-internal.h mktime.c
-
-EXTRA_libgnu_a_SOURCES += mktime.c
-
-## end   gnulib module mktime-internal
-
-## begin gnulib module mountlist
-
-
-EXTRA_DIST += mountlist.c mountlist.h
-
-EXTRA_libgnu_a_SOURCES += mountlist.c
-
-## end   gnulib module mountlist
-
-## begin gnulib module msvc-inval
-
-
-EXTRA_DIST += msvc-inval.c msvc-inval.h
-
-EXTRA_libgnu_a_SOURCES += msvc-inval.c
-
-## end   gnulib module msvc-inval
-
-## begin gnulib module msvc-nothrow
-
-
-EXTRA_DIST += msvc-nothrow.c msvc-nothrow.h
-
-EXTRA_libgnu_a_SOURCES += msvc-nothrow.c
-
-## end   gnulib module msvc-nothrow
-
-## begin gnulib module netdb
-
-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 $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-	      -e 's|@''NEXT_NETDB_H''@|$(NEXT_NETDB_H)|g' \
-	      -e 's|@''HAVE_NETDB_H''@|$(HAVE_NETDB_H)|g' \
-	      -e 's/@''GNULIB_GETADDRINFO''@/$(GNULIB_GETADDRINFO)/g' \
-	      -e 's|@''HAVE_STRUCT_ADDRINFO''@|$(HAVE_STRUCT_ADDRINFO)|g' \
-	      -e 's|@''HAVE_DECL_FREEADDRINFO''@|$(HAVE_DECL_FREEADDRINFO)|g' \
-	      -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 's|@''REPLACE_GAI_STRERROR''@|$(REPLACE_GAI_STRERROR)|g' \
-	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-	      -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-	      < $(srcdir)/netdb.in.h; \
-	} > $@-t && \
-	mv $@-t $@
-MOSTLYCLEANFILES += netdb.h netdb.h-t
-
-EXTRA_DIST += netdb.in.h
-
-## end   gnulib module netdb
-
-## begin gnulib module netinet_in
-
-BUILT_SOURCES += $(NETINET_IN_H)
-
-# We need the following in order to create <netinet/in.h> when the system
-# doesn't have one.
-if GL_GENERATE_NETINET_IN_H
-netinet/in.h: netinet_in.in.h $(top_builddir)/config.status
-	$(AM_V_at)$(MKDIR_P) netinet
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|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 && \
-	mv $@-t $@
-else
-netinet/in.h: $(top_builddir)/config.status
-	rm -f $@
-endif
-MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t
-MOSTLYCLEANDIRS += netinet
-
-EXTRA_DIST += netinet_in.in.h
-
-## end   gnulib module netinet_in
-
-## begin gnulib module nl_langinfo
-
-
-EXTRA_DIST += nl_langinfo.c
-
-EXTRA_libgnu_a_SOURCES += nl_langinfo.c
-
-## end   gnulib module nl_langinfo
-
-## begin gnulib module read
-
-
-EXTRA_DIST += read.c
-
-EXTRA_libgnu_a_SOURCES += read.c
-
-## end   gnulib module read
-
-## begin gnulib module regex
-
-
-EXTRA_DIST += regcomp.c regex.c regex.h regex_internal.c regex_internal.h regexec.c
-
-EXTRA_libgnu_a_SOURCES += regcomp.c regex.c regex_internal.c regexec.c
-
-## end   gnulib module regex
-
-## begin gnulib module safe-read
-
-libgnu_a_SOURCES += safe-read.c
-
-EXTRA_DIST += safe-read.h
-
-## end   gnulib module safe-read
-
-## begin gnulib module setenv
-
-
-EXTRA_DIST += setenv.c
-
-EXTRA_libgnu_a_SOURCES += setenv.c
-
-## end   gnulib module setenv
-
-## begin gnulib module size_max
-
-libgnu_a_SOURCES += size_max.h
-
-## end   gnulib module size_max
-
-## begin gnulib module snippet/_Noreturn
-
-# Because this Makefile snippet defines a variable used by other
-# gnulib Makefile snippets, it must be present in all Makefile.am that
-# need it. This is ensured by the applicability 'all' defined above.
-
-_NORETURN_H=$(top_srcdir)/build-aux/snippet/_Noreturn.h
-
-EXTRA_DIST += $(top_srcdir)/build-aux/snippet/_Noreturn.h
-
-## end   gnulib module snippet/_Noreturn
-
-## begin gnulib module snippet/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/snippet/arg-nonnull.h, except that it has the copyright header cut
-# off.
-arg-nonnull.h: $(top_srcdir)/build-aux/snippet/arg-nonnull.h
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	sed -n -e '/GL_ARG_NONNULL/,$$p' \
-	  < $(top_srcdir)/build-aux/snippet/arg-nonnull.h \
-	  > $@-t && \
-	mv $@-t $@
-MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t
-
-ARG_NONNULL_H=arg-nonnull.h
-
-EXTRA_DIST += $(top_srcdir)/build-aux/snippet/arg-nonnull.h
-
-## end   gnulib module snippet/arg-nonnull
-
-## begin gnulib module snippet/c++defs
-
-# 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 += c++defs.h
-# The c++defs.h that gets inserted into generated .h files is the same as
-# build-aux/snippet/c++defs.h, except that it has the copyright header cut off.
-c++defs.h: $(top_srcdir)/build-aux/snippet/c++defs.h
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	sed -n -e '/_GL_CXXDEFS/,$$p' \
-	  < $(top_srcdir)/build-aux/snippet/c++defs.h \
-	  > $@-t && \
-	mv $@-t $@
-MOSTLYCLEANFILES += c++defs.h c++defs.h-t
-
-CXXDEFS_H=c++defs.h
-
-EXTRA_DIST += $(top_srcdir)/build-aux/snippet/c++defs.h
-
-## end   gnulib module snippet/c++defs
-
-## begin gnulib module snippet/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/snippet/warn-on-use.h, except that it has the copyright header cut
-# off.
-warn-on-use.h: $(top_srcdir)/build-aux/snippet/warn-on-use.h
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	sed -n -e '/^.ifndef/,$$p' \
-	  < $(top_srcdir)/build-aux/snippet/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)/build-aux/snippet/warn-on-use.h
-
-## end   gnulib module snippet/warn-on-use
-
-## begin gnulib module snprintf
-
-
-EXTRA_DIST += snprintf.c
-
-EXTRA_libgnu_a_SOURCES += snprintf.c
-
-## end   gnulib module snprintf
-
-## begin gnulib module sockets
-
-libgnu_a_SOURCES += sockets.h sockets.c
-
-EXTRA_DIST += w32sock.h
-
-## end   gnulib module sockets
-
-## begin gnulib module stdalign
-
-BUILT_SOURCES += $(STDALIGN_H)
-
-# We need the following in order to create <stdalign.h> when the system
-# doesn't have one that works.
-if GL_GENERATE_STDALIGN_H
-stdalign.h: stdalign.in.h $(top_builddir)/config.status
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-	  cat $(srcdir)/stdalign.in.h; \
-	} > $@-t && \
-	mv $@-t $@
-else
-stdalign.h: $(top_builddir)/config.status
-	rm -f $@
-endif
-MOSTLYCLEANFILES += stdalign.h stdalign.h-t
-
-EXTRA_DIST += stdalign.in.h
-
-## end   gnulib module stdalign
-
-## begin gnulib module stdbool
-
-BUILT_SOURCES += $(STDBOOL_H)
-
-# We need the following in order to create <stdbool.h> when the system
-# doesn't have one that works.
-if GL_GENERATE_STDBOOL_H
-stdbool.h: stdbool.in.h $(top_builddir)/config.status
-	$(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 && \
-	mv $@-t $@
-else
-stdbool.h: $(top_builddir)/config.status
-	rm -f $@
-endif
-MOSTLYCLEANFILES += stdbool.h stdbool.h-t
-
-EXTRA_DIST += stdbool.in.h
-
-## end   gnulib module stdbool
-
-## begin gnulib module stddef
-
-BUILT_SOURCES += $(STDDEF_H)
-
-# We need the following in order to create <stddef.h> when the system
-# doesn't have one that works with the given compiler.
-if GL_GENERATE_STDDEF_H
-stddef.h: stddef.in.h $(top_builddir)/config.status
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-	      -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
-	      -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \
-	      -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \
-	      -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
-	      < $(srcdir)/stddef.in.h; \
-	} > $@-t && \
-	mv $@-t $@
-else
-stddef.h: $(top_builddir)/config.status
-	rm -f $@
-endif
-MOSTLYCLEANFILES += stddef.h stddef.h-t
-
-EXTRA_DIST += stddef.in.h
-
-## end   gnulib module stddef
-
-## begin gnulib module stdint
-
-BUILT_SOURCES += $(STDINT_H)
-
-# We need the following in order to create <stdint.h> when the system
-# doesn't have one that works with the given compiler.
-if GL_GENERATE_STDINT_H
-stdint.h: stdint.in.h $(top_builddir)/config.status
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-	      -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
-	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-	      -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \
-	      -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
-	      -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
-	      -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \
-	      -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
-	      -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
-	      -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
-	      -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
-	      -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \
-	      -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \
-	      -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \
-	      -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \
-	      -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \
-	      -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \
-	      -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \
-	      -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \
-	      -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \
-	      -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \
-	      -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \
-	      -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \
-	      -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
-	      -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
-	      < $(srcdir)/stdint.in.h; \
-	} > $@-t && \
-	mv $@-t $@
-else
-stdint.h: $(top_builddir)/config.status
-	rm -f $@
-endif
-MOSTLYCLEANFILES += stdint.h stdint.h-t
-
-EXTRA_DIST += stdint.in.h
-
-## end   gnulib module stdint
-
-## begin gnulib module stdio
-
-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 $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-	      -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \
-	      -e 's/@''GNULIB_DPRINTF''@/$(GNULIB_DPRINTF)/g' \
-	      -e 's/@''GNULIB_FCLOSE''@/$(GNULIB_FCLOSE)/g' \
-	      -e 's/@''GNULIB_FDOPEN''@/$(GNULIB_FDOPEN)/g' \
-	      -e 's/@''GNULIB_FFLUSH''@/$(GNULIB_FFLUSH)/g' \
-	      -e 's/@''GNULIB_FGETC''@/$(GNULIB_FGETC)/g' \
-	      -e 's/@''GNULIB_FGETS''@/$(GNULIB_FGETS)/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_FREAD''@/$(GNULIB_FREAD)/g' \
-	      -e 's/@''GNULIB_FREOPEN''@/$(GNULIB_FREOPEN)/g' \
-	      -e 's/@''GNULIB_FSCANF''@/$(GNULIB_FSCANF)/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_FWRITE''@/$(GNULIB_FWRITE)/g' \
-	      -e 's/@''GNULIB_GETC''@/$(GNULIB_GETC)/g' \
-	      -e 's/@''GNULIB_GETCHAR''@/$(GNULIB_GETCHAR)/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_PCLOSE''@/$(GNULIB_PCLOSE)/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_SCANF''@/$(GNULIB_SCANF)/g' \
-	      -e 's/@''GNULIB_SNPRINTF''@/$(GNULIB_SNPRINTF)/g' \
-	      -e 's/@''GNULIB_SPRINTF_POSIX''@/$(GNULIB_SPRINTF_POSIX)/g' \
-	      -e 's/@''GNULIB_STDIO_H_NONBLOCKING''@/$(GNULIB_STDIO_H_NONBLOCKING)/g' \
-	      -e 's/@''GNULIB_STDIO_H_SIGPIPE''@/$(GNULIB_STDIO_H_SIGPIPE)/g' \
-	      -e 's/@''GNULIB_TMPFILE''@/$(GNULIB_TMPFILE)/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_VFSCANF''@/$(GNULIB_VFSCANF)/g' \
-	      -e 's/@''GNULIB_VSCANF''@/$(GNULIB_VSCANF)/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_FSEEKO''@|$(HAVE_DECL_FSEEKO)|g' \
-	      -e 's|@''HAVE_DECL_FTELLO''@|$(HAVE_DECL_FTELLO)|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|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \
-	      -e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \
-	      -e 's|@''HAVE_FSEEKO''@|$(HAVE_FSEEKO)|g' \
-	      -e 's|@''HAVE_FTELLO''@|$(HAVE_FTELLO)|g' \
-	      -e 's|@''HAVE_PCLOSE''@|$(HAVE_PCLOSE)|g' \
-	      -e 's|@''HAVE_POPEN''@|$(HAVE_POPEN)|g' \
-	      -e 's|@''HAVE_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \
-	      -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|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_FDOPEN''@|$(REPLACE_FDOPEN)|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_FSEEK''@|$(REPLACE_FSEEK)|g' \
-	      -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
-	      -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \
-	      -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
-	      -e 's|@''REPLACE_GETDELIM''@|$(REPLACE_GETDELIM)|g' \
-	      -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \
-	      -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \
-	      -e 's|@''REPLACE_PERROR''@|$(REPLACE_PERROR)|g' \
-	      -e 's|@''REPLACE_POPEN''@|$(REPLACE_POPEN)|g' \
-	      -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \
-	      -e 's|@''REPLACE_REMOVE''@|$(REPLACE_REMOVE)|g' \
-	      -e 's|@''REPLACE_RENAME''@|$(REPLACE_RENAME)|g' \
-	      -e 's|@''REPLACE_RENAMEAT''@|$(REPLACE_RENAMEAT)|g' \
-	      -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \
-	      -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \
-	      -e 's|@''REPLACE_STDIO_READ_FUNCS''@|$(REPLACE_STDIO_READ_FUNCS)|g' \
-	      -e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \
-	      -e 's|@''REPLACE_TMPFILE''@|$(REPLACE_TMPFILE)|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 's|@''ASM_SYMBOL_PREFIX''@|$(ASM_SYMBOL_PREFIX)|g' \
-	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-	      -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
-
-EXTRA_DIST += stdio.in.h
-
-## end   gnulib module stdio
-
-## begin gnulib module stdlib
-
-BUILT_SOURCES += stdlib.h
-
-# We need the following in order to create <stdlib.h> when the system
-# doesn't have one that works with the given compiler.
-stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
-  $(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-	      -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
-	      -e 's/@''GNULIB__EXIT''@/$(GNULIB__EXIT)/g' \
-	      -e 's/@''GNULIB_ATOLL''@/$(GNULIB_ATOLL)/g' \
-	      -e 's/@''GNULIB_CALLOC_POSIX''@/$(GNULIB_CALLOC_POSIX)/g' \
-	      -e 's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GNULIB_CANONICALIZE_FILE_NAME)/g' \
-	      -e 's/@''GNULIB_GETLOADAVG''@/$(GNULIB_GETLOADAVG)/g' \
-	      -e 's/@''GNULIB_GETSUBOPT''@/$(GNULIB_GETSUBOPT)/g' \
-	      -e 's/@''GNULIB_GRANTPT''@/$(GNULIB_GRANTPT)/g' \
-	      -e 's/@''GNULIB_MALLOC_POSIX''@/$(GNULIB_MALLOC_POSIX)/g' \
-	      -e 's/@''GNULIB_MBTOWC''@/$(GNULIB_MBTOWC)/g' \
-	      -e 's/@''GNULIB_MKDTEMP''@/$(GNULIB_MKDTEMP)/g' \
-	      -e 's/@''GNULIB_MKOSTEMP''@/$(GNULIB_MKOSTEMP)/g' \
-	      -e 's/@''GNULIB_MKOSTEMPS''@/$(GNULIB_MKOSTEMPS)/g' \
-	      -e 's/@''GNULIB_MKSTEMP''@/$(GNULIB_MKSTEMP)/g' \
-	      -e 's/@''GNULIB_MKSTEMPS''@/$(GNULIB_MKSTEMPS)/g' \
-	      -e 's/@''GNULIB_POSIX_OPENPT''@/$(GNULIB_POSIX_OPENPT)/g' \
-	      -e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \
-	      -e 's/@''GNULIB_PTSNAME_R''@/$(GNULIB_PTSNAME_R)/g' \
-	      -e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \
-	      -e 's/@''GNULIB_QSORT_R''@/$(GNULIB_QSORT_R)/g' \
-	      -e 's/@''GNULIB_RANDOM''@/$(GNULIB_RANDOM)/g' \
-	      -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \
-	      -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \
-	      -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \
-	      -e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \
-	      -e 's/@''GNULIB_SECURE_GETENV''@/$(GNULIB_SECURE_GETENV)/g' \
-	      -e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \
-	      -e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \
-	      -e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \
-	      -e 's/@''GNULIB_STRTOULL''@/$(GNULIB_STRTOULL)/g' \
-	      -e 's/@''GNULIB_SYSTEM_POSIX''@/$(GNULIB_SYSTEM_POSIX)/g' \
-	      -e 's/@''GNULIB_UNLOCKPT''@/$(GNULIB_UNLOCKPT)/g' \
-	      -e 's/@''GNULIB_UNSETENV''@/$(GNULIB_UNSETENV)/g' \
-	      -e 's/@''GNULIB_WCTOMB''@/$(GNULIB_WCTOMB)/g' \
-	      < $(srcdir)/stdlib.in.h | \
-	  sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \
-	      -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \
-	      -e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \
-	      -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \
-	      -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
-	      -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \
-	      -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
-	      -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \
-	      -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \
-	      -e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \
-	      -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \
-	      -e 's|@''HAVE_POSIX_OPENPT''@|$(HAVE_POSIX_OPENPT)|g' \
-	      -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \
-	      -e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \
-	      -e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \
-	      -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
-	      -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
-	      -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \
-	      -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
-	      -e 's|@''HAVE_SECURE_GETENV''@|$(HAVE_SECURE_GETENV)|g' \
-	      -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \
-	      -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
-	      -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \
-	      -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \
-	      -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \
-	      -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \
-	      -e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \
-	      -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \
-	      -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \
-	      -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \
-	      -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
-	      -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \
-	      -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
-	      -e 's|@''REPLACE_PTSNAME''@|$(REPLACE_PTSNAME)|g' \
-	      -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \
-	      -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
-	      -e 's|@''REPLACE_QSORT_R''@|$(REPLACE_QSORT_R)|g' \
-	      -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \
-	      -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
-	      -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
-	      -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
-	      -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
-	      -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
-	      -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \
-	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-	      -e '/definition of _Noreturn/r $(_NORETURN_H)' \
-	      -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 += stdlib.h stdlib.h-t
-
-EXTRA_DIST += stdlib.in.h
-
-## end   gnulib module stdlib
-
-## begin gnulib module strcase
-
-
-EXTRA_DIST += strcasecmp.c strncasecmp.c
-
-EXTRA_libgnu_a_SOURCES += strcasecmp.c strncasecmp.c
-
-## end   gnulib module strcase
-
-## begin gnulib module strcasestr-simple
-
-
-EXTRA_DIST += str-two-way.h strcasestr.c
-
-EXTRA_libgnu_a_SOURCES += strcasestr.c
-
-## end   gnulib module strcasestr-simple
-
-## begin gnulib module streq
-
-
-EXTRA_DIST += streq.h
-
-## end   gnulib module streq
-
-## begin gnulib module strerror
-
-
-EXTRA_DIST += strerror.c
-
-EXTRA_libgnu_a_SOURCES += strerror.c
-
-## end   gnulib module strerror
-
-## begin gnulib module strerror-override
-
-
-EXTRA_DIST += strerror-override.c strerror-override.h
-
-EXTRA_libgnu_a_SOURCES += strerror-override.c
-
-## end   gnulib module strerror-override
-
-## begin gnulib module string
-
-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 $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-	      -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \
-	      -e 's/@''GNULIB_FFSL''@/$(GNULIB_FFSL)/g' \
-	      -e 's/@''GNULIB_FFSLL''@/$(GNULIB_FFSLL)/g' \
-	      -e 's/@''GNULIB_MBSLEN''@/$(GNULIB_MBSLEN)/g' \
-	      -e 's/@''GNULIB_MBSNLEN''@/$(GNULIB_MBSNLEN)/g' \
-	      -e 's/@''GNULIB_MBSCHR''@/$(GNULIB_MBSCHR)/g' \
-	      -e 's/@''GNULIB_MBSRCHR''@/$(GNULIB_MBSRCHR)/g' \
-	      -e 's/@''GNULIB_MBSSTR''@/$(GNULIB_MBSSTR)/g' \
-	      -e 's/@''GNULIB_MBSCASECMP''@/$(GNULIB_MBSCASECMP)/g' \
-	      -e 's/@''GNULIB_MBSNCASECMP''@/$(GNULIB_MBSNCASECMP)/g' \
-	      -e 's/@''GNULIB_MBSPCASECMP''@/$(GNULIB_MBSPCASECMP)/g' \
-	      -e 's/@''GNULIB_MBSCASESTR''@/$(GNULIB_MBSCASESTR)/g' \
-	      -e 's/@''GNULIB_MBSCSPN''@/$(GNULIB_MBSCSPN)/g' \
-	      -e 's/@''GNULIB_MBSPBRK''@/$(GNULIB_MBSPBRK)/g' \
-	      -e 's/@''GNULIB_MBSSPN''@/$(GNULIB_MBSSPN)/g' \
-	      -e 's/@''GNULIB_MBSSEP''@/$(GNULIB_MBSSEP)/g' \
-	      -e 's/@''GNULIB_MBSTOK_R''@/$(GNULIB_MBSTOK_R)/g' \
-	      -e 's/@''GNULIB_MEMCHR''@/$(GNULIB_MEMCHR)/g' \
-	      -e 's/@''GNULIB_MEMMEM''@/$(GNULIB_MEMMEM)/g' \
-	      -e 's/@''GNULIB_MEMPCPY''@/$(GNULIB_MEMPCPY)/g' \
-	      -e 's/@''GNULIB_MEMRCHR''@/$(GNULIB_MEMRCHR)/g' \
-	      -e 's/@''GNULIB_RAWMEMCHR''@/$(GNULIB_RAWMEMCHR)/g' \
-	      -e 's/@''GNULIB_STPCPY''@/$(GNULIB_STPCPY)/g' \
-	      -e 's/@''GNULIB_STPNCPY''@/$(GNULIB_STPNCPY)/g' \
-	      -e 's/@''GNULIB_STRCHRNUL''@/$(GNULIB_STRCHRNUL)/g' \
-	      -e 's/@''GNULIB_STRDUP''@/$(GNULIB_STRDUP)/g' \
-	      -e 's/@''GNULIB_STRNCAT''@/$(GNULIB_STRNCAT)/g' \
-	      -e 's/@''GNULIB_STRNDUP''@/$(GNULIB_STRNDUP)/g' \
-	      -e 's/@''GNULIB_STRNLEN''@/$(GNULIB_STRNLEN)/g' \
-	      -e 's/@''GNULIB_STRPBRK''@/$(GNULIB_STRPBRK)/g' \
-	      -e 's/@''GNULIB_STRSEP''@/$(GNULIB_STRSEP)/g' \
-	      -e 's/@''GNULIB_STRSTR''@/$(GNULIB_STRSTR)/g' \
-	      -e 's/@''GNULIB_STRCASESTR''@/$(GNULIB_STRCASESTR)/g' \
-	      -e 's/@''GNULIB_STRTOK_R''@/$(GNULIB_STRTOK_R)/g' \
-	      -e 's/@''GNULIB_STRERROR''@/$(GNULIB_STRERROR)/g' \
-	      -e 's/@''GNULIB_STRERROR_R''@/$(GNULIB_STRERROR_R)/g' \
-	      -e 's/@''GNULIB_STRSIGNAL''@/$(GNULIB_STRSIGNAL)/g' \
-	      -e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \
-	      < $(srcdir)/string.in.h | \
-	  sed -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \
-	      -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \
-	      -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
-	      -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|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' \
-	      -e 's|@''HAVE_RAWMEMCHR''@|$(HAVE_RAWMEMCHR)|g' \
-	      -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \
-	      -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_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \
-	      -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \
-	      -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \
-	      -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \
-	      -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
-	      -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
-	      -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \
-	      -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \
-	      -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \
-	      -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \
-	      -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \
-	      -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \
-	      -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \
-	      -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \
-	      -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \
-	      -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
-	      -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
-	      -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \
-	      -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \
-	      -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \
-	      -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \
-	      -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
-	      -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \
-	      -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \
-	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-	      -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 && \
-	mv $@-t $@
-MOSTLYCLEANFILES += string.h string.h-t
-
-EXTRA_DIST += string.in.h
-
-## end   gnulib module string
-
-## begin gnulib module strings
-
-BUILT_SOURCES += strings.h
-
-# We need the following in order to create <strings.h> when the system
-# doesn't have one that works with the given compiler.
-strings.h: strings.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-	      -e 's|@''HAVE_STRINGS_H''@|$(HAVE_STRINGS_H)|g' \
-	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-	      -e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \
-	      -e 's|@''GNULIB_FFS''@|$(GNULIB_FFS)|g' \
-	      -e 's|@''HAVE_FFS''@|$(HAVE_FFS)|g' \
-	      -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
-	      -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
-	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-	      -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-	      < $(srcdir)/strings.in.h; \
-	} > $@-t && \
-	mv $@-t $@
-MOSTLYCLEANFILES += strings.h strings.h-t
-
-EXTRA_DIST += strings.in.h
-
-## end   gnulib module strings
-
-## begin gnulib module strndup
-
-
-EXTRA_DIST += strndup.c
-
-EXTRA_libgnu_a_SOURCES += strndup.c
-
-## end   gnulib module strndup
-
-## begin gnulib module strnlen
-
-
-EXTRA_DIST += strnlen.c
-
-EXTRA_libgnu_a_SOURCES += strnlen.c
-
-## end   gnulib module strnlen
-
-## begin gnulib module strsep
-
-
-EXTRA_DIST += strsep.c
-
-EXTRA_libgnu_a_SOURCES += strsep.c
-
-## end   gnulib module strsep
-
-## begin gnulib module strstr-simple
-
-
-EXTRA_DIST += str-two-way.h strstr.c
-
-EXTRA_libgnu_a_SOURCES += strstr.c
-
-## end   gnulib module strstr-simple
-
-## begin gnulib module sys_socket
-
-BUILT_SOURCES += sys/socket.h
-libgnu_a_SOURCES += sys_socket.c
-
-# 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 $(top_builddir)/config.status $(CXXDEFS_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|@''GUARD_PREFIX''@|GL|g' \
-	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-	      -e 's|@''NEXT_SYS_SOCKET_H''@|$(NEXT_SYS_SOCKET_H)|g' \
-	      -e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \
-	      -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \
-	      -e 's/@''GNULIB_SOCKET''@/$(GNULIB_SOCKET)/g' \
-	      -e 's/@''GNULIB_CONNECT''@/$(GNULIB_CONNECT)/g' \
-	      -e 's/@''GNULIB_ACCEPT''@/$(GNULIB_ACCEPT)/g' \
-	      -e 's/@''GNULIB_BIND''@/$(GNULIB_BIND)/g' \
-	      -e 's/@''GNULIB_GETPEERNAME''@/$(GNULIB_GETPEERNAME)/g' \
-	      -e 's/@''GNULIB_GETSOCKNAME''@/$(GNULIB_GETSOCKNAME)/g' \
-	      -e 's/@''GNULIB_GETSOCKOPT''@/$(GNULIB_GETSOCKOPT)/g' \
-	      -e 's/@''GNULIB_LISTEN''@/$(GNULIB_LISTEN)/g' \
-	      -e 's/@''GNULIB_RECV''@/$(GNULIB_RECV)/g' \
-	      -e 's/@''GNULIB_SEND''@/$(GNULIB_SEND)/g' \
-	      -e 's/@''GNULIB_RECVFROM''@/$(GNULIB_RECVFROM)/g' \
-	      -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_STRUCT_SOCKADDR_STORAGE_SS_FAMILY''@|$(HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY)|g' \
-	      -e 's|@''HAVE_SA_FAMILY_T''@|$(HAVE_SA_FAMILY_T)|g' \
-	      -e 's|@''HAVE_ACCEPT4''@|$(HAVE_ACCEPT4)|g' \
-	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-	      -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 && \
-	mv -f $@-t $@
-MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t
-MOSTLYCLEANDIRS += sys
-
-EXTRA_DIST += sys_socket.in.h
-
-## end   gnulib module sys_socket
-
-## 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 $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-	$(AM_V_at)$(MKDIR_P) sys
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-	      -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \
-	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-	      -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \
-	      -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \
-	      -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
-	      -e 's/@''HAVE_GETTIMEOFDAY''@/$(HAVE_GETTIMEOFDAY)/g' \
-	      -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \
-	      -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \
-	      -e 's/@''REPLACE_STRUCT_TIMEVAL''@/$(REPLACE_STRUCT_TIMEVAL)/g' \
-	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-	      -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-	      < $(srcdir)/sys_time.in.h; \
-	} > $@-t && \
-	mv $@-t $@
-MOSTLYCLEANFILES += sys/time.h sys/time.h-t
-
-EXTRA_DIST += sys_time.in.h
-
-## end   gnulib module sys_time
-
-## begin gnulib module sys_types
-
-BUILT_SOURCES += sys/types.h
-
-# We need the following in order to create <sys/types.h> when the system
-# doesn't have one that works with the given compiler.
-sys/types.h: sys_types.in.h $(top_builddir)/config.status
-	$(AM_V_at)$(MKDIR_P) sys
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-	      -e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \
-	      -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \
-	      < $(srcdir)/sys_types.in.h; \
-	} > $@-t && \
-	mv $@-t $@
-MOSTLYCLEANFILES += sys/types.h sys/types.h-t
-
-EXTRA_DIST += sys_types.in.h
-
-## end   gnulib module sys_types
-
-## begin gnulib module sys_uio
-
-BUILT_SOURCES += sys/uio.h
-
-# We need the following in order to create <sys/uio.h> when the system
-# doesn't have one that works with the given compiler.
-sys/uio.h: sys_uio.in.h $(top_builddir)/config.status
-	$(AM_V_at)$(MKDIR_P) sys
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-	      -e 's|@''NEXT_SYS_UIO_H''@|$(NEXT_SYS_UIO_H)|g' \
-	      -e 's|@''HAVE_SYS_UIO_H''@|$(HAVE_SYS_UIO_H)|g' \
-	      < $(srcdir)/sys_uio.in.h; \
-	} > $@-t && \
-	mv -f $@-t $@
-MOSTLYCLEANFILES += sys/uio.h sys/uio.h-t
-MOSTLYCLEANDIRS += sys
-
-EXTRA_DIST += sys_uio.in.h
-
-## end   gnulib module sys_uio
-
-## begin gnulib module threadlib
-
-libgnu_a_SOURCES += glthread/threadlib.c
-
-EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath
-
-## end   gnulib module threadlib
-
-## begin gnulib module time
-
-BUILT_SOURCES += time.h
-
-# We need the following in order to create <time.h> when the system
-# doesn't have one that works with the given compiler.
-time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-	      -e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \
-	      -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \
-	      -e 's/@''GNULIB_MKTIME''@/$(GNULIB_MKTIME)/g' \
-	      -e 's/@''GNULIB_NANOSLEEP''@/$(GNULIB_NANOSLEEP)/g' \
-	      -e 's/@''GNULIB_STRPTIME''@/$(GNULIB_STRPTIME)/g' \
-	      -e 's/@''GNULIB_TIMEGM''@/$(GNULIB_TIMEGM)/g' \
-	      -e 's/@''GNULIB_TIME_R''@/$(GNULIB_TIME_R)/g' \
-	      -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \
-	      -e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \
-	      -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \
-	      -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \
-	      -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \
-	      -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|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_TIMEGM''@|$(REPLACE_TIMEGM)|g' \
-	      -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|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 's|@''UNISTD_H_DEFINES_STRUCT_TIMESPEC''@|$(UNISTD_H_DEFINES_STRUCT_TIMESPEC)|g' \
-	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-	      -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-	      < $(srcdir)/time.in.h; \
-	} > $@-t && \
-	mv $@-t $@
-MOSTLYCLEANFILES += time.h time.h-t
-
-EXTRA_DIST += time.in.h
-
-## end   gnulib module time
-
-## begin gnulib module time_r
-
-
-EXTRA_DIST += time_r.c
-
-EXTRA_libgnu_a_SOURCES += time_r.c
-
-## end   gnulib module time_r
-
-## begin gnulib module timegm
-
-
-EXTRA_DIST += mktime-internal.h timegm.c
-
-EXTRA_libgnu_a_SOURCES += timegm.c
-
-## end   gnulib module timegm
-
-## begin gnulib module unistd
-
-BUILT_SOURCES += unistd.h
-libgnu_a_SOURCES += unistd.c
-
-# 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 $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-	      -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
-	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-	      -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
-	      -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \
-	      -e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \
-	      -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \
-	      -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \
-	      -e 's/@''GNULIB_DUP''@/$(GNULIB_DUP)/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_FDATASYNC''@/$(GNULIB_FDATASYNC)/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_GROUP_MEMBER''@/$(GNULIB_GROUP_MEMBER)/g' \
-	      -e 's/@''GNULIB_ISATTY''@/$(GNULIB_ISATTY)/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_PIPE''@/$(GNULIB_PIPE)/g' \
-	      -e 's/@''GNULIB_PIPE2''@/$(GNULIB_PIPE2)/g' \
-	      -e 's/@''GNULIB_PREAD''@/$(GNULIB_PREAD)/g' \
-	      -e 's/@''GNULIB_PWRITE''@/$(GNULIB_PWRITE)/g' \
-	      -e 's/@''GNULIB_READ''@/$(GNULIB_READ)/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_SETHOSTNAME''@/$(GNULIB_SETHOSTNAME)/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_TTYNAME_R''@/$(GNULIB_TTYNAME_R)/g' \
-	      -e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GNULIB_GL_UNISTD_H_GETOPT)/g' \
-	      -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GNULIB_UNISTD_H_NONBLOCKING)/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_FCHDIR''@|$(HAVE_FCHDIR)|g' \
-	      -e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \
-	      -e 's|@''HAVE_FDATASYNC''@|$(HAVE_FDATASYNC)|g' \
-	      -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \
-	      -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|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_GROUP_MEMBER''@|$(HAVE_GROUP_MEMBER)|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_PIPE''@|$(HAVE_PIPE)|g' \
-	      -e 's|@''HAVE_PIPE2''@|$(HAVE_PIPE2)|g' \
-	      -e 's|@''HAVE_PREAD''@|$(HAVE_PREAD)|g' \
-	      -e 's|@''HAVE_PWRITE''@|$(HAVE_PWRITE)|g' \
-	      -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
-	      -e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \
-	      -e 's|@''HAVE_SETHOSTNAME''@|$(HAVE_SETHOSTNAME)|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_FCHDIR''@|$(HAVE_DECL_FCHDIR)|g' \
-	      -e 's|@''HAVE_DECL_FDATASYNC''@|$(HAVE_DECL_FDATASYNC)|g' \
-	      -e 's|@''HAVE_DECL_GETDOMAINNAME''@|$(HAVE_DECL_GETDOMAINNAME)|g' \
-	      -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
-	      -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \
-	      -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \
-	      -e 's|@''HAVE_DECL_SETHOSTNAME''@|$(HAVE_DECL_SETHOSTNAME)|g' \
-	      -e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \
-	      -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
-	      -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
-	  | \
-	  sed -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_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \
-	      -e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \
-	      -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
-	      -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \
-	      -e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \
-	      -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \
-	      -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \
-	      -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
-	      -e 's|@''REPLACE_ISATTY''@|$(REPLACE_ISATTY)|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_PWRITE''@|$(REPLACE_PWRITE)|g' \
-	      -e 's|@''REPLACE_READ''@|$(REPLACE_READ)|g' \
-	      -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \
-	      -e 's|@''REPLACE_READLINKAT''@|$(REPLACE_READLINKAT)|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_SYMLINKAT''@|$(REPLACE_SYMLINKAT)|g' \
-	      -e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \
-	      -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \
-	      -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \
-	      -e 's|@''REPLACE_USLEEP''@|$(REPLACE_USLEEP)|g' \
-	      -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \
-	      -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \
-	      -e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \
-	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-	      -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
-
-EXTRA_DIST += unistd.in.h
-
-## end   gnulib module unistd
-
-## begin gnulib module unsetenv
-
-
-EXTRA_DIST += unsetenv.c
-
-EXTRA_libgnu_a_SOURCES += unsetenv.c
-
-## end   gnulib module unsetenv
-
-## begin gnulib module vasnprintf
-
-
-EXTRA_DIST += asnprintf.c float+.h printf-args.c printf-args.h printf-parse.c printf-parse.h vasnprintf.c vasnprintf.h
-
-EXTRA_libgnu_a_SOURCES += asnprintf.c printf-args.c printf-parse.c vasnprintf.c
-
-## end   gnulib module vasnprintf
-
-## begin gnulib module vasprintf
-
-
-EXTRA_DIST += asprintf.c vasprintf.c
-
-EXTRA_libgnu_a_SOURCES += asprintf.c vasprintf.c
-
-## end   gnulib module vasprintf
-
-## begin gnulib module verify
-
-
-EXTRA_DIST += verify.h
-
-## end   gnulib module verify
-
-## begin gnulib module vsnprintf
-
-
-EXTRA_DIST += vsnprintf.c
-
-EXTRA_libgnu_a_SOURCES += vsnprintf.c
-
-## end   gnulib module vsnprintf
-
-## begin gnulib module wchar
-
-BUILT_SOURCES += wchar.h
-
-# We need the following in order to create <wchar.h> when the system
-# version does not work standalone.
-wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-	      -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \
-	      -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
-	      -e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \
-	      -e 's/@''GNULIB_BTOWC''@/$(GNULIB_BTOWC)/g' \
-	      -e 's/@''GNULIB_WCTOB''@/$(GNULIB_WCTOB)/g' \
-	      -e 's/@''GNULIB_MBSINIT''@/$(GNULIB_MBSINIT)/g' \
-	      -e 's/@''GNULIB_MBRTOWC''@/$(GNULIB_MBRTOWC)/g' \
-	      -e 's/@''GNULIB_MBRLEN''@/$(GNULIB_MBRLEN)/g' \
-	      -e 's/@''GNULIB_MBSRTOWCS''@/$(GNULIB_MBSRTOWCS)/g' \
-	      -e 's/@''GNULIB_MBSNRTOWCS''@/$(GNULIB_MBSNRTOWCS)/g' \
-	      -e 's/@''GNULIB_WCRTOMB''@/$(GNULIB_WCRTOMB)/g' \
-	      -e 's/@''GNULIB_WCSRTOMBS''@/$(GNULIB_WCSRTOMBS)/g' \
-	      -e 's/@''GNULIB_WCSNRTOMBS''@/$(GNULIB_WCSNRTOMBS)/g' \
-	      -e 's/@''GNULIB_WCWIDTH''@/$(GNULIB_WCWIDTH)/g' \
-	      -e 's/@''GNULIB_WMEMCHR''@/$(GNULIB_WMEMCHR)/g' \
-	      -e 's/@''GNULIB_WMEMCMP''@/$(GNULIB_WMEMCMP)/g' \
-	      -e 's/@''GNULIB_WMEMCPY''@/$(GNULIB_WMEMCPY)/g' \
-	      -e 's/@''GNULIB_WMEMMOVE''@/$(GNULIB_WMEMMOVE)/g' \
-	      -e 's/@''GNULIB_WMEMSET''@/$(GNULIB_WMEMSET)/g' \
-	      -e 's/@''GNULIB_WCSLEN''@/$(GNULIB_WCSLEN)/g' \
-	      -e 's/@''GNULIB_WCSNLEN''@/$(GNULIB_WCSNLEN)/g' \
-	      -e 's/@''GNULIB_WCSCPY''@/$(GNULIB_WCSCPY)/g' \
-	      -e 's/@''GNULIB_WCPCPY''@/$(GNULIB_WCPCPY)/g' \
-	      -e 's/@''GNULIB_WCSNCPY''@/$(GNULIB_WCSNCPY)/g' \
-	      -e 's/@''GNULIB_WCPNCPY''@/$(GNULIB_WCPNCPY)/g' \
-	      -e 's/@''GNULIB_WCSCAT''@/$(GNULIB_WCSCAT)/g' \
-	      -e 's/@''GNULIB_WCSNCAT''@/$(GNULIB_WCSNCAT)/g' \
-	      -e 's/@''GNULIB_WCSCMP''@/$(GNULIB_WCSCMP)/g' \
-	      -e 's/@''GNULIB_WCSNCMP''@/$(GNULIB_WCSNCMP)/g' \
-	      -e 's/@''GNULIB_WCSCASECMP''@/$(GNULIB_WCSCASECMP)/g' \
-	      -e 's/@''GNULIB_WCSNCASECMP''@/$(GNULIB_WCSNCASECMP)/g' \
-	      -e 's/@''GNULIB_WCSCOLL''@/$(GNULIB_WCSCOLL)/g' \
-	      -e 's/@''GNULIB_WCSXFRM''@/$(GNULIB_WCSXFRM)/g' \
-	      -e 's/@''GNULIB_WCSDUP''@/$(GNULIB_WCSDUP)/g' \
-	      -e 's/@''GNULIB_WCSCHR''@/$(GNULIB_WCSCHR)/g' \
-	      -e 's/@''GNULIB_WCSRCHR''@/$(GNULIB_WCSRCHR)/g' \
-	      -e 's/@''GNULIB_WCSCSPN''@/$(GNULIB_WCSCSPN)/g' \
-	      -e 's/@''GNULIB_WCSSPN''@/$(GNULIB_WCSSPN)/g' \
-	      -e 's/@''GNULIB_WCSPBRK''@/$(GNULIB_WCSPBRK)/g' \
-	      -e 's/@''GNULIB_WCSSTR''@/$(GNULIB_WCSSTR)/g' \
-	      -e 's/@''GNULIB_WCSTOK''@/$(GNULIB_WCSTOK)/g' \
-	      -e 's/@''GNULIB_WCSWIDTH''@/$(GNULIB_WCSWIDTH)/g' \
-	      < $(srcdir)/wchar.in.h | \
-	  sed -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \
-	      -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \
-	      -e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \
-	      -e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \
-	      -e 's|@''HAVE_MBRLEN''@|$(HAVE_MBRLEN)|g' \
-	      -e 's|@''HAVE_MBSRTOWCS''@|$(HAVE_MBSRTOWCS)|g' \
-	      -e 's|@''HAVE_MBSNRTOWCS''@|$(HAVE_MBSNRTOWCS)|g' \
-	      -e 's|@''HAVE_WCRTOMB''@|$(HAVE_WCRTOMB)|g' \
-	      -e 's|@''HAVE_WCSRTOMBS''@|$(HAVE_WCSRTOMBS)|g' \
-	      -e 's|@''HAVE_WCSNRTOMBS''@|$(HAVE_WCSNRTOMBS)|g' \
-	      -e 's|@''HAVE_WMEMCHR''@|$(HAVE_WMEMCHR)|g' \
-	      -e 's|@''HAVE_WMEMCMP''@|$(HAVE_WMEMCMP)|g' \
-	      -e 's|@''HAVE_WMEMCPY''@|$(HAVE_WMEMCPY)|g' \
-	      -e 's|@''HAVE_WMEMMOVE''@|$(HAVE_WMEMMOVE)|g' \
-	      -e 's|@''HAVE_WMEMSET''@|$(HAVE_WMEMSET)|g' \
-	      -e 's|@''HAVE_WCSLEN''@|$(HAVE_WCSLEN)|g' \
-	      -e 's|@''HAVE_WCSNLEN''@|$(HAVE_WCSNLEN)|g' \
-	      -e 's|@''HAVE_WCSCPY''@|$(HAVE_WCSCPY)|g' \
-	      -e 's|@''HAVE_WCPCPY''@|$(HAVE_WCPCPY)|g' \
-	      -e 's|@''HAVE_WCSNCPY''@|$(HAVE_WCSNCPY)|g' \
-	      -e 's|@''HAVE_WCPNCPY''@|$(HAVE_WCPNCPY)|g' \
-	      -e 's|@''HAVE_WCSCAT''@|$(HAVE_WCSCAT)|g' \
-	      -e 's|@''HAVE_WCSNCAT''@|$(HAVE_WCSNCAT)|g' \
-	      -e 's|@''HAVE_WCSCMP''@|$(HAVE_WCSCMP)|g' \
-	      -e 's|@''HAVE_WCSNCMP''@|$(HAVE_WCSNCMP)|g' \
-	      -e 's|@''HAVE_WCSCASECMP''@|$(HAVE_WCSCASECMP)|g' \
-	      -e 's|@''HAVE_WCSNCASECMP''@|$(HAVE_WCSNCASECMP)|g' \
-	      -e 's|@''HAVE_WCSCOLL''@|$(HAVE_WCSCOLL)|g' \
-	      -e 's|@''HAVE_WCSXFRM''@|$(HAVE_WCSXFRM)|g' \
-	      -e 's|@''HAVE_WCSDUP''@|$(HAVE_WCSDUP)|g' \
-	      -e 's|@''HAVE_WCSCHR''@|$(HAVE_WCSCHR)|g' \
-	      -e 's|@''HAVE_WCSRCHR''@|$(HAVE_WCSRCHR)|g' \
-	      -e 's|@''HAVE_WCSCSPN''@|$(HAVE_WCSCSPN)|g' \
-	      -e 's|@''HAVE_WCSSPN''@|$(HAVE_WCSSPN)|g' \
-	      -e 's|@''HAVE_WCSPBRK''@|$(HAVE_WCSPBRK)|g' \
-	      -e 's|@''HAVE_WCSSTR''@|$(HAVE_WCSSTR)|g' \
-	      -e 's|@''HAVE_WCSTOK''@|$(HAVE_WCSTOK)|g' \
-	      -e 's|@''HAVE_WCSWIDTH''@|$(HAVE_WCSWIDTH)|g' \
-	      -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \
-	      -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
-	  | \
-	  sed -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \
-	      -e 's|@''REPLACE_BTOWC''@|$(REPLACE_BTOWC)|g' \
-	      -e 's|@''REPLACE_WCTOB''@|$(REPLACE_WCTOB)|g' \
-	      -e 's|@''REPLACE_MBSINIT''@|$(REPLACE_MBSINIT)|g' \
-	      -e 's|@''REPLACE_MBRTOWC''@|$(REPLACE_MBRTOWC)|g' \
-	      -e 's|@''REPLACE_MBRLEN''@|$(REPLACE_MBRLEN)|g' \
-	      -e 's|@''REPLACE_MBSRTOWCS''@|$(REPLACE_MBSRTOWCS)|g' \
-	      -e 's|@''REPLACE_MBSNRTOWCS''@|$(REPLACE_MBSNRTOWCS)|g' \
-	      -e 's|@''REPLACE_WCRTOMB''@|$(REPLACE_WCRTOMB)|g' \
-	      -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \
-	      -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \
-	      -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
-	      -e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \
-	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-	      -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 += wchar.h wchar.h-t
-
-EXTRA_DIST += wchar.in.h
-
-## end   gnulib module wchar
-
-## begin gnulib module wcrtomb
-
-
-EXTRA_DIST += wcrtomb.c
-
-EXTRA_libgnu_a_SOURCES += wcrtomb.c
-
-## end   gnulib module wcrtomb
-
-## begin gnulib module wctype-h
-
-BUILT_SOURCES += wctype.h
-libgnu_a_SOURCES += wctype-h.c
-
-# We need the following in order to create <wctype.h> when the system
-# doesn't have one that works with the given compiler.
-wctype.h: wctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-	      -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \
-	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-	      -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \
-	      -e 's/@''GNULIB_ISWBLANK''@/$(GNULIB_ISWBLANK)/g' \
-	      -e 's/@''GNULIB_WCTYPE''@/$(GNULIB_WCTYPE)/g' \
-	      -e 's/@''GNULIB_ISWCTYPE''@/$(GNULIB_ISWCTYPE)/g' \
-	      -e 's/@''GNULIB_WCTRANS''@/$(GNULIB_WCTRANS)/g' \
-	      -e 's/@''GNULIB_TOWCTRANS''@/$(GNULIB_TOWCTRANS)/g' \
-	      -e 's/@''HAVE_ISWBLANK''@/$(HAVE_ISWBLANK)/g' \
-	      -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \
-	      -e 's/@''HAVE_WCTYPE_T''@/$(HAVE_WCTYPE_T)/g' \
-	      -e 's/@''HAVE_WCTRANS_T''@/$(HAVE_WCTRANS_T)/g' \
-	      -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
-	      -e 's/@''REPLACE_ISWBLANK''@/$(REPLACE_ISWBLANK)/g' \
-	      -e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \
-	      -e 's/@''REPLACE_TOWLOWER''@/$(REPLACE_TOWLOWER)/g' \
-	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-	      < $(srcdir)/wctype.in.h; \
-	} > $@-t && \
-	mv $@-t $@
-MOSTLYCLEANFILES += wctype.h wctype.h-t
-
-EXTRA_DIST += wctype.in.h
-
-## end   gnulib module wctype-h
-
-## begin gnulib module xalloc
-
-libgnu_a_SOURCES += xmalloc.c
-
-EXTRA_DIST += xalloc.h
-
-## end   gnulib module xalloc
-
-## begin gnulib module xalloc-die
-
-libgnu_a_SOURCES += xalloc-die.c
-
-## end   gnulib module xalloc-die
-
-## begin gnulib module xalloc-oversized
-
-
-EXTRA_DIST += xalloc-oversized.h
-
-## end   gnulib module xalloc-oversized
-
-## begin gnulib module xsize
-
-libgnu_a_SOURCES += xsize.h xsize.c
-
-## end   gnulib module xsize
-
-## begin gnulib module xstrndup
-
-libgnu_a_SOURCES += xstrndup.h xstrndup.c
-
-## end   gnulib module xstrndup
-
-
-mostlyclean-local: mostlyclean-generic
-	@for dir in '' $(MOSTLYCLEANDIRS); do \
-	  if test -n "$$dir" && test -d $$dir; then \
-	    echo "rmdir $$dir"; rmdir $$dir; \
-	  fi; \
-	done; \
-	:

+ 0 - 63
gl/alloca.in.h~

@@ -1,63 +0,0 @@
-/* Memory allocation on the stack.
-
-   Copyright (C) 1995, 1999, 2001-2004, 2006-2013 Free Software Foundation,
-   Inc.
-
-   This program is free software; you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published
-   by the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public
-   License along with this program; if not, see
-   <http://www.gnu.org/licenses/>.
-  */
-
-/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
-   means there is a real alloca function.  */
-#ifndef _GL_ALLOCA_H
-#define _GL_ALLOCA_H
-
-/* alloca (N) returns a pointer to N bytes of memory
-   allocated on the stack, which will last until the function returns.
-   Use of alloca should be avoided:
-     - inside arguments of function calls - undefined behaviour,
-     - in inline functions - the allocation may actually last until the
-       calling function returns,
-     - for huge N (say, N >= 65536) - you never know how large (or small)
-       the stack is, and when the stack cannot fulfill the memory allocation
-       request, the program just crashes.
- */
-
-#ifndef alloca
-# ifdef __GNUC__
-#  define alloca __builtin_alloca
-# elif defined _AIX
-#  define alloca __alloca
-# elif defined _MSC_VER
-#  include <malloc.h>
-#  define alloca _alloca
-# elif defined __DECC && defined __VMS
-#  define alloca __ALLOCA
-# elif defined __TANDEM && defined _TNS_E_TARGET
-#  ifdef  __cplusplus
-extern "C"
-#  endif
-void *_alloca (unsigned short);
-#  pragma intrinsic (_alloca)
-#  define alloca _alloca
-# else
-#  include <stddef.h>
-#  ifdef  __cplusplus
-extern "C"
-#  endif
-void *alloca (size_t);
-# endif
-#endif
-
-#endif /* _GL_ALLOCA_H */

+ 0 - 140
gl/arpa_inet.in.h~

@@ -1,140 +0,0 @@
-/* A GNU-like <arpa/inet.h>.
-
-   Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef _@GUARD_PREFIX@_ARPA_INET_H
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-#if @HAVE_FEATURES_H@
-# include <features.h> /* for __GLIBC__ */
-#endif
-
-/* Gnulib's sys/socket.h is responsible for defining socklen_t (used below) and
-   for pulling in winsock2.h etc. under MinGW.
-   But avoid namespace pollution on glibc systems.  */
-#ifndef __GLIBC__
-# include <sys/socket.h>
-#endif
-
-/* On NonStop Kernel, inet_ntop and inet_pton are declared in <netdb.h>.
-   But avoid namespace pollution on glibc systems.  */
-#if defined __TANDEM && !defined __GLIBC__
-# include <netdb.h>
-#endif
-
-#if @HAVE_ARPA_INET_H@
-
-/* The include_next requires a split double-inclusion guard.  */
-# @INCLUDE_NEXT@ @NEXT_ARPA_INET_H@
-
-#endif
-
-#ifndef _@GUARD_PREFIX@_ARPA_INET_H
-#define _@GUARD_PREFIX@_ARPA_INET_H
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
-
-/* The definition of _GL_ARG_NONNULL is copied here.  */
-
-/* The definition of _GL_WARN_ON_USE is copied here.  */
-
-
-#if @GNULIB_INET_NTOP@
-/* Converts an internet address from internal format to a printable,
-   presentable format.
-   AF is an internet address family, such as AF_INET or AF_INET6.
-   SRC points to a 'struct in_addr' (for AF_INET) or 'struct in6_addr'
-   (for AF_INET6).
-   DST points to a buffer having room for CNT bytes.
-   The printable representation of the address (in numeric form, not
-   surrounded by [...], no reverse DNS is done) is placed in DST, and
-   DST is returned.  If an error occurs, the return value is NULL and
-   errno is set.  If CNT bytes are not sufficient to hold the result,
-   the return value is NULL and errno is set to ENOSPC.  A good value
-   for CNT is 46.
-
-   For more details, see the POSIX:2001 specification
-   <http://www.opengroup.org/susv3xsh/inet_ntop.html>.  */
-# if @REPLACE_INET_NTOP@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef inet_ntop
-#   define inet_ntop rpl_inet_ntop
-#  endif
-_GL_FUNCDECL_RPL (inet_ntop, const char *,
-                  (int af, const void *restrict src,
-                   char *restrict dst, socklen_t cnt)
-                  _GL_ARG_NONNULL ((2, 3)));
-_GL_CXXALIAS_RPL (inet_ntop, const char *,
-                  (int af, const void *restrict src,
-                   char *restrict dst, socklen_t cnt));
-# else
-#  if !@HAVE_DECL_INET_NTOP@
-_GL_FUNCDECL_SYS (inet_ntop, const char *,
-                  (int af, const void *restrict src,
-                   char *restrict dst, socklen_t cnt)
-                  _GL_ARG_NONNULL ((2, 3)));
-#  endif
-/* Need to cast, because on NonStop Kernel, the fourth parameter is
-                                            size_t cnt.  */
-_GL_CXXALIAS_SYS_CAST (inet_ntop, const char *,
-                       (int af, const void *restrict src,
-                        char *restrict dst, socklen_t cnt));
-# endif
-_GL_CXXALIASWARN (inet_ntop);
-#elif defined GNULIB_POSIXCHECK
-# undef inet_ntop
-# 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 @REPLACE_INET_PTON@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef inet_pton
-#   define inet_pton rpl_inet_pton
-#  endif
-_GL_FUNCDECL_RPL (inet_pton, int,
-                  (int af, const char *restrict src, void *restrict dst)
-                  _GL_ARG_NONNULL ((2, 3)));
-_GL_CXXALIAS_RPL (inet_pton, int,
-                  (int af, const char *restrict src, void *restrict dst));
-# else
-#  if !@HAVE_DECL_INET_PTON@
-_GL_FUNCDECL_SYS (inet_pton, int,
-                  (int af, const char *restrict src, void *restrict dst)
-                  _GL_ARG_NONNULL ((2, 3)));
-#  endif
-_GL_CXXALIAS_SYS (inet_pton, int,
-                  (int af, const char *restrict src, void *restrict dst));
-# endif
-_GL_CXXALIASWARN (inet_pton);
-#elif defined GNULIB_POSIXCHECK
-# undef inet_pton
-# 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
-
-
-#endif /* _@GUARD_PREFIX@_ARPA_INET_H */
-#endif /* _@GUARD_PREFIX@_ARPA_INET_H */

+ 0 - 34
gl/asnprintf.c~

@@ -1,34 +0,0 @@
-/* Formatted output to strings.
-   Copyright (C) 1999, 2002, 2006, 2009-2013 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include "vasnprintf.h"
-
-#include <stdarg.h>
-
-char *
-asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
-{
-  va_list args;
-  char *result;
-
-  va_start (args, format);
-  result = vasnprintf (resultbuf, lengthp, format, args);
-  va_end (args);
-  return result;
-}

+ 0 - 39
gl/asprintf.c~

@@ -1,39 +0,0 @@
-/* Formatted output to strings.
-   Copyright (C) 1999, 2002, 2006-2007, 2009-2013 Free Software Foundation,
-   Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#ifdef IN_LIBASPRINTF
-# include "vasprintf.h"
-#else
-# include <stdio.h>
-#endif
-
-#include <stdarg.h>
-
-int
-asprintf (char **resultp, const char *format, ...)
-{
-  va_list args;
-  int result;
-
-  va_start (args, format);
-  result = vasprintf (resultp, format, args);
-  va_end (args);
-  return result;
-}

+ 0 - 574
gl/base64.c~

@@ -1,574 +0,0 @@
-/* base64.c -- Encode binary data using printable characters.
-   Copyright (C) 1999-2001, 2004-2006, 2009-2013 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Simon Josefsson.  Partially adapted from GNU MailUtils
- * (mailbox/filter_trans.c, as of 2004-11-28).  Improved by review
- * from Paul Eggert, Bruno Haible, and Stepan Kasal.
- *
- * See also RFC 4648 <http://www.ietf.org/rfc/rfc4648.txt>.
- *
- * Be careful with error checking.  Here is how you would typically
- * use these functions:
- *
- * bool ok = base64_decode_alloc (in, inlen, &out, &outlen);
- * if (!ok)
- *   FAIL: input was not valid base64
- * if (out == NULL)
- *   FAIL: memory allocation error
- * OK: data in OUT/OUTLEN
- *
- * size_t outlen = base64_encode_alloc (in, inlen, &out);
- * if (out == NULL && outlen == 0 && inlen != 0)
- *   FAIL: input too long
- * if (out == NULL)
- *   FAIL: memory allocation error
- * OK: data in OUT/OUTLEN.
- *
- */
-
-#include <config.h>
-
-/* Get prototype. */
-#include "base64.h"
-
-/* Get malloc. */
-#include <stdlib.h>
-
-/* Get UCHAR_MAX. */
-#include <limits.h>
-
-#include <string.h>
-
-/* C89 compliant way to cast 'char' to 'unsigned char'. */
-static unsigned char
-to_uchar (char ch)
-{
-  return ch;
-}
-
-/* Base64 encode IN array of size INLEN into OUT array of size OUTLEN.
-   If OUTLEN is less than BASE64_LENGTH(INLEN), write as many bytes as
-   possible.  If OUTLEN is larger than BASE64_LENGTH(INLEN), also zero
-   terminate the output buffer. */
-void
-base64_encode (const char *restrict in, size_t inlen,
-               char *restrict out, size_t outlen)
-{
-  static const char b64str[64] =
-    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-  while (inlen && outlen)
-    {
-      *out++ = b64str[(to_uchar (in[0]) >> 2) & 0x3f];
-      if (!--outlen)
-        break;
-      *out++ = b64str[((to_uchar (in[0]) << 4)
-                       + (--inlen ? to_uchar (in[1]) >> 4 : 0))
-                      & 0x3f];
-      if (!--outlen)
-        break;
-      *out++ =
-        (inlen
-         ? b64str[((to_uchar (in[1]) << 2)
-                   + (--inlen ? to_uchar (in[2]) >> 6 : 0))
-                  & 0x3f]
-         : '=');
-      if (!--outlen)
-        break;
-      *out++ = inlen ? b64str[to_uchar (in[2]) & 0x3f] : '=';
-      if (!--outlen)
-        break;
-      if (inlen)
-        inlen--;
-      if (inlen)
-        in += 3;
-    }
-
-  if (outlen)
-    *out = '\0';
-}
-
-/* Allocate a buffer and store zero terminated base64 encoded data
-   from array IN of size INLEN, returning BASE64_LENGTH(INLEN), i.e.,
-   the length of the encoded data, excluding the terminating zero.  On
-   return, the OUT variable will hold a pointer to newly allocated
-   memory that must be deallocated by the caller.  If output string
-   length would overflow, 0 is returned and OUT is set to NULL.  If
-   memory allocation failed, OUT is set to NULL, and the return value
-   indicates length of the requested memory block, i.e.,
-   BASE64_LENGTH(inlen) + 1. */
-size_t
-base64_encode_alloc (const char *in, size_t inlen, char **out)
-{
-  size_t outlen = 1 + BASE64_LENGTH (inlen);
-
-  /* Check for overflow in outlen computation.
-   *
-   * If there is no overflow, outlen >= inlen.
-   *
-   * If the operation (inlen + 2) overflows then it yields at most +1, so
-   * outlen is 0.
-   *
-   * If the multiplication overflows, we lose at least half of the
-   * correct value, so the result is < ((inlen + 2) / 3) * 2, which is
-   * less than (inlen + 2) * 0.66667, which is less than inlen as soon as
-   * (inlen > 4).
-   */
-  if (inlen > outlen)
-    {
-      *out = NULL;
-      return 0;
-    }
-
-  *out = malloc (outlen);
-  if (!*out)
-    return outlen;
-
-  base64_encode (in, inlen, *out, outlen);
-
-  return outlen - 1;
-}
-
-/* With this approach this file works independent of the charset used
-   (think EBCDIC).  However, it does assume that the characters in the
-   Base64 alphabet (A-Za-z0-9+/) are encoded in 0..255.  POSIX
-   1003.1-2001 require that char and unsigned char are 8-bit
-   quantities, though, taking care of that problem.  But this may be a
-   potential problem on non-POSIX C99 platforms.
-
-   IBM C V6 for AIX mishandles "#define B64(x) ...'x'...", so use "_"
-   as the formal parameter rather than "x".  */
-#define B64(_)                                  \
-  ((_) == 'A' ? 0                               \
-   : (_) == 'B' ? 1                             \
-   : (_) == 'C' ? 2                             \
-   : (_) == 'D' ? 3                             \
-   : (_) == 'E' ? 4                             \
-   : (_) == 'F' ? 5                             \
-   : (_) == 'G' ? 6                             \
-   : (_) == 'H' ? 7                             \
-   : (_) == 'I' ? 8                             \
-   : (_) == 'J' ? 9                             \
-   : (_) == 'K' ? 10                            \
-   : (_) == 'L' ? 11                            \
-   : (_) == 'M' ? 12                            \
-   : (_) == 'N' ? 13                            \
-   : (_) == 'O' ? 14                            \
-   : (_) == 'P' ? 15                            \
-   : (_) == 'Q' ? 16                            \
-   : (_) == 'R' ? 17                            \
-   : (_) == 'S' ? 18                            \
-   : (_) == 'T' ? 19                            \
-   : (_) == 'U' ? 20                            \
-   : (_) == 'V' ? 21                            \
-   : (_) == 'W' ? 22                            \
-   : (_) == 'X' ? 23                            \
-   : (_) == 'Y' ? 24                            \
-   : (_) == 'Z' ? 25                            \
-   : (_) == 'a' ? 26                            \
-   : (_) == 'b' ? 27                            \
-   : (_) == 'c' ? 28                            \
-   : (_) == 'd' ? 29                            \
-   : (_) == 'e' ? 30                            \
-   : (_) == 'f' ? 31                            \
-   : (_) == 'g' ? 32                            \
-   : (_) == 'h' ? 33                            \
-   : (_) == 'i' ? 34                            \
-   : (_) == 'j' ? 35                            \
-   : (_) == 'k' ? 36                            \
-   : (_) == 'l' ? 37                            \
-   : (_) == 'm' ? 38                            \
-   : (_) == 'n' ? 39                            \
-   : (_) == 'o' ? 40                            \
-   : (_) == 'p' ? 41                            \
-   : (_) == 'q' ? 42                            \
-   : (_) == 'r' ? 43                            \
-   : (_) == 's' ? 44                            \
-   : (_) == 't' ? 45                            \
-   : (_) == 'u' ? 46                            \
-   : (_) == 'v' ? 47                            \
-   : (_) == 'w' ? 48                            \
-   : (_) == 'x' ? 49                            \
-   : (_) == 'y' ? 50                            \
-   : (_) == 'z' ? 51                            \
-   : (_) == '0' ? 52                            \
-   : (_) == '1' ? 53                            \
-   : (_) == '2' ? 54                            \
-   : (_) == '3' ? 55                            \
-   : (_) == '4' ? 56                            \
-   : (_) == '5' ? 57                            \
-   : (_) == '6' ? 58                            \
-   : (_) == '7' ? 59                            \
-   : (_) == '8' ? 60                            \
-   : (_) == '9' ? 61                            \
-   : (_) == '+' ? 62                            \
-   : (_) == '/' ? 63                            \
-   : -1)
-
-static const signed char b64[0x100] = {
-  B64 (0), B64 (1), B64 (2), B64 (3),
-  B64 (4), B64 (5), B64 (6), B64 (7),
-  B64 (8), B64 (9), B64 (10), B64 (11),
-  B64 (12), B64 (13), B64 (14), B64 (15),
-  B64 (16), B64 (17), B64 (18), B64 (19),
-  B64 (20), B64 (21), B64 (22), B64 (23),
-  B64 (24), B64 (25), B64 (26), B64 (27),
-  B64 (28), B64 (29), B64 (30), B64 (31),
-  B64 (32), B64 (33), B64 (34), B64 (35),
-  B64 (36), B64 (37), B64 (38), B64 (39),
-  B64 (40), B64 (41), B64 (42), B64 (43),
-  B64 (44), B64 (45), B64 (46), B64 (47),
-  B64 (48), B64 (49), B64 (50), B64 (51),
-  B64 (52), B64 (53), B64 (54), B64 (55),
-  B64 (56), B64 (57), B64 (58), B64 (59),
-  B64 (60), B64 (61), B64 (62), B64 (63),
-  B64 (64), B64 (65), B64 (66), B64 (67),
-  B64 (68), B64 (69), B64 (70), B64 (71),
-  B64 (72), B64 (73), B64 (74), B64 (75),
-  B64 (76), B64 (77), B64 (78), B64 (79),
-  B64 (80), B64 (81), B64 (82), B64 (83),
-  B64 (84), B64 (85), B64 (86), B64 (87),
-  B64 (88), B64 (89), B64 (90), B64 (91),
-  B64 (92), B64 (93), B64 (94), B64 (95),
-  B64 (96), B64 (97), B64 (98), B64 (99),
-  B64 (100), B64 (101), B64 (102), B64 (103),
-  B64 (104), B64 (105), B64 (106), B64 (107),
-  B64 (108), B64 (109), B64 (110), B64 (111),
-  B64 (112), B64 (113), B64 (114), B64 (115),
-  B64 (116), B64 (117), B64 (118), B64 (119),
-  B64 (120), B64 (121), B64 (122), B64 (123),
-  B64 (124), B64 (125), B64 (126), B64 (127),
-  B64 (128), B64 (129), B64 (130), B64 (131),
-  B64 (132), B64 (133), B64 (134), B64 (135),
-  B64 (136), B64 (137), B64 (138), B64 (139),
-  B64 (140), B64 (141), B64 (142), B64 (143),
-  B64 (144), B64 (145), B64 (146), B64 (147),
-  B64 (148), B64 (149), B64 (150), B64 (151),
-  B64 (152), B64 (153), B64 (154), B64 (155),
-  B64 (156), B64 (157), B64 (158), B64 (159),
-  B64 (160), B64 (161), B64 (162), B64 (163),
-  B64 (164), B64 (165), B64 (166), B64 (167),
-  B64 (168), B64 (169), B64 (170), B64 (171),
-  B64 (172), B64 (173), B64 (174), B64 (175),
-  B64 (176), B64 (177), B64 (178), B64 (179),
-  B64 (180), B64 (181), B64 (182), B64 (183),
-  B64 (184), B64 (185), B64 (186), B64 (187),
-  B64 (188), B64 (189), B64 (190), B64 (191),
-  B64 (192), B64 (193), B64 (194), B64 (195),
-  B64 (196), B64 (197), B64 (198), B64 (199),
-  B64 (200), B64 (201), B64 (202), B64 (203),
-  B64 (204), B64 (205), B64 (206), B64 (207),
-  B64 (208), B64 (209), B64 (210), B64 (211),
-  B64 (212), B64 (213), B64 (214), B64 (215),
-  B64 (216), B64 (217), B64 (218), B64 (219),
-  B64 (220), B64 (221), B64 (222), B64 (223),
-  B64 (224), B64 (225), B64 (226), B64 (227),
-  B64 (228), B64 (229), B64 (230), B64 (231),
-  B64 (232), B64 (233), B64 (234), B64 (235),
-  B64 (236), B64 (237), B64 (238), B64 (239),
-  B64 (240), B64 (241), B64 (242), B64 (243),
-  B64 (244), B64 (245), B64 (246), B64 (247),
-  B64 (248), B64 (249), B64 (250), B64 (251),
-  B64 (252), B64 (253), B64 (254), B64 (255)
-};
-
-#if UCHAR_MAX == 255
-# define uchar_in_range(c) true
-#else
-# define uchar_in_range(c) ((c) <= 255)
-#endif
-
-/* Return true if CH is a character from the Base64 alphabet, and
-   false otherwise.  Note that '=' is padding and not considered to be
-   part of the alphabet.  */
-bool
-isbase64 (char ch)
-{
-  return uchar_in_range (to_uchar (ch)) && 0 <= b64[to_uchar (ch)];
-}
-
-/* Initialize decode-context buffer, CTX.  */
-void
-base64_decode_ctx_init (struct base64_decode_context *ctx)
-{
-  ctx->i = 0;
-}
-
-/* If CTX->i is 0 or 4, there are four or more bytes in [*IN..IN_END), and
-   none of those four is a newline, then return *IN.  Otherwise, copy up to
-   4 - CTX->i non-newline bytes from that range into CTX->buf, starting at
-   index CTX->i and setting CTX->i to reflect the number of bytes copied,
-   and return CTX->buf.  In either case, advance *IN to point to the byte
-   after the last one processed, and set *N_NON_NEWLINE to the number of
-   verified non-newline bytes accessible through the returned pointer.  */
-static char *
-get_4 (struct base64_decode_context *ctx,
-       char const *restrict *in, char const *restrict in_end,
-       size_t *n_non_newline)
-{
-  if (ctx->i == 4)
-    ctx->i = 0;
-
-  if (ctx->i == 0)
-    {
-      char const *t = *in;
-      if (4 <= in_end - *in && memchr (t, '\n', 4) == NULL)
-        {
-          /* This is the common case: no newline.  */
-          *in += 4;
-          *n_non_newline = 4;
-          return (char *) t;
-        }
-    }
-
-  {
-    /* Copy non-newline bytes into BUF.  */
-    char const *p = *in;
-    while (p < in_end)
-      {
-        char c = *p++;
-        if (c != '\n')
-          {
-            ctx->buf[ctx->i++] = c;
-            if (ctx->i == 4)
-              break;
-          }
-      }
-
-    *in = p;
-    *n_non_newline = ctx->i;
-    return ctx->buf;
-  }
-}
-
-#define return_false                            \
-  do                                            \
-    {                                           \
-      *outp = out;                              \
-      return false;                             \
-    }                                           \
-  while (false)
-
-/* Decode up to four bytes of base64-encoded data, IN, of length INLEN
-   into the output buffer, *OUT, of size *OUTLEN bytes.  Return true if
-   decoding is successful, false otherwise.  If *OUTLEN is too small,
-   as many bytes as possible are written to *OUT.  On return, advance
-   *OUT to point to the byte after the last one written, and decrement
-   *OUTLEN to reflect the number of bytes remaining in *OUT.  */
-static bool
-decode_4 (char const *restrict in, size_t inlen,
-          char *restrict *outp, size_t *outleft)
-{
-  char *out = *outp;
-  if (inlen < 2)
-    return false;
-
-  if (!isbase64 (in[0]) || !isbase64 (in[1]))
-    return false;
-
-  if (*outleft)
-    {
-      *out++ = ((b64[to_uchar (in[0])] << 2)
-                | (b64[to_uchar (in[1])] >> 4));
-      --*outleft;
-    }
-
-  if (inlen == 2)
-    return_false;
-
-  if (in[2] == '=')
-    {
-      if (inlen != 4)
-        return_false;
-
-      if (in[3] != '=')
-        return_false;
-    }
-  else
-    {
-      if (!isbase64 (in[2]))
-        return_false;
-
-      if (*outleft)
-        {
-          *out++ = (((b64[to_uchar (in[1])] << 4) & 0xf0)
-                    | (b64[to_uchar (in[2])] >> 2));
-          --*outleft;
-        }
-
-      if (inlen == 3)
-        return_false;
-
-      if (in[3] == '=')
-        {
-          if (inlen != 4)
-            return_false;
-        }
-      else
-        {
-          if (!isbase64 (in[3]))
-            return_false;
-
-          if (*outleft)
-            {
-              *out++ = (((b64[to_uchar (in[2])] << 6) & 0xc0)
-                        | b64[to_uchar (in[3])]);
-              --*outleft;
-            }
-        }
-    }
-
-  *outp = out;
-  return true;
-}
-
-/* Decode base64-encoded input array IN of length INLEN to output array
-   OUT that can hold *OUTLEN bytes.  The input data may be interspersed
-   with newlines.  Return true if decoding was successful, i.e. if the
-   input was valid base64 data, false otherwise.  If *OUTLEN is too
-   small, as many bytes as possible will be written to OUT.  On return,
-   *OUTLEN holds the length of decoded bytes in OUT.  Note that as soon
-   as any non-alphabet, non-newline character is encountered, decoding
-   is stopped and false is returned.  If INLEN is zero, then process
-   only whatever data is stored in CTX.
-
-   Initially, CTX must have been initialized via base64_decode_ctx_init.
-   Subsequent calls to this function must reuse whatever state is recorded
-   in that buffer.  It is necessary for when a quadruple of base64 input
-   bytes spans two input buffers.
-
-   If CTX is NULL then newlines are treated as garbage and the input
-   buffer is processed as a unit.  */
-
-bool
-base64_decode_ctx (struct base64_decode_context *ctx,
-                   const char *restrict in, size_t inlen,
-                   char *restrict out, size_t *outlen)
-{
-  size_t outleft = *outlen;
-  bool ignore_newlines = ctx != NULL;
-  bool flush_ctx = false;
-  unsigned int ctx_i = 0;
-
-  if (ignore_newlines)
-    {
-      ctx_i = ctx->i;
-      flush_ctx = inlen == 0;
-    }
-
-
-  while (true)
-    {
-      size_t outleft_save = outleft;
-      if (ctx_i == 0 && !flush_ctx)
-        {
-          while (true)
-            {
-              /* Save a copy of outleft, in case we need to re-parse this
-                 block of four bytes.  */
-              outleft_save = outleft;
-              if (!decode_4 (in, inlen, &out, &outleft))
-                break;
-
-              in += 4;
-              inlen -= 4;
-            }
-        }
-
-      if (inlen == 0 && !flush_ctx)
-        break;
-
-      /* Handle the common case of 72-byte wrapped lines.
-         This also handles any other multiple-of-4-byte wrapping.  */
-      if (inlen && *in == '\n' && ignore_newlines)
-        {
-          ++in;
-          --inlen;
-          continue;
-        }
-
-      /* Restore OUT and OUTLEFT.  */
-      out -= outleft_save - outleft;
-      outleft = outleft_save;
-
-      {
-        char const *in_end = in + inlen;
-        char const *non_nl;
-
-        if (ignore_newlines)
-          non_nl = get_4 (ctx, &in, in_end, &inlen);
-        else
-          non_nl = in;  /* Might have nl in this case. */
-
-        /* If the input is empty or consists solely of newlines (0 non-newlines),
-           then we're done.  Likewise if there are fewer than 4 bytes when not
-           flushing context and not treating newlines as garbage.  */
-        if (inlen == 0 || (inlen < 4 && !flush_ctx && ignore_newlines))
-          {
-            inlen = 0;
-            break;
-          }
-        if (!decode_4 (non_nl, inlen, &out, &outleft))
-          break;
-
-        inlen = in_end - in;
-      }
-    }
-
-  *outlen -= outleft;
-
-  return inlen == 0;
-}
-
-/* Allocate an output buffer in *OUT, and decode the base64 encoded
-   data stored in IN of size INLEN to the *OUT buffer.  On return, the
-   size of the decoded data is stored in *OUTLEN.  OUTLEN may be NULL,
-   if the caller is not interested in the decoded length.  *OUT may be
-   NULL to indicate an out of memory error, in which case *OUTLEN
-   contains the size of the memory block needed.  The function returns
-   true on successful decoding and memory allocation errors.  (Use the
-   *OUT and *OUTLEN parameters to differentiate between successful
-   decoding and memory error.)  The function returns false if the
-   input was invalid, in which case *OUT is NULL and *OUTLEN is
-   undefined. */
-bool
-base64_decode_alloc_ctx (struct base64_decode_context *ctx,
-                         const char *in, size_t inlen, char **out,
-                         size_t *outlen)
-{
-  /* This may allocate a few bytes too many, depending on input,
-     but it's not worth the extra CPU time to compute the exact size.
-     The exact size is 3 * (inlen + (ctx ? ctx->i : 0)) / 4, minus 1 if the
-     input ends with "=" and minus another 1 if the input ends with "==".
-     Dividing before multiplying avoids the possibility of overflow.  */
-  size_t needlen = 3 * (inlen / 4) + 3;
-
-  *out = malloc (needlen);
-  if (!*out)
-    return true;
-
-  if (!base64_decode_ctx (ctx, in, inlen, *out, &needlen))
-    {
-      free (*out);
-      *out = NULL;
-      return false;
-    }
-
-  if (outlen)
-    *outlen = needlen;
-
-  return true;
-}

+ 0 - 68
gl/base64.h~

@@ -1,68 +0,0 @@
-/* base64.h -- Encode binary data using printable characters.
-   Copyright (C) 2004-2006, 2009-2013 Free Software Foundation, Inc.
-   Written by Simon Josefsson.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef BASE64_H
-# define BASE64_H
-
-/* Get size_t. */
-# include <stddef.h>
-
-/* Get bool. */
-# include <stdbool.h>
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-/* This uses that the expression (n+(k-1))/k means the smallest
-   integer >= n/k, i.e., the ceiling of n/k.  */
-# define BASE64_LENGTH(inlen) ((((inlen) + 2) / 3) * 4)
-
-struct base64_decode_context
-{
-  unsigned int i;
-  char buf[4];
-};
-
-extern bool isbase64 (char ch) _GL_ATTRIBUTE_CONST;
-
-extern void base64_encode (const char *restrict in, size_t inlen,
-                           char *restrict out, size_t outlen);
-
-extern size_t base64_encode_alloc (const char *in, size_t inlen, char **out);
-
-extern void base64_decode_ctx_init (struct base64_decode_context *ctx);
-
-extern bool base64_decode_ctx (struct base64_decode_context *ctx,
-                               const char *restrict in, size_t inlen,
-                               char *restrict out, size_t *outlen);
-
-extern bool base64_decode_alloc_ctx (struct base64_decode_context *ctx,
-                                     const char *in, size_t inlen,
-                                     char **out, size_t *outlen);
-
-#define base64_decode(in, inlen, out, outlen) \
-        base64_decode_ctx (NULL, in, inlen, out, outlen)
-
-#define base64_decode_alloc(in, inlen, out, outlen) \
-        base64_decode_alloc_ctx (NULL, in, inlen, out, outlen)
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif /* BASE64_H */

+ 0 - 75
gl/basename-lgpl.c~

@@ -1,75 +0,0 @@
-/* basename.c -- return the last element in a file name
-
-   Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2013 Free Software
-   Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include "dirname.h"
-
-#include <string.h>
-
-/* Return the address of the last file name component of NAME.  If
-   NAME has no relative file name components because it is a file
-   system root, return the empty string.  */
-
-char *
-last_component (char const *name)
-{
-  char const *base = name + FILE_SYSTEM_PREFIX_LEN (name);
-  char const *p;
-  bool saw_slash = false;
-
-  while (ISSLASH (*base))
-    base++;
-
-  for (p = base; *p; p++)
-    {
-      if (ISSLASH (*p))
-        saw_slash = true;
-      else if (saw_slash)
-        {
-          base = p;
-          saw_slash = false;
-        }
-    }
-
-  return (char *) base;
-}
-
-/* Return the length of the basename NAME.  Typically NAME is the
-   value returned by base_name or last_component.  Act like strlen
-   (NAME), except omit all trailing slashes.  */
-
-size_t
-base_len (char const *name)
-{
-  size_t len;
-  size_t prefix_len = FILE_SYSTEM_PREFIX_LEN (name);
-
-  for (len = strlen (name);  1 < len && ISSLASH (name[len - 1]);  len--)
-    continue;
-
-  if (DOUBLE_SLASH_IS_DISTINCT_ROOT && len == 1
-      && ISSLASH (name[0]) && ISSLASH (name[1]) && ! name[2])
-    return 2;
-
-  if (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE && prefix_len
-      && len == prefix_len && ISSLASH (name[prefix_len]))
-    return prefix_len + 1;
-
-  return len;
-}

+ 0 - 58
gl/basename.c~

@@ -1,58 +0,0 @@
-/* basename.c -- return the last element in a file name
-
-   Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2013 Free Software
-   Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include "dirname.h"
-
-#include <string.h>
-#include "xalloc.h"
-#include "xstrndup.h"
-
-char *
-base_name (char const *name)
-{
-  char const *base = last_component (name);
-  size_t length;
-
-  /* If there is no last component, then name is a file system root or the
-     empty string.  */
-  if (! *base)
-    return xstrndup (name, base_len (name));
-
-  /* Collapse a sequence of trailing slashes into one.  */
-  length = base_len (base);
-  if (ISSLASH (base[length]))
-    length++;
-
-  /* On systems with drive letters, "a/b:c" must return "./b:c" rather
-     than "b:c" to avoid confusion with a drive letter.  On systems
-     with pure POSIX semantics, this is not an issue.  */
-  if (FILE_SYSTEM_PREFIX_LEN (base))
-    {
-      char *p = xmalloc (length + 3);
-      p[0] = '.';
-      p[1] = '/';
-      memcpy (p + 2, base, length);
-      p[length + 2] = '\0';
-      return p;
-    }
-
-  /* Finally, copy the basename.  */
-  return xstrndup (base, length);
-}

+ 0 - 39
gl/btowc.c~

@@ -1,39 +0,0 @@
-/* Convert unibyte character to wide character.
-   Copyright (C) 2008, 2010-2013 Free Software Foundation, Inc.
-   Written by Bruno Haible <bruno@clisp.org>, 2008.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include <wchar.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-
-wint_t
-btowc (int c)
-{
-  if (c != EOF)
-    {
-      char buf[1];
-      wchar_t wc;
-
-      buf[0] = c;
-      if (mbtowc (&wc, buf, 1) >= 0)
-        return wc;
-    }
-  return WEOF;
-}

+ 0 - 684
gl/config.charset~

@@ -1,684 +0,0 @@
-#! /bin/sh
-# Output a system dependent table of character encoding aliases.
-#
-#   Copyright (C) 2000-2004, 2006-2013 Free Software Foundation, Inc.
-#
-#   This program is free software; you can redistribute it and/or modify
-#   it under the terms of the GNU General Public License as published by
-#   the Free Software Foundation; either version 3, or (at your option)
-#   any later version.
-#
-#   This program is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#   GNU General Public License for more details.
-#
-#   You should have received a copy of the GNU General Public License along
-#   with this program; if not, see <http://www.gnu.org/licenses/>.
-#
-# The table consists of lines of the form
-#    ALIAS  CANONICAL
-#
-# ALIAS is the (system dependent) result of "nl_langinfo (CODESET)".
-# ALIAS is compared in a case sensitive way.
-#
-# CANONICAL is the GNU canonical name for this character encoding.
-# It must be an encoding supported by libiconv. Support by GNU libc is
-# also desirable. CANONICAL is case insensitive. Usually an upper case
-# MIME charset name is preferred.
-# The current list of GNU canonical charset names is as follows.
-#
-#       name              MIME?             used by which systems
-#                                    (darwin = Mac OS X, woe32 = native Windows)
-#
-#   ASCII, ANSI_X3.4-1968       glibc solaris freebsd netbsd darwin cygwin
-#   ISO-8859-1              Y   glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin
-#   ISO-8859-2              Y   glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin
-#   ISO-8859-3              Y   glibc solaris cygwin
-#   ISO-8859-4              Y   osf solaris freebsd netbsd openbsd darwin
-#   ISO-8859-5              Y   glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin
-#   ISO-8859-6              Y   glibc aix hpux solaris cygwin
-#   ISO-8859-7              Y   glibc aix hpux irix osf solaris netbsd openbsd darwin cygwin
-#   ISO-8859-8              Y   glibc aix hpux osf solaris cygwin
-#   ISO-8859-9              Y   glibc aix hpux irix osf solaris darwin cygwin
-#   ISO-8859-13                 glibc netbsd openbsd darwin cygwin
-#   ISO-8859-14                 glibc cygwin
-#   ISO-8859-15                 glibc aix osf solaris freebsd netbsd openbsd darwin cygwin
-#   KOI8-R                  Y   glibc solaris freebsd netbsd openbsd darwin
-#   KOI8-U                  Y   glibc freebsd netbsd openbsd darwin cygwin
-#   KOI8-T                      glibc
-#   CP437                       dos
-#   CP775                       dos
-#   CP850                       aix osf dos
-#   CP852                       dos
-#   CP855                       dos
-#   CP856                       aix
-#   CP857                       dos
-#   CP861                       dos
-#   CP862                       dos
-#   CP864                       dos
-#   CP865                       dos
-#   CP866                       freebsd netbsd openbsd darwin dos
-#   CP869                       dos
-#   CP874                       woe32 dos
-#   CP922                       aix
-#   CP932                       aix cygwin woe32 dos
-#   CP943                       aix
-#   CP949                       osf darwin woe32 dos
-#   CP950                       woe32 dos
-#   CP1046                      aix
-#   CP1124                      aix
-#   CP1125                      dos
-#   CP1129                      aix
-#   CP1131                      darwin
-#   CP1250                      woe32
-#   CP1251                      glibc solaris netbsd openbsd darwin cygwin woe32
-#   CP1252                      aix woe32
-#   CP1253                      woe32
-#   CP1254                      woe32
-#   CP1255                      glibc woe32
-#   CP1256                      woe32
-#   CP1257                      woe32
-#   GB2312                  Y   glibc aix hpux irix solaris freebsd netbsd darwin
-#   EUC-JP                  Y   glibc aix hpux irix osf solaris freebsd netbsd darwin
-#   EUC-KR                  Y   glibc aix hpux irix osf solaris freebsd netbsd darwin cygwin
-#   EUC-TW                      glibc aix hpux irix osf solaris netbsd
-#   BIG5                    Y   glibc aix hpux osf solaris freebsd netbsd darwin cygwin
-#   BIG5-HKSCS                  glibc solaris darwin
-#   GBK                         glibc aix osf solaris darwin cygwin woe32 dos
-#   GB18030                     glibc solaris netbsd darwin
-#   SHIFT_JIS               Y   hpux osf solaris freebsd netbsd darwin
-#   JOHAB                       glibc solaris woe32
-#   TIS-620                     glibc aix hpux osf solaris cygwin
-#   VISCII                  Y   glibc
-#   TCVN5712-1                  glibc
-#   ARMSCII-8                   glibc darwin
-#   GEORGIAN-PS                 glibc cygwin
-#   PT154                       glibc
-#   HP-ROMAN8                   hpux
-#   HP-ARABIC8                  hpux
-#   HP-GREEK8                   hpux
-#   HP-HEBREW8                  hpux
-#   HP-TURKISH8                 hpux
-#   HP-KANA8                    hpux
-#   DEC-KANJI                   osf
-#   DEC-HANYU                   osf
-#   UTF-8                   Y   glibc aix hpux osf solaris netbsd darwin cygwin
-#
-# Note: Names which are not marked as being a MIME name should not be used in
-# Internet protocols for information interchange (mail, news, etc.).
-#
-# Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications
-# must understand both names and treat them as equivalent.
-#
-# The first argument passed to this file is the canonical host specification,
-#    CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or
-#    CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-
-host="$1"
-os=`echo "$host" | sed -e 's/^[^-]*-[^-]*-\(.*\)$/\1/'`
-echo "# This file contains a table of character encoding aliases,"
-echo "# suitable for operating system '${os}'."
-echo "# It was automatically generated from config.charset."
-# List of references, updated during installation:
-echo "# Packages using this file: "
-case "$os" in
-  linux-gnulibc1*)
-    # Linux libc5 doesn't have nl_langinfo(CODESET); therefore
-    # localcharset.c falls back to using the full locale name
-    # from the environment variables.
-    echo "C ASCII"
-    echo "POSIX ASCII"
-    for l in af af_ZA ca ca_ES da da_DK de de_AT de_BE de_CH de_DE de_LU \
-             en en_AU en_BW en_CA en_DK en_GB en_IE en_NZ en_US en_ZA \
-             en_ZW es es_AR es_BO es_CL es_CO es_DO es_EC es_ES es_GT \
-             es_HN es_MX es_PA es_PE es_PY es_SV es_US es_UY es_VE et \
-             et_EE eu eu_ES fi fi_FI fo fo_FO fr fr_BE fr_CA fr_CH fr_FR \
-             fr_LU ga ga_IE gl gl_ES id id_ID in in_ID is is_IS it it_CH \
-             it_IT kl kl_GL nl nl_BE nl_NL no no_NO pt pt_BR pt_PT sv \
-             sv_FI sv_SE; do
-      echo "$l ISO-8859-1"
-      echo "$l.iso-8859-1 ISO-8859-1"
-      echo "$l.iso-8859-15 ISO-8859-15"
-      echo "$l.iso-8859-15@euro ISO-8859-15"
-      echo "$l@euro ISO-8859-15"
-      echo "$l.cp-437 CP437"
-      echo "$l.cp-850 CP850"
-      echo "$l.cp-1252 CP1252"
-      echo "$l.cp-1252@euro CP1252"
-      #echo "$l.atari-st ATARI-ST" # not a commonly used encoding
-      echo "$l.utf-8 UTF-8"
-      echo "$l.utf-8@euro UTF-8"
-    done
-    for l in cs cs_CZ hr hr_HR hu hu_HU pl pl_PL ro ro_RO sk sk_SK sl \
-             sl_SI sr sr_CS sr_YU; do
-      echo "$l ISO-8859-2"
-      echo "$l.iso-8859-2 ISO-8859-2"
-      echo "$l.cp-852 CP852"
-      echo "$l.cp-1250 CP1250"
-      echo "$l.utf-8 UTF-8"
-    done
-    for l in mk mk_MK ru ru_RU; do
-      echo "$l ISO-8859-5"
-      echo "$l.iso-8859-5 ISO-8859-5"
-      echo "$l.koi8-r KOI8-R"
-      echo "$l.cp-866 CP866"
-      echo "$l.cp-1251 CP1251"
-      echo "$l.utf-8 UTF-8"
-    done
-    for l in ar ar_SA; do
-      echo "$l ISO-8859-6"
-      echo "$l.iso-8859-6 ISO-8859-6"
-      echo "$l.cp-864 CP864"
-      #echo "$l.cp-868 CP868" # not a commonly used encoding
-      echo "$l.cp-1256 CP1256"
-      echo "$l.utf-8 UTF-8"
-    done
-    for l in el el_GR gr gr_GR; do
-      echo "$l ISO-8859-7"
-      echo "$l.iso-8859-7 ISO-8859-7"
-      echo "$l.cp-869 CP869"
-      echo "$l.cp-1253 CP1253"
-      echo "$l.cp-1253@euro CP1253"
-      echo "$l.utf-8 UTF-8"
-      echo "$l.utf-8@euro UTF-8"
-    done
-    for l in he he_IL iw iw_IL; do
-      echo "$l ISO-8859-8"
-      echo "$l.iso-8859-8 ISO-8859-8"
-      echo "$l.cp-862 CP862"
-      echo "$l.cp-1255 CP1255"
-      echo "$l.utf-8 UTF-8"
-    done
-    for l in tr tr_TR; do
-      echo "$l ISO-8859-9"
-      echo "$l.iso-8859-9 ISO-8859-9"
-      echo "$l.cp-857 CP857"
-      echo "$l.cp-1254 CP1254"
-      echo "$l.utf-8 UTF-8"
-    done
-    for l in lt lt_LT lv lv_LV; do
-      #echo "$l BALTIC" # not a commonly used encoding, wrong encoding name
-      echo "$l ISO-8859-13"
-    done
-    for l in ru_UA uk uk_UA; do
-      echo "$l KOI8-U"
-    done
-    for l in zh zh_CN; do
-      #echo "$l GB_2312-80" # not a commonly used encoding, wrong encoding name
-      echo "$l GB2312"
-    done
-    for l in ja ja_JP ja_JP.EUC; do
-      echo "$l EUC-JP"
-    done
-    for l in ko ko_KR; do
-      echo "$l EUC-KR"
-    done
-    for l in th th_TH; do
-      echo "$l TIS-620"
-    done
-    for l in fa fa_IR; do
-      #echo "$l ISIRI-3342" # a broken encoding
-      echo "$l.utf-8 UTF-8"
-    done
-    ;;
-  linux* | *-gnu*)
-    # With glibc-2.1 or newer, we don't need any canonicalization,
-    # because glibc has iconv and both glibc and libiconv support all
-    # GNU canonical names directly. Therefore, the Makefile does not
-    # need to install the alias file at all.
-    # The following applies only to glibc-2.0.x and older libcs.
-    echo "ISO_646.IRV:1983 ASCII"
-    ;;
-  aix*)
-    echo "ISO8859-1 ISO-8859-1"
-    echo "ISO8859-2 ISO-8859-2"
-    echo "ISO8859-5 ISO-8859-5"
-    echo "ISO8859-6 ISO-8859-6"
-    echo "ISO8859-7 ISO-8859-7"
-    echo "ISO8859-8 ISO-8859-8"
-    echo "ISO8859-9 ISO-8859-9"
-    echo "ISO8859-15 ISO-8859-15"
-    echo "IBM-850 CP850"
-    echo "IBM-856 CP856"
-    echo "IBM-921 ISO-8859-13"
-    echo "IBM-922 CP922"
-    echo "IBM-932 CP932"
-    echo "IBM-943 CP943"
-    echo "IBM-1046 CP1046"
-    echo "IBM-1124 CP1124"
-    echo "IBM-1129 CP1129"
-    echo "IBM-1252 CP1252"
-    echo "IBM-eucCN GB2312"
-    echo "IBM-eucJP EUC-JP"
-    echo "IBM-eucKR EUC-KR"
-    echo "IBM-eucTW EUC-TW"
-    echo "big5 BIG5"
-    echo "GBK GBK"
-    echo "TIS-620 TIS-620"
-    echo "UTF-8 UTF-8"
-    ;;
-  hpux*)
-    echo "iso88591 ISO-8859-1"
-    echo "iso88592 ISO-8859-2"
-    echo "iso88595 ISO-8859-5"
-    echo "iso88596 ISO-8859-6"
-    echo "iso88597 ISO-8859-7"
-    echo "iso88598 ISO-8859-8"
-    echo "iso88599 ISO-8859-9"
-    echo "iso885915 ISO-8859-15"
-    echo "roman8 HP-ROMAN8"
-    echo "arabic8 HP-ARABIC8"
-    echo "greek8 HP-GREEK8"
-    echo "hebrew8 HP-HEBREW8"
-    echo "turkish8 HP-TURKISH8"
-    echo "kana8 HP-KANA8"
-    echo "tis620 TIS-620"
-    echo "big5 BIG5"
-    echo "eucJP EUC-JP"
-    echo "eucKR EUC-KR"
-    echo "eucTW EUC-TW"
-    echo "hp15CN GB2312"
-    #echo "ccdc ?" # what is this?
-    echo "SJIS SHIFT_JIS"
-    echo "utf8 UTF-8"
-    ;;
-  irix*)
-    echo "ISO8859-1 ISO-8859-1"
-    echo "ISO8859-2 ISO-8859-2"
-    echo "ISO8859-5 ISO-8859-5"
-    echo "ISO8859-7 ISO-8859-7"
-    echo "ISO8859-9 ISO-8859-9"
-    echo "eucCN GB2312"
-    echo "eucJP EUC-JP"
-    echo "eucKR EUC-KR"
-    echo "eucTW EUC-TW"
-    ;;
-  osf*)
-    echo "ISO8859-1 ISO-8859-1"
-    echo "ISO8859-2 ISO-8859-2"
-    echo "ISO8859-4 ISO-8859-4"
-    echo "ISO8859-5 ISO-8859-5"
-    echo "ISO8859-7 ISO-8859-7"
-    echo "ISO8859-8 ISO-8859-8"
-    echo "ISO8859-9 ISO-8859-9"
-    echo "ISO8859-15 ISO-8859-15"
-    echo "cp850 CP850"
-    echo "big5 BIG5"
-    echo "dechanyu DEC-HANYU"
-    echo "dechanzi GB2312"
-    echo "deckanji DEC-KANJI"
-    echo "deckorean EUC-KR"
-    echo "eucJP EUC-JP"
-    echo "eucKR EUC-KR"
-    echo "eucTW EUC-TW"
-    echo "GBK GBK"
-    echo "KSC5601 CP949"
-    echo "sdeckanji EUC-JP"
-    echo "SJIS SHIFT_JIS"
-    echo "TACTIS TIS-620"
-    echo "UTF-8 UTF-8"
-    ;;
-  solaris*)
-    echo "646 ASCII"
-    echo "ISO8859-1 ISO-8859-1"
-    echo "ISO8859-2 ISO-8859-2"
-    echo "ISO8859-3 ISO-8859-3"
-    echo "ISO8859-4 ISO-8859-4"
-    echo "ISO8859-5 ISO-8859-5"
-    echo "ISO8859-6 ISO-8859-6"
-    echo "ISO8859-7 ISO-8859-7"
-    echo "ISO8859-8 ISO-8859-8"
-    echo "ISO8859-9 ISO-8859-9"
-    echo "ISO8859-15 ISO-8859-15"
-    echo "koi8-r KOI8-R"
-    echo "ansi-1251 CP1251"
-    echo "BIG5 BIG5"
-    echo "Big5-HKSCS BIG5-HKSCS"
-    echo "gb2312 GB2312"
-    echo "GBK GBK"
-    echo "GB18030 GB18030"
-    echo "cns11643 EUC-TW"
-    echo "5601 EUC-KR"
-    echo "ko_KR.johap92 JOHAB"
-    echo "eucJP EUC-JP"
-    echo "PCK SHIFT_JIS"
-    echo "TIS620.2533 TIS-620"
-    #echo "sun_eu_greek ?" # what is this?
-    echo "UTF-8 UTF-8"
-    ;;
-  freebsd* | os2*)
-    # FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore
-    # localcharset.c falls back to using the full locale name
-    # from the environment variables.
-    # Likewise for OS/2. OS/2 has XFree86 just like FreeBSD. Just
-    # reuse FreeBSD's locale data for OS/2.
-    echo "C ASCII"
-    echo "US-ASCII ASCII"
-    for l in la_LN lt_LN; do
-      echo "$l.ASCII ASCII"
-    done
-    for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
-             fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \
-             lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do
-      echo "$l.ISO_8859-1 ISO-8859-1"
-      echo "$l.DIS_8859-15 ISO-8859-15"
-    done
-    for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do
-      echo "$l.ISO_8859-2 ISO-8859-2"
-    done
-    for l in la_LN lt_LT; do
-      echo "$l.ISO_8859-4 ISO-8859-4"
-    done
-    for l in ru_RU ru_SU; do
-      echo "$l.KOI8-R KOI8-R"
-      echo "$l.ISO_8859-5 ISO-8859-5"
-      echo "$l.CP866 CP866"
-    done
-    echo "uk_UA.KOI8-U KOI8-U"
-    echo "zh_TW.BIG5 BIG5"
-    echo "zh_TW.Big5 BIG5"
-    echo "zh_CN.EUC GB2312"
-    echo "ja_JP.EUC EUC-JP"
-    echo "ja_JP.SJIS SHIFT_JIS"
-    echo "ja_JP.Shift_JIS SHIFT_JIS"
-    echo "ko_KR.EUC EUC-KR"
-    ;;
-  netbsd*)
-    echo "646 ASCII"
-    echo "ISO8859-1 ISO-8859-1"
-    echo "ISO8859-2 ISO-8859-2"
-    echo "ISO8859-4 ISO-8859-4"
-    echo "ISO8859-5 ISO-8859-5"
-    echo "ISO8859-7 ISO-8859-7"
-    echo "ISO8859-13 ISO-8859-13"
-    echo "ISO8859-15 ISO-8859-15"
-    echo "eucCN GB2312"
-    echo "eucJP EUC-JP"
-    echo "eucKR EUC-KR"
-    echo "eucTW EUC-TW"
-    echo "BIG5 BIG5"
-    echo "SJIS SHIFT_JIS"
-    ;;
-  openbsd*)
-    echo "646 ASCII"
-    echo "ISO8859-1 ISO-8859-1"
-    echo "ISO8859-2 ISO-8859-2"
-    echo "ISO8859-4 ISO-8859-4"
-    echo "ISO8859-5 ISO-8859-5"
-    echo "ISO8859-7 ISO-8859-7"
-    echo "ISO8859-13 ISO-8859-13"
-    echo "ISO8859-15 ISO-8859-15"
-    ;;
-  darwin[56]*)
-    # Darwin 6.8 doesn't have nl_langinfo(CODESET); therefore
-    # localcharset.c falls back to using the full locale name
-    # from the environment variables.
-    echo "C ASCII"
-    for l in en_AU en_CA en_GB en_US la_LN; do
-      echo "$l.US-ASCII ASCII"
-    done
-    for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
-             fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT nl_BE \
-             nl_NL no_NO pt_PT sv_SE; do
-      echo "$l ISO-8859-1"
-      echo "$l.ISO8859-1 ISO-8859-1"
-      echo "$l.ISO8859-15 ISO-8859-15"
-    done
-    for l in la_LN; do
-      echo "$l.ISO8859-1 ISO-8859-1"
-      echo "$l.ISO8859-15 ISO-8859-15"
-    done
-    for l in cs_CZ hr_HR hu_HU la_LN pl_PL sl_SI; do
-      echo "$l.ISO8859-2 ISO-8859-2"
-    done
-    for l in la_LN lt_LT; do
-      echo "$l.ISO8859-4 ISO-8859-4"
-    done
-    for l in ru_RU; do
-      echo "$l.KOI8-R KOI8-R"
-      echo "$l.ISO8859-5 ISO-8859-5"
-      echo "$l.CP866 CP866"
-    done
-    for l in bg_BG; do
-      echo "$l.CP1251 CP1251"
-    done
-    echo "uk_UA.KOI8-U KOI8-U"
-    echo "zh_TW.BIG5 BIG5"
-    echo "zh_TW.Big5 BIG5"
-    echo "zh_CN.EUC GB2312"
-    echo "ja_JP.EUC EUC-JP"
-    echo "ja_JP.SJIS SHIFT_JIS"
-    echo "ko_KR.EUC EUC-KR"
-    ;;
-  darwin*)
-    # Darwin 7.5 has nl_langinfo(CODESET), but sometimes its value is
-    # useless:
-    # - It returns the empty string when LANG is set to a locale of the
-    #   form ll_CC, although ll_CC/LC_CTYPE is a symlink to an UTF-8
-    #   LC_CTYPE file.
-    # - The environment variables LANG, LC_CTYPE, LC_ALL are not set by
-    #   the system; nl_langinfo(CODESET) returns "US-ASCII" in this case.
-    # - The documentation says:
-    #     "... all code that calls BSD system routines should ensure
-    #      that the const *char parameters of these routines are in UTF-8
-    #      encoding. All BSD system functions expect their string
-    #      parameters to be in UTF-8 encoding and nothing else."
-    #   It also says
-    #     "An additional caveat is that string parameters for files,
-    #      paths, and other file-system entities must be in canonical
-    #      UTF-8. In a canonical UTF-8 Unicode string, all decomposable
-    #      characters are decomposed ..."
-    #   but this is not true: You can pass non-decomposed UTF-8 strings
-    #   to file system functions, and it is the OS which will convert
-    #   them to decomposed UTF-8 before accessing the file system.
-    # - The Apple Terminal application displays UTF-8 by default.
-    # - However, other applications are free to use different encodings:
-    #   - xterm uses ISO-8859-1 by default.
-    #   - TextEdit uses MacRoman by default.
-    # We prefer UTF-8 over decomposed UTF-8-MAC because one should
-    # minimize the use of decomposed Unicode. Unfortunately, through the
-    # Darwin file system, decomposed UTF-8 strings are leaked into user
-    # space nevertheless.
-    # Then there are also the locales with encodings other than US-ASCII
-    # and UTF-8. These locales can be occasionally useful to users (e.g.
-    # when grepping through ISO-8859-1 encoded text files), when all their
-    # file names are in US-ASCII.
-    echo "ISO8859-1 ISO-8859-1"
-    echo "ISO8859-2 ISO-8859-2"
-    echo "ISO8859-4 ISO-8859-4"
-    echo "ISO8859-5 ISO-8859-5"
-    echo "ISO8859-7 ISO-8859-7"
-    echo "ISO8859-9 ISO-8859-9"
-    echo "ISO8859-13 ISO-8859-13"
-    echo "ISO8859-15 ISO-8859-15"
-    echo "KOI8-R KOI8-R"
-    echo "KOI8-U KOI8-U"
-    echo "CP866 CP866"
-    echo "CP949 CP949"
-    echo "CP1131 CP1131"
-    echo "CP1251 CP1251"
-    echo "eucCN GB2312"
-    echo "GB2312 GB2312"
-    echo "eucJP EUC-JP"
-    echo "eucKR EUC-KR"
-    echo "Big5 BIG5"
-    echo "Big5HKSCS BIG5-HKSCS"
-    echo "GBK GBK"
-    echo "GB18030 GB18030"
-    echo "SJIS SHIFT_JIS"
-    echo "ARMSCII-8 ARMSCII-8"
-    echo "PT154 PT154"
-    #echo "ISCII-DEV ?"
-    echo "* UTF-8"
-    ;;
-  beos* | haiku*)
-    # BeOS and Haiku have a single locale, and it has UTF-8 encoding.
-    echo "* UTF-8"
-    ;;
-  msdosdjgpp*)
-    # DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore
-    # localcharset.c falls back to using the full locale name
-    # from the environment variables.
-    echo "#"
-    echo "# The encodings given here may not all be correct."
-    echo "# If you find that the encoding given for your language and"
-    echo "# country is not the one your DOS machine actually uses, just"
-    echo "# correct it in this file, and send a mail to"
-    echo "# Juan Manuel Guerrero <juan.guerrero@gmx.de>"
-    echo "# and Bruno Haible <bruno@clisp.org>."
-    echo "#"
-    echo "C ASCII"
-    # ISO-8859-1 languages
-    echo "ca CP850"
-    echo "ca_ES CP850"
-    echo "da CP865"    # not CP850 ??
-    echo "da_DK CP865" # not CP850 ??
-    echo "de CP850"
-    echo "de_AT CP850"
-    echo "de_CH CP850"
-    echo "de_DE CP850"
-    echo "en CP850"
-    echo "en_AU CP850" # not CP437 ??
-    echo "en_CA CP850"
-    echo "en_GB CP850"
-    echo "en_NZ CP437"
-    echo "en_US CP437"
-    echo "en_ZA CP850" # not CP437 ??
-    echo "es CP850"
-    echo "es_AR CP850"
-    echo "es_BO CP850"
-    echo "es_CL CP850"
-    echo "es_CO CP850"
-    echo "es_CR CP850"
-    echo "es_CU CP850"
-    echo "es_DO CP850"
-    echo "es_EC CP850"
-    echo "es_ES CP850"
-    echo "es_GT CP850"
-    echo "es_HN CP850"
-    echo "es_MX CP850"
-    echo "es_NI CP850"
-    echo "es_PA CP850"
-    echo "es_PY CP850"
-    echo "es_PE CP850"
-    echo "es_SV CP850"
-    echo "es_UY CP850"
-    echo "es_VE CP850"
-    echo "et CP850"
-    echo "et_EE CP850"
-    echo "eu CP850"
-    echo "eu_ES CP850"
-    echo "fi CP850"
-    echo "fi_FI CP850"
-    echo "fr CP850"
-    echo "fr_BE CP850"
-    echo "fr_CA CP850"
-    echo "fr_CH CP850"
-    echo "fr_FR CP850"
-    echo "ga CP850"
-    echo "ga_IE CP850"
-    echo "gd CP850"
-    echo "gd_GB CP850"
-    echo "gl CP850"
-    echo "gl_ES CP850"
-    echo "id CP850"    # not CP437 ??
-    echo "id_ID CP850" # not CP437 ??
-    echo "is CP861"    # not CP850 ??
-    echo "is_IS CP861" # not CP850 ??
-    echo "it CP850"
-    echo "it_CH CP850"
-    echo "it_IT CP850"
-    echo "lt CP775"
-    echo "lt_LT CP775"
-    echo "lv CP775"
-    echo "lv_LV CP775"
-    echo "nb CP865"    # not CP850 ??
-    echo "nb_NO CP865" # not CP850 ??
-    echo "nl CP850"
-    echo "nl_BE CP850"
-    echo "nl_NL CP850"
-    echo "nn CP865"    # not CP850 ??
-    echo "nn_NO CP865" # not CP850 ??
-    echo "no CP865"    # not CP850 ??
-    echo "no_NO CP865" # not CP850 ??
-    echo "pt CP850"
-    echo "pt_BR CP850"
-    echo "pt_PT CP850"
-    echo "sv CP850"
-    echo "sv_SE CP850"
-    # ISO-8859-2 languages
-    echo "cs CP852"
-    echo "cs_CZ CP852"
-    echo "hr CP852"
-    echo "hr_HR CP852"
-    echo "hu CP852"
-    echo "hu_HU CP852"
-    echo "pl CP852"
-    echo "pl_PL CP852"
-    echo "ro CP852"
-    echo "ro_RO CP852"
-    echo "sk CP852"
-    echo "sk_SK CP852"
-    echo "sl CP852"
-    echo "sl_SI CP852"
-    echo "sq CP852"
-    echo "sq_AL CP852"
-    echo "sr CP852"    # CP852 or CP866 or CP855 ??
-    echo "sr_CS CP852" # CP852 or CP866 or CP855 ??
-    echo "sr_YU CP852" # CP852 or CP866 or CP855 ??
-    # ISO-8859-3 languages
-    echo "mt CP850"
-    echo "mt_MT CP850"
-    # ISO-8859-5 languages
-    echo "be CP866"
-    echo "be_BE CP866"
-    echo "bg CP866"    # not CP855 ??
-    echo "bg_BG CP866" # not CP855 ??
-    echo "mk CP866"    # not CP855 ??
-    echo "mk_MK CP866" # not CP855 ??
-    echo "ru CP866"
-    echo "ru_RU CP866"
-    echo "uk CP1125"
-    echo "uk_UA CP1125"
-    # ISO-8859-6 languages
-    echo "ar CP864"
-    echo "ar_AE CP864"
-    echo "ar_DZ CP864"
-    echo "ar_EG CP864"
-    echo "ar_IQ CP864"
-    echo "ar_IR CP864"
-    echo "ar_JO CP864"
-    echo "ar_KW CP864"
-    echo "ar_MA CP864"
-    echo "ar_OM CP864"
-    echo "ar_QA CP864"
-    echo "ar_SA CP864"
-    echo "ar_SY CP864"
-    # ISO-8859-7 languages
-    echo "el CP869"
-    echo "el_GR CP869"
-    # ISO-8859-8 languages
-    echo "he CP862"
-    echo "he_IL CP862"
-    # ISO-8859-9 languages
-    echo "tr CP857"
-    echo "tr_TR CP857"
-    # Japanese
-    echo "ja CP932"
-    echo "ja_JP CP932"
-    # Chinese
-    echo "zh_CN GBK"
-    echo "zh_TW CP950" # not CP938 ??
-    # Korean
-    echo "kr CP949"    # not CP934 ??
-    echo "kr_KR CP949" # not CP934 ??
-    # Thai
-    echo "th CP874"
-    echo "th_TH CP874"
-    # Other
-    echo "eo CP850"
-    echo "eo_EO CP850"
-    ;;
-esac

+ 0 - 86
gl/dirname-lgpl.c~

@@ -1,86 +0,0 @@
-/* dirname.c -- return all but the last element in a file name
-
-   Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2013 Free Software
-   Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include "dirname.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-/* Return the length of the prefix of FILE that will be used by
-   dir_name.  If FILE is in the working directory, this returns zero
-   even though 'dir_name (FILE)' will return ".".  Works properly even
-   if there are trailing slashes (by effectively ignoring them).  */
-
-size_t
-dir_len (char const *file)
-{
-  size_t prefix_length = FILE_SYSTEM_PREFIX_LEN (file);
-  size_t length;
-
-  /* Advance prefix_length beyond important leading slashes.  */
-  prefix_length += (prefix_length != 0
-                    ? (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
-                       && ISSLASH (file[prefix_length]))
-                    : (ISSLASH (file[0])
-                       ? ((DOUBLE_SLASH_IS_DISTINCT_ROOT
-                           && ISSLASH (file[1]) && ! ISSLASH (file[2])
-                           ? 2 : 1))
-                       : 0));
-
-  /* Strip the basename and any redundant slashes before it.  */
-  for (length = last_component (file) - file;
-       prefix_length < length; length--)
-    if (! ISSLASH (file[length - 1]))
-      break;
-  return length;
-}
-
-
-/* In general, we can't use the builtin 'dirname' function if available,
-   since it has different meanings in different environments.
-   In some environments the builtin 'dirname' modifies its argument.
-
-   Return the leading directories part of FILE, allocated with malloc.
-   Works properly even if there are trailing slashes (by effectively
-   ignoring them).  Return NULL on failure.
-
-   If lstat (FILE) would succeed, then { chdir (dir_name (FILE));
-   lstat (base_name (FILE)); } will access the same file.  Likewise,
-   if the sequence { chdir (dir_name (FILE));
-   rename (base_name (FILE), "foo"); } succeeds, you have renamed FILE
-   to "foo" in the same directory FILE was in.  */
-
-char *
-mdir_name (char const *file)
-{
-  size_t length = dir_len (file);
-  bool append_dot = (length == 0
-                     || (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
-                         && length == FILE_SYSTEM_PREFIX_LEN (file)
-                         && file[2] != '\0' && ! ISSLASH (file[2])));
-  char *dir = malloc (length + append_dot + 1);
-  if (!dir)
-    return NULL;
-  memcpy (dir, file, length);
-  if (append_dot)
-    dir[length++] = '.';
-  dir[length] = '\0';
-  return dir;
-}

+ 0 - 38
gl/dirname.c~

@@ -1,38 +0,0 @@
-/* dirname.c -- return all but the last element in a file name
-
-   Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2013 Free Software
-   Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include "dirname.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include "xalloc.h"
-
-/* Just like mdir_name (dirname-lgpl.c), except, rather than
-   returning NULL upon malloc failure, here, we report the
-   "memory exhausted" condition and exit.  */
-
-char *
-dir_name (char const *file)
-{
-  char *result = mdir_name (file);
-  if (!result)
-    xalloc_die ();
-  return result;
-}

+ 0 - 46
gl/dirname.h~

@@ -1,46 +0,0 @@
-/*  Take file names apart into directory and base names.
-
-    Copyright (C) 1998, 2001, 2003-2006, 2009-2013 Free Software Foundation,
-    Inc.
-
-    This program is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 3 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef NAGIOS_DIRNAME_H_INCLUDED
-#define NAGIOS_DIRNAME_H_INCLUDED
-
-# include <stdbool.h>
-# include <stddef.h>
-# include "dosname.h"
-
-# ifndef DIRECTORY_SEPARATOR
-#  define DIRECTORY_SEPARATOR '/'
-# endif
-
-# ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT
-#  define DOUBLE_SLASH_IS_DISTINCT_ROOT 0
-# endif
-
-# if GNULIB_DIRNAME
-char *base_name (char const *file);
-char *dir_name (char const *file);
-# endif
-
-char *mdir_name (char const *file);
-size_t base_len (char const *file) _GL_ATTRIBUTE_PURE;
-size_t dir_len (char const *file) _GL_ATTRIBUTE_PURE;
-char *last_component (char const *file) _GL_ATTRIBUTE_PURE;
-
-bool strip_trailing_slashes (char *file);
-
-#endif /* not NAGIOS_DIRNAME_H_INCLUDED */

+ 0 - 53
gl/dosname.h~

@@ -1,53 +0,0 @@
-/* File names on MS-DOS/Windows systems.
-
-   Copyright (C) 2000-2001, 2004-2006, 2009-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-   From Paul Eggert and Jim Meyering.  */
-
-#ifndef NAGIOS_GL_DOSNAME_H_INCLUDED
-#define NAGIOS_GL_DOSNAME_H_INCLUDED
-
-#if (defined _WIN32 || defined __WIN32__ ||     \
-     defined __MSDOS__ || defined __CYGWIN__ || \
-     defined __EMX__ || defined __DJGPP__)
-   /* This internal macro assumes ASCII, but all hosts that support drive
-      letters use ASCII.  */
-# define _IS_DRIVE_LETTER(C) (((unsigned int) (C) | ('a' - 'A')) - 'a'  \
-                              <= 'z' - 'a')
-# define FILE_SYSTEM_PREFIX_LEN(Filename) \
-          (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0)
-# ifndef __CYGWIN__
-#  define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1
-# endif
-# define ISSLASH(C) ((C) == '/' || (C) == '\\')
-#else
-# define FILE_SYSTEM_PREFIX_LEN(Filename) 0
-# define ISSLASH(C) ((C) == '/')
-#endif
-
-#ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
-# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0
-#endif
-
-#if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
-#  define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)])
-# else
-#  define IS_ABSOLUTE_FILE_NAME(F)                              \
-     (ISSLASH ((F)[0]) || FILE_SYSTEM_PREFIX_LEN (F) != 0)
-#endif
-#define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F))
-
-#endif /* DOSNAME_H_ */

+ 0 - 279
gl/errno.in.h~

@@ -1,279 +0,0 @@
-/* A POSIX-like <errno.h>.
-
-   Copyright (C) 2008-2013 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef _@GUARD_PREFIX@_ERRNO_H
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-/* The include_next requires a split double-inclusion guard.  */
-#@INCLUDE_NEXT@ @NEXT_ERRNO_H@
-
-#ifndef _@GUARD_PREFIX@_ERRNO_H
-#define _@GUARD_PREFIX@_ERRNO_H
-
-
-/* On native Windows platforms, many macros are not defined.  */
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-
-/* These are the same values as defined by MSVC 10, for interoperability.  */
-
-#  ifndef ENOMSG
-#   define ENOMSG    122
-#   define GNULIB_defined_ENOMSG 1
-#  endif
-
-#  ifndef EIDRM
-#   define EIDRM     111
-#   define GNULIB_defined_EIDRM 1
-#  endif
-
-#  ifndef ENOLINK
-#   define ENOLINK   121
-#   define GNULIB_defined_ENOLINK 1
-#  endif
-
-#  ifndef EPROTO
-#   define EPROTO    134
-#   define GNULIB_defined_EPROTO 1
-#  endif
-
-#  ifndef EBADMSG
-#   define EBADMSG   104
-#   define GNULIB_defined_EBADMSG 1
-#  endif
-
-#  ifndef EOVERFLOW
-#   define EOVERFLOW 132
-#   define GNULIB_defined_EOVERFLOW 1
-#  endif
-
-#  ifndef ENOTSUP
-#   define ENOTSUP   129
-#   define GNULIB_defined_ENOTSUP 1
-#  endif
-
-#  ifndef ENETRESET
-#   define ENETRESET 117
-#   define GNULIB_defined_ENETRESET 1
-#  endif
-
-#  ifndef ECONNABORTED
-#   define ECONNABORTED 106
-#   define GNULIB_defined_ECONNABORTED 1
-#  endif
-
-#  ifndef ECANCELED
-#   define ECANCELED 105
-#   define GNULIB_defined_ECANCELED 1
-#  endif
-
-#  ifndef EOWNERDEAD
-#   define EOWNERDEAD 133
-#   define GNULIB_defined_EOWNERDEAD 1
-#  endif
-
-#  ifndef ENOTRECOVERABLE
-#   define ENOTRECOVERABLE 127
-#   define GNULIB_defined_ENOTRECOVERABLE 1
-#  endif
-
-#  ifndef EINPROGRESS
-#   define EINPROGRESS     112
-#   define EALREADY        103
-#   define ENOTSOCK        128
-#   define EDESTADDRREQ    109
-#   define EMSGSIZE        115
-#   define EPROTOTYPE      136
-#   define ENOPROTOOPT     123
-#   define EPROTONOSUPPORT 135
-#   define EOPNOTSUPP      130
-#   define EAFNOSUPPORT    102
-#   define EADDRINUSE      100
-#   define EADDRNOTAVAIL   101
-#   define ENETDOWN        116
-#   define ENETUNREACH     118
-#   define ECONNRESET      108
-#   define ENOBUFS         119
-#   define EISCONN         113
-#   define ENOTCONN        126
-#   define ETIMEDOUT       138
-#   define ECONNREFUSED    107
-#   define ELOOP           114
-#   define EHOSTUNREACH    110
-#   define EWOULDBLOCK     140
-#   define GNULIB_defined_ESOCK 1
-#  endif
-
-#  ifndef ETXTBSY
-#   define ETXTBSY         139
-#   define ENODATA         120  /* not required by POSIX */
-#   define ENOSR           124  /* not required by POSIX */
-#   define ENOSTR          125  /* not required by POSIX */
-#   define ETIME           137  /* not required by POSIX */
-#   define EOTHER          131  /* not required by POSIX */
-#   define GNULIB_defined_ESTREAMS 1
-#  endif
-
-/* These are intentionally the same values as the WSA* error numbers, defined
-   in <winsock2.h>.  */
-#  define ESOCKTNOSUPPORT 10044  /* not required by POSIX */
-#  define EPFNOSUPPORT    10046  /* not required by POSIX */
-#  define ESHUTDOWN       10058  /* not required by POSIX */
-#  define ETOOMANYREFS    10059  /* not required by POSIX */
-#  define EHOSTDOWN       10064  /* not required by POSIX */
-#  define EPROCLIM        10067  /* not required by POSIX */
-#  define EUSERS          10068  /* not required by POSIX */
-#  define EDQUOT          10069
-#  define ESTALE          10070
-#  define EREMOTE         10071  /* not required by POSIX */
-#  define GNULIB_defined_EWINSOCK 1
-
-# endif
-
-
-/* On OSF/1 5.1, when _XOPEN_SOURCE_EXTENDED is not defined, the macros
-   EMULTIHOP, ENOLINK, EOVERFLOW are not defined.  */
-# if @EMULTIHOP_HIDDEN@
-#  define EMULTIHOP @EMULTIHOP_VALUE@
-#  define GNULIB_defined_EMULTIHOP 1
-# endif
-# if @ENOLINK_HIDDEN@
-#  define ENOLINK   @ENOLINK_VALUE@
-#  define GNULIB_defined_ENOLINK 1
-# endif
-# if @EOVERFLOW_HIDDEN@
-#  define EOVERFLOW @EOVERFLOW_VALUE@
-#  define GNULIB_defined_EOVERFLOW 1
-# endif
-
-
-/* On OpenBSD 4.0 and on native Windows, the macros ENOMSG, EIDRM, ENOLINK,
-   EPROTO, EMULTIHOP, EBADMSG, EOVERFLOW, ENOTSUP, ECANCELED are not defined.
-   Likewise, on NonStop Kernel, EDQUOT is not defined.
-   Define them here.  Values >= 2000 seem safe to use: Solaris ESTALE = 151,
-   HP-UX EWOULDBLOCK = 246, IRIX EDQUOT = 1133.
-
-   Note: When one of these systems defines some of these macros some day,
-   binaries will have to be recompiled so that they recognizes the new
-   errno values from the system.  */
-
-# ifndef ENOMSG
-#  define ENOMSG    2000
-#  define GNULIB_defined_ENOMSG 1
-# endif
-
-# ifndef EIDRM
-#  define EIDRM     2001
-#  define GNULIB_defined_EIDRM 1
-# endif
-
-# ifndef ENOLINK
-#  define ENOLINK   2002
-#  define GNULIB_defined_ENOLINK 1
-# endif
-
-# ifndef EPROTO
-#  define EPROTO    2003
-#  define GNULIB_defined_EPROTO 1
-# endif
-
-# ifndef EMULTIHOP
-#  define EMULTIHOP 2004
-#  define GNULIB_defined_EMULTIHOP 1
-# endif
-
-# ifndef EBADMSG
-#  define EBADMSG   2005
-#  define GNULIB_defined_EBADMSG 1
-# endif
-
-# ifndef EOVERFLOW
-#  define EOVERFLOW 2006
-#  define GNULIB_defined_EOVERFLOW 1
-# endif
-
-# ifndef ENOTSUP
-#  define ENOTSUP   2007
-#  define GNULIB_defined_ENOTSUP 1
-# endif
-
-# ifndef ENETRESET
-#  define ENETRESET 2011
-#  define GNULIB_defined_ENETRESET 1
-# endif
-
-# ifndef ECONNABORTED
-#  define ECONNABORTED 2012
-#  define GNULIB_defined_ECONNABORTED 1
-# endif
-
-# ifndef ESTALE
-#  define ESTALE    2009
-#  define GNULIB_defined_ESTALE 1
-# endif
-
-# ifndef EDQUOT
-#  define EDQUOT 2010
-#  define GNULIB_defined_EDQUOT 1
-# endif
-
-# ifndef ECANCELED
-#  define ECANCELED 2008
-#  define GNULIB_defined_ECANCELED 1
-# endif
-
-/* On many platforms, the macros EOWNERDEAD and ENOTRECOVERABLE are not
-   defined.  */
-
-# ifndef EOWNERDEAD
-#  if defined __sun
-    /* Use the same values as defined for Solaris >= 8, for
-       interoperability.  */
-#   define EOWNERDEAD      58
-#   define ENOTRECOVERABLE 59
-#  elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-    /* We have a conflict here: pthreads-win32 defines these values
-       differently than MSVC 10.  It's hairy to decide which one to use.  */
-#   if defined __MINGW32__ && !defined USE_WINDOWS_THREADS
-     /* Use the same values as defined by pthreads-win32, for
-        interoperability.  */
-#    define EOWNERDEAD      43
-#    define ENOTRECOVERABLE 44
-#   else
-     /* Use the same values as defined by MSVC 10, for
-        interoperability.  */
-#    define EOWNERDEAD      133
-#    define ENOTRECOVERABLE 127
-#   endif
-#  else
-#   define EOWNERDEAD      2013
-#   define ENOTRECOVERABLE 2014
-#  endif
-#  define GNULIB_defined_EOWNERDEAD 1
-#  define GNULIB_defined_ENOTRECOVERABLE 1
-# endif
-
-# ifndef EILSEQ
-#  define EILSEQ 2015
-#  define GNULIB_defined_EILSEQ 1
-# endif
-
-#endif /* _@GUARD_PREFIX@_ERRNO_H */
-#endif /* _@GUARD_PREFIX@_ERRNO_H */

+ 0 - 401
gl/error.c~

@@ -1,401 +0,0 @@
-/* Error handler for noninteractive utilities
-   Copyright (C) 1990-1998, 2000-2007, 2009-2013 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by David MacKenzie <djm@gnu.ai.mit.edu>.  */
-
-#if !_LIBC
-# include <config.h>
-#endif
-
-#include "error.h"
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#if !_LIBC && ENABLE_NLS
-# include "gettext.h"
-# define _(msgid) gettext (msgid)
-#endif
-
-#ifdef _LIBC
-# include <libintl.h>
-# include <stdbool.h>
-# include <stdint.h>
-# include <wchar.h>
-# define mbsrtowcs __mbsrtowcs
-#endif
-
-#if USE_UNLOCKED_IO
-# include "unlocked-io.h"
-#endif
-
-#ifndef _
-# define _(String) String
-#endif
-
-/* If NULL, error will flush stdout, then print on stderr the program
-   name, a colon and a space.  Otherwise, error will call this
-   function without parameters instead.  */
-void (*error_print_progname) (void);
-
-/* This variable is incremented each time 'error' is called.  */
-unsigned int error_message_count;
-
-#ifdef _LIBC
-/* In the GNU C library, there is a predefined variable for this.  */
-
-# define program_name program_invocation_name
-# include <errno.h>
-# include <limits.h>
-# include <libio/libioP.h>
-
-/* In GNU libc we want do not want to use the common name 'error' directly.
-   Instead make it a weak alias.  */
-extern void __error (int status, int errnum, const char *message, ...)
-     __attribute__ ((__format__ (__printf__, 3, 4)));
-extern void __error_at_line (int status, int errnum, const char *file_name,
-                             unsigned int line_number, const char *message,
-                             ...)
-     __attribute__ ((__format__ (__printf__, 5, 6)));;
-# define error __error
-# define error_at_line __error_at_line
-
-# include <libio/iolibio.h>
-# define fflush(s) INTUSE(_IO_fflush) (s)
-# undef putc
-# define putc(c, fp) INTUSE(_IO_putc) (c, fp)
-
-# include <bits/libc-lock.h>
-
-#else /* not _LIBC */
-
-# include <fcntl.h>
-# include <unistd.h>
-
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* Get declarations of the native Windows API functions.  */
-#  define WIN32_LEAN_AND_MEAN
-#  include <windows.h>
-/* Get _get_osfhandle.  */
-#  include "msvc-nothrow.h"
-# endif
-
-/* The gnulib override of fcntl is not needed in this file.  */
-# undef fcntl
-
-# if !HAVE_DECL_STRERROR_R
-#  ifndef HAVE_DECL_STRERROR_R
-"this configure-time declaration test was not run"
-#  endif
-#  if STRERROR_R_CHAR_P
-char *strerror_r ();
-#  else
-int strerror_r ();
-#  endif
-# endif
-
-/* The calling program should define program_name and set it to the
-   name of the executing program.  */
-extern char *program_name;
-
-# if HAVE_STRERROR_R || defined strerror_r
-#  define __strerror_r strerror_r
-# endif /* HAVE_STRERROR_R || defined strerror_r */
-#endif  /* not _LIBC */
-
-#if !_LIBC
-/* Return non-zero if FD is open.  */
-static int
-is_open (int fd)
-{
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-  /* On native Windows: The initial state of unassigned standard file
-     descriptors is that they are open but point to an INVALID_HANDLE_VALUE.
-     There is no fcntl, and the gnulib replacement fcntl does not support
-     F_GETFL.  */
-  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
-}
-#endif
-
-static void
-flush_stdout (void)
-{
-#if !_LIBC
-  int stdout_fd;
-
-# if GNULIB_FREOPEN_SAFER
-  /* Use of gnulib's freopen-safer module normally ensures that
-       fileno (stdout) == 1
-     whenever stdout is open.  */
-  stdout_fd = STDOUT_FILENO;
-# else
-  /* POSIX states that fileno (stdout) after fclose is unspecified.  But in
-     practice it is not a problem, because stdout is statically allocated and
-     the fd of a FILE stream is stored as a field in its allocated memory.  */
-  stdout_fd = fileno (stdout);
-# endif
-  /* POSIX states that fflush (stdout) after fclose is unspecified; it
-     is safe in glibc, but not on all other platforms.  fflush (NULL)
-     is always defined, but too draconian.  */
-  if (0 <= stdout_fd && is_open (stdout_fd))
-#endif
-    fflush (stdout);
-}
-
-static void
-print_errno_message (int errnum)
-{
-  char const *s;
-
-#if defined HAVE_STRERROR_R || _LIBC
-  char errbuf[1024];
-# if STRERROR_R_CHAR_P || _LIBC
-  s = __strerror_r (errnum, errbuf, sizeof errbuf);
-# else
-  if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0)
-    s = errbuf;
-  else
-    s = 0;
-# endif
-#else
-  s = strerror (errnum);
-#endif
-
-#if !_LIBC
-  if (! s)
-    s = _("Unknown system error");
-#endif
-
-#if _LIBC
-  __fxprintf (NULL, ": %s", s);
-#else
-  fprintf (stderr, ": %s", s);
-#endif
-}
-
-static void
-error_tail (int status, int errnum, const char *message, va_list args)
-{
-#if _LIBC
-  if (_IO_fwide (stderr, 0) > 0)
-    {
-# define ALLOCA_LIMIT 2000
-      size_t len = strlen (message) + 1;
-      wchar_t *wmessage = NULL;
-      mbstate_t st;
-      size_t res;
-      const char *tmp;
-      bool use_malloc = false;
-
-      while (1)
-        {
-          if (__libc_use_alloca (len * sizeof (wchar_t)))
-            wmessage = (wchar_t *) alloca (len * sizeof (wchar_t));
-          else
-            {
-              if (!use_malloc)
-                wmessage = NULL;
-
-              wchar_t *p = (wchar_t *) realloc (wmessage,
-                                                len * sizeof (wchar_t));
-              if (p == NULL)
-                {
-                  free (wmessage);
-                  fputws_unlocked (L"out of memory\n", stderr);
-                  return;
-                }
-              wmessage = p;
-              use_malloc = true;
-            }
-
-          memset (&st, '\0', sizeof (st));
-          tmp = message;
-
-          res = mbsrtowcs (wmessage, &tmp, len, &st);
-          if (res != len)
-            break;
-
-          if (__builtin_expect (len >= SIZE_MAX / 2, 0))
-            {
-              /* This really should not happen if everything is fine.  */
-              res = (size_t) -1;
-              break;
-            }
-
-          len *= 2;
-        }
-
-      if (res == (size_t) -1)
-        {
-          /* The string cannot be converted.  */
-          if (use_malloc)
-            {
-              free (wmessage);
-              use_malloc = false;
-            }
-          wmessage = (wchar_t *) L"???";
-        }
-
-      __vfwprintf (stderr, wmessage, args);
-
-      if (use_malloc)
-        free (wmessage);
-    }
-  else
-#endif
-    vfprintf (stderr, message, args);
-  va_end (args);
-
-  ++error_message_count;
-  if (errnum)
-    print_errno_message (errnum);
-#if _LIBC
-  __fxprintf (NULL, "\n");
-#else
-  putc ('\n', stderr);
-#endif
-  fflush (stderr);
-  if (status)
-    exit (status);
-}
-
-
-/* Print the program name and error message MESSAGE, which is a printf-style
-   format string with optional args.
-   If ERRNUM is nonzero, print its corresponding system error message.
-   Exit with status STATUS if it is nonzero.  */
-void
-error (int status, int errnum, const char *message, ...)
-{
-  va_list args;
-
-#if defined _LIBC && defined __libc_ptf_call
-  /* We do not want this call to be cut short by a thread
-     cancellation.  Therefore disable cancellation for now.  */
-  int state = PTHREAD_CANCEL_ENABLE;
-  __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
-                   0);
-#endif
-
-  flush_stdout ();
-#ifdef _LIBC
-  _IO_flockfile (stderr);
-#endif
-  if (error_print_progname)
-    (*error_print_progname) ();
-  else
-    {
-#if _LIBC
-      __fxprintf (NULL, "%s: ", program_name);
-#else
-      fprintf (stderr, "%s: ", program_name);
-#endif
-    }
-
-  va_start (args, message);
-  error_tail (status, errnum, message, args);
-
-#ifdef _LIBC
-  _IO_funlockfile (stderr);
-# ifdef __libc_ptf_call
-  __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
-# endif
-#endif
-}
-
-/* Sometimes we want to have at most one error per line.  This
-   variable controls whether this mode is selected or not.  */
-int error_one_per_line;
-
-void
-error_at_line (int status, int errnum, const char *file_name,
-               unsigned int line_number, const char *message, ...)
-{
-  va_list args;
-
-  if (error_one_per_line)
-    {
-      static const char *old_file_name;
-      static unsigned int old_line_number;
-
-      if (old_line_number == line_number
-          && (file_name == old_file_name
-              || strcmp (old_file_name, file_name) == 0))
-        /* Simply return and print nothing.  */
-        return;
-
-      old_file_name = file_name;
-      old_line_number = line_number;
-    }
-
-#if defined _LIBC && defined __libc_ptf_call
-  /* We do not want this call to be cut short by a thread
-     cancellation.  Therefore disable cancellation for now.  */
-  int state = PTHREAD_CANCEL_ENABLE;
-  __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
-                   0);
-#endif
-
-  flush_stdout ();
-#ifdef _LIBC
-  _IO_flockfile (stderr);
-#endif
-  if (error_print_progname)
-    (*error_print_progname) ();
-  else
-    {
-#if _LIBC
-      __fxprintf (NULL, "%s:", program_name);
-#else
-      fprintf (stderr, "%s:", program_name);
-#endif
-    }
-
-#if _LIBC
-  __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ",
-              file_name, line_number);
-#else
-  fprintf (stderr, file_name != NULL ? "%s:%d: " : " ",
-           file_name, line_number);
-#endif
-
-  va_start (args, message);
-  error_tail (status, errnum, message, args);
-
-#ifdef _LIBC
-  _IO_funlockfile (stderr);
-# ifdef __libc_ptf_call
-  __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
-# endif
-#endif
-}
-
-#ifdef _LIBC
-/* Make the weak alias.  */
-# undef error
-# undef error_at_line
-weak_alias (__error, error)
-weak_alias (__error_at_line, error_at_line)
-#endif

+ 0 - 65
gl/error.h~

@@ -1,65 +0,0 @@
-/* Declaration for error-reporting function
-   Copyright (C) 1995-1997, 2003, 2006, 2008-2013 Free Software Foundation,
-   Inc.
-   This file is part of the GNU C Library.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef NAGIOS_GL_ERROR_H_INCLUDED
-#define NAGIOS_GL_ERROR_H_INCLUDED
-
-/* 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 _GL_ATTRIBUTE_FORMAT 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 _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
-#else
-# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Print a message with 'fprintf (stderr, FORMAT, ...)';
-   if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
-   If STATUS is nonzero, terminate the program with 'exit (STATUS)'.  */
-
-extern void error (int __status, int __errnum, const char *__format, ...)
-     _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 4));
-
-extern void error_at_line (int __status, int __errnum, const char *__fname,
-                           unsigned int __lineno, const char *__format, ...)
-     _GL_ATTRIBUTE_FORMAT ((__printf__, 5, 6));
-
-/* If NULL, error will flush stdout, then print on stderr the program
-   name, a colon and a space.  Otherwise, error will call this
-   function without parameters instead.  */
-extern void (*error_print_progname) (void);
-
-/* This variable is incremented each time 'error' is called.  */
-extern unsigned int error_message_count;
-
-/* Sometimes we want to have at most one error per line.  This
-   variable controls whether this mode is selected or not.  */
-extern int error_one_per_line;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* error.h */

+ 0 - 24
gl/exitfail.c~

@@ -1,24 +0,0 @@
-/* Failure exit status
-
-   Copyright (C) 2002-2003, 2005-2007, 2009-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include "exitfail.h"
-
-#include <stdlib.h>
-
-int volatile exit_failure = EXIT_FAILURE;

+ 0 - 18
gl/exitfail.h~

@@ -1,18 +0,0 @@
-/* Failure exit status
-
-   Copyright (C) 2002, 2009-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-extern int volatile exit_failure;

+ 0 - 116
gl/fd-hook.c~

@@ -1,116 +0,0 @@
-/* Hook for making making file descriptor functions close(), ioctl() extensible.
-   Copyright (C) 2009-2013 Free Software Foundation, Inc.
-   Written by Bruno Haible <bruno@clisp.org>, 2009.
-
-   This program is free software: you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published
-   by the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include "fd-hook.h"
-
-#include <stdlib.h>
-
-/* Currently, this entire code is only needed for the handling of sockets
-   on native Windows platforms.  */
-#if WINDOWS_SOCKETS
-
-/* The first and last link in the doubly linked list.
-   Initially the list is empty.  */
-static struct fd_hook anchor = { &anchor, &anchor, NULL, NULL };
-
-int
-execute_close_hooks (const struct fd_hook *remaining_list, gl_close_fn primary,
-                     int fd)
-{
-  if (remaining_list == &anchor)
-    /* End of list reached.  */
-    return primary (fd);
-  else
-    return remaining_list->private_close_fn (remaining_list->private_next,
-                                             primary, fd);
-}
-
-int
-execute_all_close_hooks (gl_close_fn primary, int fd)
-{
-  return execute_close_hooks (anchor.private_next, primary, fd);
-}
-
-int
-execute_ioctl_hooks (const struct fd_hook *remaining_list, gl_ioctl_fn primary,
-                     int fd, int request, void *arg)
-{
-  if (remaining_list == &anchor)
-    /* End of list reached.  */
-    return primary (fd, request, arg);
-  else
-    return remaining_list->private_ioctl_fn (remaining_list->private_next,
-                                             primary, fd, request, arg);
-}
-
-int
-execute_all_ioctl_hooks (gl_ioctl_fn primary,
-                         int fd, int request, void *arg)
-{
-  return execute_ioctl_hooks (anchor.private_next, primary, fd, request, arg);
-}
-
-void
-register_fd_hook (close_hook_fn close_hook, ioctl_hook_fn ioctl_hook, struct fd_hook *link)
-{
-  if (close_hook == NULL)
-    close_hook = execute_close_hooks;
-  if (ioctl_hook == NULL)
-    ioctl_hook = execute_ioctl_hooks;
-
-  if (link->private_next == NULL && link->private_prev == NULL)
-    {
-      /* Add the link to the doubly linked list.  */
-      link->private_next = anchor.private_next;
-      link->private_prev = &anchor;
-      link->private_close_fn = close_hook;
-      link->private_ioctl_fn = ioctl_hook;
-      anchor.private_next->private_prev = link;
-      anchor.private_next = link;
-    }
-  else
-    {
-      /* The link is already in use.  */
-      if (link->private_close_fn != close_hook
-          || link->private_ioctl_fn != ioctl_hook)
-        abort ();
-    }
-}
-
-void
-unregister_fd_hook (struct fd_hook *link)
-{
-  struct fd_hook *next = link->private_next;
-  struct fd_hook *prev = link->private_prev;
-
-  if (next != NULL && prev != NULL)
-    {
-      /* The link is in use.  Remove it from the doubly linked list.  */
-      prev->private_next = next;
-      next->private_prev = prev;
-      /* Clear the link, to mark it unused.  */
-      link->private_next = NULL;
-      link->private_prev = NULL;
-      link->private_close_fn = NULL;
-      link->private_ioctl_fn = NULL;
-    }
-}
-
-#endif

+ 0 - 119
gl/fd-hook.h~

@@ -1,119 +0,0 @@
-/* Hook for making making file descriptor functions close(), ioctl() extensible.
-   Copyright (C) 2009-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published
-   by the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-
-#ifndef NAGIOS_FD_HOOK_H_INCLUDED
-#define NAGIOS_FD_HOOK_H_INCLUDED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Currently, this entire code is only needed for the handling of sockets
-   on native Windows platforms.  */
-#if WINDOWS_SOCKETS
-
-
-/* Type of function that closes FD.  */
-typedef int (*gl_close_fn) (int fd);
-
-/* Type of function that applies a control request to FD.  */
-typedef int (*gl_ioctl_fn) (int fd, int request, void *arg);
-
-/* An element of the list of file descriptor hooks.
-   In CLOS (Common Lisp Object System) speak, it consists of an "around"
-   method for the close() function and an "around" method for the ioctl()
-   function.
-   The fields of this structure are considered private.  */
-struct fd_hook
-{
-  /* Doubly linked list.  */
-  struct fd_hook *private_next;
-  struct fd_hook *private_prev;
-  /* Function that treats the types of FD that it knows about and calls
-     execute_close_hooks (REMAINING_LIST, PRIMARY, FD) as a fallback.  */
-  int (*private_close_fn) (const struct fd_hook *remaining_list,
-                           gl_close_fn primary,
-                           int fd);
-  /* Function that treats the types of FD that it knows about and calls
-     execute_ioctl_hooks (REMAINING_LIST, PRIMARY, FD, REQUEST, ARG) as a
-     fallback.  */
-  int (*private_ioctl_fn) (const struct fd_hook *remaining_list,
-                           gl_ioctl_fn primary,
-                           int fd, int request, void *arg);
-};
-
-/* This type of function closes FD, applying special knowledge for the FD
-   types it knows about, and calls
-   execute_close_hooks (REMAINING_LIST, PRIMARY, FD)
-   for the other FD types.
-   In CLOS speak, REMAINING_LIST is the remaining list of "around" methods,
-   and PRIMARY is the "primary" method for close().  */
-typedef int (*close_hook_fn) (const struct fd_hook *remaining_list,
-                              gl_close_fn primary,
-                              int fd);
-
-/* Execute the close hooks in REMAINING_LIST, with PRIMARY as "primary" method.
-   Return 0 or -1, like close() would do.  */
-extern int execute_close_hooks (const struct fd_hook *remaining_list,
-                                gl_close_fn primary,
-                                int fd);
-
-/* Execute all close hooks, with PRIMARY as "primary" method.
-   Return 0 or -1, like close() would do.  */
-extern int execute_all_close_hooks (gl_close_fn primary, int fd);
-
-/* This type of function applies a control request to FD, applying special
-   knowledge for the FD types it knows about, and calls
-   execute_ioctl_hooks (REMAINING_LIST, PRIMARY, FD, REQUEST, ARG)
-   for the other FD types.
-   In CLOS speak, REMAINING_LIST is the remaining list of "around" methods,
-   and PRIMARY is the "primary" method for ioctl().  */
-typedef int (*ioctl_hook_fn) (const struct fd_hook *remaining_list,
-                              gl_ioctl_fn primary,
-                              int fd, int request, void *arg);
-
-/* Execute the ioctl hooks in REMAINING_LIST, with PRIMARY as "primary" method.
-   Return 0 or -1, like ioctl() would do.  */
-extern int execute_ioctl_hooks (const struct fd_hook *remaining_list,
-                                gl_ioctl_fn primary,
-                                int fd, int request, void *arg);
-
-/* Execute all ioctl hooks, with PRIMARY as "primary" method.
-   Return 0 or -1, like ioctl() would do.  */
-extern int execute_all_ioctl_hooks (gl_ioctl_fn primary,
-                                    int fd, int request, void *arg);
-
-/* Add a function pair to the list of file descriptor hooks.
-   CLOSE_HOOK and IOCTL_HOOK may be NULL, indicating no change.
-   The LINK variable points to a piece of memory which is guaranteed to be
-   accessible until the corresponding call to unregister_fd_hook.  */
-extern void register_fd_hook (close_hook_fn close_hook, ioctl_hook_fn ioctl_hook,
-                              struct fd_hook *link);
-
-/* Removes a hook from the list of file descriptor hooks.  */
-extern void unregister_fd_hook (struct fd_hook *link);
-
-
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* NAGIOS_FD_HOOK_H_INCLUDED */

+ 0 - 147
gl/float+.h~

@@ -1,147 +0,0 @@
-/* Supplemental information about the floating-point formats.
-   Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
-   Written by Bruno Haible <bruno@clisp.org>, 2007.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef NAGIOS_FLOATPLUS_H_INCLUDED
-#define NAGIOS_FLOATPLUS_H_INCLUDED
-
-#include <float.h>
-#include <limits.h>
-
-/* Number of bits in the mantissa of a floating-point number, including the
-   "hidden bit".  */
-#if FLT_RADIX == 2
-# define FLT_MANT_BIT FLT_MANT_DIG
-# define DBL_MANT_BIT DBL_MANT_DIG
-# define LDBL_MANT_BIT LDBL_MANT_DIG
-#elif FLT_RADIX == 4
-# define FLT_MANT_BIT (FLT_MANT_DIG * 2)
-# define DBL_MANT_BIT (DBL_MANT_DIG * 2)
-# define LDBL_MANT_BIT (LDBL_MANT_DIG * 2)
-#elif FLT_RADIX == 16
-# define FLT_MANT_BIT (FLT_MANT_DIG * 4)
-# define DBL_MANT_BIT (DBL_MANT_DIG * 4)
-# define LDBL_MANT_BIT (LDBL_MANT_DIG * 4)
-#endif
-
-/* Bit mask that can be used to mask the exponent, as an unsigned number.  */
-#define FLT_EXP_MASK ((FLT_MAX_EXP - FLT_MIN_EXP) | 7)
-#define DBL_EXP_MASK ((DBL_MAX_EXP - DBL_MIN_EXP) | 7)
-#define LDBL_EXP_MASK ((LDBL_MAX_EXP - LDBL_MIN_EXP) | 7)
-
-/* Number of bits used for the exponent of a floating-point number, including
-   the exponent's sign.  */
-#define FLT_EXP_BIT \
-  (FLT_EXP_MASK < 0x100 ? 8 : \
-   FLT_EXP_MASK < 0x200 ? 9 : \
-   FLT_EXP_MASK < 0x400 ? 10 : \
-   FLT_EXP_MASK < 0x800 ? 11 : \
-   FLT_EXP_MASK < 0x1000 ? 12 : \
-   FLT_EXP_MASK < 0x2000 ? 13 : \
-   FLT_EXP_MASK < 0x4000 ? 14 : \
-   FLT_EXP_MASK < 0x8000 ? 15 : \
-   FLT_EXP_MASK < 0x10000 ? 16 : \
-   FLT_EXP_MASK < 0x20000 ? 17 : \
-   FLT_EXP_MASK < 0x40000 ? 18 : \
-   FLT_EXP_MASK < 0x80000 ? 19 : \
-   FLT_EXP_MASK < 0x100000 ? 20 : \
-   FLT_EXP_MASK < 0x200000 ? 21 : \
-   FLT_EXP_MASK < 0x400000 ? 22 : \
-   FLT_EXP_MASK < 0x800000 ? 23 : \
-   FLT_EXP_MASK < 0x1000000 ? 24 : \
-   FLT_EXP_MASK < 0x2000000 ? 25 : \
-   FLT_EXP_MASK < 0x4000000 ? 26 : \
-   FLT_EXP_MASK < 0x8000000 ? 27 : \
-   FLT_EXP_MASK < 0x10000000 ? 28 : \
-   FLT_EXP_MASK < 0x20000000 ? 29 : \
-   FLT_EXP_MASK < 0x40000000 ? 30 : \
-   FLT_EXP_MASK <= 0x7fffffff ? 31 : \
-   32)
-#define DBL_EXP_BIT \
-  (DBL_EXP_MASK < 0x100 ? 8 : \
-   DBL_EXP_MASK < 0x200 ? 9 : \
-   DBL_EXP_MASK < 0x400 ? 10 : \
-   DBL_EXP_MASK < 0x800 ? 11 : \
-   DBL_EXP_MASK < 0x1000 ? 12 : \
-   DBL_EXP_MASK < 0x2000 ? 13 : \
-   DBL_EXP_MASK < 0x4000 ? 14 : \
-   DBL_EXP_MASK < 0x8000 ? 15 : \
-   DBL_EXP_MASK < 0x10000 ? 16 : \
-   DBL_EXP_MASK < 0x20000 ? 17 : \
-   DBL_EXP_MASK < 0x40000 ? 18 : \
-   DBL_EXP_MASK < 0x80000 ? 19 : \
-   DBL_EXP_MASK < 0x100000 ? 20 : \
-   DBL_EXP_MASK < 0x200000 ? 21 : \
-   DBL_EXP_MASK < 0x400000 ? 22 : \
-   DBL_EXP_MASK < 0x800000 ? 23 : \
-   DBL_EXP_MASK < 0x1000000 ? 24 : \
-   DBL_EXP_MASK < 0x2000000 ? 25 : \
-   DBL_EXP_MASK < 0x4000000 ? 26 : \
-   DBL_EXP_MASK < 0x8000000 ? 27 : \
-   DBL_EXP_MASK < 0x10000000 ? 28 : \
-   DBL_EXP_MASK < 0x20000000 ? 29 : \
-   DBL_EXP_MASK < 0x40000000 ? 30 : \
-   DBL_EXP_MASK <= 0x7fffffff ? 31 : \
-   32)
-#define LDBL_EXP_BIT \
-  (LDBL_EXP_MASK < 0x100 ? 8 : \
-   LDBL_EXP_MASK < 0x200 ? 9 : \
-   LDBL_EXP_MASK < 0x400 ? 10 : \
-   LDBL_EXP_MASK < 0x800 ? 11 : \
-   LDBL_EXP_MASK < 0x1000 ? 12 : \
-   LDBL_EXP_MASK < 0x2000 ? 13 : \
-   LDBL_EXP_MASK < 0x4000 ? 14 : \
-   LDBL_EXP_MASK < 0x8000 ? 15 : \
-   LDBL_EXP_MASK < 0x10000 ? 16 : \
-   LDBL_EXP_MASK < 0x20000 ? 17 : \
-   LDBL_EXP_MASK < 0x40000 ? 18 : \
-   LDBL_EXP_MASK < 0x80000 ? 19 : \
-   LDBL_EXP_MASK < 0x100000 ? 20 : \
-   LDBL_EXP_MASK < 0x200000 ? 21 : \
-   LDBL_EXP_MASK < 0x400000 ? 22 : \
-   LDBL_EXP_MASK < 0x800000 ? 23 : \
-   LDBL_EXP_MASK < 0x1000000 ? 24 : \
-   LDBL_EXP_MASK < 0x2000000 ? 25 : \
-   LDBL_EXP_MASK < 0x4000000 ? 26 : \
-   LDBL_EXP_MASK < 0x8000000 ? 27 : \
-   LDBL_EXP_MASK < 0x10000000 ? 28 : \
-   LDBL_EXP_MASK < 0x20000000 ? 29 : \
-   LDBL_EXP_MASK < 0x40000000 ? 30 : \
-   LDBL_EXP_MASK <= 0x7fffffff ? 31 : \
-   32)
-
-/* Number of bits used for a floating-point number: the mantissa (not
-   counting the "hidden bit", since it may or may not be explicit), the
-   exponent, and the sign.  */
-#define FLT_TOTAL_BIT ((FLT_MANT_BIT - 1) + FLT_EXP_BIT + 1)
-#define DBL_TOTAL_BIT ((DBL_MANT_BIT - 1) + DBL_EXP_BIT + 1)
-#define LDBL_TOTAL_BIT ((LDBL_MANT_BIT - 1) + LDBL_EXP_BIT + 1)
-
-/* Number of bytes used for a floating-point number.
-   This can be smaller than the 'sizeof'.  For example, on i386 systems,
-   'long double' most often have LDBL_MANT_BIT = 64, LDBL_EXP_BIT = 16, hence
-   LDBL_TOTAL_BIT = 80 bits, i.e. 10 bytes of consecutive memory, but
-   sizeof (long double) = 12 or = 16.  */
-#define SIZEOF_FLT ((FLT_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
-#define SIZEOF_DBL ((DBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
-#define SIZEOF_LDBL ((LDBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
-
-/* Verify that SIZEOF_FLT <= sizeof (float) etc.  */
-typedef int verify_sizeof_flt[SIZEOF_FLT <= sizeof (float) ? 1 : -1];
-typedef int verify_sizeof_dbl[SIZEOF_DBL <= sizeof (double) ? 1 : - 1];
-typedef int verify_sizeof_ldbl[SIZEOF_LDBL <= sizeof (long double) ? 1 : - 1];
-
-#endif /* NAGIOS_FLOATPLUS_H_INCLUDED */

+ 0 - 33
gl/float.c~

@@ -1,33 +0,0 @@
-/* Auxiliary definitions for <float.h>.
-   Copyright (C) 2011-2013 Free Software Foundation, Inc.
-   Written by Bruno Haible <bruno@clisp.org>, 2011.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include <float.h>
-
-#if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__
-const union gl_long_double_union gl_LDBL_MAX =
-  { { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL } };
-#elif defined __i386__
-const union gl_long_double_union gl_LDBL_MAX =
-  { { 0xFFFFFFFF, 0xFFFFFFFF, 32766 } };
-#else
-/* This declaration is solely to ensure that after preprocessing
-   this file is never empty.  */
-typedef int dummy;
-#endif

+ 0 - 188
gl/float.in.h~

@@ -1,188 +0,0 @@
-/* A correct <float.h>.
-
-   Copyright (C) 2007-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef _@GUARD_PREFIX@_FLOAT_H
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-/* The include_next requires a split double-inclusion guard.  */
-#@INCLUDE_NEXT@ @NEXT_FLOAT_H@
-
-#ifndef _@GUARD_PREFIX@_FLOAT_H
-#define _@GUARD_PREFIX@_FLOAT_H
-
-/* 'long double' properties.  */
-
-#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__)
-/* Number of mantissa units, in base FLT_RADIX.  */
-# undef LDBL_MANT_DIG
-# define LDBL_MANT_DIG   64
-/* Number of decimal digits that is sufficient for representing a number.  */
-# undef LDBL_DIG
-# define LDBL_DIG        18
-/* x-1 where x is the smallest representable number > 1.  */
-# undef LDBL_EPSILON
-# define LDBL_EPSILON    1.0842021724855044340E-19L
-/* Minimum e such that FLT_RADIX^(e-1) is a normalized number.  */
-# undef LDBL_MIN_EXP
-# define LDBL_MIN_EXP    (-16381)
-/* Maximum e such that FLT_RADIX^(e-1) is a representable finite number.  */
-# undef LDBL_MAX_EXP
-# define LDBL_MAX_EXP    16384
-/* Minimum positive normalized number.  */
-# undef LDBL_MIN
-# define LDBL_MIN        3.3621031431120935063E-4932L
-/* Maximum representable finite number.  */
-# undef LDBL_MAX
-# define LDBL_MAX        1.1897314953572317650E+4932L
-/* Minimum e such that 10^e is in the range of normalized numbers.  */
-# undef LDBL_MIN_10_EXP
-# define LDBL_MIN_10_EXP (-4931)
-/* Maximum e such that 10^e is in the range of representable finite numbers.  */
-# undef LDBL_MAX_10_EXP
-# define LDBL_MAX_10_EXP 4932
-#endif
-
-/* On FreeBSD/x86 6.4, the 'long double' type really has only 53 bits of
-   precision in the compiler but 64 bits of precision at runtime.  See
-   <http://lists.gnu.org/archive/html/bug-gnulib/2008-07/msg00063.html>.  */
-#if defined __i386__ && defined __FreeBSD__
-/* Number of mantissa units, in base FLT_RADIX.  */
-# undef LDBL_MANT_DIG
-# define LDBL_MANT_DIG   64
-/* Number of decimal digits that is sufficient for representing a number.  */
-# undef LDBL_DIG
-# define LDBL_DIG        18
-/* x-1 where x is the smallest representable number > 1.  */
-# undef LDBL_EPSILON
-# define LDBL_EPSILON 1.084202172485504434007452800869941711426e-19L /* 2^-63 */
-/* Minimum e such that FLT_RADIX^(e-1) is a normalized number.  */
-# undef LDBL_MIN_EXP
-# define LDBL_MIN_EXP    (-16381)
-/* Maximum e such that FLT_RADIX^(e-1) is a representable finite number.  */
-# undef LDBL_MAX_EXP
-# define LDBL_MAX_EXP    16384
-/* Minimum positive normalized number.  */
-# undef LDBL_MIN
-# define LDBL_MIN        3.3621031431120935E-4932L /* = 0x1p-16382L */
-/* Maximum representable finite number.  */
-# undef LDBL_MAX
-/* LDBL_MAX is represented as { 0xFFFFFFFF, 0xFFFFFFFF, 32766 }.
-   But the largest literal that GCC allows us to write is
-   0x0.fffffffffffff8p16384L = { 0xFFFFF800, 0xFFFFFFFF, 32766 }.
-   So, define it like this through a reference to an external variable
-
-     const unsigned int LDBL_MAX[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 32766 };
-     extern const long double LDBL_MAX;
-
-   Unfortunately, this is not a constant expression.  */
-union gl_long_double_union
-  {
-    struct { unsigned int lo; unsigned int hi; unsigned int exponent; } xd;
-    long double ld;
-  };
-extern const union gl_long_double_union gl_LDBL_MAX;
-# define LDBL_MAX (gl_LDBL_MAX.ld)
-/* Minimum e such that 10^e is in the range of normalized numbers.  */
-# undef LDBL_MIN_10_EXP
-# define LDBL_MIN_10_EXP (-4931)
-/* Maximum e such that 10^e is in the range of representable finite numbers.  */
-# undef LDBL_MAX_10_EXP
-# define LDBL_MAX_10_EXP 4932
-#endif
-
-/* On AIX 7.1 with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_MAX are
-   wrong.
-   On Linux/PowerPC with gcc 4.4, the value of LDBL_MAX is wrong.  */
-#if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__
-# undef LDBL_MIN_EXP
-# define LDBL_MIN_EXP DBL_MIN_EXP
-# undef LDBL_MIN_10_EXP
-# define LDBL_MIN_10_EXP DBL_MIN_10_EXP
-# undef LDBL_MIN
-# define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */
-#endif
-#if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__
-# undef LDBL_MAX
-/* LDBL_MAX is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xFFFFFFFF }.
-   It is not easy to define:
-     #define LDBL_MAX 1.79769313486231580793728971405302307166e308L
-   is too small, whereas
-     #define LDBL_MAX 1.79769313486231580793728971405302307167e308L
-   is too large.  Apparently a bug in GCC decimal-to-binary conversion.
-   Also, I can't get values larger than
-     #define LDBL63 ((long double) (1ULL << 63))
-     #define LDBL882 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63)
-     #define LDBL945 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63)
-     #define LDBL1008 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63)
-     #define LDBL_MAX (LDBL1008 * 65535.0L + LDBL945 * (long double) 9223372036821221375ULL + LDBL882 * (long double) 4611686018427387904ULL)
-   which is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xF8000000 }.
-   So, define it like this through a reference to an external variable
-
-     const double LDBL_MAX[2] = { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL };
-     extern const long double LDBL_MAX;
-
-   or through a pointer cast
-
-     #define LDBL_MAX \
-       (*(const long double *) (double[]) { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL })
-
-   Unfortunately, this is not a constant expression, and the latter expression
-   does not work well when GCC is optimizing..  */
-union gl_long_double_union
-  {
-    struct { double hi; double lo; } dd;
-    long double ld;
-  };
-extern const union gl_long_double_union gl_LDBL_MAX;
-# define LDBL_MAX (gl_LDBL_MAX.ld)
-#endif
-
-/* On IRIX 6.5, with cc, the value of LDBL_MANT_DIG is wrong.
-   On IRIX 6.5, with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_EPSILON
-   are wrong.  */
-#if defined __sgi && (LDBL_MANT_DIG >= 106)
-# undef LDBL_MANT_DIG
-# define LDBL_MANT_DIG 106
-# if defined __GNUC__
-#  undef LDBL_MIN_EXP
-#  define LDBL_MIN_EXP DBL_MIN_EXP
-#  undef LDBL_MIN_10_EXP
-#  define LDBL_MIN_10_EXP DBL_MIN_10_EXP
-#  undef LDBL_MIN
-#  define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */
-#  undef LDBL_EPSILON
-#  define LDBL_EPSILON 2.46519032881566189191165176650870696773e-32L /* 2^-105 */
-# endif
-#endif
-
-#if @REPLACE_ITOLD@
-/* Pull in a function that fixes the 'int' to 'long double' conversion
-   of glibc 2.7.  */
-extern
-# ifdef __cplusplus
-"C"
-# endif
-void _Qp_itoq (long double *, int);
-static void (*_gl_float_fix_itold) (long double *, int) = _Qp_itoq;
-#endif
-
-#endif /* _@GUARD_PREFIX@_FLOAT_H */
-#endif /* _@GUARD_PREFIX@_FLOAT_H */

+ 0 - 105
gl/floor.c~

@@ -1,105 +0,0 @@
-/* Round towards negative infinity.
-   Copyright (C) 2007, 2010-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
-
-#if ! defined USE_LONG_DOUBLE
-# include <config.h>
-#endif
-
-/* Specification.  */
-#include <math.h>
-
-#include <float.h>
-
-#ifdef USE_LONG_DOUBLE
-# define FUNC floorl
-# define DOUBLE long double
-# define MANT_DIG LDBL_MANT_DIG
-# define L_(literal) literal##L
-#elif ! defined USE_FLOAT
-# define FUNC floor
-# define DOUBLE double
-# define MANT_DIG DBL_MANT_DIG
-# define L_(literal) literal
-#else /* defined USE_FLOAT */
-# define FUNC floorf
-# define DOUBLE float
-# define MANT_DIG FLT_MANT_DIG
-# define L_(literal) literal##f
-#endif
-
-/* MSVC with option -fp:strict refuses to compile constant initializers that
-   contain floating-point operations.  Pacify this compiler.  */
-#ifdef _MSC_VER
-# pragma fenv_access (off)
-#endif
-
-/* 2^(MANT_DIG-1).  */
-static const DOUBLE TWO_MANT_DIG =
-  /* Assume MANT_DIG <= 5 * 31.
-     Use the identity
-       n = floor(n/5) + floor((n+1)/5) + ... + floor((n+4)/5).  */
-  (DOUBLE) (1U << ((MANT_DIG - 1) / 5))
-  * (DOUBLE) (1U << ((MANT_DIG - 1 + 1) / 5))
-  * (DOUBLE) (1U << ((MANT_DIG - 1 + 2) / 5))
-  * (DOUBLE) (1U << ((MANT_DIG - 1 + 3) / 5))
-  * (DOUBLE) (1U << ((MANT_DIG - 1 + 4) / 5));
-
-DOUBLE
-FUNC (DOUBLE x)
-{
-  /* The use of 'volatile' guarantees that excess precision bits are dropped
-     at each addition step and before the following comparison at the caller's
-     site.  It is necessary on x86 systems where double-floats are not IEEE
-     compliant by default, to avoid that the results become platform and compiler
-     option dependent.  'volatile' is a portable alternative to gcc's
-     -ffloat-store option.  */
-  volatile DOUBLE y = x;
-  volatile DOUBLE z = y;
-
-  if (z > L_(0.0))
-    {
-      /* For 0 < x < 1, return +0.0 even if the current rounding mode is
-         FE_DOWNWARD.  */
-      if (z < L_(1.0))
-        z = L_(0.0);
-      /* Avoid rounding errors for values near 2^k, where k >= MANT_DIG-1.  */
-      else if (z < TWO_MANT_DIG)
-        {
-          /* Round to the next integer (nearest or up or down, doesn't matter).  */
-          z += TWO_MANT_DIG;
-          z -= TWO_MANT_DIG;
-          /* Enforce rounding down.  */
-          if (z > y)
-            z -= L_(1.0);
-        }
-    }
-  else if (z < L_(0.0))
-    {
-      /* Avoid rounding errors for values near -2^k, where k >= MANT_DIG-1.  */
-      if (z > - TWO_MANT_DIG)
-        {
-          /* Round to the next integer (nearest or up or down, doesn't matter).  */
-          z -= TWO_MANT_DIG;
-          z += TWO_MANT_DIG;
-          /* Enforce rounding down.  */
-          if (z > y)
-            z -= L_(1.0);
-        }
-    }
-  return z;
-}

+ 0 - 20
gl/floorf.c~

@@ -1,20 +0,0 @@
-/* Round towards negative infinity.
-   Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
-
-#define USE_FLOAT
-#include "floor.c"

+ 0 - 331
gl/fsusage.c~

@@ -1,331 +0,0 @@
-/* fsusage.c -- return space usage of mounted file systems
-
-   Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2013 Free Software
-   Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include "fsusage.h"
-
-#include <limits.h>
-#include <sys/types.h>
-
-#if STAT_STATVFS || STAT_STATVFS64 /* POSIX 1003.1-2001 (and later) with XSI */
-# include <sys/statvfs.h>
-#else
-/* Don't include backward-compatibility files unless they're needed.
-   Eventually we'd like to remove all this cruft.  */
-# include <fcntl.h>
-# include <unistd.h>
-# include <sys/stat.h>
-#if HAVE_SYS_PARAM_H
-# include <sys/param.h>
-#endif
-#if HAVE_SYS_MOUNT_H
-# include <sys/mount.h>
-#endif
-#if HAVE_SYS_VFS_H
-# include <sys/vfs.h>
-#endif
-# if HAVE_SYS_FS_S5PARAM_H      /* Fujitsu UXP/V */
-#  include <sys/fs/s5param.h>
-# endif
-# if defined HAVE_SYS_FILSYS_H && !defined _CRAY
-#  include <sys/filsys.h>       /* SVR2 */
-# endif
-# if HAVE_SYS_STATFS_H
-#  include <sys/statfs.h>
-# endif
-# if HAVE_DUSTAT_H              /* AIX PS/2 */
-#  include <sys/dustat.h>
-# endif
-# include "full-read.h"
-#endif
-
-/* The results of open() in this file are not used with fchdir,
-   therefore save some unnecessary work in fchdir.c.  */
-#undef open
-#undef close
-
-/* Many space usage primitives use all 1 bits to denote a value that is
-   not applicable or unknown.  Propagate this information by returning
-   a uintmax_t value that is all 1 bits if X is all 1 bits, even if X
-   is unsigned and narrower than uintmax_t.  */
-#define PROPAGATE_ALL_ONES(x) \
-  ((sizeof (x) < sizeof (uintmax_t) \
-    && (~ (x) == (sizeof (x) < sizeof (int) \
-                  ? - (1 << (sizeof (x) * CHAR_BIT)) \
-                  : 0))) \
-   ? UINTMAX_MAX : (uintmax_t) (x))
-
-/* Extract the top bit of X as an uintmax_t value.  */
-#define EXTRACT_TOP_BIT(x) ((x) \
-                            & ((uintmax_t) 1 << (sizeof (x) * CHAR_BIT - 1)))
-
-/* If a value is negative, many space usage primitives store it into an
-   integer variable by assignment, even if the variable's type is unsigned.
-   So, if a space usage variable X's top bit is set, convert X to the
-   uintmax_t value V such that (- (uintmax_t) V) is the negative of
-   the original value.  If X's top bit is clear, just yield X.
-   Use PROPAGATE_TOP_BIT if the original value might be negative;
-   otherwise, use PROPAGATE_ALL_ONES.  */
-#define PROPAGATE_TOP_BIT(x) ((x) | ~ (EXTRACT_TOP_BIT (x) - 1))
-
-#ifdef STAT_STATVFS
-/* Return true if statvfs works.  This is false for statvfs on systems
-   with GNU libc on Linux kernels before 2.6.36, which stats all
-   preceding entries in /proc/mounts; that makes df hang if even one
-   of the corresponding file systems is hard-mounted but not available.  */
-# if ! (__linux__ && (__GLIBC__ || __UCLIBC__))
-/* The FRSIZE fallback is not required in this case.  */
-#  undef STAT_STATFS2_FRSIZE
-static int statvfs_works (void) { return 1; }
-# else
-#  include <string.h> /* for strverscmp */
-#  include <sys/utsname.h>
-#  include <sys/statfs.h>
-#  define STAT_STATFS2_BSIZE 1
-
-static int
-statvfs_works (void)
-{
-  static int statvfs_works_cache = -1;
-  struct utsname name;
-  if (statvfs_works_cache < 0)
-    statvfs_works_cache = (uname (&name) == 0
-                           && 0 <= strverscmp (name.release, "2.6.36"));
-  return statvfs_works_cache;
-}
-# endif
-#endif
-
-
-/* Fill in the fields of FSP with information about space usage for
-   the file system on which FILE resides.
-   DISK is the device on which FILE is mounted, for space-getting
-   methods that need to know it.
-   Return 0 if successful, -1 if not.  When returning -1, ensure that
-   ERRNO is either a system error value, or zero if DISK is NULL
-   on a system that requires a non-NULL value.  */
-int
-get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp)
-{
-#ifdef STAT_STATVFS     /* POSIX, except pre-2.6.36 glibc/Linux */
-
-  if (statvfs_works ())
-    {
-      struct statvfs vfsd;
-
-      if (statvfs (file, &vfsd) < 0)
-        return -1;
-
-      /* f_frsize isn't guaranteed to be supported.  */
-      fsp->fsu_blocksize = (vfsd.f_frsize
-                            ? PROPAGATE_ALL_ONES (vfsd.f_frsize)
-                            : PROPAGATE_ALL_ONES (vfsd.f_bsize));
-
-      fsp->fsu_blocks = PROPAGATE_ALL_ONES (vfsd.f_blocks);
-      fsp->fsu_bfree = PROPAGATE_ALL_ONES (vfsd.f_bfree);
-      fsp->fsu_bavail = PROPAGATE_TOP_BIT (vfsd.f_bavail);
-      fsp->fsu_bavail_top_bit_set = EXTRACT_TOP_BIT (vfsd.f_bavail) != 0;
-      fsp->fsu_files = PROPAGATE_ALL_ONES (vfsd.f_files);
-      fsp->fsu_ffree = PROPAGATE_ALL_ONES (vfsd.f_ffree);
-      return 0;
-    }
-
-#endif
-
-#if defined STAT_STATVFS64            /* AIX */
-
-  struct statvfs64 fsd;
-
-  if (statvfs64 (file, &fsd) < 0)
-    return -1;
-
-  /* f_frsize isn't guaranteed to be supported.  */
-  fsp->fsu_blocksize = (fsd.f_frsize
-                        ? PROPAGATE_ALL_ONES (fsd.f_frsize)
-                        : PROPAGATE_ALL_ONES (fsd.f_bsize));
-
-#elif defined STAT_STATFS2_FS_DATA      /* Ultrix */
-
-  struct fs_data fsd;
-
-  if (statfs (file, &fsd) != 1)
-    return -1;
-
-  fsp->fsu_blocksize = 1024;
-  fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.fd_req.btot);
-  fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.fd_req.bfree);
-  fsp->fsu_bavail = PROPAGATE_TOP_BIT (fsd.fd_req.bfreen);
-  fsp->fsu_bavail_top_bit_set = EXTRACT_TOP_BIT (fsd.fd_req.bfreen) != 0;
-  fsp->fsu_files = PROPAGATE_ALL_ONES (fsd.fd_req.gtot);
-  fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.fd_req.gfree);
-
-#elif defined STAT_READ_FILSYS          /* SVR2 */
-# ifndef SUPERBOFF
-#  define SUPERBOFF (SUPERB * 512)
-# endif
-
-  struct filsys fsd;
-  int fd;
-
-  if (! disk)
-    {
-      errno = 0;
-      return -1;
-    }
-
-  fd = open (disk, O_RDONLY);
-  if (fd < 0)
-    return -1;
-  lseek (fd, (off_t) SUPERBOFF, 0);
-  if (full_read (fd, (char *) &fsd, sizeof fsd) != sizeof fsd)
-    {
-      close (fd);
-      return -1;
-    }
-  close (fd);
-
-  fsp->fsu_blocksize = (fsd.s_type == Fs2b ? 1024 : 512);
-  fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.s_fsize);
-  fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.s_tfree);
-  fsp->fsu_bavail = PROPAGATE_TOP_BIT (fsd.s_tfree);
-  fsp->fsu_bavail_top_bit_set = EXTRACT_TOP_BIT (fsd.s_tfree) != 0;
-  fsp->fsu_files = (fsd.s_isize == -1
-                    ? UINTMAX_MAX
-                    : (fsd.s_isize - 2) * INOPB * (fsd.s_type == Fs2b ? 2 : 1));
-  fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.s_tinode);
-
-#elif defined STAT_STATFS3_OSF1         /* OSF/1 */
-
-  struct statfs fsd;
-
-  if (statfs (file, &fsd, sizeof (struct statfs)) != 0)
-    return -1;
-
-  fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize);
-
-#elif defined STAT_STATFS2_FRSIZE        /* 2.6 < glibc/Linux < 2.6.36 */
-
-  struct statfs fsd;
-
-  if (statfs (file, &fsd) < 0)
-    return -1;
-
-  fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_frsize);
-
-#elif defined STAT_STATFS2_BSIZE        /* glibc/Linux < 2.6, 4.3BSD, SunOS 4, \
-                                           Mac OS X < 10.4, FreeBSD < 5.0, \
-                                           NetBSD < 3.0, OpenBSD < 4.4 */
-
-  struct statfs fsd;
-
-  if (statfs (file, &fsd) < 0)
-    return -1;
-
-  fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_bsize);
-
-# ifdef STATFS_TRUNCATES_BLOCK_COUNTS
-
-  /* In SunOS 4.1.2, 4.1.3, and 4.1.3_U1, the block counts in the
-     struct statfs are truncated to 2GB.  These conditions detect that
-     truncation, presumably without botching the 4.1.1 case, in which
-     the values are not truncated.  The correct counts are stored in
-     undocumented spare fields.  */
-  if (fsd.f_blocks == 0x7fffffff / fsd.f_bsize && fsd.f_spare[0] > 0)
-    {
-      fsd.f_blocks = fsd.f_spare[0];
-      fsd.f_bfree = fsd.f_spare[1];
-      fsd.f_bavail = fsd.f_spare[2];
-    }
-# endif /* STATFS_TRUNCATES_BLOCK_COUNTS */
-
-#elif defined STAT_STATFS2_FSIZE        /* 4.4BSD and older NetBSD */
-
-  struct statfs fsd;
-
-  if (statfs (file, &fsd) < 0)
-    return -1;
-
-  fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize);
-
-#elif defined STAT_STATFS4              /* SVR3, Dynix, old Irix, old AIX, \
-                                           Dolphin */
-
-# if !_AIX && !defined _SEQUENT_ && !defined DOLPHIN
-#  define f_bavail f_bfree
-# endif
-
-  struct statfs fsd;
-
-  if (statfs (file, &fsd, sizeof fsd, 0) < 0)
-    return -1;
-
-  /* Empirically, the block counts on most SVR3 and SVR3-derived
-     systems seem to always be in terms of 512-byte blocks,
-     no matter what value f_bsize has.  */
-# if _AIX || defined _CRAY
-   fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_bsize);
-# else
-   fsp->fsu_blocksize = 512;
-# endif
-
-#endif
-
-#if (defined STAT_STATVFS64 || defined STAT_STATFS3_OSF1                \
-     || defined STAT_STATFS2_FRSIZE || defined STAT_STATFS2_BSIZE       \
-     || defined STAT_STATFS2_FSIZE || defined STAT_STATFS4)
-
-  fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.f_blocks);
-  fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.f_bfree);
-  fsp->fsu_bavail = PROPAGATE_TOP_BIT (fsd.f_bavail);
-  fsp->fsu_bavail_top_bit_set = EXTRACT_TOP_BIT (fsd.f_bavail) != 0;
-  fsp->fsu_files = PROPAGATE_ALL_ONES (fsd.f_files);
-  fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.f_ffree);
-
-#endif
-
-  (void) disk;  /* avoid argument-unused warning */
-  return 0;
-}
-
-#if defined _AIX && defined _I386
-/* AIX PS/2 does not supply statfs.  */
-
-int
-statfs (char *file, struct statfs *fsb)
-{
-  struct stat stats;
-  struct dustat fsd;
-
-  if (stat (file, &stats) != 0)
-    return -1;
-  if (dustat (stats.st_dev, 0, &fsd, sizeof (fsd)))
-    return -1;
-  fsb->f_type   = 0;
-  fsb->f_bsize  = fsd.du_bsize;
-  fsb->f_blocks = fsd.du_fsize - fsd.du_isize;
-  fsb->f_bfree  = fsd.du_tfree;
-  fsb->f_bavail = fsd.du_tfree;
-  fsb->f_files  = (fsd.du_isize - 2) * fsd.du_inopb;
-  fsb->f_ffree  = fsd.du_tinode;
-  fsb->f_fsid.val[0] = fsd.du_site;
-  fsb->f_fsid.val[1] = fsd.du_pckno;
-  return 0;
-}
-
-#endif /* _AIX && _I386 */

+ 0 - 40
gl/fsusage.h~

@@ -1,40 +0,0 @@
-/* fsusage.h -- declarations for file system space usage info
-
-   Copyright (C) 1991-1992, 1997, 2003-2006, 2009-2013 Free Software
-   Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Space usage statistics for a file system.  Blocks are 512-byte. */
-
-#if !defined NAGIOS_FSUSAGE_H_INCLUDED
-# define NAGIOS_FSUSAGE_H_INCLUDED
-
-# include <stdint.h>
-# include <stdbool.h>
-
-struct fs_usage
-{
-  uintmax_t fsu_blocksize;      /* Size of a block.  */
-  uintmax_t fsu_blocks;         /* Total blocks. */
-  uintmax_t fsu_bfree;          /* Free blocks available to superuser. */
-  uintmax_t fsu_bavail;         /* Free blocks available to non-superuser. */
-  bool fsu_bavail_top_bit_set;  /* 1 if fsu_bavail represents a value < 0.  */
-  uintmax_t fsu_files;          /* Total file nodes. */
-  uintmax_t fsu_ffree;          /* Free file nodes. */
-};
-
-int get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp);
-
-#endif

+ 0 - 18
gl/full-read.c~

@@ -1,18 +0,0 @@
-/* An interface to read that retries after partial reads and interrupts.
-   Copyright (C) 2002-2003, 2009-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#define FULL_READ
-#include "full-write.c"

+ 0 - 24
gl/full-read.h~

@@ -1,24 +0,0 @@
-/* An interface to read() that reads all it is asked to read.
-
-   Copyright (C) 2002, 2009-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, read to the Free Software Foundation,
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <stddef.h>
-
-/* Read COUNT bytes at BUF to descriptor FD, retrying if interrupted
-   or if partial reads occur.  Return the number of bytes successfully
-   read, setting errno if that is less than COUNT.  errno = 0 means EOF.  */
-extern size_t full_read (int fd, void *buf, size_t count);

+ 0 - 79
gl/full-write.c~

@@ -1,79 +0,0 @@
-/* An interface to read and write that retries (if necessary) until complete.
-
-   Copyright (C) 1993-1994, 1997-2006, 2009-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#ifdef FULL_READ
-# include "full-read.h"
-#else
-# include "full-write.h"
-#endif
-
-#include <errno.h>
-
-#ifdef FULL_READ
-# include "safe-read.h"
-# define safe_rw safe_read
-# define full_rw full_read
-# undef const
-# define const /* empty */
-#else
-# include "safe-write.h"
-# define safe_rw safe_write
-# define full_rw full_write
-#endif
-
-#ifdef FULL_READ
-/* Set errno to zero upon EOF.  */
-# define ZERO_BYTE_TRANSFER_ERRNO 0
-#else
-/* Some buggy drivers return 0 when one tries to write beyond
-   a device's end.  (Example: Linux 1.2.13 on /dev/fd0.)
-   Set errno to ENOSPC so they get a sensible diagnostic.  */
-# define ZERO_BYTE_TRANSFER_ERRNO ENOSPC
-#endif
-
-/* Write(read) COUNT bytes at BUF to(from) descriptor FD, retrying if
-   interrupted or if a partial write(read) occurs.  Return the number
-   of bytes transferred.
-   When writing, set errno if fewer than COUNT bytes are written.
-   When reading, if fewer than COUNT bytes are read, you must examine
-   errno to distinguish failure from EOF (errno == 0).  */
-size_t
-full_rw (int fd, const void *buf, size_t count)
-{
-  size_t total = 0;
-  const char *ptr = (const char *) buf;
-
-  while (count > 0)
-    {
-      size_t n_rw = safe_rw (fd, ptr, count);
-      if (n_rw == (size_t) -1)
-        break;
-      if (n_rw == 0)
-        {
-          errno = ZERO_BYTE_TRANSFER_ERRNO;
-          break;
-        }
-      total += n_rw;
-      ptr += n_rw;
-      count -= n_rw;
-    }
-
-  return total;
-}

+ 0 - 92
gl/gai_strerror.c~

@@ -1,92 +0,0 @@
-/* Copyright (C) 1997, 2001-2002, 2004-2006, 2008-2013 Free Software
-   Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef _LIBC
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <netdb.h>
-
-#ifdef _LIBC
-# include <libintl.h>
-#else
-# include "gettext.h"
-# define _(String) gettext (String)
-# define N_(String) String
-#endif
-
-#if HAVE_DECL_GAI_STRERROR
-
-# include <sys/socket.h>
-# undef gai_strerror
-# if HAVE_DECL_GAI_STRERRORA
-#  define gai_strerror gai_strerrorA
-# endif
-
-const char *
-rpl_gai_strerror (int code)
-{
-  return gai_strerror (code);
-}
-
-#else /* !HAVE_DECL_GAI_STRERROR */
-
-static struct
-  {
-    int code;
-    const char *msg;
-  }
-values[] =
-  {
-    { EAI_ADDRFAMILY, N_("Address family for hostname not supported") },
-    { EAI_AGAIN, N_("Temporary failure in name resolution") },
-    { EAI_BADFLAGS, N_("Bad value for ai_flags") },
-    { EAI_FAIL, N_("Non-recoverable failure in name resolution") },
-    { EAI_FAMILY, N_("ai_family not supported") },
-    { EAI_MEMORY, N_("Memory allocation failure") },
-    { EAI_NODATA, N_("No address associated with hostname") },
-    { EAI_NONAME, N_("Name or service not known") },
-    { EAI_SERVICE, N_("Servname not supported for ai_socktype") },
-    { EAI_SOCKTYPE, N_("ai_socktype not supported") },
-    { EAI_SYSTEM, N_("System error") },
-    { EAI_OVERFLOW, N_("Argument buffer too small") },
-#ifdef EAI_INPROGRESS
-    { EAI_INPROGRESS, N_("Processing request in progress") },
-    { EAI_CANCELED, N_("Request canceled") },
-    { EAI_NOTCANCELED, N_("Request not canceled") },
-    { EAI_ALLDONE, N_("All requests done") },
-    { EAI_INTR, N_("Interrupted by a signal") },
-    { EAI_IDN_ENCODE, N_("Parameter string not correctly encoded") }
-#endif
-  };
-
-const char *
-gai_strerror (int code)
-{
-  size_t i;
-  for (i = 0; i < sizeof (values) / sizeof (values[0]); ++i)
-    if (values[i].code == code)
-      return _(values[i].msg);
-
-  return _("Unknown error");
-}
-# ifdef _LIBC
-libc_hidden_def (gai_strerror)
-# endif
-#endif /* !HAVE_DECL_GAI_STRERROR */

+ 0 - 443
gl/getaddrinfo.c~

@@ -1,443 +0,0 @@
-/* Get address information (partial implementation).
-   Copyright (C) 1997, 2001-2002, 2004-2013 Free Software Foundation, Inc.
-   Contributed by Simon Josefsson <simon@josefsson.org>.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-/* Don't use __attribute__ __nonnull__ in this compilation unit.  Otherwise gcc
-   optimizes away the sa == NULL test below.  */
-#define _GL_ARG_NONNULL(params)
-
-#include <config.h>
-
-#include <netdb.h>
-
-#if HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-
-/* Get inet_ntop.  */
-#include <arpa/inet.h>
-
-/* Get calloc. */
-#include <stdlib.h>
-
-/* Get memcpy, strdup. */
-#include <string.h>
-
-/* Get snprintf. */
-#include <stdio.h>
-
-#include <stdbool.h>
-
-#include "gettext.h"
-#define _(String) gettext (String)
-#define N_(String) String
-
-/* BeOS has AF_INET, but not PF_INET.  */
-#ifndef PF_INET
-# define PF_INET AF_INET
-#endif
-/* BeOS also lacks PF_UNSPEC.  */
-#ifndef PF_UNSPEC
-# define PF_UNSPEC 0
-#endif
-
-#if defined _WIN32 || defined __WIN32__
-# define WINDOWS_NATIVE
-#endif
-
-/* gl_sockets_startup */
-#include "sockets.h"
-
-#ifdef WINDOWS_NATIVE
-typedef int (WSAAPI *getaddrinfo_func) (const char*, const char*,
-                                        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);
-
-static getaddrinfo_func getaddrinfo_ptr = NULL;
-static freeaddrinfo_func freeaddrinfo_ptr = NULL;
-static getnameinfo_func getnameinfo_ptr = NULL;
-
-static int
-use_win32_p (void)
-{
-  static int done = 0;
-  HMODULE h;
-
-  if (done)
-    return getaddrinfo_ptr ? 1 : 0;
-
-  done = 1;
-
-  h = GetModuleHandle ("ws2_32.dll");
-
-  if (h)
-    {
-      getaddrinfo_ptr = (getaddrinfo_func) GetProcAddress (h, "getaddrinfo");
-      freeaddrinfo_ptr = (freeaddrinfo_func) GetProcAddress (h, "freeaddrinfo");
-      getnameinfo_ptr = (getnameinfo_func) GetProcAddress (h, "getnameinfo");
-    }
-
-  /* If either is missing, something is odd. */
-  if (!getaddrinfo_ptr || !freeaddrinfo_ptr || !getnameinfo_ptr)
-    {
-      getaddrinfo_ptr = NULL;
-      freeaddrinfo_ptr = NULL;
-      getnameinfo_ptr = NULL;
-      return 0;
-    }
-
-  gl_sockets_startup (SOCKETS_1_1);
-
-  return 1;
-}
-#endif
-
-static bool
-validate_family (int family)
-{
-  /* FIXME: Support more families. */
-#if HAVE_IPV4
-     if (family == PF_INET)
-       return true;
-#endif
-#if HAVE_IPV6
-     if (family == PF_INET6)
-       return true;
-#endif
-     if (family == PF_UNSPEC)
-       return true;
-     return false;
-}
-
-/* Translate name of a service location and/or a service name to set of
-   socket addresses. */
-int
-getaddrinfo (const char *restrict nodename,
-             const char *restrict servname,
-             const struct addrinfo *restrict hints,
-             struct addrinfo **restrict res)
-{
-  struct addrinfo *tmp;
-  int port = 0;
-  struct hostent *he;
-  void *storage;
-  size_t size;
-#if HAVE_IPV6
-  struct v6_pair {
-    struct addrinfo addrinfo;
-    struct sockaddr_in6 sockaddr_in6;
-  };
-#endif
-#if HAVE_IPV4
-  struct v4_pair {
-    struct addrinfo addrinfo;
-    struct sockaddr_in sockaddr_in;
-  };
-#endif
-
-#ifdef WINDOWS_NATIVE
-  if (use_win32_p ())
-    return getaddrinfo_ptr (nodename, servname, hints, res);
-#endif
-
-  if (hints && (hints->ai_flags & ~(AI_CANONNAME|AI_PASSIVE)))
-    /* FIXME: Support more flags. */
-    return EAI_BADFLAGS;
-
-  if (hints && !validate_family (hints->ai_family))
-    return EAI_FAMILY;
-
-  if (hints &&
-      hints->ai_socktype != SOCK_STREAM && hints->ai_socktype != SOCK_DGRAM)
-    /* FIXME: Support other socktype. */
-    return EAI_SOCKTYPE; /* FIXME: Better return code? */
-
-  if (!nodename)
-    {
-      if (!(hints->ai_flags & AI_PASSIVE))
-        return EAI_NONAME;
-
-#ifdef HAVE_IPV6
-      nodename = (hints->ai_family == AF_INET6) ? "::" : "0.0.0.0";
-#else
-      nodename = "0.0.0.0";
-#endif
-    }
-
-  if (servname)
-    {
-      struct servent *se = NULL;
-      const char *proto =
-        (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);
-
-      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);
-        }
-      else
-        port = se->s_port;
-    }
-
-  /* FIXME: Use gethostbyname_r if available. */
-  he = gethostbyname (nodename);
-  if (!he || he->h_addr_list[0] == NULL)
-    return EAI_NONAME;
-
-  switch (he->h_addrtype)
-    {
-#if HAVE_IPV6
-    case PF_INET6:
-      size = sizeof (struct v6_pair);
-      break;
-#endif
-
-#if HAVE_IPV4
-    case PF_INET:
-      size = sizeof (struct v4_pair);
-      break;
-#endif
-
-    default:
-      return EAI_NODATA;
-    }
-
-  storage = calloc (1, size);
-  if (!storage)
-    return EAI_MEMORY;
-
-  switch (he->h_addrtype)
-    {
-#if HAVE_IPV6
-    case PF_INET6:
-      {
-        struct v6_pair *p = storage;
-        struct sockaddr_in6 *sinp = &p->sockaddr_in6;
-        tmp = &p->addrinfo;
-
-        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? */
-          }
-
-        memcpy (&sinp->sin6_addr, he->h_addr_list[0], sizeof sinp->sin6_addr);
-
-        tmp->ai_addr = (struct sockaddr *) sinp;
-        tmp->ai_addrlen = sizeof *sinp;
-      }
-      break;
-#endif
-
-#if HAVE_IPV4
-    case PF_INET:
-      {
-        struct v4_pair *p = storage;
-        struct sockaddr_in *sinp = &p->sockaddr_in;
-        tmp = &p->addrinfo;
-
-        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? */
-          }
-
-        memcpy (&sinp->sin_addr, he->h_addr_list[0], sizeof sinp->sin_addr);
-
-        tmp->ai_addr = (struct sockaddr *) sinp;
-        tmp->ai_addrlen = sizeof *sinp;
-      }
-      break;
-#endif
-
-    default:
-      free (storage);
-      return EAI_NODATA;
-    }
-
-  if (hints && hints->ai_flags & AI_CANONNAME)
-    {
-      const char *cn;
-      if (he->h_name)
-        cn = he->h_name;
-      else
-        cn = nodename;
-
-      tmp->ai_canonname = strdup (cn);
-      if (!tmp->ai_canonname)
-        {
-          free (storage);
-          return EAI_MEMORY;
-        }
-    }
-
-  tmp->ai_protocol = (hints) ? hints->ai_protocol : 0;
-  tmp->ai_socktype = (hints) ? hints->ai_socktype : 0;
-  tmp->ai_addr->sa_family = he->h_addrtype;
-  tmp->ai_family = he->h_addrtype;
-
-#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
-  switch (he->h_addrtype)
-    {
-#if HAVE_IPV4
-    case AF_INET:
-      tmp->ai_addr->sa_len = sizeof (struct sockaddr_in);
-      break;
-#endif
-#if HAVE_IPV6
-    case AF_INET6:
-      tmp->ai_addr->sa_len = sizeof (struct sockaddr_in6);
-      break;
-#endif
-    }
-#endif
-
-  /* FIXME: If more than one address, create linked list of addrinfo's. */
-
-  *res = tmp;
-
-  return 0;
-}
-
-/* Free 'addrinfo' structure AI including associated storage.  */
-void
-freeaddrinfo (struct addrinfo *ai)
-{
-#ifdef WINDOWS_NATIVE
-  if (use_win32_p ())
-    {
-      freeaddrinfo_ptr (ai);
-      return;
-    }
-#endif
-
-  while (ai)
-    {
-      struct addrinfo *cur;
-
-      cur = ai;
-      ai = ai->ai_next;
-
-      free (cur->ai_canonname);
-      free (cur);
-    }
-}
-
-int
-getnameinfo (const struct sockaddr *restrict sa, socklen_t salen,
-             char *restrict node, socklen_t nodelen,
-             char *restrict service, socklen_t servicelen,
-             int flags)
-{
-#ifdef WINDOWS_NATIVE
-  if (use_win32_p ())
-    return getnameinfo_ptr (sa, salen, node, nodelen,
-                            service, servicelen, flags);
-#endif
-
-  /* FIXME: Support other flags. */
-  if ((node && nodelen > 0 && !(flags & NI_NUMERICHOST)) ||
-      (service && servicelen > 0 && !(flags & NI_NUMERICHOST)) ||
-      (flags & ~(NI_NUMERICHOST|NI_NUMERICSERV)))
-    return EAI_BADFLAGS;
-
-  if (sa == NULL || salen < sizeof (sa->sa_family))
-    return EAI_FAMILY;
-
-  switch (sa->sa_family)
-    {
-#if HAVE_IPV4
-    case AF_INET:
-      if (salen < sizeof (struct sockaddr_in))
-        return EAI_FAMILY;
-      break;
-#endif
-#if HAVE_IPV6
-    case AF_INET6:
-      if (salen < sizeof (struct sockaddr_in6))
-        return EAI_FAMILY;
-      break;
-#endif
-    default:
-      return EAI_FAMILY;
-    }
-
-  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;
-#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;
-#endif
-
-        default:
-          return EAI_FAMILY;
-        }
-    }
-
-  if (service && servicelen > 0 && flags & NI_NUMERICSERV)
-    switch (sa->sa_family)
-      {
-#if HAVE_IPV4
-      case AF_INET:
-#endif
-#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;
-      }
-
-  return 0;
-}

+ 0 - 104
gl/gethostname.c~

@@ -1,104 +0,0 @@
-/* gethostname emulation for SysV and POSIX.1.
-
-   Copyright (C) 1992, 2003, 2006, 2008-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* David MacKenzie <djm@gnu.ai.mit.edu>
-   Windows port by Simon Josefsson <simon@josefsson.org> */
-
-#include <config.h>
-
-#if !((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__)
-/* Unix API.  */
-
-/* Specification.  */
-#include <unistd.h>
-
-#ifdef HAVE_UNAME
-# include <sys/utsname.h>
-#endif
-
-#include <string.h>
-
-/* Put up to LEN chars of the host name into NAME.
-   Null terminate it if the name is shorter than LEN.
-   Return 0 if ok, -1 if error.  */
-
-#include <stddef.h>
-
-int
-gethostname (char *name, size_t len)
-{
-#ifdef HAVE_UNAME
-  struct utsname uts;
-
-  if (uname (&uts) == -1)
-    return -1;
-  if (len > sizeof (uts.nodename))
-    {
-      /* More space than we need is available.  */
-      name[sizeof (uts.nodename)] = '\0';
-      len = sizeof (uts.nodename);
-    }
-  strncpy (name, uts.nodename, len);
-#else
-  strcpy (name, "");            /* Hardcode your system name if you want.  */
-#endif
-  return 0;
-}
-
-#else
-/* Native Windows API.  Which primitive to choose?
-   - gethostname() requires linking with -lws2_32.
-   - GetComputerName() does not return the right kind of hostname.
-   - GetComputerNameEx(ComputerNameDnsHostname,...) returns the right hostname,
-     but it is hard to use portably:
-       - It requires defining _WIN32_WINNT to at least 0x0500.
-       - With mingw, it also requires
-         "#define GetComputerNameEx GetComputerNameExA".
-       - With older versions of mingw, none of the declarations are present at
-         all, not even of the enum value ComputerNameDnsHostname.
-   So we use gethostname().  Linking with -lws2_32 is the least evil.  */
-
-#define WIN32_LEAN_AND_MEAN
-/* Get winsock2.h. */
-#include <unistd.h>
-
-/* Get INT_MAX.  */
-#include <limits.h>
-
-/* Get set_winsock_errno. */
-#include "w32sock.h"
-
-#include "sockets.h"
-
-#undef gethostname
-
-int
-rpl_gethostname (char *name, size_t len)
-{
-  int r;
-
-  if (len > INT_MAX)
-    len = INT_MAX;
-  gl_sockets_startup (SOCKETS_1_1);
-  r = gethostname (name, (int) len);
-  if (r < 0)
-    set_winsock_errno ();
-
-  return r;
-}
-
-#endif

+ 0 - 1024
gl/getloadavg.c~

@@ -1,1024 +0,0 @@
-/* Get the system load averages.
-
-   Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2013 Free Software
-   Foundation, Inc.
-
-   NOTE: The canonical source of this file is maintained with gnulib.
-   Bugs can be reported to bug-gnulib@gnu.org.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Compile-time symbols that this file uses:
-
-   HAVE_PSTAT_GETDYNAMIC        Define this if your system has the
-                                pstat_getdynamic function.  I think it
-                                is unique to HPUX9.  The best way to get the
-                                definition is through the AC_FUNC_GETLOADAVG
-                                macro that comes with autoconf 2.13 or newer.
-                                If that isn't an option, then just put
-                                AC_CHECK_FUNCS(pstat_getdynamic) in your
-                                configure.ac file.
-   HAVE_LIBPERFSTAT Define this if your system has the
-                                perfstat_cpu_total function in libperfstat (AIX).
-   FIXUP_KERNEL_SYMBOL_ADDR()   Adjust address in returned struct nlist.
-   KERNEL_FILE                  Name of the kernel file to nlist.
-   LDAV_CVT()                   Scale the load average from the kernel.
-                                Returns a double.
-   LDAV_SYMBOL                  Name of kernel symbol giving load average.
-   LOAD_AVE_TYPE                Type of the load average array in the kernel.
-                                Must be defined unless one of
-                                apollo, DGUX, NeXT, or UMAX is defined;
-                                or we have libkstat;
-                                otherwise, no load average is available.
-   HAVE_NLIST_H                 nlist.h is available.  NLIST_STRUCT defaults
-                                to this.
-   NLIST_STRUCT                 Include nlist.h, not a.out.h.
-   N_NAME_POINTER               The nlist n_name element is a pointer,
-                                not an array.
-   HAVE_STRUCT_NLIST_N_UN_N_NAME 'n_un.n_name' is member of 'struct nlist'.
-   LINUX_LDAV_FILE              [__linux__, __CYGWIN__]: File containing
-                                load averages.
-
-   Specific system predefines this file uses, aside from setting
-   default values if not emacs:
-
-   apollo
-   BSD                          Real BSD, not just BSD-like.
-   convex
-   DGUX
-   eunice                       UNIX emulator under VMS.
-   hpux
-   __MSDOS__                    No-op for MSDOS.
-   NeXT
-   sgi
-   sequent                      Sequent Dynix 3.x.x (BSD)
-   _SEQUENT_                    Sequent DYNIX/ptx 1.x.x (SYSV)
-   sony_news                    NEWS-OS (works at least for 4.1C)
-   UMAX
-   UMAX4_3
-   VMS
-   WINDOWS32                    No-op for Windows95/NT.
-   __linux__                    Linux: assumes /proc file system mounted.
-                                Support from Michael K. Johnson.
-   __CYGWIN__                   Cygwin emulates linux /proc/loadavg.
-   __NetBSD__                   NetBSD: assumes /kern file system mounted.
-
-   In addition, to avoid nesting many #ifdefs, we internally set
-   LDAV_DONE to indicate that the load average has been computed.
-
-   We also #define LDAV_PRIVILEGED if a program will require
-   special installation to be able to call getloadavg.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include <stdlib.h>
-
-#include <errno.h>
-#include <stdbool.h>
-#include <stdio.h>
-
-# include <sys/types.h>
-
-# if HAVE_SYS_PARAM_H
-#  include <sys/param.h>
-# endif
-
-# include "intprops.h"
-
-# if !defined (BSD) && defined (ultrix)
-/* Ultrix behaves like BSD on Vaxen.  */
-#  define BSD
-# endif
-
-# ifdef NeXT
-/* NeXT in the 2.{0,1,2} releases defines BSD in <sys/param.h>, which
-   conflicts with the definition understood in this file, that this
-   really is BSD. */
-#  undef BSD
-
-/* NeXT defines FSCALE in <sys/param.h>.  However, we take FSCALE being
-   defined to mean that the nlist method should be used, which is not true.  */
-#  undef FSCALE
-# endif
-
-/* Same issues as for NeXT apply to the HURD-based GNU system.  */
-# ifdef __GNU__
-#  undef BSD
-#  undef FSCALE
-# endif /* __GNU__ */
-
-/* Set values that are different from the defaults, which are
-   set a little farther down with #ifndef.  */
-
-
-/* Some shorthands.  */
-
-# if defined (HPUX) && !defined (hpux)
-#  define hpux
-# endif
-
-# if defined (__hpux) && !defined (hpux)
-#  define hpux
-# endif
-
-# if defined (__sun) && !defined (sun)
-#  define sun
-# endif
-
-# if defined (hp300) && !defined (hpux)
-#  define MORE_BSD
-# endif
-
-# if defined (ultrix) && defined (mips)
-#  define decstation
-# endif
-
-# if defined (__SVR4) && !defined (SVR4)
-#  define SVR4
-# endif
-
-# if (defined (sun) && defined (SVR4)) || defined (SOLARIS2)
-#  define SUNOS_5
-# endif
-
-# if defined (__osf__) && (defined (__alpha) || defined (__alpha__))
-#  define OSF_ALPHA
-#  include <sys/mbuf.h>
-#  include <sys/socket.h>
-#  include <net/route.h>
-#  include <sys/table.h>
-/* Tru64 4.0D's table.h redefines sys */
-#  undef sys
-# endif
-
-# if defined (__osf__) && (defined (mips) || defined (__mips__))
-#  define OSF_MIPS
-#  include <sys/table.h>
-# endif
-
-/* UTek's /bin/cc on the 4300 has no architecture specific cpp define by
-   default, but _MACH_IND_SYS_TYPES is defined in <sys/types.h>.  Combine
-   that with a couple of other things and we'll have a unique match.  */
-# if !defined (tek4300) && defined (unix) && defined (m68k) && defined (mc68000) && defined (mc68020) && defined (_MACH_IND_SYS_TYPES)
-#  define tek4300                       /* Define by emacs, but not by other users.  */
-# endif
-
-
-/* VAX C can't handle multi-line #ifs, or lines longer than 256 chars.  */
-# ifndef LOAD_AVE_TYPE
-
-#  ifdef MORE_BSD
-#   define LOAD_AVE_TYPE long
-#  endif
-
-#  ifdef sun
-#   define LOAD_AVE_TYPE long
-#  endif
-
-#  ifdef decstation
-#   define LOAD_AVE_TYPE long
-#  endif
-
-#  ifdef _SEQUENT_
-#   define LOAD_AVE_TYPE long
-#  endif
-
-#  ifdef sgi
-#   define LOAD_AVE_TYPE long
-#  endif
-
-#  ifdef SVR4
-#   define LOAD_AVE_TYPE long
-#  endif
-
-#  ifdef sony_news
-#   define LOAD_AVE_TYPE long
-#  endif
-
-#  ifdef sequent
-#   define LOAD_AVE_TYPE long
-#  endif
-
-#  ifdef OSF_ALPHA
-#   define LOAD_AVE_TYPE long
-#  endif
-
-#  if defined (ardent) && defined (titan)
-#   define LOAD_AVE_TYPE long
-#  endif
-
-#  ifdef tek4300
-#   define LOAD_AVE_TYPE long
-#  endif
-
-#  if defined (alliant) && defined (i860) /* Alliant FX/2800 */
-#   define LOAD_AVE_TYPE long
-#  endif
-
-#  if defined _AIX && ! defined HAVE_LIBPERFSTAT
-#   define LOAD_AVE_TYPE long
-#  endif
-
-#  ifdef convex
-#   define LOAD_AVE_TYPE double
-#   ifndef LDAV_CVT
-#    define LDAV_CVT(n) (n)
-#   endif
-#  endif
-
-# endif /* No LOAD_AVE_TYPE.  */
-
-# ifdef OSF_ALPHA
-/* <sys/param.h> defines an incorrect value for FSCALE on Alpha OSF/1,
-   according to ghazi@noc.rutgers.edu.  */
-#  undef FSCALE
-#  define FSCALE 1024.0
-# endif
-
-# if defined (alliant) && defined (i860) /* Alliant FX/2800 */
-/* <sys/param.h> defines an incorrect value for FSCALE on an
-   Alliant FX/2800 Concentrix 2.2, according to ghazi@noc.rutgers.edu.  */
-#  undef FSCALE
-#  define FSCALE 100.0
-# endif
-
-
-# ifndef FSCALE
-
-/* SunOS and some others define FSCALE in sys/param.h.  */
-
-#  ifdef MORE_BSD
-#   define FSCALE 2048.0
-#  endif
-
-#  if defined (MIPS) || defined (SVR4) || defined (decstation)
-#   define FSCALE 256
-#  endif
-
-#  if defined (sgi) || defined (sequent)
-/* Sometimes both MIPS and sgi are defined, so FSCALE was just defined
-   above under #ifdef MIPS.  But we want the sgi value.  */
-#   undef FSCALE
-#   define FSCALE 1000.0
-#  endif
-
-#  if defined (ardent) && defined (titan)
-#   define FSCALE 65536.0
-#  endif
-
-#  ifdef tek4300
-#   define FSCALE 100.0
-#  endif
-
-#  if defined _AIX && !defined HAVE_LIBPERFSTAT
-#   define FSCALE 65536.0
-#  endif
-
-# endif /* Not FSCALE.  */
-
-# if !defined (LDAV_CVT) && defined (FSCALE)
-#  define LDAV_CVT(n) (((double) (n)) / FSCALE)
-# endif
-
-# ifndef NLIST_STRUCT
-#  if HAVE_NLIST_H
-#   define NLIST_STRUCT
-#  endif
-# endif
-
-# if defined (sgi) || (defined (mips) && !defined (BSD))
-#  define FIXUP_KERNEL_SYMBOL_ADDR(nl) ((nl)[0].n_value &= ~(1 << 31))
-# endif
-
-
-# if !defined (KERNEL_FILE) && defined (sequent)
-#  define KERNEL_FILE "/dynix"
-# endif
-
-# if !defined (KERNEL_FILE) && defined (hpux)
-#  define KERNEL_FILE "/hp-ux"
-# endif
-
-# if !defined (KERNEL_FILE) && (defined (_SEQUENT_) || defined (MIPS) || defined (SVR4) || defined (ISC) || defined (sgi) || (defined (ardent) && defined (titan)))
-#  define KERNEL_FILE "/unix"
-# endif
-
-
-# if !defined (LDAV_SYMBOL) && defined (alliant)
-#  define LDAV_SYMBOL "_Loadavg"
-# endif
-
-# if !defined (LDAV_SYMBOL) && ((defined (hpux) && !defined (hp9000s300)) || defined (_SEQUENT_) || defined (SVR4) || defined (ISC) || defined (sgi) || (defined (ardent) && defined (titan)) || (defined (_AIX) && !defined(HAVE_LIBPERFSTAT)))
-#  define LDAV_SYMBOL "avenrun"
-# endif
-
-# include <unistd.h>
-
-/* LOAD_AVE_TYPE should only get defined if we're going to use the
-   nlist method.  */
-# if !defined (LOAD_AVE_TYPE) && (defined (BSD) || defined (LDAV_CVT) || defined (KERNEL_FILE) || defined (LDAV_SYMBOL))
-#  define LOAD_AVE_TYPE double
-# endif
-
-# ifdef LOAD_AVE_TYPE
-
-#  ifndef __VMS
-#   ifndef __linux__
-#    ifndef NLIST_STRUCT
-#     include <a.out.h>
-#    else /* NLIST_STRUCT */
-#     include <nlist.h>
-#    endif /* NLIST_STRUCT */
-
-#    ifdef SUNOS_5
-#     include <kvm.h>
-#     include <kstat.h>
-#    endif
-
-#    if defined (hpux) && defined (HAVE_PSTAT_GETDYNAMIC)
-#     include <sys/pstat.h>
-#    endif
-
-#    ifndef KERNEL_FILE
-#     define KERNEL_FILE "/vmunix"
-#    endif /* KERNEL_FILE */
-
-#    ifndef LDAV_SYMBOL
-#     define LDAV_SYMBOL "_avenrun"
-#    endif /* LDAV_SYMBOL */
-#   endif /* __linux__ */
-
-#  else /* __VMS */
-
-#   ifndef eunice
-#    include <iodef.h>
-#    include <descrip.h>
-#   else /* eunice */
-#    include <vms/iodef.h>
-#   endif /* eunice */
-#  endif /* __VMS */
-
-#  ifndef LDAV_CVT
-#   define LDAV_CVT(n) ((double) (n))
-#  endif /* !LDAV_CVT */
-
-# endif /* LOAD_AVE_TYPE */
-
-# if defined HAVE_LIBPERFSTAT
-#  include <sys/protosw.h>
-#  include <libperfstat.h>
-#  include <sys/proc.h>
-#  ifndef SBITS
-#   define SBITS 16
-#  endif
-# endif
-
-# if defined (__GNU__) && !defined (NeXT)
-/* Note that NeXT Openstep defines __GNU__ even though it should not.  */
-/* GNU system acts much like NeXT, for load average purposes,
-   but not exactly.  */
-#  define NeXT
-#  define host_self mach_host_self
-# endif
-
-# ifdef NeXT
-#  ifdef HAVE_MACH_MACH_H
-#   include <mach/mach.h>
-#  else
-#   include <mach.h>
-#  endif
-# endif /* NeXT */
-
-# ifdef sgi
-#  include <sys/sysmp.h>
-# endif /* sgi */
-
-# ifdef UMAX
-#  include <signal.h>
-#  include <sys/time.h>
-#  include <sys/wait.h>
-#  include <sys/syscall.h>
-
-#  ifdef UMAX_43
-#   include <machine/cpu.h>
-#   include <inq_stats/statistics.h>
-#   include <inq_stats/sysstats.h>
-#   include <inq_stats/cpustats.h>
-#   include <inq_stats/procstats.h>
-#  else /* Not UMAX_43.  */
-#   include <sys/sysdefs.h>
-#   include <sys/statistics.h>
-#   include <sys/sysstats.h>
-#   include <sys/cpudefs.h>
-#   include <sys/cpustats.h>
-#   include <sys/procstats.h>
-#  endif /* Not UMAX_43.  */
-# endif /* UMAX */
-
-# ifdef DGUX
-#  include <sys/dg_sys_info.h>
-# endif
-
-# if (defined __linux__ || defined __CYGWIN__ || defined SUNOS_5        \
-      || (defined LOAD_AVE_TYPE && ! defined __VMS))
-#  include <fcntl.h>
-# endif
-
-/* Avoid static vars inside a function since in HPUX they dump as pure.  */
-
-# ifdef NeXT
-static processor_set_t default_set;
-static bool getloadavg_initialized;
-# endif /* NeXT */
-
-# ifdef UMAX
-static unsigned int cpus = 0;
-static unsigned int samples;
-# endif /* UMAX */
-
-# ifdef DGUX
-static struct dg_sys_info_load_info load_info;  /* what-a-mouthful! */
-# endif /* DGUX */
-
-# if !defined (HAVE_LIBKSTAT) && defined (LOAD_AVE_TYPE)
-/* File descriptor open to /dev/kmem or VMS load ave driver.  */
-static int channel;
-/* True if channel is valid.  */
-static bool getloadavg_initialized;
-/* Offset in kmem to seek to read load average, or 0 means invalid.  */
-static long offset;
-
-#  if ! defined __VMS && ! defined sgi && ! defined __linux__
-static struct nlist name_list[2];
-#  endif
-
-#  ifdef SUNOS_5
-static kvm_t *kd;
-#  endif /* SUNOS_5 */
-
-# endif /* LOAD_AVE_TYPE && !HAVE_LIBKSTAT */
-
-/* Put the 1 minute, 5 minute and 15 minute load averages
-   into the first NELEM elements of LOADAVG.
-   Return the number written (never more than 3, but may be less than NELEM),
-   or -1 (setting errno) if an error occurred.  */
-
-int
-getloadavg (double loadavg[], int nelem)
-{
-  int elem = 0;                 /* Return value.  */
-
-# ifdef NO_GET_LOAD_AVG
-#  define LDAV_DONE
-  errno = ENOSYS;
-  elem = -1;
-# endif
-
-# if !defined (LDAV_DONE) && defined (HAVE_LIBKSTAT)       /* Solaris <= 2.6 */
-/* Use libkstat because we don't have to be root.  */
-#  define LDAV_DONE
-  kstat_ctl_t *kc;
-  kstat_t *ksp;
-  kstat_named_t *kn;
-  int saved_errno;
-
-  kc = kstat_open ();
-  if (kc == 0)
-    return -1;
-  ksp = kstat_lookup (kc, "unix", 0, "system_misc");
-  if (ksp == 0)
-    return -1;
-  if (kstat_read (kc, ksp, 0) == -1)
-    return -1;
-
-
-  kn = kstat_data_lookup (ksp, "avenrun_1min");
-  if (kn == 0)
-    {
-      /* Return -1 if no load average information is available.  */
-      nelem = 0;
-      elem = -1;
-    }
-
-  if (nelem >= 1)
-    loadavg[elem++] = (double) kn->value.ul / FSCALE;
-
-  if (nelem >= 2)
-    {
-      kn = kstat_data_lookup (ksp, "avenrun_5min");
-      if (kn != 0)
-        {
-          loadavg[elem++] = (double) kn->value.ul / FSCALE;
-
-          if (nelem >= 3)
-            {
-              kn = kstat_data_lookup (ksp, "avenrun_15min");
-              if (kn != 0)
-                loadavg[elem++] = (double) kn->value.ul / FSCALE;
-            }
-        }
-    }
-
-  saved_errno = errno;
-  kstat_close (kc);
-  errno = saved_errno;
-# endif /* HAVE_LIBKSTAT */
-
-# if !defined (LDAV_DONE) && defined (hpux) && defined (HAVE_PSTAT_GETDYNAMIC)
-                                                           /* HP-UX */
-/* Use pstat_getdynamic() because we don't have to be root.  */
-#  define LDAV_DONE
-#  undef LOAD_AVE_TYPE
-
-  struct pst_dynamic dyn_info;
-  if (pstat_getdynamic (&dyn_info, sizeof (dyn_info), 0, 0) < 0)
-    return -1;
-  if (nelem > 0)
-    loadavg[elem++] = dyn_info.psd_avg_1_min;
-  if (nelem > 1)
-    loadavg[elem++] = dyn_info.psd_avg_5_min;
-  if (nelem > 2)
-    loadavg[elem++] = dyn_info.psd_avg_15_min;
-
-# endif /* hpux && HAVE_PSTAT_GETDYNAMIC */
-
-# if ! defined LDAV_DONE && defined HAVE_LIBPERFSTAT       /* AIX */
-#  define LDAV_DONE
-#  undef LOAD_AVE_TYPE
-/* Use perfstat_cpu_total because we don't have to be root. */
-  {
-    perfstat_cpu_total_t cpu_stats;
-    int result = perfstat_cpu_total (NULL, &cpu_stats, sizeof cpu_stats, 1);
-    if (result == -1)
-      return result;
-    loadavg[0] = cpu_stats.loadavg[0] / (double)(1 << SBITS);
-    loadavg[1] = cpu_stats.loadavg[1] / (double)(1 << SBITS);
-    loadavg[2] = cpu_stats.loadavg[2] / (double)(1 << SBITS);
-    elem = 3;
-  }
-# endif
-
-# if !defined (LDAV_DONE) && (defined (__linux__) || defined (__CYGWIN__))
-                                              /* Linux without glibc, Cygwin */
-#  define LDAV_DONE
-#  undef LOAD_AVE_TYPE
-
-#  ifndef LINUX_LDAV_FILE
-#   define LINUX_LDAV_FILE "/proc/loadavg"
-#  endif
-
-  char ldavgbuf[3 * (INT_STRLEN_BOUND (int) + sizeof ".00 ")];
-  char const *ptr = ldavgbuf;
-  int fd, count, saved_errno;
-
-  fd = open (LINUX_LDAV_FILE, O_RDONLY);
-  if (fd == -1)
-    return -1;
-  count = read (fd, ldavgbuf, sizeof ldavgbuf - 1);
-  saved_errno = errno;
-  (void) close (fd);
-  errno = saved_errno;
-  if (count <= 0)
-    return -1;
-  ldavgbuf[count] = '\0';
-
-  for (elem = 0; elem < nelem; elem++)
-    {
-      double numerator = 0;
-      double denominator = 1;
-
-      while (*ptr == ' ')
-        ptr++;
-
-      /* Finish if this number is missing, and report an error if all
-         were missing.  */
-      if (! ('0' <= *ptr && *ptr <= '9'))
-        {
-          if (elem == 0)
-            {
-              errno = ENOTSUP;
-              return -1;
-            }
-          break;
-        }
-
-      while ('0' <= *ptr && *ptr <= '9')
-        numerator = 10 * numerator + (*ptr++ - '0');
-
-      if (*ptr == '.')
-        for (ptr++; '0' <= *ptr && *ptr <= '9'; ptr++)
-          numerator = 10 * numerator + (*ptr - '0'), denominator *= 10;
-
-      loadavg[elem++] = numerator / denominator;
-    }
-
-  return elem;
-
-# endif /* __linux__ || __CYGWIN__ */
-
-# if !defined (LDAV_DONE) && defined (__NetBSD__)          /* NetBSD < 0.9 */
-#  define LDAV_DONE
-#  undef LOAD_AVE_TYPE
-
-#  ifndef NETBSD_LDAV_FILE
-#   define NETBSD_LDAV_FILE "/kern/loadavg"
-#  endif
-
-  unsigned long int load_ave[3], scale;
-  int count;
-  FILE *fp;
-
-  fp = fopen (NETBSD_LDAV_FILE, "r");
-  if (fp == NULL)
-    return -1;
-  count = fscanf (fp, "%lu %lu %lu %lu\n",
-                  &load_ave[0], &load_ave[1], &load_ave[2],
-                  &scale);
-  (void) fclose (fp);
-  if (count != 4)
-    {
-      errno = ENOTSUP;
-      return -1;
-    }
-
-  for (elem = 0; elem < nelem; elem++)
-    loadavg[elem] = (double) load_ave[elem] / (double) scale;
-
-  return elem;
-
-# endif /* __NetBSD__ */
-
-# if !defined (LDAV_DONE) && defined (NeXT)                /* NeXTStep */
-#  define LDAV_DONE
-  /* The NeXT code was adapted from iscreen 3.2.  */
-
-  host_t host;
-  struct processor_set_basic_info info;
-  unsigned int info_count;
-
-  /* We only know how to get the 1-minute average for this system,
-     so even if the caller asks for more than 1, we only return 1.  */
-
-  if (!getloadavg_initialized)
-    {
-      if (processor_set_default (host_self (), &default_set) == KERN_SUCCESS)
-        getloadavg_initialized = true;
-    }
-
-  if (getloadavg_initialized)
-    {
-      info_count = PROCESSOR_SET_BASIC_INFO_COUNT;
-      if (processor_set_info (default_set, PROCESSOR_SET_BASIC_INFO, &host,
-                              (processor_set_info_t) &info, &info_count)
-          != KERN_SUCCESS)
-        getloadavg_initialized = false;
-      else
-        {
-          if (nelem > 0)
-            loadavg[elem++] = (double) info.load_average / LOAD_SCALE;
-        }
-    }
-
-  if (!getloadavg_initialized)
-    {
-      errno = ENOTSUP;
-      return -1;
-    }
-# endif /* NeXT */
-
-# if !defined (LDAV_DONE) && defined (UMAX)
-#  define LDAV_DONE
-/* UMAX 4.2, which runs on the Encore Multimax multiprocessor, does not
-   have a /dev/kmem.  Information about the workings of the running kernel
-   can be gathered with inq_stats system calls.
-   We only know how to get the 1-minute average for this system.  */
-
-  struct proc_summary proc_sum_data;
-  struct stat_descr proc_info;
-  double load;
-  register unsigned int i, j;
-
-  if (cpus == 0)
-    {
-      register unsigned int c, i;
-      struct cpu_config conf;
-      struct stat_descr desc;
-
-      desc.sd_next = 0;
-      desc.sd_subsys = SUBSYS_CPU;
-      desc.sd_type = CPUTYPE_CONFIG;
-      desc.sd_addr = (char *) &conf;
-      desc.sd_size = sizeof conf;
-
-      if (inq_stats (1, &desc))
-        return -1;
-
-      c = 0;
-      for (i = 0; i < conf.config_maxclass; ++i)
-        {
-          struct class_stats stats;
-          memset (&stats, 0, sizeof stats);
-
-          desc.sd_type = CPUTYPE_CLASS;
-          desc.sd_objid = i;
-          desc.sd_addr = (char *) &stats;
-          desc.sd_size = sizeof stats;
-
-          if (inq_stats (1, &desc))
-            return -1;
-
-          c += stats.class_numcpus;
-        }
-      cpus = c;
-      samples = cpus < 2 ? 3 : (2 * cpus / 3);
-    }
-
-  proc_info.sd_next = 0;
-  proc_info.sd_subsys = SUBSYS_PROC;
-  proc_info.sd_type = PROCTYPE_SUMMARY;
-  proc_info.sd_addr = (char *) &proc_sum_data;
-  proc_info.sd_size = sizeof (struct proc_summary);
-  proc_info.sd_sizeused = 0;
-
-  if (inq_stats (1, &proc_info) != 0)
-    return -1;
-
-  load = proc_sum_data.ps_nrunnable;
-  j = 0;
-  for (i = samples - 1; i > 0; --i)
-    {
-      load += proc_sum_data.ps_nrun[j];
-      if (j++ == PS_NRUNSIZE)
-        j = 0;
-    }
-
-  if (nelem > 0)
-    loadavg[elem++] = load / samples / cpus;
-# endif /* UMAX */
-
-# if !defined (LDAV_DONE) && defined (DGUX)
-#  define LDAV_DONE
-  /* This call can return -1 for an error, but with good args
-     it's not supposed to fail.  The first argument is for no
-     apparent reason of type 'long int *'.  */
-  dg_sys_info ((long int *) &load_info,
-               DG_SYS_INFO_LOAD_INFO_TYPE,
-               DG_SYS_INFO_LOAD_VERSION_0);
-
-  if (nelem > 0)
-    loadavg[elem++] = load_info.one_minute;
-  if (nelem > 1)
-    loadavg[elem++] = load_info.five_minute;
-  if (nelem > 2)
-    loadavg[elem++] = load_info.fifteen_minute;
-# endif /* DGUX */
-
-# if !defined (LDAV_DONE) && defined (apollo)
-#  define LDAV_DONE
-/* Apollo code from lisch@mentorg.com (Ray Lischner).
-
-   This system call is not documented.  The load average is obtained as
-   three long integers, for the load average over the past minute,
-   five minutes, and fifteen minutes.  Each value is a scaled integer,
-   with 16 bits of integer part and 16 bits of fraction part.
-
-   I'm not sure which operating system first supported this system call,
-   but I know that SR10.2 supports it.  */
-
-  extern void proc1_$get_loadav ();
-  unsigned long load_ave[3];
-
-  proc1_$get_loadav (load_ave);
-
-  if (nelem > 0)
-    loadavg[elem++] = load_ave[0] / 65536.0;
-  if (nelem > 1)
-    loadavg[elem++] = load_ave[1] / 65536.0;
-  if (nelem > 2)
-    loadavg[elem++] = load_ave[2] / 65536.0;
-# endif /* apollo */
-
-# if !defined (LDAV_DONE) && defined (OSF_MIPS)
-#  define LDAV_DONE
-
-  struct tbl_loadavg load_ave;
-  table (TBL_LOADAVG, 0, &load_ave, 1, sizeof (load_ave));
-  loadavg[elem++]
-    = (load_ave.tl_lscale == 0
-       ? load_ave.tl_avenrun.d[0]
-       : (load_ave.tl_avenrun.l[0] / (double) load_ave.tl_lscale));
-# endif /* OSF_MIPS */
-
-# if !defined (LDAV_DONE) && (defined (__MSDOS__) || defined (WINDOWS32))
-                                                           /* DJGPP */
-#  define LDAV_DONE
-
-  /* A faithful emulation is going to have to be saved for a rainy day.  */
-  for ( ; elem < nelem; elem++)
-    {
-      loadavg[elem] = 0.0;
-    }
-# endif  /* __MSDOS__ || WINDOWS32 */
-
-# if !defined (LDAV_DONE) && defined (OSF_ALPHA)           /* OSF/1 */
-#  define LDAV_DONE
-
-  struct tbl_loadavg load_ave;
-  table (TBL_LOADAVG, 0, &load_ave, 1, sizeof (load_ave));
-  for (elem = 0; elem < nelem; elem++)
-    loadavg[elem]
-      = (load_ave.tl_lscale == 0
-         ? load_ave.tl_avenrun.d[elem]
-         : (load_ave.tl_avenrun.l[elem] / (double) load_ave.tl_lscale));
-# endif /* OSF_ALPHA */
-
-# if ! defined LDAV_DONE && defined __VMS                  /* VMS */
-  /* VMS specific code -- read from the Load Ave driver.  */
-
-  LOAD_AVE_TYPE load_ave[3];
-  static bool getloadavg_initialized;
-#  ifdef eunice
-  struct
-  {
-    int dsc$w_length;
-    char *dsc$a_pointer;
-  } descriptor;
-#  endif
-
-  /* Ensure that there is a channel open to the load ave device.  */
-  if (!getloadavg_initialized)
-    {
-      /* Attempt to open the channel.  */
-#  ifdef eunice
-      descriptor.dsc$w_length = 18;
-      descriptor.dsc$a_pointer = "$$VMS_LOAD_AVERAGE";
-#  else
-      $DESCRIPTOR (descriptor, "LAV0:");
-#  endif
-      if (sys$assign (&descriptor, &channel, 0, 0) & 1)
-        getloadavg_initialized = true;
-    }
-
-  /* Read the load average vector.  */
-  if (getloadavg_initialized
-      && !(sys$qiow (0, channel, IO$_READVBLK, 0, 0, 0,
-                     load_ave, 12, 0, 0, 0, 0) & 1))
-    {
-      sys$dassgn (channel);
-      getloadavg_initialized = false;
-    }
-
-  if (!getloadavg_initialized)
-    {
-      errno = ENOTSUP;
-      return -1;
-    }
-# endif /* ! defined LDAV_DONE && defined __VMS */
-
-# if ! defined LDAV_DONE && defined LOAD_AVE_TYPE && ! defined __VMS
-                                                  /* IRIX, other old systems */
-
-  /* UNIX-specific code -- read the average from /dev/kmem.  */
-
-#  define LDAV_PRIVILEGED               /* This code requires special installation.  */
-
-  LOAD_AVE_TYPE load_ave[3];
-
-  /* Get the address of LDAV_SYMBOL.  */
-  if (offset == 0)
-    {
-#  ifndef sgi
-#   if ! defined NLIST_STRUCT || ! defined N_NAME_POINTER
-      strcpy (name_list[0].n_name, LDAV_SYMBOL);
-      strcpy (name_list[1].n_name, "");
-#   else /* NLIST_STRUCT */
-#    ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME
-      name_list[0].n_un.n_name = LDAV_SYMBOL;
-      name_list[1].n_un.n_name = 0;
-#    else /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */
-      name_list[0].n_name = LDAV_SYMBOL;
-      name_list[1].n_name = 0;
-#    endif /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */
-#   endif /* NLIST_STRUCT */
-
-#   ifndef SUNOS_5
-      if (
-#    if !(defined (_AIX) && !defined (ps2))
-          nlist (KERNEL_FILE, name_list)
-#    else  /* _AIX */
-          knlist (name_list, 1, sizeof (name_list[0]))
-#    endif
-          >= 0)
-          /* Omit "&& name_list[0].n_type != 0 " -- it breaks on Sun386i.  */
-          {
-#    ifdef FIXUP_KERNEL_SYMBOL_ADDR
-            FIXUP_KERNEL_SYMBOL_ADDR (name_list);
-#    endif
-            offset = name_list[0].n_value;
-          }
-#   endif /* !SUNOS_5 */
-#  else  /* sgi */
-      ptrdiff_t ldav_off = sysmp (MP_KERNADDR, MPKA_AVENRUN);
-      if (ldav_off != -1)
-        offset = (long int) ldav_off & 0x7fffffff;
-#  endif /* sgi */
-    }
-
-  /* Make sure we have /dev/kmem open.  */
-  if (!getloadavg_initialized)
-    {
-#  ifndef SUNOS_5
-      /* Set the channel to close on exec, so it does not
-         litter any child's descriptor table.  */
-#   ifndef O_CLOEXEC
-#    define O_CLOEXEC 0
-#   endif
-      int fd = open ("/dev/kmem", O_RDONLY | O_CLOEXEC);
-      if (0 <= fd)
-        {
-#   if F_DUPFD_CLOEXEC
-          if (fd <= STDERR_FILENO)
-            {
-              int fd1 = fcntl (fd, F_DUPFD_CLOEXEC, STDERR_FILENO + 1);
-              close (fd);
-              fd = fd1;
-            }
-#   endif
-          if (0 <= fd)
-            {
-              channel = fd;
-              getloadavg_initialized = true;
-            }
-        }
-#  else /* SUNOS_5 */
-      /* We pass 0 for the kernel, corefile, and swapfile names
-         to use the currently running kernel.  */
-      kd = kvm_open (0, 0, 0, O_RDONLY, 0);
-      if (kd != 0)
-        {
-          /* nlist the currently running kernel.  */
-          kvm_nlist (kd, name_list);
-          offset = name_list[0].n_value;
-          getloadavg_initialized = true;
-        }
-#  endif /* SUNOS_5 */
-    }
-
-  /* If we can, get the load average values.  */
-  if (offset && getloadavg_initialized)
-    {
-      /* Try to read the load.  */
-#  ifndef SUNOS_5
-      if (lseek (channel, offset, 0) == -1L
-          || read (channel, (char *) load_ave, sizeof (load_ave))
-          != sizeof (load_ave))
-        {
-          close (channel);
-          getloadavg_initialized = false;
-        }
-#  else  /* SUNOS_5 */
-      if (kvm_read (kd, offset, (char *) load_ave, sizeof (load_ave))
-          != sizeof (load_ave))
-        {
-          kvm_close (kd);
-          getloadavg_initialized = false;
-        }
-#  endif /* SUNOS_5 */
-    }
-
-  if (offset == 0 || !getloadavg_initialized)
-    {
-      errno = ENOTSUP;
-      return -1;
-    }
-# endif /* ! defined LDAV_DONE && defined LOAD_AVE_TYPE && ! defined __VMS */
-
-# if !defined (LDAV_DONE) && defined (LOAD_AVE_TYPE) /* Including VMS.  */
-  if (nelem > 0)
-    loadavg[elem++] = LDAV_CVT (load_ave[0]);
-  if (nelem > 1)
-    loadavg[elem++] = LDAV_CVT (load_ave[1]);
-  if (nelem > 2)
-    loadavg[elem++] = LDAV_CVT (load_ave[2]);
-
-#  define LDAV_DONE
-# endif /* !LDAV_DONE && LOAD_AVE_TYPE */
-
-# if !defined LDAV_DONE
-  errno = ENOSYS;
-  elem = -1;
-# endif
-  return elem;
-}

+ 0 - 1253
gl/getopt.c~

@@ -1,1253 +0,0 @@
-/* Getopt for GNU.
-   NOTE: getopt is part of the C library, so if you don't know what
-   "Keep this file name-space clean" means, talk to drepper@gnu.org
-   before changing it!
-   Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2013 Free Software
-   Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef _LIBC
-# include <config.h>
-#endif
-
-#include "getopt.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#ifdef _LIBC
-# include <libintl.h>
-#else
-# include "gettext.h"
-# define _(msgid) gettext (msgid)
-#endif
-
-#if defined _LIBC && defined USE_IN_LIBIO
-# include <wchar.h>
-#endif
-
-/* This version of 'getopt' appears to the caller like standard Unix 'getopt'
-   but it behaves differently for the user, since it allows the user
-   to intersperse the options with the other arguments.
-
-   As 'getopt_long' works, it permutes the elements of ARGV so that,
-   when it is done, all the options precede everything else.  Thus
-   all application programs are extended to handle flexible argument order.
-
-   Using 'getopt' or setting the environment variable POSIXLY_CORRECT
-   disables permutation.
-   Then the behavior is completely standard.
-
-   GNU application programs can use a third alternative mode in which
-   they can distinguish the relative order of options and other arguments.  */
-
-#include "getopt_int.h"
-
-/* For communication from 'getopt' to the caller.
-   When 'getopt' finds an option that takes an argument,
-   the argument value is returned here.
-   Also, when 'ordering' is RETURN_IN_ORDER,
-   each non-option ARGV-element is returned here.  */
-
-char *optarg;
-
-/* Index in ARGV of the next element to be scanned.
-   This is used for communication to and from the caller
-   and for communication between successive calls to 'getopt'.
-
-   On entry to 'getopt', zero means this is the first call; initialize.
-
-   When 'getopt' returns -1, this is the index of the first of the
-   non-option elements that the caller should itself scan.
-
-   Otherwise, 'optind' communicates from one call to the next
-   how much of ARGV has been scanned so far.  */
-
-/* 1003.2 says this must be 1 before any call.  */
-int optind = 1;
-
-/* Callers store zero here to inhibit the error message
-   for unrecognized options.  */
-
-int opterr = 1;
-
-/* Set to an option character which was unrecognized.
-   This must be initialized on some systems to avoid linking in the
-   system's own getopt implementation.  */
-
-int optopt = '?';
-
-/* Keep a global copy of all internal members of getopt_data.  */
-
-static struct _getopt_data getopt_data;
-
-
-#if defined HAVE_DECL_GETENV && !HAVE_DECL_GETENV
-extern char *getenv ();
-#endif
-
-#ifdef _LIBC
-/* Stored original parameters.
-   XXX This is no good solution.  We should rather copy the args so
-   that we can compare them later.  But we must not use malloc(3).  */
-extern int __libc_argc;
-extern char **__libc_argv;
-
-/* Bash 2.0 gives us an environment variable containing flags
-   indicating ARGV elements that should not be considered arguments.  */
-
-# ifdef USE_NONOPTION_FLAGS
-/* Defined in getopt_init.c  */
-extern char *__getopt_nonoption_flags;
-# endif
-
-# ifdef USE_NONOPTION_FLAGS
-#  define SWAP_FLAGS(ch1, ch2) \
-  if (d->__nonoption_flags_len > 0)                                           \
-    {                                                                         \
-      char __tmp = __getopt_nonoption_flags[ch1];                             \
-      __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2];          \
-      __getopt_nonoption_flags[ch2] = __tmp;                                  \
-    }
-# else
-#  define SWAP_FLAGS(ch1, ch2)
-# endif
-#else   /* !_LIBC */
-# define SWAP_FLAGS(ch1, ch2)
-#endif  /* _LIBC */
-
-/* Exchange two adjacent subsequences of ARGV.
-   One subsequence is elements [first_nonopt,last_nonopt)
-   which contains all the non-options that have been skipped so far.
-   The other is elements [last_nonopt,optind), which contains all
-   the options processed since those non-options were skipped.
-
-   'first_nonopt' and 'last_nonopt' are relocated so that they describe
-   the new indices of the non-options in ARGV after they are moved.  */
-
-static void
-exchange (char **argv, struct _getopt_data *d)
-{
-  int bottom = d->__first_nonopt;
-  int middle = d->__last_nonopt;
-  int top = d->optind;
-  char *tem;
-
-  /* Exchange the shorter segment with the far end of the longer segment.
-     That puts the shorter segment into the right place.
-     It leaves the longer segment in the right place overall,
-     but it consists of two parts that need to be swapped next.  */
-
-#if defined _LIBC && defined USE_NONOPTION_FLAGS
-  /* First make sure the handling of the '__getopt_nonoption_flags'
-     string can work normally.  Our top argument must be in the range
-     of the string.  */
-  if (d->__nonoption_flags_len > 0 && top >= d->__nonoption_flags_max_len)
-    {
-      /* We must extend the array.  The user plays games with us and
-         presents new arguments.  */
-      char *new_str = malloc (top + 1);
-      if (new_str == NULL)
-        d->__nonoption_flags_len = d->__nonoption_flags_max_len = 0;
-      else
-        {
-          memset (__mempcpy (new_str, __getopt_nonoption_flags,
-                             d->__nonoption_flags_max_len),
-                  '\0', top + 1 - d->__nonoption_flags_max_len);
-          d->__nonoption_flags_max_len = top + 1;
-          __getopt_nonoption_flags = new_str;
-        }
-    }
-#endif
-
-  while (top > middle && middle > bottom)
-    {
-      if (top - middle > middle - bottom)
-        {
-          /* Bottom segment is the short one.  */
-          int len = middle - bottom;
-          register int i;
-
-          /* Swap it with the top part of the top segment.  */
-          for (i = 0; i < len; i++)
-            {
-              tem = argv[bottom + i];
-              argv[bottom + i] = argv[top - (middle - bottom) + i];
-              argv[top - (middle - bottom) + i] = tem;
-              SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
-            }
-          /* Exclude the moved bottom segment from further swapping.  */
-          top -= len;
-        }
-      else
-        {
-          /* Top segment is the short one.  */
-          int len = top - middle;
-          register int i;
-
-          /* Swap it with the bottom part of the bottom segment.  */
-          for (i = 0; i < len; i++)
-            {
-              tem = argv[bottom + i];
-              argv[bottom + i] = argv[middle + i];
-              argv[middle + i] = tem;
-              SWAP_FLAGS (bottom + i, middle + i);
-            }
-          /* Exclude the moved top segment from further swapping.  */
-          bottom += len;
-        }
-    }
-
-  /* Update records for the slots the non-options now occupy.  */
-
-  d->__first_nonopt += (d->optind - d->__last_nonopt);
-  d->__last_nonopt = d->optind;
-}
-
-/* Initialize the internal data when the first call is made.  */
-
-static const char *
-_getopt_initialize (int argc _GL_UNUSED,
-                    char **argv _GL_UNUSED, const char *optstring,
-                    struct _getopt_data *d, int posixly_correct)
-{
-  /* Start processing options with ARGV-element 1 (since ARGV-element 0
-     is the program name); the sequence of previously skipped
-     non-option ARGV-elements is empty.  */
-
-  d->__first_nonopt = d->__last_nonopt = d->optind;
-
-  d->__nextchar = NULL;
-
-  d->__posixly_correct = posixly_correct || !!getenv ("POSIXLY_CORRECT");
-
-  /* Determine how to handle the ordering of options and nonoptions.  */
-
-  if (optstring[0] == '-')
-    {
-      d->__ordering = RETURN_IN_ORDER;
-      ++optstring;
-    }
-  else if (optstring[0] == '+')
-    {
-      d->__ordering = REQUIRE_ORDER;
-      ++optstring;
-    }
-  else if (d->__posixly_correct)
-    d->__ordering = REQUIRE_ORDER;
-  else
-    d->__ordering = PERMUTE;
-
-#if defined _LIBC && defined USE_NONOPTION_FLAGS
-  if (!d->__posixly_correct
-      && argc == __libc_argc && argv == __libc_argv)
-    {
-      if (d->__nonoption_flags_max_len == 0)
-        {
-          if (__getopt_nonoption_flags == NULL
-              || __getopt_nonoption_flags[0] == '\0')
-            d->__nonoption_flags_max_len = -1;
-          else
-            {
-              const char *orig_str = __getopt_nonoption_flags;
-              int len = d->__nonoption_flags_max_len = strlen (orig_str);
-              if (d->__nonoption_flags_max_len < argc)
-                d->__nonoption_flags_max_len = argc;
-              __getopt_nonoption_flags =
-                (char *) malloc (d->__nonoption_flags_max_len);
-              if (__getopt_nonoption_flags == NULL)
-                d->__nonoption_flags_max_len = -1;
-              else
-                memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
-                        '\0', d->__nonoption_flags_max_len - len);
-            }
-        }
-      d->__nonoption_flags_len = d->__nonoption_flags_max_len;
-    }
-  else
-    d->__nonoption_flags_len = 0;
-#endif
-
-  return optstring;
-}
-
-/* Scan elements of ARGV (whose length is ARGC) for option characters
-   given in OPTSTRING.
-
-   If an element of ARGV starts with '-', and is not exactly "-" or "--",
-   then it is an option element.  The characters of this element
-   (aside from the initial '-') are option characters.  If 'getopt'
-   is called repeatedly, it returns successively each of the option characters
-   from each of the option elements.
-
-   If 'getopt' finds another option character, it returns that character,
-   updating 'optind' and 'nextchar' so that the next call to 'getopt' can
-   resume the scan with the following option character or ARGV-element.
-
-   If there are no more option characters, 'getopt' returns -1.
-   Then 'optind' is the index in ARGV of the first ARGV-element
-   that is not an option.  (The ARGV-elements have been permuted
-   so that those that are not options now come last.)
-
-   OPTSTRING is a string containing the legitimate option characters.
-   If an option character is seen that is not listed in OPTSTRING,
-   return '?' after printing an error message.  If you set 'opterr' to
-   zero, the error message is suppressed but we still return '?'.
-
-   If a char in OPTSTRING is followed by a colon, that means it wants an arg,
-   so the following text in the same ARGV-element, or the text of the following
-   ARGV-element, is returned in 'optarg'.  Two colons mean an option that
-   wants an optional arg; if there is text in the current ARGV-element,
-   it is returned in 'optarg', otherwise 'optarg' is set to zero.
-
-   If OPTSTRING starts with '-' or '+', it requests different methods of
-   handling the non-option ARGV-elements.
-   See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
-
-   Long-named options begin with '--' instead of '-'.
-   Their names may be abbreviated as long as the abbreviation is unique
-   or is an exact match for some defined option.  If they have an
-   argument, it follows the option name in the same ARGV-element, separated
-   from the option name by a '=', or else the in next ARGV-element.
-   When 'getopt' finds a long-named option, it returns 0 if that option's
-   'flag' field is nonzero, the value of the option's 'val' field
-   if the 'flag' field is zero.
-
-   The elements of ARGV aren't really const, because we permute them.
-   But we pretend they're const in the prototype to be compatible
-   with other systems.
-
-   LONGOPTS is a vector of 'struct option' terminated by an
-   element containing a name which is zero.
-
-   LONGIND returns the index in LONGOPT of the long-named option found.
-   It is only valid when a long-named option has been found by the most
-   recent call.
-
-   If LONG_ONLY is nonzero, '-' as well as '--' can introduce
-   long-named options.  */
-
-int
-_getopt_internal_r (int argc, char **argv, const char *optstring,
-                    const struct option *longopts, int *longind,
-                    int long_only, struct _getopt_data *d, int posixly_correct)
-{
-  int print_errors = d->opterr;
-
-  if (argc < 1)
-    return -1;
-
-  d->optarg = NULL;
-
-  if (d->optind == 0 || !d->__initialized)
-    {
-      if (d->optind == 0)
-        d->optind = 1;  /* Don't scan ARGV[0], the program name.  */
-      optstring = _getopt_initialize (argc, argv, optstring, d,
-                                      posixly_correct);
-      d->__initialized = 1;
-    }
-  else if (optstring[0] == '-' || optstring[0] == '+')
-    optstring++;
-  if (optstring[0] == ':')
-    print_errors = 0;
-
-  /* Test whether ARGV[optind] points to a non-option argument.
-     Either it does not have option syntax, or there is an environment flag
-     from the shell indicating it is not an option.  The later information
-     is only used when the used in the GNU libc.  */
-#if defined _LIBC && defined USE_NONOPTION_FLAGS
-# define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0' \
-                      || (d->optind < d->__nonoption_flags_len                \
-                          && __getopt_nonoption_flags[d->optind] == '1'))
-#else
-# define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0')
-#endif
-
-  if (d->__nextchar == NULL || *d->__nextchar == '\0')
-    {
-      /* Advance to the next ARGV-element.  */
-
-      /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
-         moved back by the user (who may also have changed the arguments).  */
-      if (d->__last_nonopt > d->optind)
-        d->__last_nonopt = d->optind;
-      if (d->__first_nonopt > d->optind)
-        d->__first_nonopt = d->optind;
-
-      if (d->__ordering == PERMUTE)
-        {
-          /* If we have just processed some options following some non-options,
-             exchange them so that the options come first.  */
-
-          if (d->__first_nonopt != d->__last_nonopt
-              && d->__last_nonopt != d->optind)
-            exchange ((char **) argv, d);
-          else if (d->__last_nonopt != d->optind)
-            d->__first_nonopt = d->optind;
-
-          /* Skip any additional non-options
-             and extend the range of non-options previously skipped.  */
-
-          while (d->optind < argc && NONOPTION_P)
-            d->optind++;
-          d->__last_nonopt = d->optind;
-        }
-
-      /* The special ARGV-element '--' means premature end of options.
-         Skip it like a null option,
-         then exchange with previous non-options as if it were an option,
-         then skip everything else like a non-option.  */
-
-      if (d->optind != argc && !strcmp (argv[d->optind], "--"))
-        {
-          d->optind++;
-
-          if (d->__first_nonopt != d->__last_nonopt
-              && d->__last_nonopt != d->optind)
-            exchange ((char **) argv, d);
-          else if (d->__first_nonopt == d->__last_nonopt)
-            d->__first_nonopt = d->optind;
-          d->__last_nonopt = argc;
-
-          d->optind = argc;
-        }
-
-      /* If we have done all the ARGV-elements, stop the scan
-         and back over any non-options that we skipped and permuted.  */
-
-      if (d->optind == argc)
-        {
-          /* Set the next-arg-index to point at the non-options
-             that we previously skipped, so the caller will digest them.  */
-          if (d->__first_nonopt != d->__last_nonopt)
-            d->optind = d->__first_nonopt;
-          return -1;
-        }
-
-      /* If we have come to a non-option and did not permute it,
-         either stop the scan or describe it to the caller and pass it by.  */
-
-      if (NONOPTION_P)
-        {
-          if (d->__ordering == REQUIRE_ORDER)
-            return -1;
-          d->optarg = argv[d->optind++];
-          return 1;
-        }
-
-      /* We have found another option-ARGV-element.
-         Skip the initial punctuation.  */
-
-      d->__nextchar = (argv[d->optind] + 1
-                  + (longopts != NULL && argv[d->optind][1] == '-'));
-    }
-
-  /* Decode the current option-ARGV-element.  */
-
-  /* Check whether the ARGV-element is a long option.
-
-     If long_only and the ARGV-element has the form "-f", where f is
-     a valid short option, don't consider it an abbreviated form of
-     a long option that starts with f.  Otherwise there would be no
-     way to give the -f short option.
-
-     On the other hand, if there's a long option "fubar" and
-     the ARGV-element is "-fu", do consider that an abbreviation of
-     the long option, just like "--fu", and not "-f" with arg "u".
-
-     This distinction seems to be the most useful approach.  */
-
-  if (longopts != NULL
-      && (argv[d->optind][1] == '-'
-          || (long_only && (argv[d->optind][2]
-                            || !strchr (optstring, argv[d->optind][1])))))
-    {
-      char *nameend;
-      unsigned int namelen;
-      const struct option *p;
-      const struct option *pfound = NULL;
-      struct option_list
-      {
-        const struct option *p;
-        struct option_list *next;
-      } *ambig_list = NULL;
-      int exact = 0;
-      int indfound = -1;
-      int option_index;
-
-      for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++)
-        /* Do nothing.  */ ;
-      namelen = nameend - d->__nextchar;
-
-      /* Test all long options for either exact match
-         or abbreviated matches.  */
-      for (p = longopts, option_index = 0; p->name; p++, option_index++)
-        if (!strncmp (p->name, d->__nextchar, namelen))
-          {
-            if (namelen == (unsigned int) strlen (p->name))
-              {
-                /* Exact match found.  */
-                pfound = p;
-                indfound = option_index;
-                exact = 1;
-                break;
-              }
-            else if (pfound == NULL)
-              {
-                /* First nonexact match found.  */
-                pfound = p;
-                indfound = option_index;
-              }
-            else if (long_only
-                     || pfound->has_arg != p->has_arg
-                     || pfound->flag != p->flag
-                     || pfound->val != p->val)
-              {
-                /* Second or later nonexact match found.  */
-                struct option_list *newp = malloc (sizeof (*newp));
-                newp->p = p;
-                newp->next = ambig_list;
-                ambig_list = newp;
-              }
-          }
-
-      if (ambig_list != NULL && !exact)
-        {
-          if (print_errors)
-            {
-              struct option_list first;
-              first.p = pfound;
-              first.next = ambig_list;
-              ambig_list = &first;
-
-#if defined _LIBC && defined USE_IN_LIBIO
-              char *buf = NULL;
-              size_t buflen = 0;
-
-              FILE *fp = open_memstream (&buf, &buflen);
-              if (fp != NULL)
-                {
-                  fprintf (fp,
-                           _("%s: option '%s' is ambiguous; possibilities:"),
-                           argv[0], argv[d->optind]);
-
-                  do
-                    {
-                      fprintf (fp, " '--%s'", ambig_list->p->name);
-                      ambig_list = ambig_list->next;
-                    }
-                  while (ambig_list != NULL);
-
-                  fputc_unlocked ('\n', fp);
-
-                  if (__builtin_expect (fclose (fp) != EOF, 1))
-                    {
-                      _IO_flockfile (stderr);
-
-                      int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
-                      ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
-
-                      __fxprintf (NULL, "%s", buf);
-
-                      ((_IO_FILE *) stderr)->_flags2 = old_flags2;
-                      _IO_funlockfile (stderr);
-
-                      free (buf);
-                    }
-                }
-#else
-              fprintf (stderr,
-                       _("%s: option '%s' is ambiguous; possibilities:"),
-                       argv[0], argv[d->optind]);
-              do
-                {
-                  fprintf (stderr, " '--%s'", ambig_list->p->name);
-                  ambig_list = ambig_list->next;
-                }
-              while (ambig_list != NULL);
-
-              fputc ('\n', stderr);
-#endif
-            }
-          d->__nextchar += strlen (d->__nextchar);
-          d->optind++;
-          d->optopt = 0;
-
-          while (ambig_list != NULL)
-            {
-              struct option_list *pn = ambig_list->next;
-              free (ambig_list);
-              ambig_list = pn;
-            }
-
-          return '?';
-        }
-
-      while (ambig_list != NULL)
-        {
-          struct option_list *pn = ambig_list->next;
-          free (ambig_list);
-          ambig_list = pn;
-        }
-
-      if (pfound != NULL)
-        {
-          option_index = indfound;
-          d->optind++;
-          if (*nameend)
-            {
-              /* Don't test has_arg with >, because some C compilers don't
-                 allow it to be used on enums.  */
-              if (pfound->has_arg)
-                d->optarg = nameend + 1;
-              else
-                {
-                  if (print_errors)
-                    {
-#if defined _LIBC && defined USE_IN_LIBIO
-                      char *buf;
-                      int n;
-#endif
-
-                      if (argv[d->optind - 1][1] == '-')
-                        {
-                          /* --option */
-#if defined _LIBC && defined USE_IN_LIBIO
-                          n = __asprintf (&buf, _("\
-%s: option '--%s' doesn't allow an argument\n"),
-                                          argv[0], pfound->name);
-#else
-                          fprintf (stderr, _("\
-%s: option '--%s' doesn't allow an argument\n"),
-                                   argv[0], pfound->name);
-#endif
-                        }
-                      else
-                        {
-                          /* +option or -option */
-#if defined _LIBC && defined USE_IN_LIBIO
-                          n = __asprintf (&buf, _("\
-%s: option '%c%s' doesn't allow an argument\n"),
-                                          argv[0], argv[d->optind - 1][0],
-                                          pfound->name);
-#else
-                          fprintf (stderr, _("\
-%s: option '%c%s' doesn't allow an argument\n"),
-                                   argv[0], argv[d->optind - 1][0],
-                                   pfound->name);
-#endif
-                        }
-
-#if defined _LIBC && defined USE_IN_LIBIO
-                      if (n >= 0)
-                        {
-                          _IO_flockfile (stderr);
-
-                          int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
-                          ((_IO_FILE *) stderr)->_flags2
-                            |= _IO_FLAGS2_NOTCANCEL;
-
-                          __fxprintf (NULL, "%s", buf);
-
-                          ((_IO_FILE *) stderr)->_flags2 = old_flags2;
-                          _IO_funlockfile (stderr);
-
-                          free (buf);
-                        }
-#endif
-                    }
-
-                  d->__nextchar += strlen (d->__nextchar);
-
-                  d->optopt = pfound->val;
-                  return '?';
-                }
-            }
-          else if (pfound->has_arg == 1)
-            {
-              if (d->optind < argc)
-                d->optarg = argv[d->optind++];
-              else
-                {
-                  if (print_errors)
-                    {
-#if defined _LIBC && defined USE_IN_LIBIO
-                      char *buf;
-
-                      if (__asprintf (&buf, _("\
-%s: option '--%s' requires an argument\n"),
-                                      argv[0], pfound->name) >= 0)
-                        {
-                          _IO_flockfile (stderr);
-
-                          int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
-                          ((_IO_FILE *) stderr)->_flags2
-                            |= _IO_FLAGS2_NOTCANCEL;
-
-                          __fxprintf (NULL, "%s", buf);
-
-                          ((_IO_FILE *) stderr)->_flags2 = old_flags2;
-                          _IO_funlockfile (stderr);
-
-                          free (buf);
-                        }
-#else
-                      fprintf (stderr,
-                               _("%s: option '--%s' requires an argument\n"),
-                               argv[0], pfound->name);
-#endif
-                    }
-                  d->__nextchar += strlen (d->__nextchar);
-                  d->optopt = pfound->val;
-                  return optstring[0] == ':' ? ':' : '?';
-                }
-            }
-          d->__nextchar += strlen (d->__nextchar);
-          if (longind != NULL)
-            *longind = option_index;
-          if (pfound->flag)
-            {
-              *(pfound->flag) = pfound->val;
-              return 0;
-            }
-          return pfound->val;
-        }
-
-      /* Can't find it as a long option.  If this is not getopt_long_only,
-         or the option starts with '--' or is not a valid short
-         option, then it's an error.
-         Otherwise interpret it as a short option.  */
-      if (!long_only || argv[d->optind][1] == '-'
-          || strchr (optstring, *d->__nextchar) == NULL)
-        {
-          if (print_errors)
-            {
-#if defined _LIBC && defined USE_IN_LIBIO
-              char *buf;
-              int n;
-#endif
-
-              if (argv[d->optind][1] == '-')
-                {
-                  /* --option */
-#if defined _LIBC && defined USE_IN_LIBIO
-                  n = __asprintf (&buf, _("%s: unrecognized option '--%s'\n"),
-                                  argv[0], d->__nextchar);
-#else
-                  fprintf (stderr, _("%s: unrecognized option '--%s'\n"),
-                           argv[0], d->__nextchar);
-#endif
-                }
-              else
-                {
-                  /* +option or -option */
-#if defined _LIBC && defined USE_IN_LIBIO
-                  n = __asprintf (&buf, _("%s: unrecognized option '%c%s'\n"),
-                                  argv[0], argv[d->optind][0], d->__nextchar);
-#else
-                  fprintf (stderr, _("%s: unrecognized option '%c%s'\n"),
-                           argv[0], argv[d->optind][0], d->__nextchar);
-#endif
-                }
-
-#if defined _LIBC && defined USE_IN_LIBIO
-              if (n >= 0)
-                {
-                  _IO_flockfile (stderr);
-
-                  int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
-                  ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
-
-                  __fxprintf (NULL, "%s", buf);
-
-                  ((_IO_FILE *) stderr)->_flags2 = old_flags2;
-                  _IO_funlockfile (stderr);
-
-                  free (buf);
-                }
-#endif
-            }
-          d->__nextchar = (char *) "";
-          d->optind++;
-          d->optopt = 0;
-          return '?';
-        }
-    }
-
-  /* Look at and handle the next short option-character.  */
-
-  {
-    char c = *d->__nextchar++;
-    const char *temp = strchr (optstring, c);
-
-    /* Increment 'optind' when we start to process its last character.  */
-    if (*d->__nextchar == '\0')
-      ++d->optind;
-
-    if (temp == NULL || c == ':' || c == ';')
-      {
-        if (print_errors)
-          {
-#if defined _LIBC && defined USE_IN_LIBIO
-              char *buf;
-              int n;
-#endif
-
-#if defined _LIBC && defined USE_IN_LIBIO
-              n = __asprintf (&buf, _("%s: invalid option -- '%c'\n"),
-                              argv[0], c);
-#else
-              fprintf (stderr, _("%s: invalid option -- '%c'\n"), argv[0], c);
-#endif
-
-#if defined _LIBC && defined USE_IN_LIBIO
-            if (n >= 0)
-              {
-                _IO_flockfile (stderr);
-
-                int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
-                ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
-
-                __fxprintf (NULL, "%s", buf);
-
-                ((_IO_FILE *) stderr)->_flags2 = old_flags2;
-                _IO_funlockfile (stderr);
-
-                free (buf);
-              }
-#endif
-          }
-        d->optopt = c;
-        return '?';
-      }
-    /* Convenience. Treat POSIX -W foo same as long option --foo */
-    if (temp[0] == 'W' && temp[1] == ';')
-      {
-        char *nameend;
-        const struct option *p;
-        const struct option *pfound = NULL;
-        int exact = 0;
-        int ambig = 0;
-        int indfound = 0;
-        int option_index;
-
-        if (longopts == NULL)
-          goto no_longs;
-
-        /* This is an option that requires an argument.  */
-        if (*d->__nextchar != '\0')
-          {
-            d->optarg = d->__nextchar;
-            /* If we end this ARGV-element by taking the rest as an arg,
-               we must advance to the next element now.  */
-            d->optind++;
-          }
-        else if (d->optind == argc)
-          {
-            if (print_errors)
-              {
-#if defined _LIBC && defined USE_IN_LIBIO
-                char *buf;
-
-                if (__asprintf (&buf,
-                                _("%s: option requires an argument -- '%c'\n"),
-                                argv[0], c) >= 0)
-                  {
-                    _IO_flockfile (stderr);
-
-                    int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
-                    ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
-
-                    __fxprintf (NULL, "%s", buf);
-
-                    ((_IO_FILE *) stderr)->_flags2 = old_flags2;
-                    _IO_funlockfile (stderr);
-
-                    free (buf);
-                  }
-#else
-                fprintf (stderr,
-                         _("%s: option requires an argument -- '%c'\n"),
-                         argv[0], c);
-#endif
-              }
-            d->optopt = c;
-            if (optstring[0] == ':')
-              c = ':';
-            else
-              c = '?';
-            return c;
-          }
-        else
-          /* We already incremented 'd->optind' once;
-             increment it again when taking next ARGV-elt as argument.  */
-          d->optarg = argv[d->optind++];
-
-        /* optarg is now the argument, see if it's in the
-           table of longopts.  */
-
-        for (d->__nextchar = nameend = d->optarg; *nameend && *nameend != '=';
-             nameend++)
-          /* Do nothing.  */ ;
-
-        /* Test all long options for either exact match
-           or abbreviated matches.  */
-        for (p = longopts, option_index = 0; p->name; p++, option_index++)
-          if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar))
-            {
-              if ((unsigned int) (nameend - d->__nextchar) == strlen (p->name))
-                {
-                  /* Exact match found.  */
-                  pfound = p;
-                  indfound = option_index;
-                  exact = 1;
-                  break;
-                }
-              else if (pfound == NULL)
-                {
-                  /* First nonexact match found.  */
-                  pfound = p;
-                  indfound = option_index;
-                }
-              else if (long_only
-                       || pfound->has_arg != p->has_arg
-                       || pfound->flag != p->flag
-                       || pfound->val != p->val)
-                /* Second or later nonexact match found.  */
-                ambig = 1;
-            }
-        if (ambig && !exact)
-          {
-            if (print_errors)
-              {
-#if defined _LIBC && defined USE_IN_LIBIO
-                char *buf;
-
-                if (__asprintf (&buf, _("%s: option '-W %s' is ambiguous\n"),
-                                argv[0], d->optarg) >= 0)
-                  {
-                    _IO_flockfile (stderr);
-
-                    int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
-                    ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
-
-                    __fxprintf (NULL, "%s", buf);
-
-                    ((_IO_FILE *) stderr)->_flags2 = old_flags2;
-                    _IO_funlockfile (stderr);
-
-                    free (buf);
-                  }
-#else
-                fprintf (stderr, _("%s: option '-W %s' is ambiguous\n"),
-                         argv[0], d->optarg);
-#endif
-              }
-            d->__nextchar += strlen (d->__nextchar);
-            d->optind++;
-            return '?';
-          }
-        if (pfound != NULL)
-          {
-            option_index = indfound;
-            if (*nameend)
-              {
-                /* Don't test has_arg with >, because some C compilers don't
-                   allow it to be used on enums.  */
-                if (pfound->has_arg)
-                  d->optarg = nameend + 1;
-                else
-                  {
-                    if (print_errors)
-                      {
-#if defined _LIBC && defined USE_IN_LIBIO
-                        char *buf;
-
-                        if (__asprintf (&buf, _("\
-%s: option '-W %s' doesn't allow an argument\n"),
-                                        argv[0], pfound->name) >= 0)
-                          {
-                            _IO_flockfile (stderr);
-
-                            int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
-                            ((_IO_FILE *) stderr)->_flags2
-                              |= _IO_FLAGS2_NOTCANCEL;
-
-                            __fxprintf (NULL, "%s", buf);
-
-                            ((_IO_FILE *) stderr)->_flags2 = old_flags2;
-                            _IO_funlockfile (stderr);
-
-                            free (buf);
-                          }
-#else
-                        fprintf (stderr, _("\
-%s: option '-W %s' doesn't allow an argument\n"),
-                                 argv[0], pfound->name);
-#endif
-                      }
-
-                    d->__nextchar += strlen (d->__nextchar);
-                    return '?';
-                  }
-              }
-            else if (pfound->has_arg == 1)
-              {
-                if (d->optind < argc)
-                  d->optarg = argv[d->optind++];
-                else
-                  {
-                    if (print_errors)
-                      {
-#if defined _LIBC && defined USE_IN_LIBIO
-                        char *buf;
-
-                        if (__asprintf (&buf, _("\
-%s: option '-W %s' requires an argument\n"),
-                                        argv[0], pfound->name) >= 0)
-                          {
-                            _IO_flockfile (stderr);
-
-                            int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
-                            ((_IO_FILE *) stderr)->_flags2
-                              |= _IO_FLAGS2_NOTCANCEL;
-
-                            __fxprintf (NULL, "%s", buf);
-
-                            ((_IO_FILE *) stderr)->_flags2 = old_flags2;
-                            _IO_funlockfile (stderr);
-
-                            free (buf);
-                          }
-#else
-                        fprintf (stderr, _("\
-%s: option '-W %s' requires an argument\n"),
-                                 argv[0], pfound->name);
-#endif
-                      }
-                    d->__nextchar += strlen (d->__nextchar);
-                    return optstring[0] == ':' ? ':' : '?';
-                  }
-              }
-            else
-              d->optarg = NULL;
-            d->__nextchar += strlen (d->__nextchar);
-            if (longind != NULL)
-              *longind = option_index;
-            if (pfound->flag)
-              {
-                *(pfound->flag) = pfound->val;
-                return 0;
-              }
-            return pfound->val;
-          }
-
-      no_longs:
-        d->__nextchar = NULL;
-        return 'W';   /* Let the application handle it.   */
-      }
-    if (temp[1] == ':')
-      {
-        if (temp[2] == ':')
-          {
-            /* This is an option that accepts an argument optionally.  */
-            if (*d->__nextchar != '\0')
-              {
-                d->optarg = d->__nextchar;
-                d->optind++;
-              }
-            else
-              d->optarg = NULL;
-            d->__nextchar = NULL;
-          }
-        else
-          {
-            /* This is an option that requires an argument.  */
-            if (*d->__nextchar != '\0')
-              {
-                d->optarg = d->__nextchar;
-                /* If we end this ARGV-element by taking the rest as an arg,
-                   we must advance to the next element now.  */
-                d->optind++;
-              }
-            else if (d->optind == argc)
-              {
-                if (print_errors)
-                  {
-#if defined _LIBC && defined USE_IN_LIBIO
-                    char *buf;
-
-                    if (__asprintf (&buf, _("\
-%s: option requires an argument -- '%c'\n"),
-                                    argv[0], c) >= 0)
-                      {
-                        _IO_flockfile (stderr);
-
-                        int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
-                        ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
-
-                        __fxprintf (NULL, "%s", buf);
-
-                        ((_IO_FILE *) stderr)->_flags2 = old_flags2;
-                        _IO_funlockfile (stderr);
-
-                        free (buf);
-                      }
-#else
-                    fprintf (stderr,
-                             _("%s: option requires an argument -- '%c'\n"),
-                             argv[0], c);
-#endif
-                  }
-                d->optopt = c;
-                if (optstring[0] == ':')
-                  c = ':';
-                else
-                  c = '?';
-              }
-            else
-              /* We already incremented 'optind' once;
-                 increment it again when taking next ARGV-elt as argument.  */
-              d->optarg = argv[d->optind++];
-            d->__nextchar = NULL;
-          }
-      }
-    return c;
-  }
-}
-
-int
-_getopt_internal (int argc, char **argv, const char *optstring,
-                  const struct option *longopts, int *longind, int long_only,
-                  int posixly_correct)
-{
-  int result;
-
-  getopt_data.optind = optind;
-  getopt_data.opterr = opterr;
-
-  result = _getopt_internal_r (argc, argv, optstring, longopts,
-                               longind, long_only, &getopt_data,
-                               posixly_correct);
-
-  optind = getopt_data.optind;
-  optarg = getopt_data.optarg;
-  optopt = getopt_data.optopt;
-
-  return result;
-}
-
-/* glibc gets a LSB-compliant getopt.
-   Standalone applications get a POSIX-compliant getopt.  */
-#if _LIBC
-enum { POSIXLY_CORRECT = 0 };
-#else
-enum { POSIXLY_CORRECT = 1 };
-#endif
-
-int
-getopt (int argc, char *const *argv, const char *optstring)
-{
-  return _getopt_internal (argc, (char **) argv, optstring,
-                           (const struct option *) 0,
-                           (int *) 0,
-                           0, POSIXLY_CORRECT);
-}
-
-#ifdef _LIBC
-int
-__posix_getopt (int argc, char *const *argv, const char *optstring)
-{
-  return _getopt_internal (argc, argv, optstring,
-                           (const struct option *) 0,
-                           (int *) 0,
-                           0, 1);
-}
-#endif
-
-
-#ifdef TEST
-
-/* Compile with -DTEST to make an executable for use in testing
-   the above definition of 'getopt'.  */
-
-int
-main (int argc, char **argv)
-{
-  int c;
-  int digit_optind = 0;
-
-  while (1)
-    {
-      int this_option_optind = optind ? optind : 1;
-
-      c = getopt (argc, argv, "abc:d:0123456789");
-      if (c == -1)
-        break;
-
-      switch (c)
-        {
-        case '0':
-        case '1':
-        case '2':
-        case '3':
-        case '4':
-        case '5':
-        case '6':
-        case '7':
-        case '8':
-        case '9':
-          if (digit_optind != 0 && digit_optind != this_option_optind)
-            printf ("digits occur in two different argv-elements.\n");
-          digit_optind = this_option_optind;
-          printf ("option %c\n", c);
-          break;
-
-        case 'a':
-          printf ("option a\n");
-          break;
-
-        case 'b':
-          printf ("option b\n");
-          break;
-
-        case 'c':
-          printf ("option c with value '%s'\n", optarg);
-          break;
-
-        case '?':
-          break;
-
-        default:
-          printf ("?? getopt returned character code 0%o ??\n", c);
-        }
-    }
-
-  if (optind < argc)
-    {
-      printf ("non-option ARGV-elements: ");
-      while (optind < argc)
-        printf ("%s ", argv[optind++]);
-      printf ("\n");
-    }
-
-  exit (0);
-}
-
-#endif /* TEST */

+ 0 - 255
gl/getopt.in.h~

@@ -1,255 +0,0 @@
-/* Declarations for getopt.
-   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2013 Free Software
-   Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef _@GUARD_PREFIX@_GETOPT_H
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-/* The include_next requires a split double-inclusion guard.  We must
-   also inform the replacement unistd.h to not recursively use
-   <getopt.h>; our definitions will be present soon enough.  */
-#if @HAVE_GETOPT_H@
-# define _GL_SYSTEM_GETOPT
-# @INCLUDE_NEXT@ @NEXT_GETOPT_H@
-# undef _GL_SYSTEM_GETOPT
-#endif
-
-#ifndef _@GUARD_PREFIX@_GETOPT_H
-
-#ifndef __need_getopt
-# define _@GUARD_PREFIX@_GETOPT_H 1
-#endif
-
-/* Standalone applications should #define __GETOPT_PREFIX to an
-   identifier that prefixes the external functions and variables
-   defined in this header.  When this happens, include the
-   headers that might declare getopt so that they will not cause
-   confusion if included after this file (if the system had <getopt.h>,
-   we have already included it).  Then systematically rename
-   identifiers so that they do not collide with the system functions
-   and variables.  Renaming avoids problems with some compilers and
-   linkers.  */
-#if defined __GETOPT_PREFIX && !defined __need_getopt
-# if !@HAVE_GETOPT_H@
-#  define __need_system_stdlib_h
-#  include <stdlib.h>
-#  undef __need_system_stdlib_h
-#  include <stdio.h>
-#  include <unistd.h>
-# endif
-# undef __need_getopt
-# undef getopt
-# undef getopt_long
-# undef getopt_long_only
-# undef optarg
-# undef opterr
-# undef optind
-# undef optopt
-# undef option
-# define __GETOPT_CONCAT(x, y) x ## y
-# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
-# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
-# define getopt __GETOPT_ID (getopt)
-# define getopt_long __GETOPT_ID (getopt_long)
-# define getopt_long_only __GETOPT_ID (getopt_long_only)
-# define optarg __GETOPT_ID (optarg)
-# define opterr __GETOPT_ID (opterr)
-# define optind __GETOPT_ID (optind)
-# define optopt __GETOPT_ID (optopt)
-# define option __GETOPT_ID (option)
-# define _getopt_internal __GETOPT_ID (getopt_internal)
-#endif
-
-/* Standalone applications get correct prototypes for getopt_long and
-   getopt_long_only; they declare "char **argv".  libc uses prototypes
-   with "char *const *argv" that are incorrect because getopt_long and
-   getopt_long_only can permute argv; this is required for backward
-   compatibility (e.g., for LSB 2.0.1).
-
-   This used to be '#if defined __GETOPT_PREFIX && !defined __need_getopt',
-   but it caused redefinition warnings if both unistd.h and getopt.h were
-   included, since unistd.h includes getopt.h having previously defined
-   __need_getopt.
-
-   The only place where __getopt_argv_const is used is in definitions
-   of getopt_long and getopt_long_only below, but these are visible
-   only if __need_getopt is not defined, so it is quite safe to rewrite
-   the conditional as follows:
-*/
-#if !defined __need_getopt
-# if defined __GETOPT_PREFIX
-#  define __getopt_argv_const /* empty */
-# else
-#  define __getopt_argv_const const
-# endif
-#endif
-
-/* If __GNU_LIBRARY__ is not already defined, either we are being used
-   standalone, or this is the first header included in the source file.
-   If we are being used with glibc, we need to include <features.h>, but
-   that does not exist if we are standalone.  So: if __GNU_LIBRARY__ is
-   not defined, include <ctype.h>, which will pull in <features.h> for us
-   if it's from glibc.  (Why ctype.h?  It's guaranteed to exist and it
-   doesn't flood the namespace with stuff the way some other headers do.)  */
-#if !defined __GNU_LIBRARY__
-# include <ctype.h>
-#endif
-
-#ifndef __THROW
-# ifndef __GNUC_PREREQ
-#  define __GNUC_PREREQ(maj, min) (0)
-# endif
-# if defined __cplusplus && __GNUC_PREREQ (2,8)
-#  define __THROW       throw ()
-# else
-#  define __THROW
-# endif
-#endif
-
-/* The definition of _GL_ARG_NONNULL is copied here.  */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* For communication from 'getopt' to the caller.
-   When 'getopt' finds an option that takes an argument,
-   the argument value is returned here.
-   Also, when 'ordering' is RETURN_IN_ORDER,
-   each non-option ARGV-element is returned here.  */
-
-extern char *optarg;
-
-/* Index in ARGV of the next element to be scanned.
-   This is used for communication to and from the caller
-   and for communication between successive calls to 'getopt'.
-
-   On entry to 'getopt', zero means this is the first call; initialize.
-
-   When 'getopt' returns -1, this is the index of the first of the
-   non-option elements that the caller should itself scan.
-
-   Otherwise, 'optind' communicates from one call to the next
-   how much of ARGV has been scanned so far.  */
-
-extern int optind;
-
-/* Callers store zero here to inhibit the error message 'getopt' prints
-   for unrecognized options.  */
-
-extern int opterr;
-
-/* Set to an option character which was unrecognized.  */
-
-extern int optopt;
-
-#ifndef __need_getopt
-/* Describe the long-named options requested by the application.
-   The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
-   of 'struct option' terminated by an element containing a name which is
-   zero.
-
-   The field 'has_arg' is:
-   no_argument          (or 0) if the option does not take an argument,
-   required_argument    (or 1) if the option requires an argument,
-   optional_argument    (or 2) if the option takes an optional argument.
-
-   If the field 'flag' is not NULL, it points to a variable that is set
-   to the value given in the field 'val' when the option is found, but
-   left unchanged if the option is not found.
-
-   To have a long-named option do something other than set an 'int' to
-   a compiled-in constant, such as set a value from 'optarg', set the
-   option's 'flag' field to zero and its 'val' field to a nonzero
-   value (the equivalent single-letter option character, if there is
-   one).  For long options that have a zero 'flag' field, 'getopt'
-   returns the contents of the 'val' field.  */
-
-# if !GNULIB_defined_struct_option
-struct option
-{
-  const char *name;
-  /* has_arg can't be an enum because some compilers complain about
-     type mismatches in all the code that assumes it is an int.  */
-  int has_arg;
-  int *flag;
-  int val;
-};
-#  define GNULIB_defined_struct_option 1
-# endif
-
-/* Names for the values of the 'has_arg' field of 'struct option'.  */
-
-# define no_argument            0
-# define required_argument      1
-# define optional_argument      2
-#endif  /* need getopt */
-
-
-/* Get definitions and prototypes for functions to process the
-   arguments in ARGV (ARGC of them, minus the program name) for
-   options given in OPTS.
-
-   Return the option character from OPTS just read.  Return -1 when
-   there are no more options.  For unrecognized options, or options
-   missing arguments, 'optopt' is set to the option letter, and '?' is
-   returned.
-
-   The OPTS string is a list of characters which are recognized option
-   letters, optionally followed by colons, specifying that that letter
-   takes an argument, to be placed in 'optarg'.
-
-   If a letter in OPTS is followed by two colons, its argument is
-   optional.  This behavior is specific to the GNU 'getopt'.
-
-   The argument '--' causes premature termination of argument
-   scanning, explicitly telling 'getopt' that there are no more
-   options.
-
-   If OPTS begins with '-', then non-option arguments are treated as
-   arguments to the option '\1'.  This behavior is specific to the GNU
-   'getopt'.  If OPTS begins with '+', or POSIXLY_CORRECT is set in
-   the environment, then do not permute arguments.  */
-
-extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
-       __THROW _GL_ARG_NONNULL ((2, 3));
-
-#ifndef __need_getopt
-extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
-                        const char *__shortopts,
-                        const struct option *__longopts, int *__longind)
-       __THROW _GL_ARG_NONNULL ((2, 3));
-extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
-                             const char *__shortopts,
-                             const struct option *__longopts, int *__longind)
-       __THROW _GL_ARG_NONNULL ((2, 3));
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-/* Make sure we later can get all the definitions and declarations.  */
-#undef __need_getopt
-
-#endif /* _@GUARD_PREFIX@_GETOPT_H */
-#endif /* _@GUARD_PREFIX@_GETOPT_H */

+ 0 - 170
gl/getopt1.c~

@@ -1,170 +0,0 @@
-/* getopt_long and getopt_long_only entry points for GNU getopt.
-   Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2013 Free Software
-   Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#ifdef _LIBC
-# include <getopt.h>
-#else
-# include <config.h>
-# include "getopt.h"
-#endif
-#include "getopt_int.h"
-
-#include <stdio.h>
-
-/* This needs to come after some library #include
-   to get __GNU_LIBRARY__ defined.  */
-#ifdef __GNU_LIBRARY__
-#include <stdlib.h>
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-int
-getopt_long (int argc, char *__getopt_argv_const *argv, const char *options,
-             const struct option *long_options, int *opt_index)
-{
-  return _getopt_internal (argc, (char **) argv, options, long_options,
-                           opt_index, 0, 0);
-}
-
-int
-_getopt_long_r (int argc, char **argv, const char *options,
-                const struct option *long_options, int *opt_index,
-                struct _getopt_data *d)
-{
-  return _getopt_internal_r (argc, argv, options, long_options, opt_index,
-                             0, d, 0);
-}
-
-/* Like getopt_long, but '-' as well as '--' can indicate a long option.
-   If an option that starts with '-' (not '--') doesn't match a long option,
-   but does match a short option, it is parsed as a short option
-   instead.  */
-
-int
-getopt_long_only (int argc, char *__getopt_argv_const *argv,
-                  const char *options,
-                  const struct option *long_options, int *opt_index)
-{
-  return _getopt_internal (argc, (char **) argv, options, long_options,
-                           opt_index, 1, 0);
-}
-
-int
-_getopt_long_only_r (int argc, char **argv, const char *options,
-                     const struct option *long_options, int *opt_index,
-                     struct _getopt_data *d)
-{
-  return _getopt_internal_r (argc, argv, options, long_options, opt_index,
-                             1, d, 0);
-}
-
-
-#ifdef TEST
-
-#include <stdio.h>
-
-int
-main (int argc, char **argv)
-{
-  int c;
-  int digit_optind = 0;
-
-  while (1)
-    {
-      int this_option_optind = optind ? optind : 1;
-      int option_index = 0;
-      static const struct option long_options[] =
-      {
-        {"add", 1, 0, 0},
-        {"append", 0, 0, 0},
-        {"delete", 1, 0, 0},
-        {"verbose", 0, 0, 0},
-        {"create", 0, 0, 0},
-        {"file", 1, 0, 0},
-        {0, 0, 0, 0}
-      };
-
-      c = getopt_long (argc, argv, "abc:d:0123456789",
-                       long_options, &option_index);
-      if (c == -1)
-        break;
-
-      switch (c)
-        {
-        case 0:
-          printf ("option %s", long_options[option_index].name);
-          if (optarg)
-            printf (" with arg %s", optarg);
-          printf ("\n");
-          break;
-
-        case '0':
-        case '1':
-        case '2':
-        case '3':
-        case '4':
-        case '5':
-        case '6':
-        case '7':
-        case '8':
-        case '9':
-          if (digit_optind != 0 && digit_optind != this_option_optind)
-            printf ("digits occur in two different argv-elements.\n");
-          digit_optind = this_option_optind;
-          printf ("option %c\n", c);
-          break;
-
-        case 'a':
-          printf ("option a\n");
-          break;
-
-        case 'b':
-          printf ("option b\n");
-          break;
-
-        case 'c':
-          printf ("option c with value '%s'\n", optarg);
-          break;
-
-        case 'd':
-          printf ("option d with value '%s'\n", optarg);
-          break;
-
-        case '?':
-          break;
-
-        default:
-          printf ("?? getopt returned character code 0%o ??\n", c);
-        }
-    }
-
-  if (optind < argc)
-    {
-      printf ("non-option ARGV-elements: ");
-      while (optind < argc)
-        printf ("%s ", argv[optind++]);
-      printf ("\n");
-    }
-
-  exit (0);
-}
-
-#endif /* TEST */

+ 0 - 135
gl/getopt_int.h~

@@ -1,135 +0,0 @@
-/* Internal declarations for getopt.
-   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2013 Free Software
-   Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef NAGIOS_GL_GETOPT_INT_H_INCLUDED
-#define NAGIOS_GL_GETOPT_INT_H_INCLUDED
-
-#include <getopt.h>
-
-extern int _getopt_internal (int ___argc, char **___argv,
-                             const char *__shortopts,
-                             const struct option *__longopts, int *__longind,
-                             int __long_only, int __posixly_correct);
-
-
-/* Reentrant versions which can handle parsing multiple argument
-   vectors at the same time.  */
-
-/* Describe how to deal with options that follow non-option ARGV-elements.
-
-   If the caller did not specify anything,
-   the default is REQUIRE_ORDER if the environment variable
-   POSIXLY_CORRECT is defined, PERMUTE otherwise.
-
-   REQUIRE_ORDER means don't recognize them as options;
-   stop option processing when the first non-option is seen.
-   This is what Unix does.
-   This mode of operation is selected by either setting the environment
-   variable POSIXLY_CORRECT, or using '+' as the first character
-   of the list of option characters, or by calling getopt.
-
-   PERMUTE is the default.  We permute the contents of ARGV as we
-   scan, so that eventually all the non-options are at the end.
-   This allows options to be given in any order, even with programs
-   that were not written to expect this.
-
-   RETURN_IN_ORDER is an option available to programs that were
-   written to expect options and other ARGV-elements in any order
-   and that care about the ordering of the two.  We describe each
-   non-option ARGV-element as if it were the argument of an option
-   with character code 1.  Using '-' as the first character of the
-   list of option characters selects this mode of operation.
-
-   The special argument '--' forces an end of option-scanning regardless
-   of the value of 'ordering'.  In the case of RETURN_IN_ORDER, only
-   '--' can cause 'getopt' to return -1 with 'optind' != ARGC.  */
-
-enum __ord
-  {
-    REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
-  };
-
-/* Data type for reentrant functions.  */
-struct _getopt_data
-{
-  /* These have exactly the same meaning as the corresponding global
-     variables, except that they are used for the reentrant
-     versions of getopt.  */
-  int optind;
-  int opterr;
-  int optopt;
-  char *optarg;
-
-  /* Internal members.  */
-
-  /* True if the internal members have been initialized.  */
-  int __initialized;
-
-  /* The next char to be scanned in the option-element
-     in which the last option character we returned was found.
-     This allows us to pick up the scan where we left off.
-
-     If this is zero, or a null string, it means resume the scan
-     by advancing to the next ARGV-element.  */
-  char *__nextchar;
-
-  /* See __ord above.  */
-  enum __ord __ordering;
-
-  /* If the POSIXLY_CORRECT environment variable is set
-     or getopt was called.  */
-  int __posixly_correct;
-
-
-  /* Handle permutation of arguments.  */
-
-  /* Describe the part of ARGV that contains non-options that have
-     been skipped.  'first_nonopt' is the index in ARGV of the first
-     of them; 'last_nonopt' is the index after the last of them.  */
-
-  int __first_nonopt;
-  int __last_nonopt;
-
-#if defined _LIBC && defined USE_NONOPTION_FLAGS
-  int __nonoption_flags_max_len;
-  int __nonoption_flags_len;
-#endif
-};
-
-/* The initializer is necessary to set OPTIND and OPTERR to their
-   default values and to clear the initialization flag.  */
-#define _GETOPT_DATA_INITIALIZER        { 1, 1 }
-
-extern int _getopt_internal_r (int ___argc, char **___argv,
-                               const char *__shortopts,
-                               const struct option *__longopts, int *__longind,
-                               int __long_only, struct _getopt_data *__data,
-                               int __posixly_correct);
-
-extern int _getopt_long_r (int ___argc, char **___argv,
-                           const char *__shortopts,
-                           const struct option *__longopts, int *__longind,
-                           struct _getopt_data *__data);
-
-extern int _getopt_long_only_r (int ___argc, char **___argv,
-                                const char *__shortopts,
-                                const struct option *__longopts,
-                                int *__longind,
-                                struct _getopt_data *__data);
-
-#endif /* getopt_int.h */

+ 0 - 288
gl/gettext.h~

@@ -1,288 +0,0 @@
-/* Convenience header for conditional use of GNU <libintl.h>.
-   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2013 Free Software
-   Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef NAGIOS_GL_GETTEXT_H_INCLUDED
-#define NAGIOS_GL_GETTEXT_H_INCLUDED
-
-/* NLS can be disabled through the configure --disable-nls option.  */
-#if ENABLE_NLS
-
-/* Get declarations of GNU message catalog functions.  */
-# include <libintl.h>
-
-/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by
-   the gettext() and ngettext() macros.  This is an alternative to calling
-   textdomain(), and is useful for libraries.  */
-# ifdef DEFAULT_TEXT_DOMAIN
-#  undef gettext
-#  define gettext(Msgid) \
-     dgettext (DEFAULT_TEXT_DOMAIN, Msgid)
-#  undef ngettext
-#  define ngettext(Msgid1, Msgid2, N) \
-     dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N)
-# endif
-
-#else
-
-/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
-   chokes if dcgettext is defined as a macro.  So include it now, to make
-   later inclusions of <locale.h> a NOP.  We don't include <libintl.h>
-   as well because people using "gettext.h" will not include <libintl.h>,
-   and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
-   is OK.  */
-#if defined(__sun)
-# include <locale.h>
-#endif
-
-/* Many header files from the libstdc++ coming with g++ 3.3 or newer include
-   <libintl.h>, which chokes if dcgettext is defined as a macro.  So include
-   it now, to make later inclusions of <libintl.h> a NOP.  */
-#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
-# include <cstdlib>
-# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H
-#  include <libintl.h>
-# endif
-#endif
-
-/* Disabled NLS.
-   The casts to 'const char *' serve the purpose of producing warnings
-   for invalid uses of the value returned from these functions.
-   On pre-ANSI systems without 'const', the config.h file is supposed to
-   contain "#define const".  */
-# undef gettext
-# define gettext(Msgid) ((const char *) (Msgid))
-# undef dgettext
-# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
-# undef dcgettext
-# define dcgettext(Domainname, Msgid, Category) \
-    ((void) (Category), dgettext (Domainname, Msgid))
-# undef ngettext
-# define ngettext(Msgid1, Msgid2, N) \
-    ((N) == 1 \
-     ? ((void) (Msgid2), (const char *) (Msgid1)) \
-     : ((void) (Msgid1), (const char *) (Msgid2)))
-# undef dngettext
-# define dngettext(Domainname, Msgid1, Msgid2, N) \
-    ((void) (Domainname), ngettext (Msgid1, Msgid2, N))
-# undef dcngettext
-# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
-    ((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N))
-# undef textdomain
-# define textdomain(Domainname) ((const char *) (Domainname))
-# undef bindtextdomain
-# define bindtextdomain(Domainname, Dirname) \
-    ((void) (Domainname), (const char *) (Dirname))
-# undef bind_textdomain_codeset
-# define bind_textdomain_codeset(Domainname, Codeset) \
-    ((void) (Domainname), (const char *) (Codeset))
-
-#endif
-
-/* Prefer gnulib's setlocale override over libintl's setlocale override.  */
-#ifdef GNULIB_defined_setlocale
-# undef setlocale
-# define setlocale rpl_setlocale
-#endif
-
-/* A pseudo function call that serves as a marker for the automated
-   extraction of messages, but does not call gettext().  The run-time
-   translation is done at a different place in the code.
-   The argument, String, should be a literal string.  Concatenated strings
-   and other string expressions won't work.
-   The macro's expansion is not parenthesized, so that it is suitable as
-   initializer for static 'char[]' or 'const char[]' variables.  */
-#define gettext_noop(String) String
-
-/* The separator between msgctxt and msgid in a .mo file.  */
-#define GETTEXT_CONTEXT_GLUE "\004"
-
-/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a
-   MSGID.  MSGCTXT and MSGID must be string literals.  MSGCTXT should be
-   short and rarely need to change.
-   The letter 'p' stands for 'particular' or 'special'.  */
-#ifdef DEFAULT_TEXT_DOMAIN
-# define pgettext(Msgctxt, Msgid) \
-   pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
-#else
-# define pgettext(Msgctxt, Msgid) \
-   pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
-#endif
-#define dpgettext(Domainname, Msgctxt, Msgid) \
-  pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
-#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \
-  pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category)
-#ifdef DEFAULT_TEXT_DOMAIN
-# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
-   npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
-#else
-# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
-   npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
-#endif
-#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
-  npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
-#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \
-  npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category)
-
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#endif
-static const char *
-pgettext_aux (const char *domain,
-              const char *msg_ctxt_id, const char *msgid,
-              int category)
-{
-  const char *translation = dcgettext (domain, msg_ctxt_id, category);
-  if (translation == msg_ctxt_id)
-    return msgid;
-  else
-    return translation;
-}
-
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#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 *translation =
-    dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
-  if (translation == msg_ctxt_id || translation == msgid_plural)
-    return (n == 1 ? msgid : msgid_plural);
-  else
-    return translation;
-}
-
-/* The same thing extended for non-constant arguments.  Here MSGCTXT and MSGID
-   can be arbitrary expressions.  But for string literals these macros are
-   less efficient than those above.  */
-
-#include <string.h>
-
-#if (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
-     /* || __STDC_VERSION__ >= 199901L */ )
-# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1
-#else
-# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0
-#endif
-
-#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
-#include <stdlib.h>
-#endif
-
-#define pgettext_expr(Msgctxt, Msgid) \
-  dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES)
-#define dpgettext_expr(Domainname, Msgctxt, Msgid) \
-  dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)
-
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#endif
-static const char *
-dcpgettext_expr (const char *domain,
-                 const char *msgctxt, const char *msgid,
-                 int category)
-{
-  size_t msgctxt_len = strlen (msgctxt) + 1;
-  size_t msgid_len = strlen (msgid) + 1;
-  const char *translation;
-#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
-  char msg_ctxt_id[msgctxt_len + msgid_len];
-#else
-  char buf[1024];
-  char *msg_ctxt_id =
-    (msgctxt_len + msgid_len <= sizeof (buf)
-     ? buf
-     : (char *) malloc (msgctxt_len + msgid_len));
-  if (msg_ctxt_id != NULL)
-#endif
-    {
-      memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
-      msg_ctxt_id[msgctxt_len - 1] = '\004';
-      memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
-      translation = dcgettext (domain, msg_ctxt_id, category);
-#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
-      if (msg_ctxt_id != buf)
-        free (msg_ctxt_id);
-#endif
-      if (translation != msg_ctxt_id)
-        return translation;
-    }
-  return msgid;
-}
-
-#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \
-  dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
-#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
-  dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
-
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#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)
-{
-  size_t msgctxt_len = strlen (msgctxt) + 1;
-  size_t msgid_len = strlen (msgid) + 1;
-  const char *translation;
-#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
-  char msg_ctxt_id[msgctxt_len + msgid_len];
-#else
-  char buf[1024];
-  char *msg_ctxt_id =
-    (msgctxt_len + msgid_len <= sizeof (buf)
-     ? buf
-     : (char *) malloc (msgctxt_len + msgid_len));
-  if (msg_ctxt_id != NULL)
-#endif
-    {
-      memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
-      msg_ctxt_id[msgctxt_len - 1] = '\004';
-      memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
-      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);
-#endif
-      if (!(translation == msg_ctxt_id || translation == msgid_plural))
-        return translation;
-    }
-  return (n == 1 ? msgid : msgid_plural);
-}
-
-#endif /* NAGIOS_GL_GETTEXT_H_INCLUDED */

+ 0 - 204
gl/idpriv-droptemp.c~

@@ -1,204 +0,0 @@
-/* Dropping uid/gid privileges of the current process temporarily.
-   Copyright (C) 2009-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include "idpriv.h"
-
-#include <errno.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-/* The privileged uid and gid that the process had earlier.  */
-#if HAVE_GETUID
-static int saved_uid = -1;
-#endif
-#if HAVE_GETGID
-static int saved_gid = -1;
-#endif
-
-int
-idpriv_temp_drop (void)
-{
-#if HAVE_GETEUID && HAVE_GETEGID && (HAVE_SETRESUID || HAVE_SETREUID) && (HAVE_SETRESGID || HAVE_SETREGID)
-  int uid = getuid ();
-  int gid = getgid ();
-
-  /* Find out about the privileged uid and gid at the first call.  */
-  if (saved_uid == -1)
-    saved_uid = geteuid ();
-  if (saved_gid == -1)
-    saved_gid = getegid ();
-
-  /* Drop the gid privilege first, because in some cases the gid privilege
-     cannot be dropped after the uid privilege has been dropped.  */
-
-  /* This is for executables that have the setgid bit set.  */
-# if HAVE_SETRESGID /* glibc, FreeBSD, OpenBSD, HP-UX */
-  if (setresgid (-1, gid, saved_gid) < 0)
-    return -1;
-# else /* Mac OS X, NetBSD, AIX, IRIX, Solaris >= 2.5, OSF/1, Cygwin */
-  if (setregid (-1, gid) < 0)
-    return -1;
-# endif
-
-  /* This is for executables that have the setuid bit set.  */
-# if HAVE_SETRESUID /* glibc, FreeBSD, OpenBSD, HP-UX */
-  /* See <http://www.usenix.org/events/sec02/full_papers/chen/chen.pdf>
-     figure 14.  */
-  if (setresuid (-1, uid, saved_uid) < 0)
-    return -1;
-# else /* Mac OS X, NetBSD, AIX, IRIX, Solaris >= 2.5, OSF/1, Cygwin */
-  if (setreuid (-1, uid) < 0)
-    return -1;
-# endif
-
-  /* Verify that the privileges have really been dropped.
-     This verification is here for security reasons.  Doesn't matter if it
-     takes a couple of system calls.
-     When the verification fails, it indicates that we need to use different
-     API in the code above. Therefore 'abort ()', not 'return -1'.  */
-# if HAVE_GETRESUID /* glibc, FreeBSD, OpenBSD, HP-UX */
-  {
-    uid_t real;
-    uid_t effective;
-    uid_t saved;
-    if (getresuid (&real, &effective, &saved) < 0
-        || real != uid
-        || effective != uid
-        || saved != saved_uid)
-      abort ();
-  }
-# else
-#  if HAVE_GETEUID
-  if (geteuid () != uid)
-    abort ();
-#  endif
-  if (getuid () != uid)
-    abort ();
-# endif
-# if HAVE_GETRESGID /* glibc, FreeBSD, OpenBSD, HP-UX */
-  {
-    uid_t real;
-    uid_t effective;
-    uid_t saved;
-    if (getresgid (&real, &effective, &saved) < 0
-        || real != gid
-        || effective != gid
-        || saved != saved_gid)
-      abort ();
-  }
-# else
-#  if HAVE_GETEGID
-  if (getegid () != gid)
-    abort ();
-#  endif
-  if (getgid () != gid)
-    abort ();
-# endif
-
-  return 0;
-#else
-  errno = ENOSYS;
-  return -1;
-#endif
-}
-
-int
-idpriv_temp_restore (void)
-{
-#if HAVE_GETEUID && HAVE_GETEGID && (HAVE_SETRESUID || HAVE_SETREUID) && (HAVE_SETRESGID || HAVE_SETREGID)
-  int uid = getuid ();
-  int gid = getgid ();
-
-  if (saved_uid == -1 || saved_gid == -1)
-    /* Caller error: idpriv_temp_drop was never invoked.  */
-    abort ();
-
-  /* Acquire the gid privilege last, because in some cases the gid privilege
-     cannot be acquired before the uid privilege has been acquired.  */
-
-  /* This is for executables that have the setuid bit set.  */
-# if HAVE_SETRESUID /* glibc, FreeBSD, OpenBSD, HP-UX */
-  /* See <http://www.usenix.org/events/sec02/full_papers/chen/chen.pdf>
-     figure 14.  */
-  if (setresuid (-1, saved_uid, -1) < 0)
-    return -1;
-# else /* Mac OS X, NetBSD, AIX, IRIX, Solaris >= 2.5, OSF/1, Cygwin */
-  if (setreuid (-1, saved_uid) < 0)
-    return -1;
-# endif
-
-  /* This is for executables that have the setgid bit set.  */
-# if HAVE_SETRESGID /* glibc, FreeBSD, OpenBSD, HP-UX */
-  if (setresgid (-1, saved_gid, -1) < 0)
-    return -1;
-# else /* Mac OS X, NetBSD, AIX, IRIX, Solaris >= 2.5, OSF/1, Cygwin */
-  if (setregid (-1, saved_gid) < 0)
-    return -1;
-# endif
-
-  /* Verify that the privileges have really been acquired.
-     This verification is here for security reasons.  Doesn't matter if it
-     takes a couple of system calls.
-     When the verification fails, it indicates that we need to use different
-     API in the code above. Therefore 'abort ()', not 'return -1'.  */
-# if HAVE_GETRESUID /* glibc, FreeBSD, OpenBSD, HP-UX */
-  {
-    uid_t real;
-    uid_t effective;
-    uid_t saved;
-    if (getresuid (&real, &effective, &saved) < 0
-        || real != uid
-        || effective != saved_uid
-        || saved != saved_uid)
-      abort ();
-  }
-# else
-#  if HAVE_GETEUID
-  if (geteuid () != saved_uid)
-    abort ();
-#  endif
-  if (getuid () != uid)
-    abort ();
-# endif
-# if HAVE_GETRESGID /* glibc, FreeBSD, OpenBSD, HP-UX */
-  {
-    uid_t real;
-    uid_t effective;
-    uid_t saved;
-    if (getresgid (&real, &effective, &saved) < 0
-        || real != gid
-        || effective != saved_gid
-        || saved != saved_gid)
-      abort ();
-  }
-# else
-#  if HAVE_GETEGID
-  if (getegid () != saved_gid)
-    abort ();
-#  endif
-  if (getgid () != gid)
-    abort ();
-# endif
-
-  return 0;
-#else
-  errno = ENOSYS;
-  return -1;
-#endif
-}

+ 0 - 116
gl/idpriv.h~

@@ -1,116 +0,0 @@
-/* Dropping uid/gid privileges of the current process.
-   Copyright (C) 2009-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef NAGIOS_GL_IDPRIV_H_INCLUDED
-#define NAGIOS_GL_IDPRIV_H_INCLUDED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* This module allows programs which are installed with setuid or setgid bit
-   (and which therefore initially run with an effective user id or group id
-   different from the one of the current user) to drop their uid or gid
-   privilege, either permanently or temporarily.
-
-   It is absolutely necessary to minimize the amount of code that is running
-   with escalated privileges (e.g. with effective uid = root). The reason is
-   that any bug or exploit in a part of a program that is running with
-   escalated privileges is a security vulnerability that - upon discovery -
-   puts the users in danger and requires immediate fixing. Then consider that
-   there's a bug every 10 or 20 lines of code on average...
-
-   For programs that temporarily drop privileges but have the ability to
-   restore them later, there are additionally the dangers that
-     - Any bug in the non-privileged part of the program may be used to
-       create invalid data structures that will trigger security
-       vulnerabilities in the privileged part of the program.
-     - Code execution exploits in the non-privileged part of the program may
-       be used to invoke the function that restores high privileges and then
-       execute additional arbitrary code.
-
-   1) The usual, and reasonably safe, way to minimize the amount of code
-      running with privileges is to create a separate executable, with setuid
-      or setgid bit, that contains only code for the tasks that require
-      privileges (and,of course, strict checking of the arguments, so that the
-      program cannot be abused). The main program is installed without setuid
-      or setgid bit.
-
-   2) A less safe way is to do some privileged tasks at the beginning of the
-      program's run, and drop privileges permanently as soon as possible.
-
-      Note: There may still be security issues if the privileged task puts
-      sensitive data into the process memory or opens communication channels
-      to restricted facilities.
-
-   3) The most unsafe way is to drop privileges temporarily for most of the
-      main program but to re-enable them for the duration of privileged tasks.
-
-      As explained above, this approach has uncontrollable dangers for
-      security.
-
-      This approach is normally not usable in multithreaded programs, because
-      you cannot know what kind of system calls the other threads could be
-      doing during the time the privileges are enabled.
-
-   With approach 1, you don't need gnulib modules.
-   With approach 2, you need the gnulib module 'idpriv-drop'.
-   With approach 3, you need the gnulib module 'idpriv-droptemp'. But really,
-   you should better stay away from this approach.
- */
-
-/* For more in-depth discussion of these topics, see the papers/articles
-   * Hao Chen, David Wagner, Drew Dean: Setuid Demystified
-     <http://www.usenix.org/events/sec02/full_papers/chen/chen.pdf>
-   * Dan Tsafrir, Dilma da Silva, David Wagner: The Murky Issue of Changing
-     Process Identity: Revising "Setuid Demystified"
-     <http://www.eecs.berkeley.edu/~daw/papers/setuid-login08b.pdf>
-     <http://code.google.com/p/change-process-identity/>
-   * Dhruv Mohindra: Observe correct revocation order while relinquishing
-     privileges
-     <https://www.securecoding.cert.org/confluence/display/seccode/POS36-C.+Observe+correct+revocation+order+while+relinquishing+privileges>
- */
-
-
-/* For approach 2.  */
-
-/* Drop the uid and gid privileges of the current process.
-   Return 0 if successful, or -1 with errno set upon failure. The recommended
-   handling of failure is to terminate the process.  */
-extern int idpriv_drop (void);
-
-
-/* For approach 3.  */
-
-/* Drop the uid and gid privileges of the current process in a way that allows
-   them to be restored later.
-   Return 0 if successful, or -1 with errno set upon failure. The recommended
-   handling of failure is to terminate the process.  */
-extern int idpriv_temp_drop (void);
-
-/* Restore the uid and gid privileges of the current process.
-   Return 0 if successful, or -1 with errno set upon failure. The recommended
-   handling of failure is to not perform the actions that require the escalated
-   privileges.  */
-extern int idpriv_temp_restore (void);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* NAGIOS_GL_IDPRIV_H_INCLUDED */

+ 0 - 260
gl/inet_ntop.c~

@@ -1,260 +0,0 @@
-/* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form
-
-   Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-/*
- * Copyright (c) 1996-1999 by Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- */
-
-#include <config.h>
-
-/* Specification.  */
-#include <arpa/inet.h>
-
-/* Use this to suppress gcc's "...may be used before initialized" warnings.
-   Beware: The Code argument must not contain commas.  */
-#ifndef IF_LINT
-# ifdef lint
-#  define IF_LINT(Code) Code
-# else
-#  define IF_LINT(Code) /* empty */
-# endif
-#endif
-
-#if HAVE_DECL_INET_NTOP
-
-# undef inet_ntop
-
-const char *
-rpl_inet_ntop (int af, const void *restrict src,
-               char *restrict dst, socklen_t cnt)
-{
-  return inet_ntop (af, src, dst, cnt);
-}
-
-#else
-
-# include <stdio.h>
-# include <string.h>
-# include <errno.h>
-
-# define NS_IN6ADDRSZ 16
-# define NS_INT16SZ 2
-
-/*
- * WARNING: Don't even consider trying to compile this on a system where
- * sizeof(int) < 4.  sizeof(int) > 4 is fine; all the world's not a VAX.
- */
-typedef int verify_int_size[4 <= sizeof (int) ? 1 : -1];
-
-static const char *inet_ntop4 (const unsigned char *src, char *dst, socklen_t size);
-# if HAVE_IPV6
-static const char *inet_ntop6 (const unsigned char *src, char *dst, socklen_t size);
-# endif
-
-
-/* char *
- * inet_ntop(af, src, dst, size)
- *      convert a network format address to presentation format.
- * return:
- *      pointer to presentation format address ('dst'), or NULL (see errno).
- * author:
- *      Paul Vixie, 1996.
- */
-const char *
-inet_ntop (int af, const void *restrict src,
-           char *restrict dst, socklen_t cnt)
-{
-  switch (af)
-    {
-# if HAVE_IPV4
-    case AF_INET:
-      return (inet_ntop4 (src, dst, cnt));
-# endif
-
-# if HAVE_IPV6
-    case AF_INET6:
-      return (inet_ntop6 (src, dst, cnt));
-# endif
-
-    default:
-      errno = EAFNOSUPPORT;
-      return (NULL);
-    }
-  /* NOTREACHED */
-}
-
-/* const char *
- * inet_ntop4(src, dst, size)
- *      format an IPv4 address
- * return:
- *      'dst' (as a const)
- * notes:
- *      (1) uses no statics
- *      (2) takes a u_char* not an in_addr as input
- * author:
- *      Paul Vixie, 1996.
- */
-static const char *
-inet_ntop4 (const unsigned char *src, char *dst, socklen_t size)
-{
-  char tmp[sizeof "255.255.255.255"];
-  int len;
-
-  len = sprintf (tmp, "%u.%u.%u.%u", src[0], src[1], src[2], src[3]);
-  if (len < 0)
-    return NULL;
-
-  if (len > size)
-    {
-      errno = ENOSPC;
-      return NULL;
-    }
-
-  return strcpy (dst, tmp);
-}
-
-# if HAVE_IPV6
-
-/* const char *
- * inet_ntop6(src, dst, size)
- *      convert IPv6 binary address into presentation (printable) format
- * author:
- *      Paul Vixie, 1996.
- */
-static const char *
-inet_ntop6 (const unsigned char *src, char *dst, socklen_t size)
-{
-  /*
-   * Note that int32_t and int16_t need only be "at least" large enough
-   * to contain a value of the specified size.  On some systems, like
-   * Crays, there is no such thing as an integer variable with 16 bits.
-   * Keep this in mind if you think this function should have been coded
-   * to use pointer overlays.  All the world's not a VAX.
-   */
-  char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
-  struct
-  {
-    int base, len;
-  } best, cur;
-  unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ];
-  int i;
-
-  /*
-   * Preprocess:
-   *      Copy the input (bytewise) array into a wordwise array.
-   *      Find the longest run of 0x00's in src[] for :: shorthanding.
-   */
-  memset (words, '\0', sizeof words);
-  for (i = 0; i < NS_IN6ADDRSZ; i += 2)
-    words[i / 2] = (src[i] << 8) | src[i + 1];
-  best.base = -1;
-  cur.base = -1;
-  IF_LINT(best.len = 0);
-  IF_LINT(cur.len = 0);
-  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++;
-        }
-      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;
-    }
-  if (best.base != -1 && best.len < 2)
-    best.base = -1;
-
-  /*
-   * Format the result.
-   */
-  tp = tmp;
-  for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
-    {
-      /* 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;
-        }
-      /* Are we following an initial run of 0x00s or any real hex? */
-      if (i != 0)
-        *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;
-        }
-      {
-        int len = sprintf (tp, "%x", words[i]);
-        if (len < 0)
-          return NULL;
-        tp += len;
-      }
-    }
-  /* Was it a trailing run of 0x00's? */
-  if (best.base != -1 && (best.base + best.len) ==
-      (NS_IN6ADDRSZ / NS_INT16SZ))
-    *tp++ = ':';
-  *tp++ = '\0';
-
-  /*
-   * Check for overflow, copy, and we're done.
-   */
-  if ((socklen_t) (tp - tmp) > size)
-    {
-      errno = ENOSPC;
-      return NULL;
-    }
-
-  return strcpy (dst, tmp);
-}
-
-# endif
-
-#endif

+ 0 - 319
gl/intprops.h~

@@ -1,319 +0,0 @@
-/* intprops.h -- properties of integer types
-
-   Copyright (C) 2001-2005, 2009-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Paul Eggert.  */
-
-#ifndef NAGIOS_GL_INTPROPS_H_INCLUDED
-#define NAGIOS_GL_INTPROPS_H_INCLUDED
-
-#include <limits.h>
-
-/* Return an integer value, converted to the same type as the integer
-   expression E after integer type promotion.  V is the unconverted value.  */
-#define _GL_INT_CONVERT(e, v) (0 * (e) + (v))
-
-/* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see
-   <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00406.html>.  */
-#define _GL_INT_NEGATE_CONVERT(e, v) (0 * (e) - (v))
-
-/* 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)
-
-/* 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)
-
-/* True if the signed integer expression E uses two's complement.  */
-#define _GL_INT_TWOS_COMPLEMENT(e) (~ _GL_INT_CONVERT (e, 0) == -1)
-
-/* True if the arithmetic type T is signed.  */
-#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
-
-/* Return 1 if the integer expression E, after integer promotion, has
-   a signed type.  */
-#define _GL_INT_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0)
-
-
-/* Minimum and maximum values for integer types and expressions.  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.  */
-
-/* The maximum and minimum values for the integer type T.  */
-#define TYPE_MINIMUM(t)                                                 \
-  ((t) (! TYPE_SIGNED (t)                                               \
-        ? (t) 0                                                         \
-        : TYPE_SIGNED_MAGNITUDE (t)                                     \
-        ? ~ (t) 0                                                       \
-        : ~ TYPE_MAXIMUM (t)))
-#define TYPE_MAXIMUM(t)                                                 \
-  ((t) (! TYPE_SIGNED (t)                                               \
-        ? (t) -1                                                        \
-        : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
-
-/* The maximum and minimum values for the type of the expression E,
-   after integer promotion.  E should not have side effects.  */
-#define _GL_INT_MINIMUM(e)                                              \
-  (_GL_INT_SIGNED (e)                                                   \
-   ? - _GL_INT_TWOS_COMPLEMENT (e) - _GL_SIGNED_INT_MAXIMUM (e)         \
-   : _GL_INT_CONVERT (e, 0))
-#define _GL_INT_MAXIMUM(e)                                              \
-  (_GL_INT_SIGNED (e)                                                   \
-   ? _GL_SIGNED_INT_MAXIMUM (e)                                         \
-   : _GL_INT_NEGATE_CONVERT (e, 1))
-#define _GL_SIGNED_INT_MAXIMUM(e)                                       \
-  (((_GL_INT_CONVERT (e, 1) << (sizeof ((e) + 0) * CHAR_BIT - 2)) - 1) * 2 + 1)
-
-
-/* Return 1 if the __typeof__ keyword works.  This could be done by
-   'configure', but for now it's easier to do it by hand.  */
-#if 2 <= __GNUC__ || defined __IBM__TYPEOF__ || 0x5110 <= __SUNPRO_C
-# define _GL_HAVE___TYPEOF__ 1
-#else
-# define _GL_HAVE___TYPEOF__ 0
-#endif
-
-/* Return 1 if the integer type or expression T might be signed.  Return 0
-   if it is definitely unsigned.  This macro does not evaluate its argument,
-   and expands to an integer constant expression.  */
-#if _GL_HAVE___TYPEOF__
-# define _GL_SIGNED_TYPE_OR_EXPR(t) TYPE_SIGNED (__typeof__ (t))
-#else
-# define _GL_SIGNED_TYPE_OR_EXPR(t) 1
-#endif
-
-/* Bound on length of the string representing an unsigned integer
-   value representable in B bits.  log10 (2.0) < 146/485.  The
-   smallest value of B where this bound is not tight is 2621.  */
-#define INT_BITS_STRLEN_BOUND(b) (((b) * 146 + 484) / 485)
-
-/* Bound on length of the string representing an integer type or expression T.
-   Subtract 1 for the sign bit if T is signed, and then add 1 more for
-   a minus sign if needed.
-
-   Because _GL_SIGNED_TYPE_OR_EXPR sometimes returns 0 when its argument is
-   signed, this macro may overestimate the true bound by one byte when
-   applied to unsigned types of size 2, 4, 16, ... bytes.  */
-#define INT_STRLEN_BOUND(t)                                     \
-  (INT_BITS_STRLEN_BOUND (sizeof (t) * CHAR_BIT                 \
-                          - _GL_SIGNED_TYPE_OR_EXPR (t))        \
-   + _GL_SIGNED_TYPE_OR_EXPR (t))
-
-/* 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)
-
-
-/* Range overflow checks.
-
-   The INT_<op>_RANGE_OVERFLOW macros return 1 if the corresponding C
-   operators might not yield numerically correct answers due to
-   arithmetic overflow.  They do not rely on undefined or
-   implementation-defined behavior.  Their implementations are simple
-   and straightforward, but they are a bit harder to use than the
-   INT_<op>_OVERFLOW macros described below.
-
-   Example usage:
-
-     long int i = ...;
-     long int j = ...;
-     if (INT_MULTIPLY_RANGE_OVERFLOW (i, j, LONG_MIN, LONG_MAX))
-       printf ("multiply would overflow");
-     else
-       printf ("product is %ld", i * j);
-
-   Restrictions on *_RANGE_OVERFLOW macros:
-
-   These macros do not check for all possible numerical problems or
-   undefined or unspecified behavior: they do not check for division
-   by zero, for bad shift counts, or for shifting negative numbers.
-
-   These macros may evaluate their arguments zero or multiple times,
-   so the arguments should not have side effects.  The arithmetic
-   arguments (including the MIN and MAX arguments) must be of the same
-   integer type after the usual arithmetic conversions, and the type
-   must have minimum value MIN and maximum MAX.  Unsigned types should
-   use a zero MIN of the proper type.
-
-   These macros are tuned for constant MIN and MAX.  For commutative
-   operations such as A + B, they are also tuned for constant B.  */
-
-/* Return 1 if A + B would overflow in [MIN,MAX] arithmetic.
-   See above for restrictions.  */
-#define INT_ADD_RANGE_OVERFLOW(a, b, min, max)          \
-  ((b) < 0                                              \
-   ? (a) < (min) - (b)                                  \
-   : (max) - (b) < (a))
-
-/* Return 1 if A - B would overflow in [MIN,MAX] arithmetic.
-   See above for restrictions.  */
-#define INT_SUBTRACT_RANGE_OVERFLOW(a, b, min, max)     \
-  ((b) < 0                                              \
-   ? (max) + (b) < (a)                                  \
-   : (a) < (min) + (b))
-
-/* Return 1 if - A would overflow in [MIN,MAX] arithmetic.
-   See above for restrictions.  */
-#define INT_NEGATE_RANGE_OVERFLOW(a, min, max)          \
-  ((min) < 0                                            \
-   ? (a) < - (max)                                      \
-   : 0 < (a))
-
-/* Return 1 if A * B would overflow in [MIN,MAX] arithmetic.
-   See above for restrictions.  Avoid && and || as they tickle
-   bugs in Sun C 5.11 2010/08/13 and other compilers; see
-   <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00401.html>.  */
-#define INT_MULTIPLY_RANGE_OVERFLOW(a, b, min, max)     \
-  ((b) < 0                                              \
-   ? ((a) < 0                                           \
-      ? (a) < (max) / (b)                               \
-      : (b) == -1                                       \
-      ? 0                                               \
-      : (min) / (b) < (a))                              \
-   : (b) == 0                                           \
-   ? 0                                                  \
-   : ((a) < 0                                           \
-      ? (a) < (min) / (b)                               \
-      : (max) / (b) < (a)))
-
-/* Return 1 if A / B would overflow in [MIN,MAX] arithmetic.
-   See above for restrictions.  Do not check for division by zero.  */
-#define INT_DIVIDE_RANGE_OVERFLOW(a, b, min, max)       \
-  ((min) < 0 && (b) == -1 && (a) < - (max))
-
-/* Return 1 if A % B would overflow in [MIN,MAX] arithmetic.
-   See above for restrictions.  Do not check for division by zero.
-   Mathematically, % should never overflow, but on x86-like hosts
-   INT_MIN % -1 traps, and the C standard permits this, so treat this
-   as an overflow too.  */
-#define INT_REMAINDER_RANGE_OVERFLOW(a, b, min, max)    \
-  INT_DIVIDE_RANGE_OVERFLOW (a, b, min, max)
-
-/* Return 1 if A << B would overflow in [MIN,MAX] arithmetic.
-   See above for restrictions.  Here, MIN and MAX are for A only, and B need
-   not be of the same type as the other arguments.  The C standard says that
-   behavior is undefined for shifts unless 0 <= B < wordwidth, and that when
-   A is negative then A << B has undefined behavior and A >> B has
-   implementation-defined behavior, but do not check these other
-   restrictions.  */
-#define INT_LEFT_SHIFT_RANGE_OVERFLOW(a, b, min, max)   \
-  ((a) < 0                                              \
-   ? (a) < (min) >> (b)                                 \
-   : (max) >> (b) < (a))
-
-
-/* The _GL*_OVERFLOW macros have the same restrictions as the
-   *_RANGE_OVERFLOW macros, except that they do not assume that operands
-   (e.g., A and B) have the same type as MIN and MAX.  Instead, they assume
-   that the result (e.g., A + B) has that type.  */
-#define _GL_ADD_OVERFLOW(a, b, min, max)                                \
-  ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max)                  \
-   : (a) < 0 ? (b) <= (a) + (b)                                         \
-   : (b) < 0 ? (a) <= (a) + (b)                                         \
-   : (a) + (b) < (b))
-#define _GL_SUBTRACT_OVERFLOW(a, b, min, max)                           \
-  ((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max)             \
-   : (a) < 0 ? 1                                                        \
-   : (b) < 0 ? (a) - (b) <= (a)                                         \
-   : (a) < (b))
-#define _GL_MULTIPLY_OVERFLOW(a, b, min, max)                           \
-  (((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a))))       \
-   || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max))
-#define _GL_DIVIDE_OVERFLOW(a, b, min, max)                             \
-  ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max)  \
-   : (a) < 0 ? (b) <= (a) + (b) - 1                                     \
-   : (b) < 0 && (a) + (b) <= (a))
-#define _GL_REMAINDER_OVERFLOW(a, b, min, max)                          \
-  ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max)  \
-   : (a) < 0 ? (a) % (b) != ((max) - (b) + 1) % (b)                     \
-   : (b) < 0 && ! _GL_UNSIGNED_NEG_MULTIPLE (a, b, max))
-
-/* Return a nonzero value if A is a mathematical multiple of B, where
-   A is unsigned, B is negative, and MAX is the maximum value of A's
-   type.  A's type must be the same as (A % B)'s type.  Normally (A %
-   -B == 0) suffices, but things get tricky if -B would overflow.  */
-#define _GL_UNSIGNED_NEG_MULTIPLE(a, b, max)                            \
-  (((b) < -_GL_SIGNED_INT_MAXIMUM (b)                                   \
-    ? (_GL_SIGNED_INT_MAXIMUM (b) == (max)                              \
-       ? (a)                                                            \
-       : (a) % (_GL_INT_CONVERT (a, _GL_SIGNED_INT_MAXIMUM (b)) + 1))   \
-    : (a) % - (b))                                                      \
-   == 0)
-
-
-/* Integer overflow checks.
-
-   The INT_<op>_OVERFLOW macros return 1 if the corresponding C operators
-   might not yield numerically correct answers due to arithmetic overflow.
-   They work correctly on all known practical hosts, and do not rely
-   on undefined behavior due to signed arithmetic overflow.
-
-   Example usage:
-
-     long int i = ...;
-     long int j = ...;
-     if (INT_MULTIPLY_OVERFLOW (i, j))
-       printf ("multiply would overflow");
-     else
-       printf ("product is %ld", i * j);
-
-   These macros do not check for all possible numerical problems or
-   undefined or unspecified behavior: they do not check for division
-   by zero, for bad shift counts, or for shifting negative numbers.
-
-   These macros may evaluate their arguments zero or multiple times, so the
-   arguments should not have side effects.
-
-   These macros are tuned for their last argument being a constant.
-
-   Return 1 if the integer expressions A * B, A - B, -A, A * B, A / B,
-   A % B, and A << B would overflow, respectively.  */
-
-#define INT_ADD_OVERFLOW(a, b) \
-  _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW)
-#define INT_SUBTRACT_OVERFLOW(a, b) \
-  _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW)
-#define INT_NEGATE_OVERFLOW(a) \
-  INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a))
-#define INT_MULTIPLY_OVERFLOW(a, b) \
-  _GL_BINARY_OP_OVERFLOW (a, b, _GL_MULTIPLY_OVERFLOW)
-#define INT_DIVIDE_OVERFLOW(a, b) \
-  _GL_BINARY_OP_OVERFLOW (a, b, _GL_DIVIDE_OVERFLOW)
-#define INT_REMAINDER_OVERFLOW(a, b) \
-  _GL_BINARY_OP_OVERFLOW (a, b, _GL_REMAINDER_OVERFLOW)
-#define INT_LEFT_SHIFT_OVERFLOW(a, b) \
-  INT_LEFT_SHIFT_RANGE_OVERFLOW (a, b, \
-                                 _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a))
-
-/* Return 1 if the expression A <op> B would overflow,
-   where OP_RESULT_OVERFLOW (A, B, MIN, MAX) does the actual test,
-   assuming MIN and MAX are the minimum and maximum for the result type.
-   Arguments should be free of side effects.  */
-#define _GL_BINARY_OP_OVERFLOW(a, b, op_result_overflow)        \
-  op_result_overflow (a, b,                                     \
-                      _GL_INT_MINIMUM (0 * (b) + (a)),          \
-                      _GL_INT_MAXIMUM (0 * (b) + (a)))
-
-#endif /* NAGIOS_GL_INTPROPS_H_INCLUDED */

+ 0 - 28
gl/itold.c~

@@ -1,28 +0,0 @@
-/* Replacement for 'int' to 'long double' conversion routine.
-   Copyright (C) 2011-2013 Free Software Foundation, Inc.
-   Written by Bruno Haible <bruno@clisp.org>, 2011.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include <float.h>
-
-void
-_Qp_itoq (long double *result, int a)
-{
-  /* Convert from 'int' to 'double', then from 'double' to 'long double'.  */
-  *result = (double) a;
-}

+ 0 - 176
gl/langinfo.in.h~

@@ -1,176 +0,0 @@
-/* Substitute for and wrapper around <langinfo.h>.
-   Copyright (C) 2009-2013 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-/*
- * POSIX <langinfo.h> for platforms that lack it or have an incomplete one.
- * <http://www.opengroup.org/onlinepubs/9699919799/basedefs/langinfo.h.html>
- */
-
-#ifndef _@GUARD_PREFIX@_LANGINFO_H
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-/* The include_next requires a split double-inclusion guard.  */
-#if @HAVE_LANGINFO_H@
-# @INCLUDE_NEXT@ @NEXT_LANGINFO_H@
-#endif
-
-#ifndef _@GUARD_PREFIX@_LANGINFO_H
-#define _@GUARD_PREFIX@_LANGINFO_H
-
-
-#if !@HAVE_LANGINFO_H@
-
-/* A platform that lacks <langinfo.h>.  */
-
-/* Assume that it also lacks <nl_types.h> and the nl_item type.  */
-# if !GNULIB_defined_nl_item
-typedef int nl_item;
-#  define GNULIB_defined_nl_item 1
-# endif
-
-/* nl_langinfo items of the LC_CTYPE category */
-# define CODESET     10000
-/* nl_langinfo items of the LC_NUMERIC category */
-# define RADIXCHAR   10001
-# define THOUSEP     10002
-/* nl_langinfo items of the LC_TIME category */
-# define D_T_FMT     10003
-# define D_FMT       10004
-# define T_FMT       10005
-# define T_FMT_AMPM  10006
-# define AM_STR      10007
-# define PM_STR      10008
-# define DAY_1       10009
-# define DAY_2       (DAY_1 + 1)
-# define DAY_3       (DAY_1 + 2)
-# define DAY_4       (DAY_1 + 3)
-# define DAY_5       (DAY_1 + 4)
-# define DAY_6       (DAY_1 + 5)
-# define DAY_7       (DAY_1 + 6)
-# define ABDAY_1     10016
-# define ABDAY_2     (ABDAY_1 + 1)
-# define ABDAY_3     (ABDAY_1 + 2)
-# define ABDAY_4     (ABDAY_1 + 3)
-# define ABDAY_5     (ABDAY_1 + 4)
-# define ABDAY_6     (ABDAY_1 + 5)
-# define ABDAY_7     (ABDAY_1 + 6)
-# define MON_1       10023
-# define MON_2       (MON_1 + 1)
-# define MON_3       (MON_1 + 2)
-# define MON_4       (MON_1 + 3)
-# define MON_5       (MON_1 + 4)
-# define MON_6       (MON_1 + 5)
-# define MON_7       (MON_1 + 6)
-# define MON_8       (MON_1 + 7)
-# define MON_9       (MON_1 + 8)
-# define MON_10      (MON_1 + 9)
-# define MON_11      (MON_1 + 10)
-# define MON_12      (MON_1 + 11)
-# define ABMON_1     10035
-# define ABMON_2     (ABMON_1 + 1)
-# define ABMON_3     (ABMON_1 + 2)
-# define ABMON_4     (ABMON_1 + 3)
-# define ABMON_5     (ABMON_1 + 4)
-# define ABMON_6     (ABMON_1 + 5)
-# define ABMON_7     (ABMON_1 + 6)
-# define ABMON_8     (ABMON_1 + 7)
-# define ABMON_9     (ABMON_1 + 8)
-# define ABMON_10    (ABMON_1 + 9)
-# define ABMON_11    (ABMON_1 + 10)
-# define ABMON_12    (ABMON_1 + 11)
-# define ERA         10047
-# define ERA_D_FMT   10048
-# define ERA_D_T_FMT 10049
-# define ERA_T_FMT   10050
-# define ALT_DIGITS  10051
-/* nl_langinfo items of the LC_MONETARY category */
-# define CRNCYSTR    10052
-/* nl_langinfo items of the LC_MESSAGES category */
-# define YESEXPR     10053
-# define NOEXPR      10054
-
-#else
-
-/* A platform that has <langinfo.h>.  */
-
-# if !@HAVE_LANGINFO_CODESET@
-#  define CODESET     10000
-#  define GNULIB_defined_CODESET 1
-# endif
-
-# if !@HAVE_LANGINFO_T_FMT_AMPM@
-#  define T_FMT_AMPM  10006
-#  define GNULIB_defined_T_FMT_AMPM 1
-# endif
-
-# if !@HAVE_LANGINFO_ERA@
-#  define ERA         10047
-#  define ERA_D_FMT   10048
-#  define ERA_D_T_FMT 10049
-#  define ERA_T_FMT   10050
-#  define ALT_DIGITS  10051
-#  define GNULIB_defined_ERA 1
-# endif
-
-# if !@HAVE_LANGINFO_YESEXPR@
-#  define YESEXPR     10053
-#  define NOEXPR      10054
-#  define GNULIB_defined_YESEXPR 1
-# endif
-
-#endif
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
-
-/* The definition of _GL_WARN_ON_USE is copied here.  */
-
-/* Declare overridden functions.  */
-
-
-/* Return a piece of locale dependent information.
-   Note: The difference between nl_langinfo (CODESET) and locale_charset ()
-   is that the latter normalizes the encoding names to GNU conventions.  */
-
-#if @GNULIB_NL_LANGINFO@
-# if @REPLACE_NL_LANGINFO@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef nl_langinfo
-#   define nl_langinfo rpl_nl_langinfo
-#  endif
-_GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item));
-_GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item));
-# else
-#  if !@HAVE_NL_LANGINFO@
-_GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item));
-#  endif
-_GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item));
-# endif
-_GL_CXXALIASWARN (nl_langinfo);
-#elif defined GNULIB_POSIXCHECK
-# undef nl_langinfo
-# if HAVE_RAW_DECL_NL_LANGINFO
-_GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - "
-                 "use gnulib module nl_langinfo for portability");
-# endif
-#endif
-
-
-#endif /* _@GUARD_PREFIX@_LANGINFO_H */
-#endif /* _@GUARD_PREFIX@_LANGINFO_H */

+ 0 - 558
gl/localcharset.c~

@@ -1,558 +0,0 @@
-/* Determine a canonical name for the current locale's character encoding.
-
-   Copyright (C) 2000-2006, 2008-2013 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Bruno Haible <bruno@clisp.org>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include "localcharset.h"
-
-#include <fcntl.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#if defined __APPLE__ && defined __MACH__ && HAVE_LANGINFO_CODESET
-# define DARWIN7 /* Darwin 7 or newer, i.e. Mac OS X 10.3 or newer */
-#endif
-
-#if defined _WIN32 || defined __WIN32__
-# define WINDOWS_NATIVE
-#endif
-
-#if defined __EMX__
-/* Assume EMX program runs on OS/2, even if compiled under DOS.  */
-# ifndef OS2
-#  define OS2
-# endif
-#endif
-
-#if !defined WINDOWS_NATIVE
-# include <unistd.h>
-# if HAVE_LANGINFO_CODESET
-#  include <langinfo.h>
-# else
-#  if 0 /* see comment below */
-#   include <locale.h>
-#  endif
-# endif
-# ifdef __CYGWIN__
-#  define WIN32_LEAN_AND_MEAN
-#  include <windows.h>
-# endif
-#elif defined WINDOWS_NATIVE
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-#endif
-#if defined OS2
-# define INCL_DOS
-# include <os2.h>
-#endif
-
-/* For MB_CUR_MAX_L */
-#if defined DARWIN7
-# include <xlocale.h>
-#endif
-
-#if ENABLE_RELOCATABLE
-# include "relocatable.h"
-#else
-# define relocate(pathname) (pathname)
-#endif
-
-/* Get LIBDIR.  */
-#ifndef LIBDIR
-# include "configmake.h"
-#endif
-
-/* Define O_NOFOLLOW to 0 on platforms where it does not exist.  */
-#ifndef O_NOFOLLOW
-# define O_NOFOLLOW 0
-#endif
-
-#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
-  /* Native Windows, Cygwin, OS/2, DOS */
-# define ISSLASH(C) ((C) == '/' || (C) == '\\')
-#endif
-
-#ifndef DIRECTORY_SEPARATOR
-# define DIRECTORY_SEPARATOR '/'
-#endif
-
-#ifndef ISSLASH
-# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
-#endif
-
-#if HAVE_DECL_GETC_UNLOCKED
-# undef getc
-# define getc getc_unlocked
-#endif
-
-/* The following static variable is declared 'volatile' to avoid a
-   possible multithread problem in the function get_charset_aliases. If we
-   are running in a threaded environment, and if two threads initialize
-   'charset_aliases' simultaneously, both will produce the same value,
-   and everything will be ok if the two assignments to 'charset_aliases'
-   are atomic. But I don't know what will happen if the two assignments mix.  */
-#if __STDC__ != 1
-# define volatile /* empty */
-#endif
-/* Pointer to the contents of the charset.alias file, if it has already been
-   read, else NULL.  Its format is:
-   ALIAS_1 '\0' CANONICAL_1 '\0' ... ALIAS_n '\0' CANONICAL_n '\0' '\0'  */
-static const char * volatile charset_aliases;
-
-/* Return a pointer to the contents of the charset.alias file.  */
-static const char *
-get_charset_aliases (void)
-{
-  const char *cp;
-
-  cp = charset_aliases;
-  if (cp == NULL)
-    {
-#if !(defined DARWIN7 || defined VMS || defined WINDOWS_NATIVE || defined __CYGWIN__)
-      const char *dir;
-      const char *base = "charset.alias";
-      char *file_name;
-
-      /* Make it possible to override the charset.alias location.  This is
-         necessary for running the testsuite before "make install".  */
-      dir = getenv ("CHARSETALIASDIR");
-      if (dir == NULL || dir[0] == '\0')
-        dir = relocate (LIBDIR);
-
-      /* Concatenate dir and base into freshly allocated file_name.  */
-      {
-        size_t dir_len = strlen (dir);
-        size_t base_len = strlen (base);
-        int add_slash = (dir_len > 0 && !ISSLASH (dir[dir_len - 1]));
-        file_name = (char *) malloc (dir_len + add_slash + base_len + 1);
-        if (file_name != NULL)
-          {
-            memcpy (file_name, dir, dir_len);
-            if (add_slash)
-              file_name[dir_len] = DIRECTORY_SEPARATOR;
-            memcpy (file_name + dir_len + add_slash, base, base_len + 1);
-          }
-      }
-
-      if (file_name == NULL)
-        /* Out of memory.  Treat the file as empty.  */
-        cp = "";
-      else
-        {
-          int fd;
-
-          /* Open the file.  Reject symbolic links on platforms that support
-             O_NOFOLLOW.  This is a security feature.  Without it, an attacker
-             could retrieve parts of the contents (namely, the tail of the
-             first line that starts with "* ") of an arbitrary file by placing
-             a symbolic link to that file under the name "charset.alias" in
-             some writable directory and defining the environment variable
-             CHARSETALIASDIR to point to that directory.  */
-          fd = open (file_name,
-                     O_RDONLY | (HAVE_WORKING_O_NOFOLLOW ? O_NOFOLLOW : 0));
-          if (fd < 0)
-            /* File not found.  Treat it as empty.  */
-            cp = "";
-          else
-            {
-              FILE *fp;
-
-              fp = fdopen (fd, "r");
-              if (fp == NULL)
-                {
-                  /* Out of memory.  Treat the file as empty.  */
-                  close (fd);
-                  cp = "";
-                }
-              else
-                {
-                  /* Parse the file's contents.  */
-                  char *res_ptr = NULL;
-                  size_t res_size = 0;
-
-                  for (;;)
-                    {
-                      int c;
-                      char buf1[50+1];
-                      char buf2[50+1];
-                      size_t l1, l2;
-                      char *old_res_ptr;
-
-                      c = getc (fp);
-                      if (c == EOF)
-                        break;
-                      if (c == '\n' || c == ' ' || c == '\t')
-                        continue;
-                      if (c == '#')
-                        {
-                          /* Skip comment, to end of line.  */
-                          do
-                            c = getc (fp);
-                          while (!(c == EOF || c == '\n'));
-                          if (c == EOF)
-                            break;
-                          continue;
-                        }
-                      ungetc (c, fp);
-                      if (fscanf (fp, "%50s %50s", buf1, buf2) < 2)
-                        break;
-                      l1 = strlen (buf1);
-                      l2 = strlen (buf2);
-                      old_res_ptr = res_ptr;
-                      if (res_size == 0)
-                        {
-                          res_size = l1 + 1 + l2 + 1;
-                          res_ptr = (char *) malloc (res_size + 1);
-                        }
-                      else
-                        {
-                          res_size += l1 + 1 + l2 + 1;
-                          res_ptr = (char *) realloc (res_ptr, res_size + 1);
-                        }
-                      if (res_ptr == NULL)
-                        {
-                          /* Out of memory. */
-                          res_size = 0;
-                          free (old_res_ptr);
-                          break;
-                        }
-                      strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1);
-                      strcpy (res_ptr + res_size - (l2 + 1), buf2);
-                    }
-                  fclose (fp);
-                  if (res_size == 0)
-                    cp = "";
-                  else
-                    {
-                      *(res_ptr + res_size) = '\0';
-                      cp = res_ptr;
-                    }
-                }
-            }
-
-          free (file_name);
-        }
-
-#else
-
-# if defined DARWIN7
-      /* To avoid the trouble of installing a file that is shared by many
-         GNU packages -- many packaging systems have problems with this --,
-         simply inline the aliases here.  */
-      cp = "ISO8859-1" "\0" "ISO-8859-1" "\0"
-           "ISO8859-2" "\0" "ISO-8859-2" "\0"
-           "ISO8859-4" "\0" "ISO-8859-4" "\0"
-           "ISO8859-5" "\0" "ISO-8859-5" "\0"
-           "ISO8859-7" "\0" "ISO-8859-7" "\0"
-           "ISO8859-9" "\0" "ISO-8859-9" "\0"
-           "ISO8859-13" "\0" "ISO-8859-13" "\0"
-           "ISO8859-15" "\0" "ISO-8859-15" "\0"
-           "KOI8-R" "\0" "KOI8-R" "\0"
-           "KOI8-U" "\0" "KOI8-U" "\0"
-           "CP866" "\0" "CP866" "\0"
-           "CP949" "\0" "CP949" "\0"
-           "CP1131" "\0" "CP1131" "\0"
-           "CP1251" "\0" "CP1251" "\0"
-           "eucCN" "\0" "GB2312" "\0"
-           "GB2312" "\0" "GB2312" "\0"
-           "eucJP" "\0" "EUC-JP" "\0"
-           "eucKR" "\0" "EUC-KR" "\0"
-           "Big5" "\0" "BIG5" "\0"
-           "Big5HKSCS" "\0" "BIG5-HKSCS" "\0"
-           "GBK" "\0" "GBK" "\0"
-           "GB18030" "\0" "GB18030" "\0"
-           "SJIS" "\0" "SHIFT_JIS" "\0"
-           "ARMSCII-8" "\0" "ARMSCII-8" "\0"
-           "PT154" "\0" "PT154" "\0"
-         /*"ISCII-DEV" "\0" "?" "\0"*/
-           "*" "\0" "UTF-8" "\0";
-# endif
-
-# if defined VMS
-      /* To avoid the troubles of an extra file charset.alias_vms in the
-         sources of many GNU packages, simply inline the aliases here.  */
-      /* The list of encodings is taken from the OpenVMS 7.3-1 documentation
-         "Compaq C Run-Time Library Reference Manual for OpenVMS systems"
-         section 10.7 "Handling Different Character Sets".  */
-      cp = "ISO8859-1" "\0" "ISO-8859-1" "\0"
-           "ISO8859-2" "\0" "ISO-8859-2" "\0"
-           "ISO8859-5" "\0" "ISO-8859-5" "\0"
-           "ISO8859-7" "\0" "ISO-8859-7" "\0"
-           "ISO8859-8" "\0" "ISO-8859-8" "\0"
-           "ISO8859-9" "\0" "ISO-8859-9" "\0"
-           /* Japanese */
-           "eucJP" "\0" "EUC-JP" "\0"
-           "SJIS" "\0" "SHIFT_JIS" "\0"
-           "DECKANJI" "\0" "DEC-KANJI" "\0"
-           "SDECKANJI" "\0" "EUC-JP" "\0"
-           /* Chinese */
-           "eucTW" "\0" "EUC-TW" "\0"
-           "DECHANYU" "\0" "DEC-HANYU" "\0"
-           "DECHANZI" "\0" "GB2312" "\0"
-           /* Korean */
-           "DECKOREAN" "\0" "EUC-KR" "\0";
-# endif
-
-# if defined WINDOWS_NATIVE || defined __CYGWIN__
-      /* To avoid the troubles of installing a separate file in the same
-         directory as the DLL and of retrieving the DLL's directory at
-         runtime, simply inline the aliases here.  */
-
-      cp = "CP936" "\0" "GBK" "\0"
-           "CP1361" "\0" "JOHAB" "\0"
-           "CP20127" "\0" "ASCII" "\0"
-           "CP20866" "\0" "KOI8-R" "\0"
-           "CP20936" "\0" "GB2312" "\0"
-           "CP21866" "\0" "KOI8-RU" "\0"
-           "CP28591" "\0" "ISO-8859-1" "\0"
-           "CP28592" "\0" "ISO-8859-2" "\0"
-           "CP28593" "\0" "ISO-8859-3" "\0"
-           "CP28594" "\0" "ISO-8859-4" "\0"
-           "CP28595" "\0" "ISO-8859-5" "\0"
-           "CP28596" "\0" "ISO-8859-6" "\0"
-           "CP28597" "\0" "ISO-8859-7" "\0"
-           "CP28598" "\0" "ISO-8859-8" "\0"
-           "CP28599" "\0" "ISO-8859-9" "\0"
-           "CP28605" "\0" "ISO-8859-15" "\0"
-           "CP38598" "\0" "ISO-8859-8" "\0"
-           "CP51932" "\0" "EUC-JP" "\0"
-           "CP51936" "\0" "GB2312" "\0"
-           "CP51949" "\0" "EUC-KR" "\0"
-           "CP51950" "\0" "EUC-TW" "\0"
-           "CP54936" "\0" "GB18030" "\0"
-           "CP65001" "\0" "UTF-8" "\0";
-# endif
-#endif
-
-      charset_aliases = cp;
-    }
-
-  return cp;
-}
-
-/* Determine the current locale's character encoding, and canonicalize it
-   into one of the canonical names listed in config.charset.
-   The result must not be freed; it is statically allocated.
-   If the canonical name cannot be determined, the result is a non-canonical
-   name.  */
-
-#ifdef STATIC
-STATIC
-#endif
-const char *
-locale_charset (void)
-{
-  const char *codeset;
-  const char *aliases;
-
-#if !(defined WINDOWS_NATIVE || defined OS2)
-
-# if HAVE_LANGINFO_CODESET
-
-  /* Most systems support nl_langinfo (CODESET) nowadays.  */
-  codeset = nl_langinfo (CODESET);
-
-#  ifdef __CYGWIN__
-  /* Cygwin < 1.7 does not have locales.  nl_langinfo (CODESET) always
-     returns "US-ASCII".  Return the suffix of the locale name from the
-     environment variables (if present) or the codepage as a number.  */
-  if (codeset != NULL && strcmp (codeset, "US-ASCII") == 0)
-    {
-      const char *locale;
-      static char buf[2 + 10 + 1];
-
-      locale = getenv ("LC_ALL");
-      if (locale == NULL || locale[0] == '\0')
-        {
-          locale = getenv ("LC_CTYPE");
-          if (locale == NULL || locale[0] == '\0')
-            locale = getenv ("LANG");
-        }
-      if (locale != NULL && locale[0] != '\0')
-        {
-          /* If the locale name contains an encoding after the dot, return
-             it.  */
-          const char *dot = strchr (locale, '.');
-
-          if (dot != NULL)
-            {
-              const char *modifier;
-
-              dot++;
-              /* Look for the possible @... trailer and remove it, if any.  */
-              modifier = strchr (dot, '@');
-              if (modifier == NULL)
-                return dot;
-              if (modifier - dot < sizeof (buf))
-                {
-                  memcpy (buf, dot, modifier - dot);
-                  buf [modifier - dot] = '\0';
-                  return buf;
-                }
-            }
-        }
-
-      /* The Windows API has a function returning the locale's codepage as a
-         number: GetACP().  This encoding is used by Cygwin, unless the user
-         has set the environment variable CYGWIN=codepage:oem (which very few
-         people do).
-         Output directed to console windows needs to be converted (to
-         GetOEMCP() if the console is using a raster font, or to
-         GetConsoleOutputCP() if it is using a TrueType font).  Cygwin does
-         this conversion transparently (see winsup/cygwin/fhandler_console.cc),
-         converting to GetConsoleOutputCP().  This leads to correct results,
-         except when SetConsoleOutputCP has been called and a raster font is
-         in use.  */
-      sprintf (buf, "CP%u", GetACP ());
-      codeset = buf;
-    }
-#  endif
-
-# else
-
-  /* On old systems which lack it, use setlocale or getenv.  */
-  const char *locale = NULL;
-
-  /* But most old systems don't have a complete set of locales.  Some
-     (like SunOS 4 or DJGPP) have only the C locale.  Therefore we don't
-     use setlocale here; it would return "C" when it doesn't support the
-     locale name the user has set.  */
-#  if 0
-  locale = setlocale (LC_CTYPE, NULL);
-#  endif
-  if (locale == NULL || locale[0] == '\0')
-    {
-      locale = getenv ("LC_ALL");
-      if (locale == NULL || locale[0] == '\0')
-        {
-          locale = getenv ("LC_CTYPE");
-          if (locale == NULL || locale[0] == '\0')
-            locale = getenv ("LANG");
-        }
-    }
-
-  /* On some old systems, one used to set locale = "iso8859_1". On others,
-     you set it to "language_COUNTRY.charset". In any case, we resolve it
-     through the charset.alias file.  */
-  codeset = locale;
-
-# endif
-
-#elif defined WINDOWS_NATIVE
-
-  static char buf[2 + 10 + 1];
-
-  /* The Windows API has a function returning the locale's codepage as a
-     number: GetACP().
-     When the output goes to a console window, it needs to be provided in
-     GetOEMCP() encoding if the console is using a raster font, or in
-     GetConsoleOutputCP() encoding if it is using a TrueType font.
-     But in GUI programs and for output sent to files and pipes, GetACP()
-     encoding is the best bet.  */
-  sprintf (buf, "CP%u", GetACP ());
-  codeset = buf;
-
-#elif defined OS2
-
-  const char *locale;
-  static char buf[2 + 10 + 1];
-  ULONG cp[3];
-  ULONG cplen;
-
-  /* Allow user to override the codeset, as set in the operating system,
-     with standard language environment variables.  */
-  locale = getenv ("LC_ALL");
-  if (locale == NULL || locale[0] == '\0')
-    {
-      locale = getenv ("LC_CTYPE");
-      if (locale == NULL || locale[0] == '\0')
-        locale = getenv ("LANG");
-    }
-  if (locale != NULL && locale[0] != '\0')
-    {
-      /* If the locale name contains an encoding after the dot, return it.  */
-      const char *dot = strchr (locale, '.');
-
-      if (dot != NULL)
-        {
-          const char *modifier;
-
-          dot++;
-          /* Look for the possible @... trailer and remove it, if any.  */
-          modifier = strchr (dot, '@');
-          if (modifier == NULL)
-            return dot;
-          if (modifier - dot < sizeof (buf))
-            {
-              memcpy (buf, dot, modifier - dot);
-              buf [modifier - dot] = '\0';
-              return buf;
-            }
-        }
-
-      /* Resolve through the charset.alias file.  */
-      codeset = locale;
-    }
-  else
-    {
-      /* OS/2 has a function returning the locale's codepage as a number.  */
-      if (DosQueryCp (sizeof (cp), cp, &cplen))
-        codeset = "";
-      else
-        {
-          sprintf (buf, "CP%u", cp[0]);
-          codeset = buf;
-        }
-    }
-
-#endif
-
-  if (codeset == NULL)
-    /* The canonical name cannot be determined.  */
-    codeset = "";
-
-  /* Resolve alias. */
-  for (aliases = get_charset_aliases ();
-       *aliases != '\0';
-       aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
-    if (strcmp (codeset, aliases) == 0
-        || (aliases[0] == '*' && aliases[1] == '\0'))
-      {
-        codeset = aliases + strlen (aliases) + 1;
-        break;
-      }
-
-  /* Don't return an empty string.  GNU libc and GNU libiconv interpret
-     the empty string as denoting "the locale's character encoding",
-     thus GNU libiconv would call this function a second time.  */
-  if (codeset[0] == '\0')
-    codeset = "ASCII";
-
-#ifdef DARWIN7
-  /* Mac OS X sets MB_CUR_MAX to 1 when LC_ALL=C, and "UTF-8"
-     (the default codeset) does not work when MB_CUR_MAX is 1.  */
-  if (strcmp (codeset, "UTF-8") == 0 && MB_CUR_MAX_L (uselocale (NULL)) <= 1)
-    codeset = "ASCII";
-#endif
-
-  return codeset;
-}

+ 0 - 40
gl/localcharset.h~

@@ -1,40 +0,0 @@
-/* Determine a canonical name for the current locale's character encoding.
-   Copyright (C) 2000-2003, 2009-2013 Free Software Foundation, Inc.
-   This file is part of the GNU CHARSET Library.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef NAGIOS_GL_LOCALCHARSET_H_INCLUDED
-#define NAGIOS_GL_LOCALCHARSET_H_INCLUDED
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Determine the current locale's character encoding, and canonicalize it
-   into one of the canonical names listed in config.charset.
-   The result must not be freed; it is statically allocated.
-   If the canonical name cannot be determined, the result is a non-canonical
-   name.  */
-extern const char * locale_charset (void);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* NAGIOS_GL_LOCALCHARSET_H_INCLUDED */

+ 0 - 216
gl/locale.in.h~

@@ -1,216 +0,0 @@
-/* A POSIX <locale.h>.
-   Copyright (C) 2007-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-#ifdef _GL_ALREADY_INCLUDING_LOCALE_H
-
-/* Special invocation conventions to handle Solaris header files
-   (through Solaris 10) when combined with gettext's libintl.h.  */
-
-#@INCLUDE_NEXT@ @NEXT_LOCALE_H@
-
-#else
-/* Normal invocation convention.  */
-
-#ifndef _@GUARD_PREFIX@_LOCALE_H
-
-#define _GL_ALREADY_INCLUDING_LOCALE_H
-
-/* The include_next requires a split double-inclusion guard.  */
-#@INCLUDE_NEXT@ @NEXT_LOCALE_H@
-
-#undef _GL_ALREADY_INCLUDING_LOCALE_H
-
-#ifndef _@GUARD_PREFIX@_LOCALE_H
-#define _@GUARD_PREFIX@_LOCALE_H
-
-/* NetBSD 5.0 mis-defines NULL.  */
-#include <stddef.h>
-
-/* Mac OS X 10.5 defines the locale_t type in <xlocale.h>.  */
-#if @HAVE_XLOCALE_H@
-# include <xlocale.h>
-#endif
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
-
-/* The definition of _GL_ARG_NONNULL is copied here.  */
-
-/* The definition of _GL_WARN_ON_USE is copied here.  */
-
-/* The LC_MESSAGES locale category is specified in POSIX, but not in ISO C.
-   On systems that don't define it, use the same value as GNU libintl.  */
-#if !defined LC_MESSAGES
-# define LC_MESSAGES 1729
-#endif
-
-/* Bionic libc's 'struct lconv' is just a dummy.  */
-#if @REPLACE_STRUCT_LCONV@
-# define lconv rpl_lconv
-struct lconv
-{
-  /* All 'char *' are actually 'const char *'.  */
-
-  /* Members that depend on the LC_NUMERIC category of the locale.  See
-     <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_04> */
-
-  /* Symbol used as decimal point.  */
-  char *decimal_point;
-  /* Symbol used to separate groups of digits to the left of the decimal
-     point.  */
-  char *thousands_sep;
-  /* Definition of the size of groups of digits to the left of the decimal
-     point.  */
-  char *grouping;
-
-  /* Members that depend on the LC_MONETARY category of the locale.  See
-     <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_03> */
-
-  /* Symbol used as decimal point.  */
-  char *mon_decimal_point;
-  /* Symbol used to separate groups of digits to the left of the decimal
-     point.  */
-  char *mon_thousands_sep;
-  /* Definition of the size of groups of digits to the left of the decimal
-     point.  */
-  char *mon_grouping;
-  /* Sign used to indicate a value >= 0.  */
-  char *positive_sign;
-  /* Sign used to indicate a value < 0.  */
-  char *negative_sign;
-
-  /* For formatting local currency.  */
-  /* Currency symbol (3 characters) followed by separator (1 character).  */
-  char *currency_symbol;
-  /* Number of digits after the decimal point.  */
-  char frac_digits;
-  /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it
-     comes after the number.  */
-  char p_cs_precedes;
-  /* For values >= 0: Position of the sign.  */
-  char p_sign_posn;
-  /* For values >= 0: Placement of spaces between currency symbol, sign, and
-     number.  */
-  char p_sep_by_space;
-  /* For values < 0: 1 if the currency symbol precedes the number, 0 if it
-     comes after the number.  */
-  char n_cs_precedes;
-  /* For values < 0: Position of the sign.  */
-  char n_sign_posn;
-  /* For values < 0: Placement of spaces between currency symbol, sign, and
-     number.  */
-  char n_sep_by_space;
-
-  /* For formatting international currency.  */
-  /* Currency symbol (3 characters) followed by separator (1 character).  */
-  char *int_curr_symbol;
-  /* Number of digits after the decimal point.  */
-  char int_frac_digits;
-  /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it
-     comes after the number.  */
-  char int_p_cs_precedes;
-  /* For values >= 0: Position of the sign.  */
-  char int_p_sign_posn;
-  /* For values >= 0: Placement of spaces between currency symbol, sign, and
-     number.  */
-  char int_p_sep_by_space;
-  /* For values < 0: 1 if the currency symbol precedes the number, 0 if it
-     comes after the number.  */
-  char int_n_cs_precedes;
-  /* For values < 0: Position of the sign.  */
-  char int_n_sign_posn;
-  /* For values < 0: Placement of spaces between currency symbol, sign, and
-     number.  */
-  char int_n_sep_by_space;
-};
-#endif
-
-#if @GNULIB_LOCALECONV@
-# if @REPLACE_LOCALECONV@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef localeconv
-#   define localeconv rpl_localeconv
-#  endif
-_GL_FUNCDECL_RPL (localeconv, struct lconv *, (void));
-_GL_CXXALIAS_RPL (localeconv, struct lconv *, (void));
-# else
-_GL_CXXALIAS_SYS (localeconv, struct lconv *, (void));
-# endif
-_GL_CXXALIASWARN (localeconv);
-#elif @REPLACE_STRUCT_LCONV@
-# undef localeconv
-# define localeconv localeconv_used_without_requesting_gnulib_module_localeconv
-#elif defined GNULIB_POSIXCHECK
-# undef localeconv
-# if HAVE_RAW_DECL_LOCALECONV
-_GL_WARN_ON_USE (localeconv,
-                 "localeconv returns too few information on some platforms - "
-                 "use gnulib module localeconv for portability");
-# endif
-#endif
-
-#if @GNULIB_SETLOCALE@
-# if @REPLACE_SETLOCALE@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef setlocale
-#   define setlocale rpl_setlocale
-#   define GNULIB_defined_setlocale 1
-#  endif
-_GL_FUNCDECL_RPL (setlocale, char *, (int category, const char *locale));
-_GL_CXXALIAS_RPL (setlocale, char *, (int category, const char *locale));
-# else
-_GL_CXXALIAS_SYS (setlocale, char *, (int category, const char *locale));
-# endif
-_GL_CXXALIASWARN (setlocale);
-#elif defined GNULIB_POSIXCHECK
-# undef setlocale
-# if HAVE_RAW_DECL_SETLOCALE
-_GL_WARN_ON_USE (setlocale, "setlocale works differently on native Windows - "
-                 "use gnulib module setlocale for portability");
-# endif
-#endif
-
-#if @GNULIB_DUPLOCALE@
-# if @REPLACE_DUPLOCALE@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef duplocale
-#   define duplocale rpl_duplocale
-#  endif
-_GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale));
-# else
-#  if @HAVE_DUPLOCALE@
-_GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale));
-#  endif
-# endif
-# if @HAVE_DUPLOCALE@
-_GL_CXXALIASWARN (duplocale);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef duplocale
-# if HAVE_RAW_DECL_DUPLOCALE
-_GL_WARN_ON_USE (duplocale, "duplocale is buggy on some glibc systems - "
-                 "use gnulib module duplocale for portability");
-# endif
-#endif
-
-#endif /* _@GUARD_PREFIX@_LOCALE_H */
-#endif /* ! _GL_ALREADY_INCLUDING_LOCALE_H */
-#endif /* _@GUARD_PREFIX@_LOCALE_H */

+ 0 - 103
gl/localeconv.c~

@@ -1,103 +0,0 @@
-/* Query locale dependent information for formatting numbers.
-   Copyright (C) 2012-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include <locale.h>
-
-#if HAVE_STRUCT_LCONV_DECIMAL_POINT
-
-/* Override for platforms where 'struct lconv' lacks the int_p_*, int_n_*
-   members.  */
-
-struct lconv *
-localeconv (void)
-{
-  static struct lconv result;
-# undef lconv
-# undef localeconv
-  struct lconv *sys_result = localeconv ();
-
-  result.decimal_point = sys_result->decimal_point;
-  result.thousands_sep = sys_result->thousands_sep;
-  result.grouping = sys_result->grouping;
-  result.mon_decimal_point = sys_result->mon_decimal_point;
-  result.mon_thousands_sep = sys_result->mon_thousands_sep;
-  result.mon_grouping = sys_result->mon_grouping;
-  result.positive_sign = sys_result->positive_sign;
-  result.negative_sign = sys_result->negative_sign;
-  result.currency_symbol = sys_result->currency_symbol;
-  result.frac_digits = sys_result->frac_digits;
-  result.p_cs_precedes = sys_result->p_cs_precedes;
-  result.p_sign_posn = sys_result->p_sign_posn;
-  result.p_sep_by_space = sys_result->p_sep_by_space;
-  result.n_cs_precedes = sys_result->n_cs_precedes;
-  result.n_sign_posn = sys_result->n_sign_posn;
-  result.n_sep_by_space = sys_result->n_sep_by_space;
-  result.int_curr_symbol = sys_result->int_curr_symbol;
-  result.int_frac_digits = sys_result->int_frac_digits;
-  result.int_p_cs_precedes = sys_result->p_cs_precedes;
-  result.int_p_sign_posn = sys_result->p_sign_posn;
-  result.int_p_sep_by_space = sys_result->p_sep_by_space;
-  result.int_n_cs_precedes = sys_result->n_cs_precedes;
-  result.int_n_sign_posn = sys_result->n_sign_posn;
-  result.int_n_sep_by_space = sys_result->n_sep_by_space;
-
-  return &result;
-}
-
-#else
-
-/* Override for platforms where 'struct lconv' is a dummy.  */
-
-# include <limits.h>
-
-struct lconv *
-localeconv (void)
-{
-  static /*const*/ struct lconv result =
-    {
-      /* decimal_point */ ".",
-      /* thousands_sep */ "",
-      /* grouping */ "",
-      /* mon_decimal_point */ "",
-      /* mon_thousands_sep */ "",
-      /* mon_grouping */ "",
-      /* positive_sign */ "",
-      /* negative_sign */ "",
-      /* currency_symbol */ "",
-      /* frac_digits */ CHAR_MAX,
-      /* p_cs_precedes */ CHAR_MAX,
-      /* p_sign_posn */ CHAR_MAX,
-      /* p_sep_by_space */ CHAR_MAX,
-      /* n_cs_precedes */ CHAR_MAX,
-      /* n_sign_posn */ CHAR_MAX,
-      /* n_sep_by_space */ CHAR_MAX,
-      /* int_curr_symbol */ "",
-      /* int_frac_digits */ CHAR_MAX,
-      /* int_p_cs_precedes */ CHAR_MAX,
-      /* int_p_sign_posn */ CHAR_MAX,
-      /* int_p_sep_by_space */ CHAR_MAX,
-      /* int_n_cs_precedes */ CHAR_MAX,
-      /* int_n_sign_posn */ CHAR_MAX,
-      /* int_n_sep_by_space */ CHAR_MAX
-    };
-
-  return &result;
-}
-
-#endif

+ 0 - 56
gl/malloc.c~

@@ -1,56 +0,0 @@
-/* malloc() function that is glibc compatible.
-
-   Copyright (C) 1997-1998, 2006-2007, 2009-2013 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-/* written by Jim Meyering and Bruno Haible */
-
-#define _GL_USE_STDLIB_ALLOC 1
-#include <config.h>
-/* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h.  */
-#ifdef malloc
-# define NEED_MALLOC_GNU 1
-# undef malloc
-/* Whereas the gnulib module 'malloc-gnu' defines HAVE_MALLOC_GNU.  */
-#elif GNULIB_MALLOC_GNU && !HAVE_MALLOC_GNU
-# define NEED_MALLOC_GNU 1
-#endif
-
-#include <stdlib.h>
-
-#include <errno.h>
-
-/* Allocate an N-byte block of memory from the heap.
-   If N is zero, allocate a 1-byte block.  */
-
-void *
-rpl_malloc (size_t n)
-{
-  void *result;
-
-#if NEED_MALLOC_GNU
-  if (n == 0)
-    n = 1;
-#endif
-
-  result = malloc (n);
-
-#if !HAVE_MALLOC_POSIX
-  if (result == NULL)
-    errno = ENOMEM;
-#endif
-
-  return result;
-}

+ 0 - 149
gl/malloca.c~

@@ -1,149 +0,0 @@
-/* Safe automatic memory allocation.
-   Copyright (C) 2003, 2006-2007, 2009-2013 Free Software Foundation, Inc.
-   Written by Bruno Haible <bruno@clisp.org>, 2003.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#define _GL_USE_STDLIB_ALLOC 1
-#include <config.h>
-
-/* Specification.  */
-#include "malloca.h"
-
-#include <stdint.h>
-
-#include "verify.h"
-
-/* The speed critical point in this file is freea() applied to an alloca()
-   result: it must be fast, to match the speed of alloca().  The speed of
-   mmalloca() and freea() in the other case are not critical, because they
-   are only invoked for big memory sizes.  */
-
-#if HAVE_ALLOCA
-
-/* Store the mmalloca() results in a hash table.  This is needed to reliably
-   distinguish a mmalloca() result and an alloca() result.
-
-   Although it is possible that the same pointer is returned by alloca() and
-   by mmalloca() at different times in the same application, it does not lead
-   to a bug in freea(), because:
-     - Before a pointer returned by alloca() can point into malloc()ed memory,
-       the function must return, and once this has happened the programmer must
-       not call freea() on it anyway.
-     - Before a pointer returned by mmalloca() can point into the stack, it
-       must be freed.  The only function that can free it is freea(), and
-       when freea() frees it, it also removes it from the hash table.  */
-
-#define MAGIC_NUMBER 0x1415fb4a
-#define MAGIC_SIZE sizeof (int)
-/* This is how the header info would look like without any alignment
-   considerations.  */
-struct preliminary_header { void *next; int magic; };
-/* But the header's size must be a multiple of sa_alignment_max.  */
-#define HEADER_SIZE \
-  (((sizeof (struct preliminary_header) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max)
-union header {
-  void *next;
-  struct {
-    char room[HEADER_SIZE - MAGIC_SIZE];
-    int word;
-  } magic;
-};
-verify (HEADER_SIZE == sizeof (union header));
-/* We make the hash table quite big, so that during lookups the probability
-   of empty hash buckets is quite high.  There is no need to make the hash
-   table resizable, because when the hash table gets filled so much that the
-   lookup becomes slow, it means that the application has memory leaks.  */
-#define HASH_TABLE_SIZE 257
-static void * mmalloca_results[HASH_TABLE_SIZE];
-
-#endif
-
-void *
-mmalloca (size_t n)
-{
-#if HAVE_ALLOCA
-  /* Allocate one more word, that serves as an indicator for malloc()ed
-     memory, so that freea() of an alloca() result is fast.  */
-  size_t nplus = n + HEADER_SIZE;
-
-  if (nplus >= n)
-    {
-      void *p = malloc (nplus);
-
-      if (p != NULL)
-        {
-          size_t slot;
-          union header *h = p;
-
-          p = h + 1;
-
-          /* Put a magic number into the indicator word.  */
-          h->magic.word = MAGIC_NUMBER;
-
-          /* Enter p into the hash table.  */
-          slot = (uintptr_t) p % HASH_TABLE_SIZE;
-          h->next = mmalloca_results[slot];
-          mmalloca_results[slot] = p;
-
-          return p;
-        }
-    }
-  /* Out of memory.  */
-  return NULL;
-#else
-# if !MALLOC_0_IS_NONNULL
-  if (n == 0)
-    n = 1;
-# endif
-  return malloc (n);
-#endif
-}
-
-#if HAVE_ALLOCA
-void
-freea (void *p)
-{
-  /* mmalloca() may have returned NULL.  */
-  if (p != NULL)
-    {
-      /* Attempt to quickly distinguish the mmalloca() result - which has
-         a magic indicator word - and the alloca() result - which has an
-         uninitialized indicator word.  It is for this test that sa_increment
-         additional bytes are allocated in the alloca() case.  */
-      if (((int *) p)[-1] == MAGIC_NUMBER)
-        {
-          /* Looks like a mmalloca() result.  To see whether it really is one,
-             perform a lookup in the hash table.  */
-          size_t slot = (uintptr_t) p % HASH_TABLE_SIZE;
-          void **chain = &mmalloca_results[slot];
-          for (; *chain != NULL;)
-            {
-              union header *h = p;
-              if (*chain == p)
-                {
-                  /* Found it.  Remove it from the hash table and free it.  */
-                  union header *p_begin = h - 1;
-                  *chain = p_begin->next;
-                  free (p_begin);
-                  return;
-                }
-              h = *chain;
-              chain = &h[-1].next;
-            }
-        }
-      /* At this point, we know it was not a mmalloca() result.  */
-    }
-}
-#endif

+ 0 - 133
gl/malloca.h~

@@ -1,133 +0,0 @@
-/* Safe automatic memory allocation.
-   Copyright (C) 2003-2007, 2009-2013 Free Software Foundation, Inc.
-   Written by Bruno Haible <bruno@clisp.org>, 2003.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef NAGIOS_MALLOCA_H_INCLUDED
-#define NAGIOS_MALLOCA_H_INCLUDED
-
-#include <alloca.h>
-#include <stddef.h>
-#include <stdlib.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* safe_alloca(N) is equivalent to alloca(N) when it is safe to call
-   alloca(N); otherwise it returns NULL.  It either returns N bytes of
-   memory allocated on the stack, that lasts until the function returns,
-   or NULL.
-   Use of safe_alloca should be avoided:
-     - inside arguments of function calls - undefined behaviour,
-     - in inline functions - the allocation may actually last until the
-       calling function returns.
-*/
-#if HAVE_ALLOCA
-/* The OS usually guarantees only one guard page at the bottom of the stack,
-   and a page size can be as small as 4096 bytes.  So we cannot safely
-   allocate anything larger than 4096 bytes.  Also care for the possibility
-   of a few compiler-allocated temporary stack slots.
-   This must be a macro, not a function.  */
-# define safe_alloca(N) ((N) < 4032 ? alloca (N) : NULL)
-#else
-# define safe_alloca(N) ((void) (N), NULL)
-#endif
-
-/* malloca(N) is a safe variant of alloca(N).  It allocates N bytes of
-   memory allocated on the stack, that must be freed using freea() before
-   the function returns.  Upon failure, it returns NULL.  */
-#if HAVE_ALLOCA
-# define malloca(N) \
-  ((N) < 4032 - sa_increment                                        \
-   ? (void *) ((char *) alloca ((N) + sa_increment) + sa_increment) \
-   : mmalloca (N))
-#else
-# define malloca(N) \
-  mmalloca (N)
-#endif
-extern void * mmalloca (size_t n);
-
-/* Free a block of memory allocated through malloca().  */
-#if HAVE_ALLOCA
-extern void freea (void *p);
-#else
-# define freea free
-#endif
-
-/* nmalloca(N,S) is an overflow-safe variant of malloca (N * S).
-   It allocates an array of N objects, each with S bytes of memory,
-   on the stack.  S must be positive and N must be nonnegative.
-   The array must be freed using freea() before the function returns.  */
-#if 1
-/* Cf. the definition of xalloc_oversized.  */
-# define nmalloca(n, s) \
-    ((n) > (size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) \
-     ? NULL \
-     : malloca ((n) * (s)))
-#else
-extern void * nmalloca (size_t n, size_t s);
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-/* ------------------- Auxiliary, non-public definitions ------------------- */
-
-/* Determine the alignment of a type at compile time.  */
-#if defined __GNUC__ || defined __IBM__ALIGNOF__
-# define sa_alignof __alignof__
-#elif defined __cplusplus
-  template <class type> struct sa_alignof_helper { char __slot1; type __slot2; };
-# define sa_alignof(type) offsetof (sa_alignof_helper<type>, __slot2)
-#elif defined __hpux
-  /* Work around a HP-UX 10.20 cc bug with enums constants defined as offsetof
-     values.  */
-# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8)
-#elif defined _AIX
-  /* Work around an AIX 3.2.5 xlc bug with enums constants defined as offsetof
-     values.  */
-# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8)
-#else
-# define sa_alignof(type) offsetof (struct { char __slot1; type __slot2; }, __slot2)
-#endif
-
-enum
-{
-/* The desired alignment of memory allocations is the maximum alignment
-   among all elementary types.  */
-  sa_alignment_long = sa_alignof (long),
-  sa_alignment_double = sa_alignof (double),
-#if HAVE_LONG_LONG_INT
-  sa_alignment_longlong = sa_alignof (long long),
-#endif
-  sa_alignment_longdouble = sa_alignof (long double),
-  sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1)
-#if HAVE_LONG_LONG_INT
-                      | (sa_alignment_longlong - 1)
-#endif
-                      | (sa_alignment_longdouble - 1)
-                     ) + 1,
-/* The increment that guarantees room for a magic word must be >= sizeof (int)
-   and a multiple of sa_alignment_max.  */
-  sa_increment = ((sizeof (int) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max
-};
-
-#endif /* NAGIOS_MALLOCA_H_INCLUDED */

+ 0 - 2275
gl/math.in.h~

@@ -1,2275 +0,0 @@
-/* A GNU-like <math.h>.
-
-   Copyright (C) 2002-2003, 2007-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef _@GUARD_PREFIX@_MATH_H
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-/* The include_next requires a split double-inclusion guard.  */
-#@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_MATH_H@
-
-#ifndef _@GUARD_PREFIX@_MATH_H
-#define _@GUARD_PREFIX@_MATH_H
-
-_GL_INLINE_HEADER_BEGIN
-#ifndef _GL_MATH_INLINE
-# define _GL_MATH_INLINE _GL_INLINE
-#endif
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
-
-/* The definition of _GL_ARG_NONNULL is copied here.  */
-
-/* The definition of _GL_WARN_ON_USE is copied here.  */
-
-#ifdef __cplusplus
-/* Helper macros to define type-generic function FUNC as overloaded functions,
-   rather than as macros like in C.  POSIX declares these with an argument of
-   real-floating (that is, one of float, double, or long double).  */
-# define _GL_MATH_CXX_REAL_FLOATING_DECL_1(func) \
-static inline int                                                   \
-_gl_cxx_ ## func ## f (float f)                                     \
-{                                                                   \
-  return func (f);                                                  \
-}                                                                   \
-static inline int                                                   \
-_gl_cxx_ ## func ## d (double d)                                    \
-{                                                                   \
-  return func (d);                                                  \
-}                                                                   \
-static inline int                                                   \
-_gl_cxx_ ## func ## l (long double l)                               \
-{                                                                   \
-  return func (l);                                                  \
-}
-# define _GL_MATH_CXX_REAL_FLOATING_DECL_2(func) \
-inline int                                                          \
-func (float f)                                                      \
-{                                                                   \
-  return _gl_cxx_ ## func ## f (f);                                 \
-}                                                                   \
-inline int                                                          \
-func (double d)                                                     \
-{                                                                   \
-  return _gl_cxx_ ## func ## d (d);                                 \
-}                                                                   \
-inline int                                                          \
-func (long double l)                                                \
-{                                                                   \
-  return _gl_cxx_ ## func ## l (l);                                 \
-}
-#endif
-
-/* Helper macros to define a portability warning for the
-   classification macro FUNC called with VALUE.  POSIX declares the
-   classification macros with an argument of real-floating (that is,
-   one of float, double, or long double).  */
-#define _GL_WARN_REAL_FLOATING_DECL(func) \
-_GL_MATH_INLINE int                                                 \
-rpl_ ## func ## f (float f)                                         \
-{                                                                   \
-  return func (f);                                                  \
-}                                                                   \
-_GL_MATH_INLINE int                                                 \
-rpl_ ## func ## d (double d)                                        \
-{                                                                   \
-  return func (d);                                                  \
-}                                                                   \
-_GL_MATH_INLINE int                                                 \
-rpl_ ## func ## l (long double l)                                   \
-{                                                                   \
-  return func (l);                                                  \
-}                                                                   \
-_GL_WARN_ON_USE (rpl_ ## func ## f, #func " is unportable - "       \
-                 "use gnulib module " #func " for portability");    \
-_GL_WARN_ON_USE (rpl_ ## func ## d, #func " is unportable - "       \
-                 "use gnulib module " #func " for portability");    \
-_GL_WARN_ON_USE (rpl_ ## func ## l, #func " is unportable - "       \
-                 "use gnulib module " #func " for portability")
-#define _GL_WARN_REAL_FLOATING_IMPL(func, value) \
-  (sizeof (value) == sizeof (float) ? rpl_ ## func ## f (value)     \
-   : sizeof (value) == sizeof (double) ? rpl_ ## func ## d (value)  \
-   : rpl_ ## func ## l (value))
-
-
-#if @REPLACE_ITOLD@
-/* Pull in a function that fixes the 'int' to 'long double' conversion
-   of glibc 2.7.  */
-_GL_EXTERN_C void _Qp_itoq (long double *, int);
-static void (*_gl_math_fix_itold) (long double *, int) = _Qp_itoq;
-#endif
-
-
-/* POSIX allows platforms that don't support NAN.  But all major
-   machines in the past 15 years have supported something close to
-   IEEE NaN, so we define this unconditionally.  We also must define
-   it on platforms like Solaris 10, where NAN is present but defined
-   as a function pointer rather than a floating point constant.  */
-#if !defined NAN || @REPLACE_NAN@
-# if !GNULIB_defined_NAN
-#  undef NAN
-  /* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler
-     choke on the expression 0.0 / 0.0.  */
-#  if defined __DECC || defined _MSC_VER
-_GL_MATH_INLINE float
-_NaN ()
-{
-  static float zero = 0.0f;
-  return zero / zero;
-}
-#   define NAN (_NaN())
-#  else
-#   define NAN (0.0f / 0.0f)
-#  endif
-#  define GNULIB_defined_NAN 1
-# endif
-#endif
-
-/* Solaris 10 defines HUGE_VAL, but as a function pointer rather
-   than a floating point constant.  */
-#if @REPLACE_HUGE_VAL@
-# undef HUGE_VALF
-# define HUGE_VALF (1.0f / 0.0f)
-# undef HUGE_VAL
-# define HUGE_VAL (1.0 / 0.0)
-# undef HUGE_VALL
-# define HUGE_VALL (1.0L / 0.0L)
-#endif
-
-/* HUGE_VALF is a 'float' Infinity.  */
-#ifndef HUGE_VALF
-# if defined _MSC_VER
-/* The Microsoft MSVC 9 compiler chokes on the expression 1.0f / 0.0f.  */
-#  define HUGE_VALF (1e25f * 1e25f)
-# else
-#  define HUGE_VALF (1.0f / 0.0f)
-# endif
-#endif
-
-/* HUGE_VAL is a 'double' Infinity.  */
-#ifndef HUGE_VAL
-# if defined _MSC_VER
-/* The Microsoft MSVC 9 compiler chokes on the expression 1.0 / 0.0.  */
-#  define HUGE_VAL (1e250 * 1e250)
-# else
-#  define HUGE_VAL (1.0 / 0.0)
-# endif
-#endif
-
-/* HUGE_VALL is a 'long double' Infinity.  */
-#ifndef HUGE_VALL
-# if defined _MSC_VER
-/* The Microsoft MSVC 9 compiler chokes on the expression 1.0L / 0.0L.  */
-#  define HUGE_VALL (1e250L * 1e250L)
-# else
-#  define HUGE_VALL (1.0L / 0.0L)
-# endif
-#endif
-
-
-/* Ensure FP_ILOGB0 and FP_ILOGBNAN are defined.  */
-#if !(defined FP_ILOGB0 && defined FP_ILOGBNAN)
-# if defined __NetBSD__ || defined __sgi
-  /* NetBSD, IRIX 6.5: match what ilogb() does */
-#  define FP_ILOGB0   (- 2147483647 - 1) /* INT_MIN */
-#  define FP_ILOGBNAN (- 2147483647 - 1) /* INT_MIN */
-# elif defined _AIX
-  /* AIX 5.1: match what ilogb() does in AIX >= 5.2 */
-#  define FP_ILOGB0   (- 2147483647 - 1) /* INT_MIN */
-#  define FP_ILOGBNAN 2147483647 /* INT_MAX */
-# elif defined __sun
-  /* Solaris 9: match what ilogb() does */
-#  define FP_ILOGB0   (- 2147483647) /* - INT_MAX */
-#  define FP_ILOGBNAN 2147483647 /* INT_MAX */
-# else
-  /* Gnulib defined values.  */
-#  define FP_ILOGB0   (- 2147483647) /* - INT_MAX */
-#  define FP_ILOGBNAN (- 2147483647 - 1) /* INT_MIN */
-# endif
-#endif
-
-
-#if @GNULIB_ACOSF@
-# if !@HAVE_ACOSF@
-#  undef acosf
-_GL_FUNCDECL_SYS (acosf, float, (float x));
-# endif
-_GL_CXXALIAS_SYS (acosf, float, (float x));
-_GL_CXXALIASWARN (acosf);
-#elif defined GNULIB_POSIXCHECK
-# undef acosf
-# if HAVE_RAW_DECL_ACOSF
-_GL_WARN_ON_USE (acosf, "acosf is unportable - "
-                 "use gnulib module acosf for portability");
-# endif
-#endif
-
-#if @GNULIB_ACOSL@
-# if !@HAVE_ACOSL@ || !@HAVE_DECL_ACOSL@
-#  undef acosl
-_GL_FUNCDECL_SYS (acosl, long double, (long double x));
-# endif
-_GL_CXXALIAS_SYS (acosl, long double, (long double x));
-_GL_CXXALIASWARN (acosl);
-#elif defined GNULIB_POSIXCHECK
-# undef acosl
-# if HAVE_RAW_DECL_ACOSL
-_GL_WARN_ON_USE (acosl, "acosl is unportable - "
-                 "use gnulib module acosl for portability");
-# endif
-#endif
-
-
-#if @GNULIB_ASINF@
-# if !@HAVE_ASINF@
-#  undef asinf
-_GL_FUNCDECL_SYS (asinf, float, (float x));
-# endif
-_GL_CXXALIAS_SYS (asinf, float, (float x));
-_GL_CXXALIASWARN (asinf);
-#elif defined GNULIB_POSIXCHECK
-# undef asinf
-# if HAVE_RAW_DECL_ASINF
-_GL_WARN_ON_USE (asinf, "asinf is unportable - "
-                 "use gnulib module asinf for portability");
-# endif
-#endif
-
-#if @GNULIB_ASINL@
-# if !@HAVE_ASINL@ || !@HAVE_DECL_ASINL@
-#  undef asinl
-_GL_FUNCDECL_SYS (asinl, long double, (long double x));
-# endif
-_GL_CXXALIAS_SYS (asinl, long double, (long double x));
-_GL_CXXALIASWARN (asinl);
-#elif defined GNULIB_POSIXCHECK
-# undef asinl
-# if HAVE_RAW_DECL_ASINL
-_GL_WARN_ON_USE (asinl, "asinl is unportable - "
-                 "use gnulib module asinl for portability");
-# endif
-#endif
-
-
-#if @GNULIB_ATANF@
-# if !@HAVE_ATANF@
-#  undef atanf
-_GL_FUNCDECL_SYS (atanf, float, (float x));
-# endif
-_GL_CXXALIAS_SYS (atanf, float, (float x));
-_GL_CXXALIASWARN (atanf);
-#elif defined GNULIB_POSIXCHECK
-# undef atanf
-# if HAVE_RAW_DECL_ATANF
-_GL_WARN_ON_USE (atanf, "atanf is unportable - "
-                 "use gnulib module atanf for portability");
-# endif
-#endif
-
-#if @GNULIB_ATANL@
-# if !@HAVE_ATANL@ || !@HAVE_DECL_ATANL@
-#  undef atanl
-_GL_FUNCDECL_SYS (atanl, long double, (long double x));
-# endif
-_GL_CXXALIAS_SYS (atanl, long double, (long double x));
-_GL_CXXALIASWARN (atanl);
-#elif defined GNULIB_POSIXCHECK
-# undef atanl
-# if HAVE_RAW_DECL_ATANL
-_GL_WARN_ON_USE (atanl, "atanl is unportable - "
-                 "use gnulib module atanl for portability");
-# endif
-#endif
-
-
-#if @GNULIB_ATAN2F@
-# if !@HAVE_ATAN2F@
-#  undef atan2f
-_GL_FUNCDECL_SYS (atan2f, float, (float y, float x));
-# endif
-_GL_CXXALIAS_SYS (atan2f, float, (float y, float x));
-_GL_CXXALIASWARN (atan2f);
-#elif defined GNULIB_POSIXCHECK
-# undef atan2f
-# if HAVE_RAW_DECL_ATAN2F
-_GL_WARN_ON_USE (atan2f, "atan2f is unportable - "
-                 "use gnulib module atan2f for portability");
-# endif
-#endif
-
-
-#if @GNULIB_CBRTF@
-# if @REPLACE_CBRTF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef cbrtf
-#   define cbrtf rpl_cbrtf
-#  endif
-_GL_FUNCDECL_RPL (cbrtf, float, (float x));
-_GL_CXXALIAS_RPL (cbrtf, float, (float x));
-# else
-#  if !@HAVE_DECL_CBRTF@
-_GL_FUNCDECL_SYS (cbrtf, float, (float x));
-#  endif
-_GL_CXXALIAS_SYS (cbrtf, float, (float x));
-# endif
-_GL_CXXALIASWARN (cbrtf);
-#elif defined GNULIB_POSIXCHECK
-# undef cbrtf
-# if HAVE_RAW_DECL_CBRTF
-_GL_WARN_ON_USE (cbrtf, "cbrtf is unportable - "
-                 "use gnulib module cbrtf for portability");
-# endif
-#endif
-
-#if @GNULIB_CBRT@
-# if !@HAVE_CBRT@
-_GL_FUNCDECL_SYS (cbrt, double, (double x));
-# endif
-_GL_CXXALIAS_SYS (cbrt, double, (double x));
-_GL_CXXALIASWARN (cbrt);
-#elif defined GNULIB_POSIXCHECK
-# undef cbrt
-# if HAVE_RAW_DECL_CBRT
-_GL_WARN_ON_USE (cbrt, "cbrt is unportable - "
-                 "use gnulib module cbrt for portability");
-# endif
-#endif
-
-#if @GNULIB_CBRTL@
-# if @REPLACE_CBRTL@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef cbrtl
-#   define cbrtl rpl_cbrtl
-#  endif
-_GL_FUNCDECL_RPL (cbrtl, long double, (long double x));
-_GL_CXXALIAS_RPL (cbrtl, long double, (long double x));
-# else
-#  if !@HAVE_DECL_CBRTL@
-_GL_FUNCDECL_SYS (cbrtl, long double, (long double x));
-#  endif
-_GL_CXXALIAS_SYS (cbrtl, long double, (long double x));
-# endif
-_GL_CXXALIASWARN (cbrtl);
-#elif defined GNULIB_POSIXCHECK
-# undef cbrtl
-# if HAVE_RAW_DECL_CBRTL
-_GL_WARN_ON_USE (cbrtl, "cbrtl is unportable - "
-                 "use gnulib module cbrtl for portability");
-# endif
-#endif
-
-
-#if @GNULIB_CEILF@
-# if @REPLACE_CEILF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef ceilf
-#   define ceilf rpl_ceilf
-#  endif
-_GL_FUNCDECL_RPL (ceilf, float, (float x));
-_GL_CXXALIAS_RPL (ceilf, float, (float x));
-# else
-#  if !@HAVE_DECL_CEILF@
-#   undef ceilf
-_GL_FUNCDECL_SYS (ceilf, float, (float x));
-#  endif
-_GL_CXXALIAS_SYS (ceilf, float, (float x));
-# endif
-_GL_CXXALIASWARN (ceilf);
-#elif defined GNULIB_POSIXCHECK
-# undef ceilf
-# if HAVE_RAW_DECL_CEILF
-_GL_WARN_ON_USE (ceilf, "ceilf is unportable - "
-                 "use gnulib module ceilf for portability");
-# endif
-#endif
-
-#if @GNULIB_CEIL@
-# if @REPLACE_CEIL@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define ceil rpl_ceil
-#  endif
-_GL_FUNCDECL_RPL (ceil, double, (double x));
-_GL_CXXALIAS_RPL (ceil, double, (double x));
-# else
-_GL_CXXALIAS_SYS (ceil, double, (double x));
-# endif
-_GL_CXXALIASWARN (ceil);
-#endif
-
-#if @GNULIB_CEILL@
-# if @REPLACE_CEILL@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef ceill
-#   define ceill rpl_ceill
-#  endif
-_GL_FUNCDECL_RPL (ceill, long double, (long double x));
-_GL_CXXALIAS_RPL (ceill, long double, (long double x));
-# else
-#  if !@HAVE_DECL_CEILL@
-#   undef ceill
-_GL_FUNCDECL_SYS (ceill, long double, (long double x));
-#  endif
-_GL_CXXALIAS_SYS (ceill, long double, (long double x));
-# endif
-_GL_CXXALIASWARN (ceill);
-#elif defined GNULIB_POSIXCHECK
-# undef ceill
-# if HAVE_RAW_DECL_CEILL
-_GL_WARN_ON_USE (ceill, "ceill is unportable - "
-                 "use gnulib module ceill for portability");
-# endif
-#endif
-
-
-#if @GNULIB_COPYSIGNF@
-# if !@HAVE_DECL_COPYSIGNF@
-_GL_FUNCDECL_SYS (copysignf, float, (float x, float y));
-# endif
-_GL_CXXALIAS_SYS (copysignf, float, (float x, float y));
-_GL_CXXALIASWARN (copysignf);
-#elif defined GNULIB_POSIXCHECK
-# undef copysignf
-# if HAVE_RAW_DECL_COPYSIGNF
-_GL_WARN_ON_USE (copysignf, "copysignf is unportable - "
-                 "use gnulib module copysignf for portability");
-# endif
-#endif
-
-#if @GNULIB_COPYSIGN@
-# if !@HAVE_COPYSIGN@
-_GL_FUNCDECL_SYS (copysign, double, (double x, double y));
-# endif
-_GL_CXXALIAS_SYS (copysign, double, (double x, double y));
-_GL_CXXALIASWARN (copysign);
-#elif defined GNULIB_POSIXCHECK
-# undef copysign
-# if HAVE_RAW_DECL_COPYSIGN
-_GL_WARN_ON_USE (copysign, "copysign is unportable - "
-                 "use gnulib module copysign for portability");
-# endif
-#endif
-
-#if @GNULIB_COPYSIGNL@
-# if !@HAVE_COPYSIGNL@
-_GL_FUNCDECL_SYS (copysignl, long double, (long double x, long double y));
-# endif
-_GL_CXXALIAS_SYS (copysignl, long double, (long double x, long double y));
-_GL_CXXALIASWARN (copysignl);
-#elif defined GNULIB_POSIXCHECK
-# undef copysignl
-# if HAVE_RAW_DECL_COPYSIGNL
-_GL_WARN_ON_USE (copysign, "copysignl is unportable - "
-                 "use gnulib module copysignl for portability");
-# endif
-#endif
-
-
-#if @GNULIB_COSF@
-# if !@HAVE_COSF@
-#  undef cosf
-_GL_FUNCDECL_SYS (cosf, float, (float x));
-# endif
-_GL_CXXALIAS_SYS (cosf, float, (float x));
-_GL_CXXALIASWARN (cosf);
-#elif defined GNULIB_POSIXCHECK
-# undef cosf
-# if HAVE_RAW_DECL_COSF
-_GL_WARN_ON_USE (cosf, "cosf is unportable - "
-                 "use gnulib module cosf for portability");
-# endif
-#endif
-
-#if @GNULIB_COSL@
-# if !@HAVE_COSL@ || !@HAVE_DECL_COSL@
-#  undef cosl
-_GL_FUNCDECL_SYS (cosl, long double, (long double x));
-# endif
-_GL_CXXALIAS_SYS (cosl, long double, (long double x));
-_GL_CXXALIASWARN (cosl);
-#elif defined GNULIB_POSIXCHECK
-# undef cosl
-# if HAVE_RAW_DECL_COSL
-_GL_WARN_ON_USE (cosl, "cosl is unportable - "
-                 "use gnulib module cosl for portability");
-# endif
-#endif
-
-
-#if @GNULIB_COSHF@
-# if !@HAVE_COSHF@
-#  undef coshf
-_GL_FUNCDECL_SYS (coshf, float, (float x));
-# endif
-_GL_CXXALIAS_SYS (coshf, float, (float x));
-_GL_CXXALIASWARN (coshf);
-#elif defined GNULIB_POSIXCHECK
-# undef coshf
-# if HAVE_RAW_DECL_COSHF
-_GL_WARN_ON_USE (coshf, "coshf is unportable - "
-                 "use gnulib module coshf for portability");
-# endif
-#endif
-
-
-#if @GNULIB_EXPF@
-# if !@HAVE_EXPF@
-#  undef expf
-_GL_FUNCDECL_SYS (expf, float, (float x));
-# endif
-_GL_CXXALIAS_SYS (expf, float, (float x));
-_GL_CXXALIASWARN (expf);
-#elif defined GNULIB_POSIXCHECK
-# undef expf
-# if HAVE_RAW_DECL_EXPF
-_GL_WARN_ON_USE (expf, "expf is unportable - "
-                 "use gnulib module expf for portability");
-# endif
-#endif
-
-#if @GNULIB_EXPL@
-# if !@HAVE_EXPL@ || !@HAVE_DECL_EXPL@
-#  undef expl
-_GL_FUNCDECL_SYS (expl, long double, (long double x));
-# endif
-_GL_CXXALIAS_SYS (expl, long double, (long double x));
-_GL_CXXALIASWARN (expl);
-#elif defined GNULIB_POSIXCHECK
-# undef expl
-# if HAVE_RAW_DECL_EXPL
-_GL_WARN_ON_USE (expl, "expl is unportable - "
-                 "use gnulib module expl for portability");
-# endif
-#endif
-
-
-#if @GNULIB_EXP2F@
-# if !@HAVE_DECL_EXP2F@
-_GL_FUNCDECL_SYS (exp2f, float, (float x));
-# endif
-_GL_CXXALIAS_SYS (exp2f, float, (float x));
-_GL_CXXALIASWARN (exp2f);
-#elif defined GNULIB_POSIXCHECK
-# undef exp2f
-# if HAVE_RAW_DECL_EXP2F
-_GL_WARN_ON_USE (exp2f, "exp2f is unportable - "
-                 "use gnulib module exp2f for portability");
-# endif
-#endif
-
-#if @GNULIB_EXP2@
-# if @REPLACE_EXP2@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef exp2
-#   define exp2 rpl_exp2
-#  endif
-_GL_FUNCDECL_RPL (exp2, double, (double x));
-_GL_CXXALIAS_RPL (exp2, double, (double x));
-# else
-#  if !@HAVE_DECL_EXP2@
-_GL_FUNCDECL_SYS (exp2, double, (double x));
-#  endif
-_GL_CXXALIAS_SYS (exp2, double, (double x));
-# endif
-_GL_CXXALIASWARN (exp2);
-#elif defined GNULIB_POSIXCHECK
-# undef exp2
-# if HAVE_RAW_DECL_EXP2
-_GL_WARN_ON_USE (exp2, "exp2 is unportable - "
-                 "use gnulib module exp2 for portability");
-# endif
-#endif
-
-#if @GNULIB_EXP2L@
-# if @REPLACE_EXP2L@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef exp2l
-#   define exp2l rpl_exp2l
-#  endif
-_GL_FUNCDECL_RPL (exp2l, long double, (long double x));
-_GL_CXXALIAS_RPL (exp2l, long double, (long double x));
-# else
-#  if !@HAVE_DECL_EXP2L@
-#   undef exp2l
-_GL_FUNCDECL_SYS (exp2l, long double, (long double x));
-#  endif
-_GL_CXXALIAS_SYS (exp2l, long double, (long double x));
-# endif
-_GL_CXXALIASWARN (exp2l);
-#elif defined GNULIB_POSIXCHECK
-# undef exp2l
-# if HAVE_RAW_DECL_EXP2L
-_GL_WARN_ON_USE (exp2l, "exp2l is unportable - "
-                 "use gnulib module exp2l for portability");
-# endif
-#endif
-
-
-#if @GNULIB_EXPM1F@
-# if @REPLACE_EXPM1F@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef expm1f
-#   define expm1f rpl_expm1f
-#  endif
-_GL_FUNCDECL_RPL (expm1f, float, (float x));
-_GL_CXXALIAS_RPL (expm1f, float, (float x));
-# else
-#  if !@HAVE_EXPM1F@
-_GL_FUNCDECL_SYS (expm1f, float, (float x));
-#  endif
-_GL_CXXALIAS_SYS (expm1f, float, (float x));
-# endif
-_GL_CXXALIASWARN (expm1f);
-#elif defined GNULIB_POSIXCHECK
-# undef expm1f
-# if HAVE_RAW_DECL_EXPM1F
-_GL_WARN_ON_USE (expm1f, "expm1f is unportable - "
-                 "use gnulib module expm1f for portability");
-# endif
-#endif
-
-#if @GNULIB_EXPM1@
-# if @REPLACE_EXPM1@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef expm1
-#   define expm1 rpl_expm1
-#  endif
-_GL_FUNCDECL_RPL (expm1, double, (double x));
-_GL_CXXALIAS_RPL (expm1, double, (double x));
-# else
-#  if !@HAVE_EXPM1@
-_GL_FUNCDECL_SYS (expm1, double, (double x));
-#  endif
-_GL_CXXALIAS_SYS (expm1, double, (double x));
-# endif
-_GL_CXXALIASWARN (expm1);
-#elif defined GNULIB_POSIXCHECK
-# undef expm1
-# if HAVE_RAW_DECL_EXPM1
-_GL_WARN_ON_USE (expm1, "expm1 is unportable - "
-                 "use gnulib module expm1 for portability");
-# endif
-#endif
-
-#if @GNULIB_EXPM1L@
-# if !@HAVE_DECL_EXPM1L@
-#  undef expm1l
-_GL_FUNCDECL_SYS (expm1l, long double, (long double x));
-# endif
-_GL_CXXALIAS_SYS (expm1l, long double, (long double x));
-_GL_CXXALIASWARN (expm1l);
-#elif defined GNULIB_POSIXCHECK
-# undef expm1l
-# if HAVE_RAW_DECL_EXPM1L
-_GL_WARN_ON_USE (expm1l, "expm1l is unportable - "
-                 "use gnulib module expm1l for portability");
-# endif
-#endif
-
-
-#if @GNULIB_FABSF@
-# if !@HAVE_FABSF@
-#  undef fabsf
-_GL_FUNCDECL_SYS (fabsf, float, (float x));
-# endif
-_GL_CXXALIAS_SYS (fabsf, float, (float x));
-_GL_CXXALIASWARN (fabsf);
-#elif defined GNULIB_POSIXCHECK
-# undef fabsf
-# if HAVE_RAW_DECL_FABSF
-_GL_WARN_ON_USE (fabsf, "fabsf is unportable - "
-                 "use gnulib module fabsf for portability");
-# endif
-#endif
-
-#if @GNULIB_FABSL@
-# if @REPLACE_FABSL@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef fabsl
-#   define fabsl rpl_fabsl
-#  endif
-_GL_FUNCDECL_RPL (fabsl, long double, (long double x));
-_GL_CXXALIAS_RPL (fabsl, long double, (long double x));
-# else
-#  if !@HAVE_FABSL@
-#   undef fabsl
-_GL_FUNCDECL_SYS (fabsl, long double, (long double x));
-#  endif
-_GL_CXXALIAS_SYS (fabsl, long double, (long double x));
-# endif
-_GL_CXXALIASWARN (fabsl);
-#elif defined GNULIB_POSIXCHECK
-# undef fabsl
-# if HAVE_RAW_DECL_FABSL
-_GL_WARN_ON_USE (fabsl, "fabsl is unportable - "
-                 "use gnulib module fabsl for portability");
-# endif
-#endif
-
-
-#if @GNULIB_FLOORF@
-# if @REPLACE_FLOORF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef floorf
-#   define floorf rpl_floorf
-#  endif
-_GL_FUNCDECL_RPL (floorf, float, (float x));
-_GL_CXXALIAS_RPL (floorf, float, (float x));
-# else
-#  if !@HAVE_DECL_FLOORF@
-#   undef floorf
-_GL_FUNCDECL_SYS (floorf, float, (float x));
-#  endif
-_GL_CXXALIAS_SYS (floorf, float, (float x));
-# endif
-_GL_CXXALIASWARN (floorf);
-#elif defined GNULIB_POSIXCHECK
-# undef floorf
-# if HAVE_RAW_DECL_FLOORF
-_GL_WARN_ON_USE (floorf, "floorf is unportable - "
-                 "use gnulib module floorf for portability");
-# endif
-#endif
-
-#if @GNULIB_FLOOR@
-# if @REPLACE_FLOOR@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define floor rpl_floor
-#  endif
-_GL_FUNCDECL_RPL (floor, double, (double x));
-_GL_CXXALIAS_RPL (floor, double, (double x));
-# else
-_GL_CXXALIAS_SYS (floor, double, (double x));
-# endif
-_GL_CXXALIASWARN (floor);
-#endif
-
-#if @GNULIB_FLOORL@
-# if @REPLACE_FLOORL@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef floorl
-#   define floorl rpl_floorl
-#  endif
-_GL_FUNCDECL_RPL (floorl, long double, (long double x));
-_GL_CXXALIAS_RPL (floorl, long double, (long double x));
-# else
-#  if !@HAVE_DECL_FLOORL@
-#   undef floorl
-_GL_FUNCDECL_SYS (floorl, long double, (long double x));
-#  endif
-_GL_CXXALIAS_SYS (floorl, long double, (long double x));
-# endif
-_GL_CXXALIASWARN (floorl);
-#elif defined GNULIB_POSIXCHECK
-# undef floorl
-# if HAVE_RAW_DECL_FLOORL
-_GL_WARN_ON_USE (floorl, "floorl is unportable - "
-                 "use gnulib module floorl for portability");
-# endif
-#endif
-
-
-#if @GNULIB_FMAF@
-# if @REPLACE_FMAF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef fmaf
-#   define fmaf rpl_fmaf
-#  endif
-_GL_FUNCDECL_RPL (fmaf, float, (float x, float y, float z));
-_GL_CXXALIAS_RPL (fmaf, float, (float x, float y, float z));
-# else
-#  if !@HAVE_FMAF@
-_GL_FUNCDECL_SYS (fmaf, float, (float x, float y, float z));
-#  endif
-_GL_CXXALIAS_SYS (fmaf, float, (float x, float y, float z));
-# endif
-_GL_CXXALIASWARN (fmaf);
-#elif defined GNULIB_POSIXCHECK
-# undef fmaf
-# if HAVE_RAW_DECL_FMAF
-_GL_WARN_ON_USE (fmaf, "fmaf is unportable - "
-                 "use gnulib module fmaf for portability");
-# endif
-#endif
-
-#if @GNULIB_FMA@
-# if @REPLACE_FMA@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef fma
-#   define fma rpl_fma
-#  endif
-_GL_FUNCDECL_RPL (fma, double, (double x, double y, double z));
-_GL_CXXALIAS_RPL (fma, double, (double x, double y, double z));
-# else
-#  if !@HAVE_FMA@
-_GL_FUNCDECL_SYS (fma, double, (double x, double y, double z));
-#  endif
-_GL_CXXALIAS_SYS (fma, double, (double x, double y, double z));
-# endif
-_GL_CXXALIASWARN (fma);
-#elif defined GNULIB_POSIXCHECK
-# undef fma
-# if HAVE_RAW_DECL_FMA
-_GL_WARN_ON_USE (fma, "fma is unportable - "
-                 "use gnulib module fma for portability");
-# endif
-#endif
-
-#if @GNULIB_FMAL@
-# if @REPLACE_FMAL@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef fmal
-#   define fmal rpl_fmal
-#  endif
-_GL_FUNCDECL_RPL (fmal, long double,
-                  (long double x, long double y, long double z));
-_GL_CXXALIAS_RPL (fmal, long double,
-                  (long double x, long double y, long double z));
-# else
-#  if !@HAVE_FMAL@
-#   undef fmal
-_GL_FUNCDECL_SYS (fmal, long double,
-                  (long double x, long double y, long double z));
-#  endif
-_GL_CXXALIAS_SYS (fmal, long double,
-                  (long double x, long double y, long double z));
-# endif
-_GL_CXXALIASWARN (fmal);
-#elif defined GNULIB_POSIXCHECK
-# undef fmal
-# if HAVE_RAW_DECL_FMAL
-_GL_WARN_ON_USE (fmal, "fmal is unportable - "
-                 "use gnulib module fmal for portability");
-# endif
-#endif
-
-
-#if @GNULIB_FMODF@
-# if @REPLACE_FMODF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef fmodf
-#   define fmodf rpl_fmodf
-#  endif
-_GL_FUNCDECL_RPL (fmodf, float, (float x, float y));
-_GL_CXXALIAS_RPL (fmodf, float, (float x, float y));
-# else
-#  if !@HAVE_FMODF@
-#   undef fmodf
-_GL_FUNCDECL_SYS (fmodf, float, (float x, float y));
-#  endif
-_GL_CXXALIAS_SYS (fmodf, float, (float x, float y));
-# endif
-_GL_CXXALIASWARN (fmodf);
-#elif defined GNULIB_POSIXCHECK
-# undef fmodf
-# if HAVE_RAW_DECL_FMODF
-_GL_WARN_ON_USE (fmodf, "fmodf is unportable - "
-                 "use gnulib module fmodf for portability");
-# endif
-#endif
-
-#if @GNULIB_FMOD@
-# if @REPLACE_FMOD@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef fmod
-#   define fmod rpl_fmod
-#  endif
-_GL_FUNCDECL_RPL (fmod, double, (double x, double y));
-_GL_CXXALIAS_RPL (fmod, double, (double x, double y));
-# else
-_GL_CXXALIAS_SYS (fmod, double, (double x, double y));
-# endif
-_GL_CXXALIASWARN (fmod);
-#elif defined GNULIB_POSIXCHECK
-# undef fmod
-# if HAVE_RAW_DECL_FMOD
-_GL_WARN_ON_USE (fmod, "fmod has portability problems - "
-                 "use gnulib module fmod for portability");
-# endif
-#endif
-
-#if @GNULIB_FMODL@
-# if @REPLACE_FMODL@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef fmodl
-#   define fmodl rpl_fmodl
-#  endif
-_GL_FUNCDECL_RPL (fmodl, long double, (long double x, long double y));
-_GL_CXXALIAS_RPL (fmodl, long double, (long double x, long double y));
-# else
-#  if !@HAVE_FMODL@
-#   undef fmodl
-_GL_FUNCDECL_SYS (fmodl, long double, (long double x, long double y));
-#  endif
-_GL_CXXALIAS_SYS (fmodl, long double, (long double x, long double y));
-# endif
-_GL_CXXALIASWARN (fmodl);
-#elif defined GNULIB_POSIXCHECK
-# undef fmodl
-# if HAVE_RAW_DECL_FMODL
-_GL_WARN_ON_USE (fmodl, "fmodl is unportable - "
-                 "use gnulib module fmodl for portability");
-# endif
-#endif
-
-
-/* Write x as
-     x = mantissa * 2^exp
-   where
-     If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
-     If x is zero: mantissa = x, exp = 0.
-     If x is infinite or NaN: mantissa = x, exp unspecified.
-   Store exp in *EXPPTR and return mantissa.  */
-#if @GNULIB_FREXPF@
-# if @REPLACE_FREXPF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef frexpf
-#   define frexpf rpl_frexpf
-#  endif
-_GL_FUNCDECL_RPL (frexpf, float, (float x, int *expptr) _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (frexpf, float, (float x, int *expptr));
-# else
-#  if !@HAVE_FREXPF@
-#   undef frexpf
-_GL_FUNCDECL_SYS (frexpf, float, (float x, int *expptr) _GL_ARG_NONNULL ((2)));
-#  endif
-_GL_CXXALIAS_SYS (frexpf, float, (float x, int *expptr));
-# endif
-_GL_CXXALIASWARN (frexpf);
-#elif defined GNULIB_POSIXCHECK
-# undef frexpf
-# if HAVE_RAW_DECL_FREXPF
-_GL_WARN_ON_USE (frexpf, "frexpf is unportable - "
-                 "use gnulib module frexpf for portability");
-# endif
-#endif
-
-/* Write x as
-     x = mantissa * 2^exp
-   where
-     If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
-     If x is zero: mantissa = x, exp = 0.
-     If x is infinite or NaN: mantissa = x, exp unspecified.
-   Store exp in *EXPPTR and return mantissa.  */
-#if @GNULIB_FREXP@
-# if @REPLACE_FREXP@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define frexp rpl_frexp
-#  endif
-_GL_FUNCDECL_RPL (frexp, double, (double x, int *expptr) _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (frexp, double, (double x, int *expptr));
-# else
-_GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr));
-# endif
-_GL_CXXALIASWARN (frexp);
-#elif defined GNULIB_POSIXCHECK
-# undef frexp
-/* Assume frexp is always declared.  */
-_GL_WARN_ON_USE (frexp, "frexp is unportable - "
-                 "use gnulib module frexp for portability");
-#endif
-
-/* Write x as
-     x = mantissa * 2^exp
-   where
-     If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
-     If x is zero: mantissa = x, exp = 0.
-     If x is infinite or NaN: mantissa = x, exp unspecified.
-   Store exp in *EXPPTR and return mantissa.  */
-#if @GNULIB_FREXPL@ && @REPLACE_FREXPL@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#  undef frexpl
-#  define frexpl rpl_frexpl
-# endif
-_GL_FUNCDECL_RPL (frexpl, long double,
-                  (long double x, int *expptr) _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (frexpl, long double, (long double x, int *expptr));
-#else
-# if !@HAVE_DECL_FREXPL@
-_GL_FUNCDECL_SYS (frexpl, long double,
-                  (long double x, int *expptr) _GL_ARG_NONNULL ((2)));
-# endif
-# if @GNULIB_FREXPL@
-_GL_CXXALIAS_SYS (frexpl, long double, (long double x, int *expptr));
-# endif
-#endif
-#if @GNULIB_FREXPL@ && !(@REPLACE_FREXPL@ && !@HAVE_DECL_FREXPL@)
-_GL_CXXALIASWARN (frexpl);
-#endif
-#if !@GNULIB_FREXPL@ && defined GNULIB_POSIXCHECK
-# undef frexpl
-# if HAVE_RAW_DECL_FREXPL
-_GL_WARN_ON_USE (frexpl, "frexpl is unportable - "
-                 "use gnulib module frexpl for portability");
-# endif
-#endif
-
-
-/* Return sqrt(x^2+y^2).  */
-#if @GNULIB_HYPOTF@
-# if @REPLACE_HYPOTF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef hypotf
-#   define hypotf rpl_hypotf
-#  endif
-_GL_FUNCDECL_RPL (hypotf, float, (float x, float y));
-_GL_CXXALIAS_RPL (hypotf, float, (float x, float y));
-# else
-#  if !@HAVE_HYPOTF@
-_GL_FUNCDECL_SYS (hypotf, float, (float x, float y));
-#  endif
-_GL_CXXALIAS_SYS (hypotf, float, (float x, float y));
-# endif
-_GL_CXXALIASWARN (hypotf);
-#elif defined GNULIB_POSIXCHECK
-# undef hypotf
-# if HAVE_RAW_DECL_HYPOTF
-_GL_WARN_ON_USE (hypotf, "hypotf is unportable - "
-                 "use gnulib module hypotf for portability");
-# endif
-#endif
-
-/* Return sqrt(x^2+y^2).  */
-#if @GNULIB_HYPOT@
-# if @REPLACE_HYPOT@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef hypot
-#   define hypot rpl_hypot
-#  endif
-_GL_FUNCDECL_RPL (hypot, double, (double x, double y));
-_GL_CXXALIAS_RPL (hypot, double, (double x, double y));
-# else
-_GL_CXXALIAS_SYS (hypot, double, (double x, double y));
-# endif
-_GL_CXXALIASWARN (hypot);
-#elif defined GNULIB_POSIXCHECK
-# undef hypot
-# if HAVE_RAW_DECL_HYPOT
-_GL_WARN_ON_USE (hypotf, "hypot has portability problems - "
-                 "use gnulib module hypot for portability");
-# endif
-#endif
-
-/* Return sqrt(x^2+y^2).  */
-#if @GNULIB_HYPOTL@
-# if @REPLACE_HYPOTL@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef hypotl
-#   define hypotl rpl_hypotl
-#  endif
-_GL_FUNCDECL_RPL (hypotl, long double, (long double x, long double y));
-_GL_CXXALIAS_RPL (hypotl, long double, (long double x, long double y));
-# else
-#  if !@HAVE_HYPOTL@
-_GL_FUNCDECL_SYS (hypotl, long double, (long double x, long double y));
-#  endif
-_GL_CXXALIAS_SYS (hypotl, long double, (long double x, long double y));
-# endif
-_GL_CXXALIASWARN (hypotl);
-#elif defined GNULIB_POSIXCHECK
-# undef hypotl
-# if HAVE_RAW_DECL_HYPOTL
-_GL_WARN_ON_USE (hypotl, "hypotl is unportable - "
-                 "use gnulib module hypotl for portability");
-# endif
-#endif
-
-
-#if @GNULIB_ILOGBF@
-# if @REPLACE_ILOGBF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef ilogbf
-#   define ilogbf rpl_ilogbf
-#  endif
-_GL_FUNCDECL_RPL (ilogbf, int, (float x));
-_GL_CXXALIAS_RPL (ilogbf, int, (float x));
-# else
-#  if !@HAVE_ILOGBF@
-_GL_FUNCDECL_SYS (ilogbf, int, (float x));
-#  endif
-_GL_CXXALIAS_SYS (ilogbf, int, (float x));
-# endif
-_GL_CXXALIASWARN (ilogbf);
-#elif defined GNULIB_POSIXCHECK
-# undef ilogbf
-# if HAVE_RAW_DECL_ILOGBF
-_GL_WARN_ON_USE (ilogbf, "ilogbf is unportable - "
-                 "use gnulib module ilogbf for portability");
-# endif
-#endif
-
-#if @GNULIB_ILOGB@
-# if @REPLACE_ILOGB@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef ilogb
-#   define ilogb rpl_ilogb
-#  endif
-_GL_FUNCDECL_RPL (ilogb, int, (double x));
-_GL_CXXALIAS_RPL (ilogb, int, (double x));
-# else
-#  if !@HAVE_ILOGB@
-_GL_FUNCDECL_SYS (ilogb, int, (double x));
-#  endif
-_GL_CXXALIAS_SYS (ilogb, int, (double x));
-# endif
-_GL_CXXALIASWARN (ilogb);
-#elif defined GNULIB_POSIXCHECK
-# undef ilogb
-# if HAVE_RAW_DECL_ILOGB
-_GL_WARN_ON_USE (ilogb, "ilogb is unportable - "
-                 "use gnulib module ilogb for portability");
-# endif
-#endif
-
-#if @GNULIB_ILOGBL@
-# if !@HAVE_ILOGBL@
-_GL_FUNCDECL_SYS (ilogbl, int, (long double x));
-# endif
-_GL_CXXALIAS_SYS (ilogbl, int, (long double x));
-_GL_CXXALIASWARN (ilogbl);
-#elif defined GNULIB_POSIXCHECK
-# undef ilogbl
-# if HAVE_RAW_DECL_ILOGBL
-_GL_WARN_ON_USE (ilogbl, "ilogbl is unportable - "
-                 "use gnulib module ilogbl for portability");
-# endif
-#endif
-
-
-/* Return x * 2^exp.  */
-#if @GNULIB_LDEXPF@
-# if !@HAVE_LDEXPF@
-#  undef ldexpf
-_GL_FUNCDECL_SYS (ldexpf, float, (float x, int exp));
-# endif
-_GL_CXXALIAS_SYS (ldexpf, float, (float x, int exp));
-_GL_CXXALIASWARN (ldexpf);
-#elif defined GNULIB_POSIXCHECK
-# undef ldexpf
-# if HAVE_RAW_DECL_LDEXPF
-_GL_WARN_ON_USE (ldexpf, "ldexpf is unportable - "
-                 "use gnulib module ldexpf for portability");
-# endif
-#endif
-
-/* Return x * 2^exp.  */
-#if @GNULIB_LDEXPL@ && @REPLACE_LDEXPL@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#  undef ldexpl
-#  define ldexpl rpl_ldexpl
-# endif
-_GL_FUNCDECL_RPL (ldexpl, long double, (long double x, int exp));
-_GL_CXXALIAS_RPL (ldexpl, long double, (long double x, int exp));
-#else
-# if !@HAVE_DECL_LDEXPL@
-_GL_FUNCDECL_SYS (ldexpl, long double, (long double x, int exp));
-# endif
-# if @GNULIB_LDEXPL@
-_GL_CXXALIAS_SYS (ldexpl, long double, (long double x, int exp));
-# endif
-#endif
-#if @GNULIB_LDEXPL@
-_GL_CXXALIASWARN (ldexpl);
-#endif
-#if !@GNULIB_LDEXPL@ && defined GNULIB_POSIXCHECK
-# undef ldexpl
-# if HAVE_RAW_DECL_LDEXPL
-_GL_WARN_ON_USE (ldexpl, "ldexpl is unportable - "
-                 "use gnulib module ldexpl for portability");
-# endif
-#endif
-
-
-#if @GNULIB_LOGF@
-# if @REPLACE_LOGF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef logf
-#   define logf rpl_logf
-#  endif
-_GL_FUNCDECL_RPL (logf, float, (float x));
-_GL_CXXALIAS_RPL (logf, float, (float x));
-# else
-#  if !@HAVE_LOGF@
-#   undef logf
-_GL_FUNCDECL_SYS (logf, float, (float x));
-#  endif
-_GL_CXXALIAS_SYS (logf, float, (float x));
-# endif
-_GL_CXXALIASWARN (logf);
-#elif defined GNULIB_POSIXCHECK
-# undef logf
-# if HAVE_RAW_DECL_LOGF
-_GL_WARN_ON_USE (logf, "logf is unportable - "
-                 "use gnulib module logf for portability");
-# endif
-#endif
-
-#if @GNULIB_LOG@
-# if @REPLACE_LOG@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef log
-#   define log rpl_log
-#  endif
-_GL_FUNCDECL_RPL (log, double, (double x));
-_GL_CXXALIAS_RPL (log, double, (double x));
-# else
-_GL_CXXALIAS_SYS (log, double, (double x));
-# endif
-_GL_CXXALIASWARN (log);
-#elif defined GNULIB_POSIXCHECK
-# undef log
-# if HAVE_RAW_DECL_LOG
-_GL_WARN_ON_USE (log, "log has portability problems - "
-                 "use gnulib module log for portability");
-# endif
-#endif
-
-#if @GNULIB_LOGL@
-# if @REPLACE_LOGL@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef logl
-#   define logl rpl_logl
-#  endif
-_GL_FUNCDECL_RPL (logl, long double, (long double x));
-_GL_CXXALIAS_RPL (logl, long double, (long double x));
-# else
-#  if !@HAVE_LOGL@ || !@HAVE_DECL_LOGL@
-#   undef logl
-_GL_FUNCDECL_SYS (logl, long double, (long double x));
-#  endif
-_GL_CXXALIAS_SYS (logl, long double, (long double x));
-# endif
-_GL_CXXALIASWARN (logl);
-#elif defined GNULIB_POSIXCHECK
-# undef logl
-# if HAVE_RAW_DECL_LOGL
-_GL_WARN_ON_USE (logl, "logl is unportable - "
-                 "use gnulib module logl for portability");
-# endif
-#endif
-
-
-#if @GNULIB_LOG10F@
-# if @REPLACE_LOG10F@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef log10f
-#   define log10f rpl_log10f
-#  endif
-_GL_FUNCDECL_RPL (log10f, float, (float x));
-_GL_CXXALIAS_RPL (log10f, float, (float x));
-# else
-#  if !@HAVE_LOG10F@
-#   undef log10f
-_GL_FUNCDECL_SYS (log10f, float, (float x));
-#  endif
-_GL_CXXALIAS_SYS (log10f, float, (float x));
-# endif
-_GL_CXXALIASWARN (log10f);
-#elif defined GNULIB_POSIXCHECK
-# undef log10f
-# if HAVE_RAW_DECL_LOG10F
-_GL_WARN_ON_USE (log10f, "log10f is unportable - "
-                 "use gnulib module log10f for portability");
-# endif
-#endif
-
-#if @GNULIB_LOG10@
-# if @REPLACE_LOG10@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef log10
-#   define log10 rpl_log10
-#  endif
-_GL_FUNCDECL_RPL (log10, double, (double x));
-_GL_CXXALIAS_RPL (log10, double, (double x));
-# else
-_GL_CXXALIAS_SYS (log10, double, (double x));
-# endif
-_GL_CXXALIASWARN (log10);
-#elif defined GNULIB_POSIXCHECK
-# undef log10
-# if HAVE_RAW_DECL_LOG10
-_GL_WARN_ON_USE (log10, "log10 has portability problems - "
-                 "use gnulib module log10 for portability");
-# endif
-#endif
-
-#if @GNULIB_LOG10L@
-# if @REPLACE_LOG10L@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef log10l
-#   define log10l rpl_log10l
-#  endif
-_GL_FUNCDECL_RPL (log10l, long double, (long double x));
-_GL_CXXALIAS_RPL (log10l, long double, (long double x));
-# else
-#  if !@HAVE_LOG10L@ || !@HAVE_DECL_LOG10L@
-#   undef log10l
-_GL_FUNCDECL_SYS (log10l, long double, (long double x));
-#  endif
-_GL_CXXALIAS_SYS (log10l, long double, (long double x));
-# endif
-_GL_CXXALIASWARN (log10l);
-#elif defined GNULIB_POSIXCHECK
-# undef log10l
-# if HAVE_RAW_DECL_LOG10L
-_GL_WARN_ON_USE (log10l, "log10l is unportable - "
-                 "use gnulib module log10l for portability");
-# endif
-#endif
-
-
-#if @GNULIB_LOG1PF@
-# if @REPLACE_LOG1PF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef log1pf
-#   define log1pf rpl_log1pf
-#  endif
-_GL_FUNCDECL_RPL (log1pf, float, (float x));
-_GL_CXXALIAS_RPL (log1pf, float, (float x));
-# else
-#  if !@HAVE_LOG1PF@
-_GL_FUNCDECL_SYS (log1pf, float, (float x));
-#  endif
-_GL_CXXALIAS_SYS (log1pf, float, (float x));
-# endif
-_GL_CXXALIASWARN (log1pf);
-#elif defined GNULIB_POSIXCHECK
-# undef log1pf
-# if HAVE_RAW_DECL_LOG1PF
-_GL_WARN_ON_USE (log1pf, "log1pf is unportable - "
-                 "use gnulib module log1pf for portability");
-# endif
-#endif
-
-#if @GNULIB_LOG1P@
-# if @REPLACE_LOG1P@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef log1p
-#   define log1p rpl_log1p
-#  endif
-_GL_FUNCDECL_RPL (log1p, double, (double x));
-_GL_CXXALIAS_RPL (log1p, double, (double x));
-# else
-#  if !@HAVE_LOG1P@
-_GL_FUNCDECL_SYS (log1p, double, (double x));
-#  endif
-_GL_CXXALIAS_SYS (log1p, double, (double x));
-# endif
-_GL_CXXALIASWARN (log1p);
-#elif defined GNULIB_POSIXCHECK
-# undef log1p
-# if HAVE_RAW_DECL_LOG1P
-_GL_WARN_ON_USE (log1p, "log1p has portability problems - "
-                 "use gnulib module log1p for portability");
-# endif
-#endif
-
-#if @GNULIB_LOG1PL@
-# if @REPLACE_LOG1PL@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef log1pl
-#   define log1pl rpl_log1pl
-#  endif
-_GL_FUNCDECL_RPL (log1pl, long double, (long double x));
-_GL_CXXALIAS_RPL (log1pl, long double, (long double x));
-# else
-#  if !@HAVE_LOG1PL@
-_GL_FUNCDECL_SYS (log1pl, long double, (long double x));
-#  endif
-_GL_CXXALIAS_SYS (log1pl, long double, (long double x));
-# endif
-_GL_CXXALIASWARN (log1pl);
-#elif defined GNULIB_POSIXCHECK
-# undef log1pl
-# if HAVE_RAW_DECL_LOG1PL
-_GL_WARN_ON_USE (log1pl, "log1pl has portability problems - "
-                 "use gnulib module log1pl for portability");
-# endif
-#endif
-
-
-#if @GNULIB_LOG2F@
-# if @REPLACE_LOG2F@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef log2f
-#   define log2f rpl_log2f
-#  endif
-_GL_FUNCDECL_RPL (log2f, float, (float x));
-_GL_CXXALIAS_RPL (log2f, float, (float x));
-# else
-#  if !@HAVE_DECL_LOG2F@
-#   undef log2f
-_GL_FUNCDECL_SYS (log2f, float, (float x));
-#  endif
-_GL_CXXALIAS_SYS (log2f, float, (float x));
-# endif
-_GL_CXXALIASWARN (log2f);
-#elif defined GNULIB_POSIXCHECK
-# undef log2f
-# if HAVE_RAW_DECL_LOG2F
-_GL_WARN_ON_USE (log2f, "log2f is unportable - "
-                 "use gnulib module log2f for portability");
-# endif
-#endif
-
-#if @GNULIB_LOG2@
-# if @REPLACE_LOG2@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef log2
-#   define log2 rpl_log2
-#  endif
-_GL_FUNCDECL_RPL (log2, double, (double x));
-_GL_CXXALIAS_RPL (log2, double, (double x));
-# else
-#  if !@HAVE_DECL_LOG2@
-#   undef log2
-_GL_FUNCDECL_SYS (log2, double, (double x));
-#  endif
-_GL_CXXALIAS_SYS (log2, double, (double x));
-# endif
-_GL_CXXALIASWARN (log2);
-#elif defined GNULIB_POSIXCHECK
-# undef log2
-# if HAVE_RAW_DECL_LOG2
-_GL_WARN_ON_USE (log2, "log2 is unportable - "
-                 "use gnulib module log2 for portability");
-# endif
-#endif
-
-#if @GNULIB_LOG2L@
-# if @REPLACE_LOG2L@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef log2l
-#   define log2l rpl_log2l
-#  endif
-_GL_FUNCDECL_RPL (log2l, long double, (long double x));
-_GL_CXXALIAS_RPL (log2l, long double, (long double x));
-# else
-#  if !@HAVE_DECL_LOG2L@
-_GL_FUNCDECL_SYS (log2l, long double, (long double x));
-#  endif
-_GL_CXXALIAS_SYS (log2l, long double, (long double x));
-# endif
-_GL_CXXALIASWARN (log2l);
-#elif defined GNULIB_POSIXCHECK
-# undef log2l
-# if HAVE_RAW_DECL_LOG2L
-_GL_WARN_ON_USE (log2l, "log2l is unportable - "
-                 "use gnulib module log2l for portability");
-# endif
-#endif
-
-
-#if @GNULIB_LOGBF@
-# if @REPLACE_LOGBF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef logbf
-#   define logbf rpl_logbf
-#  endif
-_GL_FUNCDECL_RPL (logbf, float, (float x));
-_GL_CXXALIAS_RPL (logbf, float, (float x));
-# else
-#  if !@HAVE_LOGBF@
-_GL_FUNCDECL_SYS (logbf, float, (float x));
-#  endif
-_GL_CXXALIAS_SYS (logbf, float, (float x));
-# endif
-_GL_CXXALIASWARN (logbf);
-#elif defined GNULIB_POSIXCHECK
-# undef logbf
-# if HAVE_RAW_DECL_LOGBF
-_GL_WARN_ON_USE (logbf, "logbf is unportable - "
-                 "use gnulib module logbf for portability");
-# endif
-#endif
-
-#if @GNULIB_LOGB@
-# if @REPLACE_LOGB@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef logb
-#   define logb rpl_logb
-#  endif
-_GL_FUNCDECL_RPL (logb, double, (double x));
-_GL_CXXALIAS_RPL (logb, double, (double x));
-# else
-#  if !@HAVE_DECL_LOGB@
-_GL_FUNCDECL_SYS (logb, double, (double x));
-#  endif
-_GL_CXXALIAS_SYS (logb, double, (double x));
-# endif
-_GL_CXXALIASWARN (logb);
-#elif defined GNULIB_POSIXCHECK
-# undef logb
-# if HAVE_RAW_DECL_LOGB
-_GL_WARN_ON_USE (logb, "logb is unportable - "
-                 "use gnulib module logb for portability");
-# endif
-#endif
-
-#if @GNULIB_LOGBL@
-# if @REPLACE_LOGBL@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef logbl
-#   define logbl rpl_logbl
-#  endif
-_GL_FUNCDECL_RPL (logbl, long double, (long double x));
-_GL_CXXALIAS_RPL (logbl, long double, (long double x));
-# else
-#  if !@HAVE_LOGBL@
-_GL_FUNCDECL_SYS (logbl, long double, (long double x));
-#  endif
-_GL_CXXALIAS_SYS (logbl, long double, (long double x));
-# endif
-_GL_CXXALIASWARN (logbl);
-#elif defined GNULIB_POSIXCHECK
-# undef logbl
-# if HAVE_RAW_DECL_LOGBL
-_GL_WARN_ON_USE (logbl, "logbl is unportable - "
-                 "use gnulib module logbl for portability");
-# endif
-#endif
-
-
-#if @GNULIB_MODFF@
-# if @REPLACE_MODFF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef modff
-#   define modff rpl_modff
-#  endif
-_GL_FUNCDECL_RPL (modff, float, (float x, float *iptr) _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (modff, float, (float x, float *iptr));
-# else
-#  if !@HAVE_MODFF@
-#   undef modff
-_GL_FUNCDECL_SYS (modff, float, (float x, float *iptr) _GL_ARG_NONNULL ((2)));
-#  endif
-_GL_CXXALIAS_SYS (modff, float, (float x, float *iptr));
-# endif
-_GL_CXXALIASWARN (modff);
-#elif defined GNULIB_POSIXCHECK
-# undef modff
-# if HAVE_RAW_DECL_MODFF
-_GL_WARN_ON_USE (modff, "modff is unportable - "
-                 "use gnulib module modff for portability");
-# endif
-#endif
-
-#if @GNULIB_MODF@
-# if @REPLACE_MODF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef modf
-#   define modf rpl_modf
-#  endif
-_GL_FUNCDECL_RPL (modf, double, (double x, double *iptr) _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (modf, double, (double x, double *iptr));
-# else
-_GL_CXXALIAS_SYS (modf, double, (double x, double *iptr));
-# endif
-_GL_CXXALIASWARN (modf);
-#elif defined GNULIB_POSIXCHECK
-# undef modf
-# if HAVE_RAW_DECL_MODF
-_GL_WARN_ON_USE (modf, "modf has portability problems - "
-                 "use gnulib module modf for portability");
-# endif
-#endif
-
-#if @GNULIB_MODFL@
-# if @REPLACE_MODFL@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef modfl
-#   define modfl rpl_modfl
-#  endif
-_GL_FUNCDECL_RPL (modfl, long double, (long double x, long double *iptr)
-                                      _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (modfl, long double, (long double x, long double *iptr));
-# else
-#  if !@HAVE_MODFL@
-#   undef modfl
-_GL_FUNCDECL_SYS (modfl, long double, (long double x, long double *iptr)
-                                      _GL_ARG_NONNULL ((2)));
-#  endif
-_GL_CXXALIAS_SYS (modfl, long double, (long double x, long double *iptr));
-# endif
-_GL_CXXALIASWARN (modfl);
-#elif defined GNULIB_POSIXCHECK
-# undef modfl
-# if HAVE_RAW_DECL_MODFL
-_GL_WARN_ON_USE (modfl, "modfl is unportable - "
-                 "use gnulib module modfl for portability");
-# endif
-#endif
-
-
-#if @GNULIB_POWF@
-# if !@HAVE_POWF@
-#  undef powf
-_GL_FUNCDECL_SYS (powf, float, (float x, float y));
-# endif
-_GL_CXXALIAS_SYS (powf, float, (float x, float y));
-_GL_CXXALIASWARN (powf);
-#elif defined GNULIB_POSIXCHECK
-# undef powf
-# if HAVE_RAW_DECL_POWF
-_GL_WARN_ON_USE (powf, "powf is unportable - "
-                 "use gnulib module powf for portability");
-# endif
-#endif
-
-
-#if @GNULIB_REMAINDERF@
-# if @REPLACE_REMAINDERF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef remainderf
-#   define remainderf rpl_remainderf
-#  endif
-_GL_FUNCDECL_RPL (remainderf, float, (float x, float y));
-_GL_CXXALIAS_RPL (remainderf, float, (float x, float y));
-# else
-#  if !@HAVE_REMAINDERF@
-_GL_FUNCDECL_SYS (remainderf, float, (float x, float y));
-#  endif
-_GL_CXXALIAS_SYS (remainderf, float, (float x, float y));
-# endif
-_GL_CXXALIASWARN (remainderf);
-#elif defined GNULIB_POSIXCHECK
-# undef remainderf
-# if HAVE_RAW_DECL_REMAINDERF
-_GL_WARN_ON_USE (remainderf, "remainderf is unportable - "
-                 "use gnulib module remainderf for portability");
-# endif
-#endif
-
-#if @GNULIB_REMAINDER@
-# if @REPLACE_REMAINDER@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef remainder
-#   define remainder rpl_remainder
-#  endif
-_GL_FUNCDECL_RPL (remainder, double, (double x, double y));
-_GL_CXXALIAS_RPL (remainder, double, (double x, double y));
-# else
-#  if !@HAVE_REMAINDER@ || !@HAVE_DECL_REMAINDER@
-_GL_FUNCDECL_SYS (remainder, double, (double x, double y));
-#  endif
-_GL_CXXALIAS_SYS (remainder, double, (double x, double y));
-# endif
-_GL_CXXALIASWARN (remainder);
-#elif defined GNULIB_POSIXCHECK
-# undef remainder
-# if HAVE_RAW_DECL_REMAINDER
-_GL_WARN_ON_USE (remainder, "remainder is unportable - "
-                 "use gnulib module remainder for portability");
-# endif
-#endif
-
-#if @GNULIB_REMAINDERL@
-# if @REPLACE_REMAINDERL@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef remainderl
-#   define remainderl rpl_remainderl
-#  endif
-_GL_FUNCDECL_RPL (remainderl, long double, (long double x, long double y));
-_GL_CXXALIAS_RPL (remainderl, long double, (long double x, long double y));
-# else
-#  if !@HAVE_DECL_REMAINDERL@
-#   undef remainderl
-_GL_FUNCDECL_SYS (remainderl, long double, (long double x, long double y));
-#  endif
-_GL_CXXALIAS_SYS (remainderl, long double, (long double x, long double y));
-# endif
-_GL_CXXALIASWARN (remainderl);
-#elif defined GNULIB_POSIXCHECK
-# undef remainderl
-# if HAVE_RAW_DECL_REMAINDERL
-_GL_WARN_ON_USE (remainderl, "remainderl is unportable - "
-                 "use gnulib module remainderl for portability");
-# endif
-#endif
-
-
-#if @GNULIB_RINTF@
-# if !@HAVE_DECL_RINTF@
-_GL_FUNCDECL_SYS (rintf, float, (float x));
-# endif
-_GL_CXXALIAS_SYS (rintf, float, (float x));
-_GL_CXXALIASWARN (rintf);
-#elif defined GNULIB_POSIXCHECK
-# undef rintf
-# if HAVE_RAW_DECL_RINTF
-_GL_WARN_ON_USE (rintf, "rintf is unportable - "
-                 "use gnulib module rintf for portability");
-# endif
-#endif
-
-#if @GNULIB_RINT@
-# if !@HAVE_RINT@
-_GL_FUNCDECL_SYS (rint, double, (double x));
-# endif
-_GL_CXXALIAS_SYS (rint, double, (double x));
-_GL_CXXALIASWARN (rint);
-#elif defined GNULIB_POSIXCHECK
-# undef rint
-# if HAVE_RAW_DECL_RINT
-_GL_WARN_ON_USE (rint, "rint is unportable - "
-                 "use gnulib module rint for portability");
-# endif
-#endif
-
-#if @GNULIB_RINTL@
-# if !@HAVE_RINTL@
-_GL_FUNCDECL_SYS (rintl, long double, (long double x));
-# endif
-_GL_CXXALIAS_SYS (rintl, long double, (long double x));
-_GL_CXXALIASWARN (rintl);
-#elif defined GNULIB_POSIXCHECK
-# undef rintl
-# if HAVE_RAW_DECL_RINTL
-_GL_WARN_ON_USE (rintl, "rintl is unportable - "
-                 "use gnulib module rintl for portability");
-# endif
-#endif
-
-
-#if @GNULIB_ROUNDF@
-# if @REPLACE_ROUNDF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef roundf
-#   define roundf rpl_roundf
-#  endif
-_GL_FUNCDECL_RPL (roundf, float, (float x));
-_GL_CXXALIAS_RPL (roundf, float, (float x));
-# else
-#  if !@HAVE_DECL_ROUNDF@
-_GL_FUNCDECL_SYS (roundf, float, (float x));
-#  endif
-_GL_CXXALIAS_SYS (roundf, float, (float x));
-# endif
-_GL_CXXALIASWARN (roundf);
-#elif defined GNULIB_POSIXCHECK
-# undef roundf
-# if HAVE_RAW_DECL_ROUNDF
-_GL_WARN_ON_USE (roundf, "roundf is unportable - "
-                 "use gnulib module roundf for portability");
-# endif
-#endif
-
-#if @GNULIB_ROUND@
-# if @REPLACE_ROUND@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef round
-#   define round rpl_round
-#  endif
-_GL_FUNCDECL_RPL (round, double, (double x));
-_GL_CXXALIAS_RPL (round, double, (double x));
-# else
-#  if !@HAVE_DECL_ROUND@
-_GL_FUNCDECL_SYS (round, double, (double x));
-#  endif
-_GL_CXXALIAS_SYS (round, double, (double x));
-# endif
-_GL_CXXALIASWARN (round);
-#elif defined GNULIB_POSIXCHECK
-# undef round
-# if HAVE_RAW_DECL_ROUND
-_GL_WARN_ON_USE (round, "round is unportable - "
-                 "use gnulib module round for portability");
-# endif
-#endif
-
-#if @GNULIB_ROUNDL@
-# if @REPLACE_ROUNDL@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef roundl
-#   define roundl rpl_roundl
-#  endif
-_GL_FUNCDECL_RPL (roundl, long double, (long double x));
-_GL_CXXALIAS_RPL (roundl, long double, (long double x));
-# else
-#  if !@HAVE_DECL_ROUNDL@
-#   undef roundl
-_GL_FUNCDECL_SYS (roundl, long double, (long double x));
-#  endif
-_GL_CXXALIAS_SYS (roundl, long double, (long double x));
-# endif
-_GL_CXXALIASWARN (roundl);
-#elif defined GNULIB_POSIXCHECK
-# undef roundl
-# if HAVE_RAW_DECL_ROUNDL
-_GL_WARN_ON_USE (roundl, "roundl is unportable - "
-                 "use gnulib module roundl for portability");
-# endif
-#endif
-
-
-#if @GNULIB_SINF@
-# if !@HAVE_SINF@
-#  undef sinf
-_GL_FUNCDECL_SYS (sinf, float, (float x));
-# endif
-_GL_CXXALIAS_SYS (sinf, float, (float x));
-_GL_CXXALIASWARN (sinf);
-#elif defined GNULIB_POSIXCHECK
-# undef sinf
-# if HAVE_RAW_DECL_SINF
-_GL_WARN_ON_USE (sinf, "sinf is unportable - "
-                 "use gnulib module sinf for portability");
-# endif
-#endif
-
-#if @GNULIB_SINL@
-# if !@HAVE_SINL@ || !@HAVE_DECL_SINL@
-#  undef sinl
-_GL_FUNCDECL_SYS (sinl, long double, (long double x));
-# endif
-_GL_CXXALIAS_SYS (sinl, long double, (long double x));
-_GL_CXXALIASWARN (sinl);
-#elif defined GNULIB_POSIXCHECK
-# undef sinl
-# if HAVE_RAW_DECL_SINL
-_GL_WARN_ON_USE (sinl, "sinl is unportable - "
-                 "use gnulib module sinl for portability");
-# endif
-#endif
-
-
-#if @GNULIB_SINHF@
-# if !@HAVE_SINHF@
-#  undef sinhf
-_GL_FUNCDECL_SYS (sinhf, float, (float x));
-# endif
-_GL_CXXALIAS_SYS (sinhf, float, (float x));
-_GL_CXXALIASWARN (sinhf);
-#elif defined GNULIB_POSIXCHECK
-# undef sinhf
-# if HAVE_RAW_DECL_SINHF
-_GL_WARN_ON_USE (sinhf, "sinhf is unportable - "
-                 "use gnulib module sinhf for portability");
-# endif
-#endif
-
-
-#if @GNULIB_SQRTF@
-# if !@HAVE_SQRTF@
-#  undef sqrtf
-_GL_FUNCDECL_SYS (sqrtf, float, (float x));
-# endif
-_GL_CXXALIAS_SYS (sqrtf, float, (float x));
-_GL_CXXALIASWARN (sqrtf);
-#elif defined GNULIB_POSIXCHECK
-# undef sqrtf
-# if HAVE_RAW_DECL_SQRTF
-_GL_WARN_ON_USE (sqrtf, "sqrtf is unportable - "
-                 "use gnulib module sqrtf for portability");
-# endif
-#endif
-
-#if @GNULIB_SQRTL@
-# if @REPLACE_SQRTL@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef sqrtl
-#   define sqrtl rpl_sqrtl
-#  endif
-_GL_FUNCDECL_RPL (sqrtl, long double, (long double x));
-_GL_CXXALIAS_RPL (sqrtl, long double, (long double x));
-# else
-#  if !@HAVE_SQRTL@ || !@HAVE_DECL_SQRTL@
-#   undef sqrtl
-_GL_FUNCDECL_SYS (sqrtl, long double, (long double x));
-#  endif
-_GL_CXXALIAS_SYS (sqrtl, long double, (long double x));
-# endif
-_GL_CXXALIASWARN (sqrtl);
-#elif defined GNULIB_POSIXCHECK
-# undef sqrtl
-# if HAVE_RAW_DECL_SQRTL
-_GL_WARN_ON_USE (sqrtl, "sqrtl is unportable - "
-                 "use gnulib module sqrtl for portability");
-# endif
-#endif
-
-
-#if @GNULIB_TANF@
-# if !@HAVE_TANF@
-#  undef tanf
-_GL_FUNCDECL_SYS (tanf, float, (float x));
-# endif
-_GL_CXXALIAS_SYS (tanf, float, (float x));
-_GL_CXXALIASWARN (tanf);
-#elif defined GNULIB_POSIXCHECK
-# undef tanf
-# if HAVE_RAW_DECL_TANF
-_GL_WARN_ON_USE (tanf, "tanf is unportable - "
-                 "use gnulib module tanf for portability");
-# endif
-#endif
-
-#if @GNULIB_TANL@
-# if !@HAVE_TANL@ || !@HAVE_DECL_TANL@
-#  undef tanl
-_GL_FUNCDECL_SYS (tanl, long double, (long double x));
-# endif
-_GL_CXXALIAS_SYS (tanl, long double, (long double x));
-_GL_CXXALIASWARN (tanl);
-#elif defined GNULIB_POSIXCHECK
-# undef tanl
-# if HAVE_RAW_DECL_TANL
-_GL_WARN_ON_USE (tanl, "tanl is unportable - "
-                 "use gnulib module tanl for portability");
-# endif
-#endif
-
-
-#if @GNULIB_TANHF@
-# if !@HAVE_TANHF@
-#  undef tanhf
-_GL_FUNCDECL_SYS (tanhf, float, (float x));
-# endif
-_GL_CXXALIAS_SYS (tanhf, float, (float x));
-_GL_CXXALIASWARN (tanhf);
-#elif defined GNULIB_POSIXCHECK
-# undef tanhf
-# if HAVE_RAW_DECL_TANHF
-_GL_WARN_ON_USE (tanhf, "tanhf is unportable - "
-                 "use gnulib module tanhf for portability");
-# endif
-#endif
-
-
-#if @GNULIB_TRUNCF@
-# if @REPLACE_TRUNCF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define truncf rpl_truncf
-#  endif
-_GL_FUNCDECL_RPL (truncf, float, (float x));
-_GL_CXXALIAS_RPL (truncf, float, (float x));
-# else
-#  if !@HAVE_DECL_TRUNCF@
-_GL_FUNCDECL_SYS (truncf, float, (float x));
-#  endif
-_GL_CXXALIAS_SYS (truncf, float, (float x));
-# endif
-_GL_CXXALIASWARN (truncf);
-#elif defined GNULIB_POSIXCHECK
-# undef truncf
-# if HAVE_RAW_DECL_TRUNCF
-_GL_WARN_ON_USE (truncf, "truncf is unportable - "
-                 "use gnulib module truncf for portability");
-# endif
-#endif
-
-#if @GNULIB_TRUNC@
-# if @REPLACE_TRUNC@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define trunc rpl_trunc
-#  endif
-_GL_FUNCDECL_RPL (trunc, double, (double x));
-_GL_CXXALIAS_RPL (trunc, double, (double x));
-# else
-#  if !@HAVE_DECL_TRUNC@
-_GL_FUNCDECL_SYS (trunc, double, (double x));
-#  endif
-_GL_CXXALIAS_SYS (trunc, double, (double x));
-# endif
-_GL_CXXALIASWARN (trunc);
-#elif defined GNULIB_POSIXCHECK
-# undef trunc
-# if HAVE_RAW_DECL_TRUNC
-_GL_WARN_ON_USE (trunc, "trunc is unportable - "
-                 "use gnulib module trunc for portability");
-# endif
-#endif
-
-#if @GNULIB_TRUNCL@
-# if @REPLACE_TRUNCL@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef truncl
-#   define truncl rpl_truncl
-#  endif
-_GL_FUNCDECL_RPL (truncl, long double, (long double x));
-_GL_CXXALIAS_RPL (truncl, long double, (long double x));
-# else
-#  if !@HAVE_DECL_TRUNCL@
-_GL_FUNCDECL_SYS (truncl, long double, (long double x));
-#  endif
-_GL_CXXALIAS_SYS (truncl, long double, (long double x));
-# endif
-_GL_CXXALIASWARN (truncl);
-#elif defined GNULIB_POSIXCHECK
-# undef truncl
-# if HAVE_RAW_DECL_TRUNCL
-_GL_WARN_ON_USE (truncl, "truncl is unportable - "
-                 "use gnulib module truncl for portability");
-# endif
-#endif
-
-
-/* Definitions of function-like macros come here, after the function
-   declarations.  */
-
-
-#if @GNULIB_ISFINITE@
-# if @REPLACE_ISFINITE@
-_GL_EXTERN_C int gl_isfinitef (float x);
-_GL_EXTERN_C int gl_isfinited (double x);
-_GL_EXTERN_C int gl_isfinitel (long double x);
-#  undef isfinite
-#  define isfinite(x) \
-   (sizeof (x) == sizeof (long double) ? gl_isfinitel (x) : \
-    sizeof (x) == sizeof (double) ? gl_isfinited (x) : \
-    gl_isfinitef (x))
-# endif
-# ifdef __cplusplus
-#  ifdef isfinite
-_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isfinite)
-#   undef isfinite
-_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite)
-#  endif
-# endif
-#elif defined GNULIB_POSIXCHECK
-# if defined isfinite
-_GL_WARN_REAL_FLOATING_DECL (isfinite);
-#  undef isfinite
-#  define isfinite(x) _GL_WARN_REAL_FLOATING_IMPL (isfinite, x)
-# endif
-#endif
-
-
-#if @GNULIB_ISINF@
-# if @REPLACE_ISINF@
-_GL_EXTERN_C int gl_isinff (float x);
-_GL_EXTERN_C int gl_isinfd (double x);
-_GL_EXTERN_C int gl_isinfl (long double x);
-#  undef isinf
-#  define isinf(x) \
-   (sizeof (x) == sizeof (long double) ? gl_isinfl (x) : \
-    sizeof (x) == sizeof (double) ? gl_isinfd (x) : \
-    gl_isinff (x))
-# endif
-# ifdef __cplusplus
-#  ifdef isinf
-_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isinf)
-#   undef isinf
-_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf)
-#  endif
-# endif
-#elif defined GNULIB_POSIXCHECK
-# if defined isinf
-_GL_WARN_REAL_FLOATING_DECL (isinf);
-#  undef isinf
-#  define isinf(x) _GL_WARN_REAL_FLOATING_IMPL (isinf, x)
-# endif
-#endif
-
-
-#if @GNULIB_ISNANF@
-/* Test for NaN for 'float' numbers.  */
-# if @HAVE_ISNANF@
-/* The original <math.h> included above provides a declaration of isnan macro
-   or (older) isnanf function.  */
-#  if __GNUC__ >= 4
-    /* GCC 4.0 and newer provides three built-ins for isnan.  */
-#   undef isnanf
-#   define isnanf(x) __builtin_isnanf ((float)(x))
-#  elif defined isnan
-#   undef isnanf
-#   define isnanf(x) isnan ((float)(x))
-#  endif
-# else
-/* Test whether X is a NaN.  */
-#  undef isnanf
-#  define isnanf rpl_isnanf
-_GL_EXTERN_C int isnanf (float x);
-# endif
-#endif
-
-#if @GNULIB_ISNAND@
-/* Test for NaN for 'double' numbers.
-   This function is a gnulib extension, unlike isnan() which applied only
-   to 'double' numbers earlier but now is a type-generic macro.  */
-# if @HAVE_ISNAND@
-/* The original <math.h> included above provides a declaration of isnan
-   macro.  */
-#  if __GNUC__ >= 4
-    /* GCC 4.0 and newer provides three built-ins for isnan.  */
-#   undef isnand
-#   define isnand(x) __builtin_isnan ((double)(x))
-#  else
-#   undef isnand
-#   define isnand(x) isnan ((double)(x))
-#  endif
-# else
-/* Test whether X is a NaN.  */
-#  undef isnand
-#  define isnand rpl_isnand
-_GL_EXTERN_C int isnand (double x);
-# endif
-#endif
-
-#if @GNULIB_ISNANL@
-/* Test for NaN for 'long double' numbers.  */
-# if @HAVE_ISNANL@
-/* The original <math.h> included above provides a declaration of isnan
-   macro or (older) isnanl function.  */
-#  if __GNUC__ >= 4
-    /* GCC 4.0 and newer provides three built-ins for isnan.  */
-#   undef isnanl
-#   define isnanl(x) __builtin_isnanl ((long double)(x))
-#  elif defined isnan
-#   undef isnanl
-#   define isnanl(x) isnan ((long double)(x))
-#  endif
-# else
-/* Test whether X is a NaN.  */
-#  undef isnanl
-#  define isnanl rpl_isnanl
-_GL_EXTERN_C int isnanl (long double x) _GL_ATTRIBUTE_CONST;
-# endif
-#endif
-
-/* This must come *after* the snippets for GNULIB_ISNANF and GNULIB_ISNANL!  */
-#if @GNULIB_ISNAN@
-# if @REPLACE_ISNAN@
-/* We can't just use the isnanf macro (e.g.) as exposed by
-   isnanf.h (e.g.) here, because those may end up being macros
-   that recursively expand back to isnan.  So use the gnulib
-   replacements for them directly. */
-#  if @HAVE_ISNANF@ && __GNUC__ >= 4
-#   define gl_isnan_f(x) __builtin_isnanf ((float)(x))
-#  else
-_GL_EXTERN_C int rpl_isnanf (float x);
-#   define gl_isnan_f(x) rpl_isnanf (x)
-#  endif
-#  if @HAVE_ISNAND@ && __GNUC__ >= 4
-#   define gl_isnan_d(x) __builtin_isnan ((double)(x))
-#  else
-_GL_EXTERN_C int rpl_isnand (double x);
-#   define gl_isnan_d(x) rpl_isnand (x)
-#  endif
-#  if @HAVE_ISNANL@ && __GNUC__ >= 4
-#   define gl_isnan_l(x) __builtin_isnanl ((long double)(x))
-#  else
-_GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST;
-#   define gl_isnan_l(x) rpl_isnanl (x)
-#  endif
-#  undef isnan
-#  define isnan(x) \
-   (sizeof (x) == sizeof (long double) ? gl_isnan_l (x) : \
-    sizeof (x) == sizeof (double) ? gl_isnan_d (x) : \
-    gl_isnan_f (x))
-# elif __GNUC__ >= 4
-#  undef isnan
-#  define isnan(x) \
-   (sizeof (x) == sizeof (long double) ? __builtin_isnanl ((long double)(x)) : \
-    sizeof (x) == sizeof (double) ? __builtin_isnan ((double)(x)) : \
-    __builtin_isnanf ((float)(x)))
-# endif
-# ifdef __cplusplus
-#  ifdef isnan
-_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan)
-#   undef isnan
-_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan)
-#  endif
-# else
-/* Ensure isnan is a macro.  */
-#  ifndef isnan
-#   define isnan isnan
-#  endif
-# endif
-#elif defined GNULIB_POSIXCHECK
-# if defined isnan
-_GL_WARN_REAL_FLOATING_DECL (isnan);
-#  undef isnan
-#  define isnan(x) _GL_WARN_REAL_FLOATING_IMPL (isnan, x)
-# endif
-#endif
-
-
-#if @GNULIB_SIGNBIT@
-# if @REPLACE_SIGNBIT_USING_GCC@
-#  undef signbit
-   /* GCC 4.0 and newer provides three built-ins for signbit.  */
-#  define signbit(x) \
-   (sizeof (x) == sizeof (long double) ? __builtin_signbitl (x) : \
-    sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \
-    __builtin_signbitf (x))
-# endif
-# if @REPLACE_SIGNBIT@
-#  undef signbit
-_GL_EXTERN_C int gl_signbitf (float arg);
-_GL_EXTERN_C int gl_signbitd (double arg);
-_GL_EXTERN_C int gl_signbitl (long double arg);
-#  if __GNUC__ >= 2 && !defined __STRICT_ANSI__
-#   define _GL_NUM_UINT_WORDS(type) \
-      ((sizeof (type) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
-#   if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT && !defined gl_signbitf
-#    define gl_signbitf_OPTIMIZED_MACRO
-#    define gl_signbitf(arg) \
-       ({ union { float _value;                                         \
-                  unsigned int _word[_GL_NUM_UINT_WORDS (float)];       \
-                } _m;                                                   \
-          _m._value = (arg);                                            \
-          (_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1;          \
-        })
-#   endif
-#   if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT && !defined gl_signbitd
-#    define gl_signbitd_OPTIMIZED_MACRO
-#    define gl_signbitd(arg) \
-       ({ union { double _value;                                        \
-                  unsigned int _word[_GL_NUM_UINT_WORDS (double)];      \
-                } _m;                                                   \
-          _m._value = (arg);                                            \
-          (_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1;          \
-        })
-#   endif
-#   if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT && !defined gl_signbitl
-#    define gl_signbitl_OPTIMIZED_MACRO
-#    define gl_signbitl(arg) \
-       ({ union { long double _value;                                   \
-                  unsigned int _word[_GL_NUM_UINT_WORDS (long double)]; \
-                } _m;                                                   \
-          _m._value = (arg);                                            \
-          (_m._word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1;        \
-        })
-#   endif
-#  endif
-#  define signbit(x) \
-   (sizeof (x) == sizeof (long double) ? gl_signbitl (x) : \
-    sizeof (x) == sizeof (double) ? gl_signbitd (x) : \
-    gl_signbitf (x))
-# endif
-# ifdef __cplusplus
-#  ifdef signbit
-_GL_MATH_CXX_REAL_FLOATING_DECL_1 (signbit)
-#   undef signbit
-_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit)
-#  endif
-# endif
-#elif defined GNULIB_POSIXCHECK
-# if defined signbit
-_GL_WARN_REAL_FLOATING_DECL (signbit);
-#  undef signbit
-#  define signbit(x) _GL_WARN_REAL_FLOATING_IMPL (signbit, x)
-# endif
-#endif
-
-_GL_INLINE_HEADER_END
-
-#endif /* _@GUARD_PREFIX@_MATH_H */
-#endif /* _@GUARD_PREFIX@_MATH_H */

+ 0 - 402
gl/mbrtowc.c~

@@ -1,402 +0,0 @@
-/* Convert multibyte character to wide character.
-   Copyright (C) 1999-2002, 2005-2013 Free Software Foundation, Inc.
-   Written by Bruno Haible <bruno@clisp.org>, 2008.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include <wchar.h>
-
-#if GNULIB_defined_mbstate_t
-/* Implement mbrtowc() on top of mbtowc().  */
-
-# include <errno.h>
-# include <stdlib.h>
-
-# include "localcharset.h"
-# include "streq.h"
-# include "verify.h"
-
-
-verify (sizeof (mbstate_t) >= 4);
-
-static char internal_state[4];
-
-size_t
-mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
-{
-  char *pstate = (char *)ps;
-
-  if (s == NULL)
-    {
-      pwc = NULL;
-      s = "";
-      n = 1;
-    }
-
-  if (n == 0)
-    return (size_t)(-2);
-
-  /* Here n > 0.  */
-
-  if (pstate == NULL)
-    pstate = internal_state;
-
-  {
-    size_t nstate = pstate[0];
-    char buf[4];
-    const char *p;
-    size_t m;
-
-    switch (nstate)
-      {
-      case 0:
-        p = s;
-        m = n;
-        break;
-      case 3:
-        buf[2] = pstate[3];
-        /*FALLTHROUGH*/
-      case 2:
-        buf[1] = pstate[2];
-        /*FALLTHROUGH*/
-      case 1:
-        buf[0] = pstate[1];
-        p = buf;
-        m = nstate;
-        buf[m++] = s[0];
-        if (n >= 2 && m < 4)
-          {
-            buf[m++] = s[1];
-            if (n >= 3 && m < 4)
-              buf[m++] = s[2];
-          }
-        break;
-      default:
-        errno = EINVAL;
-        return (size_t)(-1);
-      }
-
-    /* Here m > 0.  */
-
-# if __GLIBC__ || defined __UCLIBC__
-    /* Work around bug <http://sourceware.org/bugzilla/show_bug.cgi?id=9674> */
-    mbtowc (NULL, NULL, 0);
-# endif
-    {
-      int res = mbtowc (pwc, p, m);
-
-      if (res >= 0)
-        {
-          if (pwc != NULL && ((*pwc == 0) != (res == 0)))
-            abort ();
-          if (nstate >= (res > 0 ? res : 1))
-            abort ();
-          res -= nstate;
-          pstate[0] = 0;
-          return res;
-        }
-
-      /* mbtowc does not distinguish between invalid and incomplete multibyte
-         sequences.  But mbrtowc needs to make this distinction.
-         There are two possible approaches:
-           - Use iconv() and its return value.
-           - Use built-in knowledge about the possible encodings.
-         Given the low quality of implementation of iconv() on the systems that
-         lack mbrtowc(), we use the second approach.
-         The possible encodings are:
-           - 8-bit encodings,
-           - EUC-JP, EUC-KR, GB2312, EUC-TW, BIG5, GB18030, SJIS,
-           - UTF-8.
-         Use specialized code for each.  */
-      if (m >= 4 || m >= MB_CUR_MAX)
-        goto invalid;
-      /* Here MB_CUR_MAX > 1 and 0 < m < 4.  */
-      {
-        const char *encoding = locale_charset ();
-
-        if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
-          {
-            /* Cf. unistr/u8-mblen.c.  */
-            unsigned char c = (unsigned char) p[0];
-
-            if (c >= 0xc2)
-              {
-                if (c < 0xe0)
-                  {
-                    if (m == 1)
-                      goto incomplete;
-                  }
-                else if (c < 0xf0)
-                  {
-                    if (m == 1)
-                      goto incomplete;
-                    if (m == 2)
-                      {
-                        unsigned char c2 = (unsigned char) p[1];
-
-                        if ((c2 ^ 0x80) < 0x40
-                            && (c >= 0xe1 || c2 >= 0xa0)
-                            && (c != 0xed || c2 < 0xa0))
-                          goto incomplete;
-                      }
-                  }
-                else if (c <= 0xf4)
-                  {
-                    if (m == 1)
-                      goto incomplete;
-                    else /* m == 2 || m == 3 */
-                      {
-                        unsigned char c2 = (unsigned char) p[1];
-
-                        if ((c2 ^ 0x80) < 0x40
-                            && (c >= 0xf1 || c2 >= 0x90)
-                            && (c < 0xf4 || (c == 0xf4 && c2 < 0x90)))
-                          {
-                            if (m == 2)
-                              goto incomplete;
-                            else /* m == 3 */
-                              {
-                                unsigned char c3 = (unsigned char) p[2];
-
-                                if ((c3 ^ 0x80) < 0x40)
-                                  goto incomplete;
-                              }
-                          }
-                      }
-                  }
-              }
-            goto invalid;
-          }
-
-        /* As a reference for this code, you can use the GNU libiconv
-           implementation.  Look for uses of the RET_TOOFEW macro.  */
-
-        if (STREQ_OPT (encoding,
-                       "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0))
-          {
-            if (m == 1)
-              {
-                unsigned char c = (unsigned char) p[0];
-
-                if ((c >= 0xa1 && c < 0xff) || c == 0x8e || c == 0x8f)
-                  goto incomplete;
-              }
-            if (m == 2)
-              {
-                unsigned char c = (unsigned char) p[0];
-
-                if (c == 0x8f)
-                  {
-                    unsigned char c2 = (unsigned char) p[1];
-
-                    if (c2 >= 0xa1 && c2 < 0xff)
-                      goto incomplete;
-                  }
-              }
-            goto invalid;
-          }
-        if (STREQ_OPT (encoding,
-                       "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
-            || STREQ_OPT (encoding,
-                          "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0)
-            || STREQ_OPT (encoding,
-                          "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0))
-          {
-            if (m == 1)
-              {
-                unsigned char c = (unsigned char) p[0];
-
-                if (c >= 0xa1 && c < 0xff)
-                  goto incomplete;
-              }
-            goto invalid;
-          }
-        if (STREQ_OPT (encoding,
-                       "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0))
-          {
-            if (m == 1)
-              {
-                unsigned char c = (unsigned char) p[0];
-
-                if ((c >= 0xa1 && c < 0xff) || c == 0x8e)
-                  goto incomplete;
-              }
-            else /* m == 2 || m == 3 */
-              {
-                unsigned char c = (unsigned char) p[0];
-
-                if (c == 0x8e)
-                  goto incomplete;
-              }
-            goto invalid;
-          }
-        if (STREQ_OPT (encoding,
-                       "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0))
-          {
-            if (m == 1)
-              {
-                unsigned char c = (unsigned char) p[0];
-
-                if ((c >= 0x90 && c <= 0xe3) || (c >= 0xf8 && c <= 0xfe))
-                  goto incomplete;
-              }
-            else /* m == 2 || m == 3 */
-              {
-                unsigned char c = (unsigned char) p[0];
-
-                if (c >= 0x90 && c <= 0xe3)
-                  {
-                    unsigned char c2 = (unsigned char) p[1];
-
-                    if (c2 >= 0x30 && c2 <= 0x39)
-                      {
-                        if (m == 2)
-                          goto incomplete;
-                        else /* m == 3 */
-                          {
-                            unsigned char c3 = (unsigned char) p[2];
-
-                            if (c3 >= 0x81 && c3 <= 0xfe)
-                              goto incomplete;
-                          }
-                      }
-                  }
-              }
-            goto invalid;
-          }
-        if (STREQ_OPT (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0))
-          {
-            if (m == 1)
-              {
-                unsigned char c = (unsigned char) p[0];
-
-                if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xea)
-                    || (c >= 0xf0 && c <= 0xf9))
-                  goto incomplete;
-              }
-            goto invalid;
-          }
-
-        /* An unknown multibyte encoding.  */
-        goto incomplete;
-      }
-
-     incomplete:
-      {
-        size_t k = nstate;
-        /* Here 0 <= k < m < 4.  */
-        pstate[++k] = s[0];
-        if (k < m)
-          {
-            pstate[++k] = s[1];
-            if (k < m)
-              pstate[++k] = s[2];
-          }
-        if (k != m)
-          abort ();
-      }
-      pstate[0] = m;
-      return (size_t)(-2);
-
-     invalid:
-      errno = EILSEQ;
-      /* The conversion state is undefined, says POSIX.  */
-      return (size_t)(-1);
-    }
-  }
-}
-
-#else
-/* Override the system's mbrtowc() function.  */
-
-# undef mbrtowc
-
-size_t
-rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
-{
-# if MBRTOWC_NULL_ARG2_BUG || MBRTOWC_RETVAL_BUG
-  if (s == NULL)
-    {
-      pwc = NULL;
-      s = "";
-      n = 1;
-    }
-# endif
-
-# if MBRTOWC_RETVAL_BUG
-  {
-    static mbstate_t internal_state;
-
-    /* Override mbrtowc's internal state.  We cannot call mbsinit() on the
-       hidden internal state, but we can call it on our variable.  */
-    if (ps == NULL)
-      ps = &internal_state;
-
-    if (!mbsinit (ps))
-      {
-        /* Parse the rest of the multibyte character byte for byte.  */
-        size_t count = 0;
-        for (; n > 0; s++, n--)
-          {
-            wchar_t wc;
-            size_t ret = mbrtowc (&wc, s, 1, ps);
-
-            if (ret == (size_t)(-1))
-              return (size_t)(-1);
-            count++;
-            if (ret != (size_t)(-2))
-              {
-                /* The multibyte character has been completed.  */
-                if (pwc != NULL)
-                  *pwc = wc;
-                return (wc == 0 ? 0 : count);
-              }
-          }
-        return (size_t)(-2);
-      }
-  }
-# endif
-
-# if MBRTOWC_NUL_RETVAL_BUG
-  {
-    wchar_t wc;
-    size_t ret = mbrtowc (&wc, s, n, ps);
-
-    if (ret != (size_t)(-1) && ret != (size_t)(-2))
-      {
-        if (pwc != NULL)
-          *pwc = wc;
-        if (wc == 0)
-          ret = 0;
-      }
-    return ret;
-  }
-# else
-  {
-#   if MBRTOWC_NULL_ARG1_BUG
-    wchar_t dummy;
-
-    if (pwc == NULL)
-      pwc = &dummy;
-#   endif
-
-    return mbrtowc (pwc, s, n, ps);
-  }
-# endif
-}
-
-#endif

+ 0 - 61
gl/mbsinit.c~

@@ -1,61 +0,0 @@
-/* Test for initial conversion state.
-   Copyright (C) 2008-2013 Free Software Foundation, Inc.
-   Written by Bruno Haible <bruno@clisp.org>, 2008.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include <wchar.h>
-
-#include "verify.h"
-
-#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
-
-/* On native Windows, 'mbstate_t' is defined as 'int'.  */
-
-int
-mbsinit (const mbstate_t *ps)
-{
-  return ps == NULL || *ps == 0;
-}
-
-#else
-
-/* Platforms that lack mbsinit() also lack mbrlen(), mbrtowc(), mbsrtowcs()
-   and wcrtomb(), wcsrtombs().
-   We assume that
-     - sizeof (mbstate_t) >= 4,
-     - only stateless encodings are supported (such as UTF-8 and EUC-JP, but
-       not ISO-2022 variants),
-     - for each encoding, the number of bytes for a wide character is <= 4.
-       (This maximum is attained for UTF-8, GB18030, EUC-TW.)
-   We define the meaning of mbstate_t as follows:
-     - In mb -> wc direction, mbstate_t's first byte contains the number of
-       buffered bytes (in the range 0..3), followed by up to 3 buffered bytes.
-     - In wc -> mb direction, mbstate_t contains no information. In other
-       words, it is always in the initial state.  */
-
-verify (sizeof (mbstate_t) >= 4);
-
-int
-mbsinit (const mbstate_t *ps)
-{
-  const char *pstate = (const char *)ps;
-
-  return pstate == NULL || pstate[0] == 0;
-}
-
-#endif

+ 0 - 44
gl/mbtowc-impl.h~

@@ -1,44 +0,0 @@
-/* Convert multibyte character to wide character.
-   Copyright (C) 2011-2013 Free Software Foundation, Inc.
-   Written by Bruno Haible <bruno@clisp.org>, 2011.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* We don't need a static internal state, because the encoding is not state
-   dependent, and when mbrtowc returns (size_t)(-2). we throw the result
-   away. */
-
-int
-mbtowc (wchar_t *pwc, const char *s, size_t n)
-{
-  if (s == NULL)
-    return 0;
-  else
-    {
-      mbstate_t state;
-      wchar_t wc;
-      size_t result;
-
-      memset (&state, 0, sizeof (mbstate_t));
-      result = mbrtowc (&wc, s, n, &state);
-      if (result == (size_t)-1 || result == (size_t)-2)
-        {
-          errno = EILSEQ;
-          return -1;
-        }
-      if (pwc != NULL)
-        *pwc = wc;
-      return (wc == 0 ? 0 : result);
-    }
-}

+ 0 - 26
gl/mbtowc.c~

@@ -1,26 +0,0 @@
-/* Convert multibyte character to wide character.
-   Copyright (C) 2011-2013 Free Software Foundation, Inc.
-   Written by Bruno Haible <bruno@clisp.org>, 2011.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include <stdlib.h>
-
-#include <errno.h>
-#include <string.h>
-#include <wchar.h>
-
-#include "mbtowc-impl.h"

+ 0 - 172
gl/memchr.c~

@@ -1,172 +0,0 @@
-/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2013
-   Free Software Foundation, Inc.
-
-   Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
-   with help from Dan Sahlin (dan@sics.se) and
-   commentary by Jim Blandy (jimb@ai.mit.edu);
-   adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
-   and implemented by Roland McGrath (roland@ai.mit.edu).
-
-NOTE: The canonical source of this file is maintained with the GNU C Library.
-Bugs can be reported to bug-glibc@prep.ai.mit.edu.
-
-This program is free software: you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or any
-later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef _LIBC
-# include <config.h>
-#endif
-
-#include <string.h>
-
-#include <stddef.h>
-
-#if defined _LIBC
-# include <memcopy.h>
-#else
-# define reg_char char
-#endif
-
-#include <limits.h>
-
-#if HAVE_BP_SYM_H || defined _LIBC
-# include <bp-sym.h>
-#else
-# define BP_SYM(sym) sym
-#endif
-
-#undef __memchr
-#ifdef _LIBC
-# undef memchr
-#endif
-
-#ifndef weak_alias
-# define __memchr memchr
-#endif
-
-/* Search no more than N bytes of S for C.  */
-void *
-__memchr (void const *s, int c_in, size_t n)
-{
-  /* On 32-bit hardware, choosing longword to be a 32-bit unsigned
-     long instead of a 64-bit uintmax_t tends to give better
-     performance.  On 64-bit hardware, unsigned long is generally 64
-     bits already.  Change this typedef to experiment with
-     performance.  */
-  typedef unsigned long int longword;
-
-  const unsigned char *char_ptr;
-  const longword *longword_ptr;
-  longword repeated_one;
-  longword repeated_c;
-  unsigned reg_char c;
-
-  c = (unsigned char) c_in;
-
-  /* Handle the first few bytes by reading one byte at a time.
-     Do this until CHAR_PTR is aligned on a longword boundary.  */
-  for (char_ptr = (const unsigned char *) s;
-       n > 0 && (size_t) char_ptr % sizeof (longword) != 0;
-       --n, ++char_ptr)
-    if (*char_ptr == c)
-      return (void *) char_ptr;
-
-  longword_ptr = (const longword *) char_ptr;
-
-  /* All these elucidatory comments refer to 4-byte longwords,
-     but the theory applies equally well to any size longwords.  */
-
-  /* Compute auxiliary longword values:
-     repeated_one is a value which has a 1 in every byte.
-     repeated_c has c in every byte.  */
-  repeated_one = 0x01010101;
-  repeated_c = c | (c << 8);
-  repeated_c |= repeated_c << 16;
-  if (0xffffffffU < (longword) -1)
-    {
-      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;
-            }
-        }
-    }
-
-  /* Instead of the traditional loop which tests each byte, we will test a
-     longword at a time.  The tricky part is testing if *any of the four*
-     bytes in the longword in question are equal to c.  We first use an xor
-     with repeated_c.  This reduces the task to testing whether *any of the
-     four* bytes in longword1 is zero.
-
-     We compute tmp =
-       ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7).
-     That is, we perform the following operations:
-       1. Subtract repeated_one.
-       2. & ~longword1.
-       3. & a mask consisting of 0x80 in every byte.
-     Consider what happens in each byte:
-       - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff,
-         and step 3 transforms it into 0x80.  A carry can also be propagated
-         to more significant bytes.
-       - If a byte of longword1 is nonzero, let its lowest 1 bit be at
-         position k (0 <= k <= 7); so the lowest k bits are 0.  After step 1,
-         the byte ends in a single bit of value 0 and k bits of value 1.
-         After step 2, the result is just k bits of value 1: 2^k - 1.  After
-         step 3, the result is 0.  And no carry is produced.
-     So, if longword1 has only non-zero bytes, tmp is zero.
-     Whereas if longword1 has a zero byte, call j the position of the least
-     significant zero byte.  Then the result has a zero at positions 0, ...,
-     j-1 and a 0x80 at position j.  We cannot predict the result at the more
-     significant bytes (positions j+1..3), but it does not matter since we
-     already have a non-zero bit at position 8*j+7.
-
-     So, the test whether any byte in longword1 is zero is equivalent to
-     testing whether tmp is nonzero.  */
-
-  while (n >= sizeof (longword))
-    {
-      longword longword1 = *longword_ptr ^ repeated_c;
-
-      if ((((longword1 - repeated_one) & ~longword1)
-           & (repeated_one << 7)) != 0)
-        break;
-      longword_ptr++;
-      n -= sizeof (longword);
-    }
-
-  char_ptr = (const unsigned char *) longword_ptr;
-
-  /* At this point, we know that either n < sizeof (longword), or one of the
-     sizeof (longword) bytes starting at char_ptr is == c.  On little-endian
-     machines, we could determine the first such byte without any further
-     memory accesses, just by looking at the tmp result from the last loop
-     iteration.  But this does not work on big-endian machines.  Choose code
-     that works in both cases.  */
-
-  for (; n > 0; --n, ++char_ptr)
-    {
-      if (*char_ptr == c)
-        return (void *) char_ptr;
-    }
-
-  return NULL;
-}
-#ifdef weak_alias
-weak_alias (__memchr, BP_SYM (memchr))
-#endif

+ 0 - 741
gl/mktime.c~

@@ -1,741 +0,0 @@
-/* Convert a 'struct tm' to a time_t value.
-   Copyright (C) 1993-2013 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Paul Eggert <eggert@twinsun.com>.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public
-   License as published by the Free Software Foundation; either
-   version 3 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-/* Define this to have a standalone program to test this implementation of
-   mktime.  */
-/* #define DEBUG 1 */
-
-#ifndef _LIBC
-# include <config.h>
-#endif
-
-/* Assume that leap seconds are possible, unless told otherwise.
-   If the host has a 'zic' command with a '-L leapsecondfilename' option,
-   then it supports leap seconds; otherwise it probably doesn't.  */
-#ifndef LEAP_SECONDS_POSSIBLE
-# define LEAP_SECONDS_POSSIBLE 1
-#endif
-
-#include <time.h>
-
-#include <limits.h>
-
-#include <string.h>		/* For the real memcpy prototype.  */
-
-#if DEBUG
-# include <stdio.h>
-# include <stdlib.h>
-/* Make it work even if the system's libc has its own mktime routine.  */
-# undef mktime
-# define mktime my_mktime
-#endif /* DEBUG */
-
-/* Some of the code in this file assumes that signed integer overflow
-   silently wraps around.  This assumption can't easily be programmed
-   around, nor can it be checked for portably at compile-time or
-   easily eliminated at run-time.
-
-   Define WRAPV to 1 if the assumption is valid and if
-     #pragma GCC optimize ("wrapv")
-   does not trigger GCC bug 51793
-   <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51793>.
-   Otherwise, define it to 0; this forces the use of slower code that,
-   while not guaranteed by the C Standard, works on all production
-   platforms that we know about.  */
-#ifndef WRAPV
-# if (((__GNUC__ == 4 && 4 <= __GNUC_MINOR__) || 4 < __GNUC__) \
-      && defined __GLIBC__)
-#  pragma GCC optimize ("wrapv")
-#  define WRAPV 1
-# else
-#  define WRAPV 0
-# endif
-#endif
-
-/* Verify a requirement at compile-time (unlike assert, which is runtime).  */
-#define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; }
-
-/* A signed type that is at least one bit wider than int.  */
-#if INT_MAX <= LONG_MAX / 2
-typedef long int long_int;
-#else
-typedef long long int long_int;
-#endif
-verify (long_int_is_wide_enough, INT_MAX == INT_MAX * (long_int) 2 / 2);
-
-/* Shift A right by B bits portably, by dividing A by 2**B and
-   truncating towards minus infinity.  A and B should be free of side
-   effects, and B should be in the range 0 <= B <= INT_BITS - 2, where
-   INT_BITS is the number of useful bits in an int.  GNU code can
-   assume that INT_BITS is at least 32.
-
-   ISO C99 says that A >> B is implementation-defined if A < 0.  Some
-   implementations (e.g., UNICOS 9.0 on a Cray Y-MP EL) don't shift
-   right in the usual way when A < 0, so SHR falls back on division if
-   ordinary A >> B doesn't seem to be the usual signed shift.  */
-#define SHR(a, b)                                               \
-  ((-1 >> 1 == -1                                               \
-    && (long_int) -1 >> 1 == -1                                 \
-    && ((time_t) -1 >> 1 == -1 || ! TYPE_SIGNED (time_t)))      \
-   ? (a) >> (b)                                                 \
-   : (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))
-
-/* 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)
-
-/* True if negative values of the signed integer type T use two's
-   complement, or if T is an unsigned integer type.  */
-#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
-
-/* True if the arithmetic type T is signed.  */
-#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) \
-  ((t) (! TYPE_SIGNED (t) \
-	? (t) 0 \
-	: ~ TYPE_MAXIMUM (t)))
-#define TYPE_MAXIMUM(t) \
-  ((t) (! TYPE_SIGNED (t) \
-	? (t) -1 \
-	: ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
-
-#ifndef TIME_T_MIN
-# define TIME_T_MIN TYPE_MINIMUM (time_t)
-#endif
-#ifndef TIME_T_MAX
-# define TIME_T_MAX TYPE_MAXIMUM (time_t)
-#endif
-#define TIME_T_MIDPOINT (SHR (TIME_T_MIN + TIME_T_MAX, 1) + 1)
-
-verify (time_t_is_integer, TYPE_IS_INTEGER (time_t));
-verify (twos_complement_arithmetic,
-	(TYPE_TWOS_COMPLEMENT (int)
-	 && TYPE_TWOS_COMPLEMENT (long_int)
-	 && TYPE_TWOS_COMPLEMENT (time_t)));
-
-#define EPOCH_YEAR 1970
-#define TM_YEAR_BASE 1900
-verify (base_year_is_a_multiple_of_100, TM_YEAR_BASE % 100 == 0);
-
-/* Return 1 if YEAR + TM_YEAR_BASE is a leap year.  */
-static int
-leapyear (long_int year)
-{
-  /* Don't add YEAR to TM_YEAR_BASE, as that might overflow.
-     Also, work even if YEAR is negative.  */
-  return
-    ((year & 3) == 0
-     && (year % 100 != 0
-	 || ((year / 100) & 3) == (- (TM_YEAR_BASE / 100) & 3)));
-}
-
-/* How many days come before each month (0-12).  */
-#ifndef _LIBC
-static
-#endif
-const unsigned short int __mon_yday[2][13] =
-  {
-    /* Normal years.  */
-    { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
-    /* Leap years.  */
-    { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
-  };
-
-
-#ifndef _LIBC
-/* Portable standalone applications should supply a <time.h> that
-   declares a POSIX-compliant localtime_r, for the benefit of older
-   implementations that lack localtime_r or have a nonstandard one.
-   See the gnulib time_r module for one way to implement this.  */
-# undef __localtime_r
-# define __localtime_r localtime_r
-# define __mktime_internal mktime_internal
-# include "mktime-internal.h"
-#endif
-
-/* Return 1 if the values A and B differ according to the rules for
-   tm_isdst: A and B differ if one is zero and the other positive.  */
-static int
-isdst_differ (int a, int b)
-{
-  return (!a != !b) && (0 <= a) && (0 <= b);
-}
-
-/* Return an integer value measuring (YEAR1-YDAY1 HOUR1:MIN1:SEC1) -
-   (YEAR0-YDAY0 HOUR0:MIN0:SEC0) in seconds, assuming that the clocks
-   were not adjusted between the time stamps.
-
-   The YEAR values uses the same numbering as TP->tm_year.  Values
-   need not be in the usual range.  However, YEAR1 must not be less
-   than 2 * INT_MIN or greater than 2 * INT_MAX.
-
-   The result may overflow.  It is the caller's responsibility to
-   detect overflow.  */
-
-static time_t
-ydhms_diff (long_int year1, long_int yday1, int hour1, int min1, int sec1,
-	    int year0, int yday0, int hour0, int min0, int sec0)
-{
-  verify (C99_integer_division, -1 / 2 == 0);
-
-  /* Compute intervening leap days correctly even if year is negative.
-     Take care to avoid integer overflow here.  */
-  int a4 = SHR (year1, 2) + SHR (TM_YEAR_BASE, 2) - ! (year1 & 3);
-  int b4 = SHR (year0, 2) + SHR (TM_YEAR_BASE, 2) - ! (year0 & 3);
-  int a100 = a4 / 25 - (a4 % 25 < 0);
-  int b100 = b4 / 25 - (b4 % 25 < 0);
-  int a400 = SHR (a100, 2);
-  int b400 = SHR (b100, 2);
-  int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400);
-
-  /* Compute the desired time in time_t precision.  Overflow might
-     occur here.  */
-  time_t tyear1 = year1;
-  time_t years = tyear1 - year0;
-  time_t days = 365 * years + yday1 - yday0 + intervening_leap_days;
-  time_t hours = 24 * days + hour1 - hour0;
-  time_t minutes = 60 * hours + min1 - min0;
-  time_t seconds = 60 * minutes + sec1 - sec0;
-  return seconds;
-}
-
-/* Return the average of A and B, even if A + B would overflow.  */
-static time_t
-time_t_avg (time_t a, time_t b)
-{
-  return SHR (a, 1) + SHR (b, 1) + (a & b & 1);
-}
-
-/* Return 1 if A + B does not overflow.  If time_t is unsigned and if
-   B's top bit is set, assume that the sum represents A - -B, and
-   return 1 if the subtraction does not wrap around.  */
-static int
-time_t_add_ok (time_t a, time_t b)
-{
-  if (! TYPE_SIGNED (time_t))
-    {
-      time_t sum = a + b;
-      return (sum < a) == (TIME_T_MIDPOINT <= b);
-    }
-  else if (WRAPV)
-    {
-      time_t sum = a + b;
-      return (sum < a) == (b < 0);
-    }
-  else
-    {
-      time_t avg = time_t_avg (a, b);
-      return TIME_T_MIN / 2 <= avg && avg <= TIME_T_MAX / 2;
-    }
-}
-
-/* Return 1 if A + B does not overflow.  */
-static int
-time_t_int_add_ok (time_t a, int b)
-{
-  verify (int_no_wider_than_time_t, INT_MAX <= TIME_T_MAX);
-  if (WRAPV)
-    {
-      time_t sum = a + b;
-      return (sum < a) == (b < 0);
-    }
-  else
-    {
-      int a_odd = a & 1;
-      time_t avg = SHR (a, 1) + (SHR (b, 1) + (a_odd & b));
-      return TIME_T_MIN / 2 <= avg && avg <= TIME_T_MAX / 2;
-    }
-}
-
-/* Return a time_t value corresponding to (YEAR-YDAY HOUR:MIN:SEC),
-   assuming that *T corresponds to *TP and that no clock adjustments
-   occurred between *TP and the desired time.
-   If TP is null, return a value not equal to *T; this avoids false matches.
-   If overflow occurs, yield the minimal or maximal value, except do not
-   yield a value equal to *T.  */
-static time_t
-guess_time_tm (long_int year, long_int yday, int hour, int min, int sec,
-	       const time_t *t, const struct tm *tp)
-{
-  if (tp)
-    {
-      time_t d = ydhms_diff (year, yday, hour, min, sec,
-			     tp->tm_year, tp->tm_yday,
-			     tp->tm_hour, tp->tm_min, tp->tm_sec);
-      if (time_t_add_ok (*t, d))
-	return *t + d;
-    }
-
-  /* Overflow occurred one way or another.  Return the nearest result
-     that is actually in range, except don't report a zero difference
-     if the actual difference is nonzero, as that would cause a false
-     match; and don't oscillate between two values, as that would
-     confuse the spring-forward gap detector.  */
-  return (*t < TIME_T_MIDPOINT
-	  ? (*t <= TIME_T_MIN + 1 ? *t + 1 : TIME_T_MIN)
-	  : (TIME_T_MAX - 1 <= *t ? *t - 1 : TIME_T_MAX));
-}
-
-/* Use CONVERT to convert *T to a broken down time in *TP.
-   If *T is out of range for conversion, adjust it so that
-   it is the nearest in-range value and then convert that.  */
-static struct tm *
-ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
-		time_t *t, struct tm *tp)
-{
-  struct tm *r = convert (t, tp);
-
-  if (!r && *t)
-    {
-      time_t bad = *t;
-      time_t ok = 0;
-
-      /* BAD is a known unconvertible time_t, and OK is a known good one.
-	 Use binary search to narrow the range between BAD and OK until
-	 they differ by 1.  */
-      while (bad != ok + (bad < 0 ? -1 : 1))
-	{
-	  time_t mid = *t = time_t_avg (ok, bad);
-	  r = convert (t, tp);
-	  if (r)
-	    ok = mid;
-	  else
-	    bad = mid;
-	}
-
-      if (!r && ok)
-	{
-	  /* The last conversion attempt failed;
-	     revert to the most recent successful attempt.  */
-	  *t = ok;
-	  r = convert (t, tp);
-	}
-    }
-
-  return r;
-}
-
-
-/* Convert *TP to a time_t value, inverting
-   the monotonic and mostly-unit-linear conversion function CONVERT.
-   Use *OFFSET to keep track of a guess at the offset of the result,
-   compared to what the result would be for UTC without leap seconds.
-   If *OFFSET's guess is correct, only one CONVERT call is needed.
-   This function is external because it is used also by timegm.c.  */
-time_t
-__mktime_internal (struct tm *tp,
-		   struct tm *(*convert) (const time_t *, struct tm *),
-		   time_t *offset)
-{
-  time_t t, gt, t0, t1, t2;
-  struct tm tm;
-
-  /* The maximum number of probes (calls to CONVERT) should be enough
-     to handle any combinations of time zone rule changes, solar time,
-     leap seconds, and oscillations around a spring-forward gap.
-     POSIX.1 prohibits leap seconds, but some hosts have them anyway.  */
-  int remaining_probes = 6;
-
-  /* Time requested.  Copy it in case CONVERT modifies *TP; this can
-     occur if TP is localtime's returned value and CONVERT is localtime.  */
-  int sec = tp->tm_sec;
-  int min = tp->tm_min;
-  int hour = tp->tm_hour;
-  int mday = tp->tm_mday;
-  int mon = tp->tm_mon;
-  int year_requested = tp->tm_year;
-  int isdst = tp->tm_isdst;
-
-  /* 1 if the previous probe was DST.  */
-  int dst2;
-
-  /* Ensure that mon is in range, and set year accordingly.  */
-  int mon_remainder = mon % 12;
-  int negative_mon_remainder = mon_remainder < 0;
-  int mon_years = mon / 12 - negative_mon_remainder;
-  long_int lyear_requested = year_requested;
-  long_int year = lyear_requested + mon_years;
-
-  /* The other values need not be in range:
-     the remaining code handles minor overflows correctly,
-     assuming int and time_t arithmetic wraps around.
-     Major overflows are caught at the end.  */
-
-  /* Calculate day of year from year, month, and day of month.
-     The result need not be in range.  */
-  int mon_yday = ((__mon_yday[leapyear (year)]
-		   [mon_remainder + 12 * negative_mon_remainder])
-		  - 1);
-  long_int lmday = mday;
-  long_int yday = mon_yday + lmday;
-
-  time_t guessed_offset = *offset;
-
-  int sec_requested = sec;
-
-  if (LEAP_SECONDS_POSSIBLE)
-    {
-      /* Handle out-of-range seconds specially,
-	 since ydhms_tm_diff assumes every minute has 60 seconds.  */
-      if (sec < 0)
-	sec = 0;
-      if (59 < sec)
-	sec = 59;
-    }
-
-  /* Invert CONVERT by probing.  First assume the same offset as last
-     time.  */
-
-  t0 = ydhms_diff (year, yday, hour, min, sec,
-		   EPOCH_YEAR - TM_YEAR_BASE, 0, 0, 0, - guessed_offset);
-
-  if (TIME_T_MAX / INT_MAX / 366 / 24 / 60 / 60 < 3)
-    {
-      /* time_t isn't large enough to rule out overflows, so check
-	 for major overflows.  A gross check suffices, since if t0
-	 has overflowed, it is off by a multiple of TIME_T_MAX -
-	 TIME_T_MIN + 1.  So ignore any component of the difference
-	 that is bounded by a small value.  */
-
-      /* Approximate log base 2 of the number of time units per
-	 biennium.  A biennium is 2 years; use this unit instead of
-	 years to avoid integer overflow.  For example, 2 average
-	 Gregorian years are 2 * 365.2425 * 24 * 60 * 60 seconds,
-	 which is 63113904 seconds, and rint (log2 (63113904)) is
-	 26.  */
-      int ALOG2_SECONDS_PER_BIENNIUM = 26;
-      int ALOG2_MINUTES_PER_BIENNIUM = 20;
-      int ALOG2_HOURS_PER_BIENNIUM = 14;
-      int ALOG2_DAYS_PER_BIENNIUM = 10;
-      int LOG2_YEARS_PER_BIENNIUM = 1;
-
-      int approx_requested_biennia =
-	(SHR (year_requested, LOG2_YEARS_PER_BIENNIUM)
-	 - SHR (EPOCH_YEAR - TM_YEAR_BASE, LOG2_YEARS_PER_BIENNIUM)
-	 + SHR (mday, ALOG2_DAYS_PER_BIENNIUM)
-	 + SHR (hour, ALOG2_HOURS_PER_BIENNIUM)
-	 + SHR (min, ALOG2_MINUTES_PER_BIENNIUM)
-	 + (LEAP_SECONDS_POSSIBLE
-	    ? 0
-	    : SHR (sec, ALOG2_SECONDS_PER_BIENNIUM)));
-
-      int approx_biennia = SHR (t0, ALOG2_SECONDS_PER_BIENNIUM);
-      int diff = approx_biennia - approx_requested_biennia;
-      int approx_abs_diff = diff < 0 ? -1 - diff : diff;
-
-      /* IRIX 4.0.5 cc miscalculates TIME_T_MIN / 3: it erroneously
-	 gives a positive value of 715827882.  Setting a variable
-	 first then doing math on it seems to work.
-	 (ghazi@caip.rutgers.edu) */
-      time_t time_t_max = TIME_T_MAX;
-      time_t time_t_min = TIME_T_MIN;
-      time_t overflow_threshold =
-	(time_t_max / 3 - time_t_min / 3) >> ALOG2_SECONDS_PER_BIENNIUM;
-
-      if (overflow_threshold < approx_abs_diff)
-	{
-	  /* Overflow occurred.  Try repairing it; this might work if
-	     the time zone offset is enough to undo the overflow.  */
-	  time_t repaired_t0 = -1 - t0;
-	  approx_biennia = SHR (repaired_t0, ALOG2_SECONDS_PER_BIENNIUM);
-	  diff = approx_biennia - approx_requested_biennia;
-	  approx_abs_diff = diff < 0 ? -1 - diff : diff;
-	  if (overflow_threshold < approx_abs_diff)
-	    return -1;
-	  guessed_offset += repaired_t0 - t0;
-	  t0 = repaired_t0;
-	}
-    }
-
-  /* Repeatedly use the error to improve the guess.  */
-
-  for (t = t1 = t2 = t0, dst2 = 0;
-       (gt = guess_time_tm (year, yday, hour, min, sec, &t,
-			    ranged_convert (convert, &t, &tm)),
-	t != gt);
-       t1 = t2, t2 = t, t = gt, dst2 = tm.tm_isdst != 0)
-    if (t == t1 && t != t2
-	&& (tm.tm_isdst < 0
-	    || (isdst < 0
-		? dst2 <= (tm.tm_isdst != 0)
-		: (isdst != 0) != (tm.tm_isdst != 0))))
-      /* We can't possibly find a match, as we are oscillating
-	 between two values.  The requested time probably falls
-	 within a spring-forward gap of size GT - T.  Follow the common
-	 practice in this case, which is to return a time that is GT - T
-	 away from the requested time, preferring a time whose
-	 tm_isdst differs from the requested value.  (If no tm_isdst
-	 was requested and only one of the two values has a nonzero
-	 tm_isdst, prefer that value.)  In practice, this is more
-	 useful than returning -1.  */
-      goto offset_found;
-    else if (--remaining_probes == 0)
-      return -1;
-
-  /* We have a match.  Check whether tm.tm_isdst has the requested
-     value, if any.  */
-  if (isdst_differ (isdst, tm.tm_isdst))
-    {
-      /* tm.tm_isdst has the wrong value.  Look for a neighboring
-	 time with the right value, and use its UTC offset.
-
-	 Heuristic: probe the adjacent timestamps in both directions,
-	 looking for the desired isdst.  This should work for all real
-	 time zone histories in the tz database.  */
-
-      /* Distance between probes when looking for a DST boundary.  In
-	 tzdata2003a, the shortest period of DST is 601200 seconds
-	 (e.g., America/Recife starting 2000-10-08 01:00), and the
-	 shortest period of non-DST surrounded by DST is 694800
-	 seconds (Africa/Tunis starting 1943-04-17 01:00).  Use the
-	 minimum of these two values, so we don't miss these short
-	 periods when probing.  */
-      int stride = 601200;
-
-      /* The longest period of DST in tzdata2003a is 536454000 seconds
-	 (e.g., America/Jujuy starting 1946-10-01 01:00).  The longest
-	 period of non-DST is much longer, but it makes no real sense
-	 to search for more than a year of non-DST, so use the DST
-	 max.  */
-      int duration_max = 536454000;
-
-      /* Search in both directions, so the maximum distance is half
-	 the duration; add the stride to avoid off-by-1 problems.  */
-      int delta_bound = duration_max / 2 + stride;
-
-      int delta, direction;
-
-      for (delta = stride; delta < delta_bound; delta += stride)
-	for (direction = -1; direction <= 1; direction += 2)
-	  if (time_t_int_add_ok (t, delta * direction))
-	    {
-	      time_t ot = t + delta * direction;
-	      struct tm otm;
-	      ranged_convert (convert, &ot, &otm);
-	      if (! isdst_differ (isdst, otm.tm_isdst))
-		{
-		  /* We found the desired tm_isdst.
-		     Extrapolate back to the desired time.  */
-		  t = guess_time_tm (year, yday, hour, min, sec, &ot, &otm);
-		  ranged_convert (convert, &t, &tm);
-		  goto offset_found;
-		}
-	    }
-    }
-
- offset_found:
-  *offset = guessed_offset + t - t0;
-
-  if (LEAP_SECONDS_POSSIBLE && sec_requested != tm.tm_sec)
-    {
-      /* Adjust time to reflect the tm_sec requested, not the normalized value.
-	 Also, repair any damage from a false match due to a leap second.  */
-      int sec_adjustment = (sec == 0 && tm.tm_sec == 60) - sec;
-      if (! time_t_int_add_ok (t, sec_requested))
-	return -1;
-      t1 = t + sec_requested;
-      if (! time_t_int_add_ok (t1, sec_adjustment))
-	return -1;
-      t2 = t1 + sec_adjustment;
-      if (! convert (&t2, &tm))
-	return -1;
-      t = t2;
-    }
-
-  *tp = tm;
-  return t;
-}
-
-
-/* FIXME: This should use a signed type wide enough to hold any UTC
-   offset in seconds.  'int' should be good enough for GNU code.  We
-   can't fix this unilaterally though, as other modules invoke
-   __mktime_internal.  */
-static time_t localtime_offset;
-
-/* Convert *TP to a time_t value.  */
-time_t
-mktime (struct tm *tp)
-{
-#ifdef _LIBC
-  /* POSIX.1 8.1.1 requires that whenever mktime() is called, the
-     time zone names contained in the external variable 'tzname' shall
-     be set as if the tzset() function had been called.  */
-  __tzset ();
-#endif
-
-  return __mktime_internal (tp, __localtime_r, &localtime_offset);
-}
-
-#ifdef weak_alias
-weak_alias (mktime, timelocal)
-#endif
-
-#ifdef _LIBC
-libc_hidden_def (mktime)
-libc_hidden_weak (timelocal)
-#endif
-
-#if DEBUG
-
-static int
-not_equal_tm (const struct tm *a, const struct tm *b)
-{
-  return ((a->tm_sec ^ b->tm_sec)
-	  | (a->tm_min ^ b->tm_min)
-	  | (a->tm_hour ^ b->tm_hour)
-	  | (a->tm_mday ^ b->tm_mday)
-	  | (a->tm_mon ^ b->tm_mon)
-	  | (a->tm_year ^ b->tm_year)
-	  | (a->tm_yday ^ b->tm_yday)
-	  | isdst_differ (a->tm_isdst, b->tm_isdst));
-}
-
-static void
-print_tm (const struct tm *tp)
-{
-  if (tp)
-    printf ("%04d-%02d-%02d %02d:%02d:%02d yday %03d wday %d isdst %d",
-	    tp->tm_year + TM_YEAR_BASE, tp->tm_mon + 1, tp->tm_mday,
-	    tp->tm_hour, tp->tm_min, tp->tm_sec,
-	    tp->tm_yday, tp->tm_wday, tp->tm_isdst);
-  else
-    printf ("0");
-}
-
-static int
-check_result (time_t tk, struct tm tmk, time_t tl, const struct tm *lt)
-{
-  if (tk != tl || !lt || not_equal_tm (&tmk, lt))
-    {
-      printf ("mktime (");
-      print_tm (lt);
-      printf (")\nyields (");
-      print_tm (&tmk);
-      printf (") == %ld, should be %ld\n", (long int) tk, (long int) tl);
-      return 1;
-    }
-
-  return 0;
-}
-
-int
-main (int argc, char **argv)
-{
-  int status = 0;
-  struct tm tm, tmk, tml;
-  struct tm *lt;
-  time_t tk, tl, tl1;
-  char trailer;
-
-  if ((argc == 3 || argc == 4)
-      && (sscanf (argv[1], "%d-%d-%d%c",
-		  &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &trailer)
-	  == 3)
-      && (sscanf (argv[2], "%d:%d:%d%c",
-		  &tm.tm_hour, &tm.tm_min, &tm.tm_sec, &trailer)
-	  == 3))
-    {
-      tm.tm_year -= TM_YEAR_BASE;
-      tm.tm_mon--;
-      tm.tm_isdst = argc == 3 ? -1 : atoi (argv[3]);
-      tmk = tm;
-      tl = mktime (&tmk);
-      lt = localtime (&tl);
-      if (lt)
-	{
-	  tml = *lt;
-	  lt = &tml;
-	}
-      printf ("mktime returns %ld == ", (long int) tl);
-      print_tm (&tmk);
-      printf ("\n");
-      status = check_result (tl, tmk, tl, lt);
-    }
-  else if (argc == 4 || (argc == 5 && strcmp (argv[4], "-") == 0))
-    {
-      time_t from = atol (argv[1]);
-      time_t by = atol (argv[2]);
-      time_t to = atol (argv[3]);
-
-      if (argc == 4)
-	for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
-	  {
-	    lt = localtime (&tl);
-	    if (lt)
-	      {
-		tmk = tml = *lt;
-		tk = mktime (&tmk);
-		status |= check_result (tk, tmk, tl, &tml);
-	      }
-	    else
-	      {
-		printf ("localtime (%ld) yields 0\n", (long int) tl);
-		status = 1;
-	      }
-	    tl1 = tl + by;
-	    if ((tl1 < tl) != (by < 0))
-	      break;
-	  }
-      else
-	for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
-	  {
-	    /* Null benchmark.  */
-	    lt = localtime (&tl);
-	    if (lt)
-	      {
-		tmk = tml = *lt;
-		tk = tl;
-		status |= check_result (tk, tmk, tl, &tml);
-	      }
-	    else
-	      {
-		printf ("localtime (%ld) yields 0\n", (long int) tl);
-		status = 1;
-	      }
-	    tl1 = tl + by;
-	    if ((tl1 < tl) != (by < 0))
-	      break;
-	  }
-    }
-  else
-    printf ("Usage:\
-\t%s YYYY-MM-DD HH:MM:SS [ISDST] # Test given time.\n\
-\t%s FROM BY TO # Test values FROM, FROM+BY, ..., TO.\n\
-\t%s FROM BY TO - # Do not test those values (for benchmark).\n",
-	    argv[0], argv[0], argv[0]);
-
-  return status;
-}
-
-#endif /* DEBUG */
-
-/*
-Local Variables:
-compile-command: "gcc -DDEBUG -I. -Wall -W -O2 -g mktime.c -o mktime"
-End:
-*/

+ 0 - 982
gl/mountlist.c~

@@ -1,982 +0,0 @@
-/* mountlist.c -- return a list of mounted file systems
-
-   Copyright (C) 1991-1992, 1997-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include "mountlist.h"
-
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "xalloc.h"
-
-#include <errno.h>
-
-#include <fcntl.h>
-
-#include <unistd.h>
-
-#if HAVE_SYS_PARAM_H
-# include <sys/param.h>
-#endif
-
-#if defined MOUNTED_GETFSSTAT   /* OSF_1 and Darwin1.3.x */
-# if HAVE_SYS_UCRED_H
-#  include <grp.h> /* needed on OSF V4.0 for definition of NGROUPS,
-                      NGROUPS is used as an array dimension in ucred.h */
-#  include <sys/ucred.h> /* needed by powerpc-apple-darwin1.3.7 */
-# endif
-# if HAVE_SYS_MOUNT_H
-#  include <sys/mount.h>
-# endif
-# if HAVE_SYS_FS_TYPES_H
-#  include <sys/fs_types.h> /* needed by powerpc-apple-darwin1.3.7 */
-# endif
-# if HAVE_STRUCT_FSSTAT_F_FSTYPENAME
-#  define FS_TYPE(Ent) ((Ent).f_fstypename)
-# else
-#  define FS_TYPE(Ent) mnt_names[(Ent).f_type]
-# endif
-#endif /* MOUNTED_GETFSSTAT */
-
-#ifdef MOUNTED_GETMNTENT1       /* 4.3BSD, SunOS, HP-UX, Dynix, Irix.  */
-# include <mntent.h>
-# if !defined MOUNTED
-#  if defined _PATH_MOUNTED     /* GNU libc  */
-#   define MOUNTED _PATH_MOUNTED
-#  endif
-#  if defined MNT_MNTTAB        /* HP-UX.  */
-#   define MOUNTED MNT_MNTTAB
-#  endif
-#  if defined MNTTABNAME        /* Dynix.  */
-#   define MOUNTED MNTTABNAME
-#  endif
-# endif
-#endif
-
-#ifdef MOUNTED_GETMNTINFO       /* 4.4BSD.  */
-# include <sys/mount.h>
-#endif
-
-#ifdef MOUNTED_GETMNTINFO2      /* NetBSD 3.0.  */
-# include <sys/statvfs.h>
-#endif
-
-#ifdef MOUNTED_GETMNT           /* Ultrix.  */
-# include <sys/mount.h>
-# include <sys/fs_types.h>
-#endif
-
-#ifdef MOUNTED_FS_STAT_DEV      /* BeOS.  */
-# include <fs_info.h>
-# include <dirent.h>
-#endif
-
-#ifdef MOUNTED_FREAD            /* SVR2.  */
-# include <mnttab.h>
-#endif
-
-#ifdef MOUNTED_FREAD_FSTYP      /* SVR3.  */
-# include <mnttab.h>
-# include <sys/fstyp.h>
-# include <sys/statfs.h>
-#endif
-
-#ifdef MOUNTED_LISTMNTENT
-# include <mntent.h>
-#endif
-
-#ifdef MOUNTED_GETMNTENT2       /* SVR4.  */
-# include <sys/mnttab.h>
-#endif
-
-#ifdef MOUNTED_VMOUNT           /* AIX.  */
-# include <fshelp.h>
-# include <sys/vfs.h>
-#endif
-
-#ifdef MOUNTED_INTERIX_STATVFS  /* Interix. */
-# include <sys/statvfs.h>
-# include <dirent.h>
-#endif
-
-#ifdef DOLPHIN
-/* So special that it's not worth putting this in autoconf.  */
-# undef MOUNTED_FREAD_FSTYP
-# define MOUNTED_GETMNTTBL
-#endif
-
-#if HAVE_SYS_MNTENT_H
-/* This is to get MNTOPT_IGNORE on e.g. SVR4.  */
-# include <sys/mntent.h>
-#endif
-
-#ifndef HAVE_HASMNTOPT
-# define hasmntopt(mnt, opt) ((char *) 0)
-#endif
-
-#undef MNT_IGNORE
-#ifdef MNTOPT_IGNORE
-# define MNT_IGNORE(M) hasmntopt (M, MNTOPT_IGNORE)
-#else
-# define MNT_IGNORE(M) 0
-#endif
-
-#if USE_UNLOCKED_IO
-# include "unlocked-io.h"
-#endif
-
-/* The results of open() in this file are not used with fchdir,
-   therefore save some unnecessary work in fchdir.c.  */
-#undef open
-#undef close
-
-/* The results of opendir() in this file are not used with dirfd and fchdir,
-   therefore save some unnecessary work in fchdir.c.  */
-#undef opendir
-#undef closedir
-
-#define ME_DUMMY_0(Fs_name, Fs_type)            \
-  (strcmp (Fs_type, "autofs") == 0              \
-   || strcmp (Fs_type, "proc") == 0             \
-   || strcmp (Fs_type, "subfs") == 0            \
-   /* for Linux 2.6/3.x */                      \
-   || strcmp (Fs_type, "debugfs") == 0          \
-   || strcmp (Fs_type, "devpts") == 0           \
-   || strcmp (Fs_type, "fusectl") == 0          \
-   || strcmp (Fs_type, "mqueue") == 0           \
-   || strcmp (Fs_type, "rpc_pipefs") == 0       \
-   || strcmp (Fs_type, "sysfs") == 0            \
-   /* FreeBSD, Linux 2.4 */                     \
-   || strcmp (Fs_type, "devfs") == 0            \
-   /* for NetBSD 3.0 */                         \
-   || strcmp (Fs_type, "kernfs") == 0           \
-   /* for Irix 6.5 */                           \
-   || strcmp (Fs_type, "ignore") == 0)
-
-/* Historically, we have marked as "dummy" any file system of type "none",
-   but now that programs like du need to know about bind-mounted directories,
-   we grant an exception to any with "bind" in its list of mount options.
-   I.e., those are *not* dummy entries.  */
-#ifdef MOUNTED_GETMNTENT1
-# define ME_DUMMY(Fs_name, Fs_type, Fs_ent)	\
-  (ME_DUMMY_0 (Fs_name, Fs_type)		\
-   || (strcmp (Fs_type, "none") == 0		\
-       && !hasmntopt (Fs_ent, "bind")))
-#else
-# define ME_DUMMY(Fs_name, Fs_type)		\
-  (ME_DUMMY_0 (Fs_name, Fs_type) || strcmp (Fs_type, "none") == 0)
-#endif
-
-#ifdef __CYGWIN__
-# include <windows.h>
-# define ME_REMOTE me_remote
-/* All cygwin mount points include ':' or start with '//'; so it
-   requires a native Windows call to determine remote disks.  */
-static bool
-me_remote (char const *fs_name, char const *fs_type _GL_UNUSED)
-{
-  if (fs_name[0] && fs_name[1] == ':')
-    {
-      char drive[4];
-      sprintf (drive, "%c:\\", fs_name[0]);
-      switch (GetDriveType (drive))
-        {
-        case DRIVE_REMOVABLE:
-        case DRIVE_FIXED:
-        case DRIVE_CDROM:
-        case DRIVE_RAMDISK:
-          return false;
-        }
-    }
-  return true;
-}
-#endif
-
-#ifndef ME_REMOTE
-/* A file system is "remote" if its Fs_name contains a ':'
-   or if (it is of type (smbfs or cifs) and its Fs_name starts with '//').  */
-# define ME_REMOTE(Fs_name, Fs_type)            \
-    (strchr (Fs_name, ':') != NULL              \
-     || ((Fs_name)[0] == '/'                    \
-         && (Fs_name)[1] == '/'                 \
-         && (strcmp (Fs_type, "smbfs") == 0     \
-             || strcmp (Fs_type, "cifs") == 0)))
-#endif
-
-#if MOUNTED_GETMNTINFO
-
-# if ! HAVE_STRUCT_STATFS_F_FSTYPENAME
-static char *
-fstype_to_string (short int t)
-{
-  switch (t)
-    {
-#  ifdef MOUNT_PC
-    case MOUNT_PC:
-      return "pc";
-#  endif
-#  ifdef MOUNT_MFS
-    case MOUNT_MFS:
-      return "mfs";
-#  endif
-#  ifdef MOUNT_LO
-    case MOUNT_LO:
-      return "lo";
-#  endif
-#  ifdef MOUNT_TFS
-    case MOUNT_TFS:
-      return "tfs";
-#  endif
-#  ifdef MOUNT_TMP
-    case MOUNT_TMP:
-      return "tmp";
-#  endif
-#  ifdef MOUNT_UFS
-   case MOUNT_UFS:
-     return "ufs" ;
-#  endif
-#  ifdef MOUNT_NFS
-   case MOUNT_NFS:
-     return "nfs" ;
-#  endif
-#  ifdef MOUNT_MSDOS
-   case MOUNT_MSDOS:
-     return "msdos" ;
-#  endif
-#  ifdef MOUNT_LFS
-   case MOUNT_LFS:
-     return "lfs" ;
-#  endif
-#  ifdef MOUNT_LOFS
-   case MOUNT_LOFS:
-     return "lofs" ;
-#  endif
-#  ifdef MOUNT_FDESC
-   case MOUNT_FDESC:
-     return "fdesc" ;
-#  endif
-#  ifdef MOUNT_PORTAL
-   case MOUNT_PORTAL:
-     return "portal" ;
-#  endif
-#  ifdef MOUNT_NULL
-   case MOUNT_NULL:
-     return "null" ;
-#  endif
-#  ifdef MOUNT_UMAP
-   case MOUNT_UMAP:
-     return "umap" ;
-#  endif
-#  ifdef MOUNT_KERNFS
-   case MOUNT_KERNFS:
-     return "kernfs" ;
-#  endif
-#  ifdef MOUNT_PROCFS
-   case MOUNT_PROCFS:
-     return "procfs" ;
-#  endif
-#  ifdef MOUNT_AFS
-   case MOUNT_AFS:
-     return "afs" ;
-#  endif
-#  ifdef MOUNT_CD9660
-   case MOUNT_CD9660:
-     return "cd9660" ;
-#  endif
-#  ifdef MOUNT_UNION
-   case MOUNT_UNION:
-     return "union" ;
-#  endif
-#  ifdef MOUNT_DEVFS
-   case MOUNT_DEVFS:
-     return "devfs" ;
-#  endif
-#  ifdef MOUNT_EXT2FS
-   case MOUNT_EXT2FS:
-     return "ext2fs" ;
-#  endif
-    default:
-      return "?";
-    }
-}
-# endif
-
-static char *
-fsp_to_string (const struct statfs *fsp)
-{
-# if HAVE_STRUCT_STATFS_F_FSTYPENAME
-  return (char *) (fsp->f_fstypename);
-# else
-  return fstype_to_string (fsp->f_type);
-# endif
-}
-
-#endif /* MOUNTED_GETMNTINFO */
-
-#ifdef MOUNTED_VMOUNT           /* AIX.  */
-static char *
-fstype_to_string (int t)
-{
-  struct vfs_ent *e;
-
-  e = getvfsbytype (t);
-  if (!e || !e->vfsent_name)
-    return "none";
-  else
-    return e->vfsent_name;
-}
-#endif /* MOUNTED_VMOUNT */
-
-
-#if defined MOUNTED_GETMNTENT1 || defined MOUNTED_GETMNTENT2
-
-/* Return the device number from MOUNT_OPTIONS, if possible.
-   Otherwise return (dev_t) -1.  */
-static dev_t
-dev_from_mount_options (char const *mount_options)
-{
-  /* GNU/Linux allows file system implementations to define their own
-     meaning for "dev=" mount options, so don't trust the meaning
-     here.  */
-# ifndef __linux__
-
-  static char const dev_pattern[] = ",dev=";
-  char const *devopt = strstr (mount_options, dev_pattern);
-
-  if (devopt)
-    {
-      char const *optval = devopt + sizeof dev_pattern - 1;
-      char *optvalend;
-      unsigned long int dev;
-      errno = 0;
-      dev = strtoul (optval, &optvalend, 16);
-      if (optval != optvalend
-          && (*optvalend == '\0' || *optvalend == ',')
-          && ! (dev == ULONG_MAX && errno == ERANGE)
-          && dev == (dev_t) dev)
-        return dev;
-    }
-
-# endif
-  (void) mount_options;
-  return -1;
-}
-
-#endif
-
-/* Return a list of the currently mounted file systems, or NULL on error.
-   Add each entry to the tail of the list so that they stay in order.
-   If NEED_FS_TYPE is true, ensure that the file system type fields in
-   the returned list are valid.  Otherwise, they might not be.  */
-
-struct mount_entry *
-read_file_system_list (bool need_fs_type)
-{
-  struct mount_entry *mount_list;
-  struct mount_entry *me;
-  struct mount_entry **mtail = &mount_list;
-  (void) need_fs_type;
-
-#ifdef MOUNTED_LISTMNTENT
-  {
-    struct tabmntent *mntlist, *p;
-    struct mntent *mnt;
-    struct mount_entry *me;
-
-    /* the third and fourth arguments could be used to filter mounts,
-       but Crays doesn't seem to have any mounts that we want to
-       remove. Specifically, automount create normal NFS mounts.
-       */
-
-    if (listmntent (&mntlist, KMTAB, NULL, NULL) < 0)
-      return NULL;
-    for (p = mntlist; p; p = p->next)
-      {
-        mnt = p->ment;
-        me = xmalloc (sizeof *me);
-        me->me_devname = xstrdup (mnt->mnt_fsname);
-        me->me_mountdir = xstrdup (mnt->mnt_dir);
-        me->me_type = xstrdup (mnt->mnt_type);
-        me->me_type_malloced = 1;
-        me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
-        me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
-        me->me_dev = -1;
-        *mtail = me;
-        mtail = &me->me_next;
-      }
-    freemntlist (mntlist);
-  }
-#endif
-
-#ifdef MOUNTED_GETMNTENT1 /* GNU/Linux, 4.3BSD, SunOS, HP-UX, Dynix, Irix.  */
-  {
-    struct mntent *mnt;
-    char const *table = MOUNTED;
-    FILE *fp;
-
-    fp = setmntent (table, "r");
-    if (fp == NULL)
-      return NULL;
-
-    while ((mnt = getmntent (fp)))
-      {
-        me = xmalloc (sizeof *me);
-        me->me_devname = xstrdup (mnt->mnt_fsname);
-        me->me_mountdir = xstrdup (mnt->mnt_dir);
-        me->me_type = xstrdup (mnt->mnt_type);
-        me->me_type_malloced = 1;
-        me->me_dummy = ME_DUMMY (me->me_devname, me->me_type, mnt);
-        me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
-        me->me_dev = dev_from_mount_options (mnt->mnt_opts);
-
-        /* Add to the linked list. */
-        *mtail = me;
-        mtail = &me->me_next;
-      }
-
-    if (endmntent (fp) == 0)
-      goto free_then_fail;
-  }
-#endif /* MOUNTED_GETMNTENT1. */
-
-#ifdef MOUNTED_GETMNTINFO       /* 4.4BSD.  */
-  {
-    struct statfs *fsp;
-    int entries;
-
-    entries = getmntinfo (&fsp, MNT_NOWAIT);
-    if (entries < 0)
-      return NULL;
-    for (; entries-- > 0; fsp++)
-      {
-        char *fs_type = fsp_to_string (fsp);
-
-        me = xmalloc (sizeof *me);
-        me->me_devname = xstrdup (fsp->f_mntfromname);
-        me->me_mountdir = xstrdup (fsp->f_mntonname);
-        me->me_type = fs_type;
-        me->me_type_malloced = 0;
-        me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
-        me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
-        me->me_dev = (dev_t) -1;        /* Magic; means not known yet. */
-
-        /* Add to the linked list. */
-        *mtail = me;
-        mtail = &me->me_next;
-      }
-  }
-#endif /* MOUNTED_GETMNTINFO */
-
-#ifdef MOUNTED_GETMNTINFO2      /* NetBSD 3.0.  */
-  {
-    struct statvfs *fsp;
-    int entries;
-
-    entries = getmntinfo (&fsp, MNT_NOWAIT);
-    if (entries < 0)
-      return NULL;
-    for (; entries-- > 0; fsp++)
-      {
-        me = xmalloc (sizeof *me);
-        me->me_devname = xstrdup (fsp->f_mntfromname);
-        me->me_mountdir = xstrdup (fsp->f_mntonname);
-        me->me_type = xstrdup (fsp->f_fstypename);
-        me->me_type_malloced = 1;
-        me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
-        me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
-        me->me_dev = (dev_t) -1;        /* Magic; means not known yet. */
-
-        /* Add to the linked list. */
-        *mtail = me;
-        mtail = &me->me_next;
-      }
-  }
-#endif /* MOUNTED_GETMNTINFO2 */
-
-#ifdef MOUNTED_GETMNT           /* Ultrix.  */
-  {
-    int offset = 0;
-    int val;
-    struct fs_data fsd;
-
-    while (errno = 0,
-           0 < (val = getmnt (&offset, &fsd, sizeof (fsd), NOSTAT_MANY,
-                              (char *) 0)))
-      {
-        me = xmalloc (sizeof *me);
-        me->me_devname = xstrdup (fsd.fd_req.devname);
-        me->me_mountdir = xstrdup (fsd.fd_req.path);
-        me->me_type = gt_names[fsd.fd_req.fstype];
-        me->me_type_malloced = 0;
-        me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
-        me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
-        me->me_dev = fsd.fd_req.dev;
-
-        /* Add to the linked list. */
-        *mtail = me;
-        mtail = &me->me_next;
-      }
-    if (val < 0)
-      goto free_then_fail;
-  }
-#endif /* MOUNTED_GETMNT. */
-
-#if defined MOUNTED_FS_STAT_DEV /* BeOS */
-  {
-    /* The next_dev() and fs_stat_dev() system calls give the list of
-       all file systems, including the information returned by statvfs()
-       (fs type, total blocks, free blocks etc.), but without the mount
-       point. But on BeOS all file systems except / are mounted in the
-       rootfs, directly under /.
-       The directory name of the mount point is often, but not always,
-       identical to the volume name of the device.
-       We therefore get the list of subdirectories of /, and the list
-       of all file systems, and match the two lists.  */
-
-    DIR *dirp;
-    struct rootdir_entry
-      {
-        char *name;
-        dev_t dev;
-        ino_t ino;
-        struct rootdir_entry *next;
-      };
-    struct rootdir_entry *rootdir_list;
-    struct rootdir_entry **rootdir_tail;
-    int32 pos;
-    dev_t dev;
-    fs_info fi;
-
-    /* All volumes are mounted in the rootfs, directly under /. */
-    rootdir_list = NULL;
-    rootdir_tail = &rootdir_list;
-    dirp = opendir ("/");
-    if (dirp)
-      {
-        struct dirent *d;
-
-        while ((d = readdir (dirp)) != NULL)
-          {
-            char *name;
-            struct stat statbuf;
-
-            if (strcmp (d->d_name, "..") == 0)
-              continue;
-
-            if (strcmp (d->d_name, ".") == 0)
-              name = xstrdup ("/");
-            else
-              {
-                name = xmalloc (1 + strlen (d->d_name) + 1);
-                name[0] = '/';
-                strcpy (name + 1, d->d_name);
-              }
-
-            if (lstat (name, &statbuf) >= 0 && S_ISDIR (statbuf.st_mode))
-              {
-                struct rootdir_entry *re = xmalloc (sizeof *re);
-                re->name = name;
-                re->dev = statbuf.st_dev;
-                re->ino = statbuf.st_ino;
-
-                /* Add to the linked list.  */
-                *rootdir_tail = re;
-                rootdir_tail = &re->next;
-              }
-            else
-              free (name);
-          }
-        closedir (dirp);
-      }
-    *rootdir_tail = NULL;
-
-    for (pos = 0; (dev = next_dev (&pos)) >= 0; )
-      if (fs_stat_dev (dev, &fi) >= 0)
-        {
-          /* Note: fi.dev == dev. */
-          struct rootdir_entry *re;
-
-          for (re = rootdir_list; re; re = re->next)
-            if (re->dev == fi.dev && re->ino == fi.root)
-              break;
-
-          me = xmalloc (sizeof *me);
-          me->me_devname = xstrdup (fi.device_name[0] != '\0'
-                                    ? fi.device_name : fi.fsh_name);
-          me->me_mountdir = xstrdup (re != NULL ? re->name : fi.fsh_name);
-          me->me_type = xstrdup (fi.fsh_name);
-          me->me_type_malloced = 1;
-          me->me_dev = fi.dev;
-          me->me_dummy = 0;
-          me->me_remote = (fi.flags & B_FS_IS_SHARED) != 0;
-
-          /* Add to the linked list. */
-          *mtail = me;
-          mtail = &me->me_next;
-        }
-    *mtail = NULL;
-
-    while (rootdir_list != NULL)
-      {
-        struct rootdir_entry *re = rootdir_list;
-        rootdir_list = re->next;
-        free (re->name);
-        free (re);
-      }
-  }
-#endif /* MOUNTED_FS_STAT_DEV */
-
-#if defined MOUNTED_GETFSSTAT   /* __alpha running OSF_1 */
-  {
-    int numsys, counter;
-    size_t bufsize;
-    struct statfs *stats;
-
-    numsys = getfsstat (NULL, 0L, MNT_NOWAIT);
-    if (numsys < 0)
-      return NULL;
-    if (SIZE_MAX / sizeof *stats <= numsys)
-      xalloc_die ();
-
-    bufsize = (1 + numsys) * sizeof *stats;
-    stats = xmalloc (bufsize);
-    numsys = getfsstat (stats, bufsize, MNT_NOWAIT);
-
-    if (numsys < 0)
-      {
-        free (stats);
-        return NULL;
-      }
-
-    for (counter = 0; counter < numsys; counter++)
-      {
-        me = xmalloc (sizeof *me);
-        me->me_devname = xstrdup (stats[counter].f_mntfromname);
-        me->me_mountdir = xstrdup (stats[counter].f_mntonname);
-        me->me_type = xstrdup (FS_TYPE (stats[counter]));
-        me->me_type_malloced = 1;
-        me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
-        me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
-        me->me_dev = (dev_t) -1;        /* Magic; means not known yet. */
-
-        /* Add to the linked list. */
-        *mtail = me;
-        mtail = &me->me_next;
-      }
-
-    free (stats);
-  }
-#endif /* MOUNTED_GETFSSTAT */
-
-#if defined MOUNTED_FREAD || defined MOUNTED_FREAD_FSTYP /* SVR[23].  */
-  {
-    struct mnttab mnt;
-    char *table = "/etc/mnttab";
-    FILE *fp;
-
-    fp = fopen (table, "r");
-    if (fp == NULL)
-      return NULL;
-
-    while (fread (&mnt, sizeof mnt, 1, fp) > 0)
-      {
-        me = xmalloc (sizeof *me);
-# ifdef GETFSTYP                        /* SVR3.  */
-        me->me_devname = xstrdup (mnt.mt_dev);
-# else
-        me->me_devname = xmalloc (strlen (mnt.mt_dev) + 6);
-        strcpy (me->me_devname, "/dev/");
-        strcpy (me->me_devname + 5, mnt.mt_dev);
-# endif
-        me->me_mountdir = xstrdup (mnt.mt_filsys);
-        me->me_dev = (dev_t) -1;        /* Magic; means not known yet. */
-        me->me_type = "";
-        me->me_type_malloced = 0;
-# ifdef GETFSTYP                        /* SVR3.  */
-        if (need_fs_type)
-          {
-            struct statfs fsd;
-            char typebuf[FSTYPSZ];
-
-            if (statfs (me->me_mountdir, &fsd, sizeof fsd, 0) != -1
-                && sysfs (GETFSTYP, fsd.f_fstyp, typebuf) != -1)
-              {
-                me->me_type = xstrdup (typebuf);
-                me->me_type_malloced = 1;
-              }
-          }
-# endif
-        me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
-        me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
-
-        /* Add to the linked list. */
-        *mtail = me;
-        mtail = &me->me_next;
-      }
-
-    if (ferror (fp))
-      {
-        /* The last fread() call must have failed.  */
-        int saved_errno = errno;
-        fclose (fp);
-        errno = saved_errno;
-        goto free_then_fail;
-      }
-
-    if (fclose (fp) == EOF)
-      goto free_then_fail;
-  }
-#endif /* MOUNTED_FREAD || MOUNTED_FREAD_FSTYP.  */
-
-#ifdef MOUNTED_GETMNTTBL        /* DolphinOS goes its own way.  */
-  {
-    struct mntent **mnttbl = getmnttbl (), **ent;
-    for (ent = mnttbl; *ent; ent++)
-      {
-        me = xmalloc (sizeof *me);
-        me->me_devname = xstrdup ((*ent)->mt_resource);
-        me->me_mountdir = xstrdup ((*ent)->mt_directory);
-        me->me_type = xstrdup ((*ent)->mt_fstype);
-        me->me_type_malloced = 1;
-        me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
-        me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
-        me->me_dev = (dev_t) -1;        /* Magic; means not known yet. */
-
-        /* Add to the linked list. */
-        *mtail = me;
-        mtail = &me->me_next;
-      }
-    endmnttbl ();
-  }
-#endif
-
-#ifdef MOUNTED_GETMNTENT2       /* SVR4.  */
-  {
-    struct mnttab mnt;
-    char *table = MNTTAB;
-    FILE *fp;
-    int ret;
-    int lockfd = -1;
-
-# if defined F_RDLCK && defined F_SETLKW
-    /* MNTTAB_LOCK is a macro name of our own invention; it's not present in
-       e.g. Solaris 2.6.  If the SVR4 folks ever define a macro
-       for this file name, we should use their macro name instead.
-       (Why not just lock MNTTAB directly?  We don't know.)  */
-#  ifndef MNTTAB_LOCK
-#   define MNTTAB_LOCK "/etc/.mnttab.lock"
-#  endif
-    lockfd = open (MNTTAB_LOCK, O_RDONLY);
-    if (0 <= lockfd)
-      {
-        struct flock flock;
-        flock.l_type = F_RDLCK;
-        flock.l_whence = SEEK_SET;
-        flock.l_start = 0;
-        flock.l_len = 0;
-        while (fcntl (lockfd, F_SETLKW, &flock) == -1)
-          if (errno != EINTR)
-            {
-              int saved_errno = errno;
-              close (lockfd);
-              errno = saved_errno;
-              return NULL;
-            }
-      }
-    else if (errno != ENOENT)
-      return NULL;
-# endif
-
-    errno = 0;
-    fp = fopen (table, "r");
-    if (fp == NULL)
-      ret = errno;
-    else
-      {
-        while ((ret = getmntent (fp, &mnt)) == 0)
-          {
-            me = xmalloc (sizeof *me);
-            me->me_devname = xstrdup (mnt.mnt_special);
-            me->me_mountdir = xstrdup (mnt.mnt_mountp);
-            me->me_type = xstrdup (mnt.mnt_fstype);
-            me->me_type_malloced = 1;
-            me->me_dummy = MNT_IGNORE (&mnt) != 0;
-            me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
-            me->me_dev = dev_from_mount_options (mnt.mnt_mntopts);
-
-            /* Add to the linked list. */
-            *mtail = me;
-            mtail = &me->me_next;
-          }
-
-        ret = fclose (fp) == EOF ? errno : 0 < ret ? 0 : -1;
-      }
-
-    if (0 <= lockfd && close (lockfd) != 0)
-      ret = errno;
-
-    if (0 <= ret)
-      {
-        errno = ret;
-        goto free_then_fail;
-      }
-  }
-#endif /* MOUNTED_GETMNTENT2.  */
-
-#ifdef MOUNTED_VMOUNT           /* AIX.  */
-  {
-    int bufsize;
-    char *entries, *thisent;
-    struct vmount *vmp;
-    int n_entries;
-    int i;
-
-    /* Ask how many bytes to allocate for the mounted file system info.  */
-    if (mntctl (MCTL_QUERY, sizeof bufsize, (struct vmount *) &bufsize) != 0)
-      return NULL;
-    entries = xmalloc (bufsize);
-
-    /* Get the list of mounted file systems.  */
-    n_entries = mntctl (MCTL_QUERY, bufsize, (struct vmount *) entries);
-    if (n_entries < 0)
-      {
-        int saved_errno = errno;
-        free (entries);
-        errno = saved_errno;
-        return NULL;
-      }
-
-    for (i = 0, thisent = entries;
-         i < n_entries;
-         i++, thisent += vmp->vmt_length)
-      {
-        char *options, *ignore;
-
-        vmp = (struct vmount *) thisent;
-        me = xmalloc (sizeof *me);
-        if (vmp->vmt_flags & MNT_REMOTE)
-          {
-            char *host, *dir;
-
-            me->me_remote = 1;
-            /* Prepend the remote dirname.  */
-            host = thisent + vmp->vmt_data[VMT_HOSTNAME].vmt_off;
-            dir = thisent + vmp->vmt_data[VMT_OBJECT].vmt_off;
-            me->me_devname = xmalloc (strlen (host) + strlen (dir) + 2);
-            strcpy (me->me_devname, host);
-            strcat (me->me_devname, ":");
-            strcat (me->me_devname, dir);
-          }
-        else
-          {
-            me->me_remote = 0;
-            me->me_devname = xstrdup (thisent +
-                                      vmp->vmt_data[VMT_OBJECT].vmt_off);
-          }
-        me->me_mountdir = xstrdup (thisent + vmp->vmt_data[VMT_STUB].vmt_off);
-        me->me_type = xstrdup (fstype_to_string (vmp->vmt_gfstype));
-        me->me_type_malloced = 1;
-        options = thisent + vmp->vmt_data[VMT_ARGS].vmt_off;
-        ignore = strstr (options, "ignore");
-        me->me_dummy = (ignore
-                        && (ignore == options || ignore[-1] == ',')
-                        && (ignore[sizeof "ignore" - 1] == ','
-                            || ignore[sizeof "ignore" - 1] == '\0'));
-        me->me_dev = (dev_t) -1; /* vmt_fsid might be the info we want.  */
-
-        /* Add to the linked list. */
-        *mtail = me;
-        mtail = &me->me_next;
-      }
-    free (entries);
-  }
-#endif /* MOUNTED_VMOUNT. */
-
-#ifdef MOUNTED_INTERIX_STATVFS
-  {
-    DIR *dirp = opendir ("/dev/fs");
-    char node[9 + NAME_MAX];
-
-    if (!dirp)
-      goto free_then_fail;
-
-    while (1)
-      {
-        struct statvfs dev;
-        struct dirent entry;
-        struct dirent *result;
-
-        if (readdir_r (dirp, &entry, &result) || result == NULL)
-          break;
-
-        strcpy (node, "/dev/fs/");
-        strcat (node, entry.d_name);
-
-        if (statvfs (node, &dev) == 0)
-          {
-            me = xmalloc (sizeof *me);
-            me->me_devname = xstrdup (dev.f_mntfromname);
-            me->me_mountdir = xstrdup (dev.f_mntonname);
-            me->me_type = xstrdup (dev.f_fstypename);
-            me->me_type_malloced = 1;
-            me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
-            me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
-            me->me_dev = (dev_t) -1;        /* Magic; means not known yet. */
-
-            /* Add to the linked list. */
-            *mtail = me;
-            mtail = &me->me_next;
-          }
-      }
-  }
-#endif /* MOUNTED_INTERIX_STATVFS */
-
-  *mtail = NULL;
-  return mount_list;
-
-
- free_then_fail:
-  {
-    int saved_errno = errno;
-    *mtail = NULL;
-
-    while (mount_list)
-      {
-        me = mount_list->me_next;
-        free_mount_entry (mount_list);
-        mount_list = me;
-      }
-
-    errno = saved_errno;
-    return NULL;
-  }
-}
-
-/* Free a mount entry as returned from read_file_system_list ().  */
-
-void free_mount_entry (struct mount_entry *me)
-{
-  free (me->me_devname);
-  free (me->me_mountdir);
-  if (me->me_type_malloced)
-    free (me->me_type);
-  free (me);
-}

+ 0 - 41
gl/mountlist.h~

@@ -1,41 +0,0 @@
-/* mountlist.h -- declarations for list of mounted file systems
-
-   Copyright (C) 1991-1992, 1998, 2000-2005, 2009-2013 Free Software
-   Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef NAGIOS_MOUNTLIST_H_INCLUDED
-# define NAGIOS_MOUNTLIST_H_INCLUDED
-
-# include <stdbool.h>
-# include <sys/types.h>
-
-/* A mount table entry. */
-struct mount_entry
-{
-  char *me_devname;             /* Device node name, including "/dev/". */
-  char *me_mountdir;            /* Mount point directory name. */
-  char *me_type;                /* "nfs", "4.2", etc. */
-  dev_t me_dev;                 /* Device number of me_mountdir. */
-  unsigned int me_dummy : 1;    /* Nonzero for dummy file systems. */
-  unsigned int me_remote : 1;   /* Nonzero for remote filesystems. */
-  unsigned int me_type_malloced : 1; /* Nonzero if me_type was malloced. */
-  struct mount_entry *me_next;
-};
-
-struct mount_entry *read_file_system_list (bool need_fs_type);
-void free_mount_entry (struct mount_entry *entry);
-
-#endif

+ 0 - 129
gl/msvc-inval.c~

@@ -1,129 +0,0 @@
-/* Invalid parameter handler for MSVC runtime libraries.
-   Copyright (C) 2011-2013 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include "msvc-inval.h"
-
-#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \
-    && !(MSVC_INVALID_PARAMETER_HANDLING == SANE_LIBRARY_HANDLING)
-
-/* Get _invalid_parameter_handler type and _set_invalid_parameter_handler
-   declaration.  */
-# include <stdlib.h>
-
-# if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING
-
-static void __cdecl
-gl_msvc_invalid_parameter_handler (const wchar_t *expression,
-                                   const wchar_t *function,
-                                   const wchar_t *file,
-                                   unsigned int line,
-                                   uintptr_t dummy)
-{
-}
-
-# else
-
-/* Get declarations of the native Windows API functions.  */
-#  define WIN32_LEAN_AND_MEAN
-#  include <windows.h>
-
-#  if defined _MSC_VER
-
-static void __cdecl
-gl_msvc_invalid_parameter_handler (const wchar_t *expression,
-                                   const wchar_t *function,
-                                   const wchar_t *file,
-                                   unsigned int line,
-                                   uintptr_t dummy)
-{
-  RaiseException (STATUS_GNULIB_INVALID_PARAMETER, 0, 0, NULL);
-}
-
-#  else
-
-/* An index to thread-local storage.  */
-static DWORD tls_index;
-static int tls_initialized /* = 0 */;
-
-/* Used as a fallback only.  */
-static struct gl_msvc_inval_per_thread not_per_thread;
-
-struct gl_msvc_inval_per_thread *
-gl_msvc_inval_current (void)
-{
-  if (!tls_initialized)
-    {
-      tls_index = TlsAlloc ();
-      tls_initialized = 1;
-    }
-  if (tls_index == TLS_OUT_OF_INDEXES)
-    /* TlsAlloc had failed.  */
-    return &not_per_thread;
-  else
-    {
-      struct gl_msvc_inval_per_thread *pointer =
-        (struct gl_msvc_inval_per_thread *) TlsGetValue (tls_index);
-      if (pointer == NULL)
-        {
-          /* First call.  Allocate a new 'struct gl_msvc_inval_per_thread'.  */
-          pointer =
-            (struct gl_msvc_inval_per_thread *)
-            malloc (sizeof (struct gl_msvc_inval_per_thread));
-          if (pointer == NULL)
-            /* Could not allocate memory.  Use the global storage.  */
-            pointer = &not_per_thread;
-          TlsSetValue (tls_index, pointer);
-        }
-      return pointer;
-    }
-}
-
-static void __cdecl
-gl_msvc_invalid_parameter_handler (const wchar_t *expression,
-                                   const wchar_t *function,
-                                   const wchar_t *file,
-                                   unsigned int line,
-                                   uintptr_t dummy)
-{
-  struct gl_msvc_inval_per_thread *current = gl_msvc_inval_current ();
-  if (current->restart_valid)
-    longjmp (current->restart, 1);
-  else
-    /* An invalid parameter notification from outside the gnulib code.
-       Give the caller a chance to intervene.  */
-    RaiseException (STATUS_GNULIB_INVALID_PARAMETER, 0, 0, NULL);
-}
-
-#  endif
-
-# endif
-
-static int gl_msvc_inval_initialized /* = 0 */;
-
-void
-gl_msvc_inval_ensure_handler (void)
-{
-  if (gl_msvc_inval_initialized == 0)
-    {
-      _set_invalid_parameter_handler (gl_msvc_invalid_parameter_handler);
-      gl_msvc_inval_initialized = 1;
-    }
-}
-
-#endif

+ 0 - 222
gl/msvc-inval.h~

@@ -1,222 +0,0 @@
-/* Invalid parameter handler for MSVC runtime libraries.
-   Copyright (C) 2011-2013 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef NAGIOS_MSVC_INVAL_H_INCLUDED
-#define NAGIOS_MSVC_INVAL_H_INCLUDED
-
-/* With MSVC runtime libraries with the "invalid parameter handler" concept,
-   functions like fprintf(), dup2(), or close() crash when the caller passes
-   an invalid argument.  But POSIX wants error codes (such as EINVAL or EBADF)
-   instead.
-   This file defines macros that turn such an invalid parameter notification
-   into a non-local exit.  An error code can then be produced at the target
-   of this exit.  You can thus write code like
-
-     TRY_MSVC_INVAL
-       {
-         <Code that can trigger an invalid parameter notification
-          but does not do 'return', 'break', 'continue', nor 'goto'.>
-       }
-     CATCH_MSVC_INVAL
-       {
-         <Code that handles an invalid parameter notification
-          but does not do 'return', 'break', 'continue', nor 'goto'.>
-       }
-     DONE_MSVC_INVAL;
-
-   This entire block expands to a single statement.
-
-   The handling of invalid parameters can be done in three ways:
-
-     * The default way, which is reasonable for programs (not libraries):
-       AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [DEFAULT_HANDLING])
-
-     * The way for libraries that make "hairy" calls (like close(-1), or
-       fclose(fp) where fileno(fp) is closed, or simply getdtablesize()):
-       AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [HAIRY_LIBRARY_HANDLING])
-
-     * The way for libraries that make no "hairy" calls:
-       AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [SANE_LIBRARY_HANDLING])
- */
-
-#define DEFAULT_HANDLING       0
-#define HAIRY_LIBRARY_HANDLING 1
-#define SANE_LIBRARY_HANDLING  2
-
-#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \
-    && !(MSVC_INVALID_PARAMETER_HANDLING == SANE_LIBRARY_HANDLING)
-/* A native Windows platform with the "invalid parameter handler" concept,
-   and either DEFAULT_HANDLING or HAIRY_LIBRARY_HANDLING.  */
-
-# if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING
-/* Default handling.  */
-
-#  ifdef __cplusplus
-extern "C" {
-#  endif
-
-/* Ensure that the invalid parameter handler in installed that just returns.
-   Because we assume no other part of the program installs a different
-   invalid parameter handler, this solution is multithread-safe.  */
-extern void gl_msvc_inval_ensure_handler (void);
-
-#  ifdef __cplusplus
-}
-#  endif
-
-#  define TRY_MSVC_INVAL \
-     do                                                                        \
-       {                                                                       \
-         gl_msvc_inval_ensure_handler ();                                      \
-         if (1)
-#  define CATCH_MSVC_INVAL \
-         else
-#  define DONE_MSVC_INVAL \
-       }                                                                       \
-     while (0)
-
-# else
-/* Handling for hairy libraries.  */
-
-#  include <excpt.h>
-
-/* Gnulib can define its own status codes, as described in the page
-   "Raising Software Exceptions" on microsoft.com
-   <http://msdn.microsoft.com/en-us/library/het71c37.aspx>.
-   Our status codes are composed of
-     - 0xE0000000, mandatory for all user-defined status codes,
-     - 0x474E550, a API identifier ("GNU"),
-     - 0, 1, 2, ..., used to distinguish different status codes from the
-       same API.  */
-#  define STATUS_GNULIB_INVALID_PARAMETER (0xE0000000 + 0x474E550 + 0)
-
-#  if defined _MSC_VER
-/* A compiler that supports __try/__except, as described in the page
-   "try-except statement" on microsoft.com
-   <http://msdn.microsoft.com/en-us/library/s58ftw19.aspx>.
-   With __try/__except, we can use the multithread-safe exception handling.  */
-
-#   ifdef __cplusplus
-extern "C" {
-#   endif
-
-/* Ensure that the invalid parameter handler in installed that raises a
-   software exception with code STATUS_GNULIB_INVALID_PARAMETER.
-   Because we assume no other part of the program installs a different
-   invalid parameter handler, this solution is multithread-safe.  */
-extern void gl_msvc_inval_ensure_handler (void);
-
-#   ifdef __cplusplus
-}
-#   endif
-
-#   define TRY_MSVC_INVAL \
-      do                                                                       \
-        {                                                                      \
-          gl_msvc_inval_ensure_handler ();                                     \
-          __try
-#   define CATCH_MSVC_INVAL \
-          __except (GetExceptionCode () == STATUS_GNULIB_INVALID_PARAMETER     \
-                    ? EXCEPTION_EXECUTE_HANDLER                                \
-                    : EXCEPTION_CONTINUE_SEARCH)
-#   define DONE_MSVC_INVAL \
-        }                                                                      \
-      while (0)
-
-#  else
-/* Any compiler.
-   We can only use setjmp/longjmp.  */
-
-#   include <setjmp.h>
-
-#   ifdef __cplusplus
-extern "C" {
-#   endif
-
-struct gl_msvc_inval_per_thread
-{
-  /* The restart that will resume execution at the code between
-     CATCH_MSVC_INVAL and DONE_MSVC_INVAL.  It is enabled only between
-     TRY_MSVC_INVAL and CATCH_MSVC_INVAL.  */
-  jmp_buf restart;
-
-  /* Tells whether the contents of restart is valid.  */
-  int restart_valid;
-};
-
-/* Ensure that the invalid parameter handler in installed that passes
-   control to the gl_msvc_inval_restart if it is valid, or raises a
-   software exception with code STATUS_GNULIB_INVALID_PARAMETER otherwise.
-   Because we assume no other part of the program installs a different
-   invalid parameter handler, this solution is multithread-safe.  */
-extern void gl_msvc_inval_ensure_handler (void);
-
-/* Return a pointer to the per-thread data for the current thread.  */
-extern struct gl_msvc_inval_per_thread *gl_msvc_inval_current (void);
-
-#   ifdef __cplusplus
-}
-#   endif
-
-#   define TRY_MSVC_INVAL \
-      do                                                                       \
-        {                                                                      \
-          struct gl_msvc_inval_per_thread *msvc_inval_current;                 \
-          gl_msvc_inval_ensure_handler ();                                     \
-          msvc_inval_current = gl_msvc_inval_current ();                       \
-          /* First, initialize gl_msvc_inval_restart.  */                      \
-          if (setjmp (msvc_inval_current->restart) == 0)                       \
-            {                                                                  \
-              /* Then, mark it as valid.  */                                   \
-              msvc_inval_current->restart_valid = 1;
-#   define CATCH_MSVC_INVAL \
-              /* Execution completed.                                          \
-                 Mark gl_msvc_inval_restart as invalid.  */                    \
-              msvc_inval_current->restart_valid = 0;                           \
-            }                                                                  \
-          else                                                                 \
-            {                                                                  \
-              /* Execution triggered an invalid parameter notification.        \
-                 Mark gl_msvc_inval_restart as invalid.  */                    \
-              msvc_inval_current->restart_valid = 0;
-#   define DONE_MSVC_INVAL \
-            }                                                                  \
-        }                                                                      \
-      while (0)
-
-#  endif
-
-# endif
-
-#else
-/* A platform that does not need to the invalid parameter handler,
-   or when SANE_LIBRARY_HANDLING is desired.  */
-
-/* The braces here avoid GCC warnings like
-   "warning: suggest explicit braces to avoid ambiguous 'else'".  */
-# define TRY_MSVC_INVAL \
-    do                                                                         \
-      {                                                                        \
-        if (1)
-# define CATCH_MSVC_INVAL \
-        else
-# define DONE_MSVC_INVAL \
-      }                                                                        \
-    while (0)
-
-#endif
-
-#endif /* NAGIOS_MSVC_INVAL_H_INCLUDED */

+ 0 - 49
gl/msvc-nothrow.c~

@@ -1,49 +0,0 @@
-/* Wrappers that don't throw invalid parameter notifications
-   with MSVC runtime libraries.
-   Copyright (C) 2011-2013 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include "msvc-nothrow.h"
-
-/* Get declarations of the native Windows API functions.  */
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-#include "msvc-inval.h"
-
-#undef _get_osfhandle
-
-#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
-intptr_t
-_gl_nothrow_get_osfhandle (int fd)
-{
-  intptr_t result;
-
-  TRY_MSVC_INVAL
-    {
-      result = _get_osfhandle (fd);
-    }
-  CATCH_MSVC_INVAL
-    {
-      result = (intptr_t) INVALID_HANDLE_VALUE;
-    }
-  DONE_MSVC_INVAL;
-
-  return result;
-}
-#endif

+ 0 - 43
gl/msvc-nothrow.h~

@@ -1,43 +0,0 @@
-/* Wrappers that don't throw invalid parameter notifications
-   with MSVC runtime libraries.
-   Copyright (C) 2011-2013 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef NGAIOS_MSVC_NOTHROW_H_INCLUDED
-#define NGAIOS_MSVC_NOTHROW_H_INCLUDED
-
-/* With MSVC runtime libraries with the "invalid parameter handler" concept,
-   functions like fprintf(), dup2(), or close() crash when the caller passes
-   an invalid argument.  But POSIX wants error codes (such as EINVAL or EBADF)
-   instead.
-   This file defines wrappers that turn such an invalid parameter notification
-   into an error code.  */
-
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-
-/* Get original declaration of _get_osfhandle.  */
-# include <io.h>
-
-# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
-
-/* Override _get_osfhandle.  */
-extern intptr_t _gl_nothrow_get_osfhandle (int fd);
-#  define _get_osfhandle _gl_nothrow_get_osfhandle
-
-# endif
-
-#endif
-
-#endif /* NGAIOS_MSVC_NOTHROW_H_INCLUDED */

+ 0 - 265
gl/netdb.in.h~

@@ -1,265 +0,0 @@
-/* Provide a netdb.h header file for systems lacking it (read: MinGW).
-   Copyright (C) 2008-2013 Free Software Foundation, Inc.
-   Written by Simon Josefsson.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-/* This file is supposed to be used on platforms that lack <netdb.h>.
-   It is intended to provide definitions and prototypes needed by an
-   application.  */
-
-#ifndef _@GUARD_PREFIX@_NETDB_H
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-#if @HAVE_NETDB_H@
-
-/* The include_next requires a split double-inclusion guard.  */
-# @INCLUDE_NEXT@ @NEXT_NETDB_H@
-
-#endif
-
-#ifndef _@GUARD_PREFIX@_NETDB_H
-#define _@GUARD_PREFIX@_NETDB_H
-
-/* Get <netdb.h> definitions such as 'socklen_t' on IRIX 6.5 and OSF/1 4.0 and
-   'struct hostent' on MinGW.  */
-#include <sys/socket.h>
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
-
-/* The definition of _GL_ARG_NONNULL is copied here.  */
-
-/* The definition of _GL_WARN_ON_USE is copied here.  */
-
-/* Declarations for a platform that lacks <netdb.h>, or where it is
-   incomplete.  */
-
-#if @GNULIB_GETADDRINFO@
-
-# if !@HAVE_STRUCT_ADDRINFO@
-
-#  ifdef __cplusplus
-extern "C" {
-#  endif
-
-#  if !GNULIB_defined_struct_addrinfo
-/* 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.  */
-};
-#   define GNULIB_defined_struct_addrinfo 1
-#  endif
-
-#  ifdef __cplusplus
-}
-#  endif
-
-# endif
-
-/* Possible values for 'ai_flags' field in 'addrinfo' structure.  */
-# ifndef AI_PASSIVE
-#  define AI_PASSIVE    0x0001  /* Socket address is intended for 'bind'.  */
-# endif
-# ifndef AI_CANONNAME
-#  define AI_CANONNAME  0x0002  /* Request for canonical name.  */
-# endif
-# ifndef AI_NUMERICSERV
-#  define AI_NUMERICSERV        0x0400  /* Don't use name resolution.  */
-# endif
-
-# if 0
-#  define AI_NUMERICHOST        0x0004  /* Don't use name resolution.  */
-# endif
-
-/* These symbolic constants are required to be present by POSIX, but
-   our getaddrinfo replacement doesn't use them (yet).  Setting them
-   to 0 on systems that doesn't have them avoids causing problems for
-   system getaddrinfo implementations that would be confused by
-   unknown values.  */
-# ifndef AI_V4MAPPED
-#  define AI_V4MAPPED    0 /* 0x0008: IPv4 mapped addresses are acceptable.  */
-# endif
-# ifndef AI_ALL
-#  define AI_ALL         0 /* 0x0010: Return IPv4 mapped and IPv6 addresses. */
-# endif
-# ifndef AI_ADDRCONFIG
-#  define AI_ADDRCONFIG  0 /* 0x0020: Use configuration of this host to choose
-                                      returned address type.  */
-# endif
-
-/* 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.  */
-# endif
-
-/* Since EAI_NODATA is deprecated by RFC3493, some systems (at least
-   FreeBSD, which does define EAI_BADFLAGS) have removed the definition
-   in favor of EAI_NONAME.  */
-# if !defined EAI_NODATA && defined EAI_NONAME
-#  define EAI_NODATA EAI_NONAME
-# endif
-
-# ifndef EAI_OVERFLOW
-/* Not defined on mingw32 and Haiku. */
-#  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.  */
-# endif
-# ifndef EAI_SYSTEM
-/* Not defined on mingw32. */
-#  define EAI_SYSTEM      -11   /* System error returned in 'errno'.  */
-# endif
-
-# if 0
-/* The commented out definitions below are not yet implemented in the
-   GNULIB getaddrinfo() replacement, so are not yet needed.
-
-   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.  */
-#  endif
-# endif
-
-# if !@HAVE_DECL_GETADDRINFO@
-/* Translate name of a service location and/or a service name to set of
-   socket addresses.
-   For more details, see the POSIX:2001 specification
-   <http://www.opengroup.org/susv3xsh/getaddrinfo.html>.  */
-_GL_FUNCDECL_SYS (getaddrinfo, int,
-                  (const char *restrict nodename,
-                   const char *restrict servname,
-                   const struct addrinfo *restrict hints,
-                   struct addrinfo **restrict res)
-                  _GL_ARG_NONNULL ((4)));
-# endif
-_GL_CXXALIAS_SYS (getaddrinfo, int,
-                  (const char *restrict nodename,
-                   const char *restrict servname,
-                   const struct addrinfo *restrict hints,
-                   struct addrinfo **restrict res));
-_GL_CXXALIASWARN (getaddrinfo);
-
-# 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>.  */
-_GL_FUNCDECL_SYS (freeaddrinfo, void, (struct addrinfo *ai)
-                                      _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (freeaddrinfo, void, (struct addrinfo *ai));
-_GL_CXXALIASWARN (freeaddrinfo);
-
-# if @REPLACE_GAI_STRERROR@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef gai_strerror
-#   define gai_strerror rpl_gai_strerror
-#  endif
-_GL_FUNCDECL_RPL (gai_strerror, const char *, (int ecode));
-_GL_CXXALIAS_RPL (gai_strerror, const char *, (int ecode));
-# else
-#  if !@HAVE_DECL_GAI_STRERROR@
-/* Convert error return from getaddrinfo() to a string.
-   For more details, see the POSIX:2001 specification
-   <http://www.opengroup.org/susv3xsh/gai_strerror.html>.  */
-_GL_FUNCDECL_SYS (gai_strerror, const char *, (int ecode));
-#  endif
-_GL_CXXALIAS_SYS (gai_strerror, const char *, (int ecode));
-# endif
-_GL_CXXALIASWARN (gai_strerror);
-
-# if !@HAVE_DECL_GETNAMEINFO@
-/* Convert socket address to printable node and service names.
-   For more details, see the POSIX:2001 specification
-   <http://www.opengroup.org/susv3xsh/getnameinfo.html>.  */
-_GL_FUNCDECL_SYS (getnameinfo, int,
-                  (const struct sockaddr *restrict sa, socklen_t salen,
-                   char *restrict node, socklen_t nodelen,
-                   char *restrict service, socklen_t servicelen,
-                   int flags)
-                  _GL_ARG_NONNULL ((1)));
-# endif
-/* Need to cast, because on glibc systems, the seventh parameter is
-                        unsigned int flags.  */
-_GL_CXXALIAS_SYS_CAST (getnameinfo, int,
-                       (const struct sockaddr *restrict sa, socklen_t salen,
-                        char *restrict node, socklen_t nodelen,
-                        char *restrict service, socklen_t servicelen,
-                        int flags));
-_GL_CXXALIASWARN (getnameinfo);
-
-/* Possible flags for getnameinfo.  */
-# ifndef NI_NUMERICHOST
-#  define NI_NUMERICHOST 1
-# endif
-# ifndef NI_NUMERICSERV
-#  define NI_NUMERICSERV 2
-# endif
-
-#elif defined GNULIB_POSIXCHECK
-
-# undef getaddrinfo
-# if HAVE_RAW_DECL_GETADDRINFO
-_GL_WARN_ON_USE (getaddrinfo, "getaddrinfo is unportable - "
-                 "use gnulib module getaddrinfo for portability");
-# endif
-
-# undef freeaddrinfo
-# if HAVE_RAW_DECL_FREEADDRINFO
-_GL_WARN_ON_USE (freeaddrinfo, "freeaddrinfo is unportable - "
-                 "use gnulib module getaddrinfo for portability");
-# endif
-
-# undef gai_strerror
-# if HAVE_RAW_DECL_GAI_STRERROR
-_GL_WARN_ON_USE (gai_strerror, "gai_strerror is unportable - "
-                 "use gnulib module getaddrinfo for portability");
-# endif
-
-# undef getnameinfo
-# if HAVE_RAW_DECL_GETNAMEINFO
-_GL_WARN_ON_USE (getnameinfo, "getnameinfo is unportable - "
-                 "use gnulib module getaddrinfo for portability");
-# endif
-
-#endif
-
-#endif /* _@GUARD_PREFIX@_NETDB_H */
-#endif /* _@GUARD_PREFIX@_NETDB_H */

+ 0 - 47
gl/netinet_in.in.h~

@@ -1,47 +0,0 @@
-/* Substitute for <netinet/in.h>.
-   Copyright (C) 2007-2013 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef _@GUARD_PREFIX@_NETINET_IN_H
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-#if @HAVE_NETINET_IN_H@
-
-/* On many platforms, <netinet/in.h> assumes prior inclusion of
-   <sys/types.h>.  */
-# include <sys/types.h>
-
-/* The include_next requires a split double-inclusion guard.  */
-# @INCLUDE_NEXT@ @NEXT_NETINET_IN_H@
-
-#endif
-
-#ifndef _@GUARD_PREFIX@_NETINET_IN_H
-#define _@GUARD_PREFIX@_NETINET_IN_H
-
-#if !@HAVE_NETINET_IN_H@
-
-/* A platform that lacks <netinet/in.h>.  */
-
-# include <sys/socket.h>
-
-#endif
-
-#endif /* _@GUARD_PREFIX@_NETINET_IN_H */
-#endif /* _@GUARD_PREFIX@_NETINET_IN_H */

+ 0 - 271
gl/nl_langinfo.c~

@@ -1,271 +0,0 @@
-/* nl_langinfo() replacement: query locale dependent information.
-
-   Copyright (C) 2007-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include <langinfo.h>
-
-#if REPLACE_NL_LANGINFO
-
-/* Override nl_langinfo with support for added nl_item values.  */
-
-# include <locale.h>
-# include <string.h>
-
-# undef nl_langinfo
-
-char *
-rpl_nl_langinfo (nl_item item)
-{
-  switch (item)
-    {
-# if GNULIB_defined_CODESET
-    case CODESET:
-      {
-        const char *locale;
-        static char buf[2 + 10 + 1];
-
-        locale = setlocale (LC_CTYPE, NULL);
-        if (locale != NULL && locale[0] != '\0')
-          {
-            /* If the locale name contains an encoding after the dot, return
-               it.  */
-            const char *dot = strchr (locale, '.');
-
-            if (dot != NULL)
-              {
-                const char *modifier;
-
-                dot++;
-                /* Look for the possible @... trailer and remove it, if any.  */
-                modifier = strchr (dot, '@');
-                if (modifier == NULL)
-                  return dot;
-                if (modifier - dot < sizeof (buf))
-                  {
-                    memcpy (buf, dot, modifier - dot);
-                    buf [modifier - dot] = '\0';
-                    return buf;
-                  }
-              }
-          }
-        return "";
-      }
-# endif
-# if GNULIB_defined_T_FMT_AMPM
-    case T_FMT_AMPM:
-      return "%I:%M:%S %p";
-# endif
-# if GNULIB_defined_ERA
-    case ERA:
-      /* The format is not standardized.  In glibc it is a sequence of strings
-         of the form "direction:offset:start_date:end_date:era_name:era_format"
-         with an empty string at the end.  */
-      return "";
-    case ERA_D_FMT:
-      /* The %Ex conversion in strftime behaves like %x if the locale does not
-         have an alternative time format.  */
-      item = D_FMT;
-      break;
-    case ERA_D_T_FMT:
-      /* The %Ec conversion in strftime behaves like %c if the locale does not
-         have an alternative time format.  */
-      item = D_T_FMT;
-      break;
-    case ERA_T_FMT:
-      /* The %EX conversion in strftime behaves like %X if the locale does not
-         have an alternative time format.  */
-      item = T_FMT;
-      break;
-    case ALT_DIGITS:
-      /* The format is not standardized.  In glibc it is a sequence of 10
-         strings, appended in memory.  */
-      return "\0\0\0\0\0\0\0\0\0\0";
-# endif
-# if GNULIB_defined_YESEXPR || !FUNC_NL_LANGINFO_YESEXPR_WORKS
-    case YESEXPR:
-      return "^[yY]";
-    case NOEXPR:
-      return "^[nN]";
-# endif
-    default:
-      break;
-    }
-  return nl_langinfo (item);
-}
-
-#else
-
-/* Provide nl_langinfo from scratch.  */
-
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-
-/* Native Windows platforms.  */
-
-#  define WIN32_LEAN_AND_MEAN  /* avoid including junk */
-#  include <windows.h>
-
-#  include <stdio.h>
-
-# else
-
-/* An old Unix platform without locales, such as Linux libc5 or BeOS.  */
-
-# endif
-
-# include <locale.h>
-
-char *
-nl_langinfo (nl_item item)
-{
-  switch (item)
-    {
-    /* nl_langinfo items of the LC_CTYPE category */
-    case CODESET:
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-      {
-        static char buf[2 + 10 + 1];
-
-        /* The Windows API has a function returning the locale's codepage as
-           a number.  */
-        sprintf (buf, "CP%u", GetACP ());
-        return buf;
-      }
-# elif defined __BEOS__
-      return "UTF-8";
-# else
-      return "ISO-8859-1";
-# endif
-    /* nl_langinfo items of the LC_NUMERIC category */
-    case RADIXCHAR:
-      return localeconv () ->decimal_point;
-    case THOUSEP:
-      return localeconv () ->thousands_sep;
-    /* nl_langinfo items of the LC_TIME category.
-       TODO: Really use the locale.  */
-    case D_T_FMT:
-    case ERA_D_T_FMT:
-      return "%a %b %e %H:%M:%S %Y";
-    case D_FMT:
-    case ERA_D_FMT:
-      return "%m/%d/%y";
-    case T_FMT:
-    case ERA_T_FMT:
-      return "%H:%M:%S";
-    case T_FMT_AMPM:
-      return "%I:%M:%S %p";
-    case AM_STR:
-      return "AM";
-    case PM_STR:
-      return "PM";
-    case DAY_1:
-      return "Sunday";
-    case DAY_2:
-      return "Monday";
-    case DAY_3:
-      return "Tuesday";
-    case DAY_4:
-      return "Wednesday";
-    case DAY_5:
-      return "Thursday";
-    case DAY_6:
-      return "Friday";
-    case DAY_7:
-      return "Saturday";
-    case ABDAY_1:
-      return "Sun";
-    case ABDAY_2:
-      return "Mon";
-    case ABDAY_3:
-      return "Tue";
-    case ABDAY_4:
-      return "Wed";
-    case ABDAY_5:
-      return "Thu";
-    case ABDAY_6:
-      return "Fri";
-    case ABDAY_7:
-      return "Sat";
-    case MON_1:
-      return "January";
-    case MON_2:
-      return "February";
-    case MON_3:
-      return "March";
-    case MON_4:
-      return "April";
-    case MON_5:
-      return "May";
-    case MON_6:
-      return "June";
-    case MON_7:
-      return "July";
-    case MON_8:
-      return "August";
-    case MON_9:
-      return "September";
-    case MON_10:
-      return "October";
-    case MON_11:
-      return "November";
-    case MON_12:
-      return "December";
-    case ABMON_1:
-      return "Jan";
-    case ABMON_2:
-      return "Feb";
-    case ABMON_3:
-      return "Mar";
-    case ABMON_4:
-      return "Apr";
-    case ABMON_5:
-      return "May";
-    case ABMON_6:
-      return "Jun";
-    case ABMON_7:
-      return "Jul";
-    case ABMON_8:
-      return "Aug";
-    case ABMON_9:
-      return "Sep";
-    case ABMON_10:
-      return "Oct";
-    case ABMON_11:
-      return "Nov";
-    case ABMON_12:
-      return "Dec";
-    case ERA:
-      return "";
-    case ALT_DIGITS:
-      return "\0\0\0\0\0\0\0\0\0\0";
-    /* nl_langinfo items of the LC_MONETARY category
-       TODO: Really use the locale. */
-    case CRNCYSTR:
-      return "-";
-    /* nl_langinfo items of the LC_MESSAGES category
-       TODO: Really use the locale. */
-    case YESEXPR:
-      return "^[yY]";
-    case NOEXPR:
-      return "^[nN]";
-    default:
-      return "";
-    }
-}
-
-#endif

+ 0 - 187
gl/printf-args.c~

@@ -1,187 +0,0 @@
-/* Decomposed printf argument list.
-   Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2013 Free Software
-   Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-/* This file can be parametrized with the following macros:
-     ENABLE_UNISTDIO    Set to 1 to enable the unistdio extensions.
-     PRINTF_FETCHARGS   Name of the function to be defined.
-     STATIC             Set to 'static' to declare the function static.  */
-
-#ifndef PRINTF_FETCHARGS
-# include <config.h>
-#endif
-
-/* Specification.  */
-#ifndef PRINTF_FETCHARGS
-# include "printf-args.h"
-#endif
-
-#ifdef STATIC
-STATIC
-#endif
-int
-PRINTF_FETCHARGS (va_list args, arguments *a)
-{
-  size_t i;
-  argument *ap;
-
-  for (i = 0, ap = &a->arg[0]; i < a->count; i++, ap++)
-    switch (ap->type)
-      {
-      case TYPE_SCHAR:
-        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;
-      case TYPE_SHORT:
-        ap->a.a_short = va_arg (args, /*short*/ int);
-        break;
-      case TYPE_USHORT:
-        ap->a.a_ushort = va_arg (args, /*unsigned short*/ int);
-        break;
-      case TYPE_INT:
-        ap->a.a_int = va_arg (args, int);
-        break;
-      case TYPE_UINT:
-        ap->a.a_uint = va_arg (args, unsigned int);
-        break;
-      case TYPE_LONGINT:
-        ap->a.a_longint = va_arg (args, long int);
-        break;
-      case TYPE_ULONGINT:
-        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;
-      case TYPE_ULONGLONGINT:
-        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;
-      case TYPE_LONGDOUBLE:
-        ap->a.a_longdouble = va_arg (args, long double);
-        break;
-      case TYPE_CHAR:
-        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)
-           ? (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;
-#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;
-#endif
-      case TYPE_POINTER:
-        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;
-      case TYPE_COUNT_SHORT_POINTER:
-        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;
-      case TYPE_COUNT_LONGINT_POINTER:
-        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;
-#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;
-      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;
-      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;
-#endif
-      default:
-        /* Unknown type.  */
-        return -1;
-      }
-  return 0;
-}

+ 0 - 158
gl/printf-args.h~

@@ -1,158 +0,0 @@
-/* Decomposed printf argument list.
-   Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2013 Free Software
-   Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef NAGIOS_PRINTF_ARGS_H_INCLUDED
-#define NAGIOS_PRINTF_ARGS_H_INCLUDED
-
-/* This file can be parametrized with the following macros:
-     ENABLE_UNISTDIO    Set to 1 to enable the unistdio extensions.
-     PRINTF_FETCHARGS   Name of the function to be declared.
-     STATIC             Set to 'static' to declare the function static.  */
-
-/* Default parameters.  */
-#ifndef PRINTF_FETCHARGS
-# define PRINTF_FETCHARGS printf_fetchargs
-#endif
-
-/* Get size_t.  */
-#include <stddef.h>
-
-/* Get wchar_t.  */
-#if HAVE_WCHAR_T
-# include <stddef.h>
-#endif
-
-/* Get wint_t.  */
-#if HAVE_WINT_T
-# include <wchar.h>
-#endif
-
-/* Get va_list.  */
-#include <stdarg.h>
-
-
-/* Argument types */
-typedef enum
-{
-  TYPE_NONE,
-  TYPE_SCHAR,
-  TYPE_UCHAR,
-  TYPE_SHORT,
-  TYPE_USHORT,
-  TYPE_INT,
-  TYPE_UINT,
-  TYPE_LONGINT,
-  TYPE_ULONGINT,
-#if HAVE_LONG_LONG_INT
-  TYPE_LONGLONGINT,
-  TYPE_ULONGLONGINT,
-#endif
-  TYPE_DOUBLE,
-  TYPE_LONGDOUBLE,
-  TYPE_CHAR,
-#if HAVE_WINT_T
-  TYPE_WIDE_CHAR,
-#endif
-  TYPE_STRING,
-#if HAVE_WCHAR_T
-  TYPE_WIDE_STRING,
-#endif
-  TYPE_POINTER,
-  TYPE_COUNT_SCHAR_POINTER,
-  TYPE_COUNT_SHORT_POINTER,
-  TYPE_COUNT_INT_POINTER,
-  TYPE_COUNT_LONGINT_POINTER
-#if HAVE_LONG_LONG_INT
-, TYPE_COUNT_LONGLONGINT_POINTER
-#endif
-#if ENABLE_UNISTDIO
-  /* The unistdio extensions.  */
-, TYPE_U8_STRING
-, TYPE_U16_STRING
-, TYPE_U32_STRING
-#endif
-} arg_type;
-
-/* Polymorphic argument */
-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;
-#if HAVE_LONG_LONG_INT
-    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;
-#if HAVE_WINT_T
-    wint_t                      a_wide_char;
-#endif
-    const char*                 a_string;
-#if HAVE_WCHAR_T
-    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;
-#if HAVE_LONG_LONG_INT
-    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;
-#endif
-  }
-  a;
-}
-argument;
-
-/* Number of directly allocated arguments (no malloc() needed).  */
-#define N_DIRECT_ALLOC_ARGUMENTS 7
-
-typedef struct
-{
-  size_t count;
-  argument *arg;
-  argument direct_alloc_arg[N_DIRECT_ALLOC_ARGUMENTS];
-}
-arguments;
-
-
-/* Fetch the arguments, putting them into a. */
-#ifdef STATIC
-STATIC
-#else
-extern
-#endif
-int PRINTF_FETCHARGS (va_list args, arguments *a);
-
-#endif /* NAGIOS_PRINTF_ARGS_H_INCLUDED */

+ 0 - 638
gl/printf-parse.c~

@@ -1,638 +0,0 @@
-/* Formatted output to strings.
-   Copyright (C) 1999-2000, 2002-2003, 2006-2013 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-/* This file can be parametrized with the following macros:
-     CHAR_T             The element type of the format string.
-     CHAR_T_ONLY_ASCII  Set to 1 to enable verification that all characters
-                        in the format string are ASCII.
-     DIRECTIVE          Structure denoting a format directive.
-                        Depends on CHAR_T.
-     DIRECTIVES         Structure denoting the set of format directives of a
-                        format string.  Depends on CHAR_T.
-     PRINTF_PARSE       Function that parses a format string.
-                        Depends on CHAR_T.
-     STATIC             Set to 'static' to declare the function static.
-     ENABLE_UNISTDIO    Set to 1 to enable the unistdio extensions.  */
-
-#ifndef PRINTF_PARSE
-# include <config.h>
-#endif
-
-/* Specification.  */
-#ifndef PRINTF_PARSE
-# include "printf-parse.h"
-#endif
-
-/* Default parameters.  */
-#ifndef PRINTF_PARSE
-# define PRINTF_PARSE printf_parse
-# define CHAR_T char
-# define DIRECTIVE char_directive
-# define DIRECTIVES char_directives
-#endif
-
-/* Get size_t, NULL.  */
-#include <stddef.h>
-
-/* Get intmax_t.  */
-#if defined IN_LIBINTL || defined IN_LIBASPRINTF
-# if HAVE_STDINT_H_WITH_UINTMAX
-#  include <stdint.h>
-# endif
-# if HAVE_INTTYPES_H_WITH_UINTMAX
-#  include <inttypes.h>
-# endif
-#else
-# include <stdint.h>
-#endif
-
-/* malloc(), realloc(), free().  */
-#include <stdlib.h>
-
-/* memcpy().  */
-#include <string.h>
-
-/* errno.  */
-#include <errno.h>
-
-/* Checked size_t computations.  */
-#include "xsize.h"
-
-#if CHAR_T_ONLY_ASCII
-/* c_isascii().  */
-# include "c-ctype.h"
-#endif
-
-#ifdef STATIC
-STATIC
-#endif
-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 */
-  size_t max_width_length = 0;
-  size_t max_precision_length = 0;
-
-  d->count = 0;
-  d_allocated = N_DIRECT_ALLOC_DIRECTIVES;
-  d->dir = d->direct_alloc_dir;
-
-  a->count = 0;
-  a_allocated = N_DIRECT_ALLOC_ARGUMENTS;
-  a->arg = a->direct_alloc_arg;
-
-#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 != a->direct_alloc_arg            \
-                               ? realloc (a->arg, memory_size)          \
-                               : malloc (memory_size));                 \
-        if (memory == NULL)                                             \
-          /* Out of memory.  */                                         \
-          goto out_of_memory;                                           \
-        if (a->arg == a->direct_alloc_arg)                              \
-          memcpy (memory, a->arg, a->count * sizeof (argument));        \
-        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++;
-                }
-#if __GLIBC__ >= 2 && !defined __UCLIBC__
-              else if (*cp == 'I')
-                {
-                  dp->flags |= FLAG_LOCALIZED;
-                  cp++;
-                }
-#endif
-              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 Mac OS 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 Windows, 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':
-#if HAVE_LONG_LONG_INT
-                  /* 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 HAVE_LONG_LONG_INT
-                  /* 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 HAVE_WINT_T
-                    type = TYPE_WIDE_CHAR;
-#else
-                    goto error;
-#endif
-                  else
-                    type = TYPE_CHAR;
-                  break;
-#if HAVE_WINT_T
-                case 'C':
-                  type = TYPE_WIDE_CHAR;
-                  c = 'c';
-                  break;
-#endif
-                case 's':
-                  if (flags >= 8)
-#if HAVE_WCHAR_T
-                    type = TYPE_WIDE_STRING;
-#else
-                    goto error;
-#endif
-                  else
-                    type = TYPE_STRING;
-                  break;
-#if HAVE_WCHAR_T
-                case 'S':
-                  type = TYPE_WIDE_STRING;
-                  c = 's';
-                  break;
-#endif
-                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
-#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 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;
-#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 *) (d->dir != d->direct_alloc_dir
-                                      ? realloc (d->dir, memory_size)
-                                      : malloc (memory_size));
-              if (memory == NULL)
-                /* Out of memory.  */
-                goto out_of_memory;
-              if (d->dir == d->direct_alloc_dir)
-                memcpy (memory, d->dir, d->count * sizeof (DIRECTIVE));
-              d->dir = memory;
-            }
-        }
-#if CHAR_T_ONLY_ASCII
-      else if (!c_isascii (c))
-        {
-          /* Non-ASCII character.  Not supported.  */
-          goto error;
-        }
-#endif
-    }
-  d->dir[d->count].dir_start = cp;
-
-  d->max_width_length = max_width_length;
-  d->max_precision_length = max_precision_length;
-  return 0;
-
-error:
-  if (a->arg != a->direct_alloc_arg)
-    free (a->arg);
-  if (d->dir != d->direct_alloc_dir)
-    free (d->dir);
-  errno = EINVAL;
-  return -1;
-
-out_of_memory:
-  if (a->arg != a->direct_alloc_arg)
-    free (a->arg);
-  if (d->dir != d->direct_alloc_dir)
-    free (d->dir);
-  errno = ENOMEM;
-  return -1;
-}
-
-#undef PRINTF_PARSE
-#undef DIRECTIVES
-#undef DIRECTIVE
-#undef CHAR_T_ONLY_ASCII
-#undef CHAR_T

+ 0 - 193
gl/printf-parse.h~

@@ -1,193 +0,0 @@
-/* Parse printf format string.
-   Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2013 Free Software
-   Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef NAGIOS_PRINTF_PARSE_H_INCLUDED
-#define NAGIOS_PRINTF_PARSE_H_INCLUDED
-
-/* This file can be parametrized with the following macros:
-     ENABLE_UNISTDIO    Set to 1 to enable the unistdio extensions.
-     STATIC             Set to 'static' to declare the function static.  */
-
-#if HAVE_FEATURES_H
-# include <features.h> /* for __GLIBC__, __UCLIBC__ */
-#endif
-
-#include "printf-args.h"
-
-
-/* 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
-#if __GLIBC__ >= 2 && !defined __UCLIBC__
-# define FLAG_LOCALIZED 64      /* I flag, uses localized digits */
-#endif
-
-/* arg_index value indicating that no argument is consumed.  */
-#define ARG_NONE        (~(size_t)0)
-
-/* xxx_directive: A parsed directive.
-   xxx_directives: A parsed format string.  */
-
-/* Number of directly allocated directives (no malloc() needed).  */
-#define N_DIRECT_ALLOC_DIRECTIVES 7
-
-/* A parsed directive.  */
-typedef struct
-{
-  const char* dir_start;
-  const char* dir_end;
-  int flags;
-  const char* width_start;
-  const char* width_end;
-  size_t width_arg_index;
-  const char* precision_start;
-  const char* precision_end;
-  size_t precision_arg_index;
-  char conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
-  size_t arg_index;
-}
-char_directive;
-
-/* A parsed format string.  */
-typedef struct
-{
-  size_t count;
-  char_directive *dir;
-  size_t max_width_length;
-  size_t max_precision_length;
-  char_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
-}
-char_directives;
-
-#if ENABLE_UNISTDIO
-
-/* A parsed directive.  */
-typedef struct
-{
-  const uint8_t* dir_start;
-  const uint8_t* dir_end;
-  int flags;
-  const uint8_t* width_start;
-  const uint8_t* width_end;
-  size_t width_arg_index;
-  const uint8_t* precision_start;
-  const uint8_t* precision_end;
-  size_t precision_arg_index;
-  uint8_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
-  size_t arg_index;
-}
-u8_directive;
-
-/* A parsed format string.  */
-typedef struct
-{
-  size_t count;
-  u8_directive *dir;
-  size_t max_width_length;
-  size_t max_precision_length;
-  u8_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
-}
-u8_directives;
-
-/* A parsed directive.  */
-typedef struct
-{
-  const uint16_t* dir_start;
-  const uint16_t* dir_end;
-  int flags;
-  const uint16_t* width_start;
-  const uint16_t* width_end;
-  size_t width_arg_index;
-  const uint16_t* precision_start;
-  const uint16_t* precision_end;
-  size_t precision_arg_index;
-  uint16_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
-  size_t arg_index;
-}
-u16_directive;
-
-/* A parsed format string.  */
-typedef struct
-{
-  size_t count;
-  u16_directive *dir;
-  size_t max_width_length;
-  size_t max_precision_length;
-  u16_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
-}
-u16_directives;
-
-/* A parsed directive.  */
-typedef struct
-{
-  const uint32_t* dir_start;
-  const uint32_t* dir_end;
-  int flags;
-  const uint32_t* width_start;
-  const uint32_t* width_end;
-  size_t width_arg_index;
-  const uint32_t* precision_start;
-  const uint32_t* precision_end;
-  size_t precision_arg_index;
-  uint32_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
-  size_t arg_index;
-}
-u32_directive;
-
-/* A parsed format string.  */
-typedef struct
-{
-  size_t count;
-  u32_directive *dir;
-  size_t max_width_length;
-  size_t max_precision_length;
-  u32_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
-}
-u32_directives;
-
-#endif
-
-
-/* Parses the format string.  Fills in the number N of directives, and fills
-   in directives[0], ..., directives[N-1], and sets directives[N].dir_start
-   to the end of the format string.  Also fills in the arg_type fields of the
-   arguments and the needed count of arguments.  */
-#if ENABLE_UNISTDIO
-extern int
-       ulc_printf_parse (const char *format, char_directives *d, arguments *a);
-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);
-extern int
-       u32_printf_parse (const uint32_t *format, u32_directives *d,
-                         arguments *a);
-#else
-# ifdef STATIC
-STATIC
-# else
-extern
-# endif
-int printf_parse (const char *format, char_directives *d, arguments *a);
-#endif
-
-#endif /* NAGIOS_PRINTF_PARSE_H_INCLUDED */

+ 0 - 85
gl/read.c~

@@ -1,85 +0,0 @@
-/* POSIX compatible read() function.
-   Copyright (C) 2008-2013 Free Software Foundation, Inc.
-   Written by Bruno Haible <bruno@clisp.org>, 2011.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include <unistd.h>
-
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-
-# include <errno.h>
-# include <io.h>
-
-# define WIN32_LEAN_AND_MEAN  /* avoid including junk */
-# include <windows.h>
-
-# include "msvc-inval.h"
-# include "msvc-nothrow.h"
-
-# undef read
-
-# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
-static ssize_t
-read_nothrow (int fd, void *buf, size_t count)
-{
-  ssize_t result;
-
-  TRY_MSVC_INVAL
-    {
-      result = read (fd, buf, count);
-    }
-  CATCH_MSVC_INVAL
-    {
-      result = -1;
-      errno = EBADF;
-    }
-  DONE_MSVC_INVAL;
-
-  return result;
-}
-# else
-#  define read_nothrow read
-# endif
-
-ssize_t
-rpl_read (int fd, void *buf, size_t count)
-{
-  ssize_t ret = read_nothrow (fd, buf, count);
-
-# if GNULIB_NONBLOCKING
-  if (ret < 0
-      && GetLastError () == ERROR_NO_DATA)
-    {
-      HANDLE h = (HANDLE) _get_osfhandle (fd);
-      if (GetFileType (h) == FILE_TYPE_PIPE)
-        {
-          /* h is a pipe or socket.  */
-          DWORD state;
-          if (GetNamedPipeHandleState (h, &state, NULL, NULL, NULL, NULL, 0)
-              && (state & PIPE_NOWAIT) != 0)
-            /* h is a pipe in non-blocking mode.
-               Change errno from EINVAL to EAGAIN.  */
-            errno = EAGAIN;
-        }
-    }
-# endif
-
-  return ret;
-}
-
-#endif

+ 0 - 29
gl/ref-add.sin~

@@ -1,29 +0,0 @@
-# Add this package to a list of references stored in a text file.
-#
-#   Copyright (C) 2000, 2009-2013 Free Software Foundation, Inc.
-#
-#   This program is free software; you can redistribute it and/or modify
-#   it under the terms of the GNU General Public License as published by
-#   the Free Software Foundation; either version 3, or (at your option)
-#   any later version.
-#
-#   This program is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#   GNU General Public License for more details.
-#
-#   You should have received a copy of the GNU General Public License along
-#   with this program; if not, see <http://www.gnu.org/licenses/>.
-#
-# Written by Bruno Haible <haible@clisp.cons.org>.
-#
-/^# Packages using this file: / {
-  s/# Packages using this file://
-  ta
-  :a
-  s/ @PACKAGE@ / @PACKAGE@ /
-  tb
-  s/ $/ @PACKAGE@ /
-  :b
-  s/^/# Packages using this file:/
-}

+ 0 - 24
gl/ref-del.sin~

@@ -1,24 +0,0 @@
-# Remove this package from a list of references stored in a text file.
-#
-#   Copyright (C) 2000, 2009-2013 Free Software Foundation, Inc.
-#
-#   This program is free software; you can redistribute it and/or modify
-#   it under the terms of the GNU General Public License as published by
-#   the Free Software Foundation; either version 3, or (at your option)
-#   any later version.
-#
-#   This program is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#   GNU General Public License for more details.
-#
-#   You should have received a copy of the GNU General Public License along
-#   with this program; if not, see <http://www.gnu.org/licenses/>.
-#
-# Written by Bruno Haible <haible@clisp.cons.org>.
-#
-/^# Packages using this file: / {
-  s/# Packages using this file://
-  s/ @PACKAGE@ / /
-  s/^/# Packages using this file:/
-}

+ 0 - 3922
gl/regcomp.c~

@@ -1,3922 +0,0 @@
-/* Extended regular expression matching and search library.
-   Copyright (C) 2002-2013 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public
-   License as published by the Free Software Foundation; either
-   version 3 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern,
-					  size_t length, reg_syntax_t syntax);
-static void re_compile_fastmap_iter (regex_t *bufp,
-				     const re_dfastate_t *init_state,
-				     char *fastmap);
-static reg_errcode_t init_dfa (re_dfa_t *dfa, size_t pat_len);
-#ifdef RE_ENABLE_I18N
-static void free_charset (re_charset_t *cset);
-#endif /* RE_ENABLE_I18N */
-static void free_workarea_compile (regex_t *preg);
-static reg_errcode_t create_initial_state (re_dfa_t *dfa);
-#ifdef RE_ENABLE_I18N
-static void optimize_utf8 (re_dfa_t *dfa);
-#endif
-static reg_errcode_t analyze (regex_t *preg);
-static reg_errcode_t preorder (bin_tree_t *root,
-			       reg_errcode_t (fn (void *, bin_tree_t *)),
-			       void *extra);
-static reg_errcode_t postorder (bin_tree_t *root,
-				reg_errcode_t (fn (void *, bin_tree_t *)),
-				void *extra);
-static reg_errcode_t optimize_subexps (void *extra, bin_tree_t *node);
-static reg_errcode_t lower_subexps (void *extra, bin_tree_t *node);
-static bin_tree_t *lower_subexp (reg_errcode_t *err, regex_t *preg,
-				 bin_tree_t *node);
-static reg_errcode_t calc_first (void *extra, bin_tree_t *node);
-static reg_errcode_t calc_next (void *extra, bin_tree_t *node);
-static reg_errcode_t link_nfa_nodes (void *extra, bin_tree_t *node);
-static Idx duplicate_node (re_dfa_t *dfa, Idx org_idx, unsigned int constraint);
-static Idx search_duplicated_node (const re_dfa_t *dfa, Idx org_node,
-				   unsigned int constraint);
-static reg_errcode_t calc_eclosure (re_dfa_t *dfa);
-static reg_errcode_t calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa,
-					 Idx node, bool root);
-static reg_errcode_t calc_inveclosure (re_dfa_t *dfa);
-static Idx fetch_number (re_string_t *input, re_token_t *token,
-			 reg_syntax_t syntax);
-static int peek_token (re_token_t *token, re_string_t *input,
-			reg_syntax_t syntax) internal_function;
-static bin_tree_t *parse (re_string_t *regexp, regex_t *preg,
-			  reg_syntax_t syntax, reg_errcode_t *err);
-static bin_tree_t *parse_reg_exp (re_string_t *regexp, regex_t *preg,
-				  re_token_t *token, reg_syntax_t syntax,
-				  Idx nest, reg_errcode_t *err);
-static bin_tree_t *parse_branch (re_string_t *regexp, regex_t *preg,
-				 re_token_t *token, reg_syntax_t syntax,
-				 Idx nest, reg_errcode_t *err);
-static bin_tree_t *parse_expression (re_string_t *regexp, regex_t *preg,
-				     re_token_t *token, reg_syntax_t syntax,
-				     Idx nest, reg_errcode_t *err);
-static bin_tree_t *parse_sub_exp (re_string_t *regexp, regex_t *preg,
-				  re_token_t *token, reg_syntax_t syntax,
-				  Idx nest, reg_errcode_t *err);
-static bin_tree_t *parse_dup_op (bin_tree_t *dup_elem, re_string_t *regexp,
-				 re_dfa_t *dfa, re_token_t *token,
-				 reg_syntax_t syntax, reg_errcode_t *err);
-static bin_tree_t *parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa,
-				      re_token_t *token, reg_syntax_t syntax,
-				      reg_errcode_t *err);
-static reg_errcode_t parse_bracket_element (bracket_elem_t *elem,
-					    re_string_t *regexp,
-					    re_token_t *token, int token_len,
-					    re_dfa_t *dfa,
-					    reg_syntax_t syntax,
-					    bool accept_hyphen);
-static reg_errcode_t parse_bracket_symbol (bracket_elem_t *elem,
-					  re_string_t *regexp,
-					  re_token_t *token);
-#ifdef RE_ENABLE_I18N
-static reg_errcode_t build_equiv_class (bitset_t sbcset,
-					re_charset_t *mbcset,
-					Idx *equiv_class_alloc,
-					const unsigned char *name);
-static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans,
-				      bitset_t sbcset,
-				      re_charset_t *mbcset,
-				      Idx *char_class_alloc,
-				      const char *class_name,
-				      reg_syntax_t syntax);
-#else  /* not RE_ENABLE_I18N */
-static reg_errcode_t build_equiv_class (bitset_t sbcset,
-					const unsigned char *name);
-static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans,
-				      bitset_t sbcset,
-				      const char *class_name,
-				      reg_syntax_t syntax);
-#endif /* not RE_ENABLE_I18N */
-static bin_tree_t *build_charclass_op (re_dfa_t *dfa,
-				       RE_TRANSLATE_TYPE trans,
-				       const char *class_name,
-				       const char *extra,
-				       bool non_match, reg_errcode_t *err);
-static bin_tree_t *create_tree (re_dfa_t *dfa,
-				bin_tree_t *left, bin_tree_t *right,
-				re_token_type_t type);
-static bin_tree_t *create_token_tree (re_dfa_t *dfa,
-				      bin_tree_t *left, bin_tree_t *right,
-				      const re_token_t *token);
-static bin_tree_t *duplicate_tree (const bin_tree_t *src, re_dfa_t *dfa);
-static void free_token (re_token_t *node);
-static reg_errcode_t free_tree (void *extra, bin_tree_t *node);
-static reg_errcode_t mark_opt_subexp (void *extra, bin_tree_t *node);
-
-/* This table gives an error message for each of the error codes listed
-   in regex.h.  Obviously the order here has to be same as there.
-   POSIX doesn't require that we do anything for REG_NOERROR,
-   but why not be nice?  */
-
-static const char __re_error_msgid[] =
-  {
-#define REG_NOERROR_IDX	0
-    gettext_noop ("Success")	/* REG_NOERROR */
-    "\0"
-#define REG_NOMATCH_IDX (REG_NOERROR_IDX + sizeof "Success")
-    gettext_noop ("No match")	/* REG_NOMATCH */
-    "\0"
-#define REG_BADPAT_IDX	(REG_NOMATCH_IDX + sizeof "No match")
-    gettext_noop ("Invalid regular expression") /* REG_BADPAT */
-    "\0"
-#define REG_ECOLLATE_IDX (REG_BADPAT_IDX + sizeof "Invalid regular expression")
-    gettext_noop ("Invalid collation character") /* REG_ECOLLATE */
-    "\0"
-#define REG_ECTYPE_IDX	(REG_ECOLLATE_IDX + sizeof "Invalid collation character")
-    gettext_noop ("Invalid character class name") /* REG_ECTYPE */
-    "\0"
-#define REG_EESCAPE_IDX	(REG_ECTYPE_IDX + sizeof "Invalid character class name")
-    gettext_noop ("Trailing backslash") /* REG_EESCAPE */
-    "\0"
-#define REG_ESUBREG_IDX	(REG_EESCAPE_IDX + sizeof "Trailing backslash")
-    gettext_noop ("Invalid back reference") /* REG_ESUBREG */
-    "\0"
-#define REG_EBRACK_IDX	(REG_ESUBREG_IDX + sizeof "Invalid back reference")
-    gettext_noop ("Unmatched [ or [^")	/* REG_EBRACK */
-    "\0"
-#define REG_EPAREN_IDX	(REG_EBRACK_IDX + sizeof "Unmatched [ or [^")
-    gettext_noop ("Unmatched ( or \\(") /* REG_EPAREN */
-    "\0"
-#define REG_EBRACE_IDX	(REG_EPAREN_IDX + sizeof "Unmatched ( or \\(")
-    gettext_noop ("Unmatched \\{") /* REG_EBRACE */
-    "\0"
-#define REG_BADBR_IDX	(REG_EBRACE_IDX + sizeof "Unmatched \\{")
-    gettext_noop ("Invalid content of \\{\\}") /* REG_BADBR */
-    "\0"
-#define REG_ERANGE_IDX	(REG_BADBR_IDX + sizeof "Invalid content of \\{\\}")
-    gettext_noop ("Invalid range end")	/* REG_ERANGE */
-    "\0"
-#define REG_ESPACE_IDX	(REG_ERANGE_IDX + sizeof "Invalid range end")
-    gettext_noop ("Memory exhausted") /* REG_ESPACE */
-    "\0"
-#define REG_BADRPT_IDX	(REG_ESPACE_IDX + sizeof "Memory exhausted")
-    gettext_noop ("Invalid preceding regular expression") /* REG_BADRPT */
-    "\0"
-#define REG_EEND_IDX	(REG_BADRPT_IDX + sizeof "Invalid preceding regular expression")
-    gettext_noop ("Premature end of regular expression") /* REG_EEND */
-    "\0"
-#define REG_ESIZE_IDX	(REG_EEND_IDX + sizeof "Premature end of regular expression")
-    gettext_noop ("Regular expression too big") /* REG_ESIZE */
-    "\0"
-#define REG_ERPAREN_IDX	(REG_ESIZE_IDX + sizeof "Regular expression too big")
-    gettext_noop ("Unmatched ) or \\)") /* REG_ERPAREN */
-  };
-
-static const size_t __re_error_msgid_idx[] =
-  {
-    REG_NOERROR_IDX,
-    REG_NOMATCH_IDX,
-    REG_BADPAT_IDX,
-    REG_ECOLLATE_IDX,
-    REG_ECTYPE_IDX,
-    REG_EESCAPE_IDX,
-    REG_ESUBREG_IDX,
-    REG_EBRACK_IDX,
-    REG_EPAREN_IDX,
-    REG_EBRACE_IDX,
-    REG_BADBR_IDX,
-    REG_ERANGE_IDX,
-    REG_ESPACE_IDX,
-    REG_BADRPT_IDX,
-    REG_EEND_IDX,
-    REG_ESIZE_IDX,
-    REG_ERPAREN_IDX
-  };
-
-/* Entry points for GNU code.  */
-
-/* re_compile_pattern is the GNU regular expression compiler: it
-   compiles PATTERN (of length LENGTH) and puts the result in BUFP.
-   Returns 0 if the pattern was valid, otherwise an error string.
-
-   Assumes the 'allocated' (and perhaps 'buffer') and 'translate' fields
-   are set in BUFP on entry.  */
-
-#ifdef _LIBC
-const char *
-re_compile_pattern (pattern, length, bufp)
-    const char *pattern;
-    size_t length;
-    struct re_pattern_buffer *bufp;
-#else /* size_t might promote */
-const char *
-re_compile_pattern (const char *pattern, size_t length,
-		    struct re_pattern_buffer *bufp)
-#endif
-{
-  reg_errcode_t ret;
-
-  /* And GNU code determines whether or not to get register information
-     by passing null for the REGS argument to re_match, etc., not by
-     setting no_sub, unless RE_NO_SUB is set.  */
-  bufp->no_sub = !!(re_syntax_options & RE_NO_SUB);
-
-  /* Match anchors at newline.  */
-  bufp->newline_anchor = 1;
-
-  ret = re_compile_internal (bufp, pattern, length, re_syntax_options);
-
-  if (!ret)
-    return NULL;
-  return gettext (__re_error_msgid + __re_error_msgid_idx[(int) ret]);
-}
-#ifdef _LIBC
-weak_alias (__re_compile_pattern, re_compile_pattern)
-#endif
-
-/* Set by 're_set_syntax' to the current regexp syntax to recognize.  Can
-   also be assigned to arbitrarily: each pattern buffer stores its own
-   syntax, so it can be changed between regex compilations.  */
-/* This has no initializer because initialized variables in Emacs
-   become read-only after dumping.  */
-reg_syntax_t re_syntax_options;
-
-
-/* Specify the precise syntax of regexps for compilation.  This provides
-   for compatibility for various utilities which historically have
-   different, incompatible syntaxes.
-
-   The argument SYNTAX is a bit mask comprised of the various bits
-   defined in regex.h.  We return the old syntax.  */
-
-reg_syntax_t
-re_set_syntax (syntax)
-    reg_syntax_t syntax;
-{
-  reg_syntax_t ret = re_syntax_options;
-
-  re_syntax_options = syntax;
-  return ret;
-}
-#ifdef _LIBC
-weak_alias (__re_set_syntax, re_set_syntax)
-#endif
-
-int
-re_compile_fastmap (bufp)
-    struct re_pattern_buffer *bufp;
-{
-  re_dfa_t *dfa = bufp->buffer;
-  char *fastmap = bufp->fastmap;
-
-  memset (fastmap, '\0', sizeof (char) * SBC_MAX);
-  re_compile_fastmap_iter (bufp, dfa->init_state, fastmap);
-  if (dfa->init_state != dfa->init_state_word)
-    re_compile_fastmap_iter (bufp, dfa->init_state_word, fastmap);
-  if (dfa->init_state != dfa->init_state_nl)
-    re_compile_fastmap_iter (bufp, dfa->init_state_nl, fastmap);
-  if (dfa->init_state != dfa->init_state_begbuf)
-    re_compile_fastmap_iter (bufp, dfa->init_state_begbuf, fastmap);
-  bufp->fastmap_accurate = 1;
-  return 0;
-}
-#ifdef _LIBC
-weak_alias (__re_compile_fastmap, re_compile_fastmap)
-#endif
-
-static inline void
-__attribute__ ((always_inline))
-re_set_fastmap (char *fastmap, bool icase, int ch)
-{
-  fastmap[ch] = 1;
-  if (icase)
-    fastmap[tolower (ch)] = 1;
-}
-
-/* Helper function for re_compile_fastmap.
-   Compile fastmap for the initial_state INIT_STATE.  */
-
-static void
-re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
-			 char *fastmap)
-{
-  re_dfa_t *dfa = bufp->buffer;
-  Idx node_cnt;
-  bool icase = (dfa->mb_cur_max == 1 && (bufp->syntax & RE_ICASE));
-  for (node_cnt = 0; node_cnt < init_state->nodes.nelem; ++node_cnt)
-    {
-      Idx node = init_state->nodes.elems[node_cnt];
-      re_token_type_t type = dfa->nodes[node].type;
-
-      if (type == CHARACTER)
-	{
-	  re_set_fastmap (fastmap, icase, dfa->nodes[node].opr.c);
-#ifdef RE_ENABLE_I18N
-	  if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
-	    {
-	      unsigned char buf[MB_LEN_MAX];
-	      unsigned char *p;
-	      wchar_t wc;
-	      mbstate_t state;
-
-	      p = buf;
-	      *p++ = dfa->nodes[node].opr.c;
-	      while (++node < dfa->nodes_len
-		     &&	dfa->nodes[node].type == CHARACTER
-		     && dfa->nodes[node].mb_partial)
-		*p++ = dfa->nodes[node].opr.c;
-	      memset (&state, '\0', sizeof (state));
-	      if (__mbrtowc (&wc, (const char *) buf, p - buf,
-			     &state) == p - buf
-		  && (__wcrtomb ((char *) buf, towlower (wc), &state)
-		      != (size_t) -1))
-		re_set_fastmap (fastmap, false, buf[0]);
-	    }
-#endif
-	}
-      else if (type == SIMPLE_BRACKET)
-	{
-	  int i, ch;
-	  for (i = 0, ch = 0; i < BITSET_WORDS; ++i)
-	    {
-	      int j;
-	      bitset_word_t w = dfa->nodes[node].opr.sbcset[i];
-	      for (j = 0; j < BITSET_WORD_BITS; ++j, ++ch)
-		if (w & ((bitset_word_t) 1 << j))
-		  re_set_fastmap (fastmap, icase, ch);
-	    }
-	}
-#ifdef RE_ENABLE_I18N
-      else if (type == COMPLEX_BRACKET)
-	{
-	  re_charset_t *cset = dfa->nodes[node].opr.mbcset;
-	  Idx i;
-
-# ifdef _LIBC
-	  /* See if we have to try all bytes which start multiple collation
-	     elements.
-	     e.g. In da_DK, we want to catch 'a' since "aa" is a valid
-		  collation element, and don't catch 'b' since 'b' is
-		  the only collation element which starts from 'b' (and
-		  it is caught by SIMPLE_BRACKET).  */
-	      if (_NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES) != 0
-		  && (cset->ncoll_syms || cset->nranges))
-		{
-		  const int32_t *table = (const int32_t *)
-		    _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
-		  for (i = 0; i < SBC_MAX; ++i)
-		    if (table[i] < 0)
-		      re_set_fastmap (fastmap, icase, i);
-		}
-# endif /* _LIBC */
-
-	  /* See if we have to start the match at all multibyte characters,
-	     i.e. where we would not find an invalid sequence.  This only
-	     applies to multibyte character sets; for single byte character
-	     sets, the SIMPLE_BRACKET again suffices.  */
-	  if (dfa->mb_cur_max > 1
-	      && (cset->nchar_classes || cset->non_match || cset->nranges
-# ifdef _LIBC
-		  || cset->nequiv_classes
-# endif /* _LIBC */
-		 ))
-	    {
-	      unsigned char c = 0;
-	      do
-		{
-		  mbstate_t mbs;
-		  memset (&mbs, 0, sizeof (mbs));
-		  if (__mbrtowc (NULL, (char *) &c, 1, &mbs) == (size_t) -2)
-		    re_set_fastmap (fastmap, false, (int) c);
-		}
-	      while (++c != 0);
-	    }
-
-	  else
-	    {
-	      /* ... Else catch all bytes which can start the mbchars.  */
-	      for (i = 0; i < cset->nmbchars; ++i)
-		{
-		  char buf[256];
-		  mbstate_t state;
-		  memset (&state, '\0', sizeof (state));
-		  if (__wcrtomb (buf, cset->mbchars[i], &state) != (size_t) -1)
-		    re_set_fastmap (fastmap, icase, *(unsigned char *) buf);
-		  if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
-		    {
-		      if (__wcrtomb (buf, towlower (cset->mbchars[i]), &state)
-			  != (size_t) -1)
-			re_set_fastmap (fastmap, false, *(unsigned char *) buf);
-		    }
-		}
-	    }
-	}
-#endif /* RE_ENABLE_I18N */
-      else if (type == OP_PERIOD
-#ifdef RE_ENABLE_I18N
-	       || type == OP_UTF8_PERIOD
-#endif /* RE_ENABLE_I18N */
-	       || type == END_OF_RE)
-	{
-	  memset (fastmap, '\1', sizeof (char) * SBC_MAX);
-	  if (type == END_OF_RE)
-	    bufp->can_be_null = 1;
-	  return;
-	}
-    }
-}
-
-/* Entry point for POSIX code.  */
-/* regcomp takes a regular expression as a string and compiles it.
-
-   PREG is a regex_t *.  We do not expect any fields to be initialized,
-   since POSIX says we shouldn't.  Thus, we set
-
-     'buffer' to the compiled pattern;
-     'used' to the length of the compiled pattern;
-     'syntax' to RE_SYNTAX_POSIX_EXTENDED if the
-       REG_EXTENDED bit in CFLAGS is set; otherwise, to
-       RE_SYNTAX_POSIX_BASIC;
-     'newline_anchor' to REG_NEWLINE being set in CFLAGS;
-     'fastmap' to an allocated space for the fastmap;
-     'fastmap_accurate' to zero;
-     're_nsub' to the number of subexpressions in PATTERN.
-
-   PATTERN is the address of the pattern string.
-
-   CFLAGS is a series of bits which affect compilation.
-
-     If REG_EXTENDED is set, we use POSIX extended syntax; otherwise, we
-     use POSIX basic syntax.
-
-     If REG_NEWLINE is set, then . and [^...] don't match newline.
-     Also, regexec will try a match beginning after every newline.
-
-     If REG_ICASE is set, then we considers upper- and lowercase
-     versions of letters to be equivalent when matching.
-
-     If REG_NOSUB is set, then when PREG is passed to regexec, that
-     routine will report only success or failure, and nothing about the
-     registers.
-
-   It returns 0 if it succeeds, nonzero if it doesn't.  (See regex.h for
-   the return codes and their meanings.)  */
-
-int
-regcomp (preg, pattern, cflags)
-    regex_t *_Restrict_ preg;
-    const char *_Restrict_ pattern;
-    int cflags;
-{
-  reg_errcode_t ret;
-  reg_syntax_t syntax = ((cflags & REG_EXTENDED) ? RE_SYNTAX_POSIX_EXTENDED
-			 : RE_SYNTAX_POSIX_BASIC);
-
-  preg->buffer = NULL;
-  preg->allocated = 0;
-  preg->used = 0;
-
-  /* Try to allocate space for the fastmap.  */
-  preg->fastmap = re_malloc (char, SBC_MAX);
-  if (BE (preg->fastmap == NULL, 0))
-    return REG_ESPACE;
-
-  syntax |= (cflags & REG_ICASE) ? RE_ICASE : 0;
-
-  /* If REG_NEWLINE is set, newlines are treated differently.  */
-  if (cflags & REG_NEWLINE)
-    { /* REG_NEWLINE implies neither . nor [^...] match newline.  */
-      syntax &= ~RE_DOT_NEWLINE;
-      syntax |= RE_HAT_LISTS_NOT_NEWLINE;
-      /* It also changes the matching behavior.  */
-      preg->newline_anchor = 1;
-    }
-  else
-    preg->newline_anchor = 0;
-  preg->no_sub = !!(cflags & REG_NOSUB);
-  preg->translate = NULL;
-
-  ret = re_compile_internal (preg, pattern, strlen (pattern), syntax);
-
-  /* POSIX doesn't distinguish between an unmatched open-group and an
-     unmatched close-group: both are REG_EPAREN.  */
-  if (ret == REG_ERPAREN)
-    ret = REG_EPAREN;
-
-  /* We have already checked preg->fastmap != NULL.  */
-  if (BE (ret == REG_NOERROR, 1))
-    /* Compute the fastmap now, since regexec cannot modify the pattern
-       buffer.  This function never fails in this implementation.  */
-    (void) re_compile_fastmap (preg);
-  else
-    {
-      /* Some error occurred while compiling the expression.  */
-      re_free (preg->fastmap);
-      preg->fastmap = NULL;
-    }
-
-  return (int) ret;
-}
-#ifdef _LIBC
-weak_alias (__regcomp, regcomp)
-#endif
-
-/* Returns a message corresponding to an error code, ERRCODE, returned
-   from either regcomp or regexec.   We don't use PREG here.  */
-
-#ifdef _LIBC
-size_t
-regerror (errcode, preg, errbuf, errbuf_size)
-    int errcode;
-    const regex_t *_Restrict_ preg;
-    char *_Restrict_ errbuf;
-    size_t errbuf_size;
-#else /* size_t might promote */
-size_t
-regerror (int errcode, const regex_t *_Restrict_ preg,
-	  char *_Restrict_ errbuf, size_t errbuf_size)
-#endif
-{
-  const char *msg;
-  size_t msg_size;
-
-  if (BE (errcode < 0
-	  || errcode >= (int) (sizeof (__re_error_msgid_idx)
-			       / sizeof (__re_error_msgid_idx[0])), 0))
-    /* Only error codes returned by the rest of the code should be passed
-       to this routine.  If we are given anything else, or if other regex
-       code generates an invalid error code, then the program has a bug.
-       Dump core so we can fix it.  */
-    abort ();
-
-  msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]);
-
-  msg_size = strlen (msg) + 1; /* Includes the null.  */
-
-  if (BE (errbuf_size != 0, 1))
-    {
-      size_t cpy_size = msg_size;
-      if (BE (msg_size > errbuf_size, 0))
-	{
-	  cpy_size = errbuf_size - 1;
-	  errbuf[cpy_size] = '\0';
-	}
-      memcpy (errbuf, msg, cpy_size);
-    }
-
-  return msg_size;
-}
-#ifdef _LIBC
-weak_alias (__regerror, regerror)
-#endif
-
-
-#ifdef RE_ENABLE_I18N
-/* This static array is used for the map to single-byte characters when
-   UTF-8 is used.  Otherwise we would allocate memory just to initialize
-   it the same all the time.  UTF-8 is the preferred encoding so this is
-   a worthwhile optimization.  */
-static const bitset_t utf8_sb_map =
-{
-  /* Set the first 128 bits.  */
-# if defined __GNUC__ && !defined __STRICT_ANSI__
-  [0 ... 0x80 / BITSET_WORD_BITS - 1] = BITSET_WORD_MAX
-# else
-#  if 4 * BITSET_WORD_BITS < ASCII_CHARS
-#   error "bitset_word_t is narrower than 32 bits"
-#  elif 3 * BITSET_WORD_BITS < ASCII_CHARS
-  BITSET_WORD_MAX, BITSET_WORD_MAX, BITSET_WORD_MAX,
-#  elif 2 * BITSET_WORD_BITS < ASCII_CHARS
-  BITSET_WORD_MAX, BITSET_WORD_MAX,
-#  elif 1 * BITSET_WORD_BITS < ASCII_CHARS
-  BITSET_WORD_MAX,
-#  endif
-  (BITSET_WORD_MAX
-   >> (SBC_MAX % BITSET_WORD_BITS == 0
-       ? 0
-       : BITSET_WORD_BITS - SBC_MAX % BITSET_WORD_BITS))
-# endif
-};
-#endif
-
-
-static void
-free_dfa_content (re_dfa_t *dfa)
-{
-  Idx i, j;
-
-  if (dfa->nodes)
-    for (i = 0; i < dfa->nodes_len; ++i)
-      free_token (dfa->nodes + i);
-  re_free (dfa->nexts);
-  for (i = 0; i < dfa->nodes_len; ++i)
-    {
-      if (dfa->eclosures != NULL)
-	re_node_set_free (dfa->eclosures + i);
-      if (dfa->inveclosures != NULL)
-	re_node_set_free (dfa->inveclosures + i);
-      if (dfa->edests != NULL)
-	re_node_set_free (dfa->edests + i);
-    }
-  re_free (dfa->edests);
-  re_free (dfa->eclosures);
-  re_free (dfa->inveclosures);
-  re_free (dfa->nodes);
-
-  if (dfa->state_table)
-    for (i = 0; i <= dfa->state_hash_mask; ++i)
-      {
-	struct re_state_table_entry *entry = dfa->state_table + i;
-	for (j = 0; j < entry->num; ++j)
-	  {
-	    re_dfastate_t *state = entry->array[j];
-	    free_state (state);
-	  }
-	re_free (entry->array);
-      }
-  re_free (dfa->state_table);
-#ifdef RE_ENABLE_I18N
-  if (dfa->sb_char != utf8_sb_map)
-    re_free (dfa->sb_char);
-#endif
-  re_free (dfa->subexp_map);
-#ifdef DEBUG
-  re_free (dfa->re_str);
-#endif
-
-  re_free (dfa);
-}
-
-
-/* Free dynamically allocated space used by PREG.  */
-
-void
-regfree (preg)
-    regex_t *preg;
-{
-  re_dfa_t *dfa = preg->buffer;
-  if (BE (dfa != NULL, 1))
-    {
-      lock_fini (dfa->lock);
-      free_dfa_content (dfa);
-    }
-  preg->buffer = NULL;
-  preg->allocated = 0;
-
-  re_free (preg->fastmap);
-  preg->fastmap = NULL;
-
-  re_free (preg->translate);
-  preg->translate = NULL;
-}
-#ifdef _LIBC
-weak_alias (__regfree, regfree)
-#endif
-
-/* Entry points compatible with 4.2 BSD regex library.  We don't define
-   them unless specifically requested.  */
-
-#if defined _REGEX_RE_COMP || defined _LIBC
-
-/* BSD has one and only one pattern buffer.  */
-static struct re_pattern_buffer re_comp_buf;
-
-char *
-# ifdef _LIBC
-/* Make these definitions weak in libc, so POSIX programs can redefine
-   these names if they don't use our functions, and still use
-   regcomp/regexec above without link errors.  */
-weak_function
-# endif
-re_comp (s)
-     const char *s;
-{
-  reg_errcode_t ret;
-  char *fastmap;
-
-  if (!s)
-    {
-      if (!re_comp_buf.buffer)
-	return gettext ("No previous regular expression");
-      return 0;
-    }
-
-  if (re_comp_buf.buffer)
-    {
-      fastmap = re_comp_buf.fastmap;
-      re_comp_buf.fastmap = NULL;
-      __regfree (&re_comp_buf);
-      memset (&re_comp_buf, '\0', sizeof (re_comp_buf));
-      re_comp_buf.fastmap = fastmap;
-    }
-
-  if (re_comp_buf.fastmap == NULL)
-    {
-      re_comp_buf.fastmap = (char *) malloc (SBC_MAX);
-      if (re_comp_buf.fastmap == NULL)
-	return (char *) gettext (__re_error_msgid
-				 + __re_error_msgid_idx[(int) REG_ESPACE]);
-    }
-
-  /* Since 're_exec' always passes NULL for the 'regs' argument, we
-     don't need to initialize the pattern buffer fields which affect it.  */
-
-  /* Match anchors at newlines.  */
-  re_comp_buf.newline_anchor = 1;
-
-  ret = re_compile_internal (&re_comp_buf, s, strlen (s), re_syntax_options);
-
-  if (!ret)
-    return NULL;
-
-  /* Yes, we're discarding 'const' here if !HAVE_LIBINTL.  */
-  return (char *) gettext (__re_error_msgid + __re_error_msgid_idx[(int) ret]);
-}
-
-#ifdef _LIBC
-libc_freeres_fn (free_mem)
-{
-  __regfree (&re_comp_buf);
-}
-#endif
-
-#endif /* _REGEX_RE_COMP */
-
-/* Internal entry point.
-   Compile the regular expression PATTERN, whose length is LENGTH.
-   SYNTAX indicate regular expression's syntax.  */
-
-static reg_errcode_t
-re_compile_internal (regex_t *preg, const char * pattern, size_t length,
-		     reg_syntax_t syntax)
-{
-  reg_errcode_t err = REG_NOERROR;
-  re_dfa_t *dfa;
-  re_string_t regexp;
-
-  /* Initialize the pattern buffer.  */
-  preg->fastmap_accurate = 0;
-  preg->syntax = syntax;
-  preg->not_bol = preg->not_eol = 0;
-  preg->used = 0;
-  preg->re_nsub = 0;
-  preg->can_be_null = 0;
-  preg->regs_allocated = REGS_UNALLOCATED;
-
-  /* Initialize the dfa.  */
-  dfa = preg->buffer;
-  if (BE (preg->allocated < sizeof (re_dfa_t), 0))
-    {
-      /* If zero allocated, but buffer is non-null, try to realloc
-	 enough space.  This loses if buffer's address is bogus, but
-	 that is the user's responsibility.  If ->buffer is NULL this
-	 is a simple allocation.  */
-      dfa = re_realloc (preg->buffer, re_dfa_t, 1);
-      if (dfa == NULL)
-	return REG_ESPACE;
-      preg->allocated = sizeof (re_dfa_t);
-      preg->buffer = dfa;
-    }
-  preg->used = sizeof (re_dfa_t);
-
-  err = init_dfa (dfa, length);
-  if (BE (err == REG_NOERROR && lock_init (dfa->lock) != 0, 0))
-    err = REG_ESPACE;
-  if (BE (err != REG_NOERROR, 0))
-    {
-      free_dfa_content (dfa);
-      preg->buffer = NULL;
-      preg->allocated = 0;
-      return err;
-    }
-#ifdef DEBUG
-  /* Note: length+1 will not overflow since it is checked in init_dfa.  */
-  dfa->re_str = re_malloc (char, length + 1);
-  strncpy (dfa->re_str, pattern, length + 1);
-#endif
-
-  err = re_string_construct (&regexp, pattern, length, preg->translate,
-			     (syntax & RE_ICASE) != 0, dfa);
-  if (BE (err != REG_NOERROR, 0))
-    {
-    re_compile_internal_free_return:
-      free_workarea_compile (preg);
-      re_string_destruct (&regexp);
-      lock_fini (dfa->lock);
-      free_dfa_content (dfa);
-      preg->buffer = NULL;
-      preg->allocated = 0;
-      return err;
-    }
-
-  /* Parse the regular expression, and build a structure tree.  */
-  preg->re_nsub = 0;
-  dfa->str_tree = parse (&regexp, preg, syntax, &err);
-  if (BE (dfa->str_tree == NULL, 0))
-    goto re_compile_internal_free_return;
-
-  /* Analyze the tree and create the nfa.  */
-  err = analyze (preg);
-  if (BE (err != REG_NOERROR, 0))
-    goto re_compile_internal_free_return;
-
-#ifdef RE_ENABLE_I18N
-  /* If possible, do searching in single byte encoding to speed things up.  */
-  if (dfa->is_utf8 && !(syntax & RE_ICASE) && preg->translate == NULL)
-    optimize_utf8 (dfa);
-#endif
-
-  /* Then create the initial state of the dfa.  */
-  err = create_initial_state (dfa);
-
-  /* Release work areas.  */
-  free_workarea_compile (preg);
-  re_string_destruct (&regexp);
-
-  if (BE (err != REG_NOERROR, 0))
-    {
-      lock_fini (dfa->lock);
-      free_dfa_content (dfa);
-      preg->buffer = NULL;
-      preg->allocated = 0;
-    }
-
-  return err;
-}
-
-/* Initialize DFA.  We use the length of the regular expression PAT_LEN
-   as the initial length of some arrays.  */
-
-static reg_errcode_t
-init_dfa (re_dfa_t *dfa, size_t pat_len)
-{
-  __re_size_t table_size;
-#ifndef _LIBC
-  const char *codeset_name;
-#endif
-#ifdef RE_ENABLE_I18N
-  size_t max_i18n_object_size = MAX (sizeof (wchar_t), sizeof (wctype_t));
-#else
-  size_t max_i18n_object_size = 0;
-#endif
-  size_t max_object_size =
-    MAX (sizeof (struct re_state_table_entry),
-	 MAX (sizeof (re_token_t),
-	      MAX (sizeof (re_node_set),
-		   MAX (sizeof (regmatch_t),
-			max_i18n_object_size))));
-
-  memset (dfa, '\0', sizeof (re_dfa_t));
-
-  /* Force allocation of str_tree_storage the first time.  */
-  dfa->str_tree_storage_idx = BIN_TREE_STORAGE_SIZE;
-
-  /* Avoid overflows.  The extra "/ 2" is for the table_size doubling
-     calculation below, and for similar doubling calculations
-     elsewhere.  And it's <= rather than <, because some of the
-     doubling calculations add 1 afterwards.  */
-  if (BE (MIN (IDX_MAX, SIZE_MAX / max_object_size) / 2 <= pat_len, 0))
-    return REG_ESPACE;
-
-  dfa->nodes_alloc = pat_len + 1;
-  dfa->nodes = re_malloc (re_token_t, dfa->nodes_alloc);
-
-  /*  table_size = 2 ^ ceil(log pat_len) */
-  for (table_size = 1; ; table_size <<= 1)
-    if (table_size > pat_len)
-      break;
-
-  dfa->state_table = calloc (sizeof (struct re_state_table_entry), table_size);
-  dfa->state_hash_mask = table_size - 1;
-
-  dfa->mb_cur_max = MB_CUR_MAX;
-#ifdef _LIBC
-  if (dfa->mb_cur_max == 6
-      && strcmp (_NL_CURRENT (LC_CTYPE, _NL_CTYPE_CODESET_NAME), "UTF-8") == 0)
-    dfa->is_utf8 = 1;
-  dfa->map_notascii = (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_TO_NONASCII)
-		       != 0);
-#else
-  codeset_name = nl_langinfo (CODESET);
-  if ((codeset_name[0] == 'U' || codeset_name[0] == 'u')
-      && (codeset_name[1] == 'T' || codeset_name[1] == 't')
-      && (codeset_name[2] == 'F' || codeset_name[2] == 'f')
-      && strcmp (codeset_name + 3 + (codeset_name[3] == '-'), "8") == 0)
-    dfa->is_utf8 = 1;
-
-  /* We check exhaustively in the loop below if this charset is a
-     superset of ASCII.  */
-  dfa->map_notascii = 0;
-#endif
-
-#ifdef RE_ENABLE_I18N
-  if (dfa->mb_cur_max > 1)
-    {
-      if (dfa->is_utf8)
-	dfa->sb_char = (re_bitset_ptr_t) utf8_sb_map;
-      else
-	{
-	  int i, j, ch;
-
-	  dfa->sb_char = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
-	  if (BE (dfa->sb_char == NULL, 0))
-	    return REG_ESPACE;
-
-	  /* Set the bits corresponding to single byte chars.  */
-	  for (i = 0, ch = 0; i < BITSET_WORDS; ++i)
-	    for (j = 0; j < BITSET_WORD_BITS; ++j, ++ch)
-	      {
-		wint_t wch = __btowc (ch);
-		if (wch != WEOF)
-		  dfa->sb_char[i] |= (bitset_word_t) 1 << j;
-# ifndef _LIBC
-		if (isascii (ch) && wch != ch)
-		  dfa->map_notascii = 1;
-# endif
-	      }
-	}
-    }
-#endif
-
-  if (BE (dfa->nodes == NULL || dfa->state_table == NULL, 0))
-    return REG_ESPACE;
-  return REG_NOERROR;
-}
-
-/* Initialize WORD_CHAR table, which indicate which character is
-   "word".  In this case "word" means that it is the word construction
-   character used by some operators like "\<", "\>", etc.  */
-
-static void
-internal_function
-init_word_char (re_dfa_t *dfa)
-{
-  int i = 0;
-  int j;
-  int ch = 0;
-  dfa->word_ops_used = 1;
-  if (BE (dfa->map_notascii == 0, 1))
-    {
-      bitset_word_t bits0 = 0x00000000;
-      bitset_word_t bits1 = 0x03ff0000;
-      bitset_word_t bits2 = 0x87fffffe;
-      bitset_word_t bits3 = 0x07fffffe;
-      if (BITSET_WORD_BITS == 64)
-	{
-	  dfa->word_char[0] = bits1 << 31 << 1 | bits0;
-	  dfa->word_char[1] = bits3 << 31 << 1 | bits2;
-	  i = 2;
-	}
-      else if (BITSET_WORD_BITS == 32)
-	{
-	  dfa->word_char[0] = bits0;
-	  dfa->word_char[1] = bits1;
-	  dfa->word_char[2] = bits2;
-	  dfa->word_char[3] = bits3;
-	  i = 4;
-	}
-      else
-        goto general_case;
-      ch = 128;
-
-      if (BE (dfa->is_utf8, 1))
-	{
-	  memset (&dfa->word_char[i], '\0', (SBC_MAX - ch) / 8);
-	  return;
-	}
-    }
-
- general_case:
-  for (; i < BITSET_WORDS; ++i)
-    for (j = 0; j < BITSET_WORD_BITS; ++j, ++ch)
-      if (isalnum (ch) || ch == '_')
-	dfa->word_char[i] |= (bitset_word_t) 1 << j;
-}
-
-/* Free the work area which are only used while compiling.  */
-
-static void
-free_workarea_compile (regex_t *preg)
-{
-  re_dfa_t *dfa = preg->buffer;
-  bin_tree_storage_t *storage, *next;
-  for (storage = dfa->str_tree_storage; storage; storage = next)
-    {
-      next = storage->next;
-      re_free (storage);
-    }
-  dfa->str_tree_storage = NULL;
-  dfa->str_tree_storage_idx = BIN_TREE_STORAGE_SIZE;
-  dfa->str_tree = NULL;
-  re_free (dfa->org_indices);
-  dfa->org_indices = NULL;
-}
-
-/* Create initial states for all contexts.  */
-
-static reg_errcode_t
-create_initial_state (re_dfa_t *dfa)
-{
-  Idx first, i;
-  reg_errcode_t err;
-  re_node_set init_nodes;
-
-  /* Initial states have the epsilon closure of the node which is
-     the first node of the regular expression.  */
-  first = dfa->str_tree->first->node_idx;
-  dfa->init_node = first;
-  err = re_node_set_init_copy (&init_nodes, dfa->eclosures + first);
-  if (BE (err != REG_NOERROR, 0))
-    return err;
-
-  /* The back-references which are in initial states can epsilon transit,
-     since in this case all of the subexpressions can be null.
-     Then we add epsilon closures of the nodes which are the next nodes of
-     the back-references.  */
-  if (dfa->nbackref > 0)
-    for (i = 0; i < init_nodes.nelem; ++i)
-      {
-	Idx node_idx = init_nodes.elems[i];
-	re_token_type_t type = dfa->nodes[node_idx].type;
-
-	Idx clexp_idx;
-	if (type != OP_BACK_REF)
-	  continue;
-	for (clexp_idx = 0; clexp_idx < init_nodes.nelem; ++clexp_idx)
-	  {
-	    re_token_t *clexp_node;
-	    clexp_node = dfa->nodes + init_nodes.elems[clexp_idx];
-	    if (clexp_node->type == OP_CLOSE_SUBEXP
-		&& clexp_node->opr.idx == dfa->nodes[node_idx].opr.idx)
-	      break;
-	  }
-	if (clexp_idx == init_nodes.nelem)
-	  continue;
-
-	if (type == OP_BACK_REF)
-	  {
-	    Idx dest_idx = dfa->edests[node_idx].elems[0];
-	    if (!re_node_set_contains (&init_nodes, dest_idx))
-	      {
-		reg_errcode_t merge_err
-                  = re_node_set_merge (&init_nodes, dfa->eclosures + dest_idx);
-		if (merge_err != REG_NOERROR)
-		  return merge_err;
-		i = 0;
-	      }
-	  }
-      }
-
-  /* It must be the first time to invoke acquire_state.  */
-  dfa->init_state = re_acquire_state_context (&err, dfa, &init_nodes, 0);
-  /* We don't check ERR here, since the initial state must not be NULL.  */
-  if (BE (dfa->init_state == NULL, 0))
-    return err;
-  if (dfa->init_state->has_constraint)
-    {
-      dfa->init_state_word = re_acquire_state_context (&err, dfa, &init_nodes,
-						       CONTEXT_WORD);
-      dfa->init_state_nl = re_acquire_state_context (&err, dfa, &init_nodes,
-						     CONTEXT_NEWLINE);
-      dfa->init_state_begbuf = re_acquire_state_context (&err, dfa,
-							 &init_nodes,
-							 CONTEXT_NEWLINE
-							 | CONTEXT_BEGBUF);
-      if (BE (dfa->init_state_word == NULL || dfa->init_state_nl == NULL
-	      || dfa->init_state_begbuf == NULL, 0))
-	return err;
-    }
-  else
-    dfa->init_state_word = dfa->init_state_nl
-      = dfa->init_state_begbuf = dfa->init_state;
-
-  re_node_set_free (&init_nodes);
-  return REG_NOERROR;
-}
-
-#ifdef RE_ENABLE_I18N
-/* If it is possible to do searching in single byte encoding instead of UTF-8
-   to speed things up, set dfa->mb_cur_max to 1, clear is_utf8 and change
-   DFA nodes where needed.  */
-
-static void
-optimize_utf8 (re_dfa_t *dfa)
-{
-  Idx node;
-  int i;
-  bool mb_chars = false;
-  bool has_period = false;
-
-  for (node = 0; node < dfa->nodes_len; ++node)
-    switch (dfa->nodes[node].type)
-      {
-      case CHARACTER:
-	if (dfa->nodes[node].opr.c >= ASCII_CHARS)
-	  mb_chars = true;
-	break;
-      case ANCHOR:
-	switch (dfa->nodes[node].opr.ctx_type)
-	  {
-	  case LINE_FIRST:
-	  case LINE_LAST:
-	  case BUF_FIRST:
-	  case BUF_LAST:
-	    break;
-	  default:
-	    /* Word anchors etc. cannot be handled.  It's okay to test
-	       opr.ctx_type since constraints (for all DFA nodes) are
-	       created by ORing one or more opr.ctx_type values.  */
-	    return;
-	  }
-	break;
-      case OP_PERIOD:
-	has_period = true;
-	break;
-      case OP_BACK_REF:
-      case OP_ALT:
-      case END_OF_RE:
-      case OP_DUP_ASTERISK:
-      case OP_OPEN_SUBEXP:
-      case OP_CLOSE_SUBEXP:
-	break;
-      case COMPLEX_BRACKET:
-	return;
-      case SIMPLE_BRACKET:
-	/* Just double check.  */
-	{
-	  int rshift = (ASCII_CHARS % BITSET_WORD_BITS == 0
-			? 0
-			: BITSET_WORD_BITS - ASCII_CHARS % BITSET_WORD_BITS);
-	  for (i = ASCII_CHARS / BITSET_WORD_BITS; i < BITSET_WORDS; ++i)
-	    {
-	      if (dfa->nodes[node].opr.sbcset[i] >> rshift != 0)
-		return;
-	      rshift = 0;
-	    }
-	}
-	break;
-      default:
-	abort ();
-      }
-
-  if (mb_chars || has_period)
-    for (node = 0; node < dfa->nodes_len; ++node)
-      {
-	if (dfa->nodes[node].type == CHARACTER
-	    && dfa->nodes[node].opr.c >= ASCII_CHARS)
-	  dfa->nodes[node].mb_partial = 0;
-	else if (dfa->nodes[node].type == OP_PERIOD)
-	  dfa->nodes[node].type = OP_UTF8_PERIOD;
-      }
-
-  /* The search can be in single byte locale.  */
-  dfa->mb_cur_max = 1;
-  dfa->is_utf8 = 0;
-  dfa->has_mb_node = dfa->nbackref > 0 || has_period;
-}
-#endif
-
-/* Analyze the structure tree, and calculate "first", "next", "edest",
-   "eclosure", and "inveclosure".  */
-
-static reg_errcode_t
-analyze (regex_t *preg)
-{
-  re_dfa_t *dfa = preg->buffer;
-  reg_errcode_t ret;
-
-  /* Allocate arrays.  */
-  dfa->nexts = re_malloc (Idx, dfa->nodes_alloc);
-  dfa->org_indices = re_malloc (Idx, dfa->nodes_alloc);
-  dfa->edests = re_malloc (re_node_set, dfa->nodes_alloc);
-  dfa->eclosures = re_malloc (re_node_set, dfa->nodes_alloc);
-  if (BE (dfa->nexts == NULL || dfa->org_indices == NULL || dfa->edests == NULL
-	  || dfa->eclosures == NULL, 0))
-    return REG_ESPACE;
-
-  dfa->subexp_map = re_malloc (Idx, preg->re_nsub);
-  if (dfa->subexp_map != NULL)
-    {
-      Idx i;
-      for (i = 0; i < preg->re_nsub; i++)
-	dfa->subexp_map[i] = i;
-      preorder (dfa->str_tree, optimize_subexps, dfa);
-      for (i = 0; i < preg->re_nsub; i++)
-	if (dfa->subexp_map[i] != i)
-	  break;
-      if (i == preg->re_nsub)
-	{
-	  free (dfa->subexp_map);
-	  dfa->subexp_map = NULL;
-	}
-    }
-
-  ret = postorder (dfa->str_tree, lower_subexps, preg);
-  if (BE (ret != REG_NOERROR, 0))
-    return ret;
-  ret = postorder (dfa->str_tree, calc_first, dfa);
-  if (BE (ret != REG_NOERROR, 0))
-    return ret;
-  preorder (dfa->str_tree, calc_next, dfa);
-  ret = preorder (dfa->str_tree, link_nfa_nodes, dfa);
-  if (BE (ret != REG_NOERROR, 0))
-    return ret;
-  ret = calc_eclosure (dfa);
-  if (BE (ret != REG_NOERROR, 0))
-    return ret;
-
-  /* We only need this during the prune_impossible_nodes pass in regexec.c;
-     skip it if p_i_n will not run, as calc_inveclosure can be quadratic.  */
-  if ((!preg->no_sub && preg->re_nsub > 0 && dfa->has_plural_match)
-      || dfa->nbackref)
-    {
-      dfa->inveclosures = re_malloc (re_node_set, dfa->nodes_len);
-      if (BE (dfa->inveclosures == NULL, 0))
-	return REG_ESPACE;
-      ret = calc_inveclosure (dfa);
-    }
-
-  return ret;
-}
-
-/* Our parse trees are very unbalanced, so we cannot use a stack to
-   implement parse tree visits.  Instead, we use parent pointers and
-   some hairy code in these two functions.  */
-static reg_errcode_t
-postorder (bin_tree_t *root, reg_errcode_t (fn (void *, bin_tree_t *)),
-	   void *extra)
-{
-  bin_tree_t *node, *prev;
-
-  for (node = root; ; )
-    {
-      /* Descend down the tree, preferably to the left (or to the right
-	 if that's the only child).  */
-      while (node->left || node->right)
-	if (node->left)
-	  node = node->left;
-	else
-	  node = node->right;
-
-      do
-	{
-	  reg_errcode_t err = fn (extra, node);
-	  if (BE (err != REG_NOERROR, 0))
-	    return err;
-	  if (node->parent == NULL)
-	    return REG_NOERROR;
-	  prev = node;
-	  node = node->parent;
-	}
-      /* Go up while we have a node that is reached from the right.  */
-      while (node->right == prev || node->right == NULL);
-      node = node->right;
-    }
-}
-
-static reg_errcode_t
-preorder (bin_tree_t *root, reg_errcode_t (fn (void *, bin_tree_t *)),
-	  void *extra)
-{
-  bin_tree_t *node;
-
-  for (node = root; ; )
-    {
-      reg_errcode_t err = fn (extra, node);
-      if (BE (err != REG_NOERROR, 0))
-	return err;
-
-      /* Go to the left node, or up and to the right.  */
-      if (node->left)
-	node = node->left;
-      else
-	{
-	  bin_tree_t *prev = NULL;
-	  while (node->right == prev || node->right == NULL)
-	    {
-	      prev = node;
-	      node = node->parent;
-	      if (!node)
-		return REG_NOERROR;
-	    }
-	  node = node->right;
-	}
-    }
-}
-
-/* Optimization pass: if a SUBEXP is entirely contained, strip it and tell
-   re_search_internal to map the inner one's opr.idx to this one's.  Adjust
-   backreferences as well.  Requires a preorder visit.  */
-static reg_errcode_t
-optimize_subexps (void *extra, bin_tree_t *node)
-{
-  re_dfa_t *dfa = (re_dfa_t *) extra;
-
-  if (node->token.type == OP_BACK_REF && dfa->subexp_map)
-    {
-      int idx = node->token.opr.idx;
-      node->token.opr.idx = dfa->subexp_map[idx];
-      dfa->used_bkref_map |= 1 << node->token.opr.idx;
-    }
-
-  else if (node->token.type == SUBEXP
-	   && node->left && node->left->token.type == SUBEXP)
-    {
-      Idx other_idx = node->left->token.opr.idx;
-
-      node->left = node->left->left;
-      if (node->left)
-	node->left->parent = node;
-
-      dfa->subexp_map[other_idx] = dfa->subexp_map[node->token.opr.idx];
-      if (other_idx < BITSET_WORD_BITS)
-	dfa->used_bkref_map &= ~((bitset_word_t) 1 << other_idx);
-    }
-
-  return REG_NOERROR;
-}
-
-/* Lowering pass: Turn each SUBEXP node into the appropriate concatenation
-   of OP_OPEN_SUBEXP, the body of the SUBEXP (if any) and OP_CLOSE_SUBEXP.  */
-static reg_errcode_t
-lower_subexps (void *extra, bin_tree_t *node)
-{
-  regex_t *preg = (regex_t *) extra;
-  reg_errcode_t err = REG_NOERROR;
-
-  if (node->left && node->left->token.type == SUBEXP)
-    {
-      node->left = lower_subexp (&err, preg, node->left);
-      if (node->left)
-	node->left->parent = node;
-    }
-  if (node->right && node->right->token.type == SUBEXP)
-    {
-      node->right = lower_subexp (&err, preg, node->right);
-      if (node->right)
-	node->right->parent = node;
-    }
-
-  return err;
-}
-
-static bin_tree_t *
-lower_subexp (reg_errcode_t *err, regex_t *preg, bin_tree_t *node)
-{
-  re_dfa_t *dfa = preg->buffer;
-  bin_tree_t *body = node->left;
-  bin_tree_t *op, *cls, *tree1, *tree;
-
-  if (preg->no_sub
-      /* We do not optimize empty subexpressions, because otherwise we may
-	 have bad CONCAT nodes with NULL children.  This is obviously not
-	 very common, so we do not lose much.  An example that triggers
-	 this case is the sed "script" /\(\)/x.  */
-      && node->left != NULL
-      && (node->token.opr.idx >= BITSET_WORD_BITS
-	  || !(dfa->used_bkref_map
-	       & ((bitset_word_t) 1 << node->token.opr.idx))))
-    return node->left;
-
-  /* Convert the SUBEXP node to the concatenation of an
-     OP_OPEN_SUBEXP, the contents, and an OP_CLOSE_SUBEXP.  */
-  op = create_tree (dfa, NULL, NULL, OP_OPEN_SUBEXP);
-  cls = create_tree (dfa, NULL, NULL, OP_CLOSE_SUBEXP);
-  tree1 = body ? create_tree (dfa, body, cls, CONCAT) : cls;
-  tree = create_tree (dfa, op, tree1, CONCAT);
-  if (BE (tree == NULL || tree1 == NULL || op == NULL || cls == NULL, 0))
-    {
-      *err = REG_ESPACE;
-      return NULL;
-    }
-
-  op->token.opr.idx = cls->token.opr.idx = node->token.opr.idx;
-  op->token.opt_subexp = cls->token.opt_subexp = node->token.opt_subexp;
-  return tree;
-}
-
-/* Pass 1 in building the NFA: compute FIRST and create unlinked automaton
-   nodes.  Requires a postorder visit.  */
-static reg_errcode_t
-calc_first (void *extra, bin_tree_t *node)
-{
-  re_dfa_t *dfa = (re_dfa_t *) extra;
-  if (node->token.type == CONCAT)
-    {
-      node->first = node->left->first;
-      node->node_idx = node->left->node_idx;
-    }
-  else
-    {
-      node->first = node;
-      node->node_idx = re_dfa_add_node (dfa, node->token);
-      if (BE (node->node_idx == REG_MISSING, 0))
-	return REG_ESPACE;
-      if (node->token.type == ANCHOR)
-	dfa->nodes[node->node_idx].constraint = node->token.opr.ctx_type;
-    }
-  return REG_NOERROR;
-}
-
-/* Pass 2: compute NEXT on the tree.  Preorder visit.  */
-static reg_errcode_t
-calc_next (void *extra, bin_tree_t *node)
-{
-  switch (node->token.type)
-    {
-    case OP_DUP_ASTERISK:
-      node->left->next = node;
-      break;
-    case CONCAT:
-      node->left->next = node->right->first;
-      node->right->next = node->next;
-      break;
-    default:
-      if (node->left)
-	node->left->next = node->next;
-      if (node->right)
-	node->right->next = node->next;
-      break;
-    }
-  return REG_NOERROR;
-}
-
-/* Pass 3: link all DFA nodes to their NEXT node (any order will do).  */
-static reg_errcode_t
-link_nfa_nodes (void *extra, bin_tree_t *node)
-{
-  re_dfa_t *dfa = (re_dfa_t *) extra;
-  Idx idx = node->node_idx;
-  reg_errcode_t err = REG_NOERROR;
-
-  switch (node->token.type)
-    {
-    case CONCAT:
-      break;
-
-    case END_OF_RE:
-      assert (node->next == NULL);
-      break;
-
-    case OP_DUP_ASTERISK:
-    case OP_ALT:
-      {
-	Idx left, right;
-	dfa->has_plural_match = 1;
-	if (node->left != NULL)
-	  left = node->left->first->node_idx;
-	else
-	  left = node->next->node_idx;
-	if (node->right != NULL)
-	  right = node->right->first->node_idx;
-	else
-	  right = node->next->node_idx;
-	assert (REG_VALID_INDEX (left));
-	assert (REG_VALID_INDEX (right));
-	err = re_node_set_init_2 (dfa->edests + idx, left, right);
-      }
-      break;
-
-    case ANCHOR:
-    case OP_OPEN_SUBEXP:
-    case OP_CLOSE_SUBEXP:
-      err = re_node_set_init_1 (dfa->edests + idx, node->next->node_idx);
-      break;
-
-    case OP_BACK_REF:
-      dfa->nexts[idx] = node->next->node_idx;
-      if (node->token.type == OP_BACK_REF)
-	err = re_node_set_init_1 (dfa->edests + idx, dfa->nexts[idx]);
-      break;
-
-    default:
-      assert (!IS_EPSILON_NODE (node->token.type));
-      dfa->nexts[idx] = node->next->node_idx;
-      break;
-    }
-
-  return err;
-}
-
-/* Duplicate the epsilon closure of the node ROOT_NODE.
-   Note that duplicated nodes have constraint INIT_CONSTRAINT in addition
-   to their own constraint.  */
-
-static reg_errcode_t
-internal_function
-duplicate_node_closure (re_dfa_t *dfa, Idx top_org_node, Idx top_clone_node,
-			Idx root_node, unsigned int init_constraint)
-{
-  Idx org_node, clone_node;
-  bool ok;
-  unsigned int constraint = init_constraint;
-  for (org_node = top_org_node, clone_node = top_clone_node;;)
-    {
-      Idx org_dest, clone_dest;
-      if (dfa->nodes[org_node].type == OP_BACK_REF)
-	{
-	  /* If the back reference epsilon-transit, its destination must
-	     also have the constraint.  Then duplicate the epsilon closure
-	     of the destination of the back reference, and store it in
-	     edests of the back reference.  */
-	  org_dest = dfa->nexts[org_node];
-	  re_node_set_empty (dfa->edests + clone_node);
-	  clone_dest = duplicate_node (dfa, org_dest, constraint);
-	  if (BE (clone_dest == REG_MISSING, 0))
-	    return REG_ESPACE;
-	  dfa->nexts[clone_node] = dfa->nexts[org_node];
-	  ok = re_node_set_insert (dfa->edests + clone_node, clone_dest);
-	  if (BE (! ok, 0))
-	    return REG_ESPACE;
-	}
-      else if (dfa->edests[org_node].nelem == 0)
-	{
-	  /* In case of the node can't epsilon-transit, don't duplicate the
-	     destination and store the original destination as the
-	     destination of the node.  */
-	  dfa->nexts[clone_node] = dfa->nexts[org_node];
-	  break;
-	}
-      else if (dfa->edests[org_node].nelem == 1)
-	{
-	  /* In case of the node can epsilon-transit, and it has only one
-	     destination.  */
-	  org_dest = dfa->edests[org_node].elems[0];
-	  re_node_set_empty (dfa->edests + clone_node);
-	  /* If the node is root_node itself, it means the epsilon closure
-	     has a loop.  Then tie it to the destination of the root_node.  */
-	  if (org_node == root_node && clone_node != org_node)
-	    {
-	      ok = re_node_set_insert (dfa->edests + clone_node, org_dest);
-	      if (BE (! ok, 0))
-	        return REG_ESPACE;
-	      break;
-	    }
-	  /* In case the node has another constraint, append it.  */
-	  constraint |= dfa->nodes[org_node].constraint;
-	  clone_dest = duplicate_node (dfa, org_dest, constraint);
-	  if (BE (clone_dest == REG_MISSING, 0))
-	    return REG_ESPACE;
-	  ok = re_node_set_insert (dfa->edests + clone_node, clone_dest);
-	  if (BE (! ok, 0))
-	    return REG_ESPACE;
-	}
-      else /* dfa->edests[org_node].nelem == 2 */
-	{
-	  /* In case of the node can epsilon-transit, and it has two
-	     destinations. In the bin_tree_t and DFA, that's '|' and '*'.   */
-	  org_dest = dfa->edests[org_node].elems[0];
-	  re_node_set_empty (dfa->edests + clone_node);
-	  /* Search for a duplicated node which satisfies the constraint.  */
-	  clone_dest = search_duplicated_node (dfa, org_dest, constraint);
-	  if (clone_dest == REG_MISSING)
-	    {
-	      /* There is no such duplicated node, create a new one.  */
-	      reg_errcode_t err;
-	      clone_dest = duplicate_node (dfa, org_dest, constraint);
-	      if (BE (clone_dest == REG_MISSING, 0))
-		return REG_ESPACE;
-	      ok = re_node_set_insert (dfa->edests + clone_node, clone_dest);
-	      if (BE (! ok, 0))
-		return REG_ESPACE;
-	      err = duplicate_node_closure (dfa, org_dest, clone_dest,
-					    root_node, constraint);
-	      if (BE (err != REG_NOERROR, 0))
-		return err;
-	    }
-	  else
-	    {
-	      /* There is a duplicated node which satisfies the constraint,
-		 use it to avoid infinite loop.  */
-	      ok = re_node_set_insert (dfa->edests + clone_node, clone_dest);
-	      if (BE (! ok, 0))
-		return REG_ESPACE;
-	    }
-
-	  org_dest = dfa->edests[org_node].elems[1];
-	  clone_dest = duplicate_node (dfa, org_dest, constraint);
-	  if (BE (clone_dest == REG_MISSING, 0))
-	    return REG_ESPACE;
-	  ok = re_node_set_insert (dfa->edests + clone_node, clone_dest);
-	  if (BE (! ok, 0))
-	    return REG_ESPACE;
-	}
-      org_node = org_dest;
-      clone_node = clone_dest;
-    }
-  return REG_NOERROR;
-}
-
-/* Search for a node which is duplicated from the node ORG_NODE, and
-   satisfies the constraint CONSTRAINT.  */
-
-static Idx
-search_duplicated_node (const re_dfa_t *dfa, Idx org_node,
-			unsigned int constraint)
-{
-  Idx idx;
-  for (idx = dfa->nodes_len - 1; dfa->nodes[idx].duplicated && idx > 0; --idx)
-    {
-      if (org_node == dfa->org_indices[idx]
-	  && constraint == dfa->nodes[idx].constraint)
-	return idx; /* Found.  */
-    }
-  return REG_MISSING; /* Not found.  */
-}
-
-/* Duplicate the node whose index is ORG_IDX and set the constraint CONSTRAINT.
-   Return the index of the new node, or REG_MISSING if insufficient storage is
-   available.  */
-
-static Idx
-duplicate_node (re_dfa_t *dfa, Idx org_idx, unsigned int constraint)
-{
-  Idx dup_idx = re_dfa_add_node (dfa, dfa->nodes[org_idx]);
-  if (BE (dup_idx != REG_MISSING, 1))
-    {
-      dfa->nodes[dup_idx].constraint = constraint;
-      dfa->nodes[dup_idx].constraint |= dfa->nodes[org_idx].constraint;
-      dfa->nodes[dup_idx].duplicated = 1;
-
-      /* Store the index of the original node.  */
-      dfa->org_indices[dup_idx] = org_idx;
-    }
-  return dup_idx;
-}
-
-static reg_errcode_t
-calc_inveclosure (re_dfa_t *dfa)
-{
-  Idx src, idx;
-  bool ok;
-  for (idx = 0; idx < dfa->nodes_len; ++idx)
-    re_node_set_init_empty (dfa->inveclosures + idx);
-
-  for (src = 0; src < dfa->nodes_len; ++src)
-    {
-      Idx *elems = dfa->eclosures[src].elems;
-      for (idx = 0; idx < dfa->eclosures[src].nelem; ++idx)
-	{
-	  ok = re_node_set_insert_last (dfa->inveclosures + elems[idx], src);
-	  if (BE (! ok, 0))
-	    return REG_ESPACE;
-	}
-    }
-
-  return REG_NOERROR;
-}
-
-/* Calculate "eclosure" for all the node in DFA.  */
-
-static reg_errcode_t
-calc_eclosure (re_dfa_t *dfa)
-{
-  Idx node_idx;
-  bool incomplete;
-#ifdef DEBUG
-  assert (dfa->nodes_len > 0);
-#endif
-  incomplete = false;
-  /* For each nodes, calculate epsilon closure.  */
-  for (node_idx = 0; ; ++node_idx)
-    {
-      reg_errcode_t err;
-      re_node_set eclosure_elem;
-      if (node_idx == dfa->nodes_len)
-	{
-	  if (!incomplete)
-	    break;
-	  incomplete = false;
-	  node_idx = 0;
-	}
-
-#ifdef DEBUG
-      assert (dfa->eclosures[node_idx].nelem != REG_MISSING);
-#endif
-
-      /* If we have already calculated, skip it.  */
-      if (dfa->eclosures[node_idx].nelem != 0)
-	continue;
-      /* Calculate epsilon closure of 'node_idx'.  */
-      err = calc_eclosure_iter (&eclosure_elem, dfa, node_idx, true);
-      if (BE (err != REG_NOERROR, 0))
-	return err;
-
-      if (dfa->eclosures[node_idx].nelem == 0)
-	{
-	  incomplete = true;
-	  re_node_set_free (&eclosure_elem);
-	}
-    }
-  return REG_NOERROR;
-}
-
-/* Calculate epsilon closure of NODE.  */
-
-static reg_errcode_t
-calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root)
-{
-  reg_errcode_t err;
-  Idx i;
-  re_node_set eclosure;
-  bool ok;
-  bool incomplete = false;
-  err = re_node_set_alloc (&eclosure, dfa->edests[node].nelem + 1);
-  if (BE (err != REG_NOERROR, 0))
-    return err;
-
-  /* This indicates that we are calculating this node now.
-     We reference this value to avoid infinite loop.  */
-  dfa->eclosures[node].nelem = REG_MISSING;
-
-  /* If the current node has constraints, duplicate all nodes
-     since they must inherit the constraints.  */
-  if (dfa->nodes[node].constraint
-      && dfa->edests[node].nelem
-      && !dfa->nodes[dfa->edests[node].elems[0]].duplicated)
-    {
-      err = duplicate_node_closure (dfa, node, node, node,
-				    dfa->nodes[node].constraint);
-      if (BE (err != REG_NOERROR, 0))
-	return err;
-    }
-
-  /* Expand each epsilon destination nodes.  */
-  if (IS_EPSILON_NODE(dfa->nodes[node].type))
-    for (i = 0; i < dfa->edests[node].nelem; ++i)
-      {
-	re_node_set eclosure_elem;
-	Idx edest = dfa->edests[node].elems[i];
-	/* If calculating the epsilon closure of 'edest' is in progress,
-	   return intermediate result.  */
-	if (dfa->eclosures[edest].nelem == REG_MISSING)
-	  {
-	    incomplete = true;
-	    continue;
-	  }
-	/* If we haven't calculated the epsilon closure of 'edest' yet,
-	   calculate now. Otherwise use calculated epsilon closure.  */
-	if (dfa->eclosures[edest].nelem == 0)
-	  {
-	    err = calc_eclosure_iter (&eclosure_elem, dfa, edest, false);
-	    if (BE (err != REG_NOERROR, 0))
-	      return err;
-	  }
-	else
-	  eclosure_elem = dfa->eclosures[edest];
-	/* Merge the epsilon closure of 'edest'.  */
-	err = re_node_set_merge (&eclosure, &eclosure_elem);
-	if (BE (err != REG_NOERROR, 0))
-	  return err;
-	/* If the epsilon closure of 'edest' is incomplete,
-	   the epsilon closure of this node is also incomplete.  */
-	if (dfa->eclosures[edest].nelem == 0)
-	  {
-	    incomplete = true;
-	    re_node_set_free (&eclosure_elem);
-	  }
-      }
-
-  /* An epsilon closure includes itself.  */
-  ok = re_node_set_insert (&eclosure, node);
-  if (BE (! ok, 0))
-    return REG_ESPACE;
-  if (incomplete && !root)
-    dfa->eclosures[node].nelem = 0;
-  else
-    dfa->eclosures[node] = eclosure;
-  *new_set = eclosure;
-  return REG_NOERROR;
-}
-
-/* Functions for token which are used in the parser.  */
-
-/* Fetch a token from INPUT.
-   We must not use this function inside bracket expressions.  */
-
-static void
-internal_function
-fetch_token (re_token_t *result, re_string_t *input, reg_syntax_t syntax)
-{
-  re_string_skip_bytes (input, peek_token (result, input, syntax));
-}
-
-/* Peek a token from INPUT, and return the length of the token.
-   We must not use this function inside bracket expressions.  */
-
-static int
-internal_function
-peek_token (re_token_t *token, re_string_t *input, reg_syntax_t syntax)
-{
-  unsigned char c;
-
-  if (re_string_eoi (input))
-    {
-      token->type = END_OF_RE;
-      return 0;
-    }
-
-  c = re_string_peek_byte (input, 0);
-  token->opr.c = c;
-
-  token->word_char = 0;
-#ifdef RE_ENABLE_I18N
-  token->mb_partial = 0;
-  if (input->mb_cur_max > 1 &&
-      !re_string_first_byte (input, re_string_cur_idx (input)))
-    {
-      token->type = CHARACTER;
-      token->mb_partial = 1;
-      return 1;
-    }
-#endif
-  if (c == '\\')
-    {
-      unsigned char c2;
-      if (re_string_cur_idx (input) + 1 >= re_string_length (input))
-	{
-	  token->type = BACK_SLASH;
-	  return 1;
-	}
-
-      c2 = re_string_peek_byte_case (input, 1);
-      token->opr.c = c2;
-      token->type = CHARACTER;
-#ifdef RE_ENABLE_I18N
-      if (input->mb_cur_max > 1)
-	{
-	  wint_t wc = re_string_wchar_at (input,
-					  re_string_cur_idx (input) + 1);
-	  token->word_char = IS_WIDE_WORD_CHAR (wc) != 0;
-	}
-      else
-#endif
-	token->word_char = IS_WORD_CHAR (c2) != 0;
-
-      switch (c2)
-	{
-	case '|':
-	  if (!(syntax & RE_LIMITED_OPS) && !(syntax & RE_NO_BK_VBAR))
-	    token->type = OP_ALT;
-	  break;
-	case '1': case '2': case '3': case '4': case '5':
-	case '6': case '7': case '8': case '9':
-	  if (!(syntax & RE_NO_BK_REFS))
-	    {
-	      token->type = OP_BACK_REF;
-	      token->opr.idx = c2 - '1';
-	    }
-	  break;
-	case '<':
-	  if (!(syntax & RE_NO_GNU_OPS))
-	    {
-	      token->type = ANCHOR;
-	      token->opr.ctx_type = WORD_FIRST;
-	    }
-	  break;
-	case '>':
-	  if (!(syntax & RE_NO_GNU_OPS))
-	    {
-	      token->type = ANCHOR;
-	      token->opr.ctx_type = WORD_LAST;
-	    }
-	  break;
-	case 'b':
-	  if (!(syntax & RE_NO_GNU_OPS))
-	    {
-	      token->type = ANCHOR;
-	      token->opr.ctx_type = WORD_DELIM;
-	    }
-	  break;
-	case 'B':
-	  if (!(syntax & RE_NO_GNU_OPS))
-	    {
-	      token->type = ANCHOR;
-	      token->opr.ctx_type = NOT_WORD_DELIM;
-	    }
-	  break;
-	case 'w':
-	  if (!(syntax & RE_NO_GNU_OPS))
-	    token->type = OP_WORD;
-	  break;
-	case 'W':
-	  if (!(syntax & RE_NO_GNU_OPS))
-	    token->type = OP_NOTWORD;
-	  break;
-	case 's':
-	  if (!(syntax & RE_NO_GNU_OPS))
-	    token->type = OP_SPACE;
-	  break;
-	case 'S':
-	  if (!(syntax & RE_NO_GNU_OPS))
-	    token->type = OP_NOTSPACE;
-	  break;
-	case '`':
-	  if (!(syntax & RE_NO_GNU_OPS))
-	    {
-	      token->type = ANCHOR;
-	      token->opr.ctx_type = BUF_FIRST;
-	    }
-	  break;
-	case '\'':
-	  if (!(syntax & RE_NO_GNU_OPS))
-	    {
-	      token->type = ANCHOR;
-	      token->opr.ctx_type = BUF_LAST;
-	    }
-	  break;
-	case '(':
-	  if (!(syntax & RE_NO_BK_PARENS))
-	    token->type = OP_OPEN_SUBEXP;
-	  break;
-	case ')':
-	  if (!(syntax & RE_NO_BK_PARENS))
-	    token->type = OP_CLOSE_SUBEXP;
-	  break;
-	case '+':
-	  if (!(syntax & RE_LIMITED_OPS) && (syntax & RE_BK_PLUS_QM))
-	    token->type = OP_DUP_PLUS;
-	  break;
-	case '?':
-	  if (!(syntax & RE_LIMITED_OPS) && (syntax & RE_BK_PLUS_QM))
-	    token->type = OP_DUP_QUESTION;
-	  break;
-	case '{':
-	  if ((syntax & RE_INTERVALS) && (!(syntax & RE_NO_BK_BRACES)))
-	    token->type = OP_OPEN_DUP_NUM;
-	  break;
-	case '}':
-	  if ((syntax & RE_INTERVALS) && (!(syntax & RE_NO_BK_BRACES)))
-	    token->type = OP_CLOSE_DUP_NUM;
-	  break;
-	default:
-	  break;
-	}
-      return 2;
-    }
-
-  token->type = CHARACTER;
-#ifdef RE_ENABLE_I18N
-  if (input->mb_cur_max > 1)
-    {
-      wint_t wc = re_string_wchar_at (input, re_string_cur_idx (input));
-      token->word_char = IS_WIDE_WORD_CHAR (wc) != 0;
-    }
-  else
-#endif
-    token->word_char = IS_WORD_CHAR (token->opr.c);
-
-  switch (c)
-    {
-    case '\n':
-      if (syntax & RE_NEWLINE_ALT)
-	token->type = OP_ALT;
-      break;
-    case '|':
-      if (!(syntax & RE_LIMITED_OPS) && (syntax & RE_NO_BK_VBAR))
-	token->type = OP_ALT;
-      break;
-    case '*':
-      token->type = OP_DUP_ASTERISK;
-      break;
-    case '+':
-      if (!(syntax & RE_LIMITED_OPS) && !(syntax & RE_BK_PLUS_QM))
-	token->type = OP_DUP_PLUS;
-      break;
-    case '?':
-      if (!(syntax & RE_LIMITED_OPS) && !(syntax & RE_BK_PLUS_QM))
-	token->type = OP_DUP_QUESTION;
-      break;
-    case '{':
-      if ((syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES))
-	token->type = OP_OPEN_DUP_NUM;
-      break;
-    case '}':
-      if ((syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES))
-	token->type = OP_CLOSE_DUP_NUM;
-      break;
-    case '(':
-      if (syntax & RE_NO_BK_PARENS)
-	token->type = OP_OPEN_SUBEXP;
-      break;
-    case ')':
-      if (syntax & RE_NO_BK_PARENS)
-	token->type = OP_CLOSE_SUBEXP;
-      break;
-    case '[':
-      token->type = OP_OPEN_BRACKET;
-      break;
-    case '.':
-      token->type = OP_PERIOD;
-      break;
-    case '^':
-      if (!(syntax & (RE_CONTEXT_INDEP_ANCHORS | RE_CARET_ANCHORS_HERE)) &&
-	  re_string_cur_idx (input) != 0)
-	{
-	  char prev = re_string_peek_byte (input, -1);
-	  if (!(syntax & RE_NEWLINE_ALT) || prev != '\n')
-	    break;
-	}
-      token->type = ANCHOR;
-      token->opr.ctx_type = LINE_FIRST;
-      break;
-    case '$':
-      if (!(syntax & RE_CONTEXT_INDEP_ANCHORS) &&
-	  re_string_cur_idx (input) + 1 != re_string_length (input))
-	{
-	  re_token_t next;
-	  re_string_skip_bytes (input, 1);
-	  peek_token (&next, input, syntax);
-	  re_string_skip_bytes (input, -1);
-	  if (next.type != OP_ALT && next.type != OP_CLOSE_SUBEXP)
-	    break;
-	}
-      token->type = ANCHOR;
-      token->opr.ctx_type = LINE_LAST;
-      break;
-    default:
-      break;
-    }
-  return 1;
-}
-
-/* Peek a token from INPUT, and return the length of the token.
-   We must not use this function out of bracket expressions.  */
-
-static int
-internal_function
-peek_token_bracket (re_token_t *token, re_string_t *input, reg_syntax_t syntax)
-{
-  unsigned char c;
-  if (re_string_eoi (input))
-    {
-      token->type = END_OF_RE;
-      return 0;
-    }
-  c = re_string_peek_byte (input, 0);
-  token->opr.c = c;
-
-#ifdef RE_ENABLE_I18N
-  if (input->mb_cur_max > 1 &&
-      !re_string_first_byte (input, re_string_cur_idx (input)))
-    {
-      token->type = CHARACTER;
-      return 1;
-    }
-#endif /* RE_ENABLE_I18N */
-
-  if (c == '\\' && (syntax & RE_BACKSLASH_ESCAPE_IN_LISTS)
-      && re_string_cur_idx (input) + 1 < re_string_length (input))
-    {
-      /* In this case, '\' escape a character.  */
-      unsigned char c2;
-      re_string_skip_bytes (input, 1);
-      c2 = re_string_peek_byte (input, 0);
-      token->opr.c = c2;
-      token->type = CHARACTER;
-      return 1;
-    }
-  if (c == '[') /* '[' is a special char in a bracket exps.  */
-    {
-      unsigned char c2;
-      int token_len;
-      if (re_string_cur_idx (input) + 1 < re_string_length (input))
-	c2 = re_string_peek_byte (input, 1);
-      else
-	c2 = 0;
-      token->opr.c = c2;
-      token_len = 2;
-      switch (c2)
-	{
-	case '.':
-	  token->type = OP_OPEN_COLL_ELEM;
-	  break;
-	case '=':
-	  token->type = OP_OPEN_EQUIV_CLASS;
-	  break;
-	case ':':
-	  if (syntax & RE_CHAR_CLASSES)
-	    {
-	      token->type = OP_OPEN_CHAR_CLASS;
-	      break;
-	    }
-	  /* else fall through.  */
-	default:
-	  token->type = CHARACTER;
-	  token->opr.c = c;
-	  token_len = 1;
-	  break;
-	}
-      return token_len;
-    }
-  switch (c)
-    {
-    case '-':
-      token->type = OP_CHARSET_RANGE;
-      break;
-    case ']':
-      token->type = OP_CLOSE_BRACKET;
-      break;
-    case '^':
-      token->type = OP_NON_MATCH_LIST;
-      break;
-    default:
-      token->type = CHARACTER;
-    }
-  return 1;
-}
-
-/* Functions for parser.  */
-
-/* Entry point of the parser.
-   Parse the regular expression REGEXP and return the structure tree.
-   If an error occurs, ERR is set by error code, and return NULL.
-   This function build the following tree, from regular expression <reg_exp>:
-	   CAT
-	   / \
-	  /   \
-   <reg_exp>  EOR
-
-   CAT means concatenation.
-   EOR means end of regular expression.  */
-
-static bin_tree_t *
-parse (re_string_t *regexp, regex_t *preg, reg_syntax_t syntax,
-       reg_errcode_t *err)
-{
-  re_dfa_t *dfa = preg->buffer;
-  bin_tree_t *tree, *eor, *root;
-  re_token_t current_token;
-  dfa->syntax = syntax;
-  fetch_token (&current_token, regexp, syntax | RE_CARET_ANCHORS_HERE);
-  tree = parse_reg_exp (regexp, preg, &current_token, syntax, 0, err);
-  if (BE (*err != REG_NOERROR && tree == NULL, 0))
-    return NULL;
-  eor = create_tree (dfa, NULL, NULL, END_OF_RE);
-  if (tree != NULL)
-    root = create_tree (dfa, tree, eor, CONCAT);
-  else
-    root = eor;
-  if (BE (eor == NULL || root == NULL, 0))
-    {
-      *err = REG_ESPACE;
-      return NULL;
-    }
-  return root;
-}
-
-/* This function build the following tree, from regular expression
-   <branch1>|<branch2>:
-	   ALT
-	   / \
-	  /   \
-   <branch1> <branch2>
-
-   ALT means alternative, which represents the operator '|'.  */
-
-static bin_tree_t *
-parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
-	       reg_syntax_t syntax, Idx nest, reg_errcode_t *err)
-{
-  re_dfa_t *dfa = preg->buffer;
-  bin_tree_t *tree, *branch = NULL;
-  tree = parse_branch (regexp, preg, token, syntax, nest, err);
-  if (BE (*err != REG_NOERROR && tree == NULL, 0))
-    return NULL;
-
-  while (token->type == OP_ALT)
-    {
-      fetch_token (token, regexp, syntax | RE_CARET_ANCHORS_HERE);
-      if (token->type != OP_ALT && token->type != END_OF_RE
-	  && (nest == 0 || token->type != OP_CLOSE_SUBEXP))
-	{
-	  branch = parse_branch (regexp, preg, token, syntax, nest, err);
-	  if (BE (*err != REG_NOERROR && branch == NULL, 0))
-	    return NULL;
-	}
-      else
-	branch = NULL;
-      tree = create_tree (dfa, tree, branch, OP_ALT);
-      if (BE (tree == NULL, 0))
-	{
-	  *err = REG_ESPACE;
-	  return NULL;
-	}
-    }
-  return tree;
-}
-
-/* This function build the following tree, from regular expression
-   <exp1><exp2>:
-	CAT
-	/ \
-       /   \
-   <exp1> <exp2>
-
-   CAT means concatenation.  */
-
-static bin_tree_t *
-parse_branch (re_string_t *regexp, regex_t *preg, re_token_t *token,
-	      reg_syntax_t syntax, Idx nest, reg_errcode_t *err)
-{
-  bin_tree_t *tree, *expr;
-  re_dfa_t *dfa = preg->buffer;
-  tree = parse_expression (regexp, preg, token, syntax, nest, err);
-  if (BE (*err != REG_NOERROR && tree == NULL, 0))
-    return NULL;
-
-  while (token->type != OP_ALT && token->type != END_OF_RE
-	 && (nest == 0 || token->type != OP_CLOSE_SUBEXP))
-    {
-      expr = parse_expression (regexp, preg, token, syntax, nest, err);
-      if (BE (*err != REG_NOERROR && expr == NULL, 0))
-	{
-	  if (tree != NULL)
-	    postorder (tree, free_tree, NULL);
-	  return NULL;
-	}
-      if (tree != NULL && expr != NULL)
-	{
-	  bin_tree_t *newtree = create_tree (dfa, tree, expr, CONCAT);
-	  if (newtree == NULL)
-	    {
-	      postorder (expr, free_tree, NULL);
-	      postorder (tree, free_tree, NULL);
-	      *err = REG_ESPACE;
-	      return NULL;
-	    }
-	  tree = newtree;
-	}
-      else if (tree == NULL)
-	tree = expr;
-      /* Otherwise expr == NULL, we don't need to create new tree.  */
-    }
-  return tree;
-}
-
-/* This function build the following tree, from regular expression a*:
-	 *
-	 |
-	 a
-*/
-
-static bin_tree_t *
-parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token,
-		  reg_syntax_t syntax, Idx nest, reg_errcode_t *err)
-{
-  re_dfa_t *dfa = preg->buffer;
-  bin_tree_t *tree;
-  switch (token->type)
-    {
-    case CHARACTER:
-      tree = create_token_tree (dfa, NULL, NULL, token);
-      if (BE (tree == NULL, 0))
-	{
-	  *err = REG_ESPACE;
-	  return NULL;
-	}
-#ifdef RE_ENABLE_I18N
-      if (dfa->mb_cur_max > 1)
-	{
-	  while (!re_string_eoi (regexp)
-		 && !re_string_first_byte (regexp, re_string_cur_idx (regexp)))
-	    {
-	      bin_tree_t *mbc_remain;
-	      fetch_token (token, regexp, syntax);
-	      mbc_remain = create_token_tree (dfa, NULL, NULL, token);
-	      tree = create_tree (dfa, tree, mbc_remain, CONCAT);
-	      if (BE (mbc_remain == NULL || tree == NULL, 0))
-		{
-		  *err = REG_ESPACE;
-		  return NULL;
-		}
-	    }
-	}
-#endif
-      break;
-    case OP_OPEN_SUBEXP:
-      tree = parse_sub_exp (regexp, preg, token, syntax, nest + 1, err);
-      if (BE (*err != REG_NOERROR && tree == NULL, 0))
-	return NULL;
-      break;
-    case OP_OPEN_BRACKET:
-      tree = parse_bracket_exp (regexp, dfa, token, syntax, err);
-      if (BE (*err != REG_NOERROR && tree == NULL, 0))
-	return NULL;
-      break;
-    case OP_BACK_REF:
-      if (!BE (dfa->completed_bkref_map & (1 << token->opr.idx), 1))
-	{
-	  *err = REG_ESUBREG;
-	  return NULL;
-	}
-      dfa->used_bkref_map |= 1 << token->opr.idx;
-      tree = create_token_tree (dfa, NULL, NULL, token);
-      if (BE (tree == NULL, 0))
-	{
-	  *err = REG_ESPACE;
-	  return NULL;
-	}
-      ++dfa->nbackref;
-      dfa->has_mb_node = 1;
-      break;
-    case OP_OPEN_DUP_NUM:
-      if (syntax & RE_CONTEXT_INVALID_DUP)
-	{
-	  *err = REG_BADRPT;
-	  return NULL;
-	}
-      /* FALLTHROUGH */
-    case OP_DUP_ASTERISK:
-    case OP_DUP_PLUS:
-    case OP_DUP_QUESTION:
-      if (syntax & RE_CONTEXT_INVALID_OPS)
-	{
-	  *err = REG_BADRPT;
-	  return NULL;
-	}
-      else if (syntax & RE_CONTEXT_INDEP_OPS)
-	{
-	  fetch_token (token, regexp, syntax);
-	  return parse_expression (regexp, preg, token, syntax, nest, err);
-	}
-      /* else fall through  */
-    case OP_CLOSE_SUBEXP:
-      if ((token->type == OP_CLOSE_SUBEXP) &&
-	  !(syntax & RE_UNMATCHED_RIGHT_PAREN_ORD))
-	{
-	  *err = REG_ERPAREN;
-	  return NULL;
-	}
-      /* else fall through  */
-    case OP_CLOSE_DUP_NUM:
-      /* We treat it as a normal character.  */
-
-      /* Then we can these characters as normal characters.  */
-      token->type = CHARACTER;
-      /* mb_partial and word_char bits should be initialized already
-	 by peek_token.  */
-      tree = create_token_tree (dfa, NULL, NULL, token);
-      if (BE (tree == NULL, 0))
-	{
-	  *err = REG_ESPACE;
-	  return NULL;
-	}
-      break;
-    case ANCHOR:
-      if ((token->opr.ctx_type
-	   & (WORD_DELIM | NOT_WORD_DELIM | WORD_FIRST | WORD_LAST))
-	  && dfa->word_ops_used == 0)
-	init_word_char (dfa);
-      if (token->opr.ctx_type == WORD_DELIM
-	  || token->opr.ctx_type == NOT_WORD_DELIM)
-	{
-	  bin_tree_t *tree_first, *tree_last;
-	  if (token->opr.ctx_type == WORD_DELIM)
-	    {
-	      token->opr.ctx_type = WORD_FIRST;
-	      tree_first = create_token_tree (dfa, NULL, NULL, token);
-	      token->opr.ctx_type = WORD_LAST;
-	    }
-	  else
-	    {
-	      token->opr.ctx_type = INSIDE_WORD;
-	      tree_first = create_token_tree (dfa, NULL, NULL, token);
-	      token->opr.ctx_type = INSIDE_NOTWORD;
-	    }
-	  tree_last = create_token_tree (dfa, NULL, NULL, token);
-	  tree = create_tree (dfa, tree_first, tree_last, OP_ALT);
-	  if (BE (tree_first == NULL || tree_last == NULL || tree == NULL, 0))
-	    {
-	      *err = REG_ESPACE;
-	      return NULL;
-	    }
-	}
-      else
-	{
-	  tree = create_token_tree (dfa, NULL, NULL, token);
-	  if (BE (tree == NULL, 0))
-	    {
-	      *err = REG_ESPACE;
-	      return NULL;
-	    }
-	}
-      /* We must return here, since ANCHORs can't be followed
-	 by repetition operators.
-	 eg. RE"^*" is invalid or "<ANCHOR(^)><CHAR(*)>",
-	     it must not be "<ANCHOR(^)><REPEAT(*)>".  */
-      fetch_token (token, regexp, syntax);
-      return tree;
-    case OP_PERIOD:
-      tree = create_token_tree (dfa, NULL, NULL, token);
-      if (BE (tree == NULL, 0))
-	{
-	  *err = REG_ESPACE;
-	  return NULL;
-	}
-      if (dfa->mb_cur_max > 1)
-	dfa->has_mb_node = 1;
-      break;
-    case OP_WORD:
-    case OP_NOTWORD:
-      tree = build_charclass_op (dfa, regexp->trans,
-				 "alnum",
-				 "_",
-				 token->type == OP_NOTWORD, err);
-      if (BE (*err != REG_NOERROR && tree == NULL, 0))
-	return NULL;
-      break;
-    case OP_SPACE:
-    case OP_NOTSPACE:
-      tree = build_charclass_op (dfa, regexp->trans,
-				 "space",
-				 "",
-				 token->type == OP_NOTSPACE, err);
-      if (BE (*err != REG_NOERROR && tree == NULL, 0))
-	return NULL;
-      break;
-    case OP_ALT:
-    case END_OF_RE:
-      return NULL;
-    case BACK_SLASH:
-      *err = REG_EESCAPE;
-      return NULL;
-    default:
-      /* Must not happen?  */
-#ifdef DEBUG
-      assert (0);
-#endif
-      return NULL;
-    }
-  fetch_token (token, regexp, syntax);
-
-  while (token->type == OP_DUP_ASTERISK || token->type == OP_DUP_PLUS
-	 || token->type == OP_DUP_QUESTION || token->type == OP_OPEN_DUP_NUM)
-    {
-      tree = parse_dup_op (tree, regexp, dfa, token, syntax, err);
-      if (BE (*err != REG_NOERROR && tree == NULL, 0))
-	return NULL;
-      /* In BRE consecutive duplications are not allowed.  */
-      if ((syntax & RE_CONTEXT_INVALID_DUP)
-	  && (token->type == OP_DUP_ASTERISK
-	      || token->type == OP_OPEN_DUP_NUM))
-	{
-	  *err = REG_BADRPT;
-	  return NULL;
-	}
-    }
-
-  return tree;
-}
-
-/* This function build the following tree, from regular expression
-   (<reg_exp>):
-	 SUBEXP
-	    |
-	<reg_exp>
-*/
-
-static bin_tree_t *
-parse_sub_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
-	       reg_syntax_t syntax, Idx nest, reg_errcode_t *err)
-{
-  re_dfa_t *dfa = preg->buffer;
-  bin_tree_t *tree;
-  size_t cur_nsub;
-  cur_nsub = preg->re_nsub++;
-
-  fetch_token (token, regexp, syntax | RE_CARET_ANCHORS_HERE);
-
-  /* The subexpression may be a null string.  */
-  if (token->type == OP_CLOSE_SUBEXP)
-    tree = NULL;
-  else
-    {
-      tree = parse_reg_exp (regexp, preg, token, syntax, nest, err);
-      if (BE (*err == REG_NOERROR && token->type != OP_CLOSE_SUBEXP, 0))
-	{
-	  if (tree != NULL)
-	    postorder (tree, free_tree, NULL);
-	  *err = REG_EPAREN;
-	}
-      if (BE (*err != REG_NOERROR, 0))
-	return NULL;
-    }
-
-  if (cur_nsub <= '9' - '1')
-    dfa->completed_bkref_map |= 1 << cur_nsub;
-
-  tree = create_tree (dfa, tree, NULL, SUBEXP);
-  if (BE (tree == NULL, 0))
-    {
-      *err = REG_ESPACE;
-      return NULL;
-    }
-  tree->token.opr.idx = cur_nsub;
-  return tree;
-}
-
-/* This function parse repetition operators like "*", "+", "{1,3}" etc.  */
-
-static bin_tree_t *
-parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
-	      re_token_t *token, reg_syntax_t syntax, reg_errcode_t *err)
-{
-  bin_tree_t *tree = NULL, *old_tree = NULL;
-  Idx i, start, end, start_idx = re_string_cur_idx (regexp);
-  re_token_t start_token = *token;
-
-  if (token->type == OP_OPEN_DUP_NUM)
-    {
-      end = 0;
-      start = fetch_number (regexp, token, syntax);
-      if (start == REG_MISSING)
-	{
-	  if (token->type == CHARACTER && token->opr.c == ',')
-	    start = 0; /* We treat "{,m}" as "{0,m}".  */
-	  else
-	    {
-	      *err = REG_BADBR; /* <re>{} is invalid.  */
-	      return NULL;
-	    }
-	}
-      if (BE (start != REG_ERROR, 1))
-	{
-	  /* We treat "{n}" as "{n,n}".  */
-	  end = ((token->type == OP_CLOSE_DUP_NUM) ? start
-		 : ((token->type == CHARACTER && token->opr.c == ',')
-		    ? fetch_number (regexp, token, syntax) : REG_ERROR));
-	}
-      if (BE (start == REG_ERROR || end == REG_ERROR, 0))
-	{
-	  /* Invalid sequence.  */
-	  if (BE (!(syntax & RE_INVALID_INTERVAL_ORD), 0))
-	    {
-	      if (token->type == END_OF_RE)
-		*err = REG_EBRACE;
-	      else
-		*err = REG_BADBR;
-
-	      return NULL;
-	    }
-
-	  /* If the syntax bit is set, rollback.  */
-	  re_string_set_index (regexp, start_idx);
-	  *token = start_token;
-	  token->type = CHARACTER;
-	  /* mb_partial and word_char bits should be already initialized by
-	     peek_token.  */
-	  return elem;
-	}
-
-      if (BE ((end != REG_MISSING && start > end)
-	      || token->type != OP_CLOSE_DUP_NUM, 0))
-	{
-	  /* First number greater than second.  */
-	  *err = REG_BADBR;
-	  return NULL;
-	}
-
-      if (BE (RE_DUP_MAX < (end == REG_MISSING ? start : end), 0))
-	{
-	  *err = REG_ESIZE;
-	  return NULL;
-	}
-    }
-  else
-    {
-      start = (token->type == OP_DUP_PLUS) ? 1 : 0;
-      end = (token->type == OP_DUP_QUESTION) ? 1 : REG_MISSING;
-    }
-
-  fetch_token (token, regexp, syntax);
-
-  if (BE (elem == NULL, 0))
-    return NULL;
-  if (BE (start == 0 && end == 0, 0))
-    {
-      postorder (elem, free_tree, NULL);
-      return NULL;
-    }
-
-  /* Extract "<re>{n,m}" to "<re><re>...<re><re>{0,<m-n>}".  */
-  if (BE (start > 0, 0))
-    {
-      tree = elem;
-      for (i = 2; i <= start; ++i)
-	{
-	  elem = duplicate_tree (elem, dfa);
-	  tree = create_tree (dfa, tree, elem, CONCAT);
-	  if (BE (elem == NULL || tree == NULL, 0))
-	    goto parse_dup_op_espace;
-	}
-
-      if (start == end)
-	return tree;
-
-      /* Duplicate ELEM before it is marked optional.  */
-      elem = duplicate_tree (elem, dfa);
-      old_tree = tree;
-    }
-  else
-    old_tree = NULL;
-
-  if (elem->token.type == SUBEXP)
-    {
-      uintptr_t subidx = elem->token.opr.idx;
-      postorder (elem, mark_opt_subexp, (void *) subidx);
-    }
-
-  tree = create_tree (dfa, elem, NULL,
-		      (end == REG_MISSING ? OP_DUP_ASTERISK : OP_ALT));
-  if (BE (tree == NULL, 0))
-    goto parse_dup_op_espace;
-
-/* From gnulib's "intprops.h":
-   True if the arithmetic type T is signed.  */
-#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
-
-  /* This loop is actually executed only when end != REG_MISSING,
-     to rewrite <re>{0,n} as (<re>(<re>...<re>?)?)?...  We have
-     already created the start+1-th copy.  */
-  if (TYPE_SIGNED (Idx) || end != REG_MISSING)
-    for (i = start + 2; i <= end; ++i)
-      {
-	elem = duplicate_tree (elem, dfa);
-	tree = create_tree (dfa, tree, elem, CONCAT);
-	if (BE (elem == NULL || tree == NULL, 0))
-	  goto parse_dup_op_espace;
-
-	tree = create_tree (dfa, tree, NULL, OP_ALT);
-	if (BE (tree == NULL, 0))
-	  goto parse_dup_op_espace;
-      }
-
-  if (old_tree)
-    tree = create_tree (dfa, old_tree, tree, CONCAT);
-
-  return tree;
-
- parse_dup_op_espace:
-  *err = REG_ESPACE;
-  return NULL;
-}
-
-/* Size of the names for collating symbol/equivalence_class/character_class.
-   I'm not sure, but maybe enough.  */
-#define BRACKET_NAME_BUF_SIZE 32
-
-#ifndef _LIBC
-  /* Local function for parse_bracket_exp only used in case of NOT _LIBC.
-     Build the range expression which starts from START_ELEM, and ends
-     at END_ELEM.  The result are written to MBCSET and SBCSET.
-     RANGE_ALLOC is the allocated size of mbcset->range_starts, and
-     mbcset->range_ends, is a pointer argument since we may
-     update it.  */
-
-static reg_errcode_t
-internal_function
-# ifdef RE_ENABLE_I18N
-build_range_exp (const reg_syntax_t syntax,
-                 bitset_t sbcset,
-                 re_charset_t *mbcset,
-                 Idx *range_alloc,
-                 const bracket_elem_t *start_elem,
-                 const bracket_elem_t *end_elem)
-# else /* not RE_ENABLE_I18N */
-build_range_exp (const reg_syntax_t syntax,
-                 bitset_t sbcset,
-                 const bracket_elem_t *start_elem,
-                 const bracket_elem_t *end_elem)
-# endif /* not RE_ENABLE_I18N */
-{
-  unsigned int start_ch, end_ch;
-  /* Equivalence Classes and Character Classes can't be a range start/end.  */
-  if (BE (start_elem->type == EQUIV_CLASS || start_elem->type == CHAR_CLASS
-	  || end_elem->type == EQUIV_CLASS || end_elem->type == CHAR_CLASS,
-	  0))
-    return REG_ERANGE;
-
-  /* We can handle no multi character collating elements without libc
-     support.  */
-  if (BE ((start_elem->type == COLL_SYM
-	   && strlen ((char *) start_elem->opr.name) > 1)
-	  || (end_elem->type == COLL_SYM
-	      && strlen ((char *) end_elem->opr.name) > 1), 0))
-    return REG_ECOLLATE;
-
-# ifdef RE_ENABLE_I18N
-  {
-    wchar_t wc;
-    wint_t start_wc;
-    wint_t end_wc;
-
-    start_ch = ((start_elem->type == SB_CHAR) ? start_elem->opr.ch
-		: ((start_elem->type == COLL_SYM) ? start_elem->opr.name[0]
-		   : 0));
-    end_ch = ((end_elem->type == SB_CHAR) ? end_elem->opr.ch
-	      : ((end_elem->type == COLL_SYM) ? end_elem->opr.name[0]
-		 : 0));
-    start_wc = ((start_elem->type == SB_CHAR || start_elem->type == COLL_SYM)
-		? __btowc (start_ch) : start_elem->opr.wch);
-    end_wc = ((end_elem->type == SB_CHAR || end_elem->type == COLL_SYM)
-	      ? __btowc (end_ch) : end_elem->opr.wch);
-    if (start_wc == WEOF || end_wc == WEOF)
-      return REG_ECOLLATE;
-    else if (BE ((syntax & RE_NO_EMPTY_RANGES) && start_wc > end_wc, 0))
-      return REG_ERANGE;
-
-    /* Got valid collation sequence values, add them as a new entry.
-       However, for !_LIBC we have no collation elements: if the
-       character set is single byte, the single byte character set
-       that we build below suffices.  parse_bracket_exp passes
-       no MBCSET if dfa->mb_cur_max == 1.  */
-    if (mbcset)
-      {
-	/* Check the space of the arrays.  */
-	if (BE (*range_alloc == mbcset->nranges, 0))
-	  {
-	    /* There is not enough space, need realloc.  */
-	    wchar_t *new_array_start, *new_array_end;
-	    Idx new_nranges;
-
-	    /* +1 in case of mbcset->nranges is 0.  */
-	    new_nranges = 2 * mbcset->nranges + 1;
-	    /* Use realloc since mbcset->range_starts and mbcset->range_ends
-	       are NULL if *range_alloc == 0.  */
-	    new_array_start = re_realloc (mbcset->range_starts, wchar_t,
-					  new_nranges);
-	    new_array_end = re_realloc (mbcset->range_ends, wchar_t,
-					new_nranges);
-
-	    if (BE (new_array_start == NULL || new_array_end == NULL, 0))
-	      return REG_ESPACE;
-
-	    mbcset->range_starts = new_array_start;
-	    mbcset->range_ends = new_array_end;
-	    *range_alloc = new_nranges;
-	  }
-
-	mbcset->range_starts[mbcset->nranges] = start_wc;
-	mbcset->range_ends[mbcset->nranges++] = end_wc;
-      }
-
-    /* Build the table for single byte characters.  */
-    for (wc = 0; wc < SBC_MAX; ++wc)
-      {
-	if (start_wc <= wc && wc <= end_wc)
-	  bitset_set (sbcset, wc);
-      }
-  }
-# else /* not RE_ENABLE_I18N */
-  {
-    unsigned int ch;
-    start_ch = ((start_elem->type == SB_CHAR ) ? start_elem->opr.ch
-		: ((start_elem->type == COLL_SYM) ? start_elem->opr.name[0]
-		   : 0));
-    end_ch = ((end_elem->type == SB_CHAR ) ? end_elem->opr.ch
-	      : ((end_elem->type == COLL_SYM) ? end_elem->opr.name[0]
-		 : 0));
-    if (start_ch > end_ch)
-      return REG_ERANGE;
-    /* Build the table for single byte characters.  */
-    for (ch = 0; ch < SBC_MAX; ++ch)
-      if (start_ch <= ch  && ch <= end_ch)
-	bitset_set (sbcset, ch);
-  }
-# endif /* not RE_ENABLE_I18N */
-  return REG_NOERROR;
-}
-#endif /* not _LIBC */
-
-#ifndef _LIBC
-/* Helper function for parse_bracket_exp only used in case of NOT _LIBC..
-   Build the collating element which is represented by NAME.
-   The result are written to MBCSET and SBCSET.
-   COLL_SYM_ALLOC is the allocated size of mbcset->coll_sym, is a
-   pointer argument since we may update it.  */
-
-static reg_errcode_t
-internal_function
-# ifdef RE_ENABLE_I18N
-build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset,
-			Idx *coll_sym_alloc, const unsigned char *name)
-# else /* not RE_ENABLE_I18N */
-build_collating_symbol (bitset_t sbcset, const unsigned char *name)
-# endif /* not RE_ENABLE_I18N */
-{
-  size_t name_len = strlen ((const char *) name);
-  if (BE (name_len != 1, 0))
-    return REG_ECOLLATE;
-  else
-    {
-      bitset_set (sbcset, name[0]);
-      return REG_NOERROR;
-    }
-}
-#endif /* not _LIBC */
-
-/* This function parse bracket expression like "[abc]", "[a-c]",
-   "[[.a-a.]]" etc.  */
-
-static bin_tree_t *
-parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
-		   reg_syntax_t syntax, reg_errcode_t *err)
-{
-#ifdef _LIBC
-  const unsigned char *collseqmb;
-  const char *collseqwc;
-  uint32_t nrules;
-  int32_t table_size;
-  const int32_t *symb_table;
-  const unsigned char *extra;
-
-  /* Local function for parse_bracket_exp used in _LIBC environment.
-     Seek the collating symbol entry corresponding to NAME.
-     Return the index of the symbol in the SYMB_TABLE,
-     or -1 if not found.  */
-
-  auto inline int32_t
-  __attribute__ ((always_inline))
-  seek_collating_symbol_entry (const unsigned char *name, size_t name_len)
-    {
-      int32_t elem;
-
-      for (elem = 0; elem < table_size; elem++)
-	if (symb_table[2 * elem] != 0)
-	  {
-	    int32_t idx = symb_table[2 * elem + 1];
-	    /* Skip the name of collating element name.  */
-	    idx += 1 + extra[idx];
-	    if (/* Compare the length of the name.  */
-		name_len == extra[idx]
-		/* Compare the name.  */
-		&& memcmp (name, &extra[idx + 1], name_len) == 0)
-	      /* Yep, this is the entry.  */
-	      return elem;
-	  }
-      return -1;
-    }
-
-  /* Local function for parse_bracket_exp used in _LIBC environment.
-     Look up the collation sequence value of BR_ELEM.
-     Return the value if succeeded, UINT_MAX otherwise.  */
-
-  auto inline unsigned int
-  __attribute__ ((always_inline))
-  lookup_collation_sequence_value (bracket_elem_t *br_elem)
-    {
-      if (br_elem->type == SB_CHAR)
-	{
-	  /*
-	  if (MB_CUR_MAX == 1)
-	  */
-	  if (nrules == 0)
-	    return collseqmb[br_elem->opr.ch];
-	  else
-	    {
-	      wint_t wc = __btowc (br_elem->opr.ch);
-	      return __collseq_table_lookup (collseqwc, wc);
-	    }
-	}
-      else if (br_elem->type == MB_CHAR)
-	{
-	  if (nrules != 0)
-	    return __collseq_table_lookup (collseqwc, br_elem->opr.wch);
-	}
-      else if (br_elem->type == COLL_SYM)
-	{
-	  size_t sym_name_len = strlen ((char *) br_elem->opr.name);
-	  if (nrules != 0)
-	    {
-	      int32_t elem, idx;
-	      elem = seek_collating_symbol_entry (br_elem->opr.name,
-						  sym_name_len);
-	      if (elem != -1)
-		{
-		  /* We found the entry.  */
-		  idx = symb_table[2 * elem + 1];
-		  /* Skip the name of collating element name.  */
-		  idx += 1 + extra[idx];
-		  /* Skip the byte sequence of the collating element.  */
-		  idx += 1 + extra[idx];
-		  /* Adjust for the alignment.  */
-		  idx = (idx + 3) & ~3;
-		  /* Skip the multibyte collation sequence value.  */
-		  idx += sizeof (unsigned int);
-		  /* Skip the wide char sequence of the collating element.  */
-		  idx += sizeof (unsigned int) *
-		    (1 + *(unsigned int *) (extra + idx));
-		  /* Return the collation sequence value.  */
-		  return *(unsigned int *) (extra + idx);
-		}
-	      else if (sym_name_len == 1)
-		{
-		  /* No valid character.  Match it as a single byte
-		     character.  */
-		  return collseqmb[br_elem->opr.name[0]];
-		}
-	    }
-	  else if (sym_name_len == 1)
-	    return collseqmb[br_elem->opr.name[0]];
-	}
-      return UINT_MAX;
-    }
-
-  /* Local function for parse_bracket_exp used in _LIBC environment.
-     Build the range expression which starts from START_ELEM, and ends
-     at END_ELEM.  The result are written to MBCSET and SBCSET.
-     RANGE_ALLOC is the allocated size of mbcset->range_starts, and
-     mbcset->range_ends, is a pointer argument since we may
-     update it.  */
-
-  auto inline reg_errcode_t
-  __attribute__ ((always_inline))
-  build_range_exp (bitset_t sbcset, re_charset_t *mbcset, int *range_alloc,
-		   bracket_elem_t *start_elem, bracket_elem_t *end_elem)
-    {
-      unsigned int ch;
-      uint32_t start_collseq;
-      uint32_t end_collseq;
-
-      /* Equivalence Classes and Character Classes can't be a range
-	 start/end.  */
-      if (BE (start_elem->type == EQUIV_CLASS || start_elem->type == CHAR_CLASS
-	      || end_elem->type == EQUIV_CLASS || end_elem->type == CHAR_CLASS,
-	      0))
-	return REG_ERANGE;
-
-      /* FIXME: Implement rational ranges here, too.  */
-      start_collseq = lookup_collation_sequence_value (start_elem);
-      end_collseq = lookup_collation_sequence_value (end_elem);
-      /* Check start/end collation sequence values.  */
-      if (BE (start_collseq == UINT_MAX || end_collseq == UINT_MAX, 0))
-	return REG_ECOLLATE;
-      if (BE ((syntax & RE_NO_EMPTY_RANGES) && start_collseq > end_collseq, 0))
-	return REG_ERANGE;
-
-      /* Got valid collation sequence values, add them as a new entry.
-	 However, if we have no collation elements, and the character set
-	 is single byte, the single byte character set that we
-	 build below suffices. */
-      if (nrules > 0 || dfa->mb_cur_max > 1)
-	{
-	  /* Check the space of the arrays.  */
-	  if (BE (*range_alloc == mbcset->nranges, 0))
-	    {
-	      /* There is not enough space, need realloc.  */
-	      uint32_t *new_array_start;
-	      uint32_t *new_array_end;
-	      Idx new_nranges;
-
-	      /* +1 in case of mbcset->nranges is 0.  */
-	      new_nranges = 2 * mbcset->nranges + 1;
-	      new_array_start = re_realloc (mbcset->range_starts, uint32_t,
-					    new_nranges);
-	      new_array_end = re_realloc (mbcset->range_ends, uint32_t,
-					  new_nranges);
-
-	      if (BE (new_array_start == NULL || new_array_end == NULL, 0))
-		return REG_ESPACE;
-
-	      mbcset->range_starts = new_array_start;
-	      mbcset->range_ends = new_array_end;
-	      *range_alloc = new_nranges;
-	    }
-
-	  mbcset->range_starts[mbcset->nranges] = start_collseq;
-	  mbcset->range_ends[mbcset->nranges++] = end_collseq;
-	}
-
-      /* Build the table for single byte characters.  */
-      for (ch = 0; ch < SBC_MAX; ch++)
-	{
-	  uint32_t ch_collseq;
-	  /*
-	  if (MB_CUR_MAX == 1)
-	  */
-	  if (nrules == 0)
-	    ch_collseq = collseqmb[ch];
-	  else
-	    ch_collseq = __collseq_table_lookup (collseqwc, __btowc (ch));
-	  if (start_collseq <= ch_collseq && ch_collseq <= end_collseq)
-	    bitset_set (sbcset, ch);
-	}
-      return REG_NOERROR;
-    }
-
-  /* Local function for parse_bracket_exp used in _LIBC environment.
-     Build the collating element which is represented by NAME.
-     The result are written to MBCSET and SBCSET.
-     COLL_SYM_ALLOC is the allocated size of mbcset->coll_sym, is a
-     pointer argument since we may update it.  */
-
-  auto inline reg_errcode_t
-  __attribute__ ((always_inline))
-  build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset,
-			  Idx *coll_sym_alloc, const unsigned char *name)
-    {
-      int32_t elem, idx;
-      size_t name_len = strlen ((const char *) name);
-      if (nrules != 0)
-	{
-	  elem = seek_collating_symbol_entry (name, name_len);
-	  if (elem != -1)
-	    {
-	      /* We found the entry.  */
-	      idx = symb_table[2 * elem + 1];
-	      /* Skip the name of collating element name.  */
-	      idx += 1 + extra[idx];
-	    }
-	  else if (name_len == 1)
-	    {
-	      /* No valid character, treat it as a normal
-		 character.  */
-	      bitset_set (sbcset, name[0]);
-	      return REG_NOERROR;
-	    }
-	  else
-	    return REG_ECOLLATE;
-
-	  /* Got valid collation sequence, add it as a new entry.  */
-	  /* Check the space of the arrays.  */
-	  if (BE (*coll_sym_alloc == mbcset->ncoll_syms, 0))
-	    {
-	      /* Not enough, realloc it.  */
-	      /* +1 in case of mbcset->ncoll_syms is 0.  */
-	      Idx new_coll_sym_alloc = 2 * mbcset->ncoll_syms + 1;
-	      /* Use realloc since mbcset->coll_syms is NULL
-		 if *alloc == 0.  */
-	      int32_t *new_coll_syms = re_realloc (mbcset->coll_syms, int32_t,
-						   new_coll_sym_alloc);
-	      if (BE (new_coll_syms == NULL, 0))
-		return REG_ESPACE;
-	      mbcset->coll_syms = new_coll_syms;
-	      *coll_sym_alloc = new_coll_sym_alloc;
-	    }
-	  mbcset->coll_syms[mbcset->ncoll_syms++] = idx;
-	  return REG_NOERROR;
-	}
-      else
-	{
-	  if (BE (name_len != 1, 0))
-	    return REG_ECOLLATE;
-	  else
-	    {
-	      bitset_set (sbcset, name[0]);
-	      return REG_NOERROR;
-	    }
-	}
-    }
-#endif
-
-  re_token_t br_token;
-  re_bitset_ptr_t sbcset;
-#ifdef RE_ENABLE_I18N
-  re_charset_t *mbcset;
-  Idx coll_sym_alloc = 0, range_alloc = 0, mbchar_alloc = 0;
-  Idx equiv_class_alloc = 0, char_class_alloc = 0;
-#endif /* not RE_ENABLE_I18N */
-  bool non_match = false;
-  bin_tree_t *work_tree;
-  int token_len;
-  bool first_round = true;
-#ifdef _LIBC
-  collseqmb = (const unsigned char *)
-    _NL_CURRENT (LC_COLLATE, _NL_COLLATE_COLLSEQMB);
-  nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
-  if (nrules)
-    {
-      /*
-      if (MB_CUR_MAX > 1)
-      */
-      collseqwc = _NL_CURRENT (LC_COLLATE, _NL_COLLATE_COLLSEQWC);
-      table_size = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_SYMB_HASH_SIZEMB);
-      symb_table = (const int32_t *) _NL_CURRENT (LC_COLLATE,
-						  _NL_COLLATE_SYMB_TABLEMB);
-      extra = (const unsigned char *) _NL_CURRENT (LC_COLLATE,
-						   _NL_COLLATE_SYMB_EXTRAMB);
-    }
-#endif
-  sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
-#ifdef RE_ENABLE_I18N
-  mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1);
-#endif /* RE_ENABLE_I18N */
-#ifdef RE_ENABLE_I18N
-  if (BE (sbcset == NULL || mbcset == NULL, 0))
-#else
-  if (BE (sbcset == NULL, 0))
-#endif /* RE_ENABLE_I18N */
-    {
-      re_free (sbcset);
-#ifdef RE_ENABLE_I18N
-      re_free (mbcset);
-#endif
-      *err = REG_ESPACE;
-      return NULL;
-    }
-
-  token_len = peek_token_bracket (token, regexp, syntax);
-  if (BE (token->type == END_OF_RE, 0))
-    {
-      *err = REG_BADPAT;
-      goto parse_bracket_exp_free_return;
-    }
-  if (token->type == OP_NON_MATCH_LIST)
-    {
-#ifdef RE_ENABLE_I18N
-      mbcset->non_match = 1;
-#endif /* not RE_ENABLE_I18N */
-      non_match = true;
-      if (syntax & RE_HAT_LISTS_NOT_NEWLINE)
-	bitset_set (sbcset, '\n');
-      re_string_skip_bytes (regexp, token_len); /* Skip a token.  */
-      token_len = peek_token_bracket (token, regexp, syntax);
-      if (BE (token->type == END_OF_RE, 0))
-	{
-	  *err = REG_BADPAT;
-	  goto parse_bracket_exp_free_return;
-	}
-    }
-
-  /* We treat the first ']' as a normal character.  */
-  if (token->type == OP_CLOSE_BRACKET)
-    token->type = CHARACTER;
-
-  while (1)
-    {
-      bracket_elem_t start_elem, end_elem;
-      unsigned char start_name_buf[BRACKET_NAME_BUF_SIZE];
-      unsigned char end_name_buf[BRACKET_NAME_BUF_SIZE];
-      reg_errcode_t ret;
-      int token_len2 = 0;
-      bool is_range_exp = false;
-      re_token_t token2;
-
-      start_elem.opr.name = start_name_buf;
-      ret = parse_bracket_element (&start_elem, regexp, token, token_len, dfa,
-				   syntax, first_round);
-      if (BE (ret != REG_NOERROR, 0))
-	{
-	  *err = ret;
-	  goto parse_bracket_exp_free_return;
-	}
-      first_round = false;
-
-      /* Get information about the next token.  We need it in any case.  */
-      token_len = peek_token_bracket (token, regexp, syntax);
-
-      /* Do not check for ranges if we know they are not allowed.  */
-      if (start_elem.type != CHAR_CLASS && start_elem.type != EQUIV_CLASS)
-	{
-	  if (BE (token->type == END_OF_RE, 0))
-	    {
-	      *err = REG_EBRACK;
-	      goto parse_bracket_exp_free_return;
-	    }
-	  if (token->type == OP_CHARSET_RANGE)
-	    {
-	      re_string_skip_bytes (regexp, token_len); /* Skip '-'.  */
-	      token_len2 = peek_token_bracket (&token2, regexp, syntax);
-	      if (BE (token2.type == END_OF_RE, 0))
-		{
-		  *err = REG_EBRACK;
-		  goto parse_bracket_exp_free_return;
-		}
-	      if (token2.type == OP_CLOSE_BRACKET)
-		{
-		  /* We treat the last '-' as a normal character.  */
-		  re_string_skip_bytes (regexp, -token_len);
-		  token->type = CHARACTER;
-		}
-	      else
-		is_range_exp = true;
-	    }
-	}
-
-      if (is_range_exp == true)
-	{
-	  end_elem.opr.name = end_name_buf;
-	  ret = parse_bracket_element (&end_elem, regexp, &token2, token_len2,
-				       dfa, syntax, true);
-	  if (BE (ret != REG_NOERROR, 0))
-	    {
-	      *err = ret;
-	      goto parse_bracket_exp_free_return;
-	    }
-
-	  token_len = peek_token_bracket (token, regexp, syntax);
-
-#ifdef _LIBC
-	  *err = build_range_exp (sbcset, mbcset, &range_alloc,
-				  &start_elem, &end_elem);
-#else
-# ifdef RE_ENABLE_I18N
-	  *err = build_range_exp (syntax, sbcset,
-				  dfa->mb_cur_max > 1 ? mbcset : NULL,
-				  &range_alloc, &start_elem, &end_elem);
-# else
-	  *err = build_range_exp (syntax, sbcset, &start_elem, &end_elem);
-# endif
-#endif /* RE_ENABLE_I18N */
-	  if (BE (*err != REG_NOERROR, 0))
-	    goto parse_bracket_exp_free_return;
-	}
-      else
-	{
-	  switch (start_elem.type)
-	    {
-	    case SB_CHAR:
-	      bitset_set (sbcset, start_elem.opr.ch);
-	      break;
-#ifdef RE_ENABLE_I18N
-	    case MB_CHAR:
-	      /* Check whether the array has enough space.  */
-	      if (BE (mbchar_alloc == mbcset->nmbchars, 0))
-		{
-		  wchar_t *new_mbchars;
-		  /* Not enough, realloc it.  */
-		  /* +1 in case of mbcset->nmbchars is 0.  */
-		  mbchar_alloc = 2 * mbcset->nmbchars + 1;
-		  /* Use realloc since array is NULL if *alloc == 0.  */
-		  new_mbchars = re_realloc (mbcset->mbchars, wchar_t,
-					    mbchar_alloc);
-		  if (BE (new_mbchars == NULL, 0))
-		    goto parse_bracket_exp_espace;
-		  mbcset->mbchars = new_mbchars;
-		}
-	      mbcset->mbchars[mbcset->nmbchars++] = start_elem.opr.wch;
-	      break;
-#endif /* RE_ENABLE_I18N */
-	    case EQUIV_CLASS:
-	      *err = build_equiv_class (sbcset,
-#ifdef RE_ENABLE_I18N
-					mbcset, &equiv_class_alloc,
-#endif /* RE_ENABLE_I18N */
-					start_elem.opr.name);
-	      if (BE (*err != REG_NOERROR, 0))
-		goto parse_bracket_exp_free_return;
-	      break;
-	    case COLL_SYM:
-	      *err = build_collating_symbol (sbcset,
-#ifdef RE_ENABLE_I18N
-					     mbcset, &coll_sym_alloc,
-#endif /* RE_ENABLE_I18N */
-					     start_elem.opr.name);
-	      if (BE (*err != REG_NOERROR, 0))
-		goto parse_bracket_exp_free_return;
-	      break;
-	    case CHAR_CLASS:
-	      *err = build_charclass (regexp->trans, sbcset,
-#ifdef RE_ENABLE_I18N
-				      mbcset, &char_class_alloc,
-#endif /* RE_ENABLE_I18N */
-				      (const char *) start_elem.opr.name,
-				      syntax);
-	      if (BE (*err != REG_NOERROR, 0))
-	       goto parse_bracket_exp_free_return;
-	      break;
-	    default:
-	      assert (0);
-	      break;
-	    }
-	}
-      if (BE (token->type == END_OF_RE, 0))
-	{
-	  *err = REG_EBRACK;
-	  goto parse_bracket_exp_free_return;
-	}
-      if (token->type == OP_CLOSE_BRACKET)
-	break;
-    }
-
-  re_string_skip_bytes (regexp, token_len); /* Skip a token.  */
-
-  /* If it is non-matching list.  */
-  if (non_match)
-    bitset_not (sbcset);
-
-#ifdef RE_ENABLE_I18N
-  /* Ensure only single byte characters are set.  */
-  if (dfa->mb_cur_max > 1)
-    bitset_mask (sbcset, dfa->sb_char);
-
-  if (mbcset->nmbchars || mbcset->ncoll_syms || mbcset->nequiv_classes
-      || mbcset->nranges || (dfa->mb_cur_max > 1 && (mbcset->nchar_classes
-						     || mbcset->non_match)))
-    {
-      bin_tree_t *mbc_tree;
-      int sbc_idx;
-      /* Build a tree for complex bracket.  */
-      dfa->has_mb_node = 1;
-      br_token.type = COMPLEX_BRACKET;
-      br_token.opr.mbcset = mbcset;
-      mbc_tree = create_token_tree (dfa, NULL, NULL, &br_token);
-      if (BE (mbc_tree == NULL, 0))
-	goto parse_bracket_exp_espace;
-      for (sbc_idx = 0; sbc_idx < BITSET_WORDS; ++sbc_idx)
-	if (sbcset[sbc_idx])
-	  break;
-      /* If there are no bits set in sbcset, there is no point
-	 of having both SIMPLE_BRACKET and COMPLEX_BRACKET.  */
-      if (sbc_idx < BITSET_WORDS)
-	{
-	  /* Build a tree for simple bracket.  */
-	  br_token.type = SIMPLE_BRACKET;
-	  br_token.opr.sbcset = sbcset;
-	  work_tree = create_token_tree (dfa, NULL, NULL, &br_token);
-	  if (BE (work_tree == NULL, 0))
-	    goto parse_bracket_exp_espace;
-
-	  /* Then join them by ALT node.  */
-	  work_tree = create_tree (dfa, work_tree, mbc_tree, OP_ALT);
-	  if (BE (work_tree == NULL, 0))
-	    goto parse_bracket_exp_espace;
-	}
-      else
-	{
-	  re_free (sbcset);
-	  work_tree = mbc_tree;
-	}
-    }
-  else
-#endif /* not RE_ENABLE_I18N */
-    {
-#ifdef RE_ENABLE_I18N
-      free_charset (mbcset);
-#endif
-      /* Build a tree for simple bracket.  */
-      br_token.type = SIMPLE_BRACKET;
-      br_token.opr.sbcset = sbcset;
-      work_tree = create_token_tree (dfa, NULL, NULL, &br_token);
-      if (BE (work_tree == NULL, 0))
-	goto parse_bracket_exp_espace;
-    }
-  return work_tree;
-
- parse_bracket_exp_espace:
-  *err = REG_ESPACE;
- parse_bracket_exp_free_return:
-  re_free (sbcset);
-#ifdef RE_ENABLE_I18N
-  free_charset (mbcset);
-#endif /* RE_ENABLE_I18N */
-  return NULL;
-}
-
-/* Parse an element in the bracket expression.  */
-
-static reg_errcode_t
-parse_bracket_element (bracket_elem_t *elem, re_string_t *regexp,
-		       re_token_t *token, int token_len, re_dfa_t *dfa,
-		       reg_syntax_t syntax, bool accept_hyphen)
-{
-#ifdef RE_ENABLE_I18N
-  int cur_char_size;
-  cur_char_size = re_string_char_size_at (regexp, re_string_cur_idx (regexp));
-  if (cur_char_size > 1)
-    {
-      elem->type = MB_CHAR;
-      elem->opr.wch = re_string_wchar_at (regexp, re_string_cur_idx (regexp));
-      re_string_skip_bytes (regexp, cur_char_size);
-      return REG_NOERROR;
-    }
-#endif /* RE_ENABLE_I18N */
-  re_string_skip_bytes (regexp, token_len); /* Skip a token.  */
-  if (token->type == OP_OPEN_COLL_ELEM || token->type == OP_OPEN_CHAR_CLASS
-      || token->type == OP_OPEN_EQUIV_CLASS)
-    return parse_bracket_symbol (elem, regexp, token);
-  if (BE (token->type == OP_CHARSET_RANGE, 0) && !accept_hyphen)
-    {
-      /* A '-' must only appear as anything but a range indicator before
-	 the closing bracket.  Everything else is an error.  */
-      re_token_t token2;
-      (void) peek_token_bracket (&token2, regexp, syntax);
-      if (token2.type != OP_CLOSE_BRACKET)
-	/* The actual error value is not standardized since this whole
-	   case is undefined.  But ERANGE makes good sense.  */
-	return REG_ERANGE;
-    }
-  elem->type = SB_CHAR;
-  elem->opr.ch = token->opr.c;
-  return REG_NOERROR;
-}
-
-/* Parse a bracket symbol in the bracket expression.  Bracket symbols are
-   such as [:<character_class>:], [.<collating_element>.], and
-   [=<equivalent_class>=].  */
-
-static reg_errcode_t
-parse_bracket_symbol (bracket_elem_t *elem, re_string_t *regexp,
-		      re_token_t *token)
-{
-  unsigned char ch, delim = token->opr.c;
-  int i = 0;
-  if (re_string_eoi(regexp))
-    return REG_EBRACK;
-  for (;; ++i)
-    {
-      if (i >= BRACKET_NAME_BUF_SIZE)
-	return REG_EBRACK;
-      if (token->type == OP_OPEN_CHAR_CLASS)
-	ch = re_string_fetch_byte_case (regexp);
-      else
-	ch = re_string_fetch_byte (regexp);
-      if (re_string_eoi(regexp))
-	return REG_EBRACK;
-      if (ch == delim && re_string_peek_byte (regexp, 0) == ']')
-	break;
-      elem->opr.name[i] = ch;
-    }
-  re_string_skip_bytes (regexp, 1);
-  elem->opr.name[i] = '\0';
-  switch (token->type)
-    {
-    case OP_OPEN_COLL_ELEM:
-      elem->type = COLL_SYM;
-      break;
-    case OP_OPEN_EQUIV_CLASS:
-      elem->type = EQUIV_CLASS;
-      break;
-    case OP_OPEN_CHAR_CLASS:
-      elem->type = CHAR_CLASS;
-      break;
-    default:
-      break;
-    }
-  return REG_NOERROR;
-}
-
-  /* Helper function for parse_bracket_exp.
-     Build the equivalence class which is represented by NAME.
-     The result are written to MBCSET and SBCSET.
-     EQUIV_CLASS_ALLOC is the allocated size of mbcset->equiv_classes,
-     is a pointer argument since we may update it.  */
-
-static reg_errcode_t
-#ifdef RE_ENABLE_I18N
-build_equiv_class (bitset_t sbcset, re_charset_t *mbcset,
-		   Idx *equiv_class_alloc, const unsigned char *name)
-#else /* not RE_ENABLE_I18N */
-build_equiv_class (bitset_t sbcset, const unsigned char *name)
-#endif /* not RE_ENABLE_I18N */
-{
-#ifdef _LIBC
-  uint32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
-  if (nrules != 0)
-    {
-      const int32_t *table, *indirect;
-      const unsigned char *weights, *extra, *cp;
-      unsigned char char_buf[2];
-      int32_t idx1, idx2;
-      unsigned int ch;
-      size_t len;
-      /* This #include defines a local function!  */
-# include <locale/weight.h>
-      /* Calculate the index for equivalence class.  */
-      cp = name;
-      table = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
-      weights = (const unsigned char *) _NL_CURRENT (LC_COLLATE,
-					       _NL_COLLATE_WEIGHTMB);
-      extra = (const unsigned char *) _NL_CURRENT (LC_COLLATE,
-						   _NL_COLLATE_EXTRAMB);
-      indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE,
-						_NL_COLLATE_INDIRECTMB);
-      idx1 = findidx (&cp, -1);
-      if (BE (idx1 == 0 || *cp != '\0', 0))
-	/* This isn't a valid character.  */
-	return REG_ECOLLATE;
-
-      /* Build single byte matching table for this equivalence class.  */
-      len = weights[idx1 & 0xffffff];
-      for (ch = 0; ch < SBC_MAX; ++ch)
-	{
-	  char_buf[0] = ch;
-	  cp = char_buf;
-	  idx2 = findidx (&cp, 1);
-/*
-	  idx2 = table[ch];
-*/
-	  if (idx2 == 0)
-	    /* This isn't a valid character.  */
-	    continue;
-	  /* Compare only if the length matches and the collation rule
-	     index is the same.  */
-	  if (len == weights[idx2 & 0xffffff] && (idx1 >> 24) == (idx2 >> 24))
-	    {
-	      int cnt = 0;
-
-	      while (cnt <= len &&
-		     weights[(idx1 & 0xffffff) + 1 + cnt]
-		     == weights[(idx2 & 0xffffff) + 1 + cnt])
-		++cnt;
-
-	      if (cnt > len)
-		bitset_set (sbcset, ch);
-	    }
-	}
-      /* Check whether the array has enough space.  */
-      if (BE (*equiv_class_alloc == mbcset->nequiv_classes, 0))
-	{
-	  /* Not enough, realloc it.  */
-	  /* +1 in case of mbcset->nequiv_classes is 0.  */
-	  Idx new_equiv_class_alloc = 2 * mbcset->nequiv_classes + 1;
-	  /* Use realloc since the array is NULL if *alloc == 0.  */
-	  int32_t *new_equiv_classes = re_realloc (mbcset->equiv_classes,
-						   int32_t,
-						   new_equiv_class_alloc);
-	  if (BE (new_equiv_classes == NULL, 0))
-	    return REG_ESPACE;
-	  mbcset->equiv_classes = new_equiv_classes;
-	  *equiv_class_alloc = new_equiv_class_alloc;
-	}
-      mbcset->equiv_classes[mbcset->nequiv_classes++] = idx1;
-    }
-  else
-#endif /* _LIBC */
-    {
-      if (BE (strlen ((const char *) name) != 1, 0))
-	return REG_ECOLLATE;
-      bitset_set (sbcset, *name);
-    }
-  return REG_NOERROR;
-}
-
-  /* Helper function for parse_bracket_exp.
-     Build the character class which is represented by NAME.
-     The result are written to MBCSET and SBCSET.
-     CHAR_CLASS_ALLOC is the allocated size of mbcset->char_classes,
-     is a pointer argument since we may update it.  */
-
-static reg_errcode_t
-#ifdef RE_ENABLE_I18N
-build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset,
-		 re_charset_t *mbcset, Idx *char_class_alloc,
-		 const char *class_name, reg_syntax_t syntax)
-#else /* not RE_ENABLE_I18N */
-build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset,
-		 const char *class_name, reg_syntax_t syntax)
-#endif /* not RE_ENABLE_I18N */
-{
-  int i;
-  const char *name = class_name;
-
-  /* In case of REG_ICASE "upper" and "lower" match the both of
-     upper and lower cases.  */
-  if ((syntax & RE_ICASE)
-      && (strcmp (name, "upper") == 0 || strcmp (name, "lower") == 0))
-    name = "alpha";
-
-#ifdef RE_ENABLE_I18N
-  /* Check the space of the arrays.  */
-  if (BE (*char_class_alloc == mbcset->nchar_classes, 0))
-    {
-      /* Not enough, realloc it.  */
-      /* +1 in case of mbcset->nchar_classes is 0.  */
-      Idx new_char_class_alloc = 2 * mbcset->nchar_classes + 1;
-      /* Use realloc since array is NULL if *alloc == 0.  */
-      wctype_t *new_char_classes = re_realloc (mbcset->char_classes, wctype_t,
-					       new_char_class_alloc);
-      if (BE (new_char_classes == NULL, 0))
-	return REG_ESPACE;
-      mbcset->char_classes = new_char_classes;
-      *char_class_alloc = new_char_class_alloc;
-    }
-  mbcset->char_classes[mbcset->nchar_classes++] = __wctype (name);
-#endif /* RE_ENABLE_I18N */
-
-#define BUILD_CHARCLASS_LOOP(ctype_func)	\
-  do {						\
-    if (BE (trans != NULL, 0))			\
-      {						\
-	for (i = 0; i < SBC_MAX; ++i)		\
-	  if (ctype_func (i))			\
-	    bitset_set (sbcset, trans[i]);	\
-      }						\
-    else					\
-      {						\
-	for (i = 0; i < SBC_MAX; ++i)		\
-	  if (ctype_func (i))			\
-	    bitset_set (sbcset, i);		\
-      }						\
-  } while (0)
-
-  if (strcmp (name, "alnum") == 0)
-    BUILD_CHARCLASS_LOOP (isalnum);
-  else if (strcmp (name, "cntrl") == 0)
-    BUILD_CHARCLASS_LOOP (iscntrl);
-  else if (strcmp (name, "lower") == 0)
-    BUILD_CHARCLASS_LOOP (islower);
-  else if (strcmp (name, "space") == 0)
-    BUILD_CHARCLASS_LOOP (isspace);
-  else if (strcmp (name, "alpha") == 0)
-    BUILD_CHARCLASS_LOOP (isalpha);
-  else if (strcmp (name, "digit") == 0)
-    BUILD_CHARCLASS_LOOP (isdigit);
-  else if (strcmp (name, "print") == 0)
-    BUILD_CHARCLASS_LOOP (isprint);
-  else if (strcmp (name, "upper") == 0)
-    BUILD_CHARCLASS_LOOP (isupper);
-  else if (strcmp (name, "blank") == 0)
-    BUILD_CHARCLASS_LOOP (isblank);
-  else if (strcmp (name, "graph") == 0)
-    BUILD_CHARCLASS_LOOP (isgraph);
-  else if (strcmp (name, "punct") == 0)
-    BUILD_CHARCLASS_LOOP (ispunct);
-  else if (strcmp (name, "xdigit") == 0)
-    BUILD_CHARCLASS_LOOP (isxdigit);
-  else
-    return REG_ECTYPE;
-
-  return REG_NOERROR;
-}
-
-static bin_tree_t *
-build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
-		    const char *class_name,
-		    const char *extra, bool non_match,
-		    reg_errcode_t *err)
-{
-  re_bitset_ptr_t sbcset;
-#ifdef RE_ENABLE_I18N
-  re_charset_t *mbcset;
-  Idx alloc = 0;
-#endif /* not RE_ENABLE_I18N */
-  reg_errcode_t ret;
-  re_token_t br_token;
-  bin_tree_t *tree;
-
-  sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
-#ifdef RE_ENABLE_I18N
-  mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1);
-#endif /* RE_ENABLE_I18N */
-
-#ifdef RE_ENABLE_I18N
-  if (BE (sbcset == NULL || mbcset == NULL, 0))
-#else /* not RE_ENABLE_I18N */
-  if (BE (sbcset == NULL, 0))
-#endif /* not RE_ENABLE_I18N */
-    {
-      *err = REG_ESPACE;
-      return NULL;
-    }
-
-  if (non_match)
-    {
-#ifdef RE_ENABLE_I18N
-      mbcset->non_match = 1;
-#endif /* not RE_ENABLE_I18N */
-    }
-
-  /* We don't care the syntax in this case.  */
-  ret = build_charclass (trans, sbcset,
-#ifdef RE_ENABLE_I18N
-			 mbcset, &alloc,
-#endif /* RE_ENABLE_I18N */
-			 class_name, 0);
-
-  if (BE (ret != REG_NOERROR, 0))
-    {
-      re_free (sbcset);
-#ifdef RE_ENABLE_I18N
-      free_charset (mbcset);
-#endif /* RE_ENABLE_I18N */
-      *err = ret;
-      return NULL;
-    }
-  /* \w match '_' also.  */
-  for (; *extra; extra++)
-    bitset_set (sbcset, *extra);
-
-  /* If it is non-matching list.  */
-  if (non_match)
-    bitset_not (sbcset);
-
-#ifdef RE_ENABLE_I18N
-  /* Ensure only single byte characters are set.  */
-  if (dfa->mb_cur_max > 1)
-    bitset_mask (sbcset, dfa->sb_char);
-#endif
-
-  /* Build a tree for simple bracket.  */
-  br_token.type = SIMPLE_BRACKET;
-  br_token.opr.sbcset = sbcset;
-  tree = create_token_tree (dfa, NULL, NULL, &br_token);
-  if (BE (tree == NULL, 0))
-    goto build_word_op_espace;
-
-#ifdef RE_ENABLE_I18N
-  if (dfa->mb_cur_max > 1)
-    {
-      bin_tree_t *mbc_tree;
-      /* Build a tree for complex bracket.  */
-      br_token.type = COMPLEX_BRACKET;
-      br_token.opr.mbcset = mbcset;
-      dfa->has_mb_node = 1;
-      mbc_tree = create_token_tree (dfa, NULL, NULL, &br_token);
-      if (BE (mbc_tree == NULL, 0))
-	goto build_word_op_espace;
-      /* Then join them by ALT node.  */
-      tree = create_tree (dfa, tree, mbc_tree, OP_ALT);
-      if (BE (mbc_tree != NULL, 1))
-	return tree;
-    }
-  else
-    {
-      free_charset (mbcset);
-      return tree;
-    }
-#else /* not RE_ENABLE_I18N */
-  return tree;
-#endif /* not RE_ENABLE_I18N */
-
- build_word_op_espace:
-  re_free (sbcset);
-#ifdef RE_ENABLE_I18N
-  free_charset (mbcset);
-#endif /* RE_ENABLE_I18N */
-  *err = REG_ESPACE;
-  return NULL;
-}
-
-/* This is intended for the expressions like "a{1,3}".
-   Fetch a number from 'input', and return the number.
-   Return REG_MISSING if the number field is empty like "{,1}".
-   Return RE_DUP_MAX + 1 if the number field is too large.
-   Return REG_ERROR if an error occurred.  */
-
-static Idx
-fetch_number (re_string_t *input, re_token_t *token, reg_syntax_t syntax)
-{
-  Idx num = REG_MISSING;
-  unsigned char c;
-  while (1)
-    {
-      fetch_token (token, input, syntax);
-      c = token->opr.c;
-      if (BE (token->type == END_OF_RE, 0))
-	return REG_ERROR;
-      if (token->type == OP_CLOSE_DUP_NUM || c == ',')
-	break;
-      num = ((token->type != CHARACTER || c < '0' || '9' < c
-	      || num == REG_ERROR)
-	     ? REG_ERROR
-	     : num == REG_MISSING
-	     ? c - '0'
-	     : MIN (RE_DUP_MAX + 1, num * 10 + c - '0'));
-    }
-  return num;
-}
-
-#ifdef RE_ENABLE_I18N
-static void
-free_charset (re_charset_t *cset)
-{
-  re_free (cset->mbchars);
-# ifdef _LIBC
-  re_free (cset->coll_syms);
-  re_free (cset->equiv_classes);
-  re_free (cset->range_starts);
-  re_free (cset->range_ends);
-# endif
-  re_free (cset->char_classes);
-  re_free (cset);
-}
-#endif /* RE_ENABLE_I18N */
-
-/* Functions for binary tree operation.  */
-
-/* Create a tree node.  */
-
-static bin_tree_t *
-create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
-	     re_token_type_t type)
-{
-  re_token_t t;
-  t.type = type;
-  return create_token_tree (dfa, left, right, &t);
-}
-
-static bin_tree_t *
-create_token_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
-		   const re_token_t *token)
-{
-  bin_tree_t *tree;
-  if (BE (dfa->str_tree_storage_idx == BIN_TREE_STORAGE_SIZE, 0))
-    {
-      bin_tree_storage_t *storage = re_malloc (bin_tree_storage_t, 1);
-
-      if (storage == NULL)
-	return NULL;
-      storage->next = dfa->str_tree_storage;
-      dfa->str_tree_storage = storage;
-      dfa->str_tree_storage_idx = 0;
-    }
-  tree = &dfa->str_tree_storage->data[dfa->str_tree_storage_idx++];
-
-  tree->parent = NULL;
-  tree->left = left;
-  tree->right = right;
-  tree->token = *token;
-  tree->token.duplicated = 0;
-  tree->token.opt_subexp = 0;
-  tree->first = NULL;
-  tree->next = NULL;
-  tree->node_idx = REG_MISSING;
-
-  if (left != NULL)
-    left->parent = tree;
-  if (right != NULL)
-    right->parent = tree;
-  return tree;
-}
-
-/* Mark the tree SRC as an optional subexpression.
-   To be called from preorder or postorder.  */
-
-static reg_errcode_t
-mark_opt_subexp (void *extra, bin_tree_t *node)
-{
-  Idx idx = (uintptr_t) extra;
-  if (node->token.type == SUBEXP && node->token.opr.idx == idx)
-    node->token.opt_subexp = 1;
-
-  return REG_NOERROR;
-}
-
-/* Free the allocated memory inside NODE. */
-
-static void
-free_token (re_token_t *node)
-{
-#ifdef RE_ENABLE_I18N
-  if (node->type == COMPLEX_BRACKET && node->duplicated == 0)
-    free_charset (node->opr.mbcset);
-  else
-#endif /* RE_ENABLE_I18N */
-    if (node->type == SIMPLE_BRACKET && node->duplicated == 0)
-      re_free (node->opr.sbcset);
-}
-
-/* Worker function for tree walking.  Free the allocated memory inside NODE
-   and its children. */
-
-static reg_errcode_t
-free_tree (void *extra, bin_tree_t *node)
-{
-  free_token (&node->token);
-  return REG_NOERROR;
-}
-
-
-/* Duplicate the node SRC, and return new node.  This is a preorder
-   visit similar to the one implemented by the generic visitor, but
-   we need more infrastructure to maintain two parallel trees --- so,
-   it's easier to duplicate.  */
-
-static bin_tree_t *
-duplicate_tree (const bin_tree_t *root, re_dfa_t *dfa)
-{
-  const bin_tree_t *node;
-  bin_tree_t *dup_root;
-  bin_tree_t **p_new = &dup_root, *dup_node = root->parent;
-
-  for (node = root; ; )
-    {
-      /* Create a new tree and link it back to the current parent.  */
-      *p_new = create_token_tree (dfa, NULL, NULL, &node->token);
-      if (*p_new == NULL)
-	return NULL;
-      (*p_new)->parent = dup_node;
-      (*p_new)->token.duplicated = 1;
-      dup_node = *p_new;
-
-      /* Go to the left node, or up and to the right.  */
-      if (node->left)
-	{
-	  node = node->left;
-	  p_new = &dup_node->left;
-	}
-      else
-	{
-	  const bin_tree_t *prev = NULL;
-	  while (node->right == prev || node->right == NULL)
-	    {
-	      prev = node;
-	      node = node->parent;
-	      dup_node = dup_node->parent;
-	      if (!node)
-		return dup_root;
-	    }
-	  node = node->right;
-	  p_new = &dup_node->right;
-	}
-    }
-}

+ 0 - 81
gl/regex.c~

@@ -1,81 +0,0 @@
-/* Extended regular expression matching and search library.
-   Copyright (C) 2002-2013 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public
-   License as published by the Free Software Foundation; either
-   version 3 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef _LIBC
-# include <config.h>
-
-# if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__
-#  pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
-# endif
-# if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
-#  pragma GCC diagnostic ignored "-Wold-style-definition"
-#  pragma GCC diagnostic ignored "-Wtype-limits"
-# endif
-#endif
-
-/* Make sure no one compiles this code with a C++ compiler.  */
-#if defined __cplusplus && defined _LIBC
-# error "This is C code, use a C compiler"
-#endif
-
-#ifdef _LIBC
-/* We have to keep the namespace clean.  */
-# define regfree(preg) __regfree (preg)
-# define regexec(pr, st, nm, pm, ef) __regexec (pr, st, nm, pm, ef)
-# define regcomp(preg, pattern, cflags) __regcomp (preg, pattern, cflags)
-# define regerror(errcode, preg, errbuf, errbuf_size) \
-	__regerror(errcode, preg, errbuf, errbuf_size)
-# define re_set_registers(bu, re, nu, st, en) \
-	__re_set_registers (bu, re, nu, st, en)
-# define re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop) \
-	__re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
-# define re_match(bufp, string, size, pos, regs) \
-	__re_match (bufp, string, size, pos, regs)
-# define re_search(bufp, string, size, startpos, range, regs) \
-	__re_search (bufp, string, size, startpos, range, regs)
-# define re_compile_pattern(pattern, length, bufp) \
-	__re_compile_pattern (pattern, length, bufp)
-# define re_set_syntax(syntax) __re_set_syntax (syntax)
-# define re_search_2(bufp, st1, s1, st2, s2, startpos, range, regs, stop) \
-	__re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop)
-# define re_compile_fastmap(bufp) __re_compile_fastmap (bufp)
-
-# include "../locale/localeinfo.h"
-#endif
-
-/* On some systems, limits.h sets RE_DUP_MAX to a lower value than
-   GNU regex allows.  Include it before <regex.h>, which correctly
-   #undefs RE_DUP_MAX and sets it to the right value.  */
-#include <limits.h>
-
-#include <regex.h>
-#include "regex_internal.h"
-
-#include "regex_internal.c"
-#include "regcomp.c"
-#include "regexec.c"
-
-/* Binary backward compatibility.  */
-#if _LIBC
-# include <shlib-compat.h>
-# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3)
-link_warning (re_max_failures, "the 're_max_failures' variable is obsolete and will go away.")
-int re_max_failures = 2000;
-# endif
-#endif

+ 0 - 667
gl/regex.h~

@@ -1,667 +0,0 @@
-/* Definitions for data structures and routines for the regular
-   expression library.
-   Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2013 Free Software
-   Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public
-   License as published by the Free Software Foundation; either
-   version 3 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef NAGIOS_REGEX_H_INCLUDED
-#define NAGIOS_REGEX_H_INCLUDED
-
-#include <sys/types.h>
-
-/* Allow the use in C++ code.  */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Define __USE_GNU to declare GNU extensions that violate the
-   POSIX name space rules.  */
-#ifdef _GNU_SOURCE
-# define __USE_GNU 1
-#endif
-
-#ifdef _REGEX_LARGE_OFFSETS
-
-/* Use types and values that are wide enough to represent signed and
-   unsigned byte offsets in memory.  This currently works only when
-   the regex code is used outside of the GNU C library; it is not yet
-   supported within glibc itself, and glibc users should not define
-   _REGEX_LARGE_OFFSETS.  */
-
-/* The type of nonnegative object indexes.  Traditionally, GNU regex
-   uses 'int' for these.  Code that uses __re_idx_t should work
-   regardless of whether the type is signed.  */
-typedef size_t __re_idx_t;
-
-/* The type of object sizes.  */
-typedef size_t __re_size_t;
-
-/* The type of object sizes, in places where the traditional code
-   uses unsigned long int.  */
-typedef size_t __re_long_size_t;
-
-#else
-
-/* The traditional GNU regex implementation mishandles strings longer
-   than INT_MAX.  */
-typedef int __re_idx_t;
-typedef unsigned int __re_size_t;
-typedef unsigned long int __re_long_size_t;
-
-#endif
-
-/* The following two types have to be signed and unsigned integer type
-   wide enough to hold a value of a pointer.  For most ANSI compilers
-   ptrdiff_t and size_t should be likely OK.  Still size of these two
-   types is 2 for Microsoft C.  Ugh... */
-typedef long int s_reg_t;
-typedef unsigned long int active_reg_t;
-
-/* The following bits are used to determine the regexp syntax we
-   recognize.  The set/not-set meanings are chosen so that Emacs syntax
-   remains the value 0.  The bits are given in alphabetical order, and
-   the definitions shifted by one from the previous bit; thus, when we
-   add or remove a bit, only one other definition need change.  */
-typedef unsigned long int reg_syntax_t;
-
-#ifdef __USE_GNU
-/* If this bit is not set, then \ inside a bracket expression is literal.
-   If set, then such a \ quotes the following character.  */
-# define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)
-
-/* If this bit is not set, then + and ? are operators, and \+ and \? are
-     literals.
-   If set, then \+ and \? are operators and + and ? are literals.  */
-# define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
-
-/* If this bit is set, then character classes are supported.  They are:
-     [:alpha:], [:upper:], [:lower:],  [:digit:], [:alnum:], [:xdigit:],
-     [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
-   If not set, then character classes are not supported.  */
-# define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
-
-/* If this bit is set, then ^ and $ are always anchors (outside bracket
-     expressions, of course).
-   If this bit is not set, then it depends:
-	^  is an anchor if it is at the beginning of a regular
-	   expression or after an open-group or an alternation operator;
-	$  is an anchor if it is at the end of a regular expression, or
-	   before a close-group or an alternation operator.
-
-   This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
-   POSIX draft 11.2 says that * etc. in leading positions is undefined.
-   We already implemented a previous draft which made those constructs
-   invalid, though, so we haven't changed the code back.  */
-# define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
-
-/* If this bit is set, then special characters are always special
-     regardless of where they are in the pattern.
-   If this bit is not set, then special characters are special only in
-     some contexts; otherwise they are ordinary.  Specifically,
-     * + ? and intervals are only special when not after the beginning,
-     open-group, or alternation operator.  */
-# define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
-
-/* If this bit is set, then *, +, ?, and { cannot be first in an re or
-     immediately after an alternation or begin-group operator.  */
-# define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
-
-/* If this bit is set, then . matches newline.
-   If not set, then it doesn't.  */
-# define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
-
-/* If this bit is set, then . doesn't match NUL.
-   If not set, then it does.  */
-# define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
-
-/* If this bit is set, nonmatching lists [^...] do not match newline.
-   If not set, they do.  */
-# define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
-
-/* If this bit is set, either \{...\} or {...} defines an
-     interval, depending on RE_NO_BK_BRACES.
-   If not set, \{, \}, {, and } are literals.  */
-# define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
-
-/* If this bit is set, +, ? and | aren't recognized as operators.
-   If not set, they are.  */
-# define RE_LIMITED_OPS (RE_INTERVALS << 1)
-
-/* If this bit is set, newline is an alternation operator.
-   If not set, newline is literal.  */
-# define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
-
-/* If this bit is set, then '{...}' defines an interval, and \{ and \}
-     are literals.
-  If not set, then '\{...\}' defines an interval.  */
-# define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
-
-/* If this bit is set, (...) defines a group, and \( and \) are literals.
-   If not set, \(...\) defines a group, and ( and ) are literals.  */
-# define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
-
-/* If this bit is set, then \<digit> matches <digit>.
-   If not set, then \<digit> is a back-reference.  */
-# define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
-
-/* If this bit is set, then | is an alternation operator, and \| is literal.
-   If not set, then \| is an alternation operator, and | is literal.  */
-# define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
-
-/* If this bit is set, then an ending range point collating higher
-     than the starting range point, as in [z-a], is invalid.
-   If not set, then when ending range point collates higher than the
-     starting range point, the range is ignored.  */
-# define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
-
-/* If this bit is set, then an unmatched ) is ordinary.
-   If not set, then an unmatched ) is invalid.  */
-# define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
-
-/* If this bit is set, succeed as soon as we match the whole pattern,
-   without further backtracking.  */
-# define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)
-
-/* If this bit is set, do not process the GNU regex operators.
-   If not set, then the GNU regex operators are recognized. */
-# define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1)
-
-/* If this bit is set, turn on internal regex debugging.
-   If not set, and debugging was on, turn it off.
-   This only works if regex.c is compiled -DDEBUG.
-   We define this bit always, so that all that's needed to turn on
-   debugging is to recompile regex.c; the calling code can always have
-   this bit set, and it won't affect anything in the normal case. */
-# define RE_DEBUG (RE_NO_GNU_OPS << 1)
-
-/* If this bit is set, a syntactically invalid interval is treated as
-   a string of ordinary characters.  For example, the ERE 'a{1' is
-   treated as 'a\{1'.  */
-# define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)
-
-/* If this bit is set, then ignore case when matching.
-   If not set, then case is significant.  */
-# define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
-
-/* This bit is used internally like RE_CONTEXT_INDEP_ANCHORS but only
-   for ^, because it is difficult to scan the regex backwards to find
-   whether ^ should be special.  */
-# define RE_CARET_ANCHORS_HERE (RE_ICASE << 1)
-
-/* If this bit is set, then \{ cannot be first in a regex or
-   immediately after an alternation, open-group or \} operator.  */
-# define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 1)
-
-/* If this bit is set, then no_sub will be set to 1 during
-   re_compile_pattern.  */
-# define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1)
-#endif
-
-/* This global variable defines the particular regexp syntax to use (for
-   some interfaces).  When a regexp is compiled, the syntax used is
-   stored in the pattern buffer, so changing this does not affect
-   already-compiled regexps.  */
-extern reg_syntax_t re_syntax_options;
-
-#ifdef __USE_GNU
-/* Define combinations of the above bits for the standard possibilities.
-   (The [[[ comments delimit what gets put into the Texinfo file, so
-   don't delete them!)  */
-/* [[[begin syntaxes]]] */
-# define RE_SYNTAX_EMACS 0
-
-# define RE_SYNTAX_AWK							\
-  (RE_BACKSLASH_ESCAPE_IN_LISTS   | RE_DOT_NOT_NULL			\
-   | RE_NO_BK_PARENS              | RE_NO_BK_REFS			\
-   | RE_NO_BK_VBAR                | RE_NO_EMPTY_RANGES			\
-   | RE_DOT_NEWLINE		  | RE_CONTEXT_INDEP_ANCHORS		\
-   | RE_CHAR_CLASSES							\
-   | RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS)
-
-# define RE_SYNTAX_GNU_AWK						\
-  ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS		\
-    | RE_INVALID_INTERVAL_ORD)						\
-   & ~(RE_DOT_NOT_NULL | RE_CONTEXT_INDEP_OPS				\
-      | RE_CONTEXT_INVALID_OPS ))
-
-# define RE_SYNTAX_POSIX_AWK						\
-  (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS		\
-   | RE_INTERVALS	    | RE_NO_GNU_OPS				\
-   | RE_INVALID_INTERVAL_ORD)
-
-# define RE_SYNTAX_GREP							\
-  (RE_BK_PLUS_QM              | RE_CHAR_CLASSES				\
-   | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS				\
-   | RE_NEWLINE_ALT)
-
-# define RE_SYNTAX_EGREP						\
-  (RE_CHAR_CLASSES        | RE_CONTEXT_INDEP_ANCHORS			\
-   | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE			\
-   | RE_NEWLINE_ALT       | RE_NO_BK_PARENS				\
-   | RE_NO_BK_VBAR)
-
-# define RE_SYNTAX_POSIX_EGREP						\
-  (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES			\
-   | RE_INVALID_INTERVAL_ORD)
-
-/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff.  */
-# define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
-
-# define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
-
-/* Syntax bits common to both basic and extended POSIX regex syntax.  */
-# define _RE_SYNTAX_POSIX_COMMON					\
-  (RE_CHAR_CLASSES | RE_DOT_NEWLINE      | RE_DOT_NOT_NULL		\
-   | RE_INTERVALS  | RE_NO_EMPTY_RANGES)
-
-# define RE_SYNTAX_POSIX_BASIC						\
-  (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM | RE_CONTEXT_INVALID_DUP)
-
-/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
-   RE_LIMITED_OPS, i.e., \? \+ \| are not recognized.  Actually, this
-   isn't minimal, since other operators, such as \`, aren't disabled.  */
-# define RE_SYNTAX_POSIX_MINIMAL_BASIC					\
-  (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
-
-# define RE_SYNTAX_POSIX_EXTENDED					\
-  (_RE_SYNTAX_POSIX_COMMON  | RE_CONTEXT_INDEP_ANCHORS			\
-   | RE_CONTEXT_INDEP_OPS   | RE_NO_BK_BRACES				\
-   | RE_NO_BK_PARENS        | RE_NO_BK_VBAR				\
-   | RE_CONTEXT_INVALID_OPS | RE_UNMATCHED_RIGHT_PAREN_ORD)
-
-/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INDEP_OPS is
-   removed and RE_NO_BK_REFS is added.  */
-# define RE_SYNTAX_POSIX_MINIMAL_EXTENDED				\
-  (_RE_SYNTAX_POSIX_COMMON  | RE_CONTEXT_INDEP_ANCHORS			\
-   | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES				\
-   | RE_NO_BK_PARENS        | RE_NO_BK_REFS				\
-   | RE_NO_BK_VBAR	    | RE_UNMATCHED_RIGHT_PAREN_ORD)
-/* [[[end syntaxes]]] */
-
-/* Maximum number of duplicates an interval can allow.  POSIX-conforming
-   systems might define this in <limits.h>, but we want our
-   value, so remove any previous define.  */
-# ifdef _REGEX_INCLUDE_LIMITS_H
-#  include <limits.h>
-# endif
-# ifdef RE_DUP_MAX
-#  undef RE_DUP_MAX
-# endif
-
-/* RE_DUP_MAX is 2**15 - 1 because an earlier implementation stored
-   the counter as a 2-byte signed integer.  This is no longer true, so
-   RE_DUP_MAX could be increased to (INT_MAX / 10 - 1), or to
-   ((SIZE_MAX - 9) / 10) if _REGEX_LARGE_OFFSETS is defined.
-   However, there would be a huge performance problem if someone
-   actually used a pattern like a\{214748363\}, so RE_DUP_MAX retains
-   its historical value.  */
-# define RE_DUP_MAX (0x7fff)
-#endif
-
-
-/* POSIX 'cflags' bits (i.e., information for 'regcomp').  */
-
-/* If this bit is set, then use extended regular expression syntax.
-   If not set, then use basic regular expression syntax.  */
-#define REG_EXTENDED 1
-
-/* If this bit is set, then ignore case when matching.
-   If not set, then case is significant.  */
-#define REG_ICASE (1 << 1)
-
-/* If this bit is set, then anchors do not match at newline
-     characters in the string.
-   If not set, then anchors do match at newlines.  */
-#define REG_NEWLINE (1 << 2)
-
-/* If this bit is set, then report only success or fail in regexec.
-   If not set, then returns differ between not matching and errors.  */
-#define REG_NOSUB (1 << 3)
-
-
-/* POSIX 'eflags' bits (i.e., information for regexec).  */
-
-/* If this bit is set, then the beginning-of-line operator doesn't match
-     the beginning of the string (presumably because it's not the
-     beginning of a line).
-   If not set, then the beginning-of-line operator does match the
-     beginning of the string.  */
-#define REG_NOTBOL 1
-
-/* Like REG_NOTBOL, except for the end-of-line.  */
-#define REG_NOTEOL (1 << 1)
-
-/* Use PMATCH[0] to delimit the start and end of the search in the
-   buffer.  */
-#define REG_STARTEND (1 << 2)
-
-
-/* If any error codes are removed, changed, or added, update the
-   '__re_error_msgid' table in regcomp.c.  */
-
-typedef enum
-{
-  _REG_ENOSYS = -1,	/* This will never happen for this implementation.  */
-  _REG_NOERROR = 0,	/* Success.  */
-  _REG_NOMATCH,		/* Didn't find a match (for regexec).  */
-
-  /* POSIX regcomp return error codes.  (In the order listed in the
-     standard.)  */
-  _REG_BADPAT,		/* Invalid pattern.  */
-  _REG_ECOLLATE,	/* Invalid collating element.  */
-  _REG_ECTYPE,		/* Invalid character class name.  */
-  _REG_EESCAPE,		/* Trailing backslash.  */
-  _REG_ESUBREG,		/* Invalid back reference.  */
-  _REG_EBRACK,		/* Unmatched left bracket.  */
-  _REG_EPAREN,		/* Parenthesis imbalance.  */
-  _REG_EBRACE,		/* Unmatched \{.  */
-  _REG_BADBR,		/* Invalid contents of \{\}.  */
-  _REG_ERANGE,		/* Invalid range end.  */
-  _REG_ESPACE,		/* Ran out of memory.  */
-  _REG_BADRPT,		/* No preceding re for repetition op.  */
-
-  /* Error codes we've added.  */
-  _REG_EEND,		/* Premature end.  */
-  _REG_ESIZE,		/* Too large (e.g., repeat count too large).  */
-  _REG_ERPAREN		/* Unmatched ) or \); not returned from regcomp.  */
-} reg_errcode_t;
-
-#if defined _XOPEN_SOURCE || defined __USE_XOPEN2K
-# define REG_ENOSYS	_REG_ENOSYS
-#endif
-#define REG_NOERROR	_REG_NOERROR
-#define REG_NOMATCH	_REG_NOMATCH
-#define REG_BADPAT	_REG_BADPAT
-#define REG_ECOLLATE	_REG_ECOLLATE
-#define REG_ECTYPE	_REG_ECTYPE
-#define REG_EESCAPE	_REG_EESCAPE
-#define REG_ESUBREG	_REG_ESUBREG
-#define REG_EBRACK	_REG_EBRACK
-#define REG_EPAREN	_REG_EPAREN
-#define REG_EBRACE	_REG_EBRACE
-#define REG_BADBR	_REG_BADBR
-#define REG_ERANGE	_REG_ERANGE
-#define REG_ESPACE	_REG_ESPACE
-#define REG_BADRPT	_REG_BADRPT
-#define REG_EEND	_REG_EEND
-#define REG_ESIZE	_REG_ESIZE
-#define REG_ERPAREN	_REG_ERPAREN
-
-/* This data structure represents a compiled pattern.  Before calling
-   the pattern compiler, the fields 'buffer', 'allocated', 'fastmap',
-   and 'translate' can be set.  After the pattern has been compiled,
-   the fields 're_nsub', 'not_bol' and 'not_eol' are available.  All
-   other fields are private to the regex routines.  */
-
-#ifndef RE_TRANSLATE_TYPE
-# define __RE_TRANSLATE_TYPE unsigned char *
-# ifdef __USE_GNU
-#  define RE_TRANSLATE_TYPE __RE_TRANSLATE_TYPE
-# endif
-#endif
-
-#ifdef __USE_GNU
-# define __REPB_PREFIX(name) name
-#else
-# define __REPB_PREFIX(name) __##name
-#endif
-
-struct re_pattern_buffer
-{
-  /* Space that holds the compiled pattern.  The type
-     'struct re_dfa_t' is private and is not declared here.  */
-  struct re_dfa_t *__REPB_PREFIX(buffer);
-
-  /* Number of bytes to which 'buffer' points.  */
-  __re_long_size_t __REPB_PREFIX(allocated);
-
-  /* Number of bytes actually used in 'buffer'.  */
-  __re_long_size_t __REPB_PREFIX(used);
-
-  /* Syntax setting with which the pattern was compiled.  */
-  reg_syntax_t __REPB_PREFIX(syntax);
-
-  /* Pointer to a fastmap, if any, otherwise zero.  re_search uses the
-     fastmap, if there is one, to skip over impossible starting points
-     for matches.  */
-  char *__REPB_PREFIX(fastmap);
-
-  /* Either a translate table to apply to all characters before
-     comparing them, or zero for no translation.  The translation is
-     applied to a pattern when it is compiled and to a string when it
-     is matched.  */
-  __RE_TRANSLATE_TYPE __REPB_PREFIX(translate);
-
-  /* Number of subexpressions found by the compiler.  */
-  size_t re_nsub;
-
-  /* Zero if this pattern cannot match the empty string, one else.
-     Well, in truth it's used only in 're_search_2', to see whether or
-     not we should use the fastmap, so we don't set this absolutely
-     perfectly; see 're_compile_fastmap' (the "duplicate" case).  */
-  unsigned __REPB_PREFIX(can_be_null) : 1;
-
-  /* If REGS_UNALLOCATED, allocate space in the 'regs' structure
-     for 'max (RE_NREGS, re_nsub + 1)' groups.
-     If REGS_REALLOCATE, reallocate space if necessary.
-     If REGS_FIXED, use what's there.  */
-#ifdef __USE_GNU
-# define REGS_UNALLOCATED 0
-# define REGS_REALLOCATE 1
-# define REGS_FIXED 2
-#endif
-  unsigned __REPB_PREFIX(regs_allocated) : 2;
-
-  /* Set to zero when 're_compile_pattern' compiles a pattern; set to
-     one by 're_compile_fastmap' if it updates the fastmap.  */
-  unsigned __REPB_PREFIX(fastmap_accurate) : 1;
-
-  /* If set, 're_match_2' does not return information about
-     subexpressions.  */
-  unsigned __REPB_PREFIX(no_sub) : 1;
-
-  /* If set, a beginning-of-line anchor doesn't match at the beginning
-     of the string.  */
-  unsigned __REPB_PREFIX(not_bol) : 1;
-
-  /* Similarly for an end-of-line anchor.  */
-  unsigned __REPB_PREFIX(not_eol) : 1;
-
-  /* If true, an anchor at a newline matches.  */
-  unsigned __REPB_PREFIX(newline_anchor) : 1;
-};
-
-typedef struct re_pattern_buffer regex_t;
-
-/* Type for byte offsets within the string.  POSIX mandates this.  */
-#ifdef _REGEX_LARGE_OFFSETS
-/* POSIX 1003.1-2008 requires that regoff_t be at least as wide as
-   ptrdiff_t and ssize_t.  We don't know of any hosts where ptrdiff_t
-   is wider than ssize_t, so ssize_t is safe.  */
-typedef ssize_t regoff_t;
-#else
-/* The traditional GNU regex implementation mishandles strings longer
-   than INT_MAX.  */
-typedef int regoff_t;
-#endif
-
-
-#ifdef __USE_GNU
-/* This is the structure we store register match data in.  See
-   regex.texinfo for a full description of what registers match.  */
-struct re_registers
-{
-  __re_size_t num_regs;
-  regoff_t *start;
-  regoff_t *end;
-};
-
-
-/* If 'regs_allocated' is REGS_UNALLOCATED in the pattern buffer,
-   're_match_2' returns information about at least this many registers
-   the first time a 'regs' structure is passed.  */
-# ifndef RE_NREGS
-#  define RE_NREGS 30
-# endif
-#endif
-
-
-/* POSIX specification for registers.  Aside from the different names than
-   're_registers', POSIX uses an array of structures, instead of a
-   structure of arrays.  */
-typedef struct
-{
-  regoff_t rm_so;  /* Byte offset from string's start to substring's start.  */
-  regoff_t rm_eo;  /* Byte offset from string's start to substring's end.  */
-} regmatch_t;
-
-/* Declarations for routines.  */
-
-#ifdef __USE_GNU
-/* Sets the current default syntax to SYNTAX, and return the old syntax.
-   You can also simply assign to the 're_syntax_options' variable.  */
-extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax);
-
-/* Compile the regular expression PATTERN, with length LENGTH
-   and syntax given by the global 're_syntax_options', into the buffer
-   BUFFER.  Return NULL if successful, and an error string if not.
-
-   To free the allocated storage, you must call 'regfree' on BUFFER.
-   Note that the translate table must either have been initialised by
-   'regcomp', with a malloc'ed value, or set to NULL before calling
-   'regfree'.  */
-extern const char *re_compile_pattern (const char *__pattern, size_t __length,
-				       struct re_pattern_buffer *__buffer);
-
-
-/* Compile a fastmap for the compiled pattern in BUFFER; used to
-   accelerate searches.  Return 0 if successful and -2 if was an
-   internal error.  */
-extern int re_compile_fastmap (struct re_pattern_buffer *__buffer);
-
-
-/* Search in the string STRING (with length LENGTH) for the pattern
-   compiled into BUFFER.  Start searching at position START, for RANGE
-   characters.  Return the starting position of the match, -1 for no
-   match, or -2 for an internal error.  Also return register
-   information in REGS (if REGS and BUFFER->no_sub are nonzero).  */
-extern regoff_t re_search (struct re_pattern_buffer *__buffer,
-			   const char *__string, __re_idx_t __length,
-			   __re_idx_t __start, regoff_t __range,
-			   struct re_registers *__regs);
-
-
-/* Like 're_search', but search in the concatenation of STRING1 and
-   STRING2.  Also, stop searching at index START + STOP.  */
-extern regoff_t re_search_2 (struct re_pattern_buffer *__buffer,
-			     const char *__string1, __re_idx_t __length1,
-			     const char *__string2, __re_idx_t __length2,
-			     __re_idx_t __start, regoff_t __range,
-			     struct re_registers *__regs,
-			     __re_idx_t __stop);
-
-
-/* Like 're_search', but return how many characters in STRING the regexp
-   in BUFFER matched, starting at position START.  */
-extern regoff_t re_match (struct re_pattern_buffer *__buffer,
-			  const char *__string, __re_idx_t __length,
-			  __re_idx_t __start, struct re_registers *__regs);
-
-
-/* Relates to 're_match' as 're_search_2' relates to 're_search'.  */
-extern regoff_t re_match_2 (struct re_pattern_buffer *__buffer,
-			    const char *__string1, __re_idx_t __length1,
-			    const char *__string2, __re_idx_t __length2,
-			    __re_idx_t __start, struct re_registers *__regs,
-			    __re_idx_t __stop);
-
-
-/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
-   ENDS.  Subsequent matches using BUFFER and REGS will use this memory
-   for recording register information.  STARTS and ENDS must be
-   allocated with malloc, and must each be at least 'NUM_REGS * sizeof
-   (regoff_t)' bytes long.
-
-   If NUM_REGS == 0, then subsequent matches should allocate their own
-   register data.
-
-   Unless this function is called, the first search or match using
-   BUFFER will allocate its own register data, without
-   freeing the old data.  */
-extern void re_set_registers (struct re_pattern_buffer *__buffer,
-			      struct re_registers *__regs,
-			      __re_size_t __num_regs,
-			      regoff_t *__starts, regoff_t *__ends);
-#endif	/* Use GNU */
-
-#if defined _REGEX_RE_COMP || (defined _LIBC && defined __USE_BSD)
-# ifndef _CRAY
-/* 4.2 bsd compatibility.  */
-extern char *re_comp (const char *);
-extern int re_exec (const char *);
-# endif
-#endif
-
-/* GCC 2.95 and later have "__restrict"; C99 compilers have
-   "restrict", and "configure" may have defined "restrict".
-   Other compilers use __restrict, __restrict__, and _Restrict, and
-   'configure' might #define 'restrict' to those words, so pick a
-   different name.  */
-#ifndef _Restrict_
-# if 199901L <= __STDC_VERSION__
-#  define _Restrict_ restrict
-# elif 2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)
-#  define _Restrict_ __restrict
-# else
-#  define _Restrict_
-# endif
-#endif
-/* gcc 3.1 and up support the [restrict] syntax.  Don't trust
-   sys/cdefs.h's definition of __restrict_arr, though, as it
-   mishandles gcc -ansi -pedantic.  */
-#ifndef _Restrict_arr_
-# if ((199901L <= __STDC_VERSION__					\
-       || ((3 < __GNUC__ || (3 == __GNUC__ && 1 <= __GNUC_MINOR__))	\
-	   && !defined __STRICT_ANSI__))					\
-      && !defined __GNUG__)
-#  define _Restrict_arr_ _Restrict_
-# else
-#  define _Restrict_arr_
-# endif
-#endif
-
-/* POSIX compatibility.  */
-extern int regcomp (regex_t *_Restrict_ __preg,
-		    const char *_Restrict_ __pattern,
-		    int __cflags);
-
-extern int regexec (const regex_t *_Restrict_ __preg,
-		    const char *_Restrict_ __string, size_t __nmatch,
-		    regmatch_t __pmatch[_Restrict_arr_],
-		    int __eflags);
-
-extern size_t regerror (int __errcode, const regex_t *_Restrict_ __preg,
-			char *_Restrict_ __errbuf, size_t __errbuf_size);
-
-extern void regfree (regex_t *__preg);
-
-
-#ifdef __cplusplus
-}
-#endif	/* C++ */
-
-#endif /* regex.h */

+ 0 - 1741
gl/regex_internal.c~

@@ -1,1741 +0,0 @@
-/* Extended regular expression matching and search library.
-   Copyright (C) 2002-2013 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public
-   License as published by the Free Software Foundation; either
-   version 3 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-static void re_string_construct_common (const char *str, Idx len,
-					re_string_t *pstr,
-					RE_TRANSLATE_TYPE trans, bool icase,
-					const re_dfa_t *dfa) internal_function;
-static re_dfastate_t *create_ci_newstate (const re_dfa_t *dfa,
-					  const re_node_set *nodes,
-					  re_hashval_t hash) internal_function;
-static re_dfastate_t *create_cd_newstate (const re_dfa_t *dfa,
-					  const re_node_set *nodes,
-					  unsigned int context,
-					  re_hashval_t hash) internal_function;
-
-/* Functions for string operation.  */
-
-/* This function allocate the buffers.  It is necessary to call
-   re_string_reconstruct before using the object.  */
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-re_string_allocate (re_string_t *pstr, const char *str, Idx len, Idx init_len,
-		    RE_TRANSLATE_TYPE trans, bool icase, const re_dfa_t *dfa)
-{
-  reg_errcode_t ret;
-  Idx init_buf_len;
-
-  /* Ensure at least one character fits into the buffers.  */
-  if (init_len < dfa->mb_cur_max)
-    init_len = dfa->mb_cur_max;
-  init_buf_len = (len + 1 < init_len) ? len + 1: init_len;
-  re_string_construct_common (str, len, pstr, trans, icase, dfa);
-
-  ret = re_string_realloc_buffers (pstr, init_buf_len);
-  if (BE (ret != REG_NOERROR, 0))
-    return ret;
-
-  pstr->word_char = dfa->word_char;
-  pstr->word_ops_used = dfa->word_ops_used;
-  pstr->mbs = pstr->mbs_allocated ? pstr->mbs : (unsigned char *) str;
-  pstr->valid_len = (pstr->mbs_allocated || dfa->mb_cur_max > 1) ? 0 : len;
-  pstr->valid_raw_len = pstr->valid_len;
-  return REG_NOERROR;
-}
-
-/* This function allocate the buffers, and initialize them.  */
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-re_string_construct (re_string_t *pstr, const char *str, Idx len,
-		     RE_TRANSLATE_TYPE trans, bool icase, const re_dfa_t *dfa)
-{
-  reg_errcode_t ret;
-  memset (pstr, '\0', sizeof (re_string_t));
-  re_string_construct_common (str, len, pstr, trans, icase, dfa);
-
-  if (len > 0)
-    {
-      ret = re_string_realloc_buffers (pstr, len + 1);
-      if (BE (ret != REG_NOERROR, 0))
-	return ret;
-    }
-  pstr->mbs = pstr->mbs_allocated ? pstr->mbs : (unsigned char *) str;
-
-  if (icase)
-    {
-#ifdef RE_ENABLE_I18N
-      if (dfa->mb_cur_max > 1)
-	{
-	  while (1)
-	    {
-	      ret = build_wcs_upper_buffer (pstr);
-	      if (BE (ret != REG_NOERROR, 0))
-		return ret;
-	      if (pstr->valid_raw_len >= len)
-		break;
-	      if (pstr->bufs_len > pstr->valid_len + dfa->mb_cur_max)
-		break;
-	      ret = re_string_realloc_buffers (pstr, pstr->bufs_len * 2);
-	      if (BE (ret != REG_NOERROR, 0))
-		return ret;
-	    }
-	}
-      else
-#endif /* RE_ENABLE_I18N  */
-	build_upper_buffer (pstr);
-    }
-  else
-    {
-#ifdef RE_ENABLE_I18N
-      if (dfa->mb_cur_max > 1)
-	build_wcs_buffer (pstr);
-      else
-#endif /* RE_ENABLE_I18N  */
-	{
-	  if (trans != NULL)
-	    re_string_translate_buffer (pstr);
-	  else
-	    {
-	      pstr->valid_len = pstr->bufs_len;
-	      pstr->valid_raw_len = pstr->bufs_len;
-	    }
-	}
-    }
-
-  return REG_NOERROR;
-}
-
-/* Helper functions for re_string_allocate, and re_string_construct.  */
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-re_string_realloc_buffers (re_string_t *pstr, Idx new_buf_len)
-{
-#ifdef RE_ENABLE_I18N
-  if (pstr->mb_cur_max > 1)
-    {
-      wint_t *new_wcs;
-
-      /* Avoid overflow in realloc.  */
-      const size_t max_object_size = MAX (sizeof (wint_t), sizeof (Idx));
-      if (BE (MIN (IDX_MAX, SIZE_MAX / max_object_size) < new_buf_len, 0))
-	return REG_ESPACE;
-
-      new_wcs = re_realloc (pstr->wcs, wint_t, new_buf_len);
-      if (BE (new_wcs == NULL, 0))
-	return REG_ESPACE;
-      pstr->wcs = new_wcs;
-      if (pstr->offsets != NULL)
-	{
-	  Idx *new_offsets = re_realloc (pstr->offsets, Idx, new_buf_len);
-	  if (BE (new_offsets == NULL, 0))
-	    return REG_ESPACE;
-	  pstr->offsets = new_offsets;
-	}
-    }
-#endif /* RE_ENABLE_I18N  */
-  if (pstr->mbs_allocated)
-    {
-      unsigned char *new_mbs = re_realloc (pstr->mbs, unsigned char,
-					   new_buf_len);
-      if (BE (new_mbs == NULL, 0))
-	return REG_ESPACE;
-      pstr->mbs = new_mbs;
-    }
-  pstr->bufs_len = new_buf_len;
-  return REG_NOERROR;
-}
-
-
-static void
-internal_function
-re_string_construct_common (const char *str, Idx len, re_string_t *pstr,
-			    RE_TRANSLATE_TYPE trans, bool icase,
-			    const re_dfa_t *dfa)
-{
-  pstr->raw_mbs = (const unsigned char *) str;
-  pstr->len = len;
-  pstr->raw_len = len;
-  pstr->trans = trans;
-  pstr->icase = icase;
-  pstr->mbs_allocated = (trans != NULL || icase);
-  pstr->mb_cur_max = dfa->mb_cur_max;
-  pstr->is_utf8 = dfa->is_utf8;
-  pstr->map_notascii = dfa->map_notascii;
-  pstr->stop = pstr->len;
-  pstr->raw_stop = pstr->stop;
-}
-
-#ifdef RE_ENABLE_I18N
-
-/* Build wide character buffer PSTR->WCS.
-   If the byte sequence of the string are:
-     <mb1>(0), <mb1>(1), <mb2>(0), <mb2>(1), <sb3>
-   Then wide character buffer will be:
-     <wc1>   , WEOF    , <wc2>   , WEOF    , <wc3>
-   We use WEOF for padding, they indicate that the position isn't
-   a first byte of a multibyte character.
-
-   Note that this function assumes PSTR->VALID_LEN elements are already
-   built and starts from PSTR->VALID_LEN.  */
-
-static void
-internal_function
-build_wcs_buffer (re_string_t *pstr)
-{
-#ifdef _LIBC
-  unsigned char buf[MB_LEN_MAX];
-  assert (MB_LEN_MAX >= pstr->mb_cur_max);
-#else
-  unsigned char buf[64];
-#endif
-  mbstate_t prev_st;
-  Idx byte_idx, end_idx, remain_len;
-  size_t mbclen;
-
-  /* Build the buffers from pstr->valid_len to either pstr->len or
-     pstr->bufs_len.  */
-  end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len;
-  for (byte_idx = pstr->valid_len; byte_idx < end_idx;)
-    {
-      wchar_t wc;
-      const char *p;
-
-      remain_len = end_idx - byte_idx;
-      prev_st = pstr->cur_state;
-      /* Apply the translation if we need.  */
-      if (BE (pstr->trans != NULL, 0))
-	{
-	  int i, ch;
-
-	  for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i)
-	    {
-	      ch = pstr->raw_mbs [pstr->raw_mbs_idx + byte_idx + i];
-	      buf[i] = pstr->mbs[byte_idx + i] = pstr->trans[ch];
-	    }
-	  p = (const char *) buf;
-	}
-      else
-	p = (const char *) pstr->raw_mbs + pstr->raw_mbs_idx + byte_idx;
-      mbclen = __mbrtowc (&wc, p, remain_len, &pstr->cur_state);
-      if (BE (mbclen == (size_t) -1 || mbclen == 0
-	      || (mbclen == (size_t) -2 && pstr->bufs_len >= pstr->len), 0))
-	{
-	  /* We treat these cases as a singlebyte character.  */
-	  mbclen = 1;
-	  wc = (wchar_t) pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx];
-	  if (BE (pstr->trans != NULL, 0))
-	    wc = pstr->trans[wc];
-	  pstr->cur_state = prev_st;
-	}
-      else if (BE (mbclen == (size_t) -2, 0))
-	{
-	  /* The buffer doesn't have enough space, finish to build.  */
-	  pstr->cur_state = prev_st;
-	  break;
-	}
-
-      /* Write wide character and padding.  */
-      pstr->wcs[byte_idx++] = wc;
-      /* Write paddings.  */
-      for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;)
-	pstr->wcs[byte_idx++] = WEOF;
-    }
-  pstr->valid_len = byte_idx;
-  pstr->valid_raw_len = byte_idx;
-}
-
-/* Build wide character buffer PSTR->WCS like build_wcs_buffer,
-   but for REG_ICASE.  */
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-build_wcs_upper_buffer (re_string_t *pstr)
-{
-  mbstate_t prev_st;
-  Idx src_idx, byte_idx, end_idx, remain_len;
-  size_t mbclen;
-#ifdef _LIBC
-  char buf[MB_LEN_MAX];
-  assert (MB_LEN_MAX >= pstr->mb_cur_max);
-#else
-  char buf[64];
-#endif
-
-  byte_idx = pstr->valid_len;
-  end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len;
-
-  /* The following optimization assumes that ASCII characters can be
-     mapped to wide characters with a simple cast.  */
-  if (! pstr->map_notascii && pstr->trans == NULL && !pstr->offsets_needed)
-    {
-      while (byte_idx < end_idx)
-	{
-	  wchar_t wc;
-
-	  if (isascii (pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx])
-	      && mbsinit (&pstr->cur_state))
-	    {
-	      /* In case of a singlebyte character.  */
-	      pstr->mbs[byte_idx]
-		= toupper (pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx]);
-	      /* The next step uses the assumption that wchar_t is encoded
-		 ASCII-safe: all ASCII values can be converted like this.  */
-	      pstr->wcs[byte_idx] = (wchar_t) pstr->mbs[byte_idx];
-	      ++byte_idx;
-	      continue;
-	    }
-
-	  remain_len = end_idx - byte_idx;
-	  prev_st = pstr->cur_state;
-	  mbclen = __mbrtowc (&wc,
-			      ((const char *) pstr->raw_mbs + pstr->raw_mbs_idx
-			       + byte_idx), remain_len, &pstr->cur_state);
-	  if (BE (mbclen < (size_t) -2, 1))
-	    {
-	      wchar_t wcu = wc;
-	      if (iswlower (wc))
-		{
-		  size_t mbcdlen;
-
-		  wcu = towupper (wc);
-		  mbcdlen = wcrtomb (buf, wcu, &prev_st);
-		  if (BE (mbclen == mbcdlen, 1))
-		    memcpy (pstr->mbs + byte_idx, buf, mbclen);
-		  else
-		    {
-		      src_idx = byte_idx;
-		      goto offsets_needed;
-		    }
-		}
-	      else
-		memcpy (pstr->mbs + byte_idx,
-			pstr->raw_mbs + pstr->raw_mbs_idx + byte_idx, mbclen);
-	      pstr->wcs[byte_idx++] = wcu;
-	      /* Write paddings.  */
-	      for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;)
-		pstr->wcs[byte_idx++] = WEOF;
-	    }
-	  else if (mbclen == (size_t) -1 || mbclen == 0
-		   || (mbclen == (size_t) -2 && pstr->bufs_len >= pstr->len))
-	    {
-	      /* It is an invalid character, an incomplete character
-		 at the end of the string, or '\0'.  Just use the byte.  */
-	      int ch = pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx];
-	      pstr->mbs[byte_idx] = ch;
-	      /* And also cast it to wide char.  */
-	      pstr->wcs[byte_idx++] = (wchar_t) ch;
-	      if (BE (mbclen == (size_t) -1, 0))
-		pstr->cur_state = prev_st;
-	    }
-	  else
-	    {
-	      /* The buffer doesn't have enough space, finish to build.  */
-	      pstr->cur_state = prev_st;
-	      break;
-	    }
-	}
-      pstr->valid_len = byte_idx;
-      pstr->valid_raw_len = byte_idx;
-      return REG_NOERROR;
-    }
-  else
-    for (src_idx = pstr->valid_raw_len; byte_idx < end_idx;)
-      {
-	wchar_t wc;
-	const char *p;
-      offsets_needed:
-	remain_len = end_idx - byte_idx;
-	prev_st = pstr->cur_state;
-	if (BE (pstr->trans != NULL, 0))
-	  {
-	    int i, ch;
-
-	    for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i)
-	      {
-		ch = pstr->raw_mbs [pstr->raw_mbs_idx + src_idx + i];
-		buf[i] = pstr->trans[ch];
-	      }
-	    p = (const char *) buf;
-	  }
-	else
-	  p = (const char *) pstr->raw_mbs + pstr->raw_mbs_idx + src_idx;
-	mbclen = __mbrtowc (&wc, p, remain_len, &pstr->cur_state);
-	if (BE (mbclen < (size_t) -2, 1))
-	  {
-	    wchar_t wcu = wc;
-	    if (iswlower (wc))
-	      {
-		size_t mbcdlen;
-
-		wcu = towupper (wc);
-		mbcdlen = wcrtomb ((char *) buf, wcu, &prev_st);
-		if (BE (mbclen == mbcdlen, 1))
-		  memcpy (pstr->mbs + byte_idx, buf, mbclen);
-		else if (mbcdlen != (size_t) -1)
-		  {
-		    size_t i;
-
-		    if (byte_idx + mbcdlen > pstr->bufs_len)
-		      {
-			pstr->cur_state = prev_st;
-			break;
-		      }
-
-		    if (pstr->offsets == NULL)
-		      {
-			pstr->offsets = re_malloc (Idx, pstr->bufs_len);
-
-			if (pstr->offsets == NULL)
-			  return REG_ESPACE;
-		      }
-		    if (!pstr->offsets_needed)
-		      {
-			for (i = 0; i < (size_t) byte_idx; ++i)
-			  pstr->offsets[i] = i;
-			pstr->offsets_needed = 1;
-		      }
-
-		    memcpy (pstr->mbs + byte_idx, buf, mbcdlen);
-		    pstr->wcs[byte_idx] = wcu;
-		    pstr->offsets[byte_idx] = src_idx;
-		    for (i = 1; i < mbcdlen; ++i)
-		      {
-			pstr->offsets[byte_idx + i]
-			  = src_idx + (i < mbclen ? i : mbclen - 1);
-			pstr->wcs[byte_idx + i] = WEOF;
-		      }
-		    pstr->len += mbcdlen - mbclen;
-		    if (pstr->raw_stop > src_idx)
-		      pstr->stop += mbcdlen - mbclen;
-		    end_idx = (pstr->bufs_len > pstr->len)
-			      ? pstr->len : pstr->bufs_len;
-		    byte_idx += mbcdlen;
-		    src_idx += mbclen;
-		    continue;
-		  }
-		else
-		  memcpy (pstr->mbs + byte_idx, p, mbclen);
-	      }
-	    else
-	      memcpy (pstr->mbs + byte_idx, p, mbclen);
-
-	    if (BE (pstr->offsets_needed != 0, 0))
-	      {
-		size_t i;
-		for (i = 0; i < mbclen; ++i)
-		  pstr->offsets[byte_idx + i] = src_idx + i;
-	      }
-	    src_idx += mbclen;
-
-	    pstr->wcs[byte_idx++] = wcu;
-	    /* Write paddings.  */
-	    for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;)
-	      pstr->wcs[byte_idx++] = WEOF;
-	  }
-	else if (mbclen == (size_t) -1 || mbclen == 0
-		 || (mbclen == (size_t) -2 && pstr->bufs_len >= pstr->len))
-	  {
-	    /* It is an invalid character or '\0'.  Just use the byte.  */
-	    int ch = pstr->raw_mbs[pstr->raw_mbs_idx + src_idx];
-
-	    if (BE (pstr->trans != NULL, 0))
-	      ch = pstr->trans [ch];
-	    pstr->mbs[byte_idx] = ch;
-
-	    if (BE (pstr->offsets_needed != 0, 0))
-	      pstr->offsets[byte_idx] = src_idx;
-	    ++src_idx;
-
-	    /* And also cast it to wide char.  */
-	    pstr->wcs[byte_idx++] = (wchar_t) ch;
-	    if (BE (mbclen == (size_t) -1, 0))
-	      pstr->cur_state = prev_st;
-	  }
-	else
-	  {
-	    /* The buffer doesn't have enough space, finish to build.  */
-	    pstr->cur_state = prev_st;
-	    break;
-	  }
-      }
-  pstr->valid_len = byte_idx;
-  pstr->valid_raw_len = src_idx;
-  return REG_NOERROR;
-}
-
-/* Skip characters until the index becomes greater than NEW_RAW_IDX.
-   Return the index.  */
-
-static Idx
-internal_function
-re_string_skip_chars (re_string_t *pstr, Idx new_raw_idx, wint_t *last_wc)
-{
-  mbstate_t prev_st;
-  Idx rawbuf_idx;
-  size_t mbclen;
-  wint_t wc = WEOF;
-
-  /* Skip the characters which are not necessary to check.  */
-  for (rawbuf_idx = pstr->raw_mbs_idx + pstr->valid_raw_len;
-       rawbuf_idx < new_raw_idx;)
-    {
-      wchar_t wc2;
-      Idx remain_len = pstr->raw_len - rawbuf_idx;
-      prev_st = pstr->cur_state;
-      mbclen = __mbrtowc (&wc2, (const char *) pstr->raw_mbs + rawbuf_idx,
-			  remain_len, &pstr->cur_state);
-      if (BE (mbclen == (size_t) -2 || mbclen == (size_t) -1 || mbclen == 0, 0))
-	{
-	  /* We treat these cases as a single byte character.  */
-	  if (mbclen == 0 || remain_len == 0)
-	    wc = L'\0';
-	  else
-	    wc = *(unsigned char *) (pstr->raw_mbs + rawbuf_idx);
-	  mbclen = 1;
-	  pstr->cur_state = prev_st;
-	}
-      else
-	wc = wc2;
-      /* Then proceed the next character.  */
-      rawbuf_idx += mbclen;
-    }
-  *last_wc = wc;
-  return rawbuf_idx;
-}
-#endif /* RE_ENABLE_I18N  */
-
-/* Build the buffer PSTR->MBS, and apply the translation if we need.
-   This function is used in case of REG_ICASE.  */
-
-static void
-internal_function
-build_upper_buffer (re_string_t *pstr)
-{
-  Idx char_idx, end_idx;
-  end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len;
-
-  for (char_idx = pstr->valid_len; char_idx < end_idx; ++char_idx)
-    {
-      int ch = pstr->raw_mbs[pstr->raw_mbs_idx + char_idx];
-      if (BE (pstr->trans != NULL, 0))
-	ch = pstr->trans[ch];
-      if (islower (ch))
-	pstr->mbs[char_idx] = toupper (ch);
-      else
-	pstr->mbs[char_idx] = ch;
-    }
-  pstr->valid_len = char_idx;
-  pstr->valid_raw_len = char_idx;
-}
-
-/* Apply TRANS to the buffer in PSTR.  */
-
-static void
-internal_function
-re_string_translate_buffer (re_string_t *pstr)
-{
-  Idx buf_idx, end_idx;
-  end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len;
-
-  for (buf_idx = pstr->valid_len; buf_idx < end_idx; ++buf_idx)
-    {
-      int ch = pstr->raw_mbs[pstr->raw_mbs_idx + buf_idx];
-      pstr->mbs[buf_idx] = pstr->trans[ch];
-    }
-
-  pstr->valid_len = buf_idx;
-  pstr->valid_raw_len = buf_idx;
-}
-
-/* This function re-construct the buffers.
-   Concretely, convert to wide character in case of pstr->mb_cur_max > 1,
-   convert to upper case in case of REG_ICASE, apply translation.  */
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags)
-{
-  Idx offset;
-
-  if (BE (pstr->raw_mbs_idx <= idx, 0))
-    offset = idx - pstr->raw_mbs_idx;
-  else
-    {
-      /* Reset buffer.  */
-#ifdef RE_ENABLE_I18N
-      if (pstr->mb_cur_max > 1)
-	memset (&pstr->cur_state, '\0', sizeof (mbstate_t));
-#endif /* RE_ENABLE_I18N */
-      pstr->len = pstr->raw_len;
-      pstr->stop = pstr->raw_stop;
-      pstr->valid_len = 0;
-      pstr->raw_mbs_idx = 0;
-      pstr->valid_raw_len = 0;
-      pstr->offsets_needed = 0;
-      pstr->tip_context = ((eflags & REG_NOTBOL) ? CONTEXT_BEGBUF
-			   : CONTEXT_NEWLINE | CONTEXT_BEGBUF);
-      if (!pstr->mbs_allocated)
-	pstr->mbs = (unsigned char *) pstr->raw_mbs;
-      offset = idx;
-    }
-
-  if (BE (offset != 0, 1))
-    {
-      /* Should the already checked characters be kept?  */
-      if (BE (offset < pstr->valid_raw_len, 1))
-	{
-	  /* Yes, move them to the front of the buffer.  */
-#ifdef RE_ENABLE_I18N
-	  if (BE (pstr->offsets_needed, 0))
-	    {
-	      Idx low = 0, high = pstr->valid_len, mid;
-	      do
-		{
-		  mid = (high + low) / 2;
-		  if (pstr->offsets[mid] > offset)
-		    high = mid;
-		  else if (pstr->offsets[mid] < offset)
-		    low = mid + 1;
-		  else
-		    break;
-		}
-	      while (low < high);
-	      if (pstr->offsets[mid] < offset)
-		++mid;
-	      pstr->tip_context = re_string_context_at (pstr, mid - 1,
-							eflags);
-	      /* This can be quite complicated, so handle specially
-		 only the common and easy case where the character with
-		 different length representation of lower and upper
-		 case is present at or after offset.  */
-	      if (pstr->valid_len > offset
-		  && mid == offset && pstr->offsets[mid] == offset)
-		{
-		  memmove (pstr->wcs, pstr->wcs + offset,
-			   (pstr->valid_len - offset) * sizeof (wint_t));
-		  memmove (pstr->mbs, pstr->mbs + offset, pstr->valid_len - offset);
-		  pstr->valid_len -= offset;
-		  pstr->valid_raw_len -= offset;
-		  for (low = 0; low < pstr->valid_len; low++)
-		    pstr->offsets[low] = pstr->offsets[low + offset] - offset;
-		}
-	      else
-		{
-		  /* Otherwise, just find out how long the partial multibyte
-		     character at offset is and fill it with WEOF/255.  */
-		  pstr->len = pstr->raw_len - idx + offset;
-		  pstr->stop = pstr->raw_stop - idx + offset;
-		  pstr->offsets_needed = 0;
-		  while (mid > 0 && pstr->offsets[mid - 1] == offset)
-		    --mid;
-		  while (mid < pstr->valid_len)
-		    if (pstr->wcs[mid] != WEOF)
-		      break;
-		    else
-		      ++mid;
-		  if (mid == pstr->valid_len)
-		    pstr->valid_len = 0;
-		  else
-		    {
-		      pstr->valid_len = pstr->offsets[mid] - offset;
-		      if (pstr->valid_len)
-			{
-			  for (low = 0; low < pstr->valid_len; ++low)
-			    pstr->wcs[low] = WEOF;
-			  memset (pstr->mbs, 255, pstr->valid_len);
-			}
-		    }
-		  pstr->valid_raw_len = pstr->valid_len;
-		}
-	    }
-	  else
-#endif
-	    {
-	      pstr->tip_context = re_string_context_at (pstr, offset - 1,
-							eflags);
-#ifdef RE_ENABLE_I18N
-	      if (pstr->mb_cur_max > 1)
-		memmove (pstr->wcs, pstr->wcs + offset,
-			 (pstr->valid_len - offset) * sizeof (wint_t));
-#endif /* RE_ENABLE_I18N */
-	      if (BE (pstr->mbs_allocated, 0))
-		memmove (pstr->mbs, pstr->mbs + offset,
-			 pstr->valid_len - offset);
-	      pstr->valid_len -= offset;
-	      pstr->valid_raw_len -= offset;
-#if DEBUG
-	      assert (pstr->valid_len > 0);
-#endif
-	    }
-	}
-      else
-	{
-#ifdef RE_ENABLE_I18N
-	  /* No, skip all characters until IDX.  */
-	  Idx prev_valid_len = pstr->valid_len;
-
-	  if (BE (pstr->offsets_needed, 0))
-	    {
-	      pstr->len = pstr->raw_len - idx + offset;
-	      pstr->stop = pstr->raw_stop - idx + offset;
-	      pstr->offsets_needed = 0;
-	    }
-#endif
-	  pstr->valid_len = 0;
-#ifdef RE_ENABLE_I18N
-	  if (pstr->mb_cur_max > 1)
-	    {
-	      Idx wcs_idx;
-	      wint_t wc = WEOF;
-
-	      if (pstr->is_utf8)
-		{
-		  const unsigned char *raw, *p, *end;
-
-		  /* Special case UTF-8.  Multi-byte chars start with any
-		     byte other than 0x80 - 0xbf.  */
-		  raw = pstr->raw_mbs + pstr->raw_mbs_idx;
-		  end = raw + (offset - pstr->mb_cur_max);
-		  if (end < pstr->raw_mbs)
-		    end = pstr->raw_mbs;
-		  p = raw + offset - 1;
-#ifdef _LIBC
-		  /* We know the wchar_t encoding is UCS4, so for the simple
-		     case, ASCII characters, skip the conversion step.  */
-		  if (isascii (*p) && BE (pstr->trans == NULL, 1))
-		    {
-		      memset (&pstr->cur_state, '\0', sizeof (mbstate_t));
-		      /* pstr->valid_len = 0; */
-		      wc = (wchar_t) *p;
-		    }
-		  else
-#endif
-		    for (; p >= end; --p)
-		      if ((*p & 0xc0) != 0x80)
-			{
-			  mbstate_t cur_state;
-			  wchar_t wc2;
-			  Idx mlen = raw + pstr->len - p;
-			  unsigned char buf[6];
-			  size_t mbclen;
-
-			  const unsigned char *pp = p;
-			  if (BE (pstr->trans != NULL, 0))
-			    {
-			      int i = mlen < 6 ? mlen : 6;
-			      while (--i >= 0)
-				buf[i] = pstr->trans[p[i]];
-			      pp = buf;
-			    }
-			  /* XXX Don't use mbrtowc, we know which conversion
-			     to use (UTF-8 -> UCS4).  */
-			  memset (&cur_state, 0, sizeof (cur_state));
-			  mbclen = __mbrtowc (&wc2, (const char *) pp, mlen,
-					      &cur_state);
-			  if (raw + offset - p <= mbclen
-			      && mbclen < (size_t) -2)
-			    {
-			      memset (&pstr->cur_state, '\0',
-				      sizeof (mbstate_t));
-			      pstr->valid_len = mbclen - (raw + offset - p);
-			      wc = wc2;
-			    }
-			  break;
-			}
-		}
-
-	      if (wc == WEOF)
-		pstr->valid_len = re_string_skip_chars (pstr, idx, &wc) - idx;
-	      if (wc == WEOF)
-		pstr->tip_context
-		  = re_string_context_at (pstr, prev_valid_len - 1, eflags);
-	      else
-		pstr->tip_context = ((BE (pstr->word_ops_used != 0, 0)
-				      && IS_WIDE_WORD_CHAR (wc))
-				     ? CONTEXT_WORD
-				     : ((IS_WIDE_NEWLINE (wc)
-					 && pstr->newline_anchor)
-					? CONTEXT_NEWLINE : 0));
-	      if (BE (pstr->valid_len, 0))
-		{
-		  for (wcs_idx = 0; wcs_idx < pstr->valid_len; ++wcs_idx)
-		    pstr->wcs[wcs_idx] = WEOF;
-		  if (pstr->mbs_allocated)
-		    memset (pstr->mbs, 255, pstr->valid_len);
-		}
-	      pstr->valid_raw_len = pstr->valid_len;
-	    }
-	  else
-#endif /* RE_ENABLE_I18N */
-	    {
-	      int c = pstr->raw_mbs[pstr->raw_mbs_idx + offset - 1];
-	      pstr->valid_raw_len = 0;
-	      if (pstr->trans)
-		c = pstr->trans[c];
-	      pstr->tip_context = (bitset_contain (pstr->word_char, c)
-				   ? CONTEXT_WORD
-				   : ((IS_NEWLINE (c) && pstr->newline_anchor)
-				      ? CONTEXT_NEWLINE : 0));
-	    }
-	}
-      if (!BE (pstr->mbs_allocated, 0))
-	pstr->mbs += offset;
-    }
-  pstr->raw_mbs_idx = idx;
-  pstr->len -= offset;
-  pstr->stop -= offset;
-
-  /* Then build the buffers.  */
-#ifdef RE_ENABLE_I18N
-  if (pstr->mb_cur_max > 1)
-    {
-      if (pstr->icase)
-	{
-	  reg_errcode_t ret = build_wcs_upper_buffer (pstr);
-	  if (BE (ret != REG_NOERROR, 0))
-	    return ret;
-	}
-      else
-	build_wcs_buffer (pstr);
-    }
-  else
-#endif /* RE_ENABLE_I18N */
-    if (BE (pstr->mbs_allocated, 0))
-      {
-	if (pstr->icase)
-	  build_upper_buffer (pstr);
-	else if (pstr->trans != NULL)
-	  re_string_translate_buffer (pstr);
-      }
-    else
-      pstr->valid_len = pstr->len;
-
-  pstr->cur_idx = 0;
-  return REG_NOERROR;
-}
-
-static unsigned char
-internal_function __attribute__ ((pure))
-re_string_peek_byte_case (const re_string_t *pstr, Idx idx)
-{
-  int ch;
-  Idx off;
-
-  /* Handle the common (easiest) cases first.  */
-  if (BE (!pstr->mbs_allocated, 1))
-    return re_string_peek_byte (pstr, idx);
-
-#ifdef RE_ENABLE_I18N
-  if (pstr->mb_cur_max > 1
-      && ! re_string_is_single_byte_char (pstr, pstr->cur_idx + idx))
-    return re_string_peek_byte (pstr, idx);
-#endif
-
-  off = pstr->cur_idx + idx;
-#ifdef RE_ENABLE_I18N
-  if (pstr->offsets_needed)
-    off = pstr->offsets[off];
-#endif
-
-  ch = pstr->raw_mbs[pstr->raw_mbs_idx + off];
-
-#ifdef RE_ENABLE_I18N
-  /* Ensure that e.g. for tr_TR.UTF-8 BACKSLASH DOTLESS SMALL LETTER I
-     this function returns CAPITAL LETTER I instead of first byte of
-     DOTLESS SMALL LETTER I.  The latter would confuse the parser,
-     since peek_byte_case doesn't advance cur_idx in any way.  */
-  if (pstr->offsets_needed && !isascii (ch))
-    return re_string_peek_byte (pstr, idx);
-#endif
-
-  return ch;
-}
-
-static unsigned char
-internal_function
-re_string_fetch_byte_case (re_string_t *pstr)
-{
-  if (BE (!pstr->mbs_allocated, 1))
-    return re_string_fetch_byte (pstr);
-
-#ifdef RE_ENABLE_I18N
-  if (pstr->offsets_needed)
-    {
-      Idx off;
-      int ch;
-
-      /* For tr_TR.UTF-8 [[:islower:]] there is
-	 [[: CAPITAL LETTER I WITH DOT lower:]] in mbs.  Skip
-	 in that case the whole multi-byte character and return
-	 the original letter.  On the other side, with
-	 [[: DOTLESS SMALL LETTER I return [[:I, as doing
-	 anything else would complicate things too much.  */
-
-      if (!re_string_first_byte (pstr, pstr->cur_idx))
-	return re_string_fetch_byte (pstr);
-
-      off = pstr->offsets[pstr->cur_idx];
-      ch = pstr->raw_mbs[pstr->raw_mbs_idx + off];
-
-      if (! isascii (ch))
-	return re_string_fetch_byte (pstr);
-
-      re_string_skip_bytes (pstr,
-			    re_string_char_size_at (pstr, pstr->cur_idx));
-      return ch;
-    }
-#endif
-
-  return pstr->raw_mbs[pstr->raw_mbs_idx + pstr->cur_idx++];
-}
-
-static void
-internal_function
-re_string_destruct (re_string_t *pstr)
-{
-#ifdef RE_ENABLE_I18N
-  re_free (pstr->wcs);
-  re_free (pstr->offsets);
-#endif /* RE_ENABLE_I18N  */
-  if (pstr->mbs_allocated)
-    re_free (pstr->mbs);
-}
-
-/* Return the context at IDX in INPUT.  */
-
-static unsigned int
-internal_function
-re_string_context_at (const re_string_t *input, Idx idx, int eflags)
-{
-  int c;
-  if (BE (! REG_VALID_INDEX (idx), 0))
-    /* In this case, we use the value stored in input->tip_context,
-       since we can't know the character in input->mbs[-1] here.  */
-    return input->tip_context;
-  if (BE (idx == input->len, 0))
-    return ((eflags & REG_NOTEOL) ? CONTEXT_ENDBUF
-	    : CONTEXT_NEWLINE | CONTEXT_ENDBUF);
-#ifdef RE_ENABLE_I18N
-  if (input->mb_cur_max > 1)
-    {
-      wint_t wc;
-      Idx wc_idx = idx;
-      while(input->wcs[wc_idx] == WEOF)
-	{
-#ifdef DEBUG
-	  /* It must not happen.  */
-	  assert (REG_VALID_INDEX (wc_idx));
-#endif
-	  --wc_idx;
-	  if (! REG_VALID_INDEX (wc_idx))
-	    return input->tip_context;
-	}
-      wc = input->wcs[wc_idx];
-      if (BE (input->word_ops_used != 0, 0) && IS_WIDE_WORD_CHAR (wc))
-	return CONTEXT_WORD;
-      return (IS_WIDE_NEWLINE (wc) && input->newline_anchor
-	      ? CONTEXT_NEWLINE : 0);
-    }
-  else
-#endif
-    {
-      c = re_string_byte_at (input, idx);
-      if (bitset_contain (input->word_char, c))
-	return CONTEXT_WORD;
-      return IS_NEWLINE (c) && input->newline_anchor ? CONTEXT_NEWLINE : 0;
-    }
-}
-
-/* Functions for set operation.  */
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-re_node_set_alloc (re_node_set *set, Idx size)
-{
-  set->alloc = size;
-  set->nelem = 0;
-  set->elems = re_malloc (Idx, size);
-  if (BE (set->elems == NULL, 0) && (MALLOC_0_IS_NONNULL || size != 0))
-    return REG_ESPACE;
-  return REG_NOERROR;
-}
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-re_node_set_init_1 (re_node_set *set, Idx elem)
-{
-  set->alloc = 1;
-  set->nelem = 1;
-  set->elems = re_malloc (Idx, 1);
-  if (BE (set->elems == NULL, 0))
-    {
-      set->alloc = set->nelem = 0;
-      return REG_ESPACE;
-    }
-  set->elems[0] = elem;
-  return REG_NOERROR;
-}
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-re_node_set_init_2 (re_node_set *set, Idx elem1, Idx elem2)
-{
-  set->alloc = 2;
-  set->elems = re_malloc (Idx, 2);
-  if (BE (set->elems == NULL, 0))
-    return REG_ESPACE;
-  if (elem1 == elem2)
-    {
-      set->nelem = 1;
-      set->elems[0] = elem1;
-    }
-  else
-    {
-      set->nelem = 2;
-      if (elem1 < elem2)
-	{
-	  set->elems[0] = elem1;
-	  set->elems[1] = elem2;
-	}
-      else
-	{
-	  set->elems[0] = elem2;
-	  set->elems[1] = elem1;
-	}
-    }
-  return REG_NOERROR;
-}
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-re_node_set_init_copy (re_node_set *dest, const re_node_set *src)
-{
-  dest->nelem = src->nelem;
-  if (src->nelem > 0)
-    {
-      dest->alloc = dest->nelem;
-      dest->elems = re_malloc (Idx, dest->alloc);
-      if (BE (dest->elems == NULL, 0))
-	{
-	  dest->alloc = dest->nelem = 0;
-	  return REG_ESPACE;
-	}
-      memcpy (dest->elems, src->elems, src->nelem * sizeof (Idx));
-    }
-  else
-    re_node_set_init_empty (dest);
-  return REG_NOERROR;
-}
-
-/* Calculate the intersection of the sets SRC1 and SRC2. And merge it to
-   DEST. Return value indicate the error code or REG_NOERROR if succeeded.
-   Note: We assume dest->elems is NULL, when dest->alloc is 0.  */
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1,
-			   const re_node_set *src2)
-{
-  Idx i1, i2, is, id, delta, sbase;
-  if (src1->nelem == 0 || src2->nelem == 0)
-    return REG_NOERROR;
-
-  /* We need dest->nelem + 2 * elems_in_intersection; this is a
-     conservative estimate.  */
-  if (src1->nelem + src2->nelem + dest->nelem > dest->alloc)
-    {
-      Idx new_alloc = src1->nelem + src2->nelem + dest->alloc;
-      Idx *new_elems = re_realloc (dest->elems, Idx, new_alloc);
-      if (BE (new_elems == NULL, 0))
-	return REG_ESPACE;
-      dest->elems = new_elems;
-      dest->alloc = new_alloc;
-    }
-
-  /* Find the items in the intersection of SRC1 and SRC2, and copy
-     into the top of DEST those that are not already in DEST itself.  */
-  sbase = dest->nelem + src1->nelem + src2->nelem;
-  i1 = src1->nelem - 1;
-  i2 = src2->nelem - 1;
-  id = dest->nelem - 1;
-  for (;;)
-    {
-      if (src1->elems[i1] == src2->elems[i2])
-	{
-	  /* Try to find the item in DEST.  Maybe we could binary search?  */
-	  while (REG_VALID_INDEX (id) && dest->elems[id] > src1->elems[i1])
-	    --id;
-
-          if (! REG_VALID_INDEX (id) || dest->elems[id] != src1->elems[i1])
-            dest->elems[--sbase] = src1->elems[i1];
-
-	  if (! REG_VALID_INDEX (--i1) || ! REG_VALID_INDEX (--i2))
-	    break;
-	}
-
-      /* Lower the highest of the two items.  */
-      else if (src1->elems[i1] < src2->elems[i2])
-	{
-	  if (! REG_VALID_INDEX (--i2))
-	    break;
-	}
-      else
-	{
-	  if (! REG_VALID_INDEX (--i1))
-	    break;
-	}
-    }
-
-  id = dest->nelem - 1;
-  is = dest->nelem + src1->nelem + src2->nelem - 1;
-  delta = is - sbase + 1;
-
-  /* Now copy.  When DELTA becomes zero, the remaining
-     DEST elements are already in place; this is more or
-     less the same loop that is in re_node_set_merge.  */
-  dest->nelem += delta;
-  if (delta > 0 && REG_VALID_INDEX (id))
-    for (;;)
-      {
-	if (dest->elems[is] > dest->elems[id])
-	  {
-	    /* Copy from the top.  */
-	    dest->elems[id + delta--] = dest->elems[is--];
-	    if (delta == 0)
-	      break;
-	  }
-	else
-	  {
-	    /* Slide from the bottom.  */
-	    dest->elems[id + delta] = dest->elems[id];
-	    if (! REG_VALID_INDEX (--id))
-	      break;
-	  }
-      }
-
-  /* Copy remaining SRC elements.  */
-  memcpy (dest->elems, dest->elems + sbase, delta * sizeof (Idx));
-
-  return REG_NOERROR;
-}
-
-/* Calculate the union set of the sets SRC1 and SRC2. And store it to
-   DEST. Return value indicate the error code or REG_NOERROR if succeeded.  */
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-re_node_set_init_union (re_node_set *dest, const re_node_set *src1,
-			const re_node_set *src2)
-{
-  Idx i1, i2, id;
-  if (src1 != NULL && src1->nelem > 0 && src2 != NULL && src2->nelem > 0)
-    {
-      dest->alloc = src1->nelem + src2->nelem;
-      dest->elems = re_malloc (Idx, dest->alloc);
-      if (BE (dest->elems == NULL, 0))
-	return REG_ESPACE;
-    }
-  else
-    {
-      if (src1 != NULL && src1->nelem > 0)
-	return re_node_set_init_copy (dest, src1);
-      else if (src2 != NULL && src2->nelem > 0)
-	return re_node_set_init_copy (dest, src2);
-      else
-	re_node_set_init_empty (dest);
-      return REG_NOERROR;
-    }
-  for (i1 = i2 = id = 0 ; i1 < src1->nelem && i2 < src2->nelem ;)
-    {
-      if (src1->elems[i1] > src2->elems[i2])
-	{
-	  dest->elems[id++] = src2->elems[i2++];
-	  continue;
-	}
-      if (src1->elems[i1] == src2->elems[i2])
-	++i2;
-      dest->elems[id++] = src1->elems[i1++];
-    }
-  if (i1 < src1->nelem)
-    {
-      memcpy (dest->elems + id, src1->elems + i1,
-	     (src1->nelem - i1) * sizeof (Idx));
-      id += src1->nelem - i1;
-    }
-  else if (i2 < src2->nelem)
-    {
-      memcpy (dest->elems + id, src2->elems + i2,
-	     (src2->nelem - i2) * sizeof (Idx));
-      id += src2->nelem - i2;
-    }
-  dest->nelem = id;
-  return REG_NOERROR;
-}
-
-/* Calculate the union set of the sets DEST and SRC. And store it to
-   DEST. Return value indicate the error code or REG_NOERROR if succeeded.  */
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-re_node_set_merge (re_node_set *dest, const re_node_set *src)
-{
-  Idx is, id, sbase, delta;
-  if (src == NULL || src->nelem == 0)
-    return REG_NOERROR;
-  if (dest->alloc < 2 * src->nelem + dest->nelem)
-    {
-      Idx new_alloc = 2 * (src->nelem + dest->alloc);
-      Idx *new_buffer = re_realloc (dest->elems, Idx, new_alloc);
-      if (BE (new_buffer == NULL, 0))
-	return REG_ESPACE;
-      dest->elems = new_buffer;
-      dest->alloc = new_alloc;
-    }
-
-  if (BE (dest->nelem == 0, 0))
-    {
-      dest->nelem = src->nelem;
-      memcpy (dest->elems, src->elems, src->nelem * sizeof (Idx));
-      return REG_NOERROR;
-    }
-
-  /* Copy into the top of DEST the items of SRC that are not
-     found in DEST.  Maybe we could binary search in DEST?  */
-  for (sbase = dest->nelem + 2 * src->nelem,
-       is = src->nelem - 1, id = dest->nelem - 1;
-       REG_VALID_INDEX (is) && REG_VALID_INDEX (id); )
-    {
-      if (dest->elems[id] == src->elems[is])
-	is--, id--;
-      else if (dest->elems[id] < src->elems[is])
-	dest->elems[--sbase] = src->elems[is--];
-      else /* if (dest->elems[id] > src->elems[is]) */
-	--id;
-    }
-
-  if (REG_VALID_INDEX (is))
-    {
-      /* If DEST is exhausted, the remaining items of SRC must be unique.  */
-      sbase -= is + 1;
-      memcpy (dest->elems + sbase, src->elems, (is + 1) * sizeof (Idx));
-    }
-
-  id = dest->nelem - 1;
-  is = dest->nelem + 2 * src->nelem - 1;
-  delta = is - sbase + 1;
-  if (delta == 0)
-    return REG_NOERROR;
-
-  /* Now copy.  When DELTA becomes zero, the remaining
-     DEST elements are already in place.  */
-  dest->nelem += delta;
-  for (;;)
-    {
-      if (dest->elems[is] > dest->elems[id])
-	{
-	  /* Copy from the top.  */
-	  dest->elems[id + delta--] = dest->elems[is--];
-	  if (delta == 0)
-	    break;
-	}
-      else
-	{
-	  /* Slide from the bottom.  */
-	  dest->elems[id + delta] = dest->elems[id];
-	  if (! REG_VALID_INDEX (--id))
-	    {
-	      /* Copy remaining SRC elements.  */
-	      memcpy (dest->elems, dest->elems + sbase,
-		      delta * sizeof (Idx));
-	      break;
-	    }
-	}
-    }
-
-  return REG_NOERROR;
-}
-
-/* Insert the new element ELEM to the re_node_set* SET.
-   SET should not already have ELEM.
-   Return true if successful.  */
-
-static bool
-internal_function __attribute_warn_unused_result__
-re_node_set_insert (re_node_set *set, Idx elem)
-{
-  Idx idx;
-  /* In case the set is empty.  */
-  if (set->alloc == 0)
-    return BE (re_node_set_init_1 (set, elem) == REG_NOERROR, 1);
-
-  if (BE (set->nelem, 0) == 0)
-    {
-      /* We already guaranteed above that set->alloc != 0.  */
-      set->elems[0] = elem;
-      ++set->nelem;
-      return true;
-    }
-
-  /* Realloc if we need.  */
-  if (set->alloc == set->nelem)
-    {
-      Idx *new_elems;
-      set->alloc = set->alloc * 2;
-      new_elems = re_realloc (set->elems, Idx, set->alloc);
-      if (BE (new_elems == NULL, 0))
-	return false;
-      set->elems = new_elems;
-    }
-
-  /* Move the elements which follows the new element.  Test the
-     first element separately to skip a check in the inner loop.  */
-  if (elem < set->elems[0])
-    {
-      idx = 0;
-      for (idx = set->nelem; idx > 0; idx--)
-	set->elems[idx] = set->elems[idx - 1];
-    }
-  else
-    {
-      for (idx = set->nelem; set->elems[idx - 1] > elem; idx--)
-	set->elems[idx] = set->elems[idx - 1];
-    }
-
-  /* Insert the new element.  */
-  set->elems[idx] = elem;
-  ++set->nelem;
-  return true;
-}
-
-/* Insert the new element ELEM to the re_node_set* SET.
-   SET should not already have any element greater than or equal to ELEM.
-   Return true if successful.  */
-
-static bool
-internal_function __attribute_warn_unused_result__
-re_node_set_insert_last (re_node_set *set, Idx elem)
-{
-  /* Realloc if we need.  */
-  if (set->alloc == set->nelem)
-    {
-      Idx *new_elems;
-      set->alloc = (set->alloc + 1) * 2;
-      new_elems = re_realloc (set->elems, Idx, set->alloc);
-      if (BE (new_elems == NULL, 0))
-	return false;
-      set->elems = new_elems;
-    }
-
-  /* Insert the new element.  */
-  set->elems[set->nelem++] = elem;
-  return true;
-}
-
-/* Compare two node sets SET1 and SET2.
-   Return true if SET1 and SET2 are equivalent.  */
-
-static bool
-internal_function __attribute__ ((pure))
-re_node_set_compare (const re_node_set *set1, const re_node_set *set2)
-{
-  Idx i;
-  if (set1 == NULL || set2 == NULL || set1->nelem != set2->nelem)
-    return false;
-  for (i = set1->nelem ; REG_VALID_INDEX (--i) ; )
-    if (set1->elems[i] != set2->elems[i])
-      return false;
-  return true;
-}
-
-/* Return (idx + 1) if SET contains the element ELEM, return 0 otherwise.  */
-
-static Idx
-internal_function __attribute__ ((pure))
-re_node_set_contains (const re_node_set *set, Idx elem)
-{
-  __re_size_t idx, right, mid;
-  if (! REG_VALID_NONZERO_INDEX (set->nelem))
-    return 0;
-
-  /* Binary search the element.  */
-  idx = 0;
-  right = set->nelem - 1;
-  while (idx < right)
-    {
-      mid = (idx + right) / 2;
-      if (set->elems[mid] < elem)
-	idx = mid + 1;
-      else
-	right = mid;
-    }
-  return set->elems[idx] == elem ? idx + 1 : 0;
-}
-
-static void
-internal_function
-re_node_set_remove_at (re_node_set *set, Idx idx)
-{
-  if (idx < 0 || idx >= set->nelem)
-    return;
-  --set->nelem;
-  for (; idx < set->nelem; idx++)
-    set->elems[idx] = set->elems[idx + 1];
-}
-
-
-/* Add the token TOKEN to dfa->nodes, and return the index of the token.
-   Or return REG_MISSING if an error occurred.  */
-
-static Idx
-internal_function
-re_dfa_add_node (re_dfa_t *dfa, re_token_t token)
-{
-  if (BE (dfa->nodes_len >= dfa->nodes_alloc, 0))
-    {
-      size_t new_nodes_alloc = dfa->nodes_alloc * 2;
-      Idx *new_nexts, *new_indices;
-      re_node_set *new_edests, *new_eclosures;
-      re_token_t *new_nodes;
-
-      /* Avoid overflows in realloc.  */
-      const size_t max_object_size = MAX (sizeof (re_token_t),
-					  MAX (sizeof (re_node_set),
-					       sizeof (Idx)));
-      if (BE (MIN (IDX_MAX, SIZE_MAX / max_object_size) < new_nodes_alloc, 0))
-	return REG_MISSING;
-
-      new_nodes = re_realloc (dfa->nodes, re_token_t, new_nodes_alloc);
-      if (BE (new_nodes == NULL, 0))
-	return REG_MISSING;
-      dfa->nodes = new_nodes;
-      new_nexts = re_realloc (dfa->nexts, Idx, new_nodes_alloc);
-      new_indices = re_realloc (dfa->org_indices, Idx, new_nodes_alloc);
-      new_edests = re_realloc (dfa->edests, re_node_set, new_nodes_alloc);
-      new_eclosures = re_realloc (dfa->eclosures, re_node_set, new_nodes_alloc);
-      if (BE (new_nexts == NULL || new_indices == NULL
-	      || new_edests == NULL || new_eclosures == NULL, 0))
-	return REG_MISSING;
-      dfa->nexts = new_nexts;
-      dfa->org_indices = new_indices;
-      dfa->edests = new_edests;
-      dfa->eclosures = new_eclosures;
-      dfa->nodes_alloc = new_nodes_alloc;
-    }
-  dfa->nodes[dfa->nodes_len] = token;
-  dfa->nodes[dfa->nodes_len].constraint = 0;
-#ifdef RE_ENABLE_I18N
-  dfa->nodes[dfa->nodes_len].accept_mb =
-    ((token.type == OP_PERIOD && dfa->mb_cur_max > 1)
-     || token.type == COMPLEX_BRACKET);
-#endif
-  dfa->nexts[dfa->nodes_len] = REG_MISSING;
-  re_node_set_init_empty (dfa->edests + dfa->nodes_len);
-  re_node_set_init_empty (dfa->eclosures + dfa->nodes_len);
-  return dfa->nodes_len++;
-}
-
-static re_hashval_t
-internal_function
-calc_state_hash (const re_node_set *nodes, unsigned int context)
-{
-  re_hashval_t hash = nodes->nelem + context;
-  Idx i;
-  for (i = 0 ; i < nodes->nelem ; i++)
-    hash += nodes->elems[i];
-  return hash;
-}
-
-/* Search for the state whose node_set is equivalent to NODES.
-   Return the pointer to the state, if we found it in the DFA.
-   Otherwise create the new one and return it.  In case of an error
-   return NULL and set the error code in ERR.
-   Note: - We assume NULL as the invalid state, then it is possible that
-	   return value is NULL and ERR is REG_NOERROR.
-	 - We never return non-NULL value in case of any errors, it is for
-	   optimization.  */
-
-static re_dfastate_t *
-internal_function __attribute_warn_unused_result__
-re_acquire_state (reg_errcode_t *err, const re_dfa_t *dfa,
-		  const re_node_set *nodes)
-{
-  re_hashval_t hash;
-  re_dfastate_t *new_state;
-  struct re_state_table_entry *spot;
-  Idx i;
-#ifdef lint
-  /* Suppress bogus uninitialized-variable warnings.  */
-  *err = REG_NOERROR;
-#endif
-  if (BE (nodes->nelem == 0, 0))
-    {
-      *err = REG_NOERROR;
-      return NULL;
-    }
-  hash = calc_state_hash (nodes, 0);
-  spot = dfa->state_table + (hash & dfa->state_hash_mask);
-
-  for (i = 0 ; i < spot->num ; i++)
-    {
-      re_dfastate_t *state = spot->array[i];
-      if (hash != state->hash)
-	continue;
-      if (re_node_set_compare (&state->nodes, nodes))
-	return state;
-    }
-
-  /* There are no appropriate state in the dfa, create the new one.  */
-  new_state = create_ci_newstate (dfa, nodes, hash);
-  if (BE (new_state == NULL, 0))
-    *err = REG_ESPACE;
-
-  return new_state;
-}
-
-/* Search for the state whose node_set is equivalent to NODES and
-   whose context is equivalent to CONTEXT.
-   Return the pointer to the state, if we found it in the DFA.
-   Otherwise create the new one and return it.  In case of an error
-   return NULL and set the error code in ERR.
-   Note: - We assume NULL as the invalid state, then it is possible that
-	   return value is NULL and ERR is REG_NOERROR.
-	 - We never return non-NULL value in case of any errors, it is for
-	   optimization.  */
-
-static re_dfastate_t *
-internal_function __attribute_warn_unused_result__
-re_acquire_state_context (reg_errcode_t *err, const re_dfa_t *dfa,
-			  const re_node_set *nodes, unsigned int context)
-{
-  re_hashval_t hash;
-  re_dfastate_t *new_state;
-  struct re_state_table_entry *spot;
-  Idx i;
-#ifdef lint
-  /* Suppress bogus uninitialized-variable warnings.  */
-  *err = REG_NOERROR;
-#endif
-  if (nodes->nelem == 0)
-    {
-      *err = REG_NOERROR;
-      return NULL;
-    }
-  hash = calc_state_hash (nodes, context);
-  spot = dfa->state_table + (hash & dfa->state_hash_mask);
-
-  for (i = 0 ; i < spot->num ; i++)
-    {
-      re_dfastate_t *state = spot->array[i];
-      if (state->hash == hash
-	  && state->context == context
-	  && re_node_set_compare (state->entrance_nodes, nodes))
-	return state;
-    }
-  /* There are no appropriate state in 'dfa', create the new one.  */
-  new_state = create_cd_newstate (dfa, nodes, context, hash);
-  if (BE (new_state == NULL, 0))
-    *err = REG_ESPACE;
-
-  return new_state;
-}
-
-/* Finish initialization of the new state NEWSTATE, and using its hash value
-   HASH put in the appropriate bucket of DFA's state table.  Return value
-   indicates the error code if failed.  */
-
-static reg_errcode_t
-__attribute_warn_unused_result__
-register_state (const re_dfa_t *dfa, re_dfastate_t *newstate,
-		re_hashval_t hash)
-{
-  struct re_state_table_entry *spot;
-  reg_errcode_t err;
-  Idx i;
-
-  newstate->hash = hash;
-  err = re_node_set_alloc (&newstate->non_eps_nodes, newstate->nodes.nelem);
-  if (BE (err != REG_NOERROR, 0))
-    return REG_ESPACE;
-  for (i = 0; i < newstate->nodes.nelem; i++)
-    {
-      Idx elem = newstate->nodes.elems[i];
-      if (!IS_EPSILON_NODE (dfa->nodes[elem].type))
-	if (! re_node_set_insert_last (&newstate->non_eps_nodes, elem))
-	  return REG_ESPACE;
-    }
-
-  spot = dfa->state_table + (hash & dfa->state_hash_mask);
-  if (BE (spot->alloc <= spot->num, 0))
-    {
-      Idx new_alloc = 2 * spot->num + 2;
-      re_dfastate_t **new_array = re_realloc (spot->array, re_dfastate_t *,
-					      new_alloc);
-      if (BE (new_array == NULL, 0))
-	return REG_ESPACE;
-      spot->array = new_array;
-      spot->alloc = new_alloc;
-    }
-  spot->array[spot->num++] = newstate;
-  return REG_NOERROR;
-}
-
-static void
-free_state (re_dfastate_t *state)
-{
-  re_node_set_free (&state->non_eps_nodes);
-  re_node_set_free (&state->inveclosure);
-  if (state->entrance_nodes != &state->nodes)
-    {
-      re_node_set_free (state->entrance_nodes);
-      re_free (state->entrance_nodes);
-    }
-  re_node_set_free (&state->nodes);
-  re_free (state->word_trtable);
-  re_free (state->trtable);
-  re_free (state);
-}
-
-/* Create the new state which is independent of contexts.
-   Return the new state if succeeded, otherwise return NULL.  */
-
-static re_dfastate_t *
-internal_function __attribute_warn_unused_result__
-create_ci_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
-		    re_hashval_t hash)
-{
-  Idx i;
-  reg_errcode_t err;
-  re_dfastate_t *newstate;
-
-  newstate = (re_dfastate_t *) calloc (sizeof (re_dfastate_t), 1);
-  if (BE (newstate == NULL, 0))
-    return NULL;
-  err = re_node_set_init_copy (&newstate->nodes, nodes);
-  if (BE (err != REG_NOERROR, 0))
-    {
-      re_free (newstate);
-      return NULL;
-    }
-
-  newstate->entrance_nodes = &newstate->nodes;
-  for (i = 0 ; i < nodes->nelem ; i++)
-    {
-      re_token_t *node = dfa->nodes + nodes->elems[i];
-      re_token_type_t type = node->type;
-      if (type == CHARACTER && !node->constraint)
-	continue;
-#ifdef RE_ENABLE_I18N
-      newstate->accept_mb |= node->accept_mb;
-#endif /* RE_ENABLE_I18N */
-
-      /* If the state has the halt node, the state is a halt state.  */
-      if (type == END_OF_RE)
-	newstate->halt = 1;
-      else if (type == OP_BACK_REF)
-	newstate->has_backref = 1;
-      else if (type == ANCHOR || node->constraint)
-	newstate->has_constraint = 1;
-    }
-  err = register_state (dfa, newstate, hash);
-  if (BE (err != REG_NOERROR, 0))
-    {
-      free_state (newstate);
-      newstate = NULL;
-    }
-  return newstate;
-}
-
-/* Create the new state which is depend on the context CONTEXT.
-   Return the new state if succeeded, otherwise return NULL.  */
-
-static re_dfastate_t *
-internal_function __attribute_warn_unused_result__
-create_cd_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
-		    unsigned int context, re_hashval_t hash)
-{
-  Idx i, nctx_nodes = 0;
-  reg_errcode_t err;
-  re_dfastate_t *newstate;
-
-  newstate = (re_dfastate_t *) calloc (sizeof (re_dfastate_t), 1);
-  if (BE (newstate == NULL, 0))
-    return NULL;
-  err = re_node_set_init_copy (&newstate->nodes, nodes);
-  if (BE (err != REG_NOERROR, 0))
-    {
-      re_free (newstate);
-      return NULL;
-    }
-
-  newstate->context = context;
-  newstate->entrance_nodes = &newstate->nodes;
-
-  for (i = 0 ; i < nodes->nelem ; i++)
-    {
-      re_token_t *node = dfa->nodes + nodes->elems[i];
-      re_token_type_t type = node->type;
-      unsigned int constraint = node->constraint;
-
-      if (type == CHARACTER && !constraint)
-	continue;
-#ifdef RE_ENABLE_I18N
-      newstate->accept_mb |= node->accept_mb;
-#endif /* RE_ENABLE_I18N */
-
-      /* If the state has the halt node, the state is a halt state.  */
-      if (type == END_OF_RE)
-	newstate->halt = 1;
-      else if (type == OP_BACK_REF)
-	newstate->has_backref = 1;
-
-      if (constraint)
-	{
-	  if (newstate->entrance_nodes == &newstate->nodes)
-	    {
-	      newstate->entrance_nodes = re_malloc (re_node_set, 1);
-	      if (BE (newstate->entrance_nodes == NULL, 0))
-		{
-		  free_state (newstate);
-		  return NULL;
-		}
-	      if (re_node_set_init_copy (newstate->entrance_nodes, nodes)
-		  != REG_NOERROR)
-		return NULL;
-	      nctx_nodes = 0;
-	      newstate->has_constraint = 1;
-	    }
-
-	  if (NOT_SATISFY_PREV_CONSTRAINT (constraint,context))
-	    {
-	      re_node_set_remove_at (&newstate->nodes, i - nctx_nodes);
-	      ++nctx_nodes;
-	    }
-	}
-    }
-  err = register_state (dfa, newstate, hash);
-  if (BE (err != REG_NOERROR, 0))
-    {
-      free_state (newstate);
-      newstate = NULL;
-    }
-  return  newstate;
-}

+ 0 - 909
gl/regex_internal.h~

@@ -1,909 +0,0 @@
-/* Extended regular expression matching and search library.
-   Copyright (C) 2002-2013 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public
-   License as published by the Free Software Foundation; either
-   version 3 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef NAGIOS_REGEX_INTERNAL_H_INCLUDED
-#define NAGIOS_REGEX_INTERNAL_H_INCLUDED
-
-#include <assert.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <langinfo.h>
-#include <locale.h>
-#include <wchar.h>
-#include <wctype.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-#ifdef _LIBC
-# include <bits/libc-lock.h>
-# define lock_define(name) __libc_lock_define (, name)
-# define lock_init(lock) (__libc_lock_init (lock), 0)
-# define lock_fini(lock) 0
-# define lock_lock(lock) __libc_lock_lock (lock)
-# define lock_unlock(lock) __libc_lock_unlock (lock)
-#elif defined GNULIB_LOCK
-# include "glthread/lock.h"
-  /* Use gl_lock_define if empty macro arguments are known to work.
-     Otherwise, fall back on less-portable substitutes.  */
-# if ((defined __GNUC__ && !defined __STRICT_ANSI__) \
-      || (defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__))
-#  define lock_define(name) gl_lock_define (, name)
-# elif USE_POSIX_THREADS
-#  define lock_define(name) pthread_mutex_t name;
-# elif USE_PTH_THREADS
-#  define lock_define(name) pth_mutex_t name;
-# elif USE_SOLARIS_THREADS
-#  define lock_define(name) mutex_t name;
-# elif USE_WINDOWS_THREADS
-#  define lock_define(name) gl_lock_t name;
-# else
-#  define lock_define(name)
-# endif
-# define lock_init(lock) glthread_lock_init (&(lock))
-# define lock_fini(lock) glthread_lock_destroy (&(lock))
-# define lock_lock(lock) glthread_lock_lock (&(lock))
-# define lock_unlock(lock) glthread_lock_unlock (&(lock))
-#elif defined GNULIB_PTHREAD
-# include <pthread.h>
-# define lock_define(name) pthread_mutex_t name;
-# define lock_init(lock) pthread_mutex_init (&(lock), 0)
-# define lock_fini(lock) pthread_mutex_destroy (&(lock))
-# define lock_lock(lock) pthread_mutex_lock (&(lock))
-# define lock_unlock(lock) pthread_mutex_unlock (&(lock))
-#else
-# define lock_define(name)
-# define lock_init(lock) 0
-# define lock_fini(lock) ((void) 0)
-  /* The 'dfa' avoids an "unused variable 'dfa'" warning from GCC.  */
-# define lock_lock(lock) ((void) dfa)
-# define lock_unlock(lock) ((void) 0)
-#endif
-
-/* In case that the system doesn't have isblank().  */
-#if !defined _LIBC && ! (defined isblank || (HAVE_ISBLANK && HAVE_DECL_ISBLANK))
-# define isblank(ch) ((ch) == ' ' || (ch) == '\t')
-#endif
-
-#ifdef _LIBC
-# ifndef _RE_DEFINE_LOCALE_FUNCTIONS
-#  define _RE_DEFINE_LOCALE_FUNCTIONS 1
-#   include <locale/localeinfo.h>
-#   include <locale/elem-hash.h>
-#   include <locale/coll-lookup.h>
-# endif
-#endif
-
-/* This is for other GNU distributions with internationalized messages.  */
-#if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
-# include <libintl.h>
-# ifdef _LIBC
-#  undef gettext
-#  define gettext(msgid) \
-  __dcgettext (_libc_intl_domainname, msgid, LC_MESSAGES)
-# endif
-#else
-# define gettext(msgid) (msgid)
-#endif
-
-#ifndef gettext_noop
-/* This define is so xgettext can find the internationalizable
-   strings.  */
-# define gettext_noop(String) String
-#endif
-
-#if (defined MB_CUR_MAX && HAVE_WCTYPE_H && HAVE_ISWCTYPE && HAVE_WCSCOLL) || _LIBC
-# define RE_ENABLE_I18N
-#endif
-
-#if __GNUC__ >= 3
-# define BE(expr, val) __builtin_expect (expr, val)
-#else
-# define BE(expr, val) (expr)
-#endif
-
-/* Number of ASCII characters.  */
-#define ASCII_CHARS 0x80
-
-/* Number of single byte characters.  */
-#define SBC_MAX (UCHAR_MAX + 1)
-
-#define COLL_ELEM_LEN_MAX 8
-
-/* The character which represents newline.  */
-#define NEWLINE_CHAR '\n'
-#define WIDE_NEWLINE_CHAR L'\n'
-
-/* Rename to standard API for using out of glibc.  */
-#ifndef _LIBC
-# undef __wctype
-# undef __iswctype
-# define __wctype wctype
-# define __iswctype iswctype
-# define __btowc btowc
-# define __mbrtowc mbrtowc
-# define __wcrtomb wcrtomb
-# define __regfree regfree
-# define attribute_hidden
-#endif /* not _LIBC */
-
-#if __GNUC__ < 3 + (__GNUC_MINOR__ < 1)
-# define __attribute__(arg)
-#endif
-
-typedef __re_idx_t Idx;
-#ifdef _REGEX_LARGE_OFFSETS
-# define IDX_MAX (SIZE_MAX - 2)
-#else
-# define IDX_MAX INT_MAX
-#endif
-
-/* Special return value for failure to match.  */
-#define REG_MISSING ((Idx) -1)
-
-/* Special return value for internal error.  */
-#define REG_ERROR ((Idx) -2)
-
-/* Test whether N is a valid index, and is not one of the above.  */
-#ifdef _REGEX_LARGE_OFFSETS
-# define REG_VALID_INDEX(n) ((Idx) (n) < REG_ERROR)
-#else
-# define REG_VALID_INDEX(n) (0 <= (n))
-#endif
-
-/* Test whether N is a valid nonzero index.  */
-#ifdef _REGEX_LARGE_OFFSETS
-# define REG_VALID_NONZERO_INDEX(n) ((Idx) ((n) - 1) < (Idx) (REG_ERROR - 1))
-#else
-# define REG_VALID_NONZERO_INDEX(n) (0 < (n))
-#endif
-
-/* A hash value, suitable for computing hash tables.  */
-typedef __re_size_t re_hashval_t;
-
-/* An integer used to represent a set of bits.  It must be unsigned,
-   and must be at least as wide as unsigned int.  */
-typedef unsigned long int bitset_word_t;
-/* All bits set in a bitset_word_t.  */
-#define BITSET_WORD_MAX ULONG_MAX
-
-/* Number of bits in a bitset_word_t.  For portability to hosts with
-   padding bits, do not use '(sizeof (bitset_word_t) * CHAR_BIT)';
-   instead, deduce it directly from BITSET_WORD_MAX.  Avoid
-   greater-than-32-bit integers and unconditional shifts by more than
-   31 bits, as they're not portable.  */
-#if BITSET_WORD_MAX == 0xffffffffUL
-# define BITSET_WORD_BITS 32
-#elif BITSET_WORD_MAX >> 31 >> 4 == 1
-# define BITSET_WORD_BITS 36
-#elif BITSET_WORD_MAX >> 31 >> 16 == 1
-# define BITSET_WORD_BITS 48
-#elif BITSET_WORD_MAX >> 31 >> 28 == 1
-# define BITSET_WORD_BITS 60
-#elif BITSET_WORD_MAX >> 31 >> 31 >> 1 == 1
-# define BITSET_WORD_BITS 64
-#elif BITSET_WORD_MAX >> 31 >> 31 >> 9 == 1
-# define BITSET_WORD_BITS 72
-#elif BITSET_WORD_MAX >> 31 >> 31 >> 31 >> 31 >> 3 == 1
-# define BITSET_WORD_BITS 128
-#elif BITSET_WORD_MAX >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 7 == 1
-# define BITSET_WORD_BITS 256
-#elif BITSET_WORD_MAX >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 7 > 1
-# define BITSET_WORD_BITS 257 /* any value > SBC_MAX will do here */
-# if BITSET_WORD_BITS <= SBC_MAX
-#  error "Invalid SBC_MAX"
-# endif
-#else
-# error "Add case for new bitset_word_t size"
-#endif
-
-/* Number of bitset_word_t values in a bitset_t.  */
-#define BITSET_WORDS ((SBC_MAX + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS)
-
-typedef bitset_word_t bitset_t[BITSET_WORDS];
-typedef bitset_word_t *re_bitset_ptr_t;
-typedef const bitset_word_t *re_const_bitset_ptr_t;
-
-#define PREV_WORD_CONSTRAINT 0x0001
-#define PREV_NOTWORD_CONSTRAINT 0x0002
-#define NEXT_WORD_CONSTRAINT 0x0004
-#define NEXT_NOTWORD_CONSTRAINT 0x0008
-#define PREV_NEWLINE_CONSTRAINT 0x0010
-#define NEXT_NEWLINE_CONSTRAINT 0x0020
-#define PREV_BEGBUF_CONSTRAINT 0x0040
-#define NEXT_ENDBUF_CONSTRAINT 0x0080
-#define WORD_DELIM_CONSTRAINT 0x0100
-#define NOT_WORD_DELIM_CONSTRAINT 0x0200
-
-typedef enum
-{
-  INSIDE_WORD = PREV_WORD_CONSTRAINT | NEXT_WORD_CONSTRAINT,
-  WORD_FIRST = PREV_NOTWORD_CONSTRAINT | NEXT_WORD_CONSTRAINT,
-  WORD_LAST = PREV_WORD_CONSTRAINT | NEXT_NOTWORD_CONSTRAINT,
-  INSIDE_NOTWORD = PREV_NOTWORD_CONSTRAINT | NEXT_NOTWORD_CONSTRAINT,
-  LINE_FIRST = PREV_NEWLINE_CONSTRAINT,
-  LINE_LAST = NEXT_NEWLINE_CONSTRAINT,
-  BUF_FIRST = PREV_BEGBUF_CONSTRAINT,
-  BUF_LAST = NEXT_ENDBUF_CONSTRAINT,
-  WORD_DELIM = WORD_DELIM_CONSTRAINT,
-  NOT_WORD_DELIM = NOT_WORD_DELIM_CONSTRAINT
-} re_context_type;
-
-typedef struct
-{
-  Idx alloc;
-  Idx nelem;
-  Idx *elems;
-} re_node_set;
-
-typedef enum
-{
-  NON_TYPE = 0,
-
-  /* Node type, These are used by token, node, tree.  */
-  CHARACTER = 1,
-  END_OF_RE = 2,
-  SIMPLE_BRACKET = 3,
-  OP_BACK_REF = 4,
-  OP_PERIOD = 5,
-#ifdef RE_ENABLE_I18N
-  COMPLEX_BRACKET = 6,
-  OP_UTF8_PERIOD = 7,
-#endif /* RE_ENABLE_I18N */
-
-  /* We define EPSILON_BIT as a macro so that OP_OPEN_SUBEXP is used
-     when the debugger shows values of this enum type.  */
-#define EPSILON_BIT 8
-  OP_OPEN_SUBEXP = EPSILON_BIT | 0,
-  OP_CLOSE_SUBEXP = EPSILON_BIT | 1,
-  OP_ALT = EPSILON_BIT | 2,
-  OP_DUP_ASTERISK = EPSILON_BIT | 3,
-  ANCHOR = EPSILON_BIT | 4,
-
-  /* Tree type, these are used only by tree. */
-  CONCAT = 16,
-  SUBEXP = 17,
-
-  /* Token type, these are used only by token.  */
-  OP_DUP_PLUS = 18,
-  OP_DUP_QUESTION,
-  OP_OPEN_BRACKET,
-  OP_CLOSE_BRACKET,
-  OP_CHARSET_RANGE,
-  OP_OPEN_DUP_NUM,
-  OP_CLOSE_DUP_NUM,
-  OP_NON_MATCH_LIST,
-  OP_OPEN_COLL_ELEM,
-  OP_CLOSE_COLL_ELEM,
-  OP_OPEN_EQUIV_CLASS,
-  OP_CLOSE_EQUIV_CLASS,
-  OP_OPEN_CHAR_CLASS,
-  OP_CLOSE_CHAR_CLASS,
-  OP_WORD,
-  OP_NOTWORD,
-  OP_SPACE,
-  OP_NOTSPACE,
-  BACK_SLASH
-
-} re_token_type_t;
-
-#ifdef RE_ENABLE_I18N
-typedef struct
-{
-  /* Multibyte characters.  */
-  wchar_t *mbchars;
-
-  /* Collating symbols.  */
-# ifdef _LIBC
-  int32_t *coll_syms;
-# endif
-
-  /* Equivalence classes. */
-# ifdef _LIBC
-  int32_t *equiv_classes;
-# endif
-
-  /* Range expressions. */
-# ifdef _LIBC
-  uint32_t *range_starts;
-  uint32_t *range_ends;
-# else /* not _LIBC */
-  wchar_t *range_starts;
-  wchar_t *range_ends;
-# endif /* not _LIBC */
-
-  /* Character classes. */
-  wctype_t *char_classes;
-
-  /* If this character set is the non-matching list.  */
-  unsigned int non_match : 1;
-
-  /* # of multibyte characters.  */
-  Idx nmbchars;
-
-  /* # of collating symbols.  */
-  Idx ncoll_syms;
-
-  /* # of equivalence classes. */
-  Idx nequiv_classes;
-
-  /* # of range expressions. */
-  Idx nranges;
-
-  /* # of character classes. */
-  Idx nchar_classes;
-} re_charset_t;
-#endif /* RE_ENABLE_I18N */
-
-typedef struct
-{
-  union
-  {
-    unsigned char c;		/* for CHARACTER */
-    re_bitset_ptr_t sbcset;	/* for SIMPLE_BRACKET */
-#ifdef RE_ENABLE_I18N
-    re_charset_t *mbcset;	/* for COMPLEX_BRACKET */
-#endif /* RE_ENABLE_I18N */
-    Idx idx;			/* for BACK_REF */
-    re_context_type ctx_type;	/* for ANCHOR */
-  } opr;
-#if __GNUC__ >= 2 && !defined __STRICT_ANSI__
-  re_token_type_t type : 8;
-#else
-  re_token_type_t type;
-#endif
-  unsigned int constraint : 10;	/* context constraint */
-  unsigned int duplicated : 1;
-  unsigned int opt_subexp : 1;
-#ifdef RE_ENABLE_I18N
-  unsigned int accept_mb : 1;
-  /* These 2 bits can be moved into the union if needed (e.g. if running out
-     of bits; move opr.c to opr.c.c and move the flags to opr.c.flags).  */
-  unsigned int mb_partial : 1;
-#endif
-  unsigned int word_char : 1;
-} re_token_t;
-
-#define IS_EPSILON_NODE(type) ((type) & EPSILON_BIT)
-
-struct re_string_t
-{
-  /* Indicate the raw buffer which is the original string passed as an
-     argument of regexec(), re_search(), etc..  */
-  const unsigned char *raw_mbs;
-  /* Store the multibyte string.  In case of "case insensitive mode" like
-     REG_ICASE, upper cases of the string are stored, otherwise MBS points
-     the same address that RAW_MBS points.  */
-  unsigned char *mbs;
-#ifdef RE_ENABLE_I18N
-  /* Store the wide character string which is corresponding to MBS.  */
-  wint_t *wcs;
-  Idx *offsets;
-  mbstate_t cur_state;
-#endif
-  /* Index in RAW_MBS.  Each character mbs[i] corresponds to
-     raw_mbs[raw_mbs_idx + i].  */
-  Idx raw_mbs_idx;
-  /* The length of the valid characters in the buffers.  */
-  Idx valid_len;
-  /* The corresponding number of bytes in raw_mbs array.  */
-  Idx valid_raw_len;
-  /* The length of the buffers MBS and WCS.  */
-  Idx bufs_len;
-  /* The index in MBS, which is updated by re_string_fetch_byte.  */
-  Idx cur_idx;
-  /* length of RAW_MBS array.  */
-  Idx raw_len;
-  /* This is RAW_LEN - RAW_MBS_IDX + VALID_LEN - VALID_RAW_LEN.  */
-  Idx len;
-  /* End of the buffer may be shorter than its length in the cases such
-     as re_match_2, re_search_2.  Then, we use STOP for end of the buffer
-     instead of LEN.  */
-  Idx raw_stop;
-  /* This is RAW_STOP - RAW_MBS_IDX adjusted through OFFSETS.  */
-  Idx stop;
-
-  /* The context of mbs[0].  We store the context independently, since
-     the context of mbs[0] may be different from raw_mbs[0], which is
-     the beginning of the input string.  */
-  unsigned int tip_context;
-  /* The translation passed as a part of an argument of re_compile_pattern.  */
-  RE_TRANSLATE_TYPE trans;
-  /* Copy of re_dfa_t's word_char.  */
-  re_const_bitset_ptr_t word_char;
-  /* true if REG_ICASE.  */
-  unsigned char icase;
-  unsigned char is_utf8;
-  unsigned char map_notascii;
-  unsigned char mbs_allocated;
-  unsigned char offsets_needed;
-  unsigned char newline_anchor;
-  unsigned char word_ops_used;
-  int mb_cur_max;
-};
-typedef struct re_string_t re_string_t;
-
-
-struct re_dfa_t;
-typedef struct re_dfa_t re_dfa_t;
-
-#ifndef _LIBC
-# define internal_function
-#endif
-
-#ifndef NOT_IN_libc
-static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr,
-						Idx new_buf_len)
-     internal_function;
-# ifdef RE_ENABLE_I18N
-static void build_wcs_buffer (re_string_t *pstr) internal_function;
-static reg_errcode_t build_wcs_upper_buffer (re_string_t *pstr)
-  internal_function;
-# endif /* RE_ENABLE_I18N */
-static void build_upper_buffer (re_string_t *pstr) internal_function;
-static void re_string_translate_buffer (re_string_t *pstr) internal_function;
-static unsigned int re_string_context_at (const re_string_t *input, Idx idx,
-					  int eflags)
-     internal_function __attribute__ ((pure));
-#endif
-#define re_string_peek_byte(pstr, offset) \
-  ((pstr)->mbs[(pstr)->cur_idx + offset])
-#define re_string_fetch_byte(pstr) \
-  ((pstr)->mbs[(pstr)->cur_idx++])
-#define re_string_first_byte(pstr, idx) \
-  ((idx) == (pstr)->valid_len || (pstr)->wcs[idx] != WEOF)
-#define re_string_is_single_byte_char(pstr, idx) \
-  ((pstr)->wcs[idx] != WEOF && ((pstr)->valid_len == (idx) + 1 \
-				|| (pstr)->wcs[(idx) + 1] != WEOF))
-#define re_string_eoi(pstr) ((pstr)->stop <= (pstr)->cur_idx)
-#define re_string_cur_idx(pstr) ((pstr)->cur_idx)
-#define re_string_get_buffer(pstr) ((pstr)->mbs)
-#define re_string_length(pstr) ((pstr)->len)
-#define re_string_byte_at(pstr,idx) ((pstr)->mbs[idx])
-#define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx))
-#define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx))
-
-#if defined _LIBC || HAVE_ALLOCA
-# include <alloca.h>
-#endif
-
-#ifndef _LIBC
-# if HAVE_ALLOCA
-/* The OS usually guarantees only one guard page at the bottom of the stack,
-   and a page size can be as small as 4096 bytes.  So we cannot safely
-   allocate anything larger than 4096 bytes.  Also care for the possibility
-   of a few compiler-allocated temporary stack slots.  */
-#  define __libc_use_alloca(n) ((n) < 4032)
-# else
-/* alloca is implemented with malloc, so just use malloc.  */
-#  define __libc_use_alloca(n) 0
-#  undef alloca
-#  define alloca(n) malloc (n)
-# endif
-#endif
-
-#ifdef _LIBC
-# define MALLOC_0_IS_NONNULL 1
-#elif !defined MALLOC_0_IS_NONNULL
-# define MALLOC_0_IS_NONNULL 0
-#endif
-
-#ifndef MAX
-# define MAX(a,b) ((a) < (b) ? (b) : (a))
-#endif
-#ifndef MIN
-# define MIN(a,b) ((a) < (b) ? (a) : (b))
-#endif
-
-#define re_malloc(t,n) ((t *) malloc ((n) * sizeof (t)))
-#define re_realloc(p,t,n) ((t *) realloc (p, (n) * sizeof (t)))
-#define re_free(p) free (p)
-
-struct bin_tree_t
-{
-  struct bin_tree_t *parent;
-  struct bin_tree_t *left;
-  struct bin_tree_t *right;
-  struct bin_tree_t *first;
-  struct bin_tree_t *next;
-
-  re_token_t token;
-
-  /* 'node_idx' is the index in dfa->nodes, if 'type' == 0.
-     Otherwise 'type' indicate the type of this node.  */
-  Idx node_idx;
-};
-typedef struct bin_tree_t bin_tree_t;
-
-#define BIN_TREE_STORAGE_SIZE \
-  ((1024 - sizeof (void *)) / sizeof (bin_tree_t))
-
-struct bin_tree_storage_t
-{
-  struct bin_tree_storage_t *next;
-  bin_tree_t data[BIN_TREE_STORAGE_SIZE];
-};
-typedef struct bin_tree_storage_t bin_tree_storage_t;
-
-#define CONTEXT_WORD 1
-#define CONTEXT_NEWLINE (CONTEXT_WORD << 1)
-#define CONTEXT_BEGBUF (CONTEXT_NEWLINE << 1)
-#define CONTEXT_ENDBUF (CONTEXT_BEGBUF << 1)
-
-#define IS_WORD_CONTEXT(c) ((c) & CONTEXT_WORD)
-#define IS_NEWLINE_CONTEXT(c) ((c) & CONTEXT_NEWLINE)
-#define IS_BEGBUF_CONTEXT(c) ((c) & CONTEXT_BEGBUF)
-#define IS_ENDBUF_CONTEXT(c) ((c) & CONTEXT_ENDBUF)
-#define IS_ORDINARY_CONTEXT(c) ((c) == 0)
-
-#define IS_WORD_CHAR(ch) (isalnum (ch) || (ch) == '_')
-#define IS_NEWLINE(ch) ((ch) == NEWLINE_CHAR)
-#define IS_WIDE_WORD_CHAR(ch) (iswalnum (ch) || (ch) == L'_')
-#define IS_WIDE_NEWLINE(ch) ((ch) == WIDE_NEWLINE_CHAR)
-
-#define NOT_SATISFY_PREV_CONSTRAINT(constraint,context) \
- ((((constraint) & PREV_WORD_CONSTRAINT) && !IS_WORD_CONTEXT (context)) \
-  || ((constraint & PREV_NOTWORD_CONSTRAINT) && IS_WORD_CONTEXT (context)) \
-  || ((constraint & PREV_NEWLINE_CONSTRAINT) && !IS_NEWLINE_CONTEXT (context))\
-  || ((constraint & PREV_BEGBUF_CONSTRAINT) && !IS_BEGBUF_CONTEXT (context)))
-
-#define NOT_SATISFY_NEXT_CONSTRAINT(constraint,context) \
- ((((constraint) & NEXT_WORD_CONSTRAINT) && !IS_WORD_CONTEXT (context)) \
-  || (((constraint) & NEXT_NOTWORD_CONSTRAINT) && IS_WORD_CONTEXT (context)) \
-  || (((constraint) & NEXT_NEWLINE_CONSTRAINT) && !IS_NEWLINE_CONTEXT (context)) \
-  || (((constraint) & NEXT_ENDBUF_CONSTRAINT) && !IS_ENDBUF_CONTEXT (context)))
-
-struct re_dfastate_t
-{
-  re_hashval_t hash;
-  re_node_set nodes;
-  re_node_set non_eps_nodes;
-  re_node_set inveclosure;
-  re_node_set *entrance_nodes;
-  struct re_dfastate_t **trtable, **word_trtable;
-  unsigned int context : 4;
-  unsigned int halt : 1;
-  /* If this state can accept "multi byte".
-     Note that we refer to multibyte characters, and multi character
-     collating elements as "multi byte".  */
-  unsigned int accept_mb : 1;
-  /* If this state has backreference node(s).  */
-  unsigned int has_backref : 1;
-  unsigned int has_constraint : 1;
-};
-typedef struct re_dfastate_t re_dfastate_t;
-
-struct re_state_table_entry
-{
-  Idx num;
-  Idx alloc;
-  re_dfastate_t **array;
-};
-
-/* Array type used in re_sub_match_last_t and re_sub_match_top_t.  */
-
-typedef struct
-{
-  Idx next_idx;
-  Idx alloc;
-  re_dfastate_t **array;
-} state_array_t;
-
-/* Store information about the node NODE whose type is OP_CLOSE_SUBEXP.  */
-
-typedef struct
-{
-  Idx node;
-  Idx str_idx; /* The position NODE match at.  */
-  state_array_t path;
-} re_sub_match_last_t;
-
-/* Store information about the node NODE whose type is OP_OPEN_SUBEXP.
-   And information about the node, whose type is OP_CLOSE_SUBEXP,
-   corresponding to NODE is stored in LASTS.  */
-
-typedef struct
-{
-  Idx str_idx;
-  Idx node;
-  state_array_t *path;
-  Idx alasts; /* Allocation size of LASTS.  */
-  Idx nlasts; /* The number of LASTS.  */
-  re_sub_match_last_t **lasts;
-} re_sub_match_top_t;
-
-struct re_backref_cache_entry
-{
-  Idx node;
-  Idx str_idx;
-  Idx subexp_from;
-  Idx subexp_to;
-  char more;
-  char unused;
-  unsigned short int eps_reachable_subexps_map;
-};
-
-typedef struct
-{
-  /* The string object corresponding to the input string.  */
-  re_string_t input;
-#if defined _LIBC || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
-  const re_dfa_t *const dfa;
-#else
-  const re_dfa_t *dfa;
-#endif
-  /* EFLAGS of the argument of regexec.  */
-  int eflags;
-  /* Where the matching ends.  */
-  Idx match_last;
-  Idx last_node;
-  /* The state log used by the matcher.  */
-  re_dfastate_t **state_log;
-  Idx state_log_top;
-  /* Back reference cache.  */
-  Idx nbkref_ents;
-  Idx abkref_ents;
-  struct re_backref_cache_entry *bkref_ents;
-  int max_mb_elem_len;
-  Idx nsub_tops;
-  Idx asub_tops;
-  re_sub_match_top_t **sub_tops;
-} re_match_context_t;
-
-typedef struct
-{
-  re_dfastate_t **sifted_states;
-  re_dfastate_t **limited_states;
-  Idx last_node;
-  Idx last_str_idx;
-  re_node_set limits;
-} re_sift_context_t;
-
-struct re_fail_stack_ent_t
-{
-  Idx idx;
-  Idx node;
-  regmatch_t *regs;
-  re_node_set eps_via_nodes;
-};
-
-struct re_fail_stack_t
-{
-  Idx num;
-  Idx alloc;
-  struct re_fail_stack_ent_t *stack;
-};
-
-struct re_dfa_t
-{
-  re_token_t *nodes;
-  size_t nodes_alloc;
-  size_t nodes_len;
-  Idx *nexts;
-  Idx *org_indices;
-  re_node_set *edests;
-  re_node_set *eclosures;
-  re_node_set *inveclosures;
-  struct re_state_table_entry *state_table;
-  re_dfastate_t *init_state;
-  re_dfastate_t *init_state_word;
-  re_dfastate_t *init_state_nl;
-  re_dfastate_t *init_state_begbuf;
-  bin_tree_t *str_tree;
-  bin_tree_storage_t *str_tree_storage;
-  re_bitset_ptr_t sb_char;
-  int str_tree_storage_idx;
-
-  /* number of subexpressions 're_nsub' is in regex_t.  */
-  re_hashval_t state_hash_mask;
-  Idx init_node;
-  Idx nbackref; /* The number of backreference in this dfa.  */
-
-  /* Bitmap expressing which backreference is used.  */
-  bitset_word_t used_bkref_map;
-  bitset_word_t completed_bkref_map;
-
-  unsigned int has_plural_match : 1;
-  /* If this dfa has "multibyte node", which is a backreference or
-     a node which can accept multibyte character or multi character
-     collating element.  */
-  unsigned int has_mb_node : 1;
-  unsigned int is_utf8 : 1;
-  unsigned int map_notascii : 1;
-  unsigned int word_ops_used : 1;
-  int mb_cur_max;
-  bitset_t word_char;
-  reg_syntax_t syntax;
-  Idx *subexp_map;
-#ifdef DEBUG
-  char* re_str;
-#endif
-  lock_define (lock)
-};
-
-#define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_set))
-#define re_node_set_remove(set,id) \
-  (re_node_set_remove_at (set, re_node_set_contains (set, id) - 1))
-#define re_node_set_empty(p) ((p)->nelem = 0)
-#define re_node_set_free(set) re_free ((set)->elems)
-
-
-typedef enum
-{
-  SB_CHAR,
-  MB_CHAR,
-  EQUIV_CLASS,
-  COLL_SYM,
-  CHAR_CLASS
-} bracket_elem_type;
-
-typedef struct
-{
-  bracket_elem_type type;
-  union
-  {
-    unsigned char ch;
-    unsigned char *name;
-    wchar_t wch;
-  } opr;
-} bracket_elem_t;
-
-
-/* Functions for bitset_t operation.  */
-
-static void
-bitset_set (bitset_t set, Idx i)
-{
-  set[i / BITSET_WORD_BITS] |= (bitset_word_t) 1 << i % BITSET_WORD_BITS;
-}
-
-static void
-bitset_clear (bitset_t set, Idx i)
-{
-  set[i / BITSET_WORD_BITS] &= ~ ((bitset_word_t) 1 << i % BITSET_WORD_BITS);
-}
-
-static bool
-bitset_contain (const bitset_t set, Idx i)
-{
-  return (set[i / BITSET_WORD_BITS] >> i % BITSET_WORD_BITS) & 1;
-}
-
-static void
-bitset_empty (bitset_t set)
-{
-  memset (set, '\0', sizeof (bitset_t));
-}
-
-static void
-bitset_set_all (bitset_t set)
-{
-  memset (set, -1, sizeof (bitset_word_t) * (SBC_MAX / BITSET_WORD_BITS));
-  if (SBC_MAX % BITSET_WORD_BITS != 0)
-    set[BITSET_WORDS - 1] =
-      ((bitset_word_t) 1 << SBC_MAX % BITSET_WORD_BITS) - 1;
-}
-
-static void
-bitset_copy (bitset_t dest, const bitset_t src)
-{
-  memcpy (dest, src, sizeof (bitset_t));
-}
-
-static void __attribute__ ((unused))
-bitset_not (bitset_t set)
-{
-  int bitset_i;
-  for (bitset_i = 0; bitset_i < SBC_MAX / BITSET_WORD_BITS; ++bitset_i)
-    set[bitset_i] = ~set[bitset_i];
-  if (SBC_MAX % BITSET_WORD_BITS != 0)
-    set[BITSET_WORDS - 1] =
-      ((((bitset_word_t) 1 << SBC_MAX % BITSET_WORD_BITS) - 1)
-       & ~set[BITSET_WORDS - 1]);
-}
-
-static void __attribute__ ((unused))
-bitset_merge (bitset_t dest, const bitset_t src)
-{
-  int bitset_i;
-  for (bitset_i = 0; bitset_i < BITSET_WORDS; ++bitset_i)
-    dest[bitset_i] |= src[bitset_i];
-}
-
-static void __attribute__ ((unused))
-bitset_mask (bitset_t dest, const bitset_t src)
-{
-  int bitset_i;
-  for (bitset_i = 0; bitset_i < BITSET_WORDS; ++bitset_i)
-    dest[bitset_i] &= src[bitset_i];
-}
-
-#ifdef RE_ENABLE_I18N
-/* Functions for re_string.  */
-static int
-internal_function __attribute__ ((pure, unused))
-re_string_char_size_at (const re_string_t *pstr, Idx idx)
-{
-  int byte_idx;
-  if (pstr->mb_cur_max == 1)
-    return 1;
-  for (byte_idx = 1; idx + byte_idx < pstr->valid_len; ++byte_idx)
-    if (pstr->wcs[idx + byte_idx] != WEOF)
-      break;
-  return byte_idx;
-}
-
-static wint_t
-internal_function __attribute__ ((pure, unused))
-re_string_wchar_at (const re_string_t *pstr, Idx idx)
-{
-  if (pstr->mb_cur_max == 1)
-    return (wint_t) pstr->mbs[idx];
-  return (wint_t) pstr->wcs[idx];
-}
-
-# ifndef NOT_IN_libc
-static int
-internal_function __attribute__ ((pure, unused))
-re_string_elem_size_at (const re_string_t *pstr, Idx idx)
-{
-#  ifdef _LIBC
-  const unsigned char *p, *extra;
-  const int32_t *table, *indirect;
-#   include <locale/weight.h>
-  uint_fast32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
-
-  if (nrules != 0)
-    {
-      table = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
-      extra = (const unsigned char *)
-	_NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB);
-      indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE,
-						_NL_COLLATE_INDIRECTMB);
-      p = pstr->mbs + idx;
-      findidx (&p, pstr->len - idx);
-      return p - pstr->mbs - idx;
-    }
-  else
-#  endif /* _LIBC */
-    return 1;
-}
-# endif
-#endif /* RE_ENABLE_I18N */
-
-#ifndef __GNUC_PREREQ
-# if defined __GNUC__ && defined __GNUC_MINOR__
-#  define __GNUC_PREREQ(maj, min) \
-         ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
-# else
-#  define __GNUC_PREREQ(maj, min) 0
-# endif
-#endif
-
-#if __GNUC_PREREQ (3,4)
-# undef __attribute_warn_unused_result__
-# define __attribute_warn_unused_result__ \
-   __attribute__ ((__warn_unused_result__))
-#else
-# define __attribute_warn_unused_result__ /* empty */
-#endif
-
-#endif /*  NAGIOS_REGEX_INTERNAL_H_INCLUDED */

+ 0 - 4410
gl/regexec.c~

@@ -1,4410 +0,0 @@
-/* Extended regular expression matching and search library.
-   Copyright (C) 2002-2013 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public
-   License as published by the Free Software Foundation; either
-   version 3 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags,
-				     Idx n) internal_function;
-static void match_ctx_clean (re_match_context_t *mctx) internal_function;
-static void match_ctx_free (re_match_context_t *cache) internal_function;
-static reg_errcode_t match_ctx_add_entry (re_match_context_t *cache, Idx node,
-					  Idx str_idx, Idx from, Idx to)
-     internal_function;
-static Idx search_cur_bkref_entry (const re_match_context_t *mctx, Idx str_idx)
-     internal_function;
-static reg_errcode_t match_ctx_add_subtop (re_match_context_t *mctx, Idx node,
-					   Idx str_idx) internal_function;
-static re_sub_match_last_t * match_ctx_add_sublast (re_sub_match_top_t *subtop,
-						    Idx node, Idx str_idx)
-     internal_function;
-static void sift_ctx_init (re_sift_context_t *sctx, re_dfastate_t **sifted_sts,
-			   re_dfastate_t **limited_sts, Idx last_node,
-			   Idx last_str_idx)
-     internal_function;
-static reg_errcode_t re_search_internal (const regex_t *preg,
-					 const char *string, Idx length,
-					 Idx start, Idx last_start, Idx stop,
-					 size_t nmatch, regmatch_t pmatch[],
-					 int eflags) internal_function;
-static regoff_t re_search_2_stub (struct re_pattern_buffer *bufp,
-				  const char *string1, Idx length1,
-				  const char *string2, Idx length2,
-				  Idx start, regoff_t range,
-				  struct re_registers *regs,
-				  Idx stop, bool ret_len) internal_function;
-static regoff_t re_search_stub (struct re_pattern_buffer *bufp,
-				const char *string, Idx length, Idx start,
-				regoff_t range, Idx stop,
-				struct re_registers *regs,
-				bool ret_len) internal_function;
-static unsigned re_copy_regs (struct re_registers *regs, regmatch_t *pmatch,
-                              Idx nregs, int regs_allocated) internal_function;
-static reg_errcode_t prune_impossible_nodes (re_match_context_t *mctx)
-     internal_function;
-static Idx check_matching (re_match_context_t *mctx, bool fl_longest_match,
-			   Idx *p_match_first) internal_function;
-static Idx check_halt_state_context (const re_match_context_t *mctx,
-				     const re_dfastate_t *state, Idx idx)
-     internal_function;
-static void update_regs (const re_dfa_t *dfa, regmatch_t *pmatch,
-			 regmatch_t *prev_idx_match, Idx cur_node,
-			 Idx cur_idx, Idx nmatch) internal_function;
-static reg_errcode_t push_fail_stack (struct re_fail_stack_t *fs,
-				      Idx str_idx, Idx dest_node, Idx nregs,
-				      regmatch_t *regs,
-				      re_node_set *eps_via_nodes)
-     internal_function;
-static reg_errcode_t set_regs (const regex_t *preg,
-			       const re_match_context_t *mctx,
-			       size_t nmatch, regmatch_t *pmatch,
-			       bool fl_backtrack) internal_function;
-static reg_errcode_t free_fail_stack_return (struct re_fail_stack_t *fs)
-     internal_function;
-
-#ifdef RE_ENABLE_I18N
-static int sift_states_iter_mb (const re_match_context_t *mctx,
-				re_sift_context_t *sctx,
-				Idx node_idx, Idx str_idx, Idx max_str_idx)
-     internal_function;
-#endif /* RE_ENABLE_I18N */
-static reg_errcode_t sift_states_backward (const re_match_context_t *mctx,
-					   re_sift_context_t *sctx)
-     internal_function;
-static reg_errcode_t build_sifted_states (const re_match_context_t *mctx,
-					  re_sift_context_t *sctx, Idx str_idx,
-					  re_node_set *cur_dest)
-     internal_function;
-static reg_errcode_t update_cur_sifted_state (const re_match_context_t *mctx,
-					      re_sift_context_t *sctx,
-					      Idx str_idx,
-					      re_node_set *dest_nodes)
-     internal_function;
-static reg_errcode_t add_epsilon_src_nodes (const re_dfa_t *dfa,
-					    re_node_set *dest_nodes,
-					    const re_node_set *candidates)
-     internal_function;
-static bool check_dst_limits (const re_match_context_t *mctx,
-			      const re_node_set *limits,
-			      Idx dst_node, Idx dst_idx, Idx src_node,
-			      Idx src_idx) internal_function;
-static int check_dst_limits_calc_pos_1 (const re_match_context_t *mctx,
-					int boundaries, Idx subexp_idx,
-					Idx from_node, Idx bkref_idx)
-     internal_function;
-static int check_dst_limits_calc_pos (const re_match_context_t *mctx,
-				      Idx limit, Idx subexp_idx,
-				      Idx node, Idx str_idx,
-				      Idx bkref_idx) internal_function;
-static reg_errcode_t check_subexp_limits (const re_dfa_t *dfa,
-					  re_node_set *dest_nodes,
-					  const re_node_set *candidates,
-					  re_node_set *limits,
-					  struct re_backref_cache_entry *bkref_ents,
-					  Idx str_idx) internal_function;
-static reg_errcode_t sift_states_bkref (const re_match_context_t *mctx,
-					re_sift_context_t *sctx,
-					Idx str_idx, const re_node_set *candidates)
-     internal_function;
-static reg_errcode_t merge_state_array (const re_dfa_t *dfa,
-					re_dfastate_t **dst,
-					re_dfastate_t **src, Idx num)
-     internal_function;
-static re_dfastate_t *find_recover_state (reg_errcode_t *err,
-					 re_match_context_t *mctx) internal_function;
-static re_dfastate_t *transit_state (reg_errcode_t *err,
-				     re_match_context_t *mctx,
-				     re_dfastate_t *state) internal_function;
-static re_dfastate_t *merge_state_with_log (reg_errcode_t *err,
-					    re_match_context_t *mctx,
-					    re_dfastate_t *next_state)
-     internal_function;
-static reg_errcode_t check_subexp_matching_top (re_match_context_t *mctx,
-						re_node_set *cur_nodes,
-						Idx str_idx) internal_function;
-#if 0
-static re_dfastate_t *transit_state_sb (reg_errcode_t *err,
-					re_match_context_t *mctx,
-					re_dfastate_t *pstate)
-     internal_function;
-#endif
-#ifdef RE_ENABLE_I18N
-static reg_errcode_t transit_state_mb (re_match_context_t *mctx,
-				       re_dfastate_t *pstate)
-     internal_function;
-#endif /* RE_ENABLE_I18N */
-static reg_errcode_t transit_state_bkref (re_match_context_t *mctx,
-					  const re_node_set *nodes)
-     internal_function;
-static reg_errcode_t get_subexp (re_match_context_t *mctx,
-				 Idx bkref_node, Idx bkref_str_idx)
-     internal_function;
-static reg_errcode_t get_subexp_sub (re_match_context_t *mctx,
-				     const re_sub_match_top_t *sub_top,
-				     re_sub_match_last_t *sub_last,
-				     Idx bkref_node, Idx bkref_str)
-     internal_function;
-static Idx find_subexp_node (const re_dfa_t *dfa, const re_node_set *nodes,
-			     Idx subexp_idx, int type) internal_function;
-static reg_errcode_t check_arrival (re_match_context_t *mctx,
-				    state_array_t *path, Idx top_node,
-				    Idx top_str, Idx last_node, Idx last_str,
-				    int type) internal_function;
-static reg_errcode_t check_arrival_add_next_nodes (re_match_context_t *mctx,
-						   Idx str_idx,
-						   re_node_set *cur_nodes,
-						   re_node_set *next_nodes)
-     internal_function;
-static reg_errcode_t check_arrival_expand_ecl (const re_dfa_t *dfa,
-					       re_node_set *cur_nodes,
-					       Idx ex_subexp, int type)
-     internal_function;
-static reg_errcode_t check_arrival_expand_ecl_sub (const re_dfa_t *dfa,
-						   re_node_set *dst_nodes,
-						   Idx target, Idx ex_subexp,
-						   int type) internal_function;
-static reg_errcode_t expand_bkref_cache (re_match_context_t *mctx,
-					 re_node_set *cur_nodes, Idx cur_str,
-					 Idx subexp_num, int type)
-     internal_function;
-static bool build_trtable (const re_dfa_t *dfa,
-			   re_dfastate_t *state) internal_function;
-#ifdef RE_ENABLE_I18N
-static int check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx,
-				    const re_string_t *input, Idx idx)
-     internal_function;
-# ifdef _LIBC
-static unsigned int find_collation_sequence_value (const unsigned char *mbs,
-						   size_t name_len)
-     internal_function;
-# endif /* _LIBC */
-#endif /* RE_ENABLE_I18N */
-static Idx group_nodes_into_DFAstates (const re_dfa_t *dfa,
-				       const re_dfastate_t *state,
-				       re_node_set *states_node,
-				       bitset_t *states_ch) internal_function;
-static bool check_node_accept (const re_match_context_t *mctx,
-			       const re_token_t *node, Idx idx)
-     internal_function;
-static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len)
-     internal_function;
-
-/* Entry point for POSIX code.  */
-
-/* regexec searches for a given pattern, specified by PREG, in the
-   string STRING.
-
-   If NMATCH is zero or REG_NOSUB was set in the cflags argument to
-   'regcomp', we ignore PMATCH.  Otherwise, we assume PMATCH has at
-   least NMATCH elements, and we set them to the offsets of the
-   corresponding matched substrings.
-
-   EFLAGS specifies "execution flags" which affect matching: if
-   REG_NOTBOL is set, then ^ does not match at the beginning of the
-   string; if REG_NOTEOL is set, then $ does not match at the end.
-
-   We return 0 if we find a match and REG_NOMATCH if not.  */
-
-int
-regexec (preg, string, nmatch, pmatch, eflags)
-    const regex_t *_Restrict_ preg;
-    const char *_Restrict_ string;
-    size_t nmatch;
-    regmatch_t pmatch[_Restrict_arr_];
-    int eflags;
-{
-  reg_errcode_t err;
-  Idx start, length;
-  re_dfa_t *dfa = preg->buffer;
-
-  if (eflags & ~(REG_NOTBOL | REG_NOTEOL | REG_STARTEND))
-    return REG_BADPAT;
-
-  if (eflags & REG_STARTEND)
-    {
-      start = pmatch[0].rm_so;
-      length = pmatch[0].rm_eo;
-    }
-  else
-    {
-      start = 0;
-      length = strlen (string);
-    }
-
-  lock_lock (dfa->lock);
-  if (preg->no_sub)
-    err = re_search_internal (preg, string, length, start, length,
-			      length, 0, NULL, eflags);
-  else
-    err = re_search_internal (preg, string, length, start, length,
-			      length, nmatch, pmatch, eflags);
-  lock_unlock (dfa->lock);
-  return err != REG_NOERROR;
-}
-
-#ifdef _LIBC
-# include <shlib-compat.h>
-versioned_symbol (libc, __regexec, regexec, GLIBC_2_3_4);
-
-# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
-__typeof__ (__regexec) __compat_regexec;
-
-int
-attribute_compat_text_section
-__compat_regexec (const regex_t *_Restrict_ preg,
-		  const char *_Restrict_ string, size_t nmatch,
-		  regmatch_t pmatch[], int eflags)
-{
-  return regexec (preg, string, nmatch, pmatch,
-		  eflags & (REG_NOTBOL | REG_NOTEOL));
-}
-compat_symbol (libc, __compat_regexec, regexec, GLIBC_2_0);
-# endif
-#endif
-
-/* Entry points for GNU code.  */
-
-/* re_match, re_search, re_match_2, re_search_2
-
-   The former two functions operate on STRING with length LENGTH,
-   while the later two operate on concatenation of STRING1 and STRING2
-   with lengths LENGTH1 and LENGTH2, respectively.
-
-   re_match() matches the compiled pattern in BUFP against the string,
-   starting at index START.
-
-   re_search() first tries matching at index START, then it tries to match
-   starting from index START + 1, and so on.  The last start position tried
-   is START + RANGE.  (Thus RANGE = 0 forces re_search to operate the same
-   way as re_match().)
-
-   The parameter STOP of re_{match,search}_2 specifies that no match exceeding
-   the first STOP characters of the concatenation of the strings should be
-   concerned.
-
-   If REGS is not NULL, and BUFP->no_sub is not set, the offsets of the match
-   and all groups is stored in REGS.  (For the "_2" variants, the offsets are
-   computed relative to the concatenation, not relative to the individual
-   strings.)
-
-   On success, re_match* functions return the length of the match, re_search*
-   return the position of the start of the match.  Return value -1 means no
-   match was found and -2 indicates an internal error.  */
-
-regoff_t
-re_match (bufp, string, length, start, regs)
-    struct re_pattern_buffer *bufp;
-    const char *string;
-    Idx length, start;
-    struct re_registers *regs;
-{
-  return re_search_stub (bufp, string, length, start, 0, length, regs, true);
-}
-#ifdef _LIBC
-weak_alias (__re_match, re_match)
-#endif
-
-regoff_t
-re_search (bufp, string, length, start, range, regs)
-    struct re_pattern_buffer *bufp;
-    const char *string;
-    Idx length, start;
-    regoff_t range;
-    struct re_registers *regs;
-{
-  return re_search_stub (bufp, string, length, start, range, length, regs,
-			 false);
-}
-#ifdef _LIBC
-weak_alias (__re_search, re_search)
-#endif
-
-regoff_t
-re_match_2 (bufp, string1, length1, string2, length2, start, regs, stop)
-    struct re_pattern_buffer *bufp;
-    const char *string1, *string2;
-    Idx length1, length2, start, stop;
-    struct re_registers *regs;
-{
-  return re_search_2_stub (bufp, string1, length1, string2, length2,
-			   start, 0, regs, stop, true);
-}
-#ifdef _LIBC
-weak_alias (__re_match_2, re_match_2)
-#endif
-
-regoff_t
-re_search_2 (bufp, string1, length1, string2, length2, start, range, regs, stop)
-    struct re_pattern_buffer *bufp;
-    const char *string1, *string2;
-    Idx length1, length2, start, stop;
-    regoff_t range;
-    struct re_registers *regs;
-{
-  return re_search_2_stub (bufp, string1, length1, string2, length2,
-			   start, range, regs, stop, false);
-}
-#ifdef _LIBC
-weak_alias (__re_search_2, re_search_2)
-#endif
-
-static regoff_t
-re_search_2_stub (struct re_pattern_buffer *bufp,
-		  const char *string1, Idx length1,
-		  const char *string2, Idx length2,
-		  Idx start, regoff_t range, struct re_registers *regs,
-		  Idx stop, bool ret_len)
-{
-  const char *str;
-  regoff_t rval;
-  Idx len = length1 + length2;
-  char *s = NULL;
-
-  if (BE (length1 < 0 || length2 < 0 || stop < 0 || len < length1, 0))
-    return -2;
-
-  /* Concatenate the strings.  */
-  if (length2 > 0)
-    if (length1 > 0)
-      {
-	s = re_malloc (char, len);
-
-	if (BE (s == NULL, 0))
-	  return -2;
-#ifdef _LIBC
-	memcpy (__mempcpy (s, string1, length1), string2, length2);
-#else
-	memcpy (s, string1, length1);
-	memcpy (s + length1, string2, length2);
-#endif
-	str = s;
-      }
-    else
-      str = string2;
-  else
-    str = string1;
-
-  rval = re_search_stub (bufp, str, len, start, range, stop, regs,
-			 ret_len);
-  re_free (s);
-  return rval;
-}
-
-/* The parameters have the same meaning as those of re_search.
-   Additional parameters:
-   If RET_LEN is true the length of the match is returned (re_match style);
-   otherwise the position of the match is returned.  */
-
-static regoff_t
-re_search_stub (struct re_pattern_buffer *bufp,
-		const char *string, Idx length,
-		Idx start, regoff_t range, Idx stop, struct re_registers *regs,
-		bool ret_len)
-{
-  reg_errcode_t result;
-  regmatch_t *pmatch;
-  Idx nregs;
-  regoff_t rval;
-  int eflags = 0;
-  re_dfa_t *dfa = bufp->buffer;
-  Idx last_start = start + range;
-
-  /* Check for out-of-range.  */
-  if (BE (start < 0 || start > length, 0))
-    return -1;
-  if (BE (length < last_start || (0 <= range && last_start < start), 0))
-    last_start = length;
-  else if (BE (last_start < 0 || (range < 0 && start <= last_start), 0))
-    last_start = 0;
-
-  lock_lock (dfa->lock);
-
-  eflags |= (bufp->not_bol) ? REG_NOTBOL : 0;
-  eflags |= (bufp->not_eol) ? REG_NOTEOL : 0;
-
-  /* Compile fastmap if we haven't yet.  */
-  if (start < last_start && bufp->fastmap != NULL && !bufp->fastmap_accurate)
-    re_compile_fastmap (bufp);
-
-  if (BE (bufp->no_sub, 0))
-    regs = NULL;
-
-  /* We need at least 1 register.  */
-  if (regs == NULL)
-    nregs = 1;
-  else if (BE (bufp->regs_allocated == REGS_FIXED
-	       && regs->num_regs <= bufp->re_nsub, 0))
-    {
-      nregs = regs->num_regs;
-      if (BE (nregs < 1, 0))
-	{
-	  /* Nothing can be copied to regs.  */
-	  regs = NULL;
-	  nregs = 1;
-	}
-    }
-  else
-    nregs = bufp->re_nsub + 1;
-  pmatch = re_malloc (regmatch_t, nregs);
-  if (BE (pmatch == NULL, 0))
-    {
-      rval = -2;
-      goto out;
-    }
-
-  result = re_search_internal (bufp, string, length, start, last_start, stop,
-			       nregs, pmatch, eflags);
-
-  rval = 0;
-
-  /* I hope we needn't fill their regs with -1's when no match was found.  */
-  if (result != REG_NOERROR)
-    rval = result == REG_NOMATCH ? -1 : -2;
-  else if (regs != NULL)
-    {
-      /* If caller wants register contents data back, copy them.  */
-      bufp->regs_allocated = re_copy_regs (regs, pmatch, nregs,
-					   bufp->regs_allocated);
-      if (BE (bufp->regs_allocated == REGS_UNALLOCATED, 0))
-	rval = -2;
-    }
-
-  if (BE (rval == 0, 1))
-    {
-      if (ret_len)
-	{
-	  assert (pmatch[0].rm_so == start);
-	  rval = pmatch[0].rm_eo - start;
-	}
-      else
-	rval = pmatch[0].rm_so;
-    }
-  re_free (pmatch);
- out:
-  lock_unlock (dfa->lock);
-  return rval;
-}
-
-static unsigned
-re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, Idx nregs,
-	      int regs_allocated)
-{
-  int rval = REGS_REALLOCATE;
-  Idx i;
-  Idx need_regs = nregs + 1;
-  /* We need one extra element beyond 'num_regs' for the '-1' marker GNU code
-     uses.  */
-
-  /* Have the register data arrays been allocated?  */
-  if (regs_allocated == REGS_UNALLOCATED)
-    { /* No.  So allocate them with malloc.  */
-      regs->start = re_malloc (regoff_t, need_regs);
-      if (BE (regs->start == NULL, 0))
-	return REGS_UNALLOCATED;
-      regs->end = re_malloc (regoff_t, need_regs);
-      if (BE (regs->end == NULL, 0))
-	{
-	  re_free (regs->start);
-	  return REGS_UNALLOCATED;
-	}
-      regs->num_regs = need_regs;
-    }
-  else if (regs_allocated == REGS_REALLOCATE)
-    { /* Yes.  If we need more elements than were already
-	 allocated, reallocate them.  If we need fewer, just
-	 leave it alone.  */
-      if (BE (need_regs > regs->num_regs, 0))
-	{
-	  regoff_t *new_start = re_realloc (regs->start, regoff_t, need_regs);
-	  regoff_t *new_end;
-	  if (BE (new_start == NULL, 0))
-	    return REGS_UNALLOCATED;
-	  new_end = re_realloc (regs->end, regoff_t, need_regs);
-	  if (BE (new_end == NULL, 0))
-	    {
-	      re_free (new_start);
-	      return REGS_UNALLOCATED;
-	    }
-	  regs->start = new_start;
-	  regs->end = new_end;
-	  regs->num_regs = need_regs;
-	}
-    }
-  else
-    {
-      assert (regs_allocated == REGS_FIXED);
-      /* This function may not be called with REGS_FIXED and nregs too big.  */
-      assert (regs->num_regs >= nregs);
-      rval = REGS_FIXED;
-    }
-
-  /* Copy the regs.  */
-  for (i = 0; i < nregs; ++i)
-    {
-      regs->start[i] = pmatch[i].rm_so;
-      regs->end[i] = pmatch[i].rm_eo;
-    }
-  for ( ; i < regs->num_regs; ++i)
-    regs->start[i] = regs->end[i] = -1;
-
-  return rval;
-}
-
-/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
-   ENDS.  Subsequent matches using PATTERN_BUFFER and REGS will use
-   this memory for recording register information.  STARTS and ENDS
-   must be allocated using the malloc library routine, and must each
-   be at least NUM_REGS * sizeof (regoff_t) bytes long.
-
-   If NUM_REGS == 0, then subsequent matches should allocate their own
-   register data.
-
-   Unless this function is called, the first search or match using
-   PATTERN_BUFFER will allocate its own register data, without
-   freeing the old data.  */
-
-void
-re_set_registers (bufp, regs, num_regs, starts, ends)
-    struct re_pattern_buffer *bufp;
-    struct re_registers *regs;
-    __re_size_t num_regs;
-    regoff_t *starts, *ends;
-{
-  if (num_regs)
-    {
-      bufp->regs_allocated = REGS_REALLOCATE;
-      regs->num_regs = num_regs;
-      regs->start = starts;
-      regs->end = ends;
-    }
-  else
-    {
-      bufp->regs_allocated = REGS_UNALLOCATED;
-      regs->num_regs = 0;
-      regs->start = regs->end = NULL;
-    }
-}
-#ifdef _LIBC
-weak_alias (__re_set_registers, re_set_registers)
-#endif
-
-/* Entry points compatible with 4.2 BSD regex library.  We don't define
-   them unless specifically requested.  */
-
-#if defined _REGEX_RE_COMP || defined _LIBC
-int
-# ifdef _LIBC
-weak_function
-# endif
-re_exec (s)
-     const char *s;
-{
-  return 0 == regexec (&re_comp_buf, s, 0, NULL, 0);
-}
-#endif /* _REGEX_RE_COMP */
-
-/* Internal entry point.  */
-
-/* Searches for a compiled pattern PREG in the string STRING, whose
-   length is LENGTH.  NMATCH, PMATCH, and EFLAGS have the same
-   meaning as with regexec.  LAST_START is START + RANGE, where
-   START and RANGE have the same meaning as with re_search.
-   Return REG_NOERROR if we find a match, and REG_NOMATCH if not,
-   otherwise return the error code.
-   Note: We assume front end functions already check ranges.
-   (0 <= LAST_START && LAST_START <= LENGTH)  */
-
-static reg_errcode_t
-__attribute_warn_unused_result__
-re_search_internal (const regex_t *preg,
-		    const char *string, Idx length,
-		    Idx start, Idx last_start, Idx stop,
-		    size_t nmatch, regmatch_t pmatch[],
-		    int eflags)
-{
-  reg_errcode_t err;
-  const re_dfa_t *dfa = preg->buffer;
-  Idx left_lim, right_lim;
-  int incr;
-  bool fl_longest_match;
-  int match_kind;
-  Idx match_first;
-  Idx match_last = REG_MISSING;
-  Idx extra_nmatch;
-  bool sb;
-  int ch;
-#if defined _LIBC || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
-  re_match_context_t mctx = { .dfa = dfa };
-#else
-  re_match_context_t mctx;
-#endif
-  char *fastmap = ((preg->fastmap != NULL && preg->fastmap_accurate
-		    && start != last_start && !preg->can_be_null)
-		   ? preg->fastmap : NULL);
-  RE_TRANSLATE_TYPE t = preg->translate;
-
-#if !(defined _LIBC || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L))
-  memset (&mctx, '\0', sizeof (re_match_context_t));
-  mctx.dfa = dfa;
-#endif
-
-  extra_nmatch = (nmatch > preg->re_nsub) ? nmatch - (preg->re_nsub + 1) : 0;
-  nmatch -= extra_nmatch;
-
-  /* Check if the DFA haven't been compiled.  */
-  if (BE (preg->used == 0 || dfa->init_state == NULL
-	  || dfa->init_state_word == NULL || dfa->init_state_nl == NULL
-	  || dfa->init_state_begbuf == NULL, 0))
-    return REG_NOMATCH;
-
-#ifdef DEBUG
-  /* We assume front-end functions already check them.  */
-  assert (0 <= last_start && last_start <= length);
-#endif
-
-  /* If initial states with non-begbuf contexts have no elements,
-     the regex must be anchored.  If preg->newline_anchor is set,
-     we'll never use init_state_nl, so do not check it.  */
-  if (dfa->init_state->nodes.nelem == 0
-      && dfa->init_state_word->nodes.nelem == 0
-      && (dfa->init_state_nl->nodes.nelem == 0
-	  || !preg->newline_anchor))
-    {
-      if (start != 0 && last_start != 0)
-        return REG_NOMATCH;
-      start = last_start = 0;
-    }
-
-  /* We must check the longest matching, if nmatch > 0.  */
-  fl_longest_match = (nmatch != 0 || dfa->nbackref);
-
-  err = re_string_allocate (&mctx.input, string, length, dfa->nodes_len + 1,
-			    preg->translate, (preg->syntax & RE_ICASE) != 0,
-			    dfa);
-  if (BE (err != REG_NOERROR, 0))
-    goto free_return;
-  mctx.input.stop = stop;
-  mctx.input.raw_stop = stop;
-  mctx.input.newline_anchor = preg->newline_anchor;
-
-  err = match_ctx_init (&mctx, eflags, dfa->nbackref * 2);
-  if (BE (err != REG_NOERROR, 0))
-    goto free_return;
-
-  /* We will log all the DFA states through which the dfa pass,
-     if nmatch > 1, or this dfa has "multibyte node", which is a
-     back-reference or a node which can accept multibyte character or
-     multi character collating element.  */
-  if (nmatch > 1 || dfa->has_mb_node)
-    {
-      /* Avoid overflow.  */
-      if (BE ((MIN (IDX_MAX, SIZE_MAX / sizeof (re_dfastate_t *))
-               <= mctx.input.bufs_len), 0))
-	{
-	  err = REG_ESPACE;
-	  goto free_return;
-	}
-
-      mctx.state_log = re_malloc (re_dfastate_t *, mctx.input.bufs_len + 1);
-      if (BE (mctx.state_log == NULL, 0))
-	{
-	  err = REG_ESPACE;
-	  goto free_return;
-	}
-    }
-  else
-    mctx.state_log = NULL;
-
-  match_first = start;
-  mctx.input.tip_context = (eflags & REG_NOTBOL) ? CONTEXT_BEGBUF
-			   : CONTEXT_NEWLINE | CONTEXT_BEGBUF;
-
-  /* Check incrementally whether the input string matches.  */
-  incr = (last_start < start) ? -1 : 1;
-  left_lim = (last_start < start) ? last_start : start;
-  right_lim = (last_start < start) ? start : last_start;
-  sb = dfa->mb_cur_max == 1;
-  match_kind =
-    (fastmap
-     ? ((sb || !(preg->syntax & RE_ICASE || t) ? 4 : 0)
-	| (start <= last_start ? 2 : 0)
-	| (t != NULL ? 1 : 0))
-     : 8);
-
-  for (;; match_first += incr)
-    {
-      err = REG_NOMATCH;
-      if (match_first < left_lim || right_lim < match_first)
-	goto free_return;
-
-      /* Advance as rapidly as possible through the string, until we
-	 find a plausible place to start matching.  This may be done
-	 with varying efficiency, so there are various possibilities:
-	 only the most common of them are specialized, in order to
-	 save on code size.  We use a switch statement for speed.  */
-      switch (match_kind)
-	{
-	case 8:
-	  /* No fastmap.  */
-	  break;
-
-	case 7:
-	  /* Fastmap with single-byte translation, match forward.  */
-	  while (BE (match_first < right_lim, 1)
-		 && !fastmap[t[(unsigned char) string[match_first]]])
-	    ++match_first;
-	  goto forward_match_found_start_or_reached_end;
-
-	case 6:
-	  /* Fastmap without translation, match forward.  */
-	  while (BE (match_first < right_lim, 1)
-		 && !fastmap[(unsigned char) string[match_first]])
-	    ++match_first;
-
-	forward_match_found_start_or_reached_end:
-	  if (BE (match_first == right_lim, 0))
-	    {
-	      ch = match_first >= length
-		       ? 0 : (unsigned char) string[match_first];
-	      if (!fastmap[t ? t[ch] : ch])
-		goto free_return;
-	    }
-	  break;
-
-	case 4:
-	case 5:
-	  /* Fastmap without multi-byte translation, match backwards.  */
-	  while (match_first >= left_lim)
-	    {
-	      ch = match_first >= length
-		       ? 0 : (unsigned char) string[match_first];
-	      if (fastmap[t ? t[ch] : ch])
-		break;
-	      --match_first;
-	    }
-	  if (match_first < left_lim)
-	    goto free_return;
-	  break;
-
-	default:
-	  /* In this case, we can't determine easily the current byte,
-	     since it might be a component byte of a multibyte
-	     character.  Then we use the constructed buffer instead.  */
-	  for (;;)
-	    {
-	      /* If MATCH_FIRST is out of the valid range, reconstruct the
-		 buffers.  */
-	      __re_size_t offset = match_first - mctx.input.raw_mbs_idx;
-	      if (BE (offset >= (__re_size_t) mctx.input.valid_raw_len, 0))
-		{
-		  err = re_string_reconstruct (&mctx.input, match_first,
-					       eflags);
-		  if (BE (err != REG_NOERROR, 0))
-		    goto free_return;
-
-		  offset = match_first - mctx.input.raw_mbs_idx;
-		}
-	      /* If MATCH_FIRST is out of the buffer, leave it as '\0'.
-		 Note that MATCH_FIRST must not be smaller than 0.  */
-	      ch = (match_first >= length
-		    ? 0 : re_string_byte_at (&mctx.input, offset));
-	      if (fastmap[ch])
-		break;
-	      match_first += incr;
-	      if (match_first < left_lim || match_first > right_lim)
-		{
-		  err = REG_NOMATCH;
-		  goto free_return;
-		}
-	    }
-	  break;
-	}
-
-      /* Reconstruct the buffers so that the matcher can assume that
-	 the matching starts from the beginning of the buffer.  */
-      err = re_string_reconstruct (&mctx.input, match_first, eflags);
-      if (BE (err != REG_NOERROR, 0))
-	goto free_return;
-
-#ifdef RE_ENABLE_I18N
-     /* Don't consider this char as a possible match start if it part,
-	yet isn't the head, of a multibyte character.  */
-      if (!sb && !re_string_first_byte (&mctx.input, 0))
-	continue;
-#endif
-
-      /* It seems to be appropriate one, then use the matcher.  */
-      /* We assume that the matching starts from 0.  */
-      mctx.state_log_top = mctx.nbkref_ents = mctx.max_mb_elem_len = 0;
-      match_last = check_matching (&mctx, fl_longest_match,
-				   start <= last_start ? &match_first : NULL);
-      if (match_last != REG_MISSING)
-	{
-	  if (BE (match_last == REG_ERROR, 0))
-	    {
-	      err = REG_ESPACE;
-	      goto free_return;
-	    }
-	  else
-	    {
-	      mctx.match_last = match_last;
-	      if ((!preg->no_sub && nmatch > 1) || dfa->nbackref)
-		{
-		  re_dfastate_t *pstate = mctx.state_log[match_last];
-		  mctx.last_node = check_halt_state_context (&mctx, pstate,
-							     match_last);
-		}
-	      if ((!preg->no_sub && nmatch > 1 && dfa->has_plural_match)
-		  || dfa->nbackref)
-		{
-		  err = prune_impossible_nodes (&mctx);
-		  if (err == REG_NOERROR)
-		    break;
-		  if (BE (err != REG_NOMATCH, 0))
-		    goto free_return;
-		  match_last = REG_MISSING;
-		}
-	      else
-		break; /* We found a match.  */
-	    }
-	}
-
-      match_ctx_clean (&mctx);
-    }
-
-#ifdef DEBUG
-  assert (match_last != REG_MISSING);
-  assert (err == REG_NOERROR);
-#endif
-
-  /* Set pmatch[] if we need.  */
-  if (nmatch > 0)
-    {
-      Idx reg_idx;
-
-      /* Initialize registers.  */
-      for (reg_idx = 1; reg_idx < nmatch; ++reg_idx)
-	pmatch[reg_idx].rm_so = pmatch[reg_idx].rm_eo = -1;
-
-      /* Set the points where matching start/end.  */
-      pmatch[0].rm_so = 0;
-      pmatch[0].rm_eo = mctx.match_last;
-      /* FIXME: This function should fail if mctx.match_last exceeds
-	 the maximum possible regoff_t value.  We need a new error
-	 code REG_OVERFLOW.  */
-
-      if (!preg->no_sub && nmatch > 1)
-	{
-	  err = set_regs (preg, &mctx, nmatch, pmatch,
-			  dfa->has_plural_match && dfa->nbackref > 0);
-	  if (BE (err != REG_NOERROR, 0))
-	    goto free_return;
-	}
-
-      /* At last, add the offset to each register, since we slid
-	 the buffers so that we could assume that the matching starts
-	 from 0.  */
-      for (reg_idx = 0; reg_idx < nmatch; ++reg_idx)
-	if (pmatch[reg_idx].rm_so != -1)
-	  {
-#ifdef RE_ENABLE_I18N
-	    if (BE (mctx.input.offsets_needed != 0, 0))
-	      {
-		pmatch[reg_idx].rm_so =
-		  (pmatch[reg_idx].rm_so == mctx.input.valid_len
-		   ? mctx.input.valid_raw_len
-		   : mctx.input.offsets[pmatch[reg_idx].rm_so]);
-		pmatch[reg_idx].rm_eo =
-		  (pmatch[reg_idx].rm_eo == mctx.input.valid_len
-		   ? mctx.input.valid_raw_len
-		   : mctx.input.offsets[pmatch[reg_idx].rm_eo]);
-	      }
-#else
-	    assert (mctx.input.offsets_needed == 0);
-#endif
-	    pmatch[reg_idx].rm_so += match_first;
-	    pmatch[reg_idx].rm_eo += match_first;
-	  }
-      for (reg_idx = 0; reg_idx < extra_nmatch; ++reg_idx)
-	{
-	  pmatch[nmatch + reg_idx].rm_so = -1;
-	  pmatch[nmatch + reg_idx].rm_eo = -1;
-	}
-
-      if (dfa->subexp_map)
-	for (reg_idx = 0; reg_idx + 1 < nmatch; reg_idx++)
-	  if (dfa->subexp_map[reg_idx] != reg_idx)
-	    {
-	      pmatch[reg_idx + 1].rm_so
-		= pmatch[dfa->subexp_map[reg_idx] + 1].rm_so;
-	      pmatch[reg_idx + 1].rm_eo
-		= pmatch[dfa->subexp_map[reg_idx] + 1].rm_eo;
-	    }
-    }
-
- free_return:
-  re_free (mctx.state_log);
-  if (dfa->nbackref)
-    match_ctx_free (&mctx);
-  re_string_destruct (&mctx.input);
-  return err;
-}
-
-static reg_errcode_t
-__attribute_warn_unused_result__
-prune_impossible_nodes (re_match_context_t *mctx)
-{
-  const re_dfa_t *const dfa = mctx->dfa;
-  Idx halt_node, match_last;
-  reg_errcode_t ret;
-  re_dfastate_t **sifted_states;
-  re_dfastate_t **lim_states = NULL;
-  re_sift_context_t sctx;
-#ifdef DEBUG
-  assert (mctx->state_log != NULL);
-#endif
-  match_last = mctx->match_last;
-  halt_node = mctx->last_node;
-
-  /* Avoid overflow.  */
-  if (BE (MIN (IDX_MAX, SIZE_MAX / sizeof (re_dfastate_t *)) <= match_last, 0))
-    return REG_ESPACE;
-
-  sifted_states = re_malloc (re_dfastate_t *, match_last + 1);
-  if (BE (sifted_states == NULL, 0))
-    {
-      ret = REG_ESPACE;
-      goto free_return;
-    }
-  if (dfa->nbackref)
-    {
-      lim_states = re_malloc (re_dfastate_t *, match_last + 1);
-      if (BE (lim_states == NULL, 0))
-	{
-	  ret = REG_ESPACE;
-	  goto free_return;
-	}
-      while (1)
-	{
-	  memset (lim_states, '\0',
-		  sizeof (re_dfastate_t *) * (match_last + 1));
-	  sift_ctx_init (&sctx, sifted_states, lim_states, halt_node,
-			 match_last);
-	  ret = sift_states_backward (mctx, &sctx);
-	  re_node_set_free (&sctx.limits);
-	  if (BE (ret != REG_NOERROR, 0))
-	      goto free_return;
-	  if (sifted_states[0] != NULL || lim_states[0] != NULL)
-	    break;
-	  do
-	    {
-	      --match_last;
-	      if (! REG_VALID_INDEX (match_last))
-		{
-		  ret = REG_NOMATCH;
-		  goto free_return;
-		}
-	    } while (mctx->state_log[match_last] == NULL
-		     || !mctx->state_log[match_last]->halt);
-	  halt_node = check_halt_state_context (mctx,
-						mctx->state_log[match_last],
-						match_last);
-	}
-      ret = merge_state_array (dfa, sifted_states, lim_states,
-			       match_last + 1);
-      re_free (lim_states);
-      lim_states = NULL;
-      if (BE (ret != REG_NOERROR, 0))
-	goto free_return;
-    }
-  else
-    {
-      sift_ctx_init (&sctx, sifted_states, lim_states, halt_node, match_last);
-      ret = sift_states_backward (mctx, &sctx);
-      re_node_set_free (&sctx.limits);
-      if (BE (ret != REG_NOERROR, 0))
-	goto free_return;
-      if (sifted_states[0] == NULL)
-	{
-	  ret = REG_NOMATCH;
-	  goto free_return;
-	}
-    }
-  re_free (mctx->state_log);
-  mctx->state_log = sifted_states;
-  sifted_states = NULL;
-  mctx->last_node = halt_node;
-  mctx->match_last = match_last;
-  ret = REG_NOERROR;
- free_return:
-  re_free (sifted_states);
-  re_free (lim_states);
-  return ret;
-}
-
-/* Acquire an initial state and return it.
-   We must select appropriate initial state depending on the context,
-   since initial states may have constraints like "\<", "^", etc..  */
-
-static inline re_dfastate_t *
-__attribute__ ((always_inline)) internal_function
-acquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx,
-			    Idx idx)
-{
-  const re_dfa_t *const dfa = mctx->dfa;
-  if (dfa->init_state->has_constraint)
-    {
-      unsigned int context;
-      context = re_string_context_at (&mctx->input, idx - 1, mctx->eflags);
-      if (IS_WORD_CONTEXT (context))
-	return dfa->init_state_word;
-      else if (IS_ORDINARY_CONTEXT (context))
-	return dfa->init_state;
-      else if (IS_BEGBUF_CONTEXT (context) && IS_NEWLINE_CONTEXT (context))
-	return dfa->init_state_begbuf;
-      else if (IS_NEWLINE_CONTEXT (context))
-	return dfa->init_state_nl;
-      else if (IS_BEGBUF_CONTEXT (context))
-	{
-	  /* It is relatively rare case, then calculate on demand.  */
-	  return re_acquire_state_context (err, dfa,
-					   dfa->init_state->entrance_nodes,
-					   context);
-	}
-      else
-	/* Must not happen?  */
-	return dfa->init_state;
-    }
-  else
-    return dfa->init_state;
-}
-
-/* Check whether the regular expression match input string INPUT or not,
-   and return the index where the matching end.  Return REG_MISSING if
-   there is no match, and return REG_ERROR in case of an error.
-   FL_LONGEST_MATCH means we want the POSIX longest matching.
-   If P_MATCH_FIRST is not NULL, and the match fails, it is set to the
-   next place where we may want to try matching.
-   Note that the matcher assumes that the matching starts from the current
-   index of the buffer.  */
-
-static Idx
-internal_function __attribute_warn_unused_result__
-check_matching (re_match_context_t *mctx, bool fl_longest_match,
-		Idx *p_match_first)
-{
-  const re_dfa_t *const dfa = mctx->dfa;
-  reg_errcode_t err;
-  Idx match = 0;
-  Idx match_last = REG_MISSING;
-  Idx cur_str_idx = re_string_cur_idx (&mctx->input);
-  re_dfastate_t *cur_state;
-  bool at_init_state = p_match_first != NULL;
-  Idx next_start_idx = cur_str_idx;
-
-  err = REG_NOERROR;
-  cur_state = acquire_init_state_context (&err, mctx, cur_str_idx);
-  /* An initial state must not be NULL (invalid).  */
-  if (BE (cur_state == NULL, 0))
-    {
-      assert (err == REG_ESPACE);
-      return REG_ERROR;
-    }
-
-  if (mctx->state_log != NULL)
-    {
-      mctx->state_log[cur_str_idx] = cur_state;
-
-      /* Check OP_OPEN_SUBEXP in the initial state in case that we use them
-	 later.  E.g. Processing back references.  */
-      if (BE (dfa->nbackref, 0))
-	{
-	  at_init_state = false;
-	  err = check_subexp_matching_top (mctx, &cur_state->nodes, 0);
-	  if (BE (err != REG_NOERROR, 0))
-	    return err;
-
-	  if (cur_state->has_backref)
-	    {
-	      err = transit_state_bkref (mctx, &cur_state->nodes);
-	      if (BE (err != REG_NOERROR, 0))
-		return err;
-	    }
-	}
-    }
-
-  /* If the RE accepts NULL string.  */
-  if (BE (cur_state->halt, 0))
-    {
-      if (!cur_state->has_constraint
-	  || check_halt_state_context (mctx, cur_state, cur_str_idx))
-	{
-	  if (!fl_longest_match)
-	    return cur_str_idx;
-	  else
-	    {
-	      match_last = cur_str_idx;
-	      match = 1;
-	    }
-	}
-    }
-
-  while (!re_string_eoi (&mctx->input))
-    {
-      re_dfastate_t *old_state = cur_state;
-      Idx next_char_idx = re_string_cur_idx (&mctx->input) + 1;
-
-      if ((BE (next_char_idx >= mctx->input.bufs_len, 0)
-	   && mctx->input.bufs_len < mctx->input.len)
-	  || (BE (next_char_idx >= mctx->input.valid_len, 0)
-	      && mctx->input.valid_len < mctx->input.len))
-	{
-	  err = extend_buffers (mctx, next_char_idx + 1);
-	  if (BE (err != REG_NOERROR, 0))
-	    {
-	      assert (err == REG_ESPACE);
-	      return REG_ERROR;
-	    }
-	}
-
-      cur_state = transit_state (&err, mctx, cur_state);
-      if (mctx->state_log != NULL)
-	cur_state = merge_state_with_log (&err, mctx, cur_state);
-
-      if (cur_state == NULL)
-	{
-	  /* Reached the invalid state or an error.  Try to recover a valid
-	     state using the state log, if available and if we have not
-	     already found a valid (even if not the longest) match.  */
-	  if (BE (err != REG_NOERROR, 0))
-	    return REG_ERROR;
-
-	  if (mctx->state_log == NULL
-	      || (match && !fl_longest_match)
-	      || (cur_state = find_recover_state (&err, mctx)) == NULL)
-	    break;
-	}
-
-      if (BE (at_init_state, 0))
-	{
-	  if (old_state == cur_state)
-	    next_start_idx = next_char_idx;
-	  else
-	    at_init_state = false;
-	}
-
-      if (cur_state->halt)
-	{
-	  /* Reached a halt state.
-	     Check the halt state can satisfy the current context.  */
-	  if (!cur_state->has_constraint
-	      || check_halt_state_context (mctx, cur_state,
-					   re_string_cur_idx (&mctx->input)))
-	    {
-	      /* We found an appropriate halt state.  */
-	      match_last = re_string_cur_idx (&mctx->input);
-	      match = 1;
-
-	      /* We found a match, do not modify match_first below.  */
-	      p_match_first = NULL;
-	      if (!fl_longest_match)
-		break;
-	    }
-	}
-    }
-
-  if (p_match_first)
-    *p_match_first += next_start_idx;
-
-  return match_last;
-}
-
-/* Check NODE match the current context.  */
-
-static bool
-internal_function
-check_halt_node_context (const re_dfa_t *dfa, Idx node, unsigned int context)
-{
-  re_token_type_t type = dfa->nodes[node].type;
-  unsigned int constraint = dfa->nodes[node].constraint;
-  if (type != END_OF_RE)
-    return false;
-  if (!constraint)
-    return true;
-  if (NOT_SATISFY_NEXT_CONSTRAINT (constraint, context))
-    return false;
-  return true;
-}
-
-/* Check the halt state STATE match the current context.
-   Return 0 if not match, if the node, STATE has, is a halt node and
-   match the context, return the node.  */
-
-static Idx
-internal_function
-check_halt_state_context (const re_match_context_t *mctx,
-			  const re_dfastate_t *state, Idx idx)
-{
-  Idx i;
-  unsigned int context;
-#ifdef DEBUG
-  assert (state->halt);
-#endif
-  context = re_string_context_at (&mctx->input, idx, mctx->eflags);
-  for (i = 0; i < state->nodes.nelem; ++i)
-    if (check_halt_node_context (mctx->dfa, state->nodes.elems[i], context))
-      return state->nodes.elems[i];
-  return 0;
-}
-
-/* Compute the next node to which "NFA" transit from NODE("NFA" is a NFA
-   corresponding to the DFA).
-   Return the destination node, and update EPS_VIA_NODES;
-   return REG_MISSING in case of errors.  */
-
-static Idx
-internal_function
-proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs,
-		   Idx *pidx, Idx node, re_node_set *eps_via_nodes,
-		   struct re_fail_stack_t *fs)
-{
-  const re_dfa_t *const dfa = mctx->dfa;
-  Idx i;
-  bool ok;
-  if (IS_EPSILON_NODE (dfa->nodes[node].type))
-    {
-      re_node_set *cur_nodes = &mctx->state_log[*pidx]->nodes;
-      re_node_set *edests = &dfa->edests[node];
-      Idx dest_node;
-      ok = re_node_set_insert (eps_via_nodes, node);
-      if (BE (! ok, 0))
-	return REG_ERROR;
-      /* Pick up a valid destination, or return REG_MISSING if none
-	 is found.  */
-      for (dest_node = REG_MISSING, i = 0; i < edests->nelem; ++i)
-	{
-	  Idx candidate = edests->elems[i];
-	  if (!re_node_set_contains (cur_nodes, candidate))
-	    continue;
-          if (dest_node == REG_MISSING)
-	    dest_node = candidate;
-
-	  else
-	    {
-	      /* In order to avoid infinite loop like "(a*)*", return the second
-		 epsilon-transition if the first was already considered.  */
-	      if (re_node_set_contains (eps_via_nodes, dest_node))
-		return candidate;
-
-	      /* Otherwise, push the second epsilon-transition on the fail stack.  */
-	      else if (fs != NULL
-		       && push_fail_stack (fs, *pidx, candidate, nregs, regs,
-					   eps_via_nodes))
-		return REG_ERROR;
-
-	      /* We know we are going to exit.  */
-	      break;
-	    }
-	}
-      return dest_node;
-    }
-  else
-    {
-      Idx naccepted = 0;
-      re_token_type_t type = dfa->nodes[node].type;
-
-#ifdef RE_ENABLE_I18N
-      if (dfa->nodes[node].accept_mb)
-	naccepted = check_node_accept_bytes (dfa, node, &mctx->input, *pidx);
-      else
-#endif /* RE_ENABLE_I18N */
-      if (type == OP_BACK_REF)
-	{
-	  Idx subexp_idx = dfa->nodes[node].opr.idx + 1;
-	  naccepted = regs[subexp_idx].rm_eo - regs[subexp_idx].rm_so;
-	  if (fs != NULL)
-	    {
-	      if (regs[subexp_idx].rm_so == -1 || regs[subexp_idx].rm_eo == -1)
-		return REG_MISSING;
-	      else if (naccepted)
-		{
-		  char *buf = (char *) re_string_get_buffer (&mctx->input);
-		  if (memcmp (buf + regs[subexp_idx].rm_so, buf + *pidx,
-			      naccepted) != 0)
-		    return REG_MISSING;
-		}
-	    }
-
-	  if (naccepted == 0)
-	    {
-	      Idx dest_node;
-	      ok = re_node_set_insert (eps_via_nodes, node);
-	      if (BE (! ok, 0))
-		return REG_ERROR;
-	      dest_node = dfa->edests[node].elems[0];
-	      if (re_node_set_contains (&mctx->state_log[*pidx]->nodes,
-					dest_node))
-		return dest_node;
-	    }
-	}
-
-      if (naccepted != 0
-	  || check_node_accept (mctx, dfa->nodes + node, *pidx))
-	{
-	  Idx dest_node = dfa->nexts[node];
-	  *pidx = (naccepted == 0) ? *pidx + 1 : *pidx + naccepted;
-	  if (fs && (*pidx > mctx->match_last || mctx->state_log[*pidx] == NULL
-		     || !re_node_set_contains (&mctx->state_log[*pidx]->nodes,
-					       dest_node)))
-	    return REG_MISSING;
-	  re_node_set_empty (eps_via_nodes);
-	  return dest_node;
-	}
-    }
-  return REG_MISSING;
-}
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-push_fail_stack (struct re_fail_stack_t *fs, Idx str_idx, Idx dest_node,
-		 Idx nregs, regmatch_t *regs, re_node_set *eps_via_nodes)
-{
-  reg_errcode_t err;
-  Idx num = fs->num++;
-  if (fs->num == fs->alloc)
-    {
-      struct re_fail_stack_ent_t *new_array;
-      new_array = realloc (fs->stack, (sizeof (struct re_fail_stack_ent_t)
-				       * fs->alloc * 2));
-      if (new_array == NULL)
-	return REG_ESPACE;
-      fs->alloc *= 2;
-      fs->stack = new_array;
-    }
-  fs->stack[num].idx = str_idx;
-  fs->stack[num].node = dest_node;
-  fs->stack[num].regs = re_malloc (regmatch_t, nregs);
-  if (fs->stack[num].regs == NULL)
-    return REG_ESPACE;
-  memcpy (fs->stack[num].regs, regs, sizeof (regmatch_t) * nregs);
-  err = re_node_set_init_copy (&fs->stack[num].eps_via_nodes, eps_via_nodes);
-  return err;
-}
-
-static Idx
-internal_function
-pop_fail_stack (struct re_fail_stack_t *fs, Idx *pidx, Idx nregs,
-		regmatch_t *regs, re_node_set *eps_via_nodes)
-{
-  Idx num = --fs->num;
-  assert (REG_VALID_INDEX (num));
-  *pidx = fs->stack[num].idx;
-  memcpy (regs, fs->stack[num].regs, sizeof (regmatch_t) * nregs);
-  re_node_set_free (eps_via_nodes);
-  re_free (fs->stack[num].regs);
-  *eps_via_nodes = fs->stack[num].eps_via_nodes;
-  return fs->stack[num].node;
-}
-
-/* Set the positions where the subexpressions are starts/ends to registers
-   PMATCH.
-   Note: We assume that pmatch[0] is already set, and
-   pmatch[i].rm_so == pmatch[i].rm_eo == -1 for 0 < i < nmatch.  */
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch,
-	  regmatch_t *pmatch, bool fl_backtrack)
-{
-  const re_dfa_t *dfa = preg->buffer;
-  Idx idx, cur_node;
-  re_node_set eps_via_nodes;
-  struct re_fail_stack_t *fs;
-  struct re_fail_stack_t fs_body = { 0, 2, NULL };
-  regmatch_t *prev_idx_match;
-  bool prev_idx_match_malloced = false;
-
-#ifdef DEBUG
-  assert (nmatch > 1);
-  assert (mctx->state_log != NULL);
-#endif
-  if (fl_backtrack)
-    {
-      fs = &fs_body;
-      fs->stack = re_malloc (struct re_fail_stack_ent_t, fs->alloc);
-      if (fs->stack == NULL)
-	return REG_ESPACE;
-    }
-  else
-    fs = NULL;
-
-  cur_node = dfa->init_node;
-  re_node_set_init_empty (&eps_via_nodes);
-
-  if (__libc_use_alloca (nmatch * sizeof (regmatch_t)))
-    prev_idx_match = (regmatch_t *) alloca (nmatch * sizeof (regmatch_t));
-  else
-    {
-      prev_idx_match = re_malloc (regmatch_t, nmatch);
-      if (prev_idx_match == NULL)
-	{
-	  free_fail_stack_return (fs);
-	  return REG_ESPACE;
-	}
-      prev_idx_match_malloced = true;
-    }
-  memcpy (prev_idx_match, pmatch, sizeof (regmatch_t) * nmatch);
-
-  for (idx = pmatch[0].rm_so; idx <= pmatch[0].rm_eo ;)
-    {
-      update_regs (dfa, pmatch, prev_idx_match, cur_node, idx, nmatch);
-
-      if (idx == pmatch[0].rm_eo && cur_node == mctx->last_node)
-	{
-	  Idx reg_idx;
-	  if (fs)
-	    {
-	      for (reg_idx = 0; reg_idx < nmatch; ++reg_idx)
-		if (pmatch[reg_idx].rm_so > -1 && pmatch[reg_idx].rm_eo == -1)
-		  break;
-	      if (reg_idx == nmatch)
-		{
-		  re_node_set_free (&eps_via_nodes);
-		  if (prev_idx_match_malloced)
-		    re_free (prev_idx_match);
-		  return free_fail_stack_return (fs);
-		}
-	      cur_node = pop_fail_stack (fs, &idx, nmatch, pmatch,
-					 &eps_via_nodes);
-	    }
-	  else
-	    {
-	      re_node_set_free (&eps_via_nodes);
-	      if (prev_idx_match_malloced)
-		re_free (prev_idx_match);
-	      return REG_NOERROR;
-	    }
-	}
-
-      /* Proceed to next node.  */
-      cur_node = proceed_next_node (mctx, nmatch, pmatch, &idx, cur_node,
-				    &eps_via_nodes, fs);
-
-      if (BE (! REG_VALID_INDEX (cur_node), 0))
-	{
-	  if (BE (cur_node == REG_ERROR, 0))
-	    {
-	      re_node_set_free (&eps_via_nodes);
-	      if (prev_idx_match_malloced)
-		re_free (prev_idx_match);
-	      free_fail_stack_return (fs);
-	      return REG_ESPACE;
-	    }
-	  if (fs)
-	    cur_node = pop_fail_stack (fs, &idx, nmatch, pmatch,
-				       &eps_via_nodes);
-	  else
-	    {
-	      re_node_set_free (&eps_via_nodes);
-	      if (prev_idx_match_malloced)
-		re_free (prev_idx_match);
-	      return REG_NOMATCH;
-	    }
-	}
-    }
-  re_node_set_free (&eps_via_nodes);
-  if (prev_idx_match_malloced)
-    re_free (prev_idx_match);
-  return free_fail_stack_return (fs);
-}
-
-static reg_errcode_t
-internal_function
-free_fail_stack_return (struct re_fail_stack_t *fs)
-{
-  if (fs)
-    {
-      Idx fs_idx;
-      for (fs_idx = 0; fs_idx < fs->num; ++fs_idx)
-	{
-	  re_node_set_free (&fs->stack[fs_idx].eps_via_nodes);
-	  re_free (fs->stack[fs_idx].regs);
-	}
-      re_free (fs->stack);
-    }
-  return REG_NOERROR;
-}
-
-static void
-internal_function
-update_regs (const re_dfa_t *dfa, regmatch_t *pmatch,
-	     regmatch_t *prev_idx_match, Idx cur_node, Idx cur_idx, Idx nmatch)
-{
-  int type = dfa->nodes[cur_node].type;
-  if (type == OP_OPEN_SUBEXP)
-    {
-      Idx reg_num = dfa->nodes[cur_node].opr.idx + 1;
-
-      /* We are at the first node of this sub expression.  */
-      if (reg_num < nmatch)
-	{
-	  pmatch[reg_num].rm_so = cur_idx;
-	  pmatch[reg_num].rm_eo = -1;
-	}
-    }
-  else if (type == OP_CLOSE_SUBEXP)
-    {
-      Idx reg_num = dfa->nodes[cur_node].opr.idx + 1;
-      if (reg_num < nmatch)
-	{
-	  /* We are at the last node of this sub expression.  */
-	  if (pmatch[reg_num].rm_so < cur_idx)
-	    {
-	      pmatch[reg_num].rm_eo = cur_idx;
-	      /* This is a non-empty match or we are not inside an optional
-		 subexpression.  Accept this right away.  */
-	      memcpy (prev_idx_match, pmatch, sizeof (regmatch_t) * nmatch);
-	    }
-	  else
-	    {
-	      if (dfa->nodes[cur_node].opt_subexp
-		  && prev_idx_match[reg_num].rm_so != -1)
-		/* We transited through an empty match for an optional
-		   subexpression, like (a?)*, and this is not the subexp's
-		   first match.  Copy back the old content of the registers
-		   so that matches of an inner subexpression are undone as
-		   well, like in ((a?))*.  */
-		memcpy (pmatch, prev_idx_match, sizeof (regmatch_t) * nmatch);
-	      else
-		/* We completed a subexpression, but it may be part of
-		   an optional one, so do not update PREV_IDX_MATCH.  */
-		pmatch[reg_num].rm_eo = cur_idx;
-	    }
-	}
-    }
-}
-
-/* This function checks the STATE_LOG from the SCTX->last_str_idx to 0
-   and sift the nodes in each states according to the following rules.
-   Updated state_log will be wrote to STATE_LOG.
-
-   Rules: We throw away the Node 'a' in the STATE_LOG[STR_IDX] if...
-     1. When STR_IDX == MATCH_LAST(the last index in the state_log):
-	If 'a' isn't the LAST_NODE and 'a' can't epsilon transit to
-	the LAST_NODE, we throw away the node 'a'.
-     2. When 0 <= STR_IDX < MATCH_LAST and 'a' accepts
-	string 's' and transit to 'b':
-	i. If 'b' isn't in the STATE_LOG[STR_IDX+strlen('s')], we throw
-	   away the node 'a'.
-	ii. If 'b' is in the STATE_LOG[STR_IDX+strlen('s')] but 'b' is
-	    thrown away, we throw away the node 'a'.
-     3. When 0 <= STR_IDX < MATCH_LAST and 'a' epsilon transit to 'b':
-	i. If 'b' isn't in the STATE_LOG[STR_IDX], we throw away the
-	   node 'a'.
-	ii. If 'b' is in the STATE_LOG[STR_IDX] but 'b' is thrown away,
-	    we throw away the node 'a'.  */
-
-#define STATE_NODE_CONTAINS(state,node) \
-  ((state) != NULL && re_node_set_contains (&(state)->nodes, node))
-
-static reg_errcode_t
-internal_function
-sift_states_backward (const re_match_context_t *mctx, re_sift_context_t *sctx)
-{
-  reg_errcode_t err;
-  int null_cnt = 0;
-  Idx str_idx = sctx->last_str_idx;
-  re_node_set cur_dest;
-
-#ifdef DEBUG
-  assert (mctx->state_log != NULL && mctx->state_log[str_idx] != NULL);
-#endif
-
-  /* Build sifted state_log[str_idx].  It has the nodes which can epsilon
-     transit to the last_node and the last_node itself.  */
-  err = re_node_set_init_1 (&cur_dest, sctx->last_node);
-  if (BE (err != REG_NOERROR, 0))
-    return err;
-  err = update_cur_sifted_state (mctx, sctx, str_idx, &cur_dest);
-  if (BE (err != REG_NOERROR, 0))
-    goto free_return;
-
-  /* Then check each states in the state_log.  */
-  while (str_idx > 0)
-    {
-      /* Update counters.  */
-      null_cnt = (sctx->sifted_states[str_idx] == NULL) ? null_cnt + 1 : 0;
-      if (null_cnt > mctx->max_mb_elem_len)
-	{
-	  memset (sctx->sifted_states, '\0',
-		  sizeof (re_dfastate_t *) * str_idx);
-	  re_node_set_free (&cur_dest);
-	  return REG_NOERROR;
-	}
-      re_node_set_empty (&cur_dest);
-      --str_idx;
-
-      if (mctx->state_log[str_idx])
-	{
-	  err = build_sifted_states (mctx, sctx, str_idx, &cur_dest);
-	  if (BE (err != REG_NOERROR, 0))
-	    goto free_return;
-	}
-
-      /* Add all the nodes which satisfy the following conditions:
-	 - It can epsilon transit to a node in CUR_DEST.
-	 - It is in CUR_SRC.
-	 And update state_log.  */
-      err = update_cur_sifted_state (mctx, sctx, str_idx, &cur_dest);
-      if (BE (err != REG_NOERROR, 0))
-	goto free_return;
-    }
-  err = REG_NOERROR;
- free_return:
-  re_node_set_free (&cur_dest);
-  return err;
-}
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-build_sifted_states (const re_match_context_t *mctx, re_sift_context_t *sctx,
-		     Idx str_idx, re_node_set *cur_dest)
-{
-  const re_dfa_t *const dfa = mctx->dfa;
-  const re_node_set *cur_src = &mctx->state_log[str_idx]->non_eps_nodes;
-  Idx i;
-
-  /* Then build the next sifted state.
-     We build the next sifted state on 'cur_dest', and update
-     'sifted_states[str_idx]' with 'cur_dest'.
-     Note:
-     'cur_dest' is the sifted state from 'state_log[str_idx + 1]'.
-     'cur_src' points the node_set of the old 'state_log[str_idx]'
-     (with the epsilon nodes pre-filtered out).  */
-  for (i = 0; i < cur_src->nelem; i++)
-    {
-      Idx prev_node = cur_src->elems[i];
-      int naccepted = 0;
-      bool ok;
-
-#ifdef DEBUG
-      re_token_type_t type = dfa->nodes[prev_node].type;
-      assert (!IS_EPSILON_NODE (type));
-#endif
-#ifdef RE_ENABLE_I18N
-      /* If the node may accept "multi byte".  */
-      if (dfa->nodes[prev_node].accept_mb)
-	naccepted = sift_states_iter_mb (mctx, sctx, prev_node,
-					 str_idx, sctx->last_str_idx);
-#endif /* RE_ENABLE_I18N */
-
-      /* We don't check backreferences here.
-	 See update_cur_sifted_state().  */
-      if (!naccepted
-	  && check_node_accept (mctx, dfa->nodes + prev_node, str_idx)
-	  && STATE_NODE_CONTAINS (sctx->sifted_states[str_idx + 1],
-				  dfa->nexts[prev_node]))
-	naccepted = 1;
-
-      if (naccepted == 0)
-	continue;
-
-      if (sctx->limits.nelem)
-	{
-	  Idx to_idx = str_idx + naccepted;
-	  if (check_dst_limits (mctx, &sctx->limits,
-				dfa->nexts[prev_node], to_idx,
-				prev_node, str_idx))
-	    continue;
-	}
-      ok = re_node_set_insert (cur_dest, prev_node);
-      if (BE (! ok, 0))
-	return REG_ESPACE;
-    }
-
-  return REG_NOERROR;
-}
-
-/* Helper functions.  */
-
-static reg_errcode_t
-internal_function
-clean_state_log_if_needed (re_match_context_t *mctx, Idx next_state_log_idx)
-{
-  Idx top = mctx->state_log_top;
-
-  if ((next_state_log_idx >= mctx->input.bufs_len
-       && mctx->input.bufs_len < mctx->input.len)
-      || (next_state_log_idx >= mctx->input.valid_len
-	  && mctx->input.valid_len < mctx->input.len))
-    {
-      reg_errcode_t err;
-      err = extend_buffers (mctx, next_state_log_idx + 1);
-      if (BE (err != REG_NOERROR, 0))
-	return err;
-    }
-
-  if (top < next_state_log_idx)
-    {
-      memset (mctx->state_log + top + 1, '\0',
-	      sizeof (re_dfastate_t *) * (next_state_log_idx - top));
-      mctx->state_log_top = next_state_log_idx;
-    }
-  return REG_NOERROR;
-}
-
-static reg_errcode_t
-internal_function
-merge_state_array (const re_dfa_t *dfa, re_dfastate_t **dst,
-		   re_dfastate_t **src, Idx num)
-{
-  Idx st_idx;
-  reg_errcode_t err;
-  for (st_idx = 0; st_idx < num; ++st_idx)
-    {
-      if (dst[st_idx] == NULL)
-	dst[st_idx] = src[st_idx];
-      else if (src[st_idx] != NULL)
-	{
-	  re_node_set merged_set;
-	  err = re_node_set_init_union (&merged_set, &dst[st_idx]->nodes,
-					&src[st_idx]->nodes);
-	  if (BE (err != REG_NOERROR, 0))
-	    return err;
-	  dst[st_idx] = re_acquire_state (&err, dfa, &merged_set);
-	  re_node_set_free (&merged_set);
-	  if (BE (err != REG_NOERROR, 0))
-	    return err;
-	}
-    }
-  return REG_NOERROR;
-}
-
-static reg_errcode_t
-internal_function
-update_cur_sifted_state (const re_match_context_t *mctx,
-			 re_sift_context_t *sctx, Idx str_idx,
-			 re_node_set *dest_nodes)
-{
-  const re_dfa_t *const dfa = mctx->dfa;
-  reg_errcode_t err = REG_NOERROR;
-  const re_node_set *candidates;
-  candidates = ((mctx->state_log[str_idx] == NULL) ? NULL
-		: &mctx->state_log[str_idx]->nodes);
-
-  if (dest_nodes->nelem == 0)
-    sctx->sifted_states[str_idx] = NULL;
-  else
-    {
-      if (candidates)
-	{
-	  /* At first, add the nodes which can epsilon transit to a node in
-	     DEST_NODE.  */
-	  err = add_epsilon_src_nodes (dfa, dest_nodes, candidates);
-	  if (BE (err != REG_NOERROR, 0))
-	    return err;
-
-	  /* Then, check the limitations in the current sift_context.  */
-	  if (sctx->limits.nelem)
-	    {
-	      err = check_subexp_limits (dfa, dest_nodes, candidates, &sctx->limits,
-					 mctx->bkref_ents, str_idx);
-	      if (BE (err != REG_NOERROR, 0))
-		return err;
-	    }
-	}
-
-      sctx->sifted_states[str_idx] = re_acquire_state (&err, dfa, dest_nodes);
-      if (BE (err != REG_NOERROR, 0))
-	return err;
-    }
-
-  if (candidates && mctx->state_log[str_idx]->has_backref)
-    {
-      err = sift_states_bkref (mctx, sctx, str_idx, candidates);
-      if (BE (err != REG_NOERROR, 0))
-	return err;
-    }
-  return REG_NOERROR;
-}
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-add_epsilon_src_nodes (const re_dfa_t *dfa, re_node_set *dest_nodes,
-		       const re_node_set *candidates)
-{
-  reg_errcode_t err = REG_NOERROR;
-  Idx i;
-
-  re_dfastate_t *state = re_acquire_state (&err, dfa, dest_nodes);
-  if (BE (err != REG_NOERROR, 0))
-    return err;
-
-  if (!state->inveclosure.alloc)
-    {
-      err = re_node_set_alloc (&state->inveclosure, dest_nodes->nelem);
-      if (BE (err != REG_NOERROR, 0))
-	return REG_ESPACE;
-      for (i = 0; i < dest_nodes->nelem; i++)
-	{
-	  err = re_node_set_merge (&state->inveclosure,
-				   dfa->inveclosures + dest_nodes->elems[i]);
-	  if (BE (err != REG_NOERROR, 0))
-	    return REG_ESPACE;
-	}
-    }
-  return re_node_set_add_intersect (dest_nodes, candidates,
-				    &state->inveclosure);
-}
-
-static reg_errcode_t
-internal_function
-sub_epsilon_src_nodes (const re_dfa_t *dfa, Idx node, re_node_set *dest_nodes,
-		       const re_node_set *candidates)
-{
-    Idx ecl_idx;
-    reg_errcode_t err;
-    re_node_set *inv_eclosure = dfa->inveclosures + node;
-    re_node_set except_nodes;
-    re_node_set_init_empty (&except_nodes);
-    for (ecl_idx = 0; ecl_idx < inv_eclosure->nelem; ++ecl_idx)
-      {
-	Idx cur_node = inv_eclosure->elems[ecl_idx];
-	if (cur_node == node)
-	  continue;
-	if (IS_EPSILON_NODE (dfa->nodes[cur_node].type))
-	  {
-	    Idx edst1 = dfa->edests[cur_node].elems[0];
-	    Idx edst2 = ((dfa->edests[cur_node].nelem > 1)
-			 ? dfa->edests[cur_node].elems[1] : REG_MISSING);
-	    if ((!re_node_set_contains (inv_eclosure, edst1)
-		 && re_node_set_contains (dest_nodes, edst1))
-		|| (REG_VALID_NONZERO_INDEX (edst2)
-		    && !re_node_set_contains (inv_eclosure, edst2)
-		    && re_node_set_contains (dest_nodes, edst2)))
-	      {
-		err = re_node_set_add_intersect (&except_nodes, candidates,
-						 dfa->inveclosures + cur_node);
-		if (BE (err != REG_NOERROR, 0))
-		  {
-		    re_node_set_free (&except_nodes);
-		    return err;
-		  }
-	      }
-	  }
-      }
-    for (ecl_idx = 0; ecl_idx < inv_eclosure->nelem; ++ecl_idx)
-      {
-	Idx cur_node = inv_eclosure->elems[ecl_idx];
-	if (!re_node_set_contains (&except_nodes, cur_node))
-	  {
-	    Idx idx = re_node_set_contains (dest_nodes, cur_node) - 1;
-	    re_node_set_remove_at (dest_nodes, idx);
-	  }
-      }
-    re_node_set_free (&except_nodes);
-    return REG_NOERROR;
-}
-
-static bool
-internal_function
-check_dst_limits (const re_match_context_t *mctx, const re_node_set *limits,
-		  Idx dst_node, Idx dst_idx, Idx src_node, Idx src_idx)
-{
-  const re_dfa_t *const dfa = mctx->dfa;
-  Idx lim_idx, src_pos, dst_pos;
-
-  Idx dst_bkref_idx = search_cur_bkref_entry (mctx, dst_idx);
-  Idx src_bkref_idx = search_cur_bkref_entry (mctx, src_idx);
-  for (lim_idx = 0; lim_idx < limits->nelem; ++lim_idx)
-    {
-      Idx subexp_idx;
-      struct re_backref_cache_entry *ent;
-      ent = mctx->bkref_ents + limits->elems[lim_idx];
-      subexp_idx = dfa->nodes[ent->node].opr.idx;
-
-      dst_pos = check_dst_limits_calc_pos (mctx, limits->elems[lim_idx],
-					   subexp_idx, dst_node, dst_idx,
-					   dst_bkref_idx);
-      src_pos = check_dst_limits_calc_pos (mctx, limits->elems[lim_idx],
-					   subexp_idx, src_node, src_idx,
-					   src_bkref_idx);
-
-      /* In case of:
-	 <src> <dst> ( <subexp> )
-	 ( <subexp> ) <src> <dst>
-	 ( <subexp1> <src> <subexp2> <dst> <subexp3> )  */
-      if (src_pos == dst_pos)
-	continue; /* This is unrelated limitation.  */
-      else
-	return true;
-    }
-  return false;
-}
-
-static int
-internal_function
-check_dst_limits_calc_pos_1 (const re_match_context_t *mctx, int boundaries,
-			     Idx subexp_idx, Idx from_node, Idx bkref_idx)
-{
-  const re_dfa_t *const dfa = mctx->dfa;
-  const re_node_set *eclosures = dfa->eclosures + from_node;
-  Idx node_idx;
-
-  /* Else, we are on the boundary: examine the nodes on the epsilon
-     closure.  */
-  for (node_idx = 0; node_idx < eclosures->nelem; ++node_idx)
-    {
-      Idx node = eclosures->elems[node_idx];
-      switch (dfa->nodes[node].type)
-	{
-	case OP_BACK_REF:
-	  if (bkref_idx != REG_MISSING)
-	    {
-	      struct re_backref_cache_entry *ent = mctx->bkref_ents + bkref_idx;
-	      do
-		{
-		  Idx dst;
-		  int cpos;
-
-		  if (ent->node != node)
-		    continue;
-
-		  if (subexp_idx < BITSET_WORD_BITS
-		      && !(ent->eps_reachable_subexps_map
-			   & ((bitset_word_t) 1 << subexp_idx)))
-		    continue;
-
-		  /* Recurse trying to reach the OP_OPEN_SUBEXP and
-		     OP_CLOSE_SUBEXP cases below.  But, if the
-		     destination node is the same node as the source
-		     node, don't recurse because it would cause an
-		     infinite loop: a regex that exhibits this behavior
-		     is ()\1*\1*  */
-		  dst = dfa->edests[node].elems[0];
-		  if (dst == from_node)
-		    {
-		      if (boundaries & 1)
-			return -1;
-		      else /* if (boundaries & 2) */
-			return 0;
-		    }
-
-		  cpos =
-		    check_dst_limits_calc_pos_1 (mctx, boundaries, subexp_idx,
-						 dst, bkref_idx);
-		  if (cpos == -1 /* && (boundaries & 1) */)
-		    return -1;
-		  if (cpos == 0 && (boundaries & 2))
-		    return 0;
-
-		  if (subexp_idx < BITSET_WORD_BITS)
-		    ent->eps_reachable_subexps_map
-		      &= ~((bitset_word_t) 1 << subexp_idx);
-		}
-	      while (ent++->more);
-	    }
-	  break;
-
-	case OP_OPEN_SUBEXP:
-	  if ((boundaries & 1) && subexp_idx == dfa->nodes[node].opr.idx)
-	    return -1;
-	  break;
-
-	case OP_CLOSE_SUBEXP:
-	  if ((boundaries & 2) && subexp_idx == dfa->nodes[node].opr.idx)
-	    return 0;
-	  break;
-
-	default:
-	    break;
-	}
-    }
-
-  return (boundaries & 2) ? 1 : 0;
-}
-
-static int
-internal_function
-check_dst_limits_calc_pos (const re_match_context_t *mctx, Idx limit,
-			   Idx subexp_idx, Idx from_node, Idx str_idx,
-			   Idx bkref_idx)
-{
-  struct re_backref_cache_entry *lim = mctx->bkref_ents + limit;
-  int boundaries;
-
-  /* If we are outside the range of the subexpression, return -1 or 1.  */
-  if (str_idx < lim->subexp_from)
-    return -1;
-
-  if (lim->subexp_to < str_idx)
-    return 1;
-
-  /* If we are within the subexpression, return 0.  */
-  boundaries = (str_idx == lim->subexp_from);
-  boundaries |= (str_idx == lim->subexp_to) << 1;
-  if (boundaries == 0)
-    return 0;
-
-  /* Else, examine epsilon closure.  */
-  return check_dst_limits_calc_pos_1 (mctx, boundaries, subexp_idx,
-				      from_node, bkref_idx);
-}
-
-/* Check the limitations of sub expressions LIMITS, and remove the nodes
-   which are against limitations from DEST_NODES. */
-
-static reg_errcode_t
-internal_function
-check_subexp_limits (const re_dfa_t *dfa, re_node_set *dest_nodes,
-		     const re_node_set *candidates, re_node_set *limits,
-		     struct re_backref_cache_entry *bkref_ents, Idx str_idx)
-{
-  reg_errcode_t err;
-  Idx node_idx, lim_idx;
-
-  for (lim_idx = 0; lim_idx < limits->nelem; ++lim_idx)
-    {
-      Idx subexp_idx;
-      struct re_backref_cache_entry *ent;
-      ent = bkref_ents + limits->elems[lim_idx];
-
-      if (str_idx <= ent->subexp_from || ent->str_idx < str_idx)
-	continue; /* This is unrelated limitation.  */
-
-      subexp_idx = dfa->nodes[ent->node].opr.idx;
-      if (ent->subexp_to == str_idx)
-	{
-	  Idx ops_node = REG_MISSING;
-	  Idx cls_node = REG_MISSING;
-	  for (node_idx = 0; node_idx < dest_nodes->nelem; ++node_idx)
-	    {
-	      Idx node = dest_nodes->elems[node_idx];
-	      re_token_type_t type = dfa->nodes[node].type;
-	      if (type == OP_OPEN_SUBEXP
-		  && subexp_idx == dfa->nodes[node].opr.idx)
-		ops_node = node;
-	      else if (type == OP_CLOSE_SUBEXP
-		       && subexp_idx == dfa->nodes[node].opr.idx)
-		cls_node = node;
-	    }
-
-	  /* Check the limitation of the open subexpression.  */
-	  /* Note that (ent->subexp_to = str_idx != ent->subexp_from).  */
-	  if (REG_VALID_INDEX (ops_node))
-	    {
-	      err = sub_epsilon_src_nodes (dfa, ops_node, dest_nodes,
-					   candidates);
-	      if (BE (err != REG_NOERROR, 0))
-		return err;
-	    }
-
-	  /* Check the limitation of the close subexpression.  */
-	  if (REG_VALID_INDEX (cls_node))
-	    for (node_idx = 0; node_idx < dest_nodes->nelem; ++node_idx)
-	      {
-		Idx node = dest_nodes->elems[node_idx];
-		if (!re_node_set_contains (dfa->inveclosures + node,
-					   cls_node)
-		    && !re_node_set_contains (dfa->eclosures + node,
-					      cls_node))
-		  {
-		    /* It is against this limitation.
-		       Remove it form the current sifted state.  */
-		    err = sub_epsilon_src_nodes (dfa, node, dest_nodes,
-						 candidates);
-		    if (BE (err != REG_NOERROR, 0))
-		      return err;
-		    --node_idx;
-		  }
-	      }
-	}
-      else /* (ent->subexp_to != str_idx)  */
-	{
-	  for (node_idx = 0; node_idx < dest_nodes->nelem; ++node_idx)
-	    {
-	      Idx node = dest_nodes->elems[node_idx];
-	      re_token_type_t type = dfa->nodes[node].type;
-	      if (type == OP_CLOSE_SUBEXP || type == OP_OPEN_SUBEXP)
-		{
-		  if (subexp_idx != dfa->nodes[node].opr.idx)
-		    continue;
-		  /* It is against this limitation.
-		     Remove it form the current sifted state.  */
-		  err = sub_epsilon_src_nodes (dfa, node, dest_nodes,
-					       candidates);
-		  if (BE (err != REG_NOERROR, 0))
-		    return err;
-		}
-	    }
-	}
-    }
-  return REG_NOERROR;
-}
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-sift_states_bkref (const re_match_context_t *mctx, re_sift_context_t *sctx,
-		   Idx str_idx, const re_node_set *candidates)
-{
-  const re_dfa_t *const dfa = mctx->dfa;
-  reg_errcode_t err;
-  Idx node_idx, node;
-  re_sift_context_t local_sctx;
-  Idx first_idx = search_cur_bkref_entry (mctx, str_idx);
-
-  if (first_idx == REG_MISSING)
-    return REG_NOERROR;
-
-  local_sctx.sifted_states = NULL; /* Mark that it hasn't been initialized.  */
-
-  for (node_idx = 0; node_idx < candidates->nelem; ++node_idx)
-    {
-      Idx enabled_idx;
-      re_token_type_t type;
-      struct re_backref_cache_entry *entry;
-      node = candidates->elems[node_idx];
-      type = dfa->nodes[node].type;
-      /* Avoid infinite loop for the REs like "()\1+".  */
-      if (node == sctx->last_node && str_idx == sctx->last_str_idx)
-	continue;
-      if (type != OP_BACK_REF)
-	continue;
-
-      entry = mctx->bkref_ents + first_idx;
-      enabled_idx = first_idx;
-      do
-	{
-	  Idx subexp_len;
-	  Idx to_idx;
-	  Idx dst_node;
-	  bool ok;
-	  re_dfastate_t *cur_state;
-
-	  if (entry->node != node)
-	    continue;
-	  subexp_len = entry->subexp_to - entry->subexp_from;
-	  to_idx = str_idx + subexp_len;
-	  dst_node = (subexp_len ? dfa->nexts[node]
-		      : dfa->edests[node].elems[0]);
-
-	  if (to_idx > sctx->last_str_idx
-	      || sctx->sifted_states[to_idx] == NULL
-	      || !STATE_NODE_CONTAINS (sctx->sifted_states[to_idx], dst_node)
-	      || check_dst_limits (mctx, &sctx->limits, node,
-				   str_idx, dst_node, to_idx))
-	    continue;
-
-	  if (local_sctx.sifted_states == NULL)
-	    {
-	      local_sctx = *sctx;
-	      err = re_node_set_init_copy (&local_sctx.limits, &sctx->limits);
-	      if (BE (err != REG_NOERROR, 0))
-		goto free_return;
-	    }
-	  local_sctx.last_node = node;
-	  local_sctx.last_str_idx = str_idx;
-	  ok = re_node_set_insert (&local_sctx.limits, enabled_idx);
-	  if (BE (! ok, 0))
-	    {
-	      err = REG_ESPACE;
-	      goto free_return;
-	    }
-	  cur_state = local_sctx.sifted_states[str_idx];
-	  err = sift_states_backward (mctx, &local_sctx);
-	  if (BE (err != REG_NOERROR, 0))
-	    goto free_return;
-	  if (sctx->limited_states != NULL)
-	    {
-	      err = merge_state_array (dfa, sctx->limited_states,
-				       local_sctx.sifted_states,
-				       str_idx + 1);
-	      if (BE (err != REG_NOERROR, 0))
-		goto free_return;
-	    }
-	  local_sctx.sifted_states[str_idx] = cur_state;
-	  re_node_set_remove (&local_sctx.limits, enabled_idx);
-
-	  /* mctx->bkref_ents may have changed, reload the pointer.  */
-	  entry = mctx->bkref_ents + enabled_idx;
-	}
-      while (enabled_idx++, entry++->more);
-    }
-  err = REG_NOERROR;
- free_return:
-  if (local_sctx.sifted_states != NULL)
-    {
-      re_node_set_free (&local_sctx.limits);
-    }
-
-  return err;
-}
-
-
-#ifdef RE_ENABLE_I18N
-static int
-internal_function
-sift_states_iter_mb (const re_match_context_t *mctx, re_sift_context_t *sctx,
-		     Idx node_idx, Idx str_idx, Idx max_str_idx)
-{
-  const re_dfa_t *const dfa = mctx->dfa;
-  int naccepted;
-  /* Check the node can accept "multi byte".  */
-  naccepted = check_node_accept_bytes (dfa, node_idx, &mctx->input, str_idx);
-  if (naccepted > 0 && str_idx + naccepted <= max_str_idx &&
-      !STATE_NODE_CONTAINS (sctx->sifted_states[str_idx + naccepted],
-			    dfa->nexts[node_idx]))
-    /* The node can't accept the "multi byte", or the
-       destination was already thrown away, then the node
-       couldn't accept the current input "multi byte".   */
-    naccepted = 0;
-  /* Otherwise, it is sure that the node could accept
-     'naccepted' bytes input.  */
-  return naccepted;
-}
-#endif /* RE_ENABLE_I18N */
-
-
-/* Functions for state transition.  */
-
-/* Return the next state to which the current state STATE will transit by
-   accepting the current input byte, and update STATE_LOG if necessary.
-   If STATE can accept a multibyte char/collating element/back reference
-   update the destination of STATE_LOG.  */
-
-static re_dfastate_t *
-internal_function __attribute_warn_unused_result__
-transit_state (reg_errcode_t *err, re_match_context_t *mctx,
-	       re_dfastate_t *state)
-{
-  re_dfastate_t **trtable;
-  unsigned char ch;
-
-#ifdef RE_ENABLE_I18N
-  /* If the current state can accept multibyte.  */
-  if (BE (state->accept_mb, 0))
-    {
-      *err = transit_state_mb (mctx, state);
-      if (BE (*err != REG_NOERROR, 0))
-	return NULL;
-    }
-#endif /* RE_ENABLE_I18N */
-
-  /* Then decide the next state with the single byte.  */
-#if 0
-  if (0)
-    /* don't use transition table  */
-    return transit_state_sb (err, mctx, state);
-#endif
-
-  /* Use transition table  */
-  ch = re_string_fetch_byte (&mctx->input);
-  for (;;)
-    {
-      trtable = state->trtable;
-      if (BE (trtable != NULL, 1))
-	return trtable[ch];
-
-      trtable = state->word_trtable;
-      if (BE (trtable != NULL, 1))
-	{
-	  unsigned int context;
-	  context
-	    = re_string_context_at (&mctx->input,
-				    re_string_cur_idx (&mctx->input) - 1,
-				    mctx->eflags);
-	  if (IS_WORD_CONTEXT (context))
-	    return trtable[ch + SBC_MAX];
-	  else
-	    return trtable[ch];
-	}
-
-      if (!build_trtable (mctx->dfa, state))
-	{
-	  *err = REG_ESPACE;
-	  return NULL;
-	}
-
-      /* Retry, we now have a transition table.  */
-    }
-}
-
-/* Update the state_log if we need */
-static re_dfastate_t *
-internal_function
-merge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx,
-		      re_dfastate_t *next_state)
-{
-  const re_dfa_t *const dfa = mctx->dfa;
-  Idx cur_idx = re_string_cur_idx (&mctx->input);
-
-  if (cur_idx > mctx->state_log_top)
-    {
-      mctx->state_log[cur_idx] = next_state;
-      mctx->state_log_top = cur_idx;
-    }
-  else if (mctx->state_log[cur_idx] == 0)
-    {
-      mctx->state_log[cur_idx] = next_state;
-    }
-  else
-    {
-      re_dfastate_t *pstate;
-      unsigned int context;
-      re_node_set next_nodes, *log_nodes, *table_nodes = NULL;
-      /* If (state_log[cur_idx] != 0), it implies that cur_idx is
-	 the destination of a multibyte char/collating element/
-	 back reference.  Then the next state is the union set of
-	 these destinations and the results of the transition table.  */
-      pstate = mctx->state_log[cur_idx];
-      log_nodes = pstate->entrance_nodes;
-      if (next_state != NULL)
-	{
-	  table_nodes = next_state->entrance_nodes;
-	  *err = re_node_set_init_union (&next_nodes, table_nodes,
-					     log_nodes);
-	  if (BE (*err != REG_NOERROR, 0))
-	    return NULL;
-	}
-      else
-	next_nodes = *log_nodes;
-      /* Note: We already add the nodes of the initial state,
-	 then we don't need to add them here.  */
-
-      context = re_string_context_at (&mctx->input,
-				      re_string_cur_idx (&mctx->input) - 1,
-				      mctx->eflags);
-      next_state = mctx->state_log[cur_idx]
-	= re_acquire_state_context (err, dfa, &next_nodes, context);
-      /* We don't need to check errors here, since the return value of
-	 this function is next_state and ERR is already set.  */
-
-      if (table_nodes != NULL)
-	re_node_set_free (&next_nodes);
-    }
-
-  if (BE (dfa->nbackref, 0) && next_state != NULL)
-    {
-      /* Check OP_OPEN_SUBEXP in the current state in case that we use them
-	 later.  We must check them here, since the back references in the
-	 next state might use them.  */
-      *err = check_subexp_matching_top (mctx, &next_state->nodes,
-					cur_idx);
-      if (BE (*err != REG_NOERROR, 0))
-	return NULL;
-
-      /* If the next state has back references.  */
-      if (next_state->has_backref)
-	{
-	  *err = transit_state_bkref (mctx, &next_state->nodes);
-	  if (BE (*err != REG_NOERROR, 0))
-	    return NULL;
-	  next_state = mctx->state_log[cur_idx];
-	}
-    }
-
-  return next_state;
-}
-
-/* Skip bytes in the input that correspond to part of a
-   multi-byte match, then look in the log for a state
-   from which to restart matching.  */
-static re_dfastate_t *
-internal_function
-find_recover_state (reg_errcode_t *err, re_match_context_t *mctx)
-{
-  re_dfastate_t *cur_state;
-  do
-    {
-      Idx max = mctx->state_log_top;
-      Idx cur_str_idx = re_string_cur_idx (&mctx->input);
-
-      do
-	{
-	  if (++cur_str_idx > max)
-	    return NULL;
-	  re_string_skip_bytes (&mctx->input, 1);
-	}
-      while (mctx->state_log[cur_str_idx] == NULL);
-
-      cur_state = merge_state_with_log (err, mctx, NULL);
-    }
-  while (*err == REG_NOERROR && cur_state == NULL);
-  return cur_state;
-}
-
-/* Helper functions for transit_state.  */
-
-/* From the node set CUR_NODES, pick up the nodes whose types are
-   OP_OPEN_SUBEXP and which have corresponding back references in the regular
-   expression. And register them to use them later for evaluating the
-   corresponding back references.  */
-
-static reg_errcode_t
-internal_function
-check_subexp_matching_top (re_match_context_t *mctx, re_node_set *cur_nodes,
-			   Idx str_idx)
-{
-  const re_dfa_t *const dfa = mctx->dfa;
-  Idx node_idx;
-  reg_errcode_t err;
-
-  /* TODO: This isn't efficient.
-	   Because there might be more than one nodes whose types are
-	   OP_OPEN_SUBEXP and whose index is SUBEXP_IDX, we must check all
-	   nodes.
-	   E.g. RE: (a){2}  */
-  for (node_idx = 0; node_idx < cur_nodes->nelem; ++node_idx)
-    {
-      Idx node = cur_nodes->elems[node_idx];
-      if (dfa->nodes[node].type == OP_OPEN_SUBEXP
-	  && dfa->nodes[node].opr.idx < BITSET_WORD_BITS
-	  && (dfa->used_bkref_map
-	      & ((bitset_word_t) 1 << dfa->nodes[node].opr.idx)))
-	{
-	  err = match_ctx_add_subtop (mctx, node, str_idx);
-	  if (BE (err != REG_NOERROR, 0))
-	    return err;
-	}
-    }
-  return REG_NOERROR;
-}
-
-#if 0
-/* Return the next state to which the current state STATE will transit by
-   accepting the current input byte.  */
-
-static re_dfastate_t *
-transit_state_sb (reg_errcode_t *err, re_match_context_t *mctx,
-		  re_dfastate_t *state)
-{
-  const re_dfa_t *const dfa = mctx->dfa;
-  re_node_set next_nodes;
-  re_dfastate_t *next_state;
-  Idx node_cnt, cur_str_idx = re_string_cur_idx (&mctx->input);
-  unsigned int context;
-
-  *err = re_node_set_alloc (&next_nodes, state->nodes.nelem + 1);
-  if (BE (*err != REG_NOERROR, 0))
-    return NULL;
-  for (node_cnt = 0; node_cnt < state->nodes.nelem; ++node_cnt)
-    {
-      Idx cur_node = state->nodes.elems[node_cnt];
-      if (check_node_accept (mctx, dfa->nodes + cur_node, cur_str_idx))
-	{
-	  *err = re_node_set_merge (&next_nodes,
-				    dfa->eclosures + dfa->nexts[cur_node]);
-	  if (BE (*err != REG_NOERROR, 0))
-	    {
-	      re_node_set_free (&next_nodes);
-	      return NULL;
-	    }
-	}
-    }
-  context = re_string_context_at (&mctx->input, cur_str_idx, mctx->eflags);
-  next_state = re_acquire_state_context (err, dfa, &next_nodes, context);
-  /* We don't need to check errors here, since the return value of
-     this function is next_state and ERR is already set.  */
-
-  re_node_set_free (&next_nodes);
-  re_string_skip_bytes (&mctx->input, 1);
-  return next_state;
-}
-#endif
-
-#ifdef RE_ENABLE_I18N
-static reg_errcode_t
-internal_function
-transit_state_mb (re_match_context_t *mctx, re_dfastate_t *pstate)
-{
-  const re_dfa_t *const dfa = mctx->dfa;
-  reg_errcode_t err;
-  Idx i;
-
-  for (i = 0; i < pstate->nodes.nelem; ++i)
-    {
-      re_node_set dest_nodes, *new_nodes;
-      Idx cur_node_idx = pstate->nodes.elems[i];
-      int naccepted;
-      Idx dest_idx;
-      unsigned int context;
-      re_dfastate_t *dest_state;
-
-      if (!dfa->nodes[cur_node_idx].accept_mb)
-	continue;
-
-      if (dfa->nodes[cur_node_idx].constraint)
-	{
-	  context = re_string_context_at (&mctx->input,
-					  re_string_cur_idx (&mctx->input),
-					  mctx->eflags);
-	  if (NOT_SATISFY_NEXT_CONSTRAINT (dfa->nodes[cur_node_idx].constraint,
-					   context))
-	    continue;
-	}
-
-      /* How many bytes the node can accept?  */
-      naccepted = check_node_accept_bytes (dfa, cur_node_idx, &mctx->input,
-					   re_string_cur_idx (&mctx->input));
-      if (naccepted == 0)
-	continue;
-
-      /* The node can accepts 'naccepted' bytes.  */
-      dest_idx = re_string_cur_idx (&mctx->input) + naccepted;
-      mctx->max_mb_elem_len = ((mctx->max_mb_elem_len < naccepted) ? naccepted
-			       : mctx->max_mb_elem_len);
-      err = clean_state_log_if_needed (mctx, dest_idx);
-      if (BE (err != REG_NOERROR, 0))
-	return err;
-#ifdef DEBUG
-      assert (dfa->nexts[cur_node_idx] != REG_MISSING);
-#endif
-      new_nodes = dfa->eclosures + dfa->nexts[cur_node_idx];
-
-      dest_state = mctx->state_log[dest_idx];
-      if (dest_state == NULL)
-	dest_nodes = *new_nodes;
-      else
-	{
-	  err = re_node_set_init_union (&dest_nodes,
-					dest_state->entrance_nodes, new_nodes);
-	  if (BE (err != REG_NOERROR, 0))
-	    return err;
-	}
-      context = re_string_context_at (&mctx->input, dest_idx - 1,
-				      mctx->eflags);
-      mctx->state_log[dest_idx]
-	= re_acquire_state_context (&err, dfa, &dest_nodes, context);
-      if (dest_state != NULL)
-	re_node_set_free (&dest_nodes);
-      if (BE (mctx->state_log[dest_idx] == NULL && err != REG_NOERROR, 0))
-	return err;
-    }
-  return REG_NOERROR;
-}
-#endif /* RE_ENABLE_I18N */
-
-static reg_errcode_t
-internal_function
-transit_state_bkref (re_match_context_t *mctx, const re_node_set *nodes)
-{
-  const re_dfa_t *const dfa = mctx->dfa;
-  reg_errcode_t err;
-  Idx i;
-  Idx cur_str_idx = re_string_cur_idx (&mctx->input);
-
-  for (i = 0; i < nodes->nelem; ++i)
-    {
-      Idx dest_str_idx, prev_nelem, bkc_idx;
-      Idx node_idx = nodes->elems[i];
-      unsigned int context;
-      const re_token_t *node = dfa->nodes + node_idx;
-      re_node_set *new_dest_nodes;
-
-      /* Check whether 'node' is a backreference or not.  */
-      if (node->type != OP_BACK_REF)
-	continue;
-
-      if (node->constraint)
-	{
-	  context = re_string_context_at (&mctx->input, cur_str_idx,
-					  mctx->eflags);
-	  if (NOT_SATISFY_NEXT_CONSTRAINT (node->constraint, context))
-	    continue;
-	}
-
-      /* 'node' is a backreference.
-	 Check the substring which the substring matched.  */
-      bkc_idx = mctx->nbkref_ents;
-      err = get_subexp (mctx, node_idx, cur_str_idx);
-      if (BE (err != REG_NOERROR, 0))
-	goto free_return;
-
-      /* And add the epsilon closures (which is 'new_dest_nodes') of
-	 the backreference to appropriate state_log.  */
-#ifdef DEBUG
-      assert (dfa->nexts[node_idx] != REG_MISSING);
-#endif
-      for (; bkc_idx < mctx->nbkref_ents; ++bkc_idx)
-	{
-	  Idx subexp_len;
-	  re_dfastate_t *dest_state;
-	  struct re_backref_cache_entry *bkref_ent;
-	  bkref_ent = mctx->bkref_ents + bkc_idx;
-	  if (bkref_ent->node != node_idx || bkref_ent->str_idx != cur_str_idx)
-	    continue;
-	  subexp_len = bkref_ent->subexp_to - bkref_ent->subexp_from;
-	  new_dest_nodes = (subexp_len == 0
-			    ? dfa->eclosures + dfa->edests[node_idx].elems[0]
-			    : dfa->eclosures + dfa->nexts[node_idx]);
-	  dest_str_idx = (cur_str_idx + bkref_ent->subexp_to
-			  - bkref_ent->subexp_from);
-	  context = re_string_context_at (&mctx->input, dest_str_idx - 1,
-					  mctx->eflags);
-	  dest_state = mctx->state_log[dest_str_idx];
-	  prev_nelem = ((mctx->state_log[cur_str_idx] == NULL) ? 0
-			: mctx->state_log[cur_str_idx]->nodes.nelem);
-	  /* Add 'new_dest_node' to state_log.  */
-	  if (dest_state == NULL)
-	    {
-	      mctx->state_log[dest_str_idx]
-		= re_acquire_state_context (&err, dfa, new_dest_nodes,
-					    context);
-	      if (BE (mctx->state_log[dest_str_idx] == NULL
-		      && err != REG_NOERROR, 0))
-		goto free_return;
-	    }
-	  else
-	    {
-	      re_node_set dest_nodes;
-	      err = re_node_set_init_union (&dest_nodes,
-					    dest_state->entrance_nodes,
-					    new_dest_nodes);
-	      if (BE (err != REG_NOERROR, 0))
-		{
-		  re_node_set_free (&dest_nodes);
-		  goto free_return;
-		}
-	      mctx->state_log[dest_str_idx]
-		= re_acquire_state_context (&err, dfa, &dest_nodes, context);
-	      re_node_set_free (&dest_nodes);
-	      if (BE (mctx->state_log[dest_str_idx] == NULL
-		      && err != REG_NOERROR, 0))
-		goto free_return;
-	    }
-	  /* We need to check recursively if the backreference can epsilon
-	     transit.  */
-	  if (subexp_len == 0
-	      && mctx->state_log[cur_str_idx]->nodes.nelem > prev_nelem)
-	    {
-	      err = check_subexp_matching_top (mctx, new_dest_nodes,
-					       cur_str_idx);
-	      if (BE (err != REG_NOERROR, 0))
-		goto free_return;
-	      err = transit_state_bkref (mctx, new_dest_nodes);
-	      if (BE (err != REG_NOERROR, 0))
-		goto free_return;
-	    }
-	}
-    }
-  err = REG_NOERROR;
- free_return:
-  return err;
-}
-
-/* Enumerate all the candidates which the backreference BKREF_NODE can match
-   at BKREF_STR_IDX, and register them by match_ctx_add_entry().
-   Note that we might collect inappropriate candidates here.
-   However, the cost of checking them strictly here is too high, then we
-   delay these checking for prune_impossible_nodes().  */
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-get_subexp (re_match_context_t *mctx, Idx bkref_node, Idx bkref_str_idx)
-{
-  const re_dfa_t *const dfa = mctx->dfa;
-  Idx subexp_num, sub_top_idx;
-  const char *buf = (const char *) re_string_get_buffer (&mctx->input);
-  /* Return if we have already checked BKREF_NODE at BKREF_STR_IDX.  */
-  Idx cache_idx = search_cur_bkref_entry (mctx, bkref_str_idx);
-  if (cache_idx != REG_MISSING)
-    {
-      const struct re_backref_cache_entry *entry
-	= mctx->bkref_ents + cache_idx;
-      do
-	if (entry->node == bkref_node)
-	  return REG_NOERROR; /* We already checked it.  */
-      while (entry++->more);
-    }
-
-  subexp_num = dfa->nodes[bkref_node].opr.idx;
-
-  /* For each sub expression  */
-  for (sub_top_idx = 0; sub_top_idx < mctx->nsub_tops; ++sub_top_idx)
-    {
-      reg_errcode_t err;
-      re_sub_match_top_t *sub_top = mctx->sub_tops[sub_top_idx];
-      re_sub_match_last_t *sub_last;
-      Idx sub_last_idx, sl_str, bkref_str_off;
-
-      if (dfa->nodes[sub_top->node].opr.idx != subexp_num)
-	continue; /* It isn't related.  */
-
-      sl_str = sub_top->str_idx;
-      bkref_str_off = bkref_str_idx;
-      /* At first, check the last node of sub expressions we already
-	 evaluated.  */
-      for (sub_last_idx = 0; sub_last_idx < sub_top->nlasts; ++sub_last_idx)
-	{
-	  regoff_t sl_str_diff;
-	  sub_last = sub_top->lasts[sub_last_idx];
-	  sl_str_diff = sub_last->str_idx - sl_str;
-	  /* The matched string by the sub expression match with the substring
-	     at the back reference?  */
-	  if (sl_str_diff > 0)
-	    {
-	      if (BE (bkref_str_off + sl_str_diff > mctx->input.valid_len, 0))
-		{
-		  /* Not enough chars for a successful match.  */
-		  if (bkref_str_off + sl_str_diff > mctx->input.len)
-		    break;
-
-		  err = clean_state_log_if_needed (mctx,
-						   bkref_str_off
-						   + sl_str_diff);
-		  if (BE (err != REG_NOERROR, 0))
-		    return err;
-		  buf = (const char *) re_string_get_buffer (&mctx->input);
-		}
-	      if (memcmp (buf + bkref_str_off, buf + sl_str, sl_str_diff) != 0)
-		/* We don't need to search this sub expression any more.  */
-		break;
-	    }
-	  bkref_str_off += sl_str_diff;
-	  sl_str += sl_str_diff;
-	  err = get_subexp_sub (mctx, sub_top, sub_last, bkref_node,
-				bkref_str_idx);
-
-	  /* Reload buf, since the preceding call might have reallocated
-	     the buffer.  */
-	  buf = (const char *) re_string_get_buffer (&mctx->input);
-
-	  if (err == REG_NOMATCH)
-	    continue;
-	  if (BE (err != REG_NOERROR, 0))
-	    return err;
-	}
-
-      if (sub_last_idx < sub_top->nlasts)
-	continue;
-      if (sub_last_idx > 0)
-	++sl_str;
-      /* Then, search for the other last nodes of the sub expression.  */
-      for (; sl_str <= bkref_str_idx; ++sl_str)
-	{
-	  Idx cls_node;
-	  regoff_t sl_str_off;
-	  const re_node_set *nodes;
-	  sl_str_off = sl_str - sub_top->str_idx;
-	  /* The matched string by the sub expression match with the substring
-	     at the back reference?  */
-	  if (sl_str_off > 0)
-	    {
-	      if (BE (bkref_str_off >= mctx->input.valid_len, 0))
-		{
-		  /* If we are at the end of the input, we cannot match.  */
-		  if (bkref_str_off >= mctx->input.len)
-		    break;
-
-		  err = extend_buffers (mctx, bkref_str_off + 1);
-		  if (BE (err != REG_NOERROR, 0))
-		    return err;
-
-		  buf = (const char *) re_string_get_buffer (&mctx->input);
-		}
-	      if (buf [bkref_str_off++] != buf[sl_str - 1])
-		break; /* We don't need to search this sub expression
-			  any more.  */
-	    }
-	  if (mctx->state_log[sl_str] == NULL)
-	    continue;
-	  /* Does this state have a ')' of the sub expression?  */
-	  nodes = &mctx->state_log[sl_str]->nodes;
-	  cls_node = find_subexp_node (dfa, nodes, subexp_num,
-				       OP_CLOSE_SUBEXP);
-	  if (cls_node == REG_MISSING)
-	    continue; /* No.  */
-	  if (sub_top->path == NULL)
-	    {
-	      sub_top->path = calloc (sizeof (state_array_t),
-				      sl_str - sub_top->str_idx + 1);
-	      if (sub_top->path == NULL)
-		return REG_ESPACE;
-	    }
-	  /* Can the OP_OPEN_SUBEXP node arrive the OP_CLOSE_SUBEXP node
-	     in the current context?  */
-	  err = check_arrival (mctx, sub_top->path, sub_top->node,
-			       sub_top->str_idx, cls_node, sl_str,
-			       OP_CLOSE_SUBEXP);
-	  if (err == REG_NOMATCH)
-	      continue;
-	  if (BE (err != REG_NOERROR, 0))
-	      return err;
-	  sub_last = match_ctx_add_sublast (sub_top, cls_node, sl_str);
-	  if (BE (sub_last == NULL, 0))
-	    return REG_ESPACE;
-	  err = get_subexp_sub (mctx, sub_top, sub_last, bkref_node,
-				bkref_str_idx);
-	  if (err == REG_NOMATCH)
-	    continue;
-	}
-    }
-  return REG_NOERROR;
-}
-
-/* Helper functions for get_subexp().  */
-
-/* Check SUB_LAST can arrive to the back reference BKREF_NODE at BKREF_STR.
-   If it can arrive, register the sub expression expressed with SUB_TOP
-   and SUB_LAST.  */
-
-static reg_errcode_t
-internal_function
-get_subexp_sub (re_match_context_t *mctx, const re_sub_match_top_t *sub_top,
-		re_sub_match_last_t *sub_last, Idx bkref_node, Idx bkref_str)
-{
-  reg_errcode_t err;
-  Idx to_idx;
-  /* Can the subexpression arrive the back reference?  */
-  err = check_arrival (mctx, &sub_last->path, sub_last->node,
-		       sub_last->str_idx, bkref_node, bkref_str,
-		       OP_OPEN_SUBEXP);
-  if (err != REG_NOERROR)
-    return err;
-  err = match_ctx_add_entry (mctx, bkref_node, bkref_str, sub_top->str_idx,
-			     sub_last->str_idx);
-  if (BE (err != REG_NOERROR, 0))
-    return err;
-  to_idx = bkref_str + sub_last->str_idx - sub_top->str_idx;
-  return clean_state_log_if_needed (mctx, to_idx);
-}
-
-/* Find the first node which is '(' or ')' and whose index is SUBEXP_IDX.
-   Search '(' if FL_OPEN, or search ')' otherwise.
-   TODO: This function isn't efficient...
-	 Because there might be more than one nodes whose types are
-	 OP_OPEN_SUBEXP and whose index is SUBEXP_IDX, we must check all
-	 nodes.
-	 E.g. RE: (a){2}  */
-
-static Idx
-internal_function
-find_subexp_node (const re_dfa_t *dfa, const re_node_set *nodes,
-		  Idx subexp_idx, int type)
-{
-  Idx cls_idx;
-  for (cls_idx = 0; cls_idx < nodes->nelem; ++cls_idx)
-    {
-      Idx cls_node = nodes->elems[cls_idx];
-      const re_token_t *node = dfa->nodes + cls_node;
-      if (node->type == type
-	  && node->opr.idx == subexp_idx)
-	return cls_node;
-    }
-  return REG_MISSING;
-}
-
-/* Check whether the node TOP_NODE at TOP_STR can arrive to the node
-   LAST_NODE at LAST_STR.  We record the path onto PATH since it will be
-   heavily reused.
-   Return REG_NOERROR if it can arrive, or REG_NOMATCH otherwise.  */
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-check_arrival (re_match_context_t *mctx, state_array_t *path, Idx top_node,
-	       Idx top_str, Idx last_node, Idx last_str, int type)
-{
-  const re_dfa_t *const dfa = mctx->dfa;
-  reg_errcode_t err = REG_NOERROR;
-  Idx subexp_num, backup_cur_idx, str_idx, null_cnt;
-  re_dfastate_t *cur_state = NULL;
-  re_node_set *cur_nodes, next_nodes;
-  re_dfastate_t **backup_state_log;
-  unsigned int context;
-
-  subexp_num = dfa->nodes[top_node].opr.idx;
-  /* Extend the buffer if we need.  */
-  if (BE (path->alloc < last_str + mctx->max_mb_elem_len + 1, 0))
-    {
-      re_dfastate_t **new_array;
-      Idx old_alloc = path->alloc;
-      Idx incr_alloc = last_str + mctx->max_mb_elem_len + 1;
-      Idx new_alloc;
-      if (BE (IDX_MAX - old_alloc < incr_alloc, 0))
-	return REG_ESPACE;
-      new_alloc = old_alloc + incr_alloc;
-      if (BE (SIZE_MAX / sizeof (re_dfastate_t *) < new_alloc, 0))
-	return REG_ESPACE;
-      new_array = re_realloc (path->array, re_dfastate_t *, new_alloc);
-      if (BE (new_array == NULL, 0))
-	return REG_ESPACE;
-      path->array = new_array;
-      path->alloc = new_alloc;
-      memset (new_array + old_alloc, '\0',
-	      sizeof (re_dfastate_t *) * (path->alloc - old_alloc));
-    }
-
-  str_idx = path->next_idx ? path->next_idx : top_str;
-
-  /* Temporary modify MCTX.  */
-  backup_state_log = mctx->state_log;
-  backup_cur_idx = mctx->input.cur_idx;
-  mctx->state_log = path->array;
-  mctx->input.cur_idx = str_idx;
-
-  /* Setup initial node set.  */
-  context = re_string_context_at (&mctx->input, str_idx - 1, mctx->eflags);
-  if (str_idx == top_str)
-    {
-      err = re_node_set_init_1 (&next_nodes, top_node);
-      if (BE (err != REG_NOERROR, 0))
-	return err;
-      err = check_arrival_expand_ecl (dfa, &next_nodes, subexp_num, type);
-      if (BE (err != REG_NOERROR, 0))
-	{
-	  re_node_set_free (&next_nodes);
-	  return err;
-	}
-    }
-  else
-    {
-      cur_state = mctx->state_log[str_idx];
-      if (cur_state && cur_state->has_backref)
-	{
-	  err = re_node_set_init_copy (&next_nodes, &cur_state->nodes);
-	  if (BE (err != REG_NOERROR, 0))
-	    return err;
-	}
-      else
-	re_node_set_init_empty (&next_nodes);
-    }
-  if (str_idx == top_str || (cur_state && cur_state->has_backref))
-    {
-      if (next_nodes.nelem)
-	{
-	  err = expand_bkref_cache (mctx, &next_nodes, str_idx,
-				    subexp_num, type);
-	  if (BE (err != REG_NOERROR, 0))
-	    {
-	      re_node_set_free (&next_nodes);
-	      return err;
-	    }
-	}
-      cur_state = re_acquire_state_context (&err, dfa, &next_nodes, context);
-      if (BE (cur_state == NULL && err != REG_NOERROR, 0))
-	{
-	  re_node_set_free (&next_nodes);
-	  return err;
-	}
-      mctx->state_log[str_idx] = cur_state;
-    }
-
-  for (null_cnt = 0; str_idx < last_str && null_cnt <= mctx->max_mb_elem_len;)
-    {
-      re_node_set_empty (&next_nodes);
-      if (mctx->state_log[str_idx + 1])
-	{
-	  err = re_node_set_merge (&next_nodes,
-				   &mctx->state_log[str_idx + 1]->nodes);
-	  if (BE (err != REG_NOERROR, 0))
-	    {
-	      re_node_set_free (&next_nodes);
-	      return err;
-	    }
-	}
-      if (cur_state)
-	{
-	  err = check_arrival_add_next_nodes (mctx, str_idx,
-					      &cur_state->non_eps_nodes,
-					      &next_nodes);
-	  if (BE (err != REG_NOERROR, 0))
-	    {
-	      re_node_set_free (&next_nodes);
-	      return err;
-	    }
-	}
-      ++str_idx;
-      if (next_nodes.nelem)
-	{
-	  err = check_arrival_expand_ecl (dfa, &next_nodes, subexp_num, type);
-	  if (BE (err != REG_NOERROR, 0))
-	    {
-	      re_node_set_free (&next_nodes);
-	      return err;
-	    }
-	  err = expand_bkref_cache (mctx, &next_nodes, str_idx,
-				    subexp_num, type);
-	  if (BE (err != REG_NOERROR, 0))
-	    {
-	      re_node_set_free (&next_nodes);
-	      return err;
-	    }
-	}
-      context = re_string_context_at (&mctx->input, str_idx - 1, mctx->eflags);
-      cur_state = re_acquire_state_context (&err, dfa, &next_nodes, context);
-      if (BE (cur_state == NULL && err != REG_NOERROR, 0))
-	{
-	  re_node_set_free (&next_nodes);
-	  return err;
-	}
-      mctx->state_log[str_idx] = cur_state;
-      null_cnt = cur_state == NULL ? null_cnt + 1 : 0;
-    }
-  re_node_set_free (&next_nodes);
-  cur_nodes = (mctx->state_log[last_str] == NULL ? NULL
-	       : &mctx->state_log[last_str]->nodes);
-  path->next_idx = str_idx;
-
-  /* Fix MCTX.  */
-  mctx->state_log = backup_state_log;
-  mctx->input.cur_idx = backup_cur_idx;
-
-  /* Then check the current node set has the node LAST_NODE.  */
-  if (cur_nodes != NULL && re_node_set_contains (cur_nodes, last_node))
-    return REG_NOERROR;
-
-  return REG_NOMATCH;
-}
-
-/* Helper functions for check_arrival.  */
-
-/* Calculate the destination nodes of CUR_NODES at STR_IDX, and append them
-   to NEXT_NODES.
-   TODO: This function is similar to the functions transit_state*(),
-	 however this function has many additional works.
-	 Can't we unify them?  */
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-check_arrival_add_next_nodes (re_match_context_t *mctx, Idx str_idx,
-			      re_node_set *cur_nodes, re_node_set *next_nodes)
-{
-  const re_dfa_t *const dfa = mctx->dfa;
-  bool ok;
-  Idx cur_idx;
-#ifdef RE_ENABLE_I18N
-  reg_errcode_t err = REG_NOERROR;
-#endif
-  re_node_set union_set;
-  re_node_set_init_empty (&union_set);
-  for (cur_idx = 0; cur_idx < cur_nodes->nelem; ++cur_idx)
-    {
-      int naccepted = 0;
-      Idx cur_node = cur_nodes->elems[cur_idx];
-#ifdef DEBUG
-      re_token_type_t type = dfa->nodes[cur_node].type;
-      assert (!IS_EPSILON_NODE (type));
-#endif
-#ifdef RE_ENABLE_I18N
-      /* If the node may accept "multi byte".  */
-      if (dfa->nodes[cur_node].accept_mb)
-	{
-	  naccepted = check_node_accept_bytes (dfa, cur_node, &mctx->input,
-					       str_idx);
-	  if (naccepted > 1)
-	    {
-	      re_dfastate_t *dest_state;
-	      Idx next_node = dfa->nexts[cur_node];
-	      Idx next_idx = str_idx + naccepted;
-	      dest_state = mctx->state_log[next_idx];
-	      re_node_set_empty (&union_set);
-	      if (dest_state)
-		{
-		  err = re_node_set_merge (&union_set, &dest_state->nodes);
-		  if (BE (err != REG_NOERROR, 0))
-		    {
-		      re_node_set_free (&union_set);
-		      return err;
-		    }
-		}
-	      ok = re_node_set_insert (&union_set, next_node);
-	      if (BE (! ok, 0))
-		{
-		  re_node_set_free (&union_set);
-		  return REG_ESPACE;
-		}
-	      mctx->state_log[next_idx] = re_acquire_state (&err, dfa,
-							    &union_set);
-	      if (BE (mctx->state_log[next_idx] == NULL
-		      && err != REG_NOERROR, 0))
-		{
-		  re_node_set_free (&union_set);
-		  return err;
-		}
-	    }
-	}
-#endif /* RE_ENABLE_I18N */
-      if (naccepted
-	  || check_node_accept (mctx, dfa->nodes + cur_node, str_idx))
-	{
-	  ok = re_node_set_insert (next_nodes, dfa->nexts[cur_node]);
-	  if (BE (! ok, 0))
-	    {
-	      re_node_set_free (&union_set);
-	      return REG_ESPACE;
-	    }
-	}
-    }
-  re_node_set_free (&union_set);
-  return REG_NOERROR;
-}
-
-/* For all the nodes in CUR_NODES, add the epsilon closures of them to
-   CUR_NODES, however exclude the nodes which are:
-    - inside the sub expression whose number is EX_SUBEXP, if FL_OPEN.
-    - out of the sub expression whose number is EX_SUBEXP, if !FL_OPEN.
-*/
-
-static reg_errcode_t
-internal_function
-check_arrival_expand_ecl (const re_dfa_t *dfa, re_node_set *cur_nodes,
-			  Idx ex_subexp, int type)
-{
-  reg_errcode_t err;
-  Idx idx, outside_node;
-  re_node_set new_nodes;
-#ifdef DEBUG
-  assert (cur_nodes->nelem);
-#endif
-  err = re_node_set_alloc (&new_nodes, cur_nodes->nelem);
-  if (BE (err != REG_NOERROR, 0))
-    return err;
-  /* Create a new node set NEW_NODES with the nodes which are epsilon
-     closures of the node in CUR_NODES.  */
-
-  for (idx = 0; idx < cur_nodes->nelem; ++idx)
-    {
-      Idx cur_node = cur_nodes->elems[idx];
-      const re_node_set *eclosure = dfa->eclosures + cur_node;
-      outside_node = find_subexp_node (dfa, eclosure, ex_subexp, type);
-      if (outside_node == REG_MISSING)
-	{
-	  /* There are no problematic nodes, just merge them.  */
-	  err = re_node_set_merge (&new_nodes, eclosure);
-	  if (BE (err != REG_NOERROR, 0))
-	    {
-	      re_node_set_free (&new_nodes);
-	      return err;
-	    }
-	}
-      else
-	{
-	  /* There are problematic nodes, re-calculate incrementally.  */
-	  err = check_arrival_expand_ecl_sub (dfa, &new_nodes, cur_node,
-					      ex_subexp, type);
-	  if (BE (err != REG_NOERROR, 0))
-	    {
-	      re_node_set_free (&new_nodes);
-	      return err;
-	    }
-	}
-    }
-  re_node_set_free (cur_nodes);
-  *cur_nodes = new_nodes;
-  return REG_NOERROR;
-}
-
-/* Helper function for check_arrival_expand_ecl.
-   Check incrementally the epsilon closure of TARGET, and if it isn't
-   problematic append it to DST_NODES.  */
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-check_arrival_expand_ecl_sub (const re_dfa_t *dfa, re_node_set *dst_nodes,
-			      Idx target, Idx ex_subexp, int type)
-{
-  Idx cur_node;
-  for (cur_node = target; !re_node_set_contains (dst_nodes, cur_node);)
-    {
-      bool ok;
-
-      if (dfa->nodes[cur_node].type == type
-	  && dfa->nodes[cur_node].opr.idx == ex_subexp)
-	{
-	  if (type == OP_CLOSE_SUBEXP)
-	    {
-	      ok = re_node_set_insert (dst_nodes, cur_node);
-	      if (BE (! ok, 0))
-		return REG_ESPACE;
-	    }
-	  break;
-	}
-      ok = re_node_set_insert (dst_nodes, cur_node);
-      if (BE (! ok, 0))
-	return REG_ESPACE;
-      if (dfa->edests[cur_node].nelem == 0)
-	break;
-      if (dfa->edests[cur_node].nelem == 2)
-	{
-	  reg_errcode_t err;
-	  err = check_arrival_expand_ecl_sub (dfa, dst_nodes,
-					      dfa->edests[cur_node].elems[1],
-					      ex_subexp, type);
-	  if (BE (err != REG_NOERROR, 0))
-	    return err;
-	}
-      cur_node = dfa->edests[cur_node].elems[0];
-    }
-  return REG_NOERROR;
-}
-
-
-/* For all the back references in the current state, calculate the
-   destination of the back references by the appropriate entry
-   in MCTX->BKREF_ENTS.  */
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-expand_bkref_cache (re_match_context_t *mctx, re_node_set *cur_nodes,
-		    Idx cur_str, Idx subexp_num, int type)
-{
-  const re_dfa_t *const dfa = mctx->dfa;
-  reg_errcode_t err;
-  Idx cache_idx_start = search_cur_bkref_entry (mctx, cur_str);
-  struct re_backref_cache_entry *ent;
-
-  if (cache_idx_start == REG_MISSING)
-    return REG_NOERROR;
-
- restart:
-  ent = mctx->bkref_ents + cache_idx_start;
-  do
-    {
-      Idx to_idx, next_node;
-
-      /* Is this entry ENT is appropriate?  */
-      if (!re_node_set_contains (cur_nodes, ent->node))
-	continue; /* No.  */
-
-      to_idx = cur_str + ent->subexp_to - ent->subexp_from;
-      /* Calculate the destination of the back reference, and append it
-	 to MCTX->STATE_LOG.  */
-      if (to_idx == cur_str)
-	{
-	  /* The backreference did epsilon transit, we must re-check all the
-	     node in the current state.  */
-	  re_node_set new_dests;
-	  reg_errcode_t err2, err3;
-	  next_node = dfa->edests[ent->node].elems[0];
-	  if (re_node_set_contains (cur_nodes, next_node))
-	    continue;
-	  err = re_node_set_init_1 (&new_dests, next_node);
-	  err2 = check_arrival_expand_ecl (dfa, &new_dests, subexp_num, type);
-	  err3 = re_node_set_merge (cur_nodes, &new_dests);
-	  re_node_set_free (&new_dests);
-	  if (BE (err != REG_NOERROR || err2 != REG_NOERROR
-		  || err3 != REG_NOERROR, 0))
-	    {
-	      err = (err != REG_NOERROR ? err
-		     : (err2 != REG_NOERROR ? err2 : err3));
-	      return err;
-	    }
-	  /* TODO: It is still inefficient...  */
-	  goto restart;
-	}
-      else
-	{
-	  re_node_set union_set;
-	  next_node = dfa->nexts[ent->node];
-	  if (mctx->state_log[to_idx])
-	    {
-	      bool ok;
-	      if (re_node_set_contains (&mctx->state_log[to_idx]->nodes,
-					next_node))
-		continue;
-	      err = re_node_set_init_copy (&union_set,
-					   &mctx->state_log[to_idx]->nodes);
-	      ok = re_node_set_insert (&union_set, next_node);
-	      if (BE (err != REG_NOERROR || ! ok, 0))
-		{
-		  re_node_set_free (&union_set);
-		  err = err != REG_NOERROR ? err : REG_ESPACE;
-		  return err;
-		}
-	    }
-	  else
-	    {
-	      err = re_node_set_init_1 (&union_set, next_node);
-	      if (BE (err != REG_NOERROR, 0))
-		return err;
-	    }
-	  mctx->state_log[to_idx] = re_acquire_state (&err, dfa, &union_set);
-	  re_node_set_free (&union_set);
-	  if (BE (mctx->state_log[to_idx] == NULL
-		  && err != REG_NOERROR, 0))
-	    return err;
-	}
-    }
-  while (ent++->more);
-  return REG_NOERROR;
-}
-
-/* Build transition table for the state.
-   Return true if successful.  */
-
-static bool
-internal_function
-build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
-{
-  reg_errcode_t err;
-  Idx i, j;
-  int ch;
-  bool need_word_trtable = false;
-  bitset_word_t elem, mask;
-  bool dests_node_malloced = false;
-  bool dest_states_malloced = false;
-  Idx ndests; /* Number of the destination states from 'state'.  */
-  re_dfastate_t **trtable;
-  re_dfastate_t **dest_states = NULL, **dest_states_word, **dest_states_nl;
-  re_node_set follows, *dests_node;
-  bitset_t *dests_ch;
-  bitset_t acceptable;
-
-  struct dests_alloc
-  {
-    re_node_set dests_node[SBC_MAX];
-    bitset_t dests_ch[SBC_MAX];
-  } *dests_alloc;
-
-  /* We build DFA states which corresponds to the destination nodes
-     from 'state'.  'dests_node[i]' represents the nodes which i-th
-     destination state contains, and 'dests_ch[i]' represents the
-     characters which i-th destination state accepts.  */
-  if (__libc_use_alloca (sizeof (struct dests_alloc)))
-    dests_alloc = (struct dests_alloc *) alloca (sizeof (struct dests_alloc));
-  else
-    {
-      dests_alloc = re_malloc (struct dests_alloc, 1);
-      if (BE (dests_alloc == NULL, 0))
-	return false;
-      dests_node_malloced = true;
-    }
-  dests_node = dests_alloc->dests_node;
-  dests_ch = dests_alloc->dests_ch;
-
-  /* Initialize transition table.  */
-  state->word_trtable = state->trtable = NULL;
-
-  /* At first, group all nodes belonging to 'state' into several
-     destinations.  */
-  ndests = group_nodes_into_DFAstates (dfa, state, dests_node, dests_ch);
-  if (BE (! REG_VALID_NONZERO_INDEX (ndests), 0))
-    {
-      if (dests_node_malloced)
-	free (dests_alloc);
-      /* Return false in case of an error, true otherwise.  */
-      if (ndests == 0)
-	{
-	  state->trtable = (re_dfastate_t **)
-	    calloc (sizeof (re_dfastate_t *), SBC_MAX);
-          if (BE (state->trtable == NULL, 0))
-            return false;
-	  return true;
-	}
-      return false;
-    }
-
-  err = re_node_set_alloc (&follows, ndests + 1);
-  if (BE (err != REG_NOERROR, 0))
-    goto out_free;
-
-  /* Avoid arithmetic overflow in size calculation.  */
-  if (BE ((((SIZE_MAX - (sizeof (re_node_set) + sizeof (bitset_t)) * SBC_MAX)
-	    / (3 * sizeof (re_dfastate_t *)))
-	   < ndests),
-	  0))
-    goto out_free;
-
-  if (__libc_use_alloca ((sizeof (re_node_set) + sizeof (bitset_t)) * SBC_MAX
-			 + ndests * 3 * sizeof (re_dfastate_t *)))
-    dest_states = (re_dfastate_t **)
-      alloca (ndests * 3 * sizeof (re_dfastate_t *));
-  else
-    {
-      dest_states = (re_dfastate_t **)
-	malloc (ndests * 3 * sizeof (re_dfastate_t *));
-      if (BE (dest_states == NULL, 0))
-	{
-out_free:
-	  if (dest_states_malloced)
-	    free (dest_states);
-	  re_node_set_free (&follows);
-	  for (i = 0; i < ndests; ++i)
-	    re_node_set_free (dests_node + i);
-	  if (dests_node_malloced)
-	    free (dests_alloc);
-	  return false;
-	}
-      dest_states_malloced = true;
-    }
-  dest_states_word = dest_states + ndests;
-  dest_states_nl = dest_states_word + ndests;
-  bitset_empty (acceptable);
-
-  /* Then build the states for all destinations.  */
-  for (i = 0; i < ndests; ++i)
-    {
-      Idx next_node;
-      re_node_set_empty (&follows);
-      /* Merge the follows of this destination states.  */
-      for (j = 0; j < dests_node[i].nelem; ++j)
-	{
-	  next_node = dfa->nexts[dests_node[i].elems[j]];
-	  if (next_node != REG_MISSING)
-	    {
-	      err = re_node_set_merge (&follows, dfa->eclosures + next_node);
-	      if (BE (err != REG_NOERROR, 0))
-		goto out_free;
-	    }
-	}
-      dest_states[i] = re_acquire_state_context (&err, dfa, &follows, 0);
-      if (BE (dest_states[i] == NULL && err != REG_NOERROR, 0))
-	goto out_free;
-      /* If the new state has context constraint,
-	 build appropriate states for these contexts.  */
-      if (dest_states[i]->has_constraint)
-	{
-	  dest_states_word[i] = re_acquire_state_context (&err, dfa, &follows,
-							  CONTEXT_WORD);
-	  if (BE (dest_states_word[i] == NULL && err != REG_NOERROR, 0))
-	    goto out_free;
-
-	  if (dest_states[i] != dest_states_word[i] && dfa->mb_cur_max > 1)
-	    need_word_trtable = true;
-
-	  dest_states_nl[i] = re_acquire_state_context (&err, dfa, &follows,
-							CONTEXT_NEWLINE);
-	  if (BE (dest_states_nl[i] == NULL && err != REG_NOERROR, 0))
-	    goto out_free;
-	}
-      else
-	{
-	  dest_states_word[i] = dest_states[i];
-	  dest_states_nl[i] = dest_states[i];
-	}
-      bitset_merge (acceptable, dests_ch[i]);
-    }
-
-  if (!BE (need_word_trtable, 0))
-    {
-      /* We don't care about whether the following character is a word
-	 character, or we are in a single-byte character set so we can
-	 discern by looking at the character code: allocate a
-	 256-entry transition table.  */
-      trtable = state->trtable =
-	(re_dfastate_t **) calloc (sizeof (re_dfastate_t *), SBC_MAX);
-      if (BE (trtable == NULL, 0))
-	goto out_free;
-
-      /* For all characters ch...:  */
-      for (i = 0; i < BITSET_WORDS; ++i)
-	for (ch = i * BITSET_WORD_BITS, elem = acceptable[i], mask = 1;
-	     elem;
-	     mask <<= 1, elem >>= 1, ++ch)
-	  if (BE (elem & 1, 0))
-	    {
-	      /* There must be exactly one destination which accepts
-		 character ch.  See group_nodes_into_DFAstates.  */
-	      for (j = 0; (dests_ch[j][i] & mask) == 0; ++j)
-		;
-
-	      /* j-th destination accepts the word character ch.  */
-	      if (dfa->word_char[i] & mask)
-		trtable[ch] = dest_states_word[j];
-	      else
-		trtable[ch] = dest_states[j];
-	    }
-    }
-  else
-    {
-      /* We care about whether the following character is a word
-	 character, and we are in a multi-byte character set: discern
-	 by looking at the character code: build two 256-entry
-	 transition tables, one starting at trtable[0] and one
-	 starting at trtable[SBC_MAX].  */
-      trtable = state->word_trtable =
-	(re_dfastate_t **) calloc (sizeof (re_dfastate_t *), 2 * SBC_MAX);
-      if (BE (trtable == NULL, 0))
-	goto out_free;
-
-      /* For all characters ch...:  */
-      for (i = 0; i < BITSET_WORDS; ++i)
-	for (ch = i * BITSET_WORD_BITS, elem = acceptable[i], mask = 1;
-	     elem;
-	     mask <<= 1, elem >>= 1, ++ch)
-	  if (BE (elem & 1, 0))
-	    {
-	      /* There must be exactly one destination which accepts
-		 character ch.  See group_nodes_into_DFAstates.  */
-	      for (j = 0; (dests_ch[j][i] & mask) == 0; ++j)
-		;
-
-	      /* j-th destination accepts the word character ch.  */
-	      trtable[ch] = dest_states[j];
-	      trtable[ch + SBC_MAX] = dest_states_word[j];
-	    }
-    }
-
-  /* new line */
-  if (bitset_contain (acceptable, NEWLINE_CHAR))
-    {
-      /* The current state accepts newline character.  */
-      for (j = 0; j < ndests; ++j)
-	if (bitset_contain (dests_ch[j], NEWLINE_CHAR))
-	  {
-	    /* k-th destination accepts newline character.  */
-	    trtable[NEWLINE_CHAR] = dest_states_nl[j];
-	    if (need_word_trtable)
-	      trtable[NEWLINE_CHAR + SBC_MAX] = dest_states_nl[j];
-	    /* There must be only one destination which accepts
-	       newline.  See group_nodes_into_DFAstates.  */
-	    break;
-	  }
-    }
-
-  if (dest_states_malloced)
-    free (dest_states);
-
-  re_node_set_free (&follows);
-  for (i = 0; i < ndests; ++i)
-    re_node_set_free (dests_node + i);
-
-  if (dests_node_malloced)
-    free (dests_alloc);
-
-  return true;
-}
-
-/* Group all nodes belonging to STATE into several destinations.
-   Then for all destinations, set the nodes belonging to the destination
-   to DESTS_NODE[i] and set the characters accepted by the destination
-   to DEST_CH[i].  This function return the number of destinations.  */
-
-static Idx
-internal_function
-group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state,
-			    re_node_set *dests_node, bitset_t *dests_ch)
-{
-  reg_errcode_t err;
-  bool ok;
-  Idx i, j, k;
-  Idx ndests; /* Number of the destinations from 'state'.  */
-  bitset_t accepts; /* Characters a node can accept.  */
-  const re_node_set *cur_nodes = &state->nodes;
-  bitset_empty (accepts);
-  ndests = 0;
-
-  /* For all the nodes belonging to 'state',  */
-  for (i = 0; i < cur_nodes->nelem; ++i)
-    {
-      re_token_t *node = &dfa->nodes[cur_nodes->elems[i]];
-      re_token_type_t type = node->type;
-      unsigned int constraint = node->constraint;
-
-      /* Enumerate all single byte character this node can accept.  */
-      if (type == CHARACTER)
-	bitset_set (accepts, node->opr.c);
-      else if (type == SIMPLE_BRACKET)
-	{
-	  bitset_merge (accepts, node->opr.sbcset);
-	}
-      else if (type == OP_PERIOD)
-	{
-#ifdef RE_ENABLE_I18N
-	  if (dfa->mb_cur_max > 1)
-	    bitset_merge (accepts, dfa->sb_char);
-	  else
-#endif
-	    bitset_set_all (accepts);
-	  if (!(dfa->syntax & RE_DOT_NEWLINE))
-	    bitset_clear (accepts, '\n');
-	  if (dfa->syntax & RE_DOT_NOT_NULL)
-	    bitset_clear (accepts, '\0');
-	}
-#ifdef RE_ENABLE_I18N
-      else if (type == OP_UTF8_PERIOD)
-	{
-	  if (ASCII_CHARS % BITSET_WORD_BITS == 0)
-	    memset (accepts, -1, ASCII_CHARS / CHAR_BIT);
-	  else
-	    bitset_merge (accepts, utf8_sb_map);
-	  if (!(dfa->syntax & RE_DOT_NEWLINE))
-	    bitset_clear (accepts, '\n');
-	  if (dfa->syntax & RE_DOT_NOT_NULL)
-	    bitset_clear (accepts, '\0');
-	}
-#endif
-      else
-	continue;
-
-      /* Check the 'accepts' and sift the characters which are not
-	 match it the context.  */
-      if (constraint)
-	{
-	  if (constraint & NEXT_NEWLINE_CONSTRAINT)
-	    {
-	      bool accepts_newline = bitset_contain (accepts, NEWLINE_CHAR);
-	      bitset_empty (accepts);
-	      if (accepts_newline)
-		bitset_set (accepts, NEWLINE_CHAR);
-	      else
-		continue;
-	    }
-	  if (constraint & NEXT_ENDBUF_CONSTRAINT)
-	    {
-	      bitset_empty (accepts);
-	      continue;
-	    }
-
-	  if (constraint & NEXT_WORD_CONSTRAINT)
-	    {
-	      bitset_word_t any_set = 0;
-	      if (type == CHARACTER && !node->word_char)
-		{
-		  bitset_empty (accepts);
-		  continue;
-		}
-#ifdef RE_ENABLE_I18N
-	      if (dfa->mb_cur_max > 1)
-		for (j = 0; j < BITSET_WORDS; ++j)
-		  any_set |= (accepts[j] &= (dfa->word_char[j] | ~dfa->sb_char[j]));
-	      else
-#endif
-		for (j = 0; j < BITSET_WORDS; ++j)
-		  any_set |= (accepts[j] &= dfa->word_char[j]);
-	      if (!any_set)
-		continue;
-	    }
-	  if (constraint & NEXT_NOTWORD_CONSTRAINT)
-	    {
-	      bitset_word_t any_set = 0;
-	      if (type == CHARACTER && node->word_char)
-		{
-		  bitset_empty (accepts);
-		  continue;
-		}
-#ifdef RE_ENABLE_I18N
-	      if (dfa->mb_cur_max > 1)
-		for (j = 0; j < BITSET_WORDS; ++j)
-		  any_set |= (accepts[j] &= ~(dfa->word_char[j] & dfa->sb_char[j]));
-	      else
-#endif
-		for (j = 0; j < BITSET_WORDS; ++j)
-		  any_set |= (accepts[j] &= ~dfa->word_char[j]);
-	      if (!any_set)
-		continue;
-	    }
-	}
-
-      /* Then divide 'accepts' into DFA states, or create a new
-	 state.  Above, we make sure that accepts is not empty.  */
-      for (j = 0; j < ndests; ++j)
-	{
-	  bitset_t intersec; /* Intersection sets, see below.  */
-	  bitset_t remains;
-	  /* Flags, see below.  */
-	  bitset_word_t has_intersec, not_subset, not_consumed;
-
-	  /* Optimization, skip if this state doesn't accept the character.  */
-	  if (type == CHARACTER && !bitset_contain (dests_ch[j], node->opr.c))
-	    continue;
-
-	  /* Enumerate the intersection set of this state and 'accepts'.  */
-	  has_intersec = 0;
-	  for (k = 0; k < BITSET_WORDS; ++k)
-	    has_intersec |= intersec[k] = accepts[k] & dests_ch[j][k];
-	  /* And skip if the intersection set is empty.  */
-	  if (!has_intersec)
-	    continue;
-
-	  /* Then check if this state is a subset of 'accepts'.  */
-	  not_subset = not_consumed = 0;
-	  for (k = 0; k < BITSET_WORDS; ++k)
-	    {
-	      not_subset |= remains[k] = ~accepts[k] & dests_ch[j][k];
-	      not_consumed |= accepts[k] = accepts[k] & ~dests_ch[j][k];
-	    }
-
-	  /* If this state isn't a subset of 'accepts', create a
-	     new group state, which has the 'remains'. */
-	  if (not_subset)
-	    {
-	      bitset_copy (dests_ch[ndests], remains);
-	      bitset_copy (dests_ch[j], intersec);
-	      err = re_node_set_init_copy (dests_node + ndests, &dests_node[j]);
-	      if (BE (err != REG_NOERROR, 0))
-		goto error_return;
-	      ++ndests;
-	    }
-
-	  /* Put the position in the current group. */
-	  ok = re_node_set_insert (&dests_node[j], cur_nodes->elems[i]);
-	  if (BE (! ok, 0))
-	    goto error_return;
-
-	  /* If all characters are consumed, go to next node. */
-	  if (!not_consumed)
-	    break;
-	}
-      /* Some characters remain, create a new group. */
-      if (j == ndests)
-	{
-	  bitset_copy (dests_ch[ndests], accepts);
-	  err = re_node_set_init_1 (dests_node + ndests, cur_nodes->elems[i]);
-	  if (BE (err != REG_NOERROR, 0))
-	    goto error_return;
-	  ++ndests;
-	  bitset_empty (accepts);
-	}
-    }
-  return ndests;
- error_return:
-  for (j = 0; j < ndests; ++j)
-    re_node_set_free (dests_node + j);
-  return REG_MISSING;
-}
-
-#ifdef RE_ENABLE_I18N
-/* Check how many bytes the node 'dfa->nodes[node_idx]' accepts.
-   Return the number of the bytes the node accepts.
-   STR_IDX is the current index of the input string.
-
-   This function handles the nodes which can accept one character, or
-   one collating element like '.', '[a-z]', opposite to the other nodes
-   can only accept one byte.  */
-
-static int
-internal_function
-check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx,
-			 const re_string_t *input, Idx str_idx)
-{
-  const re_token_t *node = dfa->nodes + node_idx;
-  int char_len, elem_len;
-  Idx i;
-
-  if (BE (node->type == OP_UTF8_PERIOD, 0))
-    {
-      unsigned char c = re_string_byte_at (input, str_idx), d;
-      if (BE (c < 0xc2, 1))
-	return 0;
-
-      if (str_idx + 2 > input->len)
-	return 0;
-
-      d = re_string_byte_at (input, str_idx + 1);
-      if (c < 0xe0)
-	return (d < 0x80 || d > 0xbf) ? 0 : 2;
-      else if (c < 0xf0)
-	{
-	  char_len = 3;
-	  if (c == 0xe0 && d < 0xa0)
-	    return 0;
-	}
-      else if (c < 0xf8)
-	{
-	  char_len = 4;
-	  if (c == 0xf0 && d < 0x90)
-	    return 0;
-	}
-      else if (c < 0xfc)
-	{
-	  char_len = 5;
-	  if (c == 0xf8 && d < 0x88)
-	    return 0;
-	}
-      else if (c < 0xfe)
-	{
-	  char_len = 6;
-	  if (c == 0xfc && d < 0x84)
-	    return 0;
-	}
-      else
-	return 0;
-
-      if (str_idx + char_len > input->len)
-	return 0;
-
-      for (i = 1; i < char_len; ++i)
-	{
-	  d = re_string_byte_at (input, str_idx + i);
-	  if (d < 0x80 || d > 0xbf)
-	    return 0;
-	}
-      return char_len;
-    }
-
-  char_len = re_string_char_size_at (input, str_idx);
-  if (node->type == OP_PERIOD)
-    {
-      if (char_len <= 1)
-	return 0;
-      /* FIXME: I don't think this if is needed, as both '\n'
-	 and '\0' are char_len == 1.  */
-      /* '.' accepts any one character except the following two cases.  */
-      if ((!(dfa->syntax & RE_DOT_NEWLINE) &&
-	   re_string_byte_at (input, str_idx) == '\n') ||
-	  ((dfa->syntax & RE_DOT_NOT_NULL) &&
-	   re_string_byte_at (input, str_idx) == '\0'))
-	return 0;
-      return char_len;
-    }
-
-  elem_len = re_string_elem_size_at (input, str_idx);
-  if ((elem_len <= 1 && char_len <= 1) || char_len == 0)
-    return 0;
-
-  if (node->type == COMPLEX_BRACKET)
-    {
-      const re_charset_t *cset = node->opr.mbcset;
-# ifdef _LIBC
-      const unsigned char *pin
-	= ((const unsigned char *) re_string_get_buffer (input) + str_idx);
-      Idx j;
-      uint32_t nrules;
-# endif /* _LIBC */
-      int match_len = 0;
-      wchar_t wc = ((cset->nranges || cset->nchar_classes || cset->nmbchars)
-		    ? re_string_wchar_at (input, str_idx) : 0);
-
-      /* match with multibyte character?  */
-      for (i = 0; i < cset->nmbchars; ++i)
-	if (wc == cset->mbchars[i])
-	  {
-	    match_len = char_len;
-	    goto check_node_accept_bytes_match;
-	  }
-      /* match with character_class?  */
-      for (i = 0; i < cset->nchar_classes; ++i)
-	{
-	  wctype_t wt = cset->char_classes[i];
-	  if (__iswctype (wc, wt))
-	    {
-	      match_len = char_len;
-	      goto check_node_accept_bytes_match;
-	    }
-	}
-
-# ifdef _LIBC
-      nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
-      if (nrules != 0)
-	{
-	  unsigned int in_collseq = 0;
-	  const int32_t *table, *indirect;
-	  const unsigned char *weights, *extra;
-	  const char *collseqwc;
-	  /* This #include defines a local function!  */
-#  include <locale/weight.h>
-
-	  /* match with collating_symbol?  */
-	  if (cset->ncoll_syms)
-	    extra = (const unsigned char *)
-	      _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB);
-	  for (i = 0; i < cset->ncoll_syms; ++i)
-	    {
-	      const unsigned char *coll_sym = extra + cset->coll_syms[i];
-	      /* Compare the length of input collating element and
-		 the length of current collating element.  */
-	      if (*coll_sym != elem_len)
-		continue;
-	      /* Compare each bytes.  */
-	      for (j = 0; j < *coll_sym; j++)
-		if (pin[j] != coll_sym[1 + j])
-		  break;
-	      if (j == *coll_sym)
-		{
-		  /* Match if every bytes is equal.  */
-		  match_len = j;
-		  goto check_node_accept_bytes_match;
-		}
-	    }
-
-	  if (cset->nranges)
-	    {
-	      if (elem_len <= char_len)
-		{
-		  collseqwc = _NL_CURRENT (LC_COLLATE, _NL_COLLATE_COLLSEQWC);
-		  in_collseq = __collseq_table_lookup (collseqwc, wc);
-		}
-	      else
-		in_collseq = find_collation_sequence_value (pin, elem_len);
-	    }
-	  /* match with range expression?  */
-	  /* FIXME: Implement rational ranges here, too.  */
-	  for (i = 0; i < cset->nranges; ++i)
-	    if (cset->range_starts[i] <= in_collseq
-		&& in_collseq <= cset->range_ends[i])
-	      {
-		match_len = elem_len;
-		goto check_node_accept_bytes_match;
-	      }
-
-	  /* match with equivalence_class?  */
-	  if (cset->nequiv_classes)
-	    {
-	      const unsigned char *cp = pin;
-	      table = (const int32_t *)
-		_NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
-	      weights = (const unsigned char *)
-		_NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTMB);
-	      extra = (const unsigned char *)
-		_NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB);
-	      indirect = (const int32_t *)
-		_NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB);
-	      int32_t idx = findidx (&cp, elem_len);
-	      if (idx > 0)
-		for (i = 0; i < cset->nequiv_classes; ++i)
-		  {
-		    int32_t equiv_class_idx = cset->equiv_classes[i];
-		    size_t weight_len = weights[idx & 0xffffff];
-		    if (weight_len == weights[equiv_class_idx & 0xffffff]
-			&& (idx >> 24) == (equiv_class_idx >> 24))
-		      {
-			Idx cnt = 0;
-
-			idx &= 0xffffff;
-			equiv_class_idx &= 0xffffff;
-
-			while (cnt <= weight_len
-			       && (weights[equiv_class_idx + 1 + cnt]
-				   == weights[idx + 1 + cnt]))
-			  ++cnt;
-			if (cnt > weight_len)
-			  {
-			    match_len = elem_len;
-			    goto check_node_accept_bytes_match;
-			  }
-		      }
-		  }
-	    }
-	}
-      else
-# endif /* _LIBC */
-	{
-	  /* match with range expression?  */
-	  for (i = 0; i < cset->nranges; ++i)
-	    {
-	      if (cset->range_starts[i] <= wc && wc <= cset->range_ends[i])
-		{
-		  match_len = char_len;
-		  goto check_node_accept_bytes_match;
-		}
-	    }
-	}
-    check_node_accept_bytes_match:
-      if (!cset->non_match)
-	return match_len;
-      else
-	{
-	  if (match_len > 0)
-	    return 0;
-	  else
-	    return (elem_len > char_len) ? elem_len : char_len;
-	}
-    }
-  return 0;
-}
-
-# ifdef _LIBC
-static unsigned int
-internal_function
-find_collation_sequence_value (const unsigned char *mbs, size_t mbs_len)
-{
-  uint32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
-  if (nrules == 0)
-    {
-      if (mbs_len == 1)
-	{
-	  /* No valid character.  Match it as a single byte character.  */
-	  const unsigned char *collseq = (const unsigned char *)
-	    _NL_CURRENT (LC_COLLATE, _NL_COLLATE_COLLSEQMB);
-	  return collseq[mbs[0]];
-	}
-      return UINT_MAX;
-    }
-  else
-    {
-      int32_t idx;
-      const unsigned char *extra = (const unsigned char *)
-	_NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB);
-      int32_t extrasize = (const unsigned char *)
-	_NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB + 1) - extra;
-
-      for (idx = 0; idx < extrasize;)
-	{
-	  int mbs_cnt;
-	  bool found = false;
-	  int32_t elem_mbs_len;
-	  /* Skip the name of collating element name.  */
-	  idx = idx + extra[idx] + 1;
-	  elem_mbs_len = extra[idx++];
-	  if (mbs_len == elem_mbs_len)
-	    {
-	      for (mbs_cnt = 0; mbs_cnt < elem_mbs_len; ++mbs_cnt)
-		if (extra[idx + mbs_cnt] != mbs[mbs_cnt])
-		  break;
-	      if (mbs_cnt == elem_mbs_len)
-		/* Found the entry.  */
-		found = true;
-	    }
-	  /* Skip the byte sequence of the collating element.  */
-	  idx += elem_mbs_len;
-	  /* Adjust for the alignment.  */
-	  idx = (idx + 3) & ~3;
-	  /* Skip the collation sequence value.  */
-	  idx += sizeof (uint32_t);
-	  /* Skip the wide char sequence of the collating element.  */
-	  idx = idx + sizeof (uint32_t) * (*(int32_t *) (extra + idx) + 1);
-	  /* If we found the entry, return the sequence value.  */
-	  if (found)
-	    return *(uint32_t *) (extra + idx);
-	  /* Skip the collation sequence value.  */
-	  idx += sizeof (uint32_t);
-	}
-      return UINT_MAX;
-    }
-}
-# endif /* _LIBC */
-#endif /* RE_ENABLE_I18N */
-
-/* Check whether the node accepts the byte which is IDX-th
-   byte of the INPUT.  */
-
-static bool
-internal_function
-check_node_accept (const re_match_context_t *mctx, const re_token_t *node,
-		   Idx idx)
-{
-  unsigned char ch;
-  ch = re_string_byte_at (&mctx->input, idx);
-  switch (node->type)
-    {
-    case CHARACTER:
-      if (node->opr.c != ch)
-        return false;
-      break;
-
-    case SIMPLE_BRACKET:
-      if (!bitset_contain (node->opr.sbcset, ch))
-        return false;
-      break;
-
-#ifdef RE_ENABLE_I18N
-    case OP_UTF8_PERIOD:
-      if (ch >= ASCII_CHARS)
-        return false;
-      /* FALLTHROUGH */
-#endif
-    case OP_PERIOD:
-      if ((ch == '\n' && !(mctx->dfa->syntax & RE_DOT_NEWLINE))
-	  || (ch == '\0' && (mctx->dfa->syntax & RE_DOT_NOT_NULL)))
-	return false;
-      break;
-
-    default:
-      return false;
-    }
-
-  if (node->constraint)
-    {
-      /* The node has constraints.  Check whether the current context
-	 satisfies the constraints.  */
-      unsigned int context = re_string_context_at (&mctx->input, idx,
-						   mctx->eflags);
-      if (NOT_SATISFY_NEXT_CONSTRAINT (node->constraint, context))
-	return false;
-    }
-
-  return true;
-}
-
-/* Extend the buffers, if the buffers have run out.  */
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-extend_buffers (re_match_context_t *mctx, int min_len)
-{
-  reg_errcode_t ret;
-  re_string_t *pstr = &mctx->input;
-
-  /* Avoid overflow.  */
-  if (BE (MIN (IDX_MAX, SIZE_MAX / sizeof (re_dfastate_t *)) / 2
-          <= pstr->bufs_len, 0))
-    return REG_ESPACE;
-
-  /* Double the lengths of the buffers, but allocate at least MIN_LEN.  */
-  ret = re_string_realloc_buffers (pstr,
-				   MAX (min_len,
-					MIN (pstr->len, pstr->bufs_len * 2)));
-  if (BE (ret != REG_NOERROR, 0))
-    return ret;
-
-  if (mctx->state_log != NULL)
-    {
-      /* And double the length of state_log.  */
-      /* XXX We have no indication of the size of this buffer.  If this
-	 allocation fail we have no indication that the state_log array
-	 does not have the right size.  */
-      re_dfastate_t **new_array = re_realloc (mctx->state_log, re_dfastate_t *,
-					      pstr->bufs_len + 1);
-      if (BE (new_array == NULL, 0))
-	return REG_ESPACE;
-      mctx->state_log = new_array;
-    }
-
-  /* Then reconstruct the buffers.  */
-  if (pstr->icase)
-    {
-#ifdef RE_ENABLE_I18N
-      if (pstr->mb_cur_max > 1)
-	{
-	  ret = build_wcs_upper_buffer (pstr);
-	  if (BE (ret != REG_NOERROR, 0))
-	    return ret;
-	}
-      else
-#endif /* RE_ENABLE_I18N  */
-	build_upper_buffer (pstr);
-    }
-  else
-    {
-#ifdef RE_ENABLE_I18N
-      if (pstr->mb_cur_max > 1)
-	build_wcs_buffer (pstr);
-      else
-#endif /* RE_ENABLE_I18N  */
-	{
-	  if (pstr->trans != NULL)
-	    re_string_translate_buffer (pstr);
-	}
-    }
-  return REG_NOERROR;
-}
-
-
-/* Functions for matching context.  */
-
-/* Initialize MCTX.  */
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-match_ctx_init (re_match_context_t *mctx, int eflags, Idx n)
-{
-  mctx->eflags = eflags;
-  mctx->match_last = REG_MISSING;
-  if (n > 0)
-    {
-      /* Avoid overflow.  */
-      size_t max_object_size =
-	MAX (sizeof (struct re_backref_cache_entry),
-	     sizeof (re_sub_match_top_t *));
-      if (BE (MIN (IDX_MAX, SIZE_MAX / max_object_size) < n, 0))
-	return REG_ESPACE;
-
-      mctx->bkref_ents = re_malloc (struct re_backref_cache_entry, n);
-      mctx->sub_tops = re_malloc (re_sub_match_top_t *, n);
-      if (BE (mctx->bkref_ents == NULL || mctx->sub_tops == NULL, 0))
-	return REG_ESPACE;
-    }
-  /* Already zero-ed by the caller.
-     else
-       mctx->bkref_ents = NULL;
-     mctx->nbkref_ents = 0;
-     mctx->nsub_tops = 0;  */
-  mctx->abkref_ents = n;
-  mctx->max_mb_elem_len = 1;
-  mctx->asub_tops = n;
-  return REG_NOERROR;
-}
-
-/* Clean the entries which depend on the current input in MCTX.
-   This function must be invoked when the matcher changes the start index
-   of the input, or changes the input string.  */
-
-static void
-internal_function
-match_ctx_clean (re_match_context_t *mctx)
-{
-  Idx st_idx;
-  for (st_idx = 0; st_idx < mctx->nsub_tops; ++st_idx)
-    {
-      Idx sl_idx;
-      re_sub_match_top_t *top = mctx->sub_tops[st_idx];
-      for (sl_idx = 0; sl_idx < top->nlasts; ++sl_idx)
-	{
-	  re_sub_match_last_t *last = top->lasts[sl_idx];
-	  re_free (last->path.array);
-	  re_free (last);
-	}
-      re_free (top->lasts);
-      if (top->path)
-	{
-	  re_free (top->path->array);
-	  re_free (top->path);
-	}
-      free (top);
-    }
-
-  mctx->nsub_tops = 0;
-  mctx->nbkref_ents = 0;
-}
-
-/* Free all the memory associated with MCTX.  */
-
-static void
-internal_function
-match_ctx_free (re_match_context_t *mctx)
-{
-  /* First, free all the memory associated with MCTX->SUB_TOPS.  */
-  match_ctx_clean (mctx);
-  re_free (mctx->sub_tops);
-  re_free (mctx->bkref_ents);
-}
-
-/* Add a new backreference entry to MCTX.
-   Note that we assume that caller never call this function with duplicate
-   entry, and call with STR_IDX which isn't smaller than any existing entry.
-*/
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-match_ctx_add_entry (re_match_context_t *mctx, Idx node, Idx str_idx, Idx from,
-		     Idx to)
-{
-  if (mctx->nbkref_ents >= mctx->abkref_ents)
-    {
-      struct re_backref_cache_entry* new_entry;
-      new_entry = re_realloc (mctx->bkref_ents, struct re_backref_cache_entry,
-			      mctx->abkref_ents * 2);
-      if (BE (new_entry == NULL, 0))
-	{
-	  re_free (mctx->bkref_ents);
-	  return REG_ESPACE;
-	}
-      mctx->bkref_ents = new_entry;
-      memset (mctx->bkref_ents + mctx->nbkref_ents, '\0',
-	      sizeof (struct re_backref_cache_entry) * mctx->abkref_ents);
-      mctx->abkref_ents *= 2;
-    }
-  if (mctx->nbkref_ents > 0
-      && mctx->bkref_ents[mctx->nbkref_ents - 1].str_idx == str_idx)
-    mctx->bkref_ents[mctx->nbkref_ents - 1].more = 1;
-
-  mctx->bkref_ents[mctx->nbkref_ents].node = node;
-  mctx->bkref_ents[mctx->nbkref_ents].str_idx = str_idx;
-  mctx->bkref_ents[mctx->nbkref_ents].subexp_from = from;
-  mctx->bkref_ents[mctx->nbkref_ents].subexp_to = to;
-
-  /* This is a cache that saves negative results of check_dst_limits_calc_pos.
-     If bit N is clear, means that this entry won't epsilon-transition to
-     an OP_OPEN_SUBEXP or OP_CLOSE_SUBEXP for the N+1-th subexpression.  If
-     it is set, check_dst_limits_calc_pos_1 will recurse and try to find one
-     such node.
-
-     A backreference does not epsilon-transition unless it is empty, so set
-     to all zeros if FROM != TO.  */
-  mctx->bkref_ents[mctx->nbkref_ents].eps_reachable_subexps_map
-    = (from == to ? -1 : 0);
-
-  mctx->bkref_ents[mctx->nbkref_ents++].more = 0;
-  if (mctx->max_mb_elem_len < to - from)
-    mctx->max_mb_elem_len = to - from;
-  return REG_NOERROR;
-}
-
-/* Return the first entry with the same str_idx, or REG_MISSING if none is
-   found.  Note that MCTX->BKREF_ENTS is already sorted by MCTX->STR_IDX.  */
-
-static Idx
-internal_function
-search_cur_bkref_entry (const re_match_context_t *mctx, Idx str_idx)
-{
-  Idx left, right, mid, last;
-  last = right = mctx->nbkref_ents;
-  for (left = 0; left < right;)
-    {
-      mid = (left + right) / 2;
-      if (mctx->bkref_ents[mid].str_idx < str_idx)
-	left = mid + 1;
-      else
-	right = mid;
-    }
-  if (left < last && mctx->bkref_ents[left].str_idx == str_idx)
-    return left;
-  else
-    return REG_MISSING;
-}
-
-/* Register the node NODE, whose type is OP_OPEN_SUBEXP, and which matches
-   at STR_IDX.  */
-
-static reg_errcode_t
-internal_function __attribute_warn_unused_result__
-match_ctx_add_subtop (re_match_context_t *mctx, Idx node, Idx str_idx)
-{
-#ifdef DEBUG
-  assert (mctx->sub_tops != NULL);
-  assert (mctx->asub_tops > 0);
-#endif
-  if (BE (mctx->nsub_tops == mctx->asub_tops, 0))
-    {
-      Idx new_asub_tops = mctx->asub_tops * 2;
-      re_sub_match_top_t **new_array = re_realloc (mctx->sub_tops,
-						   re_sub_match_top_t *,
-						   new_asub_tops);
-      if (BE (new_array == NULL, 0))
-	return REG_ESPACE;
-      mctx->sub_tops = new_array;
-      mctx->asub_tops = new_asub_tops;
-    }
-  mctx->sub_tops[mctx->nsub_tops] = calloc (1, sizeof (re_sub_match_top_t));
-  if (BE (mctx->sub_tops[mctx->nsub_tops] == NULL, 0))
-    return REG_ESPACE;
-  mctx->sub_tops[mctx->nsub_tops]->node = node;
-  mctx->sub_tops[mctx->nsub_tops++]->str_idx = str_idx;
-  return REG_NOERROR;
-}
-
-/* Register the node NODE, whose type is OP_CLOSE_SUBEXP, and which matches
-   at STR_IDX, whose corresponding OP_OPEN_SUBEXP is SUB_TOP.  */
-
-static re_sub_match_last_t *
-internal_function
-match_ctx_add_sublast (re_sub_match_top_t *subtop, Idx node, Idx str_idx)
-{
-  re_sub_match_last_t *new_entry;
-  if (BE (subtop->nlasts == subtop->alasts, 0))
-    {
-      Idx new_alasts = 2 * subtop->alasts + 1;
-      re_sub_match_last_t **new_array = re_realloc (subtop->lasts,
-						    re_sub_match_last_t *,
-						    new_alasts);
-      if (BE (new_array == NULL, 0))
-	return NULL;
-      subtop->lasts = new_array;
-      subtop->alasts = new_alasts;
-    }
-  new_entry = calloc (1, sizeof (re_sub_match_last_t));
-  if (BE (new_entry != NULL, 1))
-    {
-      subtop->lasts[subtop->nlasts] = new_entry;
-      new_entry->node = node;
-      new_entry->str_idx = str_idx;
-      ++subtop->nlasts;
-    }
-  return new_entry;
-}
-
-static void
-internal_function
-sift_ctx_init (re_sift_context_t *sctx, re_dfastate_t **sifted_sts,
-	       re_dfastate_t **limited_sts, Idx last_node, Idx last_str_idx)
-{
-  sctx->sifted_states = sifted_sts;
-  sctx->limited_states = limited_sts;
-  sctx->last_node = last_node;
-  sctx->last_str_idx = last_str_idx;
-  re_node_set_init_empty (&sctx->limits);
-}

+ 0 - 77
gl/safe-read.c~

@@ -1,77 +0,0 @@
-/* An interface to read and write that retries after interrupts.
-
-   Copyright (C) 1993-1994, 1998, 2002-2006, 2009-2013 Free Software
-   Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#ifdef SAFE_WRITE
-# include "safe-write.h"
-#else
-# include "safe-read.h"
-#endif
-
-/* Get ssize_t.  */
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <errno.h>
-
-#ifdef EINTR
-# define IS_EINTR(x) ((x) == EINTR)
-#else
-# define IS_EINTR(x) 0
-#endif
-
-#include <limits.h>
-
-#ifdef SAFE_WRITE
-# define safe_rw safe_write
-# define rw write
-#else
-# define safe_rw safe_read
-# define rw read
-# undef const
-# define const /* empty */
-#endif
-
-/* Read(write) up to COUNT bytes at BUF from(to) descriptor FD, retrying if
-   interrupted.  Return the actual number of bytes read(written), zero for EOF,
-   or SAFE_READ_ERROR(SAFE_WRITE_ERROR) upon error.  */
-size_t
-safe_rw (int fd, void const *buf, size_t count)
-{
-  /* Work around a bug in Tru64 5.1.  Attempting to read more than
-     INT_MAX bytes fails with errno == EINVAL.  See
-     <http://lists.gnu.org/archive/html/bug-gnu-utils/2002-04/msg00010.html>.
-     When decreasing COUNT, keep it block-aligned.  */
-  enum { BUGGY_READ_MAXIMUM = INT_MAX & ~8191 };
-
-  for (;;)
-    {
-      ssize_t result = rw (fd, buf, count);
-
-      if (0 <= result)
-        return result;
-      else if (IS_EINTR (errno))
-        continue;
-      else if (errno == EINVAL && BUGGY_READ_MAXIMUM < count)
-        count = BUGGY_READ_MAXIMUM;
-      else
-        return result;
-    }
-}

+ 0 - 47
gl/safe-read.h~

@@ -1,47 +0,0 @@
-/* An interface to read() that retries after interrupts.
-   Copyright (C) 2002, 2006, 2009-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Some system calls may be interrupted and fail with errno = EINTR in the
-   following situations:
-     - The process is stopped and restarted (signal SIGSTOP and SIGCONT, user
-       types Ctrl-Z) on some platforms: Mac OS X.
-     - The process receives a signal for which a signal handler was installed
-       with sigaction() with an sa_flags field that does not contain
-       SA_RESTART.
-     - The process receives a signal for which a signal handler was installed
-       with signal() and for which no call to siginterrupt(sig,0) was done,
-       on some platforms: AIX, HP-UX, IRIX, OSF/1, Solaris.
-
-   This module provides a wrapper around read() that handles EINTR.  */
-
-#include <stddef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#define SAFE_READ_ERROR ((size_t) -1)
-
-/* Read up to COUNT bytes at BUF from descriptor FD, retrying if interrupted.
-   Return the actual number of bytes read, zero for EOF, or SAFE_READ_ERROR
-   upon error.  */
-extern size_t safe_read (int fd, void *buf, size_t count);
-
-
-#ifdef __cplusplus
-}
-#endif

+ 0 - 390
gl/setenv.c~

@@ -1,390 +0,0 @@
-/* Copyright (C) 1992, 1995-2003, 2005-2013 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#if !_LIBC
-/* Don't use __attribute__ __nonnull__ in this compilation unit.  Otherwise gcc
-   optimizes away the name == NULL test below.  */
-# define _GL_ARG_NONNULL(params)
-
-# define _GL_USE_STDLIB_ALLOC 1
-# include <config.h>
-#endif
-
-#include <alloca.h>
-
-/* Specification.  */
-#include <stdlib.h>
-
-#include <errno.h>
-#ifndef __set_errno
-# define __set_errno(ev) ((errno) = (ev))
-#endif
-
-#include <string.h>
-#if _LIBC || HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if !_LIBC
-# include "malloca.h"
-#endif
-
-#if _LIBC || !HAVE_SETENV
-
-#if !_LIBC
-# define __environ      environ
-#endif
-
-#if _LIBC
-/* This lock protects against simultaneous modifications of 'environ'.  */
-# include <bits/libc-lock.h>
-__libc_lock_define_initialized (static, envlock)
-# define LOCK   __libc_lock_lock (envlock)
-# define UNLOCK __libc_lock_unlock (envlock)
-#else
-# define LOCK
-# define UNLOCK
-#endif
-
-/* In the GNU C library we must keep the namespace clean.  */
-#ifdef _LIBC
-# define setenv __setenv
-# define clearenv __clearenv
-# define tfind __tfind
-# define tsearch __tsearch
-#endif
-
-/* In the GNU C library implementation we try to be more clever and
-   allow arbitrarily many changes of the environment given that the used
-   values are from a small set.  Outside glibc this will eat up all
-   memory after a while.  */
-#if defined _LIBC || (defined HAVE_SEARCH_H && defined HAVE_TSEARCH \
-                      && defined __GNUC__)
-# define USE_TSEARCH    1
-# include <search.h>
-typedef int (*compar_fn_t) (const void *, const void *);
-
-/* This is a pointer to the root of the search tree with the known
-   values.  */
-static void *known_values;
-
-# define KNOWN_VALUE(Str) \
-  ({                                                                          \
-    void *value = tfind (Str, &known_values, (compar_fn_t) strcmp);           \
-    value != NULL ? *(char **) value : NULL;                                  \
-  })
-# define STORE_VALUE(Str) \
-  tsearch (Str, &known_values, (compar_fn_t) strcmp)
-
-#else
-# undef USE_TSEARCH
-
-# define KNOWN_VALUE(Str) NULL
-# define STORE_VALUE(Str) do { } while (0)
-
-#endif
-
-
-/* If this variable is not a null pointer we allocated the current
-   environment.  */
-static char **last_environ;
-
-
-/* This function is used by 'setenv' and 'putenv'.  The difference between
-   the two functions is that for the former must create a new string which
-   is then placed in the environment, while the argument of 'putenv'
-   must be used directly.  This is all complicated by the fact that we try
-   to reuse values once generated for a 'setenv' call since we can never
-   free the strings.  */
-int
-__add_to_environ (const char *name, const char *value, const char *combined,
-                  int replace)
-{
-  char **ep;
-  size_t size;
-  const size_t namelen = strlen (name);
-  const size_t vallen = value != NULL ? strlen (value) + 1 : 0;
-
-  LOCK;
-
-  /* We have to get the pointer now that we have the lock and not earlier
-     since another thread might have created a new environment.  */
-  ep = __environ;
-
-  size = 0;
-  if (ep != NULL)
-    {
-      for (; *ep != NULL; ++ep)
-        if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=')
-          break;
-        else
-          ++size;
-    }
-
-  if (ep == NULL || *ep == NULL)
-    {
-      char **new_environ;
-#ifdef USE_TSEARCH
-      char *new_value;
-#endif
-
-      /* We allocated this space; we can extend it.  */
-      new_environ =
-        (char **) (last_environ == NULL
-                   ? malloc ((size + 2) * sizeof (char *))
-                   : realloc (last_environ, (size + 2) * sizeof (char *)));
-      if (new_environ == NULL)
-        {
-          /* It's easier to set errno to ENOMEM than to rely on the
-             'malloc-posix' and 'realloc-posix' gnulib modules.  */
-          __set_errno (ENOMEM);
-          UNLOCK;
-          return -1;
-        }
-
-      /* If the whole entry is given add it.  */
-      if (combined != NULL)
-        /* We must not add the string to the search tree since it belongs
-           to the user.  */
-        new_environ[size] = (char *) combined;
-      else
-        {
-          /* See whether the value is already known.  */
-#ifdef USE_TSEARCH
-# ifdef _LIBC
-          new_value = (char *) alloca (namelen + 1 + vallen);
-          __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
-                     value, vallen);
-# else
-          new_value = (char *) malloca (namelen + 1 + vallen);
-          if (new_value == NULL)
-            {
-              __set_errno (ENOMEM);
-              UNLOCK;
-              return -1;
-            }
-          memcpy (new_value, name, namelen);
-          new_value[namelen] = '=';
-          memcpy (&new_value[namelen + 1], value, vallen);
-# endif
-
-          new_environ[size] = KNOWN_VALUE (new_value);
-          if (new_environ[size] == NULL)
-#endif
-            {
-              new_environ[size] = (char *) malloc (namelen + 1 + vallen);
-              if (new_environ[size] == NULL)
-                {
-#if defined USE_TSEARCH && !defined _LIBC
-                  freea (new_value);
-#endif
-                  __set_errno (ENOMEM);
-                  UNLOCK;
-                  return -1;
-                }
-
-#ifdef USE_TSEARCH
-              memcpy (new_environ[size], new_value, namelen + 1 + vallen);
-#else
-              memcpy (new_environ[size], name, namelen);
-              new_environ[size][namelen] = '=';
-              memcpy (&new_environ[size][namelen + 1], value, vallen);
-#endif
-              /* And save the value now.  We cannot do this when we remove
-                 the string since then we cannot decide whether it is a
-                 user string or not.  */
-              STORE_VALUE (new_environ[size]);
-            }
-#if defined USE_TSEARCH && !defined _LIBC
-          freea (new_value);
-#endif
-        }
-
-      if (__environ != last_environ)
-        memcpy ((char *) new_environ, (char *) __environ,
-                size * sizeof (char *));
-
-      new_environ[size + 1] = NULL;
-
-      last_environ = __environ = new_environ;
-    }
-  else if (replace)
-    {
-      char *np;
-
-      /* Use the user string if given.  */
-      if (combined != NULL)
-        np = (char *) combined;
-      else
-        {
-#ifdef USE_TSEARCH
-          char *new_value;
-# ifdef _LIBC
-          new_value = alloca (namelen + 1 + vallen);
-          __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
-                     value, vallen);
-# else
-          new_value = malloca (namelen + 1 + vallen);
-          if (new_value == NULL)
-            {
-              __set_errno (ENOMEM);
-              UNLOCK;
-              return -1;
-            }
-          memcpy (new_value, name, namelen);
-          new_value[namelen] = '=';
-          memcpy (&new_value[namelen + 1], value, vallen);
-# endif
-
-          np = KNOWN_VALUE (new_value);
-          if (np == NULL)
-#endif
-            {
-              np = (char *) malloc (namelen + 1 + vallen);
-              if (np == NULL)
-                {
-#if defined USE_TSEARCH && !defined _LIBC
-                  freea (new_value);
-#endif
-                  __set_errno (ENOMEM);
-                  UNLOCK;
-                  return -1;
-                }
-
-#ifdef USE_TSEARCH
-              memcpy (np, new_value, namelen + 1 + vallen);
-#else
-              memcpy (np, name, namelen);
-              np[namelen] = '=';
-              memcpy (&np[namelen + 1], value, vallen);
-#endif
-              /* And remember the value.  */
-              STORE_VALUE (np);
-            }
-#if defined USE_TSEARCH && !defined _LIBC
-          freea (new_value);
-#endif
-        }
-
-      *ep = np;
-    }
-
-  UNLOCK;
-
-  return 0;
-}
-
-int
-setenv (const char *name, const char *value, int replace)
-{
-  if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  return __add_to_environ (name, value, NULL, replace);
-}
-
-/* The 'clearenv' was planned to be added to POSIX.1 but probably
-   never made it.  Nevertheless the POSIX.9 standard (POSIX bindings
-   for Fortran 77) requires this function.  */
-int
-clearenv (void)
-{
-  LOCK;
-
-  if (__environ == last_environ && __environ != NULL)
-    {
-      /* We allocated this environment so we can free it.  */
-      free (__environ);
-      last_environ = NULL;
-    }
-
-  /* Clear the environment pointer removes the whole environment.  */
-  __environ = NULL;
-
-  UNLOCK;
-
-  return 0;
-}
-
-#ifdef _LIBC
-static void
-free_mem (void)
-{
-  /* Remove all traces.  */
-  clearenv ();
-
-  /* Now remove the search tree.  */
-  __tdestroy (known_values, free);
-  known_values = NULL;
-}
-text_set_element (__libc_subfreeres, free_mem);
-
-
-# undef setenv
-# undef clearenv
-weak_alias (__setenv, setenv)
-weak_alias (__clearenv, clearenv)
-#endif
-
-#endif /* _LIBC || !HAVE_SETENV */
-
-/* The rest of this file is called into use when replacing an existing
-   but buggy setenv.  Known bugs include failure to diagnose invalid
-   name, and consuming a leading '=' from value.  */
-#if HAVE_SETENV
-
-# undef setenv
-# if !HAVE_DECL_SETENV
-extern int setenv (const char *, const char *, int);
-# endif
-# define STREQ(a, b) (strcmp (a, b) == 0)
-
-int
-rpl_setenv (const char *name, const char *value, int replace)
-{
-  int result;
-  if (!name || !*name || strchr (name, '='))
-    {
-      errno = EINVAL;
-      return -1;
-    }
-  /* Call the real setenv even if replace is 0, in case implementation
-     has underlying data to update, such as when environ changes.  */
-  result = setenv (name, value, replace);
-  if (result == 0 && replace && *value == '=')
-    {
-      char *tmp = getenv (name);
-      if (!STREQ (tmp, value))
-        {
-          int saved_errno;
-          size_t len = strlen (value);
-          tmp = malloca (len + 2);
-          /* Since leading '=' is eaten, double it up.  */
-          *tmp = '=';
-          memcpy (tmp + 1, value, len + 1);
-          result = setenv (name, tmp, replace);
-          saved_errno = errno;
-          freea (tmp);
-          errno = saved_errno;
-        }
-    }
-  return result;
-}
-
-#endif /* HAVE_SETENV */

+ 0 - 426
gl/sha1.c~

@@ -1,426 +0,0 @@
-/* sha1.c - Functions to compute SHA1 message digest of files or
-   memory blocks according to the NIST specification FIPS-180-1.
-
-   Copyright (C) 2000-2001, 2003-2006, 2008-2013 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published by the
-   Free Software Foundation; either version 3, or (at your option) any
-   later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Scott G. Miller
-   Credits:
-      Robert Klep <robert@ilse.nl>  -- Expansion function fix
-*/
-
-#include <config.h>
-
-#include "sha1.h"
-
-#include <stdalign.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-#if USE_UNLOCKED_IO
-# include "unlocked-io.h"
-#endif
-
-#ifdef WORDS_BIGENDIAN
-# define SWAP(n) (n)
-#else
-# define SWAP(n) \
-    (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
-#endif
-
-#define BLOCKSIZE 32768
-#if BLOCKSIZE % 64 != 0
-# error "invalid BLOCKSIZE"
-#endif
-
-/* This array contains the bytes used to pad the buffer to the next
-   64-byte boundary.  (RFC 1321, 3.1: Step 1)  */
-static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ...  */ };
-
-
-/* Take a pointer to a 160 bit block of data (five 32 bit ints) and
-   initialize it to the start constants of the SHA1 algorithm.  This
-   must be called before using hash in the call to sha1_hash.  */
-void
-sha1_init_ctx (struct sha1_ctx *ctx)
-{
-  ctx->A = 0x67452301;
-  ctx->B = 0xefcdab89;
-  ctx->C = 0x98badcfe;
-  ctx->D = 0x10325476;
-  ctx->E = 0xc3d2e1f0;
-
-  ctx->total[0] = ctx->total[1] = 0;
-  ctx->buflen = 0;
-}
-
-/* Copy the 4 byte value from v into the memory location pointed to by *cp,
-   If your architecture allows unaligned access this is equivalent to
-   * (uint32_t *) cp = v  */
-static void
-set_uint32 (char *cp, uint32_t v)
-{
-  memcpy (cp, &v, sizeof v);
-}
-
-/* Put result from CTX in first 20 bytes following RESBUF.  The result
-   must be in little endian byte order.  */
-void *
-sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf)
-{
-  char *r = resbuf;
-  set_uint32 (r + 0 * sizeof ctx->A, SWAP (ctx->A));
-  set_uint32 (r + 1 * sizeof ctx->B, SWAP (ctx->B));
-  set_uint32 (r + 2 * sizeof ctx->C, SWAP (ctx->C));
-  set_uint32 (r + 3 * sizeof ctx->D, SWAP (ctx->D));
-  set_uint32 (r + 4 * sizeof ctx->E, SWAP (ctx->E));
-
-  return resbuf;
-}
-
-/* Process the remaining bytes in the internal buffer and the usual
-   prolog according to the standard and write the result to RESBUF.  */
-void *
-sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf)
-{
-  /* Take yet unprocessed bytes into account.  */
-  uint32_t bytes = ctx->buflen;
-  size_t size = (bytes < 56) ? 64 / 4 : 64 * 2 / 4;
-
-  /* Now count remaining bytes.  */
-  ctx->total[0] += bytes;
-  if (ctx->total[0] < bytes)
-    ++ctx->total[1];
-
-  /* Put the 64-bit file length in *bits* at the end of the buffer.  */
-  ctx->buffer[size - 2] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29));
-  ctx->buffer[size - 1] = SWAP (ctx->total[0] << 3);
-
-  memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 4 - bytes);
-
-  /* Process last bytes.  */
-  sha1_process_block (ctx->buffer, size * 4, ctx);
-
-  return sha1_read_ctx (ctx, resbuf);
-}
-
-/* Compute SHA1 message digest for bytes read from STREAM.  The
-   resulting message digest number will be written into the 16 bytes
-   beginning at RESBLOCK.  */
-int
-sha1_stream (FILE *stream, void *resblock)
-{
-  struct sha1_ctx ctx;
-  size_t sum;
-
-  char *buffer = malloc (BLOCKSIZE + 72);
-  if (!buffer)
-    return 1;
-
-  /* Initialize the computation context.  */
-  sha1_init_ctx (&ctx);
-
-  /* Iterate over full file contents.  */
-  while (1)
-    {
-      /* We read the file in blocks of BLOCKSIZE bytes.  One call of the
-         computation function processes the whole buffer so that with the
-         next round of the loop another block can be read.  */
-      size_t n;
-      sum = 0;
-
-      /* Read block.  Take care for partial reads.  */
-      while (1)
-        {
-          n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
-
-          sum += n;
-
-          if (sum == BLOCKSIZE)
-            break;
-
-          if (n == 0)
-            {
-              /* Check for the error flag IFF N == 0, so that we don't
-                 exit the loop after a partial read due to e.g., EAGAIN
-                 or EWOULDBLOCK.  */
-              if (ferror (stream))
-                {
-                  free (buffer);
-                  return 1;
-                }
-              goto process_partial_block;
-            }
-
-          /* We've read at least one byte, so ignore errors.  But always
-             check for EOF, since feof may be true even though N > 0.
-             Otherwise, we could end up calling fread after EOF.  */
-          if (feof (stream))
-            goto process_partial_block;
-        }
-
-      /* Process buffer with BLOCKSIZE bytes.  Note that
-                        BLOCKSIZE % 64 == 0
-       */
-      sha1_process_block (buffer, BLOCKSIZE, &ctx);
-    }
-
- process_partial_block:;
-
-  /* Process any remaining bytes.  */
-  if (sum > 0)
-    sha1_process_bytes (buffer, sum, &ctx);
-
-  /* Construct result in desired memory.  */
-  sha1_finish_ctx (&ctx, resblock);
-  free (buffer);
-  return 0;
-}
-
-/* Compute SHA1 message digest for LEN bytes beginning at BUFFER.  The
-   result is always in little endian byte order, so that a byte-wise
-   output yields to the wanted ASCII representation of the message
-   digest.  */
-void *
-sha1_buffer (const char *buffer, size_t len, void *resblock)
-{
-  struct sha1_ctx ctx;
-
-  /* Initialize the computation context.  */
-  sha1_init_ctx (&ctx);
-
-  /* Process whole buffer but last len % 64 bytes.  */
-  sha1_process_bytes (buffer, len, &ctx);
-
-  /* Put result in desired memory area.  */
-  return sha1_finish_ctx (&ctx, resblock);
-}
-
-void
-sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx)
-{
-  /* When we already have some bits in our internal buffer concatenate
-     both inputs first.  */
-  if (ctx->buflen != 0)
-    {
-      size_t left_over = ctx->buflen;
-      size_t add = 128 - left_over > len ? len : 128 - left_over;
-
-      memcpy (&((char *) ctx->buffer)[left_over], buffer, add);
-      ctx->buflen += add;
-
-      if (ctx->buflen > 64)
-        {
-          sha1_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
-
-          ctx->buflen &= 63;
-          /* The regions in the following copy operation cannot overlap.  */
-          memcpy (ctx->buffer,
-                  &((char *) ctx->buffer)[(left_over + add) & ~63],
-                  ctx->buflen);
-        }
-
-      buffer = (const char *) buffer + add;
-      len -= add;
-    }
-
-  /* Process available complete blocks.  */
-  if (len >= 64)
-    {
-#if !_STRING_ARCH_unaligned
-# define UNALIGNED_P(p) ((uintptr_t) (p) % alignof (uint32_t) != 0)
-      if (UNALIGNED_P (buffer))
-        while (len > 64)
-          {
-            sha1_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
-            buffer = (const char *) buffer + 64;
-            len -= 64;
-          }
-      else
-#endif
-        {
-          sha1_process_block (buffer, len & ~63, ctx);
-          buffer = (const char *) buffer + (len & ~63);
-          len &= 63;
-        }
-    }
-
-  /* Move remaining bytes in internal buffer.  */
-  if (len > 0)
-    {
-      size_t left_over = ctx->buflen;
-
-      memcpy (&((char *) ctx->buffer)[left_over], buffer, len);
-      left_over += len;
-      if (left_over >= 64)
-        {
-          sha1_process_block (ctx->buffer, 64, ctx);
-          left_over -= 64;
-          memcpy (ctx->buffer, &ctx->buffer[16], left_over);
-        }
-      ctx->buflen = left_over;
-    }
-}
-
-/* --- Code below is the primary difference between md5.c and sha1.c --- */
-
-/* SHA1 round constants */
-#define K1 0x5a827999
-#define K2 0x6ed9eba1
-#define K3 0x8f1bbcdc
-#define K4 0xca62c1d6
-
-/* Round functions.  Note that F2 is the same as F4.  */
-#define F1(B,C,D) ( D ^ ( B & ( C ^ D ) ) )
-#define F2(B,C,D) (B ^ C ^ D)
-#define F3(B,C,D) ( ( B & C ) | ( D & ( B | C ) ) )
-#define F4(B,C,D) (B ^ C ^ D)
-
-/* Process LEN bytes of BUFFER, accumulating context into CTX.
-   It is assumed that LEN % 64 == 0.
-   Most of this code comes from GnuPG's cipher/sha1.c.  */
-
-void
-sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx)
-{
-  const uint32_t *words = buffer;
-  size_t nwords = len / sizeof (uint32_t);
-  const uint32_t *endp = words + nwords;
-  uint32_t x[16];
-  uint32_t a = ctx->A;
-  uint32_t b = ctx->B;
-  uint32_t c = ctx->C;
-  uint32_t d = ctx->D;
-  uint32_t e = ctx->E;
-  uint32_t lolen = len;
-
-  /* First increment the byte count.  RFC 1321 specifies the possible
-     length of the file up to 2^64 bits.  Here we only compute the
-     number of bytes.  Do a double word increment.  */
-  ctx->total[0] += lolen;
-  ctx->total[1] += (len >> 31 >> 1) + (ctx->total[0] < lolen);
-
-#define rol(x, n) (((x) << (n)) | ((uint32_t) (x) >> (32 - (n))))
-
-#define M(I) ( tm =   x[I&0x0f] ^ x[(I-14)&0x0f] \
-                    ^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \
-               , (x[I&0x0f] = rol(tm, 1)) )
-
-#define R(A,B,C,D,E,F,K,M)  do { E += rol( A, 5 )     \
-                                      + F( B, C, D )  \
-                                      + K             \
-                                      + M;            \
-                                 B = rol( B, 30 );    \
-                               } while(0)
-
-  while (words < endp)
-    {
-      uint32_t tm;
-      int t;
-      for (t = 0; t < 16; t++)
-        {
-          x[t] = SWAP (*words);
-          words++;
-        }
-
-      R( a, b, c, d, e, F1, K1, x[ 0] );
-      R( e, a, b, c, d, F1, K1, x[ 1] );
-      R( d, e, a, b, c, F1, K1, x[ 2] );
-      R( c, d, e, a, b, F1, K1, x[ 3] );
-      R( b, c, d, e, a, F1, K1, x[ 4] );
-      R( a, b, c, d, e, F1, K1, x[ 5] );
-      R( e, a, b, c, d, F1, K1, x[ 6] );
-      R( d, e, a, b, c, F1, K1, x[ 7] );
-      R( c, d, e, a, b, F1, K1, x[ 8] );
-      R( b, c, d, e, a, F1, K1, x[ 9] );
-      R( a, b, c, d, e, F1, K1, x[10] );
-      R( e, a, b, c, d, F1, K1, x[11] );
-      R( d, e, a, b, c, F1, K1, x[12] );
-      R( c, d, e, a, b, F1, K1, x[13] );
-      R( b, c, d, e, a, F1, K1, x[14] );
-      R( a, b, c, d, e, F1, K1, x[15] );
-      R( e, a, b, c, d, F1, K1, M(16) );
-      R( d, e, a, b, c, F1, K1, M(17) );
-      R( c, d, e, a, b, F1, K1, M(18) );
-      R( b, c, d, e, a, F1, K1, M(19) );
-      R( a, b, c, d, e, F2, K2, M(20) );
-      R( e, a, b, c, d, F2, K2, M(21) );
-      R( d, e, a, b, c, F2, K2, M(22) );
-      R( c, d, e, a, b, F2, K2, M(23) );
-      R( b, c, d, e, a, F2, K2, M(24) );
-      R( a, b, c, d, e, F2, K2, M(25) );
-      R( e, a, b, c, d, F2, K2, M(26) );
-      R( d, e, a, b, c, F2, K2, M(27) );
-      R( c, d, e, a, b, F2, K2, M(28) );
-      R( b, c, d, e, a, F2, K2, M(29) );
-      R( a, b, c, d, e, F2, K2, M(30) );
-      R( e, a, b, c, d, F2, K2, M(31) );
-      R( d, e, a, b, c, F2, K2, M(32) );
-      R( c, d, e, a, b, F2, K2, M(33) );
-      R( b, c, d, e, a, F2, K2, M(34) );
-      R( a, b, c, d, e, F2, K2, M(35) );
-      R( e, a, b, c, d, F2, K2, M(36) );
-      R( d, e, a, b, c, F2, K2, M(37) );
-      R( c, d, e, a, b, F2, K2, M(38) );
-      R( b, c, d, e, a, F2, K2, M(39) );
-      R( a, b, c, d, e, F3, K3, M(40) );
-      R( e, a, b, c, d, F3, K3, M(41) );
-      R( d, e, a, b, c, F3, K3, M(42) );
-      R( c, d, e, a, b, F3, K3, M(43) );
-      R( b, c, d, e, a, F3, K3, M(44) );
-      R( a, b, c, d, e, F3, K3, M(45) );
-      R( e, a, b, c, d, F3, K3, M(46) );
-      R( d, e, a, b, c, F3, K3, M(47) );
-      R( c, d, e, a, b, F3, K3, M(48) );
-      R( b, c, d, e, a, F3, K3, M(49) );
-      R( a, b, c, d, e, F3, K3, M(50) );
-      R( e, a, b, c, d, F3, K3, M(51) );
-      R( d, e, a, b, c, F3, K3, M(52) );
-      R( c, d, e, a, b, F3, K3, M(53) );
-      R( b, c, d, e, a, F3, K3, M(54) );
-      R( a, b, c, d, e, F3, K3, M(55) );
-      R( e, a, b, c, d, F3, K3, M(56) );
-      R( d, e, a, b, c, F3, K3, M(57) );
-      R( c, d, e, a, b, F3, K3, M(58) );
-      R( b, c, d, e, a, F3, K3, M(59) );
-      R( a, b, c, d, e, F4, K4, M(60) );
-      R( e, a, b, c, d, F4, K4, M(61) );
-      R( d, e, a, b, c, F4, K4, M(62) );
-      R( c, d, e, a, b, F4, K4, M(63) );
-      R( b, c, d, e, a, F4, K4, M(64) );
-      R( a, b, c, d, e, F4, K4, M(65) );
-      R( e, a, b, c, d, F4, K4, M(66) );
-      R( d, e, a, b, c, F4, K4, M(67) );
-      R( c, d, e, a, b, F4, K4, M(68) );
-      R( b, c, d, e, a, F4, K4, M(69) );
-      R( a, b, c, d, e, F4, K4, M(70) );
-      R( e, a, b, c, d, F4, K4, M(71) );
-      R( d, e, a, b, c, F4, K4, M(72) );
-      R( c, d, e, a, b, F4, K4, M(73) );
-      R( b, c, d, e, a, F4, K4, M(74) );
-      R( a, b, c, d, e, F4, K4, M(75) );
-      R( e, a, b, c, d, F4, K4, M(76) );
-      R( d, e, a, b, c, F4, K4, M(77) );
-      R( c, d, e, a, b, F4, K4, M(78) );
-      R( b, c, d, e, a, F4, K4, M(79) );
-
-      a = ctx->A += a;
-      b = ctx->B += b;
-      c = ctx->C += c;
-      d = ctx->D += d;
-      e = ctx->E += e;
-    }
-}

+ 0 - 91
gl/sha1.h~

@@ -1,91 +0,0 @@
-/* Declarations of functions and data types used for SHA1 sum
-   library functions.
-   Copyright (C) 2000-2001, 2003, 2005-2006, 2008-2013 Free Software
-   Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published by the
-   Free Software Foundation; either version 3, or (at your option) any
-   later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef NAGIOS_GL_SHA1_H_INCLUDED
-# define NAGIOS_GL_SHA1_H_INCLUDED
-
-# include <stdio.h>
-# include <stdint.h>
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-#define SHA1_DIGEST_SIZE 20
-
-/* Structure to save state of computation between the single steps.  */
-struct sha1_ctx
-{
-  uint32_t A;
-  uint32_t B;
-  uint32_t C;
-  uint32_t D;
-  uint32_t E;
-
-  uint32_t total[2];
-  uint32_t buflen;
-  uint32_t buffer[32];
-};
-
-
-/* Initialize structure containing state of computation. */
-extern void sha1_init_ctx (struct sha1_ctx *ctx);
-
-/* Starting with the result of former calls of this function (or the
-   initialization function update the context for the next LEN bytes
-   starting at BUFFER.
-   It is necessary that LEN is a multiple of 64!!! */
-extern void sha1_process_block (const void *buffer, size_t len,
-                                struct sha1_ctx *ctx);
-
-/* Starting with the result of former calls of this function (or the
-   initialization function update the context for the next LEN bytes
-   starting at BUFFER.
-   It is NOT required that LEN is a multiple of 64.  */
-extern void sha1_process_bytes (const void *buffer, size_t len,
-                                struct sha1_ctx *ctx);
-
-/* Process the remaining bytes in the buffer and put result from CTX
-   in first 20 bytes following RESBUF.  The result is always in little
-   endian byte order, so that a byte-wise output yields to the wanted
-   ASCII representation of the message digest.  */
-extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf);
-
-
-/* Put result from CTX in first 20 bytes following RESBUF.  The result is
-   always in little endian byte order, so that a byte-wise output yields
-   to the wanted ASCII representation of the message digest.  */
-extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf);
-
-
-/* Compute SHA1 message digest for bytes read from STREAM.  The
-   resulting message digest number will be written into the 20 bytes
-   beginning at RESBLOCK.  */
-extern int sha1_stream (FILE *stream, void *resblock);
-
-/* Compute SHA1 message digest for LEN bytes beginning at BUFFER.  The
-   result is always in little endian byte order, so that a byte-wise
-   output yields to the wanted ASCII representation of the message
-   digest.  */
-extern void *sha1_buffer (const char *buffer, size_t len, void *resblock);
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif

+ 0 - 30
gl/size_max.h~

@@ -1,30 +0,0 @@
-/* size_max.h -- declare SIZE_MAX through system headers
-   Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc.
-   Written by Simon Josefsson.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef GNULIB_SIZE_MAX_H
-#define GNULIB_SIZE_MAX_H
-
-/* Get SIZE_MAX declaration on systems like Solaris 7/8/9.  */
-# include <limits.h>
-/* Get SIZE_MAX declaration on systems like glibc 2.  */
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-/* On systems where these include files don't define it, SIZE_MAX is defined
-   in config.h.  */
-
-#endif /* GNULIB_SIZE_MAX_H */

+ 0 - 71
gl/snprintf.c~

@@ -1,71 +0,0 @@
-/* Formatted output to strings.
-   Copyright (C) 2004, 2006-2013 Free Software Foundation, Inc.
-   Written by Simon Josefsson and Paul Eggert.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include <stdio.h>
-
-#include <errno.h>
-#include <limits.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "vasnprintf.h"
-
-/* Print formatted output to string STR.  Similar to sprintf, but
-   additional length SIZE limit how much is written into STR.  Returns
-   string length of formatted string (which may be larger than SIZE).
-   STR may be NULL, in which case nothing will be written.  On error,
-   return a negative value.  */
-int
-snprintf (char *str, size_t size, const char *format, ...)
-{
-  char *output;
-  size_t len;
-  size_t lenbuf = size;
-  va_list args;
-
-  va_start (args, format);
-  output = vasnprintf (str, &lenbuf, format, args);
-  len = lenbuf;
-  va_end (args);
-
-  if (!output)
-    return -1;
-
-  if (output != str)
-    {
-      if (size)
-        {
-          size_t pruned_len = (len < size ? len : size - 1);
-          memcpy (str, output, pruned_len);
-          str[pruned_len] = '\0';
-        }
-
-      free (output);
-    }
-
-  if (INT_MAX < len)
-    {
-      errno = EOVERFLOW;
-      return -1;
-    }
-
-  return len;
-}

+ 0 - 154
gl/sockets.c~

@@ -1,154 +0,0 @@
-/* sockets.c --- wrappers for Windows socket functions
-
-   Copyright (C) 2008-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Simon Josefsson */
-
-#include <config.h>
-
-/* Specification.  */
-#include "sockets.h"
-
-#if WINDOWS_SOCKETS
-
-/* This includes winsock2.h on MinGW. */
-# include <sys/socket.h>
-
-# include "fd-hook.h"
-# include "msvc-nothrow.h"
-
-/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-# include "w32sock.h"
-
-static int
-close_fd_maybe_socket (const struct fd_hook *remaining_list,
-                       gl_close_fn primary,
-                       int fd)
-{
-  /* Note about multithread-safety: There is a race condition where, between
-     our calls to closesocket() and the primary close(), some other thread
-     could make system calls that allocate precisely the same HANDLE value
-     as sock; then the primary close() would call CloseHandle() on it.  */
-  SOCKET sock;
-  WSANETWORKEVENTS ev;
-
-  /* Test whether fd refers to a socket.  */
-  sock = FD_TO_SOCKET (fd);
-  ev.lNetworkEvents = 0xDEADBEEF;
-  WSAEnumNetworkEvents (sock, NULL, &ev);
-  if (ev.lNetworkEvents != 0xDEADBEEF)
-    {
-      /* fd refers to a socket.  */
-      /* FIXME: other applications, like squid, use an undocumented
-         _free_osfhnd free function.  But this is not enough: The 'osfile'
-         flags for fd also needs to be cleared, but it is hard to access it.
-         Instead, here we just close twice the file descriptor.  */
-      if (closesocket (sock))
-        {
-          set_winsock_errno ();
-          return -1;
-        }
-      else
-        {
-          /* This call frees the file descriptor and does a
-             CloseHandle ((HANDLE) _get_osfhandle (fd)), which fails.  */
-          _close (fd);
-          return 0;
-        }
-    }
-  else
-    /* Some other type of file descriptor.  */
-    return execute_close_hooks (remaining_list, primary, fd);
-}
-
-static int
-ioctl_fd_maybe_socket (const struct fd_hook *remaining_list,
-                       gl_ioctl_fn primary,
-                       int fd, int request, void *arg)
-{
-  SOCKET sock;
-  WSANETWORKEVENTS ev;
-
-  /* Test whether fd refers to a socket.  */
-  sock = FD_TO_SOCKET (fd);
-  ev.lNetworkEvents = 0xDEADBEEF;
-  WSAEnumNetworkEvents (sock, NULL, &ev);
-  if (ev.lNetworkEvents != 0xDEADBEEF)
-    {
-      /* fd refers to a socket.  */
-      if (ioctlsocket (sock, request, arg) < 0)
-        {
-          set_winsock_errno ();
-          return -1;
-        }
-      else
-        return 0;
-    }
-  else
-    /* Some other type of file descriptor.  */
-    return execute_ioctl_hooks (remaining_list, primary, fd, request, arg);
-}
-
-static struct fd_hook fd_sockets_hook;
-
-static int initialized_sockets_version /* = 0 */;
-
-#endif /* WINDOWS_SOCKETS */
-
-int
-gl_sockets_startup (int version _GL_UNUSED)
-{
-#if WINDOWS_SOCKETS
-  if (version > initialized_sockets_version)
-    {
-      WSADATA data;
-      int err;
-
-      err = WSAStartup (version, &data);
-      if (err != 0)
-        return 1;
-
-      if (data.wVersion < version)
-        return 2;
-
-      if (initialized_sockets_version == 0)
-        register_fd_hook (close_fd_maybe_socket, ioctl_fd_maybe_socket,
-                          &fd_sockets_hook);
-
-      initialized_sockets_version = version;
-    }
-#endif
-
-  return 0;
-}
-
-int
-gl_sockets_cleanup (void)
-{
-#if WINDOWS_SOCKETS
-  int err;
-
-  initialized_sockets_version = 0;
-
-  unregister_fd_hook (&fd_sockets_hook);
-
-  err = WSACleanup ();
-  if (err != 0)
-    return 1;
-#endif
-
-  return 0;
-}

+ 0 - 62
gl/sockets.h~

@@ -1,62 +0,0 @@
-/* sockets.h - wrappers for Windows socket functions
-
-   Copyright (C) 2008-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Simon Josefsson */
-
-#ifndef NAGIOS_SOCKETS_H_INCLUDED
-# define NAGIOS_SOCKETS_H_INCLUDED
-
-#define SOCKETS_1_0 0x100  /* don't use - does not work on Windows XP */
-#define SOCKETS_1_1 0x101
-#define SOCKETS_2_0 0x200  /* don't use - does not work on Windows XP */
-#define SOCKETS_2_1 0x201
-#define SOCKETS_2_2 0x202
-
-int gl_sockets_startup (int version)
-#if !WINDOWS_SOCKETS
-  _GL_ATTRIBUTE_CONST
-#endif
-  ;
-
-int gl_sockets_cleanup (void)
-#if !WINDOWS_SOCKETS
-  _GL_ATTRIBUTE_CONST
-#endif
-  ;
-
-/* This function is useful it you create a socket using gnulib's
-   Winsock wrappers but needs to pass on the socket handle to some
-   other library that only accepts sockets. */
-#if WINDOWS_SOCKETS
-
-#include <sys/socket.h>
-
-#include "msvc-nothrow.h"
-
-static inline SOCKET
-gl_fd_to_handle (int fd)
-{
-  return _get_osfhandle (fd);
-}
-
-#else
-
-#define gl_fd_to_handle(x) (x)
-
-#endif /* WINDOWS_SOCKETS */
-
-#endif /* NAGIOS_SOCKETS_H_INCLUDED */

+ 0 - 109
gl/stdalign.in.h~

@@ -1,109 +0,0 @@
-/* A substitute for ISO C11 <stdalign.h>.
-
-   Copyright 2011-2013 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Paul Eggert and Bruno Haible.  */
-
-#ifndef NAGIOS_GL_STDALIGN_H_INCLUDED
-#define NAGIOS_GL_STDALIGN_H_INCLUDED
-
-/* ISO C11 <stdalign.h> for platforms that lack it.
-
-   References:
-   ISO C11 (latest free draft
-   <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf>)
-   sections 6.5.3.4, 6.7.5, 7.15.
-   C++11 (latest free draft
-   <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf>)
-   section 18.10. */
-
-/* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment
-   requirement of a structure member (i.e., slot or field) that is of
-   type TYPE, as an integer constant expression.
-
-   This differs from GCC's __alignof__ operator, which can yield a
-   better-performing alignment for an object of that type.  For
-   example, on x86 with GCC, __alignof__ (double) and __alignof__
-   (long long) are 8, whereas alignof (double) and alignof (long long)
-   are 4 unless the option '-malign-double' is used.
-
-   The result cannot be used as a value for an 'enum' constant, if you
-   want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc.
-
-   Include <stddef.h> for offsetof.  */
-#include <stddef.h>
-
-/* FreeBSD 9.1 <sys/cdefs.h>, included by <stddef.h> and lots of other
-   standard headers, defines conflicting implementations of _Alignas
-   and _Alignof that are no better than ours; override them.  */
-#undef _Alignas
-#undef _Alignof
-
-#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
-# ifdef __cplusplus
-#  if 201103 <= __cplusplus
-#   define _Alignof(type) alignof (type)
-#  else
-   template <class __t> struct __alignof_helper { char __a; __t __b; };
-#   define _Alignof(type) offsetof (__alignof_helper<type>, __b)
-#  endif
-# else
-#  define _Alignof(type) offsetof (struct { char __a; type __b; }, __b)
-# endif
-#endif
-#define alignof _Alignof
-#define __alignof_is_defined 1
-
-/* alignas (A), also known as _Alignas (A), aligns a variable or type
-   to the alignment A, where A is an integer constant expression.  For
-   example:
-
-      int alignas (8) foo;
-      struct s { int a; int alignas (8) bar; };
-
-   aligns the address of FOO and the offset of BAR to be multiples of 8.
-
-   A should be a power of two that is at least the type's alignment
-   and at most the implementation's alignment limit.  This limit is
-   2**28 on typical GNUish hosts, and 2**13 on MSVC.  To be portable
-   to MSVC through at least version 10.0, A should be an integer
-   constant, as MSVC does not support expressions such as 1 << 3.
-   To be portable to Sun C 5.11, do not align auto variables to
-   anything stricter than their default alignment.
-
-   The following C11 requirements are not supported here:
-
-     - If A is zero, alignas has no effect.
-     - alignas can be used multiple times; the strictest one wins.
-     - alignas (TYPE) is equivalent to alignas (alignof (TYPE)).
-
-   */
-
-#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
-# if defined __cplusplus && 201103 <= __cplusplus
-#  define _Alignas(a) alignas (a)
-# elif __GNUC__ || __IBMC__ || __IBMCPP__ || __ICC || 0x5110 <= __SUNPRO_C
-#  define _Alignas(a) __attribute__ ((__aligned__ (a)))
-# elif 1300 <= _MSC_VER
-#  define _Alignas(a) __declspec (align (a))
-# endif
-#endif
-#if defined _Alignas || (defined __STDC_VERSION && 201112 <= __STDC_VERSION__)
-# define alignas _Alignas
-# define __alignas_is_defined 1
-#endif
-
-#endif /* NAGIOS_GL_STDALIGN_H_INCLUDED */

+ 0 - 132
gl/stdbool.in.h~

@@ -1,132 +0,0 @@
-/* Copyright (C) 2001-2003, 2006-2013 Free Software Foundation, Inc.
-   Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef NAGIOS_GL_STDBOOL_H_INCLUDED
-#define NAGIOS_GL_STDBOOL_H_INCLUDED
-
-/* ISO C 99 <stdbool.h> for platforms that lack it.  */
-
-/* Usage suggestions:
-
-   Programs that use <stdbool.h> should be aware of some limitations
-   and standards compliance issues.
-
-   Standards compliance:
-
-       - <stdbool.h> must be #included before 'bool', 'false', 'true'
-         can be used.
-
-       - You cannot assume that sizeof (bool) == 1.
-
-       - Programs should not undefine the macros bool, true, and false,
-         as C99 lists that as an "obsolescent feature".
-
-   Limitations of this substitute, when used in a C89 environment:
-
-       - <stdbool.h> must be #included before the '_Bool' type can be used.
-
-       - You cannot assume that _Bool is a typedef; it might be a macro.
-
-       - Bit-fields of type 'bool' are not supported.  Portable code
-         should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'.
-
-       - In C99, casts and automatic conversions to '_Bool' or 'bool' are
-         performed in such a way that every nonzero value gets converted
-         to 'true', and zero gets converted to 'false'.  This doesn't work
-         with this substitute.  With this substitute, only the values 0 and 1
-         give the expected result when converted to _Bool' or 'bool'.
-
-       - C99 allows the use of (_Bool)0.0 in constant expressions, but
-         this substitute cannot always provide this property.
-
-   Also, it is suggested that programs use 'bool' rather than '_Bool';
-   this isn't required, but 'bool' is more common.  */
-
-
-/* 7.16. Boolean type and values */
-
-/* BeOS <sys/socket.h> already #defines false 0, true 1.  We use the same
-   definitions below, but temporarily we have to #undef them.  */
-#if defined __BEOS__ && !defined __HAIKU__
-# include <OS.h> /* defines bool but not _Bool */
-# undef false
-# undef true
-#endif
-
-#ifdef __cplusplus
-# define _Bool bool
-# define bool bool
-#else
-# if defined __BEOS__ && !defined __HAIKU__
-  /* A compiler known to have 'bool'.  */
-  /* If the compiler already has both 'bool' and '_Bool', we can assume they
-     are the same types.  */
-#  if !@HAVE__BOOL@
-typedef bool _Bool;
-#  endif
-# else
-#  if !defined __GNUC__
-   /* If @HAVE__BOOL@:
-        Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when
-        the built-in _Bool type is used.  See
-          http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
-          http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
-          http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
-        Similar bugs are likely with other compilers as well; this file
-        wouldn't be used if <stdbool.h> was working.
-        So we override the _Bool type.
-      If !@HAVE__BOOL@:
-        Need to define _Bool ourselves. As 'signed char' or as an enum type?
-        Use of a typedef, with SunPRO C, leads to a stupid
-          "warning: _Bool is a keyword in ISO C99".
-        Use of an enum type, with IRIX cc, leads to a stupid
-          "warning(1185): enumerated type mixed with another type".
-        Even the existence of an enum type, without a typedef,
-          "Invalid enumerator. (badenum)" with HP-UX cc on Tru64.
-        The only benefit of the enum, debuggability, is not important
-        with these compilers.  So use 'signed char' and no enum.  */
-#   define _Bool signed char
-#  else
-   /* With this compiler, trust the _Bool type if the compiler has it.  */
-#   if !@HAVE__BOOL@
-   /* For the sake of symbolic names in gdb, define true and false as
-      enum constants, not only as macros.
-      It is tempting to write
-         typedef enum { false = 0, true = 1 } _Bool;
-      so that gdb prints values of type 'bool' symbolically.  But then
-      values of type '_Bool' might promote to 'int' or 'unsigned int'
-      (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
-      (see ISO C 99 6.3.1.1.(2)).  So add a negative value to the
-      enum; this ensures that '_Bool' promotes to 'int'.  */
-typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
-#   endif
-#  endif
-# endif
-# define bool _Bool
-#endif
-
-/* The other macros must be usable in preprocessor directives.  */
-#ifdef __cplusplus
-# define false false
-# define true true
-#else
-# define false 0
-# define true 1
-#endif
-
-#define __bool_true_false_are_defined 1
-
-#endif /* NAGIOS_GL_STDBOOL_H_INCLUDED */

+ 0 - 86
gl/stddef.in.h~

@@ -1,86 +0,0 @@
-/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
-
-   Copyright (C) 2009-2013 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Eric Blake.  */
-
-/*
- * POSIX 2008 <stddef.h> for platforms that have issues.
- * <http://www.opengroup.org/susv3xbd/stddef.h.html>
- */
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-#if defined __need_wchar_t || defined __need_size_t  \
-  || defined __need_ptrdiff_t || defined __need_NULL \
-  || defined __need_wint_t
-/* Special invocation convention inside gcc header files.  In
-   particular, gcc provides a version of <stddef.h> that blindly
-   redefines NULL even when __need_wint_t was defined, even though
-   wint_t is not normally provided by <stddef.h>.  Hence, we must
-   remember if special invocation has ever been used to obtain wint_t,
-   in which case we need to clean up NULL yet again.  */
-
-# if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T)
-#  ifdef __need_wint_t
-#   undef _@GUARD_PREFIX@_STDDEF_H
-#   define _GL_STDDEF_WINT_T
-#  endif
-#  @INCLUDE_NEXT@ @NEXT_STDDEF_H@
-# endif
-
-#else
-/* Normal invocation convention.  */
-
-# ifndef _@GUARD_PREFIX@_STDDEF_H
-
-/* The include_next requires a split double-inclusion guard.  */
-
-#  @INCLUDE_NEXT@ @NEXT_STDDEF_H@
-
-#  ifndef _@GUARD_PREFIX@_STDDEF_H
-#   define _@GUARD_PREFIX@_STDDEF_H
-
-/* On NetBSD 5.0, the definition of NULL lacks proper parentheses.  */
-#if @REPLACE_NULL@
-# undef NULL
-# ifdef __cplusplus
-   /* ISO C++ says that the macro NULL must expand to an integer constant
-      expression, hence '((void *) 0)' is not allowed in C++.  */
-#  if __GNUG__ >= 3
-    /* GNU C++ has a __null macro that behaves like an integer ('int' or
-       'long') but has the same size as a pointer.  Use that, to avoid
-       warnings.  */
-#   define NULL __null
-#  else
-#   define NULL 0L
-#  endif
-# else
-#  define NULL ((void *) 0)
-# endif
-#endif
-
-/* Some platforms lack wchar_t.  */
-#if !@HAVE_WCHAR_T@
-# define wchar_t int
-#endif
-
-#  endif /* _@GUARD_PREFIX@_STDDEF_H */
-# endif /* _@GUARD_PREFIX@_STDDEF_H */
-#endif /* __need_XXX */

+ 0 - 636
gl/stdint.in.h~

@@ -1,636 +0,0 @@
-/* Copyright (C) 2001-2002, 2004-2013 Free Software Foundation, Inc.
-   Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
-   This file is part of gnulib.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-/*
- * ISO C 99 <stdint.h> for platforms that lack it.
- * <http://www.opengroup.org/susv3xbd/stdint.h.html>
- */
-
-#ifndef _@GUARD_PREFIX@_STDINT_H
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-/* When including a system file that in turn includes <inttypes.h>,
-   use the system <inttypes.h>, not our substitute.  This avoids
-   problems with (for example) VMS, whose <sys/bitypes.h> includes
-   <inttypes.h>.  */
-#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
-
-/* On Android (Bionic libc), <sys/types.h> includes this file before
-   having defined 'time_t'.  Therefore in this case avoid including
-   other system header files; just include the system's <stdint.h>.
-   Ideally we should test __BIONIC__ here, but it is only defined after
-   <sys/cdefs.h> has been included; hence test __ANDROID__ instead.  */
-#if defined __ANDROID__ \
-    && defined _SYS_TYPES_H_ && !defined __need_size_t
-# @INCLUDE_NEXT@ @NEXT_STDINT_H@
-#else
-
-/* Get those types that are already defined in other system include
-   files, so that we can "#define int8_t signed char" below without
-   worrying about a later system include file containing a "typedef
-   signed char int8_t;" that will get messed up by our macro.  Our
-   macros should all be consistent with the system versions, except
-   for the "fast" types and macros, which we recommend against using
-   in public interfaces due to compiler differences.  */
-
-#if @HAVE_STDINT_H@
-# if defined __sgi && ! defined __c99
-   /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users
-      with "This header file is to be used only for c99 mode compilations"
-      diagnostics.  */
-#  define __STDINT_H__
-# endif
-
-  /* Some pre-C++11 <stdint.h> implementations need this.  */
-# ifdef __cplusplus
-#  ifndef __STDC_CONSTANT_MACROS
-#   define __STDC_CONSTANT_MACROS 1
-#  endif
-#  ifndef __STDC_LIMIT_MACROS
-#   define __STDC_LIMIT_MACROS 1
-#  endif
-# endif
-
-  /* Other systems may have an incomplete or buggy <stdint.h>.
-     Include it before <inttypes.h>, since any "#include <stdint.h>"
-     in <inttypes.h> would reinclude us, skipping our contents because
-     _@GUARD_PREFIX@_STDINT_H is defined.
-     The include_next requires a split double-inclusion guard.  */
-# @INCLUDE_NEXT@ @NEXT_STDINT_H@
-#endif
-
-#if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
-#define _@GUARD_PREFIX@_STDINT_H
-
-/* <sys/types.h> defines some of the stdint.h types as well, on glibc,
-   IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
-   AIX 5.2 <sys/types.h> isn't needed and causes troubles.
-   Mac OS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
-   relies on the system <stdint.h> definitions, so include
-   <sys/types.h> after @NEXT_STDINT_H@.  */
-#if @HAVE_SYS_TYPES_H@ && ! defined _AIX
-# include <sys/types.h>
-#endif
-
-/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX,
-   LONG_MIN, LONG_MAX, ULONG_MAX.  */
-#include <limits.h>
-
-#if @HAVE_INTTYPES_H@
-  /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
-     int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
-     <inttypes.h> also defines intptr_t and uintptr_t.  */
-# include <inttypes.h>
-#elif @HAVE_SYS_INTTYPES_H@
-  /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
-     the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX.  */
-# include <sys/inttypes.h>
-#endif
-
-#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__
-  /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
-     int{8,16,32,64}_t and __BIT_TYPES_DEFINED__.  In libc5 >= 5.2.2 it is
-     included by <sys/types.h>.  */
-# include <sys/bitypes.h>
-#endif
-
-#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
-
-/* Minimum and maximum values for an integer type under the usual assumption.
-   Return an unspecified value if BITS == 0, adding a check to pacify
-   picky compilers.  */
-
-#define _STDINT_MIN(signed, bits, zero) \
-  ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero))
-
-#define _STDINT_MAX(signed, bits, zero) \
-  ((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.  */ \
-     ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
-
-#if !GNULIB_defined_stdint_types
-
-/* 7.18.1.1. Exact-width integer types */
-
-/* Here we assume a standard architecture where the hardware integer
-   types have 8, 16, 32, optionally 64 bits.  */
-
-#undef int8_t
-#undef uint8_t
-typedef signed char gl_int8_t;
-typedef unsigned char gl_uint8_t;
-#define int8_t gl_int8_t
-#define uint8_t gl_uint8_t
-
-#undef int16_t
-#undef uint16_t
-typedef short int gl_int16_t;
-typedef unsigned short int gl_uint16_t;
-#define int16_t gl_int16_t
-#define uint16_t gl_uint16_t
-
-#undef int32_t
-#undef uint32_t
-typedef int gl_int32_t;
-typedef unsigned int gl_uint32_t;
-#define int32_t gl_int32_t
-#define uint32_t gl_uint32_t
-
-/* If the system defines INT64_MAX, assume int64_t works.  That way,
-   if the underlying platform defines int64_t to be a 64-bit long long
-   int, the code below won't mistakenly define it to be a 64-bit long
-   int, which would mess up C++ name mangling.  We must use #ifdef
-   rather than #if, to avoid an error with HP-UX 10.20 cc.  */
-
-#ifdef INT64_MAX
-# define GL_INT64_T
-#else
-/* Do not undefine int64_t if gnulib is not being used with 64-bit
-   types, since otherwise it breaks platforms like Tandem/NSK.  */
-# if LONG_MAX >> 31 >> 31 == 1
-#  undef int64_t
-typedef long int gl_int64_t;
-#  define int64_t gl_int64_t
-#  define GL_INT64_T
-# elif defined _MSC_VER
-#  undef int64_t
-typedef __int64 gl_int64_t;
-#  define int64_t gl_int64_t
-#  define GL_INT64_T
-# elif @HAVE_LONG_LONG_INT@
-#  undef int64_t
-typedef long long int gl_int64_t;
-#  define int64_t gl_int64_t
-#  define GL_INT64_T
-# endif
-#endif
-
-#ifdef UINT64_MAX
-# define GL_UINT64_T
-#else
-# if ULONG_MAX >> 31 >> 31 >> 1 == 1
-#  undef uint64_t
-typedef unsigned long int gl_uint64_t;
-#  define uint64_t gl_uint64_t
-#  define GL_UINT64_T
-# elif defined _MSC_VER
-#  undef uint64_t
-typedef unsigned __int64 gl_uint64_t;
-#  define uint64_t gl_uint64_t
-#  define GL_UINT64_T
-# elif @HAVE_UNSIGNED_LONG_LONG_INT@
-#  undef uint64_t
-typedef unsigned long long int gl_uint64_t;
-#  define uint64_t gl_uint64_t
-#  define GL_UINT64_T
-# endif
-#endif
-
-/* Avoid collision with Solaris 2.5.1 <pthread.h> etc.  */
-#define _UINT8_T
-#define _UINT32_T
-#define _UINT64_T
-
-
-/* 7.18.1.2. Minimum-width integer types */
-
-/* Here we assume a standard architecture where the hardware integer
-   types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
-   are the same as the corresponding N_t types.  */
-
-#undef int_least8_t
-#undef uint_least8_t
-#undef int_least16_t
-#undef uint_least16_t
-#undef int_least32_t
-#undef uint_least32_t
-#undef int_least64_t
-#undef uint_least64_t
-#define int_least8_t int8_t
-#define uint_least8_t uint8_t
-#define int_least16_t int16_t
-#define uint_least16_t uint16_t
-#define int_least32_t int32_t
-#define uint_least32_t uint32_t
-#ifdef GL_INT64_T
-# define int_least64_t int64_t
-#endif
-#ifdef GL_UINT64_T
-# define uint_least64_t uint64_t
-#endif
-
-/* 7.18.1.3. Fastest minimum-width integer types */
-
-/* Note: Other <stdint.h> substitutes may define these types differently.
-   It is not recommended to use these types in public header files. */
-
-/* Here we assume a standard architecture where the hardware integer
-   types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
-   are taken from the same list of types.  The following code normally
-   uses types consistent with glibc, as that lessens the chance of
-   incompatibility with older GNU hosts.  */
-
-#undef int_fast8_t
-#undef uint_fast8_t
-#undef int_fast16_t
-#undef uint_fast16_t
-#undef int_fast32_t
-#undef uint_fast32_t
-#undef int_fast64_t
-#undef uint_fast64_t
-typedef signed char gl_int_fast8_t;
-typedef unsigned char gl_uint_fast8_t;
-
-#ifdef __sun
-/* Define types compatible with SunOS 5.10, so that code compiled under
-   earlier SunOS versions works with code compiled under SunOS 5.10.  */
-typedef int gl_int_fast32_t;
-typedef unsigned int gl_uint_fast32_t;
-#else
-typedef long int gl_int_fast32_t;
-typedef unsigned long int gl_uint_fast32_t;
-#endif
-typedef gl_int_fast32_t gl_int_fast16_t;
-typedef gl_uint_fast32_t gl_uint_fast16_t;
-
-#define int_fast8_t gl_int_fast8_t
-#define uint_fast8_t gl_uint_fast8_t
-#define int_fast16_t gl_int_fast16_t
-#define uint_fast16_t gl_uint_fast16_t
-#define int_fast32_t gl_int_fast32_t
-#define uint_fast32_t gl_uint_fast32_t
-#ifdef GL_INT64_T
-# define int_fast64_t int64_t
-#endif
-#ifdef GL_UINT64_T
-# define uint_fast64_t uint64_t
-#endif
-
-/* 7.18.1.4. Integer types capable of holding object pointers */
-
-#undef intptr_t
-#undef uintptr_t
-typedef long int gl_intptr_t;
-typedef unsigned long int gl_uintptr_t;
-#define intptr_t gl_intptr_t
-#define uintptr_t gl_uintptr_t
-
-/* 7.18.1.5. Greatest-width integer types */
-
-/* Note: These types are compiler dependent. It may be unwise to use them in
-   public header files. */
-
-/* If the system defines INTMAX_MAX, assume that intmax_t works, and
-   similarly for UINTMAX_MAX and uintmax_t.  This avoids problems with
-   assuming one type where another is used by the system.  */
-
-#ifndef INTMAX_MAX
-# undef INTMAX_C
-# undef intmax_t
-# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
-typedef long long int gl_intmax_t;
-#  define intmax_t gl_intmax_t
-# elif defined GL_INT64_T
-#  define intmax_t int64_t
-# else
-typedef long int gl_intmax_t;
-#  define intmax_t gl_intmax_t
-# endif
-#endif
-
-#ifndef UINTMAX_MAX
-# undef UINTMAX_C
-# undef uintmax_t
-# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
-typedef unsigned long long int gl_uintmax_t;
-#  define uintmax_t gl_uintmax_t
-# elif defined GL_UINT64_T
-#  define uintmax_t uint64_t
-# else
-typedef unsigned long int gl_uintmax_t;
-#  define uintmax_t gl_uintmax_t
-# endif
-#endif
-
-/* Verify that intmax_t and uintmax_t have the same size.  Too much code
-   breaks if this is not the case.  If this check fails, the reason is likely
-   to be found in the autoconf macros.  */
-typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
-                                ? 1 : -1];
-
-#define GNULIB_defined_stdint_types 1
-#endif /* !GNULIB_defined_stdint_types */
-
-/* 7.18.2. Limits of specified-width integer types */
-
-/* 7.18.2.1. Limits of exact-width integer types */
-
-/* Here we assume a standard architecture where the hardware integer
-   types have 8, 16, 32, optionally 64 bits.  */
-
-#undef INT8_MIN
-#undef INT8_MAX
-#undef UINT8_MAX
-#define INT8_MIN  (~ INT8_MAX)
-#define INT8_MAX  127
-#define UINT8_MAX  255
-
-#undef INT16_MIN
-#undef INT16_MAX
-#undef UINT16_MAX
-#define INT16_MIN  (~ INT16_MAX)
-#define INT16_MAX  32767
-#define UINT16_MAX  65535
-
-#undef INT32_MIN
-#undef INT32_MAX
-#undef UINT32_MAX
-#define INT32_MIN  (~ INT32_MAX)
-#define INT32_MAX  2147483647
-#define UINT32_MAX  4294967295U
-
-#if defined GL_INT64_T && ! defined INT64_MAX
-/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0
-   evaluates the latter incorrectly in preprocessor expressions.  */
-# define INT64_MIN  (- INTMAX_C (1) << 63)
-# define INT64_MAX  INTMAX_C (9223372036854775807)
-#endif
-
-#if defined GL_UINT64_T && ! defined UINT64_MAX
-# define UINT64_MAX  UINTMAX_C (18446744073709551615)
-#endif
-
-/* 7.18.2.2. Limits of minimum-width integer types */
-
-/* Here we assume a standard architecture where the hardware integer
-   types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
-   are the same as the corresponding N_t types.  */
-
-#undef INT_LEAST8_MIN
-#undef INT_LEAST8_MAX
-#undef UINT_LEAST8_MAX
-#define INT_LEAST8_MIN  INT8_MIN
-#define INT_LEAST8_MAX  INT8_MAX
-#define UINT_LEAST8_MAX  UINT8_MAX
-
-#undef INT_LEAST16_MIN
-#undef INT_LEAST16_MAX
-#undef UINT_LEAST16_MAX
-#define INT_LEAST16_MIN  INT16_MIN
-#define INT_LEAST16_MAX  INT16_MAX
-#define UINT_LEAST16_MAX  UINT16_MAX
-
-#undef INT_LEAST32_MIN
-#undef INT_LEAST32_MAX
-#undef UINT_LEAST32_MAX
-#define INT_LEAST32_MIN  INT32_MIN
-#define INT_LEAST32_MAX  INT32_MAX
-#define UINT_LEAST32_MAX  UINT32_MAX
-
-#undef INT_LEAST64_MIN
-#undef INT_LEAST64_MAX
-#ifdef GL_INT64_T
-# define INT_LEAST64_MIN  INT64_MIN
-# define INT_LEAST64_MAX  INT64_MAX
-#endif
-
-#undef UINT_LEAST64_MAX
-#ifdef GL_UINT64_T
-# define UINT_LEAST64_MAX  UINT64_MAX
-#endif
-
-/* 7.18.2.3. Limits of fastest minimum-width integer types */
-
-/* Here we assume a standard architecture where the hardware integer
-   types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
-   are taken from the same list of types.  */
-
-#undef INT_FAST8_MIN
-#undef INT_FAST8_MAX
-#undef UINT_FAST8_MAX
-#define INT_FAST8_MIN  SCHAR_MIN
-#define INT_FAST8_MAX  SCHAR_MAX
-#define UINT_FAST8_MAX  UCHAR_MAX
-
-#undef INT_FAST16_MIN
-#undef INT_FAST16_MAX
-#undef UINT_FAST16_MAX
-#define INT_FAST16_MIN  INT_FAST32_MIN
-#define INT_FAST16_MAX  INT_FAST32_MAX
-#define UINT_FAST16_MAX  UINT_FAST32_MAX
-
-#undef INT_FAST32_MIN
-#undef INT_FAST32_MAX
-#undef UINT_FAST32_MAX
-#ifdef __sun
-# define INT_FAST32_MIN  INT_MIN
-# define INT_FAST32_MAX  INT_MAX
-# define UINT_FAST32_MAX  UINT_MAX
-#else
-# define INT_FAST32_MIN  LONG_MIN
-# define INT_FAST32_MAX  LONG_MAX
-# define UINT_FAST32_MAX  ULONG_MAX
-#endif
-
-#undef INT_FAST64_MIN
-#undef INT_FAST64_MAX
-#ifdef GL_INT64_T
-# define INT_FAST64_MIN  INT64_MIN
-# define INT_FAST64_MAX  INT64_MAX
-#endif
-
-#undef UINT_FAST64_MAX
-#ifdef GL_UINT64_T
-# define UINT_FAST64_MAX  UINT64_MAX
-#endif
-
-/* 7.18.2.4. Limits of integer types capable of holding object pointers */
-
-#undef INTPTR_MIN
-#undef INTPTR_MAX
-#undef UINTPTR_MAX
-#define INTPTR_MIN  LONG_MIN
-#define INTPTR_MAX  LONG_MAX
-#define UINTPTR_MAX  ULONG_MAX
-
-/* 7.18.2.5. Limits of greatest-width integer types */
-
-#ifndef INTMAX_MAX
-# undef INTMAX_MIN
-# ifdef INT64_MAX
-#  define INTMAX_MIN  INT64_MIN
-#  define INTMAX_MAX  INT64_MAX
-# else
-#  define INTMAX_MIN  INT32_MIN
-#  define INTMAX_MAX  INT32_MAX
-# endif
-#endif
-
-#ifndef UINTMAX_MAX
-# ifdef UINT64_MAX
-#  define UINTMAX_MAX  UINT64_MAX
-# else
-#  define UINTMAX_MAX  UINT32_MAX
-# endif
-#endif
-
-/* 7.18.3. Limits of other integer types */
-
-/* ptrdiff_t limits */
-#undef PTRDIFF_MIN
-#undef PTRDIFF_MAX
-#if @APPLE_UNIVERSAL_BUILD@
-# ifdef _LP64
-#  define PTRDIFF_MIN  _STDINT_MIN (1, 64, 0l)
-#  define PTRDIFF_MAX  _STDINT_MAX (1, 64, 0l)
-# else
-#  define PTRDIFF_MIN  _STDINT_MIN (1, 32, 0)
-#  define PTRDIFF_MAX  _STDINT_MAX (1, 32, 0)
-# endif
-#else
-# define PTRDIFF_MIN  \
-    _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
-# define PTRDIFF_MAX  \
-    _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
-#endif
-
-/* sig_atomic_t limits */
-#undef SIG_ATOMIC_MIN
-#undef SIG_ATOMIC_MAX
-#define SIG_ATOMIC_MIN  \
-   _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
-                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@)
-
-
-/* size_t limit */
-#undef SIZE_MAX
-#if @APPLE_UNIVERSAL_BUILD@
-# ifdef _LP64
-#  define SIZE_MAX  _STDINT_MAX (0, 64, 0ul)
-# else
-#  define SIZE_MAX  _STDINT_MAX (0, 32, 0ul)
-# endif
-#else
-# define SIZE_MAX  _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
-#endif
-
-/* wchar_t limits */
-/* Get WCHAR_MIN, WCHAR_MAX.
-   This include is not on the top, above, because on OSF/1 4.0 we have a
-   sequence of nested includes
-   <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
-   <stdint.h> and assumes its types are already defined.  */
-#if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX)
-  /* 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>
-# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
-# include <wchar.h>
-# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
-#endif
-#undef WCHAR_MIN
-#undef WCHAR_MAX
-#define WCHAR_MIN  \
-   _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
-#define WCHAR_MAX  \
-   _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
-
-/* wint_t limits */
-#undef WINT_MIN
-#undef WINT_MAX
-#define WINT_MIN  \
-   _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
-#define WINT_MAX  \
-   _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
-
-/* 7.18.4. Macros for integer constants */
-
-/* 7.18.4.1. Macros for minimum-width integer constants */
-/* According to ISO C 99 Technical Corrigendum 1 */
-
-/* Here we assume a standard architecture where the hardware integer
-   types have 8, 16, 32, optionally 64 bits, and int is 32 bits.  */
-
-#undef INT8_C
-#undef UINT8_C
-#define INT8_C(x) x
-#define UINT8_C(x) x
-
-#undef INT16_C
-#undef UINT16_C
-#define INT16_C(x) x
-#define UINT16_C(x) x
-
-#undef INT32_C
-#undef UINT32_C
-#define INT32_C(x) x
-#define UINT32_C(x) x ## U
-
-#undef INT64_C
-#undef UINT64_C
-#if LONG_MAX >> 31 >> 31 == 1
-# define INT64_C(x) x##L
-#elif defined _MSC_VER
-# define INT64_C(x) x##i64
-#elif @HAVE_LONG_LONG_INT@
-# define INT64_C(x) x##LL
-#endif
-#if ULONG_MAX >> 31 >> 31 >> 1 == 1
-# define UINT64_C(x) x##UL
-#elif defined _MSC_VER
-# define UINT64_C(x) x##ui64
-#elif @HAVE_UNSIGNED_LONG_LONG_INT@
-# define UINT64_C(x) x##ULL
-#endif
-
-/* 7.18.4.2. Macros for greatest-width integer constants */
-
-#ifndef INTMAX_C
-# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
-#  define INTMAX_C(x)   x##LL
-# elif defined GL_INT64_T
-#  define INTMAX_C(x)   INT64_C(x)
-# else
-#  define INTMAX_C(x)   x##L
-# endif
-#endif
-
-#ifndef UINTMAX_C
-# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
-#  define UINTMAX_C(x)  x##ULL
-# elif defined GL_UINT64_T
-#  define UINTMAX_C(x)  UINT64_C(x)
-# else
-#  define UINTMAX_C(x)  x##UL
-# endif
-#endif
-
-#endif /* _@GUARD_PREFIX@_STDINT_H */
-#endif /* !(defined __ANDROID__ && ...) */
-#endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */

+ 0 - 1344
gl/stdio.in.h~

@@ -1,1344 +0,0 @@
-/* A GNU-like <stdio.h>.
-
-   Copyright (C) 2004, 2007-2013 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-#if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H
-/* Special invocation convention:
-   - Inside glibc header files.
-   - On OSF/1 5.1 we have a sequence of nested includes
-     <stdio.h> -> <getopt.h> -> <ctype.h> -> <sys/localedef.h> ->
-     <sys/lc_core.h> -> <nl_types.h> -> <mesg.h> -> <stdio.h>.
-     In this situation, the functions are not yet declared, therefore we cannot
-     provide the C++ aliases.  */
-
-#@INCLUDE_NEXT@ @NEXT_STDIO_H@
-
-#else
-/* Normal invocation convention.  */
-
-#ifndef _@GUARD_PREFIX@_STDIO_H
-
-#define _GL_ALREADY_INCLUDING_STDIO_H
-
-/* The include_next requires a split double-inclusion guard.  */
-#@INCLUDE_NEXT@ @NEXT_STDIO_H@
-
-#undef _GL_ALREADY_INCLUDING_STDIO_H
-
-#ifndef _@GUARD_PREFIX@_STDIO_H
-#define _@GUARD_PREFIX@_STDIO_H
-
-/* Get va_list.  Needed on many systems, including glibc 2.8.  */
-#include <stdarg.h>
-
-#include <stddef.h>
-
-/* Get off_t and ssize_t.  Needed on many systems, including glibc 2.8
-   and eglibc 2.11.2.
-   May also define off_t to a 64-bit type on native Windows.  */
-#include <sys/types.h>
-
-/* 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 _GL_ATTRIBUTE_FORMAT 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 _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
-#else
-# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
-#endif
-
-/* _GL_ATTRIBUTE_FORMAT_PRINTF
-   indicates to GCC that the function takes a format string and arguments,
-   where the format string directives are the ones standardized by ISO C99
-   and POSIX.  */
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
-# define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
-   _GL_ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument))
-#else
-# define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
-   _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
-#endif
-
-/* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF,
-   except that it indicates to GCC that the supported format string directives
-   are the ones of the system printf(), rather than the ones standardized by
-   ISO C99 and POSIX.  */
-#define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
-  _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
-
-/* _GL_ATTRIBUTE_FORMAT_SCANF
-   indicates to GCC that the function takes a format string and arguments,
-   where the format string directives are the ones standardized by ISO C99
-   and POSIX.  */
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
-# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
-   _GL_ATTRIBUTE_FORMAT ((__gnu_scanf__, formatstring_parameter, first_argument))
-#else
-# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
-   _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
-#endif
-
-/* _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_SCANF,
-   except that it indicates to GCC that the supported format string directives
-   are the ones of the system scanf(), rather than the ones standardized by
-   ISO C99 and POSIX.  */
-#define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \
-  _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
-
-/* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>.  */
-/* But in any case avoid namespace pollution on glibc systems.  */
-#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \
-    && ! defined __GLIBC__
-# include <unistd.h>
-#endif
-
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
-
-/* The definition of _GL_ARG_NONNULL is copied here.  */
-
-/* The definition of _GL_WARN_ON_USE is copied here.  */
-
-/* Macros for stringification.  */
-#define _GL_STDIO_STRINGIZE(token) #token
-#define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token)
-
-
-#if @GNULIB_DPRINTF@
-# if @REPLACE_DPRINTF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define dprintf rpl_dprintf
-#  endif
-_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...)
-                                _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
-                                _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...));
-# else
-#  if !@HAVE_DPRINTF@
-_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...)
-                                _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
-                                _GL_ARG_NONNULL ((2)));
-#  endif
-_GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...));
-# endif
-_GL_CXXALIASWARN (dprintf);
-#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@
-/* Close STREAM and its underlying file descriptor.  */
-# if @REPLACE_FCLOSE@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define fclose rpl_fclose
-#  endif
-_GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (fclose, int, (FILE *stream));
-# else
-_GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
-# endif
-_GL_CXXALIASWARN (fclose);
-#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_FDOPEN@
-# if @REPLACE_FDOPEN@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef fdopen
-#   define fdopen rpl_fdopen
-#  endif
-_GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode)
-                                  _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
-# else
-_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
-# endif
-_GL_CXXALIASWARN (fdopen);
-#elif defined GNULIB_POSIXCHECK
-# undef fdopen
-/* Assume fdopen is always declared.  */
-_GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - "
-                 "use gnulib module fdopen for portability");
-#endif
-
-#if @GNULIB_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).  */
-# if @REPLACE_FFLUSH@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define fflush rpl_fflush
-#  endif
-_GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream));
-_GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream));
-# else
-_GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream));
-# endif
-_GL_CXXALIASWARN (fflush);
-#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
-
-#if @GNULIB_FGETC@
-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef fgetc
-#   define fgetc rpl_fgetc
-#  endif
-_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (fgetc, int, (FILE *stream));
-# else
-_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream));
-# endif
-_GL_CXXALIASWARN (fgetc);
-#endif
-
-#if @GNULIB_FGETS@
-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef fgets
-#   define fgets rpl_fgets
-#  endif
-_GL_FUNCDECL_RPL (fgets, char *, (char *s, int n, FILE *stream)
-                                 _GL_ARG_NONNULL ((1, 3)));
-_GL_CXXALIAS_RPL (fgets, char *, (char *s, int n, FILE *stream));
-# else
-_GL_CXXALIAS_SYS (fgets, char *, (char *s, int n, FILE *stream));
-# endif
-_GL_CXXALIASWARN (fgets);
-#endif
-
-#if @GNULIB_FOPEN@
-# if @REPLACE_FOPEN@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef fopen
-#   define fopen rpl_fopen
-#  endif
-_GL_FUNCDECL_RPL (fopen, FILE *, (const char *filename, const char *mode)
-                                 _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode));
-# else
-_GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode));
-# endif
-_GL_CXXALIASWARN (fopen);
-#elif defined GNULIB_POSIXCHECK
-# undef fopen
-/* Assume fopen is always declared.  */
-_GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - "
-                 "use gnulib module fopen for portability");
-#endif
-
-#if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
-# if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
-     || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define fprintf rpl_fprintf
-#  endif
-#  define GNULIB_overrides_fprintf 1
-#  if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
-_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
-                                _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
-                                _GL_ARG_NONNULL ((1, 2)));
-#  else
-_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
-                                _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3)
-                                _GL_ARG_NONNULL ((1, 2)));
-#  endif
-_GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...));
-# else
-_GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...));
-# endif
-_GL_CXXALIASWARN (fprintf);
-#endif
-#if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
-# if !GNULIB_overrides_fprintf
-#  undef fprintf
-# endif
-/* 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_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.  */
-# if @REPLACE_FPURGE@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define fpurge rpl_fpurge
-#  endif
-_GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream));
-# else
-#  if !@HAVE_DECL_FPURGE@
-_GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
-#  endif
-_GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream));
-# endif
-_GL_CXXALIASWARN (fpurge);
-#elif defined GNULIB_POSIXCHECK
-# 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_FPUTC@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef fputc
-#   define fputc rpl_fputc
-#  endif
-_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream));
-# else
-_GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream));
-# endif
-_GL_CXXALIASWARN (fputc);
-#endif
-
-#if @GNULIB_FPUTS@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef fputs
-#   define fputs rpl_fputs
-#  endif
-_GL_FUNCDECL_RPL (fputs, int, (const char *string, FILE *stream)
-                              _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream));
-# else
-_GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream));
-# endif
-_GL_CXXALIASWARN (fputs);
-#endif
-
-#if @GNULIB_FREAD@
-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef fread
-#   define fread rpl_fread
-#  endif
-_GL_FUNCDECL_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)
-                                 _GL_ARG_NONNULL ((4)));
-_GL_CXXALIAS_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
-# else
-_GL_CXXALIAS_SYS (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
-# endif
-_GL_CXXALIASWARN (fread);
-#endif
-
-#if @GNULIB_FREOPEN@
-# if @REPLACE_FREOPEN@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef freopen
-#   define freopen rpl_freopen
-#  endif
-_GL_FUNCDECL_RPL (freopen, FILE *,
-                  (const char *filename, const char *mode, FILE *stream)
-                  _GL_ARG_NONNULL ((2, 3)));
-_GL_CXXALIAS_RPL (freopen, FILE *,
-                  (const char *filename, const char *mode, FILE *stream));
-# else
-_GL_CXXALIAS_SYS (freopen, FILE *,
-                  (const char *filename, const char *mode, FILE *stream));
-# endif
-_GL_CXXALIASWARN (freopen);
-#elif defined GNULIB_POSIXCHECK
-# undef freopen
-/* Assume freopen is always declared.  */
-_GL_WARN_ON_USE (freopen,
-                 "freopen on native Windows platforms is not POSIX compliant - "
-                 "use gnulib module freopen for portability");
-#endif
-
-#if @GNULIB_FSCANF@
-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef fscanf
-#   define fscanf rpl_fscanf
-#  endif
-_GL_FUNCDECL_RPL (fscanf, int, (FILE *stream, const char *format, ...)
-                               _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3)
-                               _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (fscanf, int, (FILE *stream, const char *format, ...));
-# else
-_GL_CXXALIAS_SYS (fscanf, int, (FILE *stream, const char *format, ...));
-# endif
-_GL_CXXALIASWARN (fscanf);
-#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.
-   In C++ compilations with GNULIB_NAMESPACE, in order to avoid that
-   fseek gets defined as a macro, it is recommended that the developer
-   uses the fseek module, even if he is not calling the fseek function.
-
-   Most gnulib clients that perform stream operations should fall into
-   category 3.  */
-
-#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@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef fseek
-#   define fseek rpl_fseek
-#  endif
-_GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence)
-                              _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence));
-# else
-_GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence));
-# endif
-_GL_CXXALIASWARN (fseek);
-#endif
-
-#if @GNULIB_FSEEKO@
-# if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES
-#  define _GL_FSEEK_WARN /* Category 3, above.  */
-#  undef fseek
-# endif
-# if @REPLACE_FSEEKO@
-/* Provide an fseeko function that is aware of a preceding fflush(), and which
-   detects pipes.  */
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef fseeko
-#   define fseeko rpl_fseeko
-#  endif
-_GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)
-                               _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
-# else
-#  if ! @HAVE_DECL_FSEEKO@
-_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)
-                               _GL_ARG_NONNULL ((1)));
-#  endif
-_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
-# endif
-_GL_CXXALIASWARN (fseeko);
-#elif defined GNULIB_POSIXCHECK
-# 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
-
-#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
-
-
-/* ftell, ftello.  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@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef ftell
-#   define ftell rpl_ftell
-#  endif
-_GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (ftell, long, (FILE *fp));
-# else
-_GL_CXXALIAS_SYS (ftell, long, (FILE *fp));
-# endif
-_GL_CXXALIASWARN (ftell);
-#endif
-
-#if @GNULIB_FTELLO@
-# if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES
-#  define _GL_FTELL_WARN /* Category 3, above.  */
-#  undef ftell
-# endif
-# if @REPLACE_FTELLO@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef ftello
-#   define ftello rpl_ftello
-#  endif
-_GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp));
-# else
-#  if ! @HAVE_DECL_FTELLO@
-_GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
-#  endif
-_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
-# endif
-_GL_CXXALIASWARN (ftello);
-#elif defined GNULIB_POSIXCHECK
-# 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
-
-#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@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef fwrite
-#   define fwrite rpl_fwrite
-#  endif
-_GL_FUNCDECL_RPL (fwrite, size_t,
-                  (const void *ptr, size_t s, size_t n, FILE *stream)
-                  _GL_ARG_NONNULL ((1, 4)));
-_GL_CXXALIAS_RPL (fwrite, size_t,
-                  (const void *ptr, size_t s, size_t n, FILE *stream));
-# else
-_GL_CXXALIAS_SYS (fwrite, size_t,
-                  (const void *ptr, size_t s, size_t n, FILE *stream));
-
-/* Work around bug 11959 when fortifying glibc 2.4 through 2.15
-   <http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>,
-   which sometimes causes an unwanted diagnostic for fwrite calls.
-   This affects only function declaration attributes under certain
-   versions of gcc and clang, and is not needed for C++.  */
-#  if (0 < __USE_FORTIFY_LEVEL                                          \
-       && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \
-       && 3 < __GNUC__ + (4 <= __GNUC_MINOR__)                          \
-       && !defined __cplusplus)
-#   undef fwrite
-#   undef fwrite_unlocked
-extern size_t __REDIRECT (rpl_fwrite,
-                          (const void *__restrict, size_t, size_t,
-                           FILE *__restrict),
-                          fwrite);
-extern size_t __REDIRECT (rpl_fwrite_unlocked,
-                          (const void *__restrict, size_t, size_t,
-                           FILE *__restrict),
-                          fwrite_unlocked);
-#   define fwrite rpl_fwrite
-#   define fwrite_unlocked rpl_fwrite_unlocked
-#  endif
-# endif
-_GL_CXXALIASWARN (fwrite);
-#endif
-
-#if @GNULIB_GETC@
-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef getc
-#   define getc rpl_fgetc
-#  endif
-_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream));
-# else
-_GL_CXXALIAS_SYS (getc, int, (FILE *stream));
-# endif
-_GL_CXXALIASWARN (getc);
-#endif
-
-#if @GNULIB_GETCHAR@
-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef getchar
-#   define getchar rpl_getchar
-#  endif
-_GL_FUNCDECL_RPL (getchar, int, (void));
-_GL_CXXALIAS_RPL (getchar, int, (void));
-# else
-_GL_CXXALIAS_SYS (getchar, int, (void));
-# endif
-_GL_CXXALIASWARN (getchar);
-#endif
-
-#if @GNULIB_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.  */
-# if @REPLACE_GETDELIM@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef getdelim
-#   define getdelim rpl_getdelim
-#  endif
-_GL_FUNCDECL_RPL (getdelim, ssize_t,
-                  (char **lineptr, size_t *linesize, int delimiter,
-                   FILE *stream)
-                  _GL_ARG_NONNULL ((1, 2, 4)));
-_GL_CXXALIAS_RPL (getdelim, ssize_t,
-                  (char **lineptr, size_t *linesize, int delimiter,
-                   FILE *stream));
-# else
-#  if !@HAVE_DECL_GETDELIM@
-_GL_FUNCDECL_SYS (getdelim, ssize_t,
-                  (char **lineptr, size_t *linesize, int delimiter,
-                   FILE *stream)
-                  _GL_ARG_NONNULL ((1, 2, 4)));
-#  endif
-_GL_CXXALIAS_SYS (getdelim, ssize_t,
-                  (char **lineptr, size_t *linesize, int delimiter,
-                   FILE *stream));
-# endif
-_GL_CXXALIASWARN (getdelim);
-#elif defined GNULIB_POSIXCHECK
-# 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_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.  */
-# if @REPLACE_GETLINE@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef getline
-#   define getline rpl_getline
-#  endif
-_GL_FUNCDECL_RPL (getline, ssize_t,
-                  (char **lineptr, size_t *linesize, FILE *stream)
-                  _GL_ARG_NONNULL ((1, 2, 3)));
-_GL_CXXALIAS_RPL (getline, ssize_t,
-                  (char **lineptr, size_t *linesize, FILE *stream));
-# else
-#  if !@HAVE_DECL_GETLINE@
-_GL_FUNCDECL_SYS (getline, ssize_t,
-                  (char **lineptr, size_t *linesize, FILE *stream)
-                  _GL_ARG_NONNULL ((1, 2, 3)));
-#  endif
-_GL_CXXALIAS_SYS (getline, ssize_t,
-                  (char **lineptr, size_t *linesize, FILE *stream));
-# endif
-# if @HAVE_DECL_GETLINE@
-_GL_CXXALIASWARN (getline);
-# 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
-
-/* It is very rare that the developer ever has full control of stdin,
-   so any use of gets warrants an unconditional warning; besides, C11
-   removed it.  */
-#undef gets
-#if HAVE_RAW_DECL_GETS
-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
-#endif
-
-
-#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
-struct obstack;
-/* Grow an obstack with formatted output.  Return the number of
-   bytes added to OBS.  No trailing nul byte is added, and the
-   object should be closed with obstack_finish before use.  Upon
-   memory allocation error, call obstack_alloc_failed_handler.  Upon
-   other error, return -1.  */
-# if @REPLACE_OBSTACK_PRINTF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define obstack_printf rpl_obstack_printf
-#  endif
-_GL_FUNCDECL_RPL (obstack_printf, int,
-                  (struct obstack *obs, const char *format, ...)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
-                  _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (obstack_printf, int,
-                  (struct obstack *obs, const char *format, ...));
-# else
-#  if !@HAVE_DECL_OBSTACK_PRINTF@
-_GL_FUNCDECL_SYS (obstack_printf, int,
-                  (struct obstack *obs, const char *format, ...)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
-                  _GL_ARG_NONNULL ((1, 2)));
-#  endif
-_GL_CXXALIAS_SYS (obstack_printf, int,
-                  (struct obstack *obs, const char *format, ...));
-# endif
-_GL_CXXALIASWARN (obstack_printf);
-# if @REPLACE_OBSTACK_PRINTF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define obstack_vprintf rpl_obstack_vprintf
-#  endif
-_GL_FUNCDECL_RPL (obstack_vprintf, int,
-                  (struct obstack *obs, const char *format, va_list args)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
-                  _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (obstack_vprintf, int,
-                  (struct obstack *obs, const char *format, va_list args));
-# else
-#  if !@HAVE_DECL_OBSTACK_PRINTF@
-_GL_FUNCDECL_SYS (obstack_vprintf, int,
-                  (struct obstack *obs, const char *format, va_list args)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
-                  _GL_ARG_NONNULL ((1, 2)));
-#  endif
-_GL_CXXALIAS_SYS (obstack_vprintf, int,
-                  (struct obstack *obs, const char *format, va_list args));
-# endif
-_GL_CXXALIASWARN (obstack_vprintf);
-#endif
-
-#if @GNULIB_PCLOSE@
-# if !@HAVE_PCLOSE@
-_GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (pclose, int, (FILE *stream));
-_GL_CXXALIASWARN (pclose);
-#elif defined GNULIB_POSIXCHECK
-# undef pclose
-# if HAVE_RAW_DECL_PCLOSE
-_GL_WARN_ON_USE (pclose, "pclose is unportable - "
-                 "use gnulib module pclose for more portability");
-# endif
-#endif
-
-#if @GNULIB_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.  */
-# if @REPLACE_PERROR@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define perror rpl_perror
-#  endif
-_GL_FUNCDECL_RPL (perror, void, (const char *string));
-_GL_CXXALIAS_RPL (perror, void, (const char *string));
-# else
-_GL_CXXALIAS_SYS (perror, void, (const char *string));
-# endif
-_GL_CXXALIASWARN (perror);
-#elif defined GNULIB_POSIXCHECK
-# 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_POPEN@
-# if @REPLACE_POPEN@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef popen
-#   define popen rpl_popen
-#  endif
-_GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode)
-                                 _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode));
-# else
-#  if !@HAVE_POPEN@
-_GL_FUNCDECL_SYS (popen, FILE *, (const char *cmd, const char *mode)
-                                 _GL_ARG_NONNULL ((1, 2)));
-#  endif
-_GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode));
-# endif
-_GL_CXXALIASWARN (popen);
-#elif defined GNULIB_POSIXCHECK
-# 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_PRINTF_POSIX@ || @GNULIB_PRINTF@
-# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
-     || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
-#  if defined __GNUC__
-#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-/* Don't break __attribute__((format(printf,M,N))).  */
-#    define printf __printf__
-#   endif
-#   if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
-_GL_FUNCDECL_RPL_1 (__printf__, int,
-                    (const char *format, ...)
-                    __asm__ (@ASM_SYMBOL_PREFIX@
-                             _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
-                    _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
-                    _GL_ARG_NONNULL ((1)));
-#   else
-_GL_FUNCDECL_RPL_1 (__printf__, int,
-                    (const char *format, ...)
-                    __asm__ (@ASM_SYMBOL_PREFIX@
-                             _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
-                    _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2)
-                    _GL_ARG_NONNULL ((1)));
-#   endif
-_GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
-#  else
-#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#    define printf rpl_printf
-#   endif
-_GL_FUNCDECL_RPL (printf, int,
-                  (const char *format, ...)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
-                  _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (printf, int, (const char *format, ...));
-#  endif
-#  define GNULIB_overrides_printf 1
-# else
-_GL_CXXALIAS_SYS (printf, int, (const char *format, ...));
-# endif
-_GL_CXXALIASWARN (printf);
-#endif
-#if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
-# if !GNULIB_overrides_printf
-#  undef printf
-# endif
-/* 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_PUTC@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef putc
-#   define putc rpl_fputc
-#  endif
-_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream));
-# else
-_GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream));
-# endif
-_GL_CXXALIASWARN (putc);
-#endif
-
-#if @GNULIB_PUTCHAR@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef putchar
-#   define putchar rpl_putchar
-#  endif
-_GL_FUNCDECL_RPL (putchar, int, (int c));
-_GL_CXXALIAS_RPL (putchar, int, (int c));
-# else
-_GL_CXXALIAS_SYS (putchar, int, (int c));
-# endif
-_GL_CXXALIASWARN (putchar);
-#endif
-
-#if @GNULIB_PUTS@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef puts
-#   define puts rpl_puts
-#  endif
-_GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (puts, int, (const char *string));
-# else
-_GL_CXXALIAS_SYS (puts, int, (const char *string));
-# endif
-_GL_CXXALIASWARN (puts);
-#endif
-
-#if @GNULIB_REMOVE@
-# if @REPLACE_REMOVE@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef remove
-#   define remove rpl_remove
-#  endif
-_GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (remove, int, (const char *name));
-# else
-_GL_CXXALIAS_SYS (remove, int, (const char *name));
-# endif
-_GL_CXXALIASWARN (remove);
-#elif defined GNULIB_POSIXCHECK
-# 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_RENAME@
-# if @REPLACE_RENAME@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef rename
-#   define rename rpl_rename
-#  endif
-_GL_FUNCDECL_RPL (rename, int,
-                  (const char *old_filename, const char *new_filename)
-                  _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (rename, int,
-                  (const char *old_filename, const char *new_filename));
-# else
-_GL_CXXALIAS_SYS (rename, int,
-                  (const char *old_filename, const char *new_filename));
-# endif
-_GL_CXXALIASWARN (rename);
-#elif defined GNULIB_POSIXCHECK
-# 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_RENAMEAT@
-# if @REPLACE_RENAMEAT@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef renameat
-#   define renameat rpl_renameat
-#  endif
-_GL_FUNCDECL_RPL (renameat, int,
-                  (int fd1, char const *file1, int fd2, char const *file2)
-                  _GL_ARG_NONNULL ((2, 4)));
-_GL_CXXALIAS_RPL (renameat, int,
-                  (int fd1, char const *file1, int fd2, char const *file2));
-# else
-#  if !@HAVE_RENAMEAT@
-_GL_FUNCDECL_SYS (renameat, int,
-                  (int fd1, char const *file1, int fd2, char const *file2)
-                  _GL_ARG_NONNULL ((2, 4)));
-#  endif
-_GL_CXXALIAS_SYS (renameat, int,
-                  (int fd1, char const *file1, int fd2, char const *file2));
-# endif
-_GL_CXXALIASWARN (renameat);
-#elif defined GNULIB_POSIXCHECK
-# 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_SCANF@
-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
-#  if defined __GNUC__
-#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#    undef scanf
-/* Don't break __attribute__((format(scanf,M,N))).  */
-#    define scanf __scanf__
-#   endif
-_GL_FUNCDECL_RPL_1 (__scanf__, int,
-                    (const char *format, ...)
-                    __asm__ (@ASM_SYMBOL_PREFIX@
-                             _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf))
-                    _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
-                    _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *format, ...));
-#  else
-#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#    undef scanf
-#    define scanf rpl_scanf
-#   endif
-_GL_FUNCDECL_RPL (scanf, int, (const char *format, ...)
-                              _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
-                              _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (scanf, int, (const char *format, ...));
-#  endif
-# else
-_GL_CXXALIAS_SYS (scanf, int, (const char *format, ...));
-# endif
-_GL_CXXALIASWARN (scanf);
-#endif
-
-#if @GNULIB_SNPRINTF@
-# if @REPLACE_SNPRINTF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define snprintf rpl_snprintf
-#  endif
-_GL_FUNCDECL_RPL (snprintf, int,
-                  (char *str, size_t size, const char *format, ...)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
-                  _GL_ARG_NONNULL ((3)));
-_GL_CXXALIAS_RPL (snprintf, int,
-                  (char *str, size_t size, const char *format, ...));
-# else
-#  if !@HAVE_DECL_SNPRINTF@
-_GL_FUNCDECL_SYS (snprintf, int,
-                  (char *str, size_t size, const char *format, ...)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
-                  _GL_ARG_NONNULL ((3)));
-#  endif
-_GL_CXXALIAS_SYS (snprintf, int,
-                  (char *str, size_t size, const char *format, ...));
-# endif
-_GL_CXXALIASWARN (snprintf);
-#elif defined GNULIB_POSIXCHECK
-# undef snprintf
-# if HAVE_RAW_DECL_SNPRINTF
-_GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
-                 "use gnulib module snprintf for portability");
-# endif
-#endif
-
-/* Some people would argue that all sprintf uses should be warned about
-   (for example, OpenBSD issues a link warning for it),
-   since it 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_SPRINTF_POSIX@
-# if @REPLACE_SPRINTF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define sprintf rpl_sprintf
-#  endif
-_GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...)
-                                _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
-                                _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...));
-# else
-_GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...));
-# endif
-_GL_CXXALIASWARN (sprintf);
-#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_TMPFILE@
-# if @REPLACE_TMPFILE@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define tmpfile rpl_tmpfile
-#  endif
-_GL_FUNCDECL_RPL (tmpfile, FILE *, (void));
-_GL_CXXALIAS_RPL (tmpfile, FILE *, (void));
-# else
-_GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
-# endif
-_GL_CXXALIASWARN (tmpfile);
-#elif defined GNULIB_POSIXCHECK
-# undef tmpfile
-# if HAVE_RAW_DECL_TMPFILE
-_GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - "
-                 "use gnulib module tmpfile for portability");
-# endif
-#endif
-
-#if @GNULIB_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.  */
-# if @REPLACE_VASPRINTF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define asprintf rpl_asprintf
-#  endif
-_GL_FUNCDECL_RPL (asprintf, int,
-                  (char **result, const char *format, ...)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
-                  _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (asprintf, int,
-                  (char **result, const char *format, ...));
-# else
-#  if !@HAVE_VASPRINTF@
-_GL_FUNCDECL_SYS (asprintf, int,
-                  (char **result, const char *format, ...)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
-                  _GL_ARG_NONNULL ((1, 2)));
-#  endif
-_GL_CXXALIAS_SYS (asprintf, int,
-                  (char **result, const char *format, ...));
-# endif
-_GL_CXXALIASWARN (asprintf);
-# if @REPLACE_VASPRINTF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define vasprintf rpl_vasprintf
-#  endif
-_GL_FUNCDECL_RPL (vasprintf, int,
-                  (char **result, const char *format, va_list args)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
-                  _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (vasprintf, int,
-                  (char **result, const char *format, va_list args));
-# else
-#  if !@HAVE_VASPRINTF@
-_GL_FUNCDECL_SYS (vasprintf, int,
-                  (char **result, const char *format, va_list args)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
-                  _GL_ARG_NONNULL ((1, 2)));
-#  endif
-_GL_CXXALIAS_SYS (vasprintf, int,
-                  (char **result, const char *format, va_list args));
-# endif
-_GL_CXXALIASWARN (vasprintf);
-#endif
-
-#if @GNULIB_VDPRINTF@
-# if @REPLACE_VDPRINTF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define vdprintf rpl_vdprintf
-#  endif
-_GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args)
-                                 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
-                                 _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args));
-# else
-#  if !@HAVE_VDPRINTF@
-_GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args)
-                                 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
-                                 _GL_ARG_NONNULL ((2)));
-#  endif
-/* Need to cast, because on Solaris, the third parameter will likely be
-                                                    __va_list args.  */
-_GL_CXXALIAS_SYS_CAST (vdprintf, int,
-                       (int fd, const char *format, va_list args));
-# endif
-_GL_CXXALIASWARN (vdprintf);
-#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_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
-# if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
-     || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define vfprintf rpl_vfprintf
-#  endif
-#  define GNULIB_overrides_vfprintf 1
-#  if @GNULIB_VFPRINTF_POSIX@
-_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
-                                 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
-                                 _GL_ARG_NONNULL ((1, 2)));
-#  else
-_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
-                                 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0)
-                                 _GL_ARG_NONNULL ((1, 2)));
-#  endif
-_GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args));
-# else
-/* Need to cast, because on Solaris, the third parameter is
-                                                      __va_list args
-   and GCC's fixincludes did not change this to __gnuc_va_list.  */
-_GL_CXXALIAS_SYS_CAST (vfprintf, int,
-                       (FILE *fp, const char *format, va_list args));
-# endif
-_GL_CXXALIASWARN (vfprintf);
-#endif
-#if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
-# if !GNULIB_overrides_vfprintf
-#  undef vfprintf
-# endif
-/* 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_VFSCANF@
-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef vfscanf
-#   define vfscanf rpl_vfscanf
-#  endif
-_GL_FUNCDECL_RPL (vfscanf, int,
-                  (FILE *stream, const char *format, va_list args)
-                  _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0)
-                  _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (vfscanf, int,
-                  (FILE *stream, const char *format, va_list args));
-# else
-_GL_CXXALIAS_SYS (vfscanf, int,
-                  (FILE *stream, const char *format, va_list args));
-# endif
-_GL_CXXALIASWARN (vfscanf);
-#endif
-
-#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
-# if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
-     || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define vprintf rpl_vprintf
-#  endif
-#  define GNULIB_overrides_vprintf 1
-#  if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
-_GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
-                                _GL_ATTRIBUTE_FORMAT_PRINTF (1, 0)
-                                _GL_ARG_NONNULL ((1)));
-#  else
-_GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
-                                _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0)
-                                _GL_ARG_NONNULL ((1)));
-#  endif
-_GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args));
-# else
-/* Need to cast, because on Solaris, the second parameter is
-                                                          __va_list args
-   and GCC's fixincludes did not change this to __gnuc_va_list.  */
-_GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args));
-# endif
-_GL_CXXALIASWARN (vprintf);
-#endif
-#if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
-# if !GNULIB_overrides_vprintf
-#  undef vprintf
-# endif
-/* 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_VSCANF@
-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef vscanf
-#   define vscanf rpl_vscanf
-#  endif
-_GL_FUNCDECL_RPL (vscanf, int, (const char *format, va_list args)
-                               _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0)
-                               _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (vscanf, int, (const char *format, va_list args));
-# else
-_GL_CXXALIAS_SYS (vscanf, int, (const char *format, va_list args));
-# endif
-_GL_CXXALIASWARN (vscanf);
-#endif
-
-#if @GNULIB_VSNPRINTF@
-# if @REPLACE_VSNPRINTF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define vsnprintf rpl_vsnprintf
-#  endif
-_GL_FUNCDECL_RPL (vsnprintf, int,
-                  (char *str, size_t size, const char *format, va_list args)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
-                  _GL_ARG_NONNULL ((3)));
-_GL_CXXALIAS_RPL (vsnprintf, int,
-                  (char *str, size_t size, const char *format, va_list args));
-# else
-#  if !@HAVE_DECL_VSNPRINTF@
-_GL_FUNCDECL_SYS (vsnprintf, int,
-                  (char *str, size_t size, const char *format, va_list args)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
-                  _GL_ARG_NONNULL ((3)));
-#  endif
-_GL_CXXALIAS_SYS (vsnprintf, int,
-                  (char *str, size_t size, const char *format, va_list args));
-# endif
-_GL_CXXALIASWARN (vsnprintf);
-#elif defined GNULIB_POSIXCHECK
-# 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_VSPRINTF_POSIX@
-# if @REPLACE_VSPRINTF@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define vsprintf rpl_vsprintf
-#  endif
-_GL_FUNCDECL_RPL (vsprintf, int,
-                  (char *str, const char *format, va_list args)
-                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
-                  _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (vsprintf, int,
-                  (char *str, const char *format, va_list args));
-# else
-/* Need to cast, because on Solaris, the third parameter is
-                                                       __va_list args
-   and GCC's fixincludes did not change this to __gnuc_va_list.  */
-_GL_CXXALIAS_SYS_CAST (vsprintf, int,
-                       (char *str, const char *format, va_list args));
-# endif
-_GL_CXXALIASWARN (vsprintf);
-#elif defined GNULIB_POSIXCHECK
-# 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
-
-#endif /* _@GUARD_PREFIX@_STDIO_H */
-#endif /* _@GUARD_PREFIX@_STDIO_H */
-#endif

+ 0 - 954
gl/stdlib.in.h~

@@ -1,954 +0,0 @@
-/* A GNU-like <stdlib.h>.
-
-   Copyright (C) 1995, 2001-2004, 2006-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-#if defined __need_system_stdlib_h || defined __need_malloc_and_calloc
-/* Special invocation conventions inside some gnulib header files,
-   and inside some glibc header files, respectively.  */
-
-#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
-
-#else
-/* Normal invocation convention.  */
-
-#ifndef _@GUARD_PREFIX@_STDLIB_H
-
-/* The include_next requires a split double-inclusion guard.  */
-#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
-
-#ifndef _@GUARD_PREFIX@_STDLIB_H
-#define _@GUARD_PREFIX@_STDLIB_H
-
-/* NetBSD 5.0 mis-defines NULL.  */
-#include <stddef.h>
-
-/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>.  */
-#if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
-# include <sys/wait.h>
-#endif
-
-/* Solaris declares getloadavg() in <sys/loadavg.h>.  */
-#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
-# include <sys/loadavg.h>
-#endif
-
-/* Native Windows platforms declare mktemp() in <io.h>.  */
-#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
-# include <io.h>
-#endif
-
-#if @GNULIB_RANDOM_R@
-
-/* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
-   from <stdlib.h> if _REENTRANT is defined.  Include it whenever we need
-   'struct random_data'.  */
-# if @HAVE_RANDOM_H@
-#  include <random.h>
-# endif
-
-# if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@
-#  include <stdint.h>
-# endif
-
-# if !@HAVE_STRUCT_RANDOM_DATA@
-/* Define 'struct random_data'.
-   But allow multiple gnulib generated <stdlib.h> replacements to coexist.  */
-#  if !GNULIB_defined_struct_random_data
-struct random_data
-{
-  int32_t *fptr;                /* Front pointer.  */
-  int32_t *rptr;                /* Rear pointer.  */
-  int32_t *state;               /* Array of state values.  */
-  int rand_type;                /* Type of random number generator.  */
-  int rand_deg;                 /* Degree of random number generator.  */
-  int rand_sep;                 /* Distance between front and rear.  */
-  int32_t *end_ptr;             /* Pointer behind state table.  */
-};
-#   define GNULIB_defined_struct_random_data 1
-#  endif
-# endif
-#endif
-
-#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
-/* On Mac OS X 10.3, only <unistd.h> declares mkstemp.  */
-/* On Mac OS X 10.5, only <unistd.h> declares mkstemps.  */
-/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt.  */
-/* But avoid namespace pollution on glibc systems and native Windows.  */
-# include <unistd.h>
-#endif
-
-/* The __attribute__ feature is available in gcc versions 2.5 and later.
-   The attribute __pure__ was added in gcc 2.96.  */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
-# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
-#else
-# define _GL_ATTRIBUTE_PURE /* empty */
-#endif
-
-/* The definition of _Noreturn is copied here.  */
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
-
-/* The definition of _GL_ARG_NONNULL is copied here.  */
-
-/* The definition of _GL_WARN_ON_USE is copied here.  */
-
-
-/* Some systems do not define EXIT_*, despite otherwise supporting C89.  */
-#ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-#endif
-/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
-   with proper operation of xargs.  */
-#ifndef EXIT_FAILURE
-# define EXIT_FAILURE 1
-#elif EXIT_FAILURE != 1
-# undef EXIT_FAILURE
-# define EXIT_FAILURE 1
-#endif
-
-
-#if @GNULIB__EXIT@
-/* Terminate the current process with the given return code, without running
-   the 'atexit' handlers.  */
-# if !@HAVE__EXIT@
-_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
-# endif
-_GL_CXXALIAS_SYS (_Exit, void, (int status));
-_GL_CXXALIASWARN (_Exit);
-#elif defined GNULIB_POSIXCHECK
-# undef _Exit
-# if HAVE_RAW_DECL__EXIT
-_GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
-                 "use gnulib module _Exit for portability");
-# endif
-#endif
-
-
-#if @GNULIB_ATOLL@
-/* Parse a signed decimal integer.
-   Returns the value of the integer.  Errors are not detected.  */
-# if !@HAVE_ATOLL@
-_GL_FUNCDECL_SYS (atoll, long long, (const char *string)
-                                    _GL_ATTRIBUTE_PURE
-                                    _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (atoll, long long, (const char *string));
-_GL_CXXALIASWARN (atoll);
-#elif defined GNULIB_POSIXCHECK
-# undef atoll
-# if HAVE_RAW_DECL_ATOLL
-_GL_WARN_ON_USE (atoll, "atoll is unportable - "
-                 "use gnulib module atoll for portability");
-# endif
-#endif
-
-#if @GNULIB_CALLOC_POSIX@
-# if @REPLACE_CALLOC@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef calloc
-#   define calloc rpl_calloc
-#  endif
-_GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size));
-_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
-# else
-_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
-# endif
-_GL_CXXALIASWARN (calloc);
-#elif defined GNULIB_POSIXCHECK
-# undef calloc
-/* Assume calloc is always declared.  */
-_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
-                 "use gnulib module calloc-posix for portability");
-#endif
-
-#if @GNULIB_CANONICALIZE_FILE_NAME@
-# if @REPLACE_CANONICALIZE_FILE_NAME@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define canonicalize_file_name rpl_canonicalize_file_name
-#  endif
-_GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name)
-                                                  _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
-# else
-#  if !@HAVE_CANONICALIZE_FILE_NAME@
-_GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name)
-                                                  _GL_ARG_NONNULL ((1)));
-#  endif
-_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
-# endif
-_GL_CXXALIASWARN (canonicalize_file_name);
-#elif defined GNULIB_POSIXCHECK
-# undef canonicalize_file_name
-# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
-_GL_WARN_ON_USE (canonicalize_file_name,
-                 "canonicalize_file_name is unportable - "
-                 "use gnulib module canonicalize-lgpl for portability");
-# endif
-#endif
-
-#if @GNULIB_GETLOADAVG@
-/* Store max(NELEM,3) load average numbers in LOADAVG[].
-   The three numbers are the load average of the last 1 minute, the last 5
-   minutes, and the last 15 minutes, respectively.
-   LOADAVG is an array of NELEM numbers.  */
-# if !@HAVE_DECL_GETLOADAVG@
-_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
-                                   _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
-_GL_CXXALIASWARN (getloadavg);
-#elif defined GNULIB_POSIXCHECK
-# undef getloadavg
-# if HAVE_RAW_DECL_GETLOADAVG
-_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
-                 "use gnulib module getloadavg for portability");
-# endif
-#endif
-
-#if @GNULIB_GETSUBOPT@
-/* Assuming *OPTIONP is a comma separated list of elements of the form
-   "token" or "token=value", getsubopt parses the first of these elements.
-   If the first element refers to a "token" that is member of the given
-   NULL-terminated array of tokens:
-     - It replaces the comma with a NUL byte, updates *OPTIONP to point past
-       the first option and the comma, sets *VALUEP to the value of the
-       element (or NULL if it doesn't contain an "=" sign),
-     - It returns the index of the "token" in the given array of tokens.
-   Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
-   For more details see the POSIX:2001 specification.
-   http://www.opengroup.org/susv3xsh/getsubopt.html */
-# if !@HAVE_GETSUBOPT@
-_GL_FUNCDECL_SYS (getsubopt, int,
-                  (char **optionp, char *const *tokens, char **valuep)
-                  _GL_ARG_NONNULL ((1, 2, 3)));
-# endif
-_GL_CXXALIAS_SYS (getsubopt, int,
-                  (char **optionp, char *const *tokens, char **valuep));
-_GL_CXXALIASWARN (getsubopt);
-#elif defined GNULIB_POSIXCHECK
-# undef getsubopt
-# if HAVE_RAW_DECL_GETSUBOPT
-_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
-                 "use gnulib module getsubopt for portability");
-# endif
-#endif
-
-#if @GNULIB_GRANTPT@
-/* Change the ownership and access permission of the slave side of the
-   pseudo-terminal whose master side is specified by FD.  */
-# if !@HAVE_GRANTPT@
-_GL_FUNCDECL_SYS (grantpt, int, (int fd));
-# endif
-_GL_CXXALIAS_SYS (grantpt, int, (int fd));
-_GL_CXXALIASWARN (grantpt);
-#elif defined GNULIB_POSIXCHECK
-# undef grantpt
-# if HAVE_RAW_DECL_GRANTPT
-_GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
-                 "use gnulib module grantpt for portability");
-# endif
-#endif
-
-/* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
-   rely on GNU or POSIX semantics for malloc and realloc (for example,
-   by never specifying a zero size), so it does not need malloc or
-   realloc to be redefined.  */
-#if @GNULIB_MALLOC_POSIX@
-# if @REPLACE_MALLOC@
-#  if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
-        || _GL_USE_STDLIB_ALLOC)
-#   undef malloc
-#   define malloc rpl_malloc
-#  endif
-_GL_FUNCDECL_RPL (malloc, void *, (size_t size));
-_GL_CXXALIAS_RPL (malloc, void *, (size_t size));
-# else
-_GL_CXXALIAS_SYS (malloc, void *, (size_t size));
-# endif
-_GL_CXXALIASWARN (malloc);
-#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
-# undef malloc
-/* Assume malloc is always declared.  */
-_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
-                 "use gnulib module malloc-posix for portability");
-#endif
-
-/* Convert a multibyte character to a wide character.  */
-#if @GNULIB_MBTOWC@
-# if @REPLACE_MBTOWC@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef mbtowc
-#   define mbtowc rpl_mbtowc
-#  endif
-_GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
-_GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
-# else
-_GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
-# endif
-_GL_CXXALIASWARN (mbtowc);
-#endif
-
-#if @GNULIB_MKDTEMP@
-/* Create a unique temporary directory from TEMPLATE.
-   The last six characters of TEMPLATE must be "XXXXXX";
-   they are replaced with a string that makes the directory name unique.
-   Returns TEMPLATE, or a null pointer if it cannot get a unique name.
-   The directory is created mode 700.  */
-# if !@HAVE_MKDTEMP@
-_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
-_GL_CXXALIASWARN (mkdtemp);
-#elif defined GNULIB_POSIXCHECK
-# undef mkdtemp
-# if HAVE_RAW_DECL_MKDTEMP
-_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
-                 "use gnulib module mkdtemp for portability");
-# endif
-#endif
-
-#if @GNULIB_MKOSTEMP@
-/* Create a unique temporary file from TEMPLATE.
-   The last six characters of TEMPLATE must be "XXXXXX";
-   they are replaced with a string that makes the file name unique.
-   The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
-   and O_TEXT, O_BINARY (defined in "binary-io.h").
-   The file is then created, with the specified flags, ensuring it didn't exist
-   before.
-   The file is created read-write (mask at least 0600 & ~umask), but it may be
-   world-readable and world-writable (mask 0666 & ~umask), depending on the
-   implementation.
-   Returns the open file descriptor if successful, otherwise -1 and errno
-   set.  */
-# if !@HAVE_MKOSTEMP@
-_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
-                                 _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
-_GL_CXXALIASWARN (mkostemp);
-#elif defined GNULIB_POSIXCHECK
-# undef mkostemp
-# if HAVE_RAW_DECL_MKOSTEMP
-_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
-                 "use gnulib module mkostemp for portability");
-# endif
-#endif
-
-#if @GNULIB_MKOSTEMPS@
-/* Create a unique temporary file from TEMPLATE.
-   The last six characters of TEMPLATE before a suffix of length
-   SUFFIXLEN must be "XXXXXX";
-   they are replaced with a string that makes the file name unique.
-   The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
-   and O_TEXT, O_BINARY (defined in "binary-io.h").
-   The file is then created, with the specified flags, ensuring it didn't exist
-   before.
-   The file is created read-write (mask at least 0600 & ~umask), but it may be
-   world-readable and world-writable (mask 0666 & ~umask), depending on the
-   implementation.
-   Returns the open file descriptor if successful, otherwise -1 and errno
-   set.  */
-# if !@HAVE_MKOSTEMPS@
-_GL_FUNCDECL_SYS (mkostemps, int,
-                  (char * /*template*/, int /*suffixlen*/, int /*flags*/)
-                  _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (mkostemps, int,
-                  (char * /*template*/, int /*suffixlen*/, int /*flags*/));
-_GL_CXXALIASWARN (mkostemps);
-#elif defined GNULIB_POSIXCHECK
-# undef mkostemps
-# if HAVE_RAW_DECL_MKOSTEMPS
-_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
-                 "use gnulib module mkostemps for portability");
-# endif
-#endif
-
-#if @GNULIB_MKSTEMP@
-/* Create a unique temporary file from TEMPLATE.
-   The last six characters of TEMPLATE must be "XXXXXX";
-   they are replaced with a string that makes the file name unique.
-   The file is then created, ensuring it didn't exist before.
-   The file is created read-write (mask at least 0600 & ~umask), but it may be
-   world-readable and world-writable (mask 0666 & ~umask), depending on the
-   implementation.
-   Returns the open file descriptor if successful, otherwise -1 and errno
-   set.  */
-# if @REPLACE_MKSTEMP@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define mkstemp rpl_mkstemp
-#  endif
-_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
-# else
-#  if ! @HAVE_MKSTEMP@
-_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
-#  endif
-_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
-# endif
-_GL_CXXALIASWARN (mkstemp);
-#elif defined GNULIB_POSIXCHECK
-# undef mkstemp
-# if HAVE_RAW_DECL_MKSTEMP
-_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
-                 "use gnulib module mkstemp for portability");
-# endif
-#endif
-
-#if @GNULIB_MKSTEMPS@
-/* Create a unique temporary file from TEMPLATE.
-   The last six characters of TEMPLATE prior to a suffix of length
-   SUFFIXLEN must be "XXXXXX";
-   they are replaced with a string that makes the file name unique.
-   The file is then created, ensuring it didn't exist before.
-   The file is created read-write (mask at least 0600 & ~umask), but it may be
-   world-readable and world-writable (mask 0666 & ~umask), depending on the
-   implementation.
-   Returns the open file descriptor if successful, otherwise -1 and errno
-   set.  */
-# if !@HAVE_MKSTEMPS@
-_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
-                                 _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
-_GL_CXXALIASWARN (mkstemps);
-#elif defined GNULIB_POSIXCHECK
-# undef mkstemps
-# if HAVE_RAW_DECL_MKSTEMPS
-_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
-                 "use gnulib module mkstemps for portability");
-# endif
-#endif
-
-#if @GNULIB_POSIX_OPENPT@
-/* Return an FD open to the master side of a pseudo-terminal.  Flags should
-   include O_RDWR, and may also include O_NOCTTY.  */
-# if !@HAVE_POSIX_OPENPT@
-_GL_FUNCDECL_SYS (posix_openpt, int, (int flags));
-# endif
-_GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
-_GL_CXXALIASWARN (posix_openpt);
-#elif defined GNULIB_POSIXCHECK
-# undef posix_openpt
-# if HAVE_RAW_DECL_POSIX_OPENPT
-_GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
-                 "use gnulib module posix_openpt for portability");
-# endif
-#endif
-
-#if @GNULIB_PTSNAME@
-/* Return the pathname of the pseudo-terminal slave associated with
-   the master FD is open on, or NULL on errors.  */
-# if @REPLACE_PTSNAME@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef ptsname
-#   define ptsname rpl_ptsname
-#  endif
-_GL_FUNCDECL_RPL (ptsname, char *, (int fd));
-_GL_CXXALIAS_RPL (ptsname, char *, (int fd));
-# else
-#  if !@HAVE_PTSNAME@
-_GL_FUNCDECL_SYS (ptsname, char *, (int fd));
-#  endif
-_GL_CXXALIAS_SYS (ptsname, char *, (int fd));
-# endif
-_GL_CXXALIASWARN (ptsname);
-#elif defined GNULIB_POSIXCHECK
-# undef ptsname
-# if HAVE_RAW_DECL_PTSNAME
-_GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
-                 "use gnulib module ptsname for portability");
-# endif
-#endif
-
-#if @GNULIB_PTSNAME_R@
-/* Set the pathname of the pseudo-terminal slave associated with
-   the master FD is open on and return 0, or set errno and return
-   non-zero on errors.  */
-# if @REPLACE_PTSNAME_R@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef ptsname_r
-#   define ptsname_r rpl_ptsname_r
-#  endif
-_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
-_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
-# else
-#  if !@HAVE_PTSNAME_R@
-_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
-#  endif
-_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
-# endif
-_GL_CXXALIASWARN (ptsname_r);
-#elif defined GNULIB_POSIXCHECK
-# undef ptsname_r
-# if HAVE_RAW_DECL_PTSNAME_R
-_GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
-                 "use gnulib module ptsname_r for portability");
-# endif
-#endif
-
-#if @GNULIB_PUTENV@
-# if @REPLACE_PUTENV@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef putenv
-#   define putenv rpl_putenv
-#  endif
-_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (putenv, int, (char *string));
-# else
-_GL_CXXALIAS_SYS (putenv, int, (char *string));
-# endif
-_GL_CXXALIASWARN (putenv);
-#endif
-
-
-#if @GNULIB_RANDOM_R@
-# if !@HAVE_RANDOM_R@
-#  ifndef RAND_MAX
-#   define RAND_MAX 2147483647
-#  endif
-# endif
-#endif
-
-
-#if @GNULIB_RANDOM@
-# if !@HAVE_RANDOM@
-_GL_FUNCDECL_SYS (random, long, (void));
-# endif
-_GL_CXXALIAS_SYS (random, long, (void));
-_GL_CXXALIASWARN (random);
-#elif defined GNULIB_POSIXCHECK
-# undef random
-# if HAVE_RAW_DECL_RANDOM
-_GL_WARN_ON_USE (random, "random is unportable - "
-                 "use gnulib module random for portability");
-# endif
-#endif
-
-#if @GNULIB_RANDOM@
-# if !@HAVE_RANDOM@
-_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
-# endif
-_GL_CXXALIAS_SYS (srandom, void, (unsigned int seed));
-_GL_CXXALIASWARN (srandom);
-#elif defined GNULIB_POSIXCHECK
-# undef srandom
-# if HAVE_RAW_DECL_SRANDOM
-_GL_WARN_ON_USE (srandom, "srandom is unportable - "
-                 "use gnulib module random for portability");
-# endif
-#endif
-
-#if @GNULIB_RANDOM@
-# if !@HAVE_RANDOM@
-_GL_FUNCDECL_SYS (initstate, char *,
-                  (unsigned int seed, char *buf, size_t buf_size)
-                  _GL_ARG_NONNULL ((2)));
-# endif
-_GL_CXXALIAS_SYS (initstate, char *,
-                  (unsigned int seed, char *buf, size_t buf_size));
-_GL_CXXALIASWARN (initstate);
-#elif defined GNULIB_POSIXCHECK
-# undef initstate
-# if HAVE_RAW_DECL_INITSTATE_R
-_GL_WARN_ON_USE (initstate, "initstate is unportable - "
-                 "use gnulib module random for portability");
-# endif
-#endif
-
-#if @GNULIB_RANDOM@
-# if !@HAVE_RANDOM@
-_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (setstate, char *, (char *arg_state));
-_GL_CXXALIASWARN (setstate);
-#elif defined GNULIB_POSIXCHECK
-# undef setstate
-# if HAVE_RAW_DECL_SETSTATE_R
-_GL_WARN_ON_USE (setstate, "setstate is unportable - "
-                 "use gnulib module random for portability");
-# endif
-#endif
-
-
-#if @GNULIB_RANDOM_R@
-# if @REPLACE_RANDOM_R@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef random_r
-#   define random_r rpl_random_r
-#  endif
-_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result)
-                                 _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
-# else
-#  if !@HAVE_RANDOM_R@
-_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
-                                 _GL_ARG_NONNULL ((1, 2)));
-#  endif
-_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
-# endif
-_GL_CXXALIASWARN (random_r);
-#elif defined GNULIB_POSIXCHECK
-# undef random_r
-# if HAVE_RAW_DECL_RANDOM_R
-_GL_WARN_ON_USE (random_r, "random_r is unportable - "
-                 "use gnulib module random_r for portability");
-# endif
-#endif
-
-#if @GNULIB_RANDOM_R@
-# if @REPLACE_RANDOM_R@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef srandom_r
-#   define srandom_r rpl_srandom_r
-#  endif
-_GL_FUNCDECL_RPL (srandom_r, int,
-                  (unsigned int seed, struct random_data *rand_state)
-                  _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (srandom_r, int,
-                  (unsigned int seed, struct random_data *rand_state));
-# else
-#  if !@HAVE_RANDOM_R@
-_GL_FUNCDECL_SYS (srandom_r, int,
-                  (unsigned int seed, struct random_data *rand_state)
-                  _GL_ARG_NONNULL ((2)));
-#  endif
-_GL_CXXALIAS_SYS (srandom_r, int,
-                  (unsigned int seed, struct random_data *rand_state));
-# endif
-_GL_CXXALIASWARN (srandom_r);
-#elif defined GNULIB_POSIXCHECK
-# undef srandom_r
-# if HAVE_RAW_DECL_SRANDOM_R
-_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
-                 "use gnulib module random_r for portability");
-# endif
-#endif
-
-#if @GNULIB_RANDOM_R@
-# if @REPLACE_RANDOM_R@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef initstate_r
-#   define initstate_r rpl_initstate_r
-#  endif
-_GL_FUNCDECL_RPL (initstate_r, int,
-                  (unsigned int seed, char *buf, size_t buf_size,
-                   struct random_data *rand_state)
-                  _GL_ARG_NONNULL ((2, 4)));
-_GL_CXXALIAS_RPL (initstate_r, int,
-                  (unsigned int seed, char *buf, size_t buf_size,
-                   struct random_data *rand_state));
-# else
-#  if !@HAVE_RANDOM_R@
-_GL_FUNCDECL_SYS (initstate_r, int,
-                  (unsigned int seed, char *buf, size_t buf_size,
-                   struct random_data *rand_state)
-                  _GL_ARG_NONNULL ((2, 4)));
-#  endif
-_GL_CXXALIAS_SYS (initstate_r, int,
-                  (unsigned int seed, char *buf, size_t buf_size,
-                   struct random_data *rand_state));
-# endif
-_GL_CXXALIASWARN (initstate_r);
-#elif defined GNULIB_POSIXCHECK
-# undef initstate_r
-# if HAVE_RAW_DECL_INITSTATE_R
-_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
-                 "use gnulib module random_r for portability");
-# endif
-#endif
-
-#if @GNULIB_RANDOM_R@
-# if @REPLACE_RANDOM_R@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef setstate_r
-#   define setstate_r rpl_setstate_r
-#  endif
-_GL_FUNCDECL_RPL (setstate_r, int,
-                  (char *arg_state, struct random_data *rand_state)
-                  _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (setstate_r, int,
-                  (char *arg_state, struct random_data *rand_state));
-# else
-#  if !@HAVE_RANDOM_R@
-_GL_FUNCDECL_SYS (setstate_r, int,
-                  (char *arg_state, struct random_data *rand_state)
-                  _GL_ARG_NONNULL ((1, 2)));
-#  endif
-_GL_CXXALIAS_SYS (setstate_r, int,
-                  (char *arg_state, struct random_data *rand_state));
-# endif
-_GL_CXXALIASWARN (setstate_r);
-#elif defined GNULIB_POSIXCHECK
-# undef setstate_r
-# if HAVE_RAW_DECL_SETSTATE_R
-_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
-                 "use gnulib module random_r for portability");
-# endif
-#endif
-
-
-#if @GNULIB_REALLOC_POSIX@
-# if @REPLACE_REALLOC@
-#  if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
-        || _GL_USE_STDLIB_ALLOC)
-#   undef realloc
-#   define realloc rpl_realloc
-#  endif
-_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size));
-_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
-# else
-_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
-# endif
-_GL_CXXALIASWARN (realloc);
-#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
-# undef realloc
-/* Assume realloc is always declared.  */
-_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
-                 "use gnulib module realloc-posix for portability");
-#endif
-
-#if @GNULIB_REALPATH@
-# if @REPLACE_REALPATH@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define realpath rpl_realpath
-#  endif
-_GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved)
-                                    _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved));
-# else
-#  if !@HAVE_REALPATH@
-_GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved)
-                                    _GL_ARG_NONNULL ((1)));
-#  endif
-_GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved));
-# endif
-_GL_CXXALIASWARN (realpath);
-#elif defined GNULIB_POSIXCHECK
-# undef realpath
-# if HAVE_RAW_DECL_REALPATH
-_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
-                 "canonicalize or canonicalize-lgpl for portability");
-# endif
-#endif
-
-#if @GNULIB_RPMATCH@
-/* Test a user response to a question.
-   Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear.  */
-# if !@HAVE_RPMATCH@
-_GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
-_GL_CXXALIASWARN (rpmatch);
-#elif defined GNULIB_POSIXCHECK
-# undef rpmatch
-# if HAVE_RAW_DECL_RPMATCH
-_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
-                 "use gnulib module rpmatch for portability");
-# endif
-#endif
-
-#if @GNULIB_SECURE_GETENV@
-/* Look up NAME in the environment, returning 0 in insecure situations.  */
-# if !@HAVE_SECURE_GETENV@
-_GL_FUNCDECL_SYS (secure_getenv, char *,
-                  (char const *name) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name));
-_GL_CXXALIASWARN (secure_getenv);
-#elif defined GNULIB_POSIXCHECK
-# undef secure_getenv
-# if HAVE_RAW_DECL_SECURE_GETENV
-_GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
-                 "use gnulib module secure_getenv for portability");
-# endif
-#endif
-
-#if @GNULIB_SETENV@
-/* Set NAME to VALUE in the environment.
-   If REPLACE is nonzero, overwrite an existing value.  */
-# if @REPLACE_SETENV@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef setenv
-#   define setenv rpl_setenv
-#  endif
-_GL_FUNCDECL_RPL (setenv, int,
-                  (const char *name, const char *value, int replace)
-                  _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (setenv, int,
-                  (const char *name, const char *value, int replace));
-# else
-#  if !@HAVE_DECL_SETENV@
-_GL_FUNCDECL_SYS (setenv, int,
-                  (const char *name, const char *value, int replace)
-                  _GL_ARG_NONNULL ((1)));
-#  endif
-_GL_CXXALIAS_SYS (setenv, int,
-                  (const char *name, const char *value, int replace));
-# endif
-# if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
-_GL_CXXALIASWARN (setenv);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef setenv
-# if HAVE_RAW_DECL_SETENV
-_GL_WARN_ON_USE (setenv, "setenv is unportable - "
-                 "use gnulib module setenv for portability");
-# endif
-#endif
-
-#if @GNULIB_STRTOD@
- /* Parse a double from STRING, updating ENDP if appropriate.  */
-# if @REPLACE_STRTOD@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define strtod rpl_strtod
-#  endif
-_GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp)
-                                  _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp));
-# else
-#  if !@HAVE_STRTOD@
-_GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp)
-                                  _GL_ARG_NONNULL ((1)));
-#  endif
-_GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp));
-# endif
-_GL_CXXALIASWARN (strtod);
-#elif defined GNULIB_POSIXCHECK
-# undef strtod
-# if HAVE_RAW_DECL_STRTOD
-_GL_WARN_ON_USE (strtod, "strtod is unportable - "
-                 "use gnulib module strtod for portability");
-# endif
-#endif
-
-#if @GNULIB_STRTOLL@
-/* Parse a signed integer whose textual representation starts at STRING.
-   The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
-   it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
-   "0x").
-   If ENDPTR is not NULL, the address of the first byte after the integer is
-   stored in *ENDPTR.
-   Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
-   to ERANGE.  */
-# if !@HAVE_STRTOLL@
-_GL_FUNCDECL_SYS (strtoll, long long,
-                  (const char *string, char **endptr, int base)
-                  _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (strtoll, long long,
-                  (const char *string, char **endptr, int base));
-_GL_CXXALIASWARN (strtoll);
-#elif defined GNULIB_POSIXCHECK
-# undef strtoll
-# if HAVE_RAW_DECL_STRTOLL
-_GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
-                 "use gnulib module strtoll for portability");
-# endif
-#endif
-
-#if @GNULIB_STRTOULL@
-/* Parse an unsigned integer whose textual representation starts at STRING.
-   The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
-   it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
-   "0x").
-   If ENDPTR is not NULL, the address of the first byte after the integer is
-   stored in *ENDPTR.
-   Upon overflow, the return value is ULLONG_MAX, and errno is set to
-   ERANGE.  */
-# if !@HAVE_STRTOULL@
-_GL_FUNCDECL_SYS (strtoull, unsigned long long,
-                  (const char *string, char **endptr, int base)
-                  _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (strtoull, unsigned long long,
-                  (const char *string, char **endptr, int base));
-_GL_CXXALIASWARN (strtoull);
-#elif defined GNULIB_POSIXCHECK
-# undef strtoull
-# if HAVE_RAW_DECL_STRTOULL
-_GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
-                 "use gnulib module strtoull for portability");
-# endif
-#endif
-
-#if @GNULIB_UNLOCKPT@
-/* Unlock the slave side of the pseudo-terminal whose master side is specified
-   by FD, so that it can be opened.  */
-# if !@HAVE_UNLOCKPT@
-_GL_FUNCDECL_SYS (unlockpt, int, (int fd));
-# endif
-_GL_CXXALIAS_SYS (unlockpt, int, (int fd));
-_GL_CXXALIASWARN (unlockpt);
-#elif defined GNULIB_POSIXCHECK
-# undef unlockpt
-# if HAVE_RAW_DECL_UNLOCKPT
-_GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
-                 "use gnulib module unlockpt for portability");
-# endif
-#endif
-
-#if @GNULIB_UNSETENV@
-/* Remove the variable NAME from the environment.  */
-# if @REPLACE_UNSETENV@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef unsetenv
-#   define unsetenv rpl_unsetenv
-#  endif
-_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
-# else
-#  if !@HAVE_DECL_UNSETENV@
-_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
-#  endif
-_GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
-# endif
-# if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
-_GL_CXXALIASWARN (unsetenv);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef unsetenv
-# if HAVE_RAW_DECL_UNSETENV
-_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
-                 "use gnulib module unsetenv for portability");
-# endif
-#endif
-
-/* Convert a wide character to a multibyte character.  */
-#if @GNULIB_WCTOMB@
-# if @REPLACE_WCTOMB@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef wctomb
-#   define wctomb rpl_wctomb
-#  endif
-_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc));
-_GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
-# else
-_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
-# endif
-_GL_CXXALIASWARN (wctomb);
-#endif
-
-
-#endif /* _@GUARD_PREFIX@_STDLIB_H */
-#endif /* _@GUARD_PREFIX@_STDLIB_H */
-#endif

+ 0 - 452
gl/str-two-way.h~

@@ -1,452 +0,0 @@
-/* Byte-wise substring search, using the Two-Way algorithm.
-   Copyright (C) 2008-2013 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Written by Eric Blake <ebb9@byu.net>, 2008.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-/* Before including this file, you need to include <config.h> and
-   <string.h>, and define:
-     RESULT_TYPE             A macro that expands to the return type.
-     AVAILABLE(h, h_l, j, n_l)
-                             A macro that returns nonzero if there are
-                             at least N_L bytes left starting at H[J].
-                             H is 'unsigned char *', H_L, J, and N_L
-                             are 'size_t'; H_L is an lvalue.  For
-                             NUL-terminated searches, H_L can be
-                             modified each iteration to avoid having
-                             to compute the end of H up front.
-
-  For case-insensitivity, you may optionally define:
-     CMP_FUNC(p1, p2, l)     A macro that returns 0 iff the first L
-                             characters of P1 and P2 are equal.
-     CANON_ELEMENT(c)        A macro that canonicalizes an element right after
-                             it has been fetched from one of the two strings.
-                             The argument is an 'unsigned char'; the result
-                             must be an 'unsigned char' as well.
-
-  This file undefines the macros documented above, and defines
-  LONG_NEEDLE_THRESHOLD.
-*/
-
-#include <limits.h>
-#include <stdint.h>
-
-/* We use the Two-Way string matching algorithm (also known as
-   Chrochemore-Perrin), which guarantees linear complexity with
-   constant space.  Additionally, for long needles, we also use a bad
-   character shift table similar to the Boyer-Moore algorithm to
-   achieve improved (potentially sub-linear) performance.
-
-   See http://www-igm.univ-mlv.fr/~lecroq/string/node26.html#SECTION00260,
-   http://en.wikipedia.org/wiki/Boyer-Moore_string_search_algorithm,
-   http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.34.6641&rep=rep1&type=pdf
-*/
-
-/* Point at which computing a bad-byte shift table is likely to be
-   worthwhile.  Small needles should not compute a table, since it
-   adds (1 << CHAR_BIT) + NEEDLE_LEN computations of preparation for a
-   speedup no greater than a factor of NEEDLE_LEN.  The larger the
-   needle, the better the potential performance gain.  On the other
-   hand, on non-POSIX systems with CHAR_BIT larger than eight, the
-   memory required for the table is prohibitive.  */
-#if CHAR_BIT < 10
-# define LONG_NEEDLE_THRESHOLD 32U
-#else
-# define LONG_NEEDLE_THRESHOLD SIZE_MAX
-#endif
-
-#ifndef MAX
-# define MAX(a, b) ((a < b) ? (b) : (a))
-#endif
-
-#ifndef CANON_ELEMENT
-# define CANON_ELEMENT(c) c
-#endif
-#ifndef CMP_FUNC
-# define CMP_FUNC memcmp
-#endif
-
-/* Perform a critical factorization of NEEDLE, of length NEEDLE_LEN.
-   Return the index of the first byte in the right half, and set
-   *PERIOD to the global period of the right half.
-
-   The global period of a string is the smallest index (possibly its
-   length) at which all remaining bytes in the string are repetitions
-   of the prefix (the last repetition may be a subset of the prefix).
-
-   When NEEDLE is factored into two halves, a local period is the
-   length of the smallest word that shares a suffix with the left half
-   and shares a prefix with the right half.  All factorizations of a
-   non-empty NEEDLE have a local period of at least 1 and no greater
-   than NEEDLE_LEN.
-
-   A critical factorization has the property that the local period
-   equals the global period.  All strings have at least one critical
-   factorization with the left half smaller than the global period.
-   And while some strings have more than one critical factorization,
-   it is provable that with an ordered alphabet, at least one of the
-   critical factorizations corresponds to a maximal suffix.
-
-   Given an ordered alphabet, a critical factorization can be computed
-   in linear time, with 2 * NEEDLE_LEN comparisons, by computing the
-   shorter of two ordered maximal suffixes.  The ordered maximal
-   suffixes are determined by lexicographic comparison while tracking
-   periodicity.  */
-static size_t
-critical_factorization (const unsigned char *needle, size_t needle_len,
-                        size_t *period)
-{
-  /* Index of last byte of left half, or SIZE_MAX.  */
-  size_t max_suffix, max_suffix_rev;
-  size_t j; /* Index into NEEDLE for current candidate suffix.  */
-  size_t k; /* Offset into current period.  */
-  size_t p; /* Intermediate period.  */
-  unsigned char a, b; /* Current comparison bytes.  */
-
-  /* Special case NEEDLE_LEN of 1 or 2 (all callers already filtered
-     out 0-length needles.  */
-  if (needle_len < 3)
-    {
-      *period = 1;
-      return needle_len - 1;
-    }
-
-  /* Invariants:
-     0 <= j < NEEDLE_LEN - 1
-     -1 <= max_suffix{,_rev} < j (treating SIZE_MAX as if it were signed)
-     min(max_suffix, max_suffix_rev) < global period of NEEDLE
-     1 <= p <= global period of NEEDLE
-     p == global period of the substring NEEDLE[max_suffix{,_rev}+1...j]
-     1 <= k <= p
-  */
-
-  /* Perform lexicographic search.  */
-  max_suffix = SIZE_MAX;
-  j = 0;
-  k = p = 1;
-  while (j + k < needle_len)
-    {
-      a = CANON_ELEMENT (needle[j + k]);
-      b = CANON_ELEMENT (needle[max_suffix + k]);
-      if (a < b)
-        {
-          /* Suffix is smaller, period is entire prefix so far.  */
-          j += k;
-          k = 1;
-          p = j - max_suffix;
-        }
-      else if (a == b)
-        {
-          /* Advance through repetition of the current period.  */
-          if (k != p)
-            ++k;
-          else
-            {
-              j += p;
-              k = 1;
-            }
-        }
-      else /* b < a */
-        {
-          /* Suffix is larger, start over from current location.  */
-          max_suffix = j++;
-          k = p = 1;
-        }
-    }
-  *period = p;
-
-  /* Perform reverse lexicographic search.  */
-  max_suffix_rev = SIZE_MAX;
-  j = 0;
-  k = p = 1;
-  while (j + k < needle_len)
-    {
-      a = CANON_ELEMENT (needle[j + k]);
-      b = CANON_ELEMENT (needle[max_suffix_rev + k]);
-      if (b < a)
-        {
-          /* Suffix is smaller, period is entire prefix so far.  */
-          j += k;
-          k = 1;
-          p = j - max_suffix_rev;
-        }
-      else if (a == b)
-        {
-          /* Advance through repetition of the current period.  */
-          if (k != p)
-            ++k;
-          else
-            {
-              j += p;
-              k = 1;
-            }
-        }
-      else /* a < b */
-        {
-          /* Suffix is larger, start over from current location.  */
-          max_suffix_rev = j++;
-          k = p = 1;
-        }
-    }
-
-  /* Choose the shorter suffix.  Return the index of the first byte of
-     the right half, rather than the last byte of the left half.
-
-     For some examples, 'banana' has two critical factorizations, both
-     exposed by the two lexicographic extreme suffixes of 'anana' and
-     'nana', where both suffixes have a period of 2.  On the other
-     hand, with 'aab' and 'bba', both strings have a single critical
-     factorization of the last byte, with the suffix having a period
-     of 1.  While the maximal lexicographic suffix of 'aab' is 'b',
-     the maximal lexicographic suffix of 'bba' is 'ba', which is not a
-     critical factorization.  Conversely, the maximal reverse
-     lexicographic suffix of 'a' works for 'bba', but not 'ab' for
-     'aab'.  The shorter suffix of the two will always be a critical
-     factorization.  */
-  if (max_suffix_rev + 1 < max_suffix + 1)
-    return max_suffix + 1;
-  *period = p;
-  return max_suffix_rev + 1;
-}
-
-/* Return the first location of non-empty NEEDLE within HAYSTACK, or
-   NULL.  HAYSTACK_LEN is the minimum known length of HAYSTACK.  This
-   method is optimized for NEEDLE_LEN < LONG_NEEDLE_THRESHOLD.
-   Performance is guaranteed to be linear, with an initialization cost
-   of 2 * NEEDLE_LEN comparisons.
-
-   If AVAILABLE does not modify HAYSTACK_LEN (as in memmem), then at
-   most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching.
-   If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 *
-   HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching.  */
-static RETURN_TYPE
-two_way_short_needle (const unsigned char *haystack, size_t haystack_len,
-                      const unsigned char *needle, size_t needle_len)
-{
-  size_t i; /* Index into current byte of NEEDLE.  */
-  size_t j; /* Index into current window of HAYSTACK.  */
-  size_t period; /* The period of the right half of needle.  */
-  size_t suffix; /* The index of the right half of needle.  */
-
-  /* Factor the needle into two halves, such that the left half is
-     smaller than the global period, and the right half is
-     periodic (with a period as large as NEEDLE_LEN - suffix).  */
-  suffix = critical_factorization (needle, needle_len, &period);
-
-  /* Perform the search.  Each iteration compares the right half
-     first.  */
-  if (CMP_FUNC (needle, needle + period, suffix) == 0)
-    {
-      /* Entire needle is periodic; a mismatch in the left half can
-         only advance by the period, so use memory to avoid rescanning
-         known occurrences of the period in the right half.  */
-      size_t memory = 0;
-      j = 0;
-      while (AVAILABLE (haystack, haystack_len, j, needle_len))
-        {
-          /* Scan for matches in right half.  */
-          i = MAX (suffix, memory);
-          while (i < needle_len && (CANON_ELEMENT (needle[i])
-                                    == CANON_ELEMENT (haystack[i + j])))
-            ++i;
-          if (needle_len <= i)
-            {
-              /* Scan for matches in left half.  */
-              i = suffix - 1;
-              while (memory < i + 1 && (CANON_ELEMENT (needle[i])
-                                        == CANON_ELEMENT (haystack[i + j])))
-                --i;
-              if (i + 1 < memory + 1)
-                return (RETURN_TYPE) (haystack + j);
-              /* No match, so remember how many repetitions of period
-                 on the right half were scanned.  */
-              j += period;
-              memory = needle_len - period;
-            }
-          else
-            {
-              j += i - suffix + 1;
-              memory = 0;
-            }
-        }
-    }
-  else
-    {
-      /* The two halves of needle are distinct; no extra memory is
-         required, and any mismatch results in a maximal shift.  */
-      period = MAX (suffix, needle_len - suffix) + 1;
-      j = 0;
-      while (AVAILABLE (haystack, haystack_len, j, needle_len))
-        {
-          /* Scan for matches in right half.  */
-          i = suffix;
-          while (i < needle_len && (CANON_ELEMENT (needle[i])
-                                    == CANON_ELEMENT (haystack[i + j])))
-            ++i;
-          if (needle_len <= i)
-            {
-              /* Scan for matches in left half.  */
-              i = suffix - 1;
-              while (i != SIZE_MAX && (CANON_ELEMENT (needle[i])
-                                       == CANON_ELEMENT (haystack[i + j])))
-                --i;
-              if (i == SIZE_MAX)
-                return (RETURN_TYPE) (haystack + j);
-              j += period;
-            }
-          else
-            j += i - suffix + 1;
-        }
-    }
-  return NULL;
-}
-
-/* Return the first location of non-empty NEEDLE within HAYSTACK, or
-   NULL.  HAYSTACK_LEN is the minimum known length of HAYSTACK.  This
-   method is optimized for LONG_NEEDLE_THRESHOLD <= NEEDLE_LEN.
-   Performance is guaranteed to be linear, with an initialization cost
-   of 3 * NEEDLE_LEN + (1 << CHAR_BIT) operations.
-
-   If AVAILABLE does not modify HAYSTACK_LEN (as in memmem), then at
-   most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching,
-   and sublinear performance O(HAYSTACK_LEN / NEEDLE_LEN) is possible.
-   If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 *
-   HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching, and
-   sublinear performance is not possible.  */
-static RETURN_TYPE
-two_way_long_needle (const unsigned char *haystack, size_t haystack_len,
-                     const unsigned char *needle, size_t needle_len)
-{
-  size_t i; /* Index into current byte of NEEDLE.  */
-  size_t j; /* Index into current window of HAYSTACK.  */
-  size_t period; /* The period of the right half of needle.  */
-  size_t suffix; /* The index of the right half of needle.  */
-  size_t shift_table[1U << CHAR_BIT]; /* See below.  */
-
-  /* Factor the needle into two halves, such that the left half is
-     smaller than the global period, and the right half is
-     periodic (with a period as large as NEEDLE_LEN - suffix).  */
-  suffix = critical_factorization (needle, needle_len, &period);
-
-  /* Populate shift_table.  For each possible byte value c,
-     shift_table[c] is the distance from the last occurrence of c to
-     the end of NEEDLE, or NEEDLE_LEN if c is absent from the NEEDLE.
-     shift_table[NEEDLE[NEEDLE_LEN - 1]] contains the only 0.  */
-  for (i = 0; i < 1U << CHAR_BIT; i++)
-    shift_table[i] = needle_len;
-  for (i = 0; i < needle_len; i++)
-    shift_table[CANON_ELEMENT (needle[i])] = needle_len - i - 1;
-
-  /* Perform the search.  Each iteration compares the right half
-     first.  */
-  if (CMP_FUNC (needle, needle + period, suffix) == 0)
-    {
-      /* Entire needle is periodic; a mismatch in the left half can
-         only advance by the period, so use memory to avoid rescanning
-         known occurrences of the period in the right half.  */
-      size_t memory = 0;
-      size_t shift;
-      j = 0;
-      while (AVAILABLE (haystack, haystack_len, j, needle_len))
-        {
-          /* Check the last byte first; if it does not match, then
-             shift to the next possible match location.  */
-          shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])];
-          if (0 < shift)
-            {
-              if (memory && shift < period)
-                {
-                  /* Since needle is periodic, but the last period has
-                     a byte out of place, there can be no match until
-                     after the mismatch.  */
-                  shift = needle_len - period;
-                }
-              memory = 0;
-              j += shift;
-              continue;
-            }
-          /* Scan for matches in right half.  The last byte has
-             already been matched, by virtue of the shift table.  */
-          i = MAX (suffix, memory);
-          while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
-                                        == CANON_ELEMENT (haystack[i + j])))
-            ++i;
-          if (needle_len - 1 <= i)
-            {
-              /* Scan for matches in left half.  */
-              i = suffix - 1;
-              while (memory < i + 1 && (CANON_ELEMENT (needle[i])
-                                        == CANON_ELEMENT (haystack[i + j])))
-                --i;
-              if (i + 1 < memory + 1)
-                return (RETURN_TYPE) (haystack + j);
-              /* No match, so remember how many repetitions of period
-                 on the right half were scanned.  */
-              j += period;
-              memory = needle_len - period;
-            }
-          else
-            {
-              j += i - suffix + 1;
-              memory = 0;
-            }
-        }
-    }
-  else
-    {
-      /* The two halves of needle are distinct; no extra memory is
-         required, and any mismatch results in a maximal shift.  */
-      size_t shift;
-      period = MAX (suffix, needle_len - suffix) + 1;
-      j = 0;
-      while (AVAILABLE (haystack, haystack_len, j, needle_len))
-        {
-          /* Check the last byte first; if it does not match, then
-             shift to the next possible match location.  */
-          shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])];
-          if (0 < shift)
-            {
-              j += shift;
-              continue;
-            }
-          /* Scan for matches in right half.  The last byte has
-             already been matched, by virtue of the shift table.  */
-          i = suffix;
-          while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
-                                        == CANON_ELEMENT (haystack[i + j])))
-            ++i;
-          if (needle_len - 1 <= i)
-            {
-              /* Scan for matches in left half.  */
-              i = suffix - 1;
-              while (i != SIZE_MAX && (CANON_ELEMENT (needle[i])
-                                       == CANON_ELEMENT (haystack[i + j])))
-                --i;
-              if (i == SIZE_MAX)
-                return (RETURN_TYPE) (haystack + j);
-              j += period;
-            }
-          else
-            j += i - suffix + 1;
-        }
-    }
-  return NULL;
-}
-
-#undef AVAILABLE
-#undef CANON_ELEMENT
-#undef CMP_FUNC
-#undef MAX
-#undef RETURN_TYPE

Некоторые файлы не были показаны из-за большого количества измененных файлов