summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.am3
-rw-r--r--lib/Makefile.gnulib35
-rw-r--r--lib/Makefile.in99
-rw-r--r--lib/dup2.c97
-rw-r--r--lib/math.in.h9
-rw-r--r--lib/stdbool.mini.h99
-rw-r--r--lib/stddef.in.h86
-rw-r--r--lib/stdlib.in.h2
-rw-r--r--lib/string.in.h2
-rw-r--r--lib/unistd.in.h25
-rw-r--r--lib/vasnprintf.c1
11 files changed, 418 insertions, 40 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 24644e3..2c8da9d 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -65,7 +65,7 @@ nobase_nodist_include_HEADERS = \
# AIX >= 5.3 has <stdbool.h>.
# Solaris 10 and some HP-UX 11 versions have <stdbool.h> but it does not
# necessarily work.
-unistring/stdbool.h : $(STDBOOL_H)
+unistring/stdbool.h : $(STDBOOL_H) stdbool.mini.h
@MKDIR_P@ unistring
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -85,6 +85,7 @@ unistring/stdbool.h : $(STDBOOL_H)
BUILT_SOURCES += unistring/stdbool.h
MOSTLYCLEANFILES += unistring/stdbool.h-t
CLEANFILES += unistring/stdbool.h
+EXTRA_DIST += stdbool.mini.h
# Produce an unistring/stdint.h that is not compiler dependent.
# Glibc >= 2 has <stdint.h>.
diff --git a/lib/Makefile.gnulib b/lib/Makefile.gnulib
index b7a5d31..735befa 100644
--- a/lib/Makefile.gnulib
+++ b/lib/Makefile.gnulib
@@ -124,6 +124,15 @@ CLEANFILES += configmake.h configmake.h-t
## end gnulib module configmake
+## begin gnulib module dup2
+
+
+EXTRA_DIST += dup2.c
+
+EXTRA_libunistring_la_SOURCES += dup2.c
+
+## end gnulib module dup2
+
## begin gnulib module errno
BUILT_SOURCES += $(ERRNO_H)
@@ -603,6 +612,29 @@ EXTRA_DIST += stdbool.in.h
## end gnulib module stdbool
+## begin gnulib module stddef
+
+BUILT_SOURCES += $(STDDEF_H)
+
+# We need the following in order to create <stddef.h> when the system
+# doesn't have one that works with the given compiler.
+stddef.h: stddef.in.h
+ rm -f $@-t $@
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
+ -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \
+ -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
+ < $(srcdir)/stddef.in.h; \
+ } > $@-t
+ mv $@-t $@
+MOSTLYCLEANFILES += stddef.h stddef.h-t
+
+EXTRA_DIST += stddef.in.h
+
+## end gnulib module stddef
+
## begin gnulib module stdint
BUILT_SOURCES += $(STDINT_H)
@@ -3003,6 +3035,7 @@ unistd.h: unistd.in.h
-e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \
-e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
-e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \
+ -e 's|@''GNULIB_UNISTD_H_GETOPT''@|$(GNULIB_UNISTD_H_GETOPT)|g' \
-e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \
-e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \
-e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
@@ -3023,6 +3056,7 @@ unistd.h: unistd.in.h
-e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
-e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
-e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \
+ -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \
-e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
-e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
-e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
@@ -3030,6 +3064,7 @@ unistd.h: unistd.in.h
-e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
-e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \
-e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \
+ -e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
< $(srcdir)/unistd.in.h; \
} > $@-t
diff --git a/lib/Makefile.in b/lib/Makefile.in
index a8cc568..e243d6b 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -59,6 +59,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \
$(top_srcdir)/gnulib-m4/alloca.m4 \
$(top_srcdir)/gnulib-m4/codeset.m4 \
+ $(top_srcdir)/gnulib-m4/dup2.m4 \
$(top_srcdir)/gnulib-m4/eealloc.m4 \
$(top_srcdir)/gnulib-m4/environ.m4 \
$(top_srcdir)/gnulib-m4/errno_h.m4 \
@@ -68,6 +69,7 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \
$(top_srcdir)/gnulib-m4/exponentf.m4 \
$(top_srcdir)/gnulib-m4/exponentl.m4 \
$(top_srcdir)/gnulib-m4/extensions.m4 \
+ $(top_srcdir)/gnulib-m4/fcntl_h.m4 \
$(top_srcdir)/gnulib-m4/float_h.m4 \
$(top_srcdir)/gnulib-m4/fpieee.m4 \
$(top_srcdir)/gnulib-m4/frexp.m4 \
@@ -111,8 +113,10 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \
$(top_srcdir)/gnulib-m4/memchr.m4 \
$(top_srcdir)/gnulib-m4/minmax.m4 \
$(top_srcdir)/gnulib-m4/mmap-anon.m4 \
+ $(top_srcdir)/gnulib-m4/mode_t.m4 \
$(top_srcdir)/gnulib-m4/multiarch.m4 \
$(top_srcdir)/gnulib-m4/nocrash.m4 \
+ $(top_srcdir)/gnulib-m4/open.m4 \
$(top_srcdir)/gnulib-m4/printf-frexp.m4 \
$(top_srcdir)/gnulib-m4/printf-frexpl.m4 \
$(top_srcdir)/gnulib-m4/printf.m4 \
@@ -121,6 +125,7 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \
$(top_srcdir)/gnulib-m4/signbit.m4 \
$(top_srcdir)/gnulib-m4/size_max.m4 \
$(top_srcdir)/gnulib-m4/stdbool.m4 \
+ $(top_srcdir)/gnulib-m4/stddef_h.m4 \
$(top_srcdir)/gnulib-m4/stdint.m4 \
$(top_srcdir)/gnulib-m4/stdint_h.m4 \
$(top_srcdir)/gnulib-m4/stdlib_h.m4 \
@@ -730,6 +735,7 @@ EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@
EOVERFLOW_VALUE = @EOVERFLOW_VALUE@
ERRNO_H = @ERRNO_H@
EXEEXT = @EXEEXT@
+FCNTL_H = @FCNTL_H@
FGREP = @FGREP@
FLOAT_H = @FLOAT_H@
GLIBC21 = @GLIBC21@
@@ -797,6 +803,7 @@ GNULIB_MEMPCPY = @GNULIB_MEMPCPY@
GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
+GNULIB_OPEN = @GNULIB_OPEN@
GNULIB_PUTENV = @GNULIB_PUTENV@
GNULIB_RANDOM_R = @GNULIB_RANDOM_R@
GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@
@@ -829,6 +836,7 @@ GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@
GNULIB_TRUNC = @GNULIB_TRUNC@
GNULIB_TRUNCF = @GNULIB_TRUNCF@
GNULIB_TRUNCL = @GNULIB_TRUNCL@
+GNULIB_UNISTD_H_GETOPT = @GNULIB_UNISTD_H_GETOPT@
GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@
GNULIB_UNSETENV = @GNULIB_UNSETENV@
GNULIB_WCRTOMB = @GNULIB_WCRTOMB@
@@ -927,6 +935,7 @@ HAVE_UNISTD_H = @HAVE_UNISTD_H@
HAVE_UNSETENV = @HAVE_UNSETENV@
HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
HAVE_WCHAR_H = @HAVE_WCHAR_H@
+HAVE_WCHAR_T = @HAVE_WCHAR_T@
HAVE_WCRTOMB = @HAVE_WCRTOMB@
HAVE_WCSNRTOMBS = @HAVE_WCSNRTOMBS@
HAVE_WCSRTOMBS = @HAVE_WCSRTOMBS@
@@ -967,10 +976,12 @@ MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NAMESPACING = @NAMESPACING@
NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@
+NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@
NEXT_AS_FIRST_DIRECTIVE_FLOAT_H = @NEXT_AS_FIRST_DIRECTIVE_FLOAT_H@
NEXT_AS_FIRST_DIRECTIVE_ICONV_H = @NEXT_AS_FIRST_DIRECTIVE_ICONV_H@
NEXT_AS_FIRST_DIRECTIVE_LOCALE_H = @NEXT_AS_FIRST_DIRECTIVE_LOCALE_H@
NEXT_AS_FIRST_DIRECTIVE_MATH_H = @NEXT_AS_FIRST_DIRECTIVE_MATH_H@
+NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@
NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@
NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@
NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@
@@ -978,10 +989,12 @@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@
NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@
NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H@
NEXT_ERRNO_H = @NEXT_ERRNO_H@
+NEXT_FCNTL_H = @NEXT_FCNTL_H@
NEXT_FLOAT_H = @NEXT_FLOAT_H@
NEXT_ICONV_H = @NEXT_ICONV_H@
NEXT_LOCALE_H = @NEXT_LOCALE_H@
NEXT_MATH_H = @NEXT_MATH_H@
+NEXT_STDDEF_H = @NEXT_STDDEF_H@
NEXT_STDINT_H = @NEXT_STDINT_H@
NEXT_STDLIB_H = @NEXT_STDLIB_H@
NEXT_STRING_H = @NEXT_STRING_H@
@@ -999,6 +1012,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
@@ -1012,6 +1026,7 @@ REPLACE_CEILF = @REPLACE_CEILF@
REPLACE_CEILL = @REPLACE_CEILL@
REPLACE_CHOWN = @REPLACE_CHOWN@
REPLACE_CLOSE = @REPLACE_CLOSE@
+REPLACE_DUP2 = @REPLACE_DUP2@
REPLACE_FCHDIR = @REPLACE_FCHDIR@
REPLACE_FLOORF = @REPLACE_FLOORF@
REPLACE_FLOORL = @REPLACE_FLOORL@
@@ -1040,6 +1055,8 @@ REPLACE_MEMCHR = @REPLACE_MEMCHR@
REPLACE_MEMMEM = @REPLACE_MEMMEM@
REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
REPLACE_NAN = @REPLACE_NAN@
+REPLACE_NULL = @REPLACE_NULL@
+REPLACE_OPEN = @REPLACE_OPEN@
REPLACE_PUTENV = @REPLACE_PUTENV@
REPLACE_ROUND = @REPLACE_ROUND@
REPLACE_ROUNDF = @REPLACE_ROUNDF@
@@ -1065,10 +1082,12 @@ SHELL = @SHELL@
SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@
SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
STDBOOL_H = @STDBOOL_H@
+STDDEF_H = @STDDEF_H@
STDINT_H = @STDINT_H@
STRIP = @STRIP@
TEXI2DVI = @TEXI2DVI@
UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@
+UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
VERSION = @VERSION@
VOID_UNSETENV = @VOID_UNSETENV@
WCHAR_H = @WCHAR_H@
@@ -1134,26 +1153,26 @@ top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects no-dependencies
# Version information according to Woe32 conventions.
-EXTRA_DIST = alloca.in.h array-mergesort.h c-strcaseeq.h errno.in.h \
- float.in.h fpucw.h frexp.c frexpl.c fseterr.h stdio-impl.h \
- getpagesize.c $(top_srcdir)/build-aux/config.rpath \
- iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h \
- iconv_open-osf.h iconv.in.h iconv_open-aix.gperf \
- iconv_open-hpux.gperf iconv_open-irix.gperf \
- iconv_open-osf.gperf iconv_open.c float+.h isnan.c \
- isnand-nolibm.h isnand.c float+.h isnan.c isnanf-nolibm.h \
- isnanf.c float+.h isnan.c isnanl-nolibm.h isnanl.c \
- $(top_srcdir)/build-aux/link-warning.h config.charset \
+EXTRA_DIST = alloca.in.h array-mergesort.h c-strcaseeq.h dup2.c \
+ errno.in.h float.in.h fpucw.h frexp.c frexpl.c fseterr.h \
+ stdio-impl.h getpagesize.c \
+ $(top_srcdir)/build-aux/config.rpath iconv_open-aix.h \
+ iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h \
+ iconv.in.h iconv_open-aix.gperf iconv_open-hpux.gperf \
+ iconv_open-irix.gperf iconv_open-osf.gperf iconv_open.c \
+ float+.h isnan.c isnand-nolibm.h isnand.c float+.h isnan.c \
+ isnanf-nolibm.h isnanf.c float+.h isnan.c isnanl-nolibm.h \
+ isnanl.c $(top_srcdir)/build-aux/link-warning.h config.charset \
ref-add.sin ref-del.sin localename.h malloc.c malloca.h \
malloca.valgrind math.in.h mbchar.h mbrtowc.c mbsinit.c \
memchr.c memchr.valgrind memcmp2.h memxfrm.h printf-frexp.h \
printf-frexp.c printf-frexpl.h relocatable.c relocatable.h \
float+.h signbitd.c signbitf.c signbitl.c stdbool.in.h \
- stdint.in.h stdlib.in.h streq.h iconveh.h string.in.h \
- unicase.h unicase/cased.h unicase/caseprop.h unictype/bitmap.h \
- unicase/caseprop.h unicase/ignorable.h unictype/bitmap.h \
- unicase/locale-languages.h unicase/locale-languages.gperf \
- unicase/special-casing-table.h \
+ stddef.in.h stdint.in.h stdlib.in.h streq.h iconveh.h \
+ string.in.h unicase.h unicase/cased.h unicase/caseprop.h \
+ unictype/bitmap.h unicase/caseprop.h unicase/ignorable.h \
+ unictype/bitmap.h unicase/locale-languages.h \
+ unicase/locale-languages.gperf unicase/special-casing-table.h \
unicase/special-casing-table.gperf unicase/special-casing.h \
unicase/casefold.h unicase/simple-mapping.h \
unicase/tocasefold.h unicase/simple-mapping.h \
@@ -1360,28 +1379,31 @@ EXTRA_DIST = alloca.in.h array-mergesort.h c-strcaseeq.h errno.in.h \
uniwbrk/u-wordbreaks.h uniwbrk/u-wordbreaks.h \
uniwbrk/u-wordbreaks.h uniwbrk/wbrkprop.h localcharset.h \
uniwidth.h uniwidth/cjk.h wchar.in.h wctype.in.h wcwidth.c \
- stdint.mini.h libunistring.sym declared.sh libunistring.rc
+ stdbool.mini.h stdint.mini.h libunistring.sym declared.sh \
+ libunistring.rc
BUILT_SOURCES = $(ALLOCA_H) configmake.h $(ERRNO_H) $(FLOAT_H) \
$(ICONV_H) iconv_open-aix.h iconv_open-hpux.h \
iconv_open-irix.h iconv_open-osf.h math.h $(STDBOOL_H) \
- $(STDINT_H) stdlib.h string.h unicase/locale-languages.h \
- unicase/special-casing-table.h unictype/pr_byname.h \
- unictype/scripts_byname.h uninorm/composition-table.h unistd.h \
- $(WCHAR_H) $(WCTYPE_H) unistring/stdbool.h unistring/stdint.h \
+ $(STDDEF_H) $(STDINT_H) stdlib.h string.h \
+ unicase/locale-languages.h unicase/special-casing-table.h \
+ unictype/pr_byname.h unictype/scripts_byname.h \
+ uninorm/composition-table.h unistd.h $(WCHAR_H) $(WCTYPE_H) \
+ unistring/stdbool.h unistring/stdint.h \
unistring/localcharset.h unistring/iconveh.h
# We distribute it because declared.sh relies on GNU sed.
MOSTLYCLEANFILES = core *.stackdump core *.stackdump alloca.h \
alloca.h-t errno.h errno.h-t float.h float.h-t iconv.h \
iconv.h-t iconv_open-aix.h-t iconv_open-hpux.h-t \
iconv_open-irix.h-t iconv_open-osf.h-t math.h math.h-t \
- stdbool.h stdbool.h-t stdint.h stdint.h-t stdlib.h stdlib.h-t \
- string.h string.h-t unicase/locale-languages.h-t \
- unicase/special-casing-table.h-t unictype/pr_byname.h-t \
- unictype/scripts_byname.h-t uninorm/composition-table.h-t \
- unistd.h unistd.h-t wchar.h wchar.h-t wctype.h wctype.h-t \
- unistring/stdbool.h-t unistring/stdint.h-t \
- unistring/localcharset.h-t unistring/iconveh.h-t \
- libunistring.sym-t config.h config.h-t $(am__append_4)
+ stdbool.h stdbool.h-t stddef.h stddef.h-t stdint.h stdint.h-t \
+ stdlib.h stdlib.h-t string.h string.h-t \
+ unicase/locale-languages.h-t unicase/special-casing-table.h-t \
+ unictype/pr_byname.h-t unictype/scripts_byname.h-t \
+ uninorm/composition-table.h-t unistd.h unistd.h-t wchar.h \
+ wchar.h-t wctype.h wctype.h-t unistring/stdbool.h-t \
+ unistring/stdint.h-t unistring/localcharset.h-t \
+ unistring/iconveh.h-t libunistring.sym-t config.h config.h-t \
+ $(am__append_4)
CLEANFILES = configmake.h configmake.h-t charset.alias ref-add.sed \
ref-del.sed unistring/stdbool.h unistring/stdint.h \
unistring/localcharset.h unistring/iconveh.h
@@ -1649,7 +1671,7 @@ libunistring_la_SOURCES = c-ctype.h c-ctype.c c-strcase.h \
verify.h xsize.h version.c $(am__append_2)
libunistring_la_LIBADD = $(gl_LTLIBOBJS) $(WOE32_LIBADD)
libunistring_la_DEPENDENCIES = $(gl_LTLIBOBJS) $(WOE32_LIBADD)
-EXTRA_libunistring_la_SOURCES = frexp.c frexpl.c getpagesize.c \
+EXTRA_libunistring_la_SOURCES = dup2.c frexp.c frexpl.c getpagesize.c \
iconv_open.c isnan.c isnand.c isnan.c isnanf.c isnan.c \
isnanl.c malloc.c mbrtowc.c mbsinit.c memchr.c printf-frexp.c \
relocatable.c signbitd.c signbitf.c signbitl.c printf-args.c \
@@ -3819,6 +3841,20 @@ stdbool.h: stdbool.in.h
} > $@-t
mv $@-t $@
+# We need the following in order to create <stddef.h> when the system
+# doesn't have one that works with the given compiler.
+stddef.h: stddef.in.h
+ rm -f $@-t $@
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
+ -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \
+ -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
+ < $(srcdir)/stddef.in.h; \
+ } > $@-t
+ mv $@-t $@
+
# We need the following in order to create <stdint.h> when the system
# doesn't have one that works with the given compiler.
stdint.h: stdint.in.h
@@ -4022,6 +4058,7 @@ unistd.h: unistd.in.h
-e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \
-e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
-e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \
+ -e 's|@''GNULIB_UNISTD_H_GETOPT''@|$(GNULIB_UNISTD_H_GETOPT)|g' \
-e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \
-e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \
-e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
@@ -4042,6 +4079,7 @@ unistd.h: unistd.in.h
-e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
-e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
-e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \
+ -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \
-e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
-e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
-e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
@@ -4049,6 +4087,7 @@ unistd.h: unistd.in.h
-e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
-e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \
-e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \
+ -e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
< $(srcdir)/unistd.in.h; \
} > $@-t
@@ -4132,7 +4171,7 @@ mostlyclean-local: mostlyclean-generic
# AIX >= 5.3 has <stdbool.h>.
# Solaris 10 and some HP-UX 11 versions have <stdbool.h> but it does not
# necessarily work.
-unistring/stdbool.h : $(STDBOOL_H)
+unistring/stdbool.h : $(STDBOOL_H) stdbool.mini.h
@MKDIR_P@ unistring
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
diff --git a/lib/dup2.c b/lib/dup2.c
new file mode 100644
index 0000000..a7d3cfd
--- /dev/null
+++ b/lib/dup2.c
@@ -0,0 +1,97 @@
+/* Duplicate an open file descriptor to a specified file descriptor.
+
+ Copyright (C) 1999, 2004, 2005, 2006, 2007, 2009 Free Software
+ Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* written by Paul Eggert */
+
+#include <config.h>
+
+/* Specification. */
+#include <unistd.h>
+
+#include <errno.h>
+#include <fcntl.h>
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+/* Get declarations of the Win32 API functions. */
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+#endif
+
+#if REPLACE_DUP2
+
+# undef dup2
+
+int
+rpl_dup2 (int fd, int desired_fd)
+{
+ int result;
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+ /* If fd is closed, mingw hangs on dup2 (fd, fd). If fd is open,
+ dup2 (fd, fd) returns 0, but all further attempts to use fd in
+ future dup2 calls will hang. */
+ if (fd == desired_fd)
+ {
+ if ((HANDLE) _get_osfhandle (fd) == INVALID_HANDLE_VALUE)
+ {
+ errno = EBADF;
+ return -1;
+ }
+ return fd;
+ }
+# endif
+ result = dup2 (fd, desired_fd);
+ if (result == 0)
+ result = desired_fd;
+ return result;
+}
+
+#else /* !REPLACE_DUP2 */
+
+/* On older platforms, dup2 did not exist. */
+
+# ifndef F_DUPFD
+static int
+dupfd (int fd, int desired_fd)
+{
+ int duplicated_fd = dup (fd);
+ if (duplicated_fd < 0 || duplicated_fd == desired_fd)
+ return duplicated_fd;
+ else
+ {
+ int r = dupfd (fd, desired_fd);
+ int e = errno;
+ close (duplicated_fd);
+ errno = e;
+ return r;
+ }
+}
+# endif
+
+int
+dup2 (int fd, int desired_fd)
+{
+ if (fd == desired_fd)
+ return fd;
+ close (desired_fd);
+# ifdef F_DUPFD
+ return fcntl (fd, F_DUPFD, desired_fd);
+# else
+ return dupfd (fd, desired_fd);
+# endif
+}
+#endif /* !REPLACE_DUP2 */
diff --git a/lib/math.in.h b/lib/math.in.h
index efca0f0..d494051 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -148,7 +148,8 @@ extern long double ceill (long double x);
#endif
-#if @GNULIB_MATHL@ || !@HAVE_DECL_COSL@
+#if @GNULIB_MATHL@ || (!@HAVE_DECL_COSL@ && !defined cosl)
+# undef cosl
extern long double cosl (long double x);
#endif
#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
@@ -237,7 +238,8 @@ extern long double ldexpl (long double x, int exp);
#endif
-#if @GNULIB_MATHL@ || !@HAVE_DECL_LOGL@
+#if @GNULIB_MATHL@ || (!@HAVE_DECL_LOGL@ && !defined logl)
+# undef logl
extern long double logl (long double x);
#endif
#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
@@ -292,7 +294,8 @@ extern long double roundl (long double x);
#endif
-#if @GNULIB_MATHL@ || !@HAVE_DECL_SINL@
+#if @GNULIB_MATHL@ || (!@HAVE_DECL_SINL@ && !defined sinl)
+# undef sinl
extern long double sinl (long double x);
#endif
#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
diff --git a/lib/stdbool.mini.h b/lib/stdbool.mini.h
new file mode 100644
index 0000000..285f80c
--- /dev/null
+++ b/lib/stdbool.mini.h
@@ -0,0 +1,99 @@
+/* Copyright (C) 2001-2003, 2006-2009 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 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifndef _UNISTRING_STDBOOL_H
+#define _UNISTRING_STDBOOL_H
+
+/* 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'.
+
+ 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 */
+
+/* For the sake of symbolic names in gdb, we 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 if we do
+ this, values of type '_Bool' may 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 we add a negative value to the
+ enum; this ensures that '_Bool' promotes to 'int'. */
+#if defined __cplusplus
+ /* Assume the compiler has 'bool' and '_Bool'. */
+#else
+ /* 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
+#endif
+#define bool _Bool
+
+/* The other macros must be usable in preprocessor directives. */
+#define false 0
+#define true 1
+#define __bool_true_false_are_defined 1
+
+#endif /* _UNISTRING_STDBOOL_H */
diff --git a/lib/stddef.in.h b/lib/stddef.in.h
new file mode 100644
index 0000000..dacc83d
--- /dev/null
+++ b/lib/stddef.in.h
@@ -0,0 +1,86 @@
+/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
+
+ Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* Written by Eric Blake. */
+
+/*
+ * POSIX 2008 <stddef.h> for platforms that have issues.
+ * <http://www.opengroup.org/susv3xbd/stddef.h.html>
+ */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+
+#if defined __need_wchar_t || defined __need_size_t \
+ || defined __need_ptrdiff_t || defined __need_NULL \
+ || defined __need_wint_t
+/* Special invocation convention inside gcc header files. In
+ particular, gcc provides a version of <stddef.h> that blindly
+ redefines NULL even when __need_wint_t was defined, even though
+ wint_t is not normally provided by <stddef.h>. Hence, we must
+ remember if special invocation has ever been used to obtain wint_t,
+ in which case we need to clean up NULL yet again. */
+
+# if !(defined _GL_STDDEF_H && defined _GL_STDDEF_WINT_T)
+# ifdef __need_wint_t
+# undef _GL_STDDEF_H
+# define _GL_STDDEF_WINT_T
+# endif
+# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
+# endif
+
+#else
+/* Normal invocation convention. */
+
+# ifndef _GL_STDDEF_H
+
+/* The include_next requires a split double-inclusion guard. */
+
+# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
+
+# ifndef _GL_STDDEF_H
+# define _GL_STDDEF_H
+
+/* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */
+#if @REPLACE_NULL@
+# undef NULL
+# ifdef __cplusplus
+ /* ISO C++ says that the macro NULL must expand to an integer constant
+ expression, hence '((void *) 0)' is not allowed in C++. */
+# if __GNUG__ >= 3
+ /* GNU C++ has a __null macro that behaves like an integer ('int' or
+ 'long') but has the same size as a pointer. Use that, to avoid
+ warnings. */
+# define NULL __null
+# else
+# define NULL 0L
+# endif
+# else
+# define NULL ((void *) 0)
+# endif
+#endif
+
+/* Some platforms lack wchar_t. */
+#if !@HAVE_WCHAR_T@
+# define wchar_t int
+#endif
+
+# endif /* _GL_STDDEF_H */
+# endif /* _GL_STDDEF_H */
+#endif /* __need_XXX */
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 23325b5..2a62fb7 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -35,6 +35,8 @@
#ifndef _GL_STDLIB_H
#define _GL_STDLIB_H
+/* NetBSD 5.0 mis-defines NULL. */
+#include <stddef.h>
/* Solaris declares getloadavg() in <sys/loadavg.h>. */
#if @GNULIB_GETLOADAVG@ && @HAVE_SYS_LOADAVG_H@
diff --git a/lib/string.in.h b/lib/string.in.h
index fe11425..3540765 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -28,6 +28,8 @@
#ifndef _GL_STRING_H
#define _GL_STRING_H
+/* NetBSD 5.0 mis-defines NULL. */
+#include <stddef.h>
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 2e42c0b..19bf5be 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -29,6 +29,9 @@
#ifndef _GL_UNISTD_H
#define _GL_UNISTD_H
+/* NetBSD 5.0 mis-defines NULL. Also get size_t. */
+#include <stddef.h>
+
/* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */
#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET)
# include <stdio.h>
@@ -43,6 +46,11 @@
# include <sys/types.h>
#endif
+/* Get getopt(), optarg, optind, opterr, optopt. */
+#if @GNULIB_UNISTD_H_GETOPT@
+# include <getopt.h>
+#endif
+
#if @GNULIB_GETHOSTNAME@
/* Get all possible declarations of gethostname(). */
# if @UNISTD_H_HAVE_WINSOCK2_H@
@@ -137,7 +145,7 @@ extern int chown (const char *file, uid_t uid, gid_t gid);
# define close rpl_close
extern int close (int);
# endif
-#elif @UNISTD_H_HAVE_WINSOCK2_H@
+#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
# undef close
# define close close_used_without_requesting_gnulib_module_close
#elif defined GNULIB_POSIXCHECK
@@ -150,10 +158,13 @@ extern int close (int);
#if @GNULIB_DUP2@
-# if !@HAVE_DUP2@
+# if @REPLACE_DUP2@
+# define dup2 rpl_dup2
+# endif
+# if !@HAVE_DUP2@ || @REPLACE_DUP2@
/* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
NEWFD = OLDFD, otherwise close NEWFD first if it is open.
- Return 0 if successful, otherwise -1 and errno set.
+ Return newfd if successful, otherwise -1 and errno set.
See the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/dup2.html>. */
extern int dup2 (int oldfd, int newfd);
@@ -214,7 +225,11 @@ extern int fchdir (int /*fd*/);
# define dup rpl_dup
extern int dup (int);
-# define dup2 rpl_dup2
+
+# if @REPLACE_DUP2@
+# undef dup2
+# endif
+# define dup2 rpl_dup2_fchdir
extern int dup2 (int, int);
# endif
@@ -363,7 +378,6 @@ extern int gethostname(char *name, size_t len);
See <http://www.opengroup.org/susv3xsh/getlogin.html>.
*/
# if !@HAVE_DECL_GETLOGIN_R@
-# include <stddef.h>
extern int getlogin_r (char *name, size_t size);
# endif
#elif defined GNULIB_POSIXCHECK
@@ -524,7 +538,6 @@ extern int link (const char *path1, const char *path2);
See the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/readlink.html>. */
# if !@HAVE_READLINK@
-# include <stddef.h>
extern int readlink (const char *file, char *buf, size_t bufsize);
# endif
#elif defined GNULIB_POSIXCHECK
diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index c620b4c..35db978 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -5476,6 +5476,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
#undef TCHARS_PER_DCHAR
#undef SNPRINTF
#undef USE_SNPRINTF
+#undef DCHAR_SET
#undef DCHAR_CPY
#undef PRINTF_PARSE
#undef DIRECTIVES