summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2011-06-16 18:22:50 +0200
committerAndy Wingo <wingo@pobox.com>2011-06-16 19:47:25 +0200
commit3d458a81c64e4696157b23c7c4c4c150aa4a93b8 (patch)
tree1478fb3a9faaf203f517a8776f54d00884efdef6 /lib
parent0b77014f0c7d53b8bdbc7059c92f526560e1cacd (diff)
downloadguile-3d458a81c64e4696157b23c7c4c4c150aa4a93b8.tar.gz
gnulib update
Added pipe2 and open modules, to get O_CLOEXEC. * libguile/Makefile.am (guile_filter_doc_snarfage$(EXEEXT)): Add gnulib here, in the native build case, for rpl_fflush if needed. foo
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.am765
-rw-r--r--lib/alignof.h2
-rw-r--r--lib/arpa_inet.in.h10
-rw-r--r--lib/binary-io.h52
-rw-r--r--lib/errno.in.h10
-rw-r--r--lib/fclose.c49
-rw-r--r--lib/fcntl.in.h325
-rw-r--r--lib/fflush.c218
-rw-r--r--lib/float.in.h10
-rw-r--r--lib/fpurge.c137
-rw-r--r--lib/freading.c68
-rw-r--r--lib/freading.h53
-rw-r--r--lib/fseek.c30
-rw-r--r--lib/fseeko.c146
-rw-r--r--lib/ftell.c38
-rw-r--r--lib/ftello.c77
-rw-r--r--lib/gai_strerror.c21
-rw-r--r--lib/getsockopt.c3
-rw-r--r--lib/iconv.in.h10
-rw-r--r--lib/locale.in.h10
-rw-r--r--lib/lseek.c62
-rw-r--r--lib/math.in.h10
-rw-r--r--lib/netdb.in.h75
-rw-r--r--lib/netinet_in.in.h10
-rw-r--r--lib/open.c176
-rw-r--r--lib/pipe2.c151
-rw-r--r--lib/sockets.c4
-rw-r--r--lib/stat-time.h14
-rw-r--r--lib/stddef.in.h14
-rw-r--r--lib/stdint.in.h14
-rw-r--r--lib/stdio-impl.h110
-rw-r--r--lib/stdio.in.h48
-rw-r--r--lib/stdlib.in.h13
-rw-r--r--lib/string.in.h14
-rw-r--r--lib/sys_file.in.h10
-rw-r--r--lib/sys_socket.in.h23
-rw-r--r--lib/sys_stat.in.h10
-rw-r--r--lib/sys_time.in.h6
-rw-r--r--lib/sys_uio.in.h25
-rw-r--r--lib/time.in.h4
-rw-r--r--lib/unistd.in.h30
-rw-r--r--lib/verify.h143
-rw-r--r--lib/wchar.in.h10
43 files changed, 2468 insertions, 542 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 217fcf6a4..dfba180a9 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -9,7 +9,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen locale log1p maintainer-makefile malloc-gnu malloca nproc putenv recv recvfrom send sendto setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat trunc verify vsnprintf warnings wchar
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen locale log1p maintainer-makefile malloc-gnu malloca nproc open pipe2 putenv recv recvfrom send sendto setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat trunc verify vsnprintf warnings wchar
AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
@@ -136,14 +136,15 @@ arpa/inet.h: arpa_inet.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON
$(AM_V_at)$(MKDIR_P) arpa
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ 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/@''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 '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
@@ -159,6 +160,12 @@ EXTRA_DIST += arpa_inet.in.h
## end gnulib module arpa_inet
+## begin gnulib module binary-io
+
+libgnu_la_SOURCES += binary-io.h
+
+## end gnulib module binary-io
+
## begin gnulib module bind
@@ -296,7 +303,8 @@ 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|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ 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' \
@@ -328,6 +336,41 @@ EXTRA_libgnu_la_SOURCES += fclose.c
## end gnulib module fclose
+## begin gnulib module fcntl-h
+
+BUILT_SOURCES += fcntl.h
+
+# We need the following in order to create <fcntl.h> when the system
+# doesn't have one that works with the given compiler.
+fcntl.h: fcntl.in.h $(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_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \
+ -e 's/@''GNULIB_FCNTL''@/$(GNULIB_FCNTL)/g' \
+ -e 's/@''GNULIB_NONBLOCKING''@/$(GNULIB_NONBLOCKING)/g' \
+ -e 's/@''GNULIB_OPEN''@/$(GNULIB_OPEN)/g' \
+ -e 's/@''GNULIB_OPENAT''@/$(GNULIB_OPENAT)/g' \
+ -e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \
+ -e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \
+ -e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \
+ -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \
+ -e 's|@''REPLACE_OPENAT''@|$(REPLACE_OPENAT)|g' \
+ -e '/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)/fcntl.in.h; \
+ } > $@-t && \
+ mv $@-t $@
+MOSTLYCLEANFILES += fcntl.h fcntl.h-t
+
+EXTRA_DIST += fcntl.in.h
+
+## end gnulib module fcntl-h
+
## begin gnulib module fd-hook
libgnu_la_SOURCES += fd-hook.c
@@ -336,6 +379,15 @@ EXTRA_DIST += fd-hook.h
## end gnulib module fd-hook
+## begin gnulib module fflush
+
+
+EXTRA_DIST += fflush.c stdio-impl.h
+
+EXTRA_libgnu_la_SOURCES += fflush.c
+
+## end gnulib module fflush
+
## begin gnulib module float
BUILT_SOURCES += $(FLOAT_H)
@@ -346,7 +398,8 @@ 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|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ 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' \
@@ -381,6 +434,23 @@ EXTRA_libgnu_la_SOURCES += floor.c
## end gnulib module floor
+## begin gnulib module fpurge
+
+
+EXTRA_DIST += fpurge.c stdio-impl.h
+
+EXTRA_libgnu_la_SOURCES += fpurge.c
+
+## end gnulib module fpurge
+
+## begin gnulib module freading
+
+libgnu_la_SOURCES += freading.c
+
+EXTRA_DIST += freading.h stdio-impl.h
+
+## end gnulib module freading
+
## begin gnulib module frexp
@@ -390,6 +460,42 @@ EXTRA_libgnu_la_SOURCES += frexp.c
## end gnulib module frexp
+## begin gnulib module fseek
+
+
+EXTRA_DIST += fseek.c
+
+EXTRA_libgnu_la_SOURCES += fseek.c
+
+## end gnulib module fseek
+
+## begin gnulib module fseeko
+
+
+EXTRA_DIST += fseeko.c stdio-impl.h
+
+EXTRA_libgnu_la_SOURCES += fseeko.c
+
+## end gnulib module fseeko
+
+## begin gnulib module ftell
+
+
+EXTRA_DIST += ftell.c
+
+EXTRA_libgnu_la_SOURCES += ftell.c
+
+## end gnulib module ftell
+
+## begin gnulib module ftello
+
+
+EXTRA_DIST += ftello.c stdio-impl.h
+
+EXTRA_libgnu_la_SOURCES += ftello.c
+
+## end gnulib module ftello
+
## begin gnulib module full-read
libgnu_la_SOURCES += full-read.h full-read.c
@@ -516,11 +622,12 @@ if GL_GENERATE_ICONV_H
iconv.h: iconv.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|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ 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_ICONV_H''@|$(NEXT_ICONV_H)|g' \
- -e 's|@''GNULIB_ICONV''@|$(GNULIB_ICONV)|g' \
+ -e 's/@''GNULIB_ICONV''@/$(GNULIB_ICONV)/g' \
-e 's|@''ICONV_CONST''@|$(ICONV_CONST)|g' \
-e 's|@''REPLACE_ICONV''@|$(REPLACE_ICONV)|g' \
-e 's|@''REPLACE_ICONV_OPEN''@|$(REPLACE_ICONV_OPEN)|g' \
@@ -563,21 +670,12 @@ MOSTLYCLEANFILES += iconv_open-aix.h-t iconv_open-hpux.h-t iconv_open-irix.h
MAINTAINERCLEANFILES += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h
EXTRA_DIST += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h
-EXTRA_DIST += iconv_open-aix.gperf iconv_open-hpux.gperf iconv_open-irix.gperf iconv_open-osf.gperf iconv_open-solaris.gperf iconv_open.c
+EXTRA_DIST += iconv.c iconv_close.c iconv_open-aix.gperf iconv_open-hpux.gperf iconv_open-irix.gperf iconv_open-osf.gperf iconv_open-solaris.gperf iconv_open.c
-EXTRA_libgnu_la_SOURCES += iconv_open.c
+EXTRA_libgnu_la_SOURCES += iconv.c iconv_close.c iconv_open.c
## end gnulib module iconv_open
-## begin gnulib module iconv_open-utf
-
-
-EXTRA_DIST += iconv.c iconv_close.c
-
-EXTRA_libgnu_la_SOURCES += iconv.c iconv_close.c
-
-## end gnulib module iconv_open-utf
-
## begin gnulib module inet_ntop
@@ -676,12 +774,13 @@ BUILT_SOURCES += locale.h
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|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ 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_SETLOCALE''@|$(GNULIB_SETLOCALE)|g' \
- -e 's|@''GNULIB_DUPLOCALE''@|$(GNULIB_DUPLOCALE)|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_SETLOCALE''@|$(REPLACE_SETLOCALE)|g' \
@@ -698,6 +797,15 @@ EXTRA_DIST += locale.in.h
## end gnulib module locale
+## begin gnulib module lseek
+
+
+EXTRA_DIST += lseek.c
+
+EXTRA_libgnu_la_SOURCES += lseek.c
+
+## end gnulib module lseek
+
## begin gnulib module lstat
@@ -748,42 +856,43 @@ BUILT_SOURCES += math.h
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|@''INCLUDE_NEXT_AS_FIRST_DIRECTIVE''@|$(INCLUDE_NEXT_AS_FIRST_DIRECTIVE)|g' \
+ 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_ACOSL''@|$(GNULIB_ACOSL)|g' \
- -e 's|@''GNULIB_ASINL''@|$(GNULIB_ASINL)|g' \
- -e 's|@''GNULIB_ATANL''@|$(GNULIB_ATANL)|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_COSL''@|$(GNULIB_COSL)|g' \
- -e 's|@''GNULIB_EXPL''@|$(GNULIB_EXPL)|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_FREXP''@|$(GNULIB_FREXP)|g' \
- -e 's|@''GNULIB_FREXPL''@|$(GNULIB_FREXPL)|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_LDEXPL''@|$(GNULIB_LDEXPL)|g' \
- -e 's|@''GNULIB_LOGB''@|$(GNULIB_LOGB)|g' \
- -e 's|@''GNULIB_LOGL''@|$(GNULIB_LOGL)|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_SINL''@|$(GNULIB_SINL)|g' \
- -e 's|@''GNULIB_SQRTL''@|$(GNULIB_SQRTL)|g' \
- -e 's|@''GNULIB_TANL''@|$(GNULIB_TANL)|g' \
- -e 's|@''GNULIB_TRUNC''@|$(GNULIB_TRUNC)|g' \
- -e 's|@''GNULIB_TRUNCF''@|$(GNULIB_TRUNCF)|g' \
- -e 's|@''GNULIB_TRUNCL''@|$(GNULIB_TRUNCL)|g' \
+ -e 's/@''GNULIB_ACOSL''@/$(GNULIB_ACOSL)/g' \
+ -e 's/@''GNULIB_ASINL''@/$(GNULIB_ASINL)/g' \
+ -e 's/@''GNULIB_ATANL''@/$(GNULIB_ATANL)/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_COSL''@/$(GNULIB_COSL)/g' \
+ -e 's/@''GNULIB_EXPL''@/$(GNULIB_EXPL)/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_FREXP''@/$(GNULIB_FREXP)/g' \
+ -e 's/@''GNULIB_FREXPL''@/$(GNULIB_FREXPL)/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_LDEXPL''@/$(GNULIB_LDEXPL)/g' \
+ -e 's/@''GNULIB_LOGB''@/$(GNULIB_LOGB)/g' \
+ -e 's/@''GNULIB_LOGL''@/$(GNULIB_LOGL)/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_SINL''@/$(GNULIB_SINL)/g' \
+ -e 's/@''GNULIB_SQRTL''@/$(GNULIB_SQRTL)/g' \
+ -e 's/@''GNULIB_TANL''@/$(GNULIB_TANL)/g' \
+ -e 's/@''GNULIB_TRUNC''@/$(GNULIB_TRUNC)/g' \
+ -e 's/@''GNULIB_TRUNCF''@/$(GNULIB_TRUNCF)/g' \
+ -e 's/@''GNULIB_TRUNCL''@/$(GNULIB_TRUNCL)/g' \
< $(srcdir)/math.in.h | \
sed -e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \
-e 's|@''HAVE_ASINL''@|$(HAVE_ASINL)|g' \
@@ -868,20 +977,23 @@ 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 $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+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|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ 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/@''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; \
@@ -904,7 +1016,8 @@ 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|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ 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' \
@@ -931,6 +1044,15 @@ EXTRA_DIST += nproc.h
## end gnulib module nproc
+## begin gnulib module open
+
+
+EXTRA_DIST += open.c
+
+EXTRA_libgnu_la_SOURCES += open.c
+
+## end gnulib module open
+
## begin gnulib module pathmax
@@ -938,6 +1060,12 @@ EXTRA_DIST += pathmax.h
## end gnulib module pathmax
+## begin gnulib module pipe2
+
+libgnu_la_SOURCES += pipe2.c
+
+## end gnulib module pipe2
+
## begin gnulib module putenv
@@ -985,19 +1113,19 @@ EXTRA_libgnu_la_SOURCES += recvfrom.c
## begin gnulib module safe-read
+libgnu_la_SOURCES += safe-read.c
-EXTRA_DIST += safe-read.c safe-read.h
-
-EXTRA_libgnu_la_SOURCES += safe-read.c
+EXTRA_DIST += safe-read.h
## end gnulib module safe-read
## begin gnulib module safe-write
+libgnu_la_SOURCES += safe-write.c
-EXTRA_DIST += safe-read.c safe-write.c safe-write.h
+EXTRA_DIST += safe-read.c safe-write.h
-EXTRA_libgnu_la_SOURCES += safe-read.c safe-write.c
+EXTRA_libgnu_la_SOURCES += safe-read.c
## end gnulib module safe-write
@@ -1118,7 +1246,8 @@ 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|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ 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' \
@@ -1147,7 +1276,8 @@ 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/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
+ 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' \
@@ -1195,62 +1325,63 @@ BUILT_SOURCES += stdio.h
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|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ 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_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_GETS''@|$(GNULIB_GETS)|g' \
- -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \
- -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \
- -e 's|@''GNULIB_PERROR''@|$(GNULIB_PERROR)|g' \
- -e 's|@''GNULIB_POPEN''@|$(GNULIB_POPEN)|g' \
- -e 's|@''GNULIB_PRINTF''@|$(GNULIB_PRINTF)|g' \
- -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \
- -e 's|@''GNULIB_PUTC''@|$(GNULIB_PUTC)|g' \
- -e 's|@''GNULIB_PUTCHAR''@|$(GNULIB_PUTCHAR)|g' \
- -e 's|@''GNULIB_PUTS''@|$(GNULIB_PUTS)|g' \
- -e 's|@''GNULIB_REMOVE''@|$(GNULIB_REMOVE)|g' \
- -e 's|@''GNULIB_RENAME''@|$(GNULIB_RENAME)|g' \
- -e 's|@''GNULIB_RENAMEAT''@|$(GNULIB_RENAMEAT)|g' \
- -e 's|@''GNULIB_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' \
+ -e 's/@''GNULIB_DPRINTF''@/$(GNULIB_DPRINTF)/g' \
+ -e 's/@''GNULIB_FCLOSE''@/$(GNULIB_FCLOSE)/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_GETS''@/$(GNULIB_GETS)/g' \
+ -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GNULIB_OBSTACK_PRINTF)/g' \
+ -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GNULIB_OBSTACK_PRINTF_POSIX)/g' \
+ -e 's/@''GNULIB_PERROR''@/$(GNULIB_PERROR)/g' \
+ -e 's/@''GNULIB_POPEN''@/$(GNULIB_POPEN)/g' \
+ -e 's/@''GNULIB_PRINTF''@/$(GNULIB_PRINTF)/g' \
+ -e 's/@''GNULIB_PRINTF_POSIX''@/$(GNULIB_PRINTF_POSIX)/g' \
+ -e 's/@''GNULIB_PUTC''@/$(GNULIB_PUTC)/g' \
+ -e 's/@''GNULIB_PUTCHAR''@/$(GNULIB_PUTCHAR)/g' \
+ -e 's/@''GNULIB_PUTS''@/$(GNULIB_PUTS)/g' \
+ -e 's/@''GNULIB_REMOVE''@/$(GNULIB_REMOVE)/g' \
+ -e 's/@''GNULIB_RENAME''@/$(GNULIB_RENAME)/g' \
+ -e 's/@''GNULIB_RENAMEAT''@/$(GNULIB_RENAMEAT)/g' \
+ -e 's/@''GNULIB_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' \
@@ -1318,38 +1449,39 @@ BUILT_SOURCES += stdlib.h
stdlib.h: stdlib.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|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ 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_PTSNAME''@|$(GNULIB_PTSNAME)|g' \
- -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \
- -e 's|@''GNULIB_RANDOM_R''@|$(GNULIB_RANDOM_R)|g' \
- -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \
- -e 's|@''GNULIB_REALPATH''@|$(GNULIB_REALPATH)|g' \
- -e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \
- -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \
- -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \
- -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' \
+ -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_PTSNAME''@/$(GNULIB_PTSNAME)/g' \
+ -e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \
+ -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \
+ -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \
+ -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \
+ -e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \
+ -e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \
+ -e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \
+ -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' \
@@ -1400,10 +1532,9 @@ EXTRA_DIST += stdlib.in.h
## begin gnulib module strftime
+libgnu_la_SOURCES += strftime.c
-EXTRA_DIST += strftime.c strftime.h
-
-EXTRA_libgnu_la_SOURCES += strftime.c
+EXTRA_DIST += strftime.h
## end gnulib module strftime
@@ -1427,45 +1558,46 @@ BUILT_SOURCES += string.h
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|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ 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_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' \
+ -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_MBSLEN''@|$(HAVE_MBSLEN)|g' \
-e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \
@@ -1523,7 +1655,8 @@ sys/file.h: sys_file.in.h $(top_builddir)/config.status $(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/@''HAVE_SYS_FILE_H''@/$(HAVE_SYS_FILE_H)/g' \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's/@''HAVE_SYS_FILE_H''@/$(HAVE_SYS_FILE_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' \
@@ -1551,27 +1684,28 @@ sys/socket.h: sys_socket.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_
$(AM_V_at)$(MKDIR_P) sys
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ 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/@''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' \
@@ -1601,22 +1735,23 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
$(AM_V_at)$(MKDIR_P) sys
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ 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_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
- -e 's|@''GNULIB_FCHMODAT''@|$(GNULIB_FCHMODAT)|g' \
- -e 's|@''GNULIB_FSTATAT''@|$(GNULIB_FSTATAT)|g' \
- -e 's|@''GNULIB_FUTIMENS''@|$(GNULIB_FUTIMENS)|g' \
- -e 's|@''GNULIB_LCHMOD''@|$(GNULIB_LCHMOD)|g' \
- -e 's|@''GNULIB_LSTAT''@|$(GNULIB_LSTAT)|g' \
- -e 's|@''GNULIB_MKDIRAT''@|$(GNULIB_MKDIRAT)|g' \
- -e 's|@''GNULIB_MKFIFO''@|$(GNULIB_MKFIFO)|g' \
- -e 's|@''GNULIB_MKFIFOAT''@|$(GNULIB_MKFIFOAT)|g' \
- -e 's|@''GNULIB_MKNOD''@|$(GNULIB_MKNOD)|g' \
- -e 's|@''GNULIB_MKNODAT''@|$(GNULIB_MKNODAT)|g' \
- -e 's|@''GNULIB_STAT''@|$(GNULIB_STAT)|g' \
- -e 's|@''GNULIB_UTIMENSAT''@|$(GNULIB_UTIMENSAT)|g' \
+ -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \
+ -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \
+ -e 's/@''GNULIB_FUTIMENS''@/$(GNULIB_FUTIMENS)/g' \
+ -e 's/@''GNULIB_LCHMOD''@/$(GNULIB_LCHMOD)/g' \
+ -e 's/@''GNULIB_LSTAT''@/$(GNULIB_LSTAT)/g' \
+ -e 's/@''GNULIB_MKDIRAT''@/$(GNULIB_MKDIRAT)/g' \
+ -e 's/@''GNULIB_MKFIFO''@/$(GNULIB_MKFIFO)/g' \
+ -e 's/@''GNULIB_MKFIFOAT''@/$(GNULIB_MKFIFOAT)/g' \
+ -e 's/@''GNULIB_MKNOD''@/$(GNULIB_MKNOD)/g' \
+ -e 's/@''GNULIB_MKNODAT''@/$(GNULIB_MKNODAT)/g' \
+ -e 's/@''GNULIB_STAT''@/$(GNULIB_STAT)/g' \
+ -e 's/@''GNULIB_UTIMENSAT''@/$(GNULIB_UTIMENSAT)/g' \
-e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \
-e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \
-e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \
@@ -1660,7 +1795,8 @@ sys/time.h: sys_time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
$(AM_V_at)$(MKDIR_P) sys
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \
+ 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' \
@@ -1691,7 +1827,8 @@ 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|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ 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' \
@@ -1715,15 +1852,16 @@ BUILT_SOURCES += time.h
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|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ 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_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/@''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' \
@@ -1774,54 +1912,56 @@ BUILT_SOURCES += unistd.h
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|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
+ 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|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \
- -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \
- -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \
- -e 's|@''GNULIB_DUP3''@|$(GNULIB_DUP3)|g' \
- -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \
- -e 's|@''GNULIB_EUIDACCESS''@|$(GNULIB_EUIDACCESS)|g' \
- -e 's|@''GNULIB_FACCESSAT''@|$(GNULIB_FACCESSAT)|g' \
- -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \
- -e 's|@''GNULIB_FCHOWNAT''@|$(GNULIB_FCHOWNAT)|g' \
- -e 's|@''GNULIB_FSYNC''@|$(GNULIB_FSYNC)|g' \
- -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \
- -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \
- -e 's|@''GNULIB_GETDOMAINNAME''@|$(GNULIB_GETDOMAINNAME)|g' \
- -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \
- -e 's|@''GNULIB_GETGROUPS''@|$(GNULIB_GETGROUPS)|g' \
- -e 's|@''GNULIB_GETHOSTNAME''@|$(GNULIB_GETHOSTNAME)|g' \
- -e 's|@''GNULIB_GETLOGIN''@|$(GNULIB_GETLOGIN)|g' \
- -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
- -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \
- -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \
- -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \
- -e 's|@''GNULIB_LINK''@|$(GNULIB_LINK)|g' \
- -e 's|@''GNULIB_LINKAT''@|$(GNULIB_LINKAT)|g' \
- -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \
- -e 's|@''GNULIB_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_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''@|$(GNULIB_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' \
+ -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \
+ -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \
+ -e 's/@''GNULIB_DUP2''@/$(GNULIB_DUP2)/g' \
+ -e 's/@''GNULIB_DUP3''@/$(GNULIB_DUP3)/g' \
+ -e 's/@''GNULIB_ENVIRON''@/$(GNULIB_ENVIRON)/g' \
+ -e 's/@''GNULIB_EUIDACCESS''@/$(GNULIB_EUIDACCESS)/g' \
+ -e 's/@''GNULIB_FACCESSAT''@/$(GNULIB_FACCESSAT)/g' \
+ -e 's/@''GNULIB_FCHDIR''@/$(GNULIB_FCHDIR)/g' \
+ -e 's/@''GNULIB_FCHOWNAT''@/$(GNULIB_FCHOWNAT)/g' \
+ -e 's/@''GNULIB_FSYNC''@/$(GNULIB_FSYNC)/g' \
+ -e 's/@''GNULIB_FTRUNCATE''@/$(GNULIB_FTRUNCATE)/g' \
+ -e 's/@''GNULIB_GETCWD''@/$(GNULIB_GETCWD)/g' \
+ -e 's/@''GNULIB_GETDOMAINNAME''@/$(GNULIB_GETDOMAINNAME)/g' \
+ -e 's/@''GNULIB_GETDTABLESIZE''@/$(GNULIB_GETDTABLESIZE)/g' \
+ -e 's/@''GNULIB_GETGROUPS''@/$(GNULIB_GETGROUPS)/g' \
+ -e 's/@''GNULIB_GETHOSTNAME''@/$(GNULIB_GETHOSTNAME)/g' \
+ -e 's/@''GNULIB_GETLOGIN''@/$(GNULIB_GETLOGIN)/g' \
+ -e 's/@''GNULIB_GETLOGIN_R''@/$(GNULIB_GETLOGIN_R)/g' \
+ -e 's/@''GNULIB_GETPAGESIZE''@/$(GNULIB_GETPAGESIZE)/g' \
+ -e 's/@''GNULIB_GETUSERSHELL''@/$(GNULIB_GETUSERSHELL)/g' \
+ -e 's/@''GNULIB_GROUP_MEMBER''@/$(GNULIB_GROUP_MEMBER)/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_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''@/$(GNULIB_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' \
@@ -1837,6 +1977,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-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' \
@@ -2022,7 +2163,8 @@ EXTRA_DIST += $(top_srcdir)/build-aux/vc-list-files
## begin gnulib module verify
-libgnu_la_SOURCES += verify.h
+
+EXTRA_DIST += verify.h
## end gnulib module verify
@@ -2063,51 +2205,52 @@ BUILT_SOURCES += wchar.h
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|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ 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' \
+ -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' \
diff --git a/lib/alignof.h b/lib/alignof.h
index 5e71f6cbb..4d03e35c9 100644
--- a/lib/alignof.h
+++ b/lib/alignof.h
@@ -31,7 +31,7 @@
# define alignof_slot(type) offsetof (struct { char __slot1; type __slot2; }, __slot2)
#endif
-/* Determine the good alignment of a object of the given type at compile time.
+/* Determine the good alignment of an object of the given type at compile time.
Note that this is not necessarily the same as alignof_slot(type).
For example, with GNU C on x86 platforms: alignof_type(double) = 8, but
- when -malign-double is not specified: alignof_slot(double) = 4,
diff --git a/lib/arpa_inet.in.h b/lib/arpa_inet.in.h
index 1fa1f5289..a7871a7a4 100644
--- a/lib/arpa_inet.in.h
+++ b/lib/arpa_inet.in.h
@@ -16,7 +16,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-#ifndef _GL_ARPA_INET_H
+#ifndef _@GUARD_PREFIX@_ARPA_INET_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -47,8 +47,8 @@
#endif
-#ifndef _GL_ARPA_INET_H
-#define _GL_ARPA_INET_H
+#ifndef _@GUARD_PREFIX@_ARPA_INET_H
+#define _@GUARD_PREFIX@_ARPA_INET_H
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -111,5 +111,5 @@ _GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - "
#endif
-#endif /* _GL_ARPA_INET_H */
-#endif /* _GL_ARPA_INET_H */
+#endif /* _@GUARD_PREFIX@_ARPA_INET_H */
+#endif /* _@GUARD_PREFIX@_ARPA_INET_H */
diff --git a/lib/binary-io.h b/lib/binary-io.h
new file mode 100644
index 000000000..874fe689e
--- /dev/null
+++ b/lib/binary-io.h
@@ -0,0 +1,52 @@
+/* Binary mode I/O.
+ Copyright (C) 2001, 2003, 2005, 2008-2011 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/>. */
+
+#ifndef _BINARY_H
+#define _BINARY_H
+
+/* For systems that distinguish between text and binary I/O.
+ O_BINARY is guaranteed by the gnulib <fcntl.h>. */
+#include <fcntl.h>
+
+/* The MSVC7 <stdio.h> doesn't like to be included after '#define fileno ...',
+ so we include it here first. */
+#include <stdio.h>
+
+/* SET_BINARY (fd);
+ changes the file descriptor fd to perform binary I/O. */
+#if O_BINARY
+# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__
+# include <io.h> /* declares setmode() */
+# else
+# define setmode _setmode
+# undef fileno
+# define fileno _fileno
+# endif
+# ifdef __DJGPP__
+# include <unistd.h> /* declares isatty() */
+ /* Avoid putting stdin/stdout in binary mode if it is connected to
+ the console, because that would make it impossible for the user
+ to interrupt the program through Ctrl-C or Ctrl-Break. */
+# define SET_BINARY(fd) ((void) (!isatty (fd) ? (setmode (fd, O_BINARY), 0) : 0))
+# else
+# define SET_BINARY(fd) ((void) setmode (fd, O_BINARY))
+# endif
+#else
+ /* On reasonable systems, binary I/O is the default. */
+# define SET_BINARY(fd) /* do nothing */ ((void) 0)
+#endif
+
+#endif /* _BINARY_H */
diff --git a/lib/errno.in.h b/lib/errno.in.h
index 98355be69..1eb77afd6 100644
--- a/lib/errno.in.h
+++ b/lib/errno.in.h
@@ -16,7 +16,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-#ifndef _GL_ERRNO_H
+#ifndef _@GUARD_PREFIX@_ERRNO_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -26,8 +26,8 @@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_ERRNO_H@
-#ifndef _GL_ERRNO_H
-#define _GL_ERRNO_H
+#ifndef _@GUARD_PREFIX@_ERRNO_H
+#define _@GUARD_PREFIX@_ERRNO_H
/* On native Windows platforms, many macros are not defined. */
@@ -163,5 +163,5 @@
# endif
-#endif /* _GL_ERRNO_H */
-#endif /* _GL_ERRNO_H */
+#endif /* _@GUARD_PREFIX@_ERRNO_H */
+#endif /* _@GUARD_PREFIX@_ERRNO_H */
diff --git a/lib/fclose.c b/lib/fclose.c
index 805449a20..a4a519f7c 100644
--- a/lib/fclose.c
+++ b/lib/fclose.c
@@ -22,26 +22,63 @@
#include <errno.h>
#include <unistd.h>
-/* Override fclose() to call the overridden close(). */
+#include "freading.h"
+
+/* Override fclose() to call the overridden fflush() or close(). */
int
rpl_fclose (FILE *fp)
#undef fclose
{
int saved_errno = 0;
+ int fd;
+ int result = 0;
+
+ /* Don't change behavior on memstreams. */
+ fd = fileno (fp);
+ if (fd < 0)
+ return fclose (fp);
- if (fflush (fp))
+ /* We only need to flush the file if it is not reading or if it is
+ seekable. This only guarantees the file position of input files
+ if the fflush module is also in use. */
+ if ((!freading (fp) || lseek (fileno (fp), 0, SEEK_CUR) != -1)
+ && fflush (fp))
saved_errno = errno;
- if (close (fileno (fp)) < 0 && saved_errno == 0)
+ /* fclose() calls close(), but we need to also invoke all hooks that our
+ overridden close() function invokes. See lib/close.c. */
+#if WINDOWS_SOCKETS
+ /* Call the overridden close(), then the original fclose().
+ Note about multithread-safety: There is a race condition where some
+ other thread could open fd between our close and fclose. */
+ if (close (fd) < 0 && saved_errno == 0)
saved_errno = errno;
- fclose (fp); /* will fail with errno = EBADF */
+ fclose (fp); /* will fail with errno = EBADF, if we did not lose a race */
+
+#else /* !WINDOWS_SOCKETS */
+ /* Call fclose() and invoke all hooks of the overridden close(). */
+
+# if REPLACE_FCHDIR
+ /* Note about multithread-safety: There is a race condition here as well.
+ Some other thread could open fd between our calls to fclose and
+ _gl_unregister_fd. */
+ result = fclose (fp);
+ if (result == 0)
+ _gl_unregister_fd (fd);
+# else
+ /* No race condition here. */
+ result = fclose (fp);
+# endif
+
+#endif /* !WINDOWS_SOCKETS */
if (saved_errno != 0)
{
errno = saved_errno;
- return EOF;
+ result = EOF;
}
- return 0;
+
+ return result;
}
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
new file mode 100644
index 000000000..77d69a3e5
--- /dev/null
+++ b/lib/fcntl.in.h
@@ -0,0 +1,325 @@
+/* Like <fcntl.h>, but with non-working flags defined to 0.
+
+ Copyright (C) 2006-2011 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 */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#if defined __need_system_fcntl_h
+/* Special invocation convention. */
+
+#include <sys/types.h>
+/* On some systems other than glibc, <sys/stat.h> is a prerequisite of
+ <fcntl.h>. On glibc systems, we would like to avoid namespace pollution.
+ But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an
+ extern "C" { ... } block, which leads to errors in C++ mode with the
+ overridden <sys/stat.h> from gnulib. These errors are known to be gone
+ with g++ version >= 4.3. */
+#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
+# include <sys/stat.h>
+#endif
+#@INCLUDE_NEXT@ @NEXT_FCNTL_H@
+
+#else
+/* Normal invocation convention. */
+
+#ifndef _@GUARD_PREFIX@_FCNTL_H
+
+#include <sys/types.h>
+/* On some systems other than glibc, <sys/stat.h> is a prerequisite of
+ <fcntl.h>. On glibc systems, we would like to avoid namespace pollution.
+ But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an
+ extern "C" { ... } block, which leads to errors in C++ mode with the
+ overridden <sys/stat.h> from gnulib. These errors are known to be gone
+ with g++ version >= 4.3. */
+#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
+# include <sys/stat.h>
+#endif
+/* The include_next requires a split double-inclusion guard. */
+#@INCLUDE_NEXT@ @NEXT_FCNTL_H@
+
+#ifndef _@GUARD_PREFIX@_FCNTL_H
+#define _@GUARD_PREFIX@_FCNTL_H
+
+#ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems. */
+# 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. */
+
+
+/* Declare overridden functions. */
+
+#if @GNULIB_FCNTL@
+# if @REPLACE_FCNTL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef fcntl
+# define fcntl rpl_fcntl
+# endif
+_GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...));
+_GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...));
+# else
+# if !@HAVE_FCNTL@
+_GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...));
+# endif
+_GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...));
+# endif
+_GL_CXXALIASWARN (fcntl);
+#elif defined GNULIB_POSIXCHECK
+# undef fcntl
+# if HAVE_RAW_DECL_FCNTL
+_GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - "
+ "use gnulib module fcntl for portability");
+# endif
+#endif
+
+#if @GNULIB_OPEN@
+# if @REPLACE_OPEN@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef open
+# define open rpl_open
+# endif
+_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
+# else
+_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
+# endif
+/* On HP-UX 11, in C++ mode, open() is defined as an inline function with a
+ default argument. _GL_CXXALIASWARN does not work in this case. */
+# if !defined __hpux
+_GL_CXXALIASWARN (open);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef open
+/* Assume open is always declared. */
+_GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
+ "use gnulib module open for portability");
+#endif
+
+#if @GNULIB_OPENAT@
+# if @REPLACE_OPENAT@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef openat
+# define openat rpl_openat
+# endif
+_GL_FUNCDECL_RPL (openat, int,
+ (int fd, char const *file, int flags, /* mode_t mode */ ...)
+ _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (openat, int,
+ (int fd, char const *file, int flags, /* mode_t mode */ ...));
+# else
+# if !@HAVE_OPENAT@
+_GL_FUNCDECL_SYS (openat, int,
+ (int fd, char const *file, int flags, /* mode_t mode */ ...)
+ _GL_ARG_NONNULL ((2)));
+# endif
+_GL_CXXALIAS_SYS (openat, int,
+ (int fd, char const *file, int flags, /* mode_t mode */ ...));
+# endif
+_GL_CXXALIASWARN (openat);
+#elif defined GNULIB_POSIXCHECK
+# undef openat
+# if HAVE_RAW_DECL_OPENAT
+_GL_WARN_ON_USE (openat, "openat is not portable - "
+ "use gnulib module openat for portability");
+# endif
+#endif
+
+
+/* Fix up the FD_* macros, only known to be missing on mingw. */
+
+#ifndef FD_CLOEXEC
+# define FD_CLOEXEC 1
+#endif
+
+/* Fix up the supported F_* macros. Intentionally leave other F_*
+ macros undefined. Only known to be missing on mingw. */
+
+#ifndef F_DUPFD_CLOEXEC
+# define F_DUPFD_CLOEXEC 0x40000000
+/* Witness variable: 1 if gnulib defined F_DUPFD_CLOEXEC, 0 otherwise. */
+# define GNULIB_defined_F_DUPFD_CLOEXEC 1
+#else
+# define GNULIB_defined_F_DUPFD_CLOEXEC 0
+#endif
+
+#ifndef F_DUPFD
+# define F_DUPFD 1
+#endif
+
+#ifndef F_GETFD
+# define F_GETFD 2
+#endif
+
+/* Fix up the O_* macros. */
+
+#if !defined O_DIRECT && defined O_DIRECTIO
+/* Tru64 spells it `O_DIRECTIO'. */
+# define O_DIRECT O_DIRECTIO
+#endif
+
+#if !defined O_CLOEXEC && defined O_NOINHERIT
+/* Mingw spells it `O_NOINHERIT'. */
+# define O_CLOEXEC O_NOINHERIT
+#endif
+
+#ifndef O_CLOEXEC
+# define O_CLOEXEC 0
+#endif
+
+#ifndef O_DIRECT
+# define O_DIRECT 0
+#endif
+
+#ifndef O_DIRECTORY
+# define O_DIRECTORY 0
+#endif
+
+#ifndef O_DSYNC
+# define O_DSYNC 0
+#endif
+
+#ifndef O_EXEC
+# define O_EXEC O_RDONLY /* This is often close enough in older systems. */
+#endif
+
+#ifndef O_NDELAY
+# define O_NDELAY 0
+#endif
+
+#ifndef O_NOATIME
+# define O_NOATIME 0
+#endif
+
+#ifndef O_NONBLOCK
+# define O_NONBLOCK O_NDELAY
+#endif
+
+/* If the gnulib module 'nonblocking' is in use, guarantee a working non-zero
+ value of O_NONBLOCK. Otherwise, O_NONBLOCK is defined (above) to O_NDELAY
+ or to 0 as fallback. */
+#if @GNULIB_NONBLOCKING@
+# if O_NONBLOCK
+# define GNULIB_defined_O_NONBLOCK 0
+# else
+# define GNULIB_defined_O_NONBLOCK 1
+# undef O_NONBLOCK
+# define O_NONBLOCK 0x40000000
+# endif
+#endif
+
+#ifndef O_NOCTTY
+# define O_NOCTTY 0
+#endif
+
+#ifndef O_NOFOLLOW
+# define O_NOFOLLOW 0
+#endif
+
+#ifndef O_NOLINKS
+# define O_NOLINKS 0
+#endif
+
+#ifndef O_RSYNC
+# define O_RSYNC 0
+#endif
+
+#ifndef O_SEARCH
+# define O_SEARCH O_RDONLY /* This is often close enough in older systems. */
+#endif
+
+#ifndef O_SYNC
+# define O_SYNC 0
+#endif
+
+#ifndef O_TTY_INIT
+# define O_TTY_INIT 0
+#endif
+
+#if O_ACCMODE != (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
+# undef O_ACCMODE
+# define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
+#endif
+
+/* For systems that distinguish between text and binary I/O.
+ O_BINARY is usually declared in fcntl.h */
+#if !defined O_BINARY && defined _O_BINARY
+ /* For MSC-compatible compilers. */
+# define O_BINARY _O_BINARY
+# define O_TEXT _O_TEXT
+#endif
+
+#if defined __BEOS__ || defined __HAIKU__
+ /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect. */
+# undef O_BINARY
+# undef O_TEXT
+#endif
+
+#ifndef O_BINARY
+# define O_BINARY 0
+# define O_TEXT 0
+#endif
+
+/* Fix up the AT_* macros. */
+
+/* Work around a bug in Solaris 9 and 10: AT_FDCWD is positive. Its
+ value exceeds INT_MAX, so its use as an int doesn't conform to the
+ C standard, and GCC and Sun C complain in some cases. If the bug
+ is present, undef AT_FDCWD here, so it can be redefined below. */
+#if 0 < AT_FDCWD && AT_FDCWD == 0xffd19553
+# undef AT_FDCWD
+#endif
+
+/* Use the same bit pattern as Solaris 9, but with the proper
+ signedness. The bit pattern is important, in case this actually is
+ Solaris with the above workaround. */
+#ifndef AT_FDCWD
+# define AT_FDCWD (-3041965)
+#endif
+
+/* Use the same values as Solaris 9. This shouldn't matter, but
+ there's no real reason to differ. */
+#ifndef AT_SYMLINK_NOFOLLOW
+# define AT_SYMLINK_NOFOLLOW 4096
+#endif
+
+#ifndef AT_REMOVEDIR
+# define AT_REMOVEDIR 1
+#endif
+
+/* Solaris 9 lacks these two, so just pick unique values. */
+#ifndef AT_SYMLINK_FOLLOW
+# define AT_SYMLINK_FOLLOW 2
+#endif
+
+#ifndef AT_EACCESS
+# define AT_EACCESS 4
+#endif
+
+
+#endif /* _@GUARD_PREFIX@_FCNTL_H */
+#endif /* _@GUARD_PREFIX@_FCNTL_H */
+#endif
diff --git a/lib/fflush.c b/lib/fflush.c
new file mode 100644
index 000000000..f90ba6fa1
--- /dev/null
+++ b/lib/fflush.c
@@ -0,0 +1,218 @@
+/* fflush.c -- allow flushing input streams
+ Copyright (C) 2007-2011 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 Eric Blake. */
+
+#include <config.h>
+
+/* Specification. */
+#include <stdio.h>
+
+#include <errno.h>
+#include <unistd.h>
+
+#include "freading.h"
+
+#include "stdio-impl.h"
+
+#undef fflush
+
+
+#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+
+/* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */
+static inline void
+clear_ungetc_buffer_preserving_position (FILE *fp)
+{
+ if (fp->_flags & _IO_IN_BACKUP)
+ /* _IO_free_backup_area is a bit complicated. Simply call fseek. */
+ fseeko (fp, 0, SEEK_CUR);
+}
+
+#else
+
+/* Clear the stream's ungetc buffer. May modify the value of ftello (fp). */
+static inline void
+clear_ungetc_buffer (FILE *fp)
+{
+# if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
+ if (HASUB (fp))
+ {
+ fp_->_p += fp_->_r;
+ fp_->_r = 0;
+ }
+# elif defined __EMX__ /* emx+gcc */
+ if (fp->_ungetc_count > 0)
+ {
+ fp->_ungetc_count = 0;
+ fp->_rcount = - fp->_rcount;
+ }
+# elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
+ /* Nothing to do. */
+# else /* other implementations */
+ fseeko (fp, 0, SEEK_CUR);
+# endif
+}
+
+#endif
+
+#if (defined __sferror || defined __DragonFly__) && defined __SNPT /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
+
+static inline int
+disable_seek_optimization (FILE *fp)
+{
+ int saved_flags = fp_->_flags & (__SOPT | __SNPT);
+ fp_->_flags = (fp_->_flags & ~__SOPT) | __SNPT;
+ return saved_flags;
+}
+
+static inline void
+restore_seek_optimization (FILE *fp, int saved_flags)
+{
+ fp_->_flags = (fp_->_flags & ~(__SOPT | __SNPT)) | saved_flags;
+}
+
+#endif
+
+static inline void
+update_fpos_cache (FILE *fp, off_t pos)
+{
+#if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
+# if defined __CYGWIN__
+ /* fp_->_offset is typed as an integer. */
+ fp_->_offset = pos;
+# else
+ /* fp_->_offset is an fpos_t. */
+ /* Use a union, since on NetBSD, the compilation flags determine
+ whether fpos_t is typedef'd to off_t or a struct containing a
+ single off_t member. */
+ union
+ {
+ fpos_t f;
+ off_t o;
+ } u;
+ u.o = pos;
+ fp_->_offset = u.f;
+# endif
+ fp_->_flags |= __SOFF;
+#endif
+}
+
+/* Flush all pending data on STREAM according to POSIX rules. Both
+ output and seekable input streams are supported. */
+int
+rpl_fflush (FILE *stream)
+{
+ /* When stream is NULL, POSIX and C99 only require flushing of "output
+ streams and update streams in which the most recent operation was not
+ input", and all implementations do this.
+
+ When stream is "an output stream or an update stream in which the most
+ recent operation was not input", POSIX and C99 requires that fflush
+ writes out any buffered data, and all implementations do this.
+
+ When stream is, however, an input stream or an update stream in
+ which the most recent operation was input, C99 specifies nothing,
+ and POSIX only specifies behavior if the stream is seekable.
+ mingw, in particular, drops the input buffer, leaving the file
+ descriptor positioned at the end of the input buffer. I.e. ftell
+ (stream) is lost. We don't want to call the implementation's
+ fflush in this case.
+
+ We test ! freading (stream) here, rather than fwriting (stream), because
+ what we need to know is whether the stream holds a "read buffer", and on
+ mingw this is indicated by _IOREAD, regardless of _IOWRT. */
+ if (stream == NULL || ! freading (stream))
+ return fflush (stream);
+
+#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+
+ clear_ungetc_buffer_preserving_position (stream);
+
+ return fflush (stream);
+
+#else
+ {
+ /* Notes about the file-position indicator:
+ 1) The file position indicator is incremented by fgetc() and decremented
+ by ungetc():
+ <http://www.opengroup.org/susv3/functions/fgetc.html>
+ "... the fgetc() function shall ... advance the associated file
+ position indicator for the stream ..."
+ <http://www.opengroup.org/susv3/functions/ungetc.html>
+ "The file-position indicator is decremented by each successful
+ call to ungetc()..."
+ 2) <http://www.opengroup.org/susv3/functions/ungetc.html> says:
+ "The value of the file-position indicator for the stream after
+ reading or discarding all pushed-back bytes shall be the same
+ as it was before the bytes were pushed back."
+ Here we are discarding all pushed-back bytes. But more specifically,
+ 3) <http://www.opengroup.org/austin/aardvark/latest/xshbug3.txt> says:
+ "[After fflush(),] the file offset of the underlying open file
+ description shall be set to the file position of the stream, and
+ any characters pushed back onto the stream by ungetc() ... shall
+ be discarded." */
+
+ /* POSIX does not specify fflush behavior for non-seekable input
+ streams. Some implementations purge unread data, some return
+ EBADF, some do nothing. */
+ off_t pos = ftello (stream);
+ if (pos == -1)
+ {
+ errno = EBADF;
+ return EOF;
+ }
+
+ /* Clear the ungetc buffer. */
+ clear_ungetc_buffer (stream);
+
+ /* To get here, we must be flushing a seekable input stream, so the
+ semantics of fpurge are now appropriate to clear the buffer. To
+ avoid losing data, the lseek is also necessary. */
+ {
+ int result = fpurge (stream);
+ if (result != 0)
+ return result;
+ }
+
+# if (defined __sferror || defined __DragonFly__) && defined __SNPT /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
+
+ {
+ /* Disable seek optimization for the next fseeko call. This tells the
+ following fseeko call to seek to the desired position directly, rather
+ than to seek to a block-aligned boundary. */
+ int saved_flags = disable_seek_optimization (stream);
+ int result = fseeko (stream, pos, SEEK_SET);
+
+ restore_seek_optimization (stream, saved_flags);
+ return result;
+ }
+
+# else
+
+ pos = lseek (fileno (stream), pos, SEEK_SET);
+ if (pos == -1)
+ return EOF;
+ /* After a successful lseek, update the file descriptor's position cache
+ in the stream. */
+ update_fpos_cache (stream, pos);
+
+ return 0;
+
+# endif
+ }
+#endif
+}
diff --git a/lib/float.in.h b/lib/float.in.h
index d252bf074..58a5f736e 100644
--- a/lib/float.in.h
+++ b/lib/float.in.h
@@ -15,7 +15,7 @@
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/>. */
-#ifndef _GL_FLOAT_H
+#ifndef _@GUARD_PREFIX@_FLOAT_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -25,8 +25,8 @@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_FLOAT_H@
-#ifndef _GL_FLOAT_H
-#define _GL_FLOAT_H
+#ifndef _@GUARD_PREFIX@_FLOAT_H
+#define _@GUARD_PREFIX@_FLOAT_H
/* 'long double' properties. */
#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__)
@@ -59,5 +59,5 @@
# define LDBL_MAX_10_EXP 4932
#endif
-#endif /* _GL_FLOAT_H */
-#endif /* _GL_FLOAT_H */
+#endif /* _@GUARD_PREFIX@_FLOAT_H */
+#endif /* _@GUARD_PREFIX@_FLOAT_H */
diff --git a/lib/fpurge.c b/lib/fpurge.c
new file mode 100644
index 000000000..5c53ee763
--- /dev/null
+++ b/lib/fpurge.c
@@ -0,0 +1,137 @@
+/* Flushing buffers of a FILE stream.
+ Copyright (C) 2007-2011 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/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include <stdio.h>
+
+#if HAVE___FPURGE /* glibc >= 2.2, Haiku, Solaris >= 7 */
+# include <stdio_ext.h>
+#endif
+#include <stdlib.h>
+
+#include "stdio-impl.h"
+
+int
+fpurge (FILE *fp)
+{
+#if HAVE___FPURGE /* glibc >= 2.2, Haiku, Solaris >= 7 */
+
+ __fpurge (fp);
+ /* The __fpurge function does not have a return value. */
+ return 0;
+
+#elif HAVE_FPURGE /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin 1.7 */
+
+ /* Call the system's fpurge function. */
+# undef fpurge
+# if !HAVE_DECL_FPURGE
+ extern int fpurge (FILE *);
+# endif
+ int result = fpurge (fp);
+# if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
+ if (result == 0)
+ /* Correct the invariants that fpurge broke.
+ <stdio.h> on BSD systems says:
+ "The following always hold: if _flags & __SRD, _w is 0."
+ If this invariant is not fulfilled and the stream is read-write but
+ currently reading, subsequent putc or fputc calls will write directly
+ into the buffer, although they shouldn't be allowed to. */
+ if ((fp_->_flags & __SRD) != 0)
+ fp_->_w = 0;
+# endif
+ return result;
+
+#else
+
+ /* Most systems provide FILE as a struct and the necessary bitmask in
+ <stdio.h>, because they need it for implementing getc() and putc() as
+ fast macros. */
+# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+ fp->_IO_read_end = fp->_IO_read_ptr;
+ fp->_IO_write_ptr = fp->_IO_write_base;
+ /* Avoid memory leak when there is an active ungetc buffer. */
+ if (fp->_IO_save_base != NULL)
+ {
+ free (fp->_IO_save_base);
+ fp->_IO_save_base = NULL;
+ }
+ return 0;
+# elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
+ fp_->_p = fp_->_bf._base;
+ fp_->_r = 0;
+ fp_->_w = ((fp_->_flags & (__SLBF | __SNBF | __SRD)) == 0 /* fully buffered and not currently reading? */
+ ? fp_->_bf._size
+ : 0);
+ /* Avoid memory leak when there is an active ungetc buffer. */
+ if (fp_ub._base != NULL)
+ {
+ if (fp_ub._base != fp_->_ubuf)
+ free (fp_ub._base);
+ fp_ub._base = NULL;
+ }
+ return 0;
+# elif defined __EMX__ /* emx+gcc */
+ fp->_ptr = fp->_buffer;
+ fp->_rcount = 0;
+ fp->_wcount = 0;
+ fp->_ungetc_count = 0;
+ return 0;
+# elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
+ fp->_ptr = fp->_base;
+ if (fp->_ptr != NULL)
+ fp->_cnt = 0;
+ return 0;
+# elif defined __UCLIBC__ /* uClibc */
+# ifdef __STDIO_BUFFERS
+ if (fp->__modeflags & __FLAG_WRITING)
+ fp->__bufpos = fp->__bufstart;
+ else if (fp->__modeflags & (__FLAG_READONLY | __FLAG_READING))
+ fp->__bufpos = fp->__bufread;
+# endif
+ return 0;
+# elif defined __QNX__ /* QNX */
+ fp->_Rback = fp->_Back + sizeof (fp->_Back);
+ fp->_Rsave = NULL;
+ if (fp->_Mode & 0x2000 /* _MWRITE */)
+ /* fp->_Buf <= fp->_Next <= fp->_Wend */
+ fp->_Next = fp->_Buf;
+ else
+ /* fp->_Buf <= fp->_Next <= fp->_Rend */
+ fp->_Rend = fp->_Next;
+ return 0;
+# elif defined __MINT__ /* Atari FreeMiNT */
+ if (fp->__pushed_back)
+ {
+ fp->__bufp = fp->__pushback_bufp;
+ fp->__pushed_back = 0;
+ }
+ /* Preserve the current file position. */
+ if (fp->__target != -1)
+ fp->__target += fp->__bufp - fp->__buffer;
+ fp->__bufp = fp->__buffer;
+ /* Nothing in the buffer, next getc is nontrivial. */
+ fp->__get_limit = fp->__bufp;
+ /* Nothing in the buffer, next putc is nontrivial. */
+ fp->__put_limit = fp->__buffer;
+ return 0;
+# else
+# error "Please port gnulib fpurge.c to your platform! Look at the definitions of fflush, setvbuf and ungetc on your system, then report this to bug-gnulib."
+# endif
+
+#endif
+}
diff --git a/lib/freading.c b/lib/freading.c
new file mode 100644
index 000000000..1d13121ce
--- /dev/null
+++ b/lib/freading.c
@@ -0,0 +1,68 @@
+/* Retrieve information about a FILE stream.
+ Copyright (C) 2007-2011 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/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include "freading.h"
+
+#include "stdio-impl.h"
+
+/* Don't use glibc's __freading function in glibc < 2.7, see
+ <http://sourceware.org/bugzilla/show_bug.cgi?id=4359> */
+#if !(HAVE___FREADING && (!defined __GLIBC__ || defined __UCLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7)))
+
+bool
+freading (FILE *fp)
+{
+ /* Most systems provide FILE as a struct and the necessary bitmask in
+ <stdio.h>, because they need it for implementing getc() and putc() as
+ fast macros. */
+# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+ return ((fp->_flags & _IO_NO_WRITES) != 0
+ || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
+ && fp->_IO_read_base != NULL));
+# elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
+ return (fp_->_flags & __SRD) != 0;
+# elif defined __EMX__ /* emx+gcc */
+ return (fp->_flags & _IOREAD) != 0;
+# elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
+# if defined __sun /* Solaris */
+ return (fp->_flag & _IOREAD) != 0 && (fp->_flag & _IOWRT) == 0;
+# else
+ return (fp->_flag & _IOREAD) != 0;
+# endif
+# elif defined __UCLIBC__ /* uClibc */
+ return (fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) != 0;
+# elif defined __QNX__ /* QNX */
+ return ((fp->_Mode & 0x2 /* _MOPENW */) == 0
+ || (fp->_Mode & 0x1000 /* _MREAD */) != 0);
+# elif defined __MINT__ /* Atari FreeMiNT */
+ if (!fp->__mode.__write)
+ return 1;
+ if (!fp->__mode.__read)
+ return 0;
+# ifdef _IO_CURRENTLY_GETTING /* Flag added on 2009-02-28 */
+ return (fp->__flags & _IO_CURRENTLY_GETTING) != 0;
+# else
+ return (fp->__buffer < fp->__get_limit /*|| fp->__bufp == fp->__put_limit ??*/);
+# endif
+# else
+# error "Please port gnulib freading.c to your platform!"
+# endif
+}
+
+#endif
diff --git a/lib/freading.h b/lib/freading.h
new file mode 100644
index 000000000..89bf453c1
--- /dev/null
+++ b/lib/freading.h
@@ -0,0 +1,53 @@
+/* Retrieve information about a FILE stream.
+ Copyright (C) 2007-2011 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/>. */
+
+#include <stdbool.h>
+#include <stdio.h>
+
+/* Return true if the stream STREAM is opened read-only, or if the
+ last operation on the stream was a read operation. Return false if
+ the stream is opened write-only or append-only, or if it supports
+ writing and there is no current read operation (such as fgetc).
+
+ freading and fwriting will never both be true. If STREAM supports
+ both reads and writes, then:
+ - both freading and fwriting might be false when the stream is first
+ opened, after read encounters EOF, or after fflush,
+ - freading might be false or true and fwriting might be false
+ after repositioning (such as fseek, fsetpos, or rewind),
+ depending on the underlying implementation.
+
+ STREAM must not be wide-character oriented. */
+
+#if HAVE___FREADING && (!defined __GLIBC__ || defined __UCLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7))
+/* Solaris >= 7, not glibc >= 2.2, but glibc >= 2.7 */
+
+# include <stdio_ext.h>
+# define freading(stream) (__freading (stream) != 0)
+
+#else
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+extern bool freading (FILE *stream);
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
diff --git a/lib/fseek.c b/lib/fseek.c
new file mode 100644
index 000000000..74625d0f5
--- /dev/null
+++ b/lib/fseek.c
@@ -0,0 +1,30 @@
+/* An fseek() function that, together with fflush(), is POSIX compliant.
+ Copyright (C) 2007, 2009-2011 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/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include <stdio.h>
+
+/* Get off_t. */
+#include <unistd.h>
+
+int
+fseek (FILE *fp, long offset, int whence)
+{
+ /* Use the replacement fseeko function with all its workarounds. */
+ return fseeko (fp, (off_t)offset, whence);
+}
diff --git a/lib/fseeko.c b/lib/fseeko.c
new file mode 100644
index 000000000..e55a42bf2
--- /dev/null
+++ b/lib/fseeko.c
@@ -0,0 +1,146 @@
+/* An fseeko() function that, together with fflush(), is POSIX compliant.
+ Copyright (C) 2007-2011 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. */
+
+#include <config.h>
+
+/* Specification. */
+#include <stdio.h>
+
+/* Get off_t and lseek. */
+#include <unistd.h>
+
+#include "stdio-impl.h"
+
+int
+fseeko (FILE *fp, off_t offset, int whence)
+#undef fseeko
+#if !HAVE_FSEEKO
+# undef fseek
+# define fseeko fseek
+#endif
+{
+#if LSEEK_PIPE_BROKEN
+ /* mingw gives bogus answers rather than failure on non-seekable files. */
+ if (lseek (fileno (fp), 0, SEEK_CUR) == -1)
+ return EOF;
+#endif
+
+ /* These tests are based on fpurge.c. */
+#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+ if (fp->_IO_read_end == fp->_IO_read_ptr
+ && fp->_IO_write_ptr == fp->_IO_write_base
+ && fp->_IO_save_base == NULL)
+#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
+# if defined __SL64 && defined __SCLE /* Cygwin */
+ if ((fp->_flags & __SL64) == 0)
+ {
+ /* Cygwin 1.5.0 through 1.5.24 failed to open stdin in 64-bit
+ mode; but has an fseeko that requires 64-bit mode. */
+ FILE *tmp = fopen ("/dev/null", "r");
+ if (!tmp)
+ return -1;
+ fp->_flags |= __SL64;
+ fp->_seek64 = tmp->_seek64;
+ fclose (tmp);
+ }
+# endif
+ if (fp_->_p == fp_->_bf._base
+ && fp_->_r == 0
+ && fp_->_w == ((fp_->_flags & (__SLBF | __SNBF | __SRD)) == 0 /* fully buffered and not currently reading? */
+ ? fp_->_bf._size
+ : 0)
+ && fp_ub._base == NULL)
+#elif defined __EMX__ /* emx+gcc */
+ if (fp->_ptr == fp->_buffer
+ && fp->_rcount == 0
+ && fp->_wcount == 0
+ && fp->_ungetc_count == 0)
+#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
+ if (fp_->_ptr == fp_->_base
+ && (fp_->_ptr == NULL || fp_->_cnt == 0))
+#elif defined __UCLIBC__ /* uClibc */
+ if (((fp->__modeflags & __FLAG_WRITING) == 0
+ || fp->__bufpos == fp->__bufstart)
+ && ((fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) == 0
+ || fp->__bufpos == fp->__bufread))
+#elif defined __QNX__ /* QNX */
+ if ((fp->_Mode & 0x2000 /* _MWRITE */ ? fp->_Next == fp->_Buf : fp->_Next == fp->_Rend)
+ && fp->_Rback == fp->_Back + sizeof (fp->_Back)
+ && fp->_Rsave == NULL)
+#elif defined __MINT__ /* Atari FreeMiNT */
+ if (fp->__bufp == fp->__buffer
+ && fp->__get_limit == fp->__bufp
+ && fp->__put_limit == fp->__bufp
+ && !fp->__pushed_back)
+#else
+ #error "Please port gnulib fseeko.c to your platform! Look at the code in fpurge.c, then report this to bug-gnulib."
+#endif
+ {
+ /* We get here when an fflush() call immediately preceded this one. We
+ know there are no buffers.
+ POSIX requires us to modify the file descriptor's position.
+ But we cannot position beyond end of file here. */
+ off_t pos =
+ lseek (fileno (fp),
+ whence == SEEK_END && offset > 0 ? 0 : offset,
+ whence);
+ if (pos == -1)
+ {
+#if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
+ fp_->_flags &= ~__SOFF;
+#endif
+ return -1;
+ }
+
+#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+ fp->_flags &= ~_IO_EOF_SEEN;
+#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
+# if defined __CYGWIN__
+ /* fp_->_offset is typed as an integer. */
+ fp_->_offset = pos;
+# else
+ /* fp_->_offset is an fpos_t. */
+ {
+ /* Use a union, since on NetBSD, the compilation flags
+ determine whether fpos_t is typedef'd to off_t or a struct
+ containing a single off_t member. */
+ union
+ {
+ fpos_t f;
+ off_t o;
+ } u;
+ u.o = pos;
+ fp_->_offset = u.f;
+ }
+# endif
+ fp_->_flags |= __SOFF;
+ fp_->_flags &= ~__SEOF;
+#elif defined __EMX__ /* emx+gcc */
+ fp->_flags &= ~_IOEOF;
+#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
+ fp->_flag &= ~_IOEOF;
+#elif defined __MINT__ /* Atari FreeMiNT */
+ fp->__offset = pos;
+ fp->__eof = 0;
+#endif
+ /* If we were not requested to position beyond end of file, we're
+ done. */
+ if (!(whence == SEEK_END && offset > 0))
+ return 0;
+ }
+ return fseeko (fp, offset, whence);
+}
diff --git a/lib/ftell.c b/lib/ftell.c
new file mode 100644
index 000000000..5ba3b32df
--- /dev/null
+++ b/lib/ftell.c
@@ -0,0 +1,38 @@
+/* An ftell() function that works around platform bugs.
+ Copyright (C) 2007-2011 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/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include <stdio.h>
+
+#include <errno.h>
+/* Get off_t. */
+#include <unistd.h>
+
+long
+ftell (FILE *fp)
+{
+ /* Use the replacement ftello function with all its workarounds. */
+ off_t offset = ftello (fp);
+ if (offset == (long)offset)
+ return (long)offset;
+ else
+ {
+ errno = EOVERFLOW;
+ return -1;
+ }
+}
diff --git a/lib/ftello.c b/lib/ftello.c
new file mode 100644
index 000000000..2aaa048a4
--- /dev/null
+++ b/lib/ftello.c
@@ -0,0 +1,77 @@
+/* An ftello() function that works around platform bugs.
+ Copyright (C) 2007, 2009-2011 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/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include <stdio.h>
+
+/* Get lseek. */
+#include <unistd.h>
+
+#include "stdio-impl.h"
+
+off_t
+ftello (FILE *fp)
+#undef ftello
+#if !HAVE_FTELLO
+# undef ftell
+# define ftello ftell
+#endif
+{
+#if LSEEK_PIPE_BROKEN
+ /* mingw gives bogus answers rather than failure on non-seekable files. */
+ if (lseek (fileno (fp), 0, SEEK_CUR) == -1)
+ return -1;
+#endif
+
+#if FTELLO_BROKEN_AFTER_SWITCHING_FROM_READ_TO_WRITE /* Solaris */
+ /* The Solaris stdio leaves the _IOREAD flag set after reading from a file
+ reaches EOF and the program then starts writing to the file. ftello
+ gets confused by this. */
+ if (fp_->_flag & _IOWRT)
+ {
+ off_t pos;
+
+ /* Call ftello nevertheless, for the side effects that it does on fp. */
+ ftello (fp);
+
+ /* Compute the file position ourselves. */
+ pos = lseek (fileno (fp), (off_t) 0, SEEK_CUR);
+ if (pos >= 0)
+ {
+ if ((fp_->_flag & _IONBF) == 0 && fp_->_base != NULL)
+ pos += fp_->_ptr - fp_->_base;
+ }
+ return pos;
+ }
+#endif
+
+#if defined __SL64 && defined __SCLE /* Cygwin */
+ if ((fp->_flags & __SL64) == 0)
+ {
+ /* Cygwin 1.5.0 through 1.5.24 failed to open stdin in 64-bit
+ mode; but has an ftello that requires 64-bit mode. */
+ FILE *tmp = fopen ("/dev/null", "r");
+ if (!tmp)
+ return -1;
+ fp->_flags |= __SL64;
+ fp->_seek64 = tmp->_seek64;
+ fclose (tmp);
+ }
+#endif
+ return ftello (fp);
+}
diff --git a/lib/gai_strerror.c b/lib/gai_strerror.c
index 92b4dd054..cc6f9c062 100644
--- a/lib/gai_strerror.c
+++ b/lib/gai_strerror.c
@@ -32,6 +32,22 @@
# 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;
@@ -71,6 +87,7 @@ gai_strerror (int code)
return _("Unknown error");
}
-#ifdef _LIBC
+# ifdef _LIBC
libc_hidden_def (gai_strerror)
-#endif
+# endif
+#endif /* !HAVE_DECL_GAI_STRERROR */
diff --git a/lib/getsockopt.c b/lib/getsockopt.c
index 7c83f01aa..8433ab921 100644
--- a/lib/getsockopt.c
+++ b/lib/getsockopt.c
@@ -46,7 +46,8 @@ rpl_getsockopt (int fd, int level, int optname, void *optval, socklen_t *optlen)
int milliseconds_len = sizeof (int);
struct timeval tv;
size_t n;
- r = getsockopt (sock, level, optname, &milliseconds, &milliseconds_len);
+ r = getsockopt (sock, level, optname, (char *) &milliseconds,
+ &milliseconds_len);
tv.tv_sec = milliseconds / 1000;
tv.tv_usec = (milliseconds - 1000 * tv.tv_sec) * 1000;
n = sizeof (struct timeval);
diff --git a/lib/iconv.in.h b/lib/iconv.in.h
index 6cb698e92..66fc8ef5d 100644
--- a/lib/iconv.in.h
+++ b/lib/iconv.in.h
@@ -16,7 +16,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-#ifndef _GL_ICONV_H
+#ifndef _@GUARD_PREFIX@_ICONV_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -26,8 +26,8 @@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_ICONV_H@
-#ifndef _GL_ICONV_H
-#define _GL_ICONV_H
+#ifndef _@GUARD_PREFIX@_ICONV_H
+#define _@GUARD_PREFIX@_ICONV_H
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -107,5 +107,5 @@ _GL_CXXALIASWARN (iconv_close);
#endif
-#endif /* _GL_ICONV_H */
-#endif /* _GL_ICONV_H */
+#endif /* _@GUARD_PREFIX@_ICONV_H */
+#endif /* _@GUARD_PREFIX@_ICONV_H */
diff --git a/lib/locale.in.h b/lib/locale.in.h
index 02db8dadb..da722ab9c 100644
--- a/lib/locale.in.h
+++ b/lib/locale.in.h
@@ -14,7 +14,7 @@
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/>. */
-#ifndef _GL_LOCALE_H
+#ifndef _@GUARD_PREFIX@_LOCALE_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -24,8 +24,8 @@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_LOCALE_H@
-#ifndef _GL_LOCALE_H
-#define _GL_LOCALE_H
+#ifndef _@GUARD_PREFIX@_LOCALE_H
+#define _@GUARD_PREFIX@_LOCALE_H
/* NetBSD 5.0 mis-defines NULL. */
#include <stddef.h>
@@ -92,5 +92,5 @@ _GL_WARN_ON_USE (duplocale, "duplocale is buggy on some glibc systems - "
# endif
#endif
-#endif /* _GL_LOCALE_H */
-#endif /* _GL_LOCALE_H */
+#endif /* _@GUARD_PREFIX@_LOCALE_H */
+#endif /* _@GUARD_PREFIX@_LOCALE_H */
diff --git a/lib/lseek.c b/lib/lseek.c
new file mode 100644
index 000000000..32e8bd17c
--- /dev/null
+++ b/lib/lseek.c
@@ -0,0 +1,62 @@
+/* An lseek() function that detects pipes.
+ Copyright (C) 2007, 2009-2011 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. */
+
+#include <config.h>
+
+/* Specification. */
+#include <unistd.h>
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+/* Windows platforms. */
+/* Get GetFileType. */
+# include <windows.h>
+#else
+# include <sys/stat.h>
+#endif
+#include <errno.h>
+
+#undef lseek
+
+off_t
+rpl_lseek (int fd, off_t offset, int whence)
+{
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+ /* mingw lseek mistakenly succeeds on pipes, sockets, and terminals. */
+ HANDLE h = (HANDLE) _get_osfhandle (fd);
+ if (h == INVALID_HANDLE_VALUE)
+ {
+ errno = EBADF;
+ return -1;
+ }
+ if (GetFileType (h) != FILE_TYPE_DISK)
+ {
+ errno = ESPIPE;
+ return -1;
+ }
+#else
+ /* BeOS lseek mistakenly succeeds on pipes... */
+ struct stat statbuf;
+ if (fstat (fd, &statbuf) < 0)
+ return -1;
+ if (!S_ISREG (statbuf.st_mode))
+ {
+ errno = ESPIPE;
+ return -1;
+ }
+#endif
+ return lseek (fd, offset, whence);
+}
diff --git a/lib/math.in.h b/lib/math.in.h
index 7ff01026b..e926a1851 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -15,7 +15,7 @@
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/>. */
-#ifndef _GL_MATH_H
+#ifndef _@GUARD_PREFIX@_MATH_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -25,8 +25,8 @@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_MATH_H@
-#ifndef _GL_MATH_H
-#define _GL_MATH_H
+#ifndef _@GUARD_PREFIX@_MATH_H
+#define _@GUARD_PREFIX@_MATH_H
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -806,5 +806,5 @@ _GL_WARN_REAL_FLOATING_DECL (signbit);
#endif
-#endif /* _GL_MATH_H */
-#endif /* _GL_MATH_H */
+#endif /* _@GUARD_PREFIX@_MATH_H */
+#endif /* _@GUARD_PREFIX@_MATH_H */
diff --git a/lib/netdb.in.h b/lib/netdb.in.h
index 5b64e486b..3077b9fbd 100644
--- a/lib/netdb.in.h
+++ b/lib/netdb.in.h
@@ -20,7 +20,7 @@
It is intended to provide definitions and prototypes needed by an
application. */
-#ifndef _GL_NETDB_H
+#ifndef _@GUARD_PREFIX@_NETDB_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -34,13 +34,15 @@
#endif
-#ifndef _GL_NETDB_H
-#define _GL_NETDB_H
+#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. */
@@ -52,6 +54,10 @@
# 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
@@ -67,6 +73,11 @@ struct addrinfo
};
# define GNULIB_defined_struct_addrinfo 1
# endif
+
+# ifdef __cplusplus
+}
+# endif
+
# endif
/* Possible values for `ai_flags' field in `addrinfo' structure. */
@@ -153,37 +164,67 @@ struct addrinfo
socket addresses.
For more details, see the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */
-extern int getaddrinfo (const char *restrict nodename,
- const char *restrict servname,
- const struct addrinfo *restrict hints,
- struct addrinfo **restrict res)
- _GL_ARG_NONNULL ((4));
+_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>. */
-extern void freeaddrinfo (struct addrinfo *ai) _GL_ARG_NONNULL ((1));
+_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 !@HAVE_DECL_GAI_STRERROR@
+# 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>. */
-extern const char *gai_strerror (int ecode);
+_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>. */
-extern int getnameinfo (const struct sockaddr *restrict sa, socklen_t salen,
+_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_ARG_NONNULL ((1));
-# endif
+ int flags));
+_GL_CXXALIASWARN (getnameinfo);
/* Possible flags for getnameinfo. */
# ifndef NI_NUMERICHOST
@@ -221,5 +262,5 @@ _GL_WARN_ON_USE (getnameinfo, "getnameinfo is unportable - "
#endif
-#endif /* _GL_NETDB_H */
-#endif /* _GL_NETDB_H */
+#endif /* _@GUARD_PREFIX@_NETDB_H */
+#endif /* _@GUARD_PREFIX@_NETDB_H */
diff --git a/lib/netinet_in.in.h b/lib/netinet_in.in.h
index 11c587a47..97df933be 100644
--- a/lib/netinet_in.in.h
+++ b/lib/netinet_in.in.h
@@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-#ifndef _GL_NETINET_IN_H
+#ifndef _@GUARD_PREFIX@_NETINET_IN_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -33,8 +33,8 @@
#endif
-#ifndef _GL_NETINET_IN_H
-#define _GL_NETINET_IN_H
+#ifndef _@GUARD_PREFIX@_NETINET_IN_H
+#define _@GUARD_PREFIX@_NETINET_IN_H
#if !@HAVE_NETINET_IN_H@
@@ -44,5 +44,5 @@
#endif
-#endif /* _GL_NETINET_IN_H */
-#endif /* _GL_NETINET_IN_H */
+#endif /* _@GUARD_PREFIX@_NETINET_IN_H */
+#endif /* _@GUARD_PREFIX@_NETINET_IN_H */
diff --git a/lib/open.c b/lib/open.c
new file mode 100644
index 000000000..480017750
--- /dev/null
+++ b/lib/open.c
@@ -0,0 +1,176 @@
+/* Open a descriptor to a file.
+ Copyright (C) 2007-2011 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
+
+#include <config.h>
+
+/* Get the original definition of open. It might be defined as a macro. */
+#define __need_system_fcntl_h
+#include <fcntl.h>
+#undef __need_system_fcntl_h
+#include <sys/types.h>
+
+static inline int
+orig_open (const char *filename, int flags, mode_t mode)
+{
+ return open (filename, flags, mode);
+}
+
+/* Specification. */
+#include <fcntl.h>
+
+#include <errno.h>
+#include <stdarg.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#ifndef REPLACE_OPEN_DIRECTORY
+# define REPLACE_OPEN_DIRECTORY 0
+#endif
+
+int
+open (const char *filename, int flags, ...)
+{
+ mode_t mode;
+ int fd;
+
+ mode = 0;
+ if (flags & O_CREAT)
+ {
+ va_list arg;
+ va_start (arg, flags);
+
+ /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4
+ creates crashing code when 'mode_t' is smaller than 'int'. */
+ mode = va_arg (arg, PROMOTED_MODE_T);
+
+ va_end (arg);
+ }
+
+#if GNULIB_defined_O_NONBLOCK
+ /* The only known platform that lacks O_NONBLOCK is mingw, but it
+ also lacks named pipes and Unix sockets, which are the only two
+ file types that require non-blocking handling in open().
+ Therefore, it is safe to ignore O_NONBLOCK here. It is handy
+ that mingw also lacks openat(), so that is also covered here. */
+ flags &= ~O_NONBLOCK;
+#endif
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+ if (strcmp (filename, "/dev/null") == 0)
+ filename = "NUL";
+#endif
+
+#if OPEN_TRAILING_SLASH_BUG
+ /* If the filename ends in a slash and one of O_CREAT, O_WRONLY, O_RDWR
+ is specified, then fail.
+ Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html>
+ says that
+ "A pathname that contains at least one non-slash character and that
+ ends with one or more trailing slashes shall be resolved as if a
+ single dot character ( '.' ) were appended to the pathname."
+ and
+ "The special filename dot shall refer to the directory specified by
+ its predecessor."
+ If the named file already exists as a directory, then
+ - if O_CREAT is specified, open() must fail because of the semantics
+ of O_CREAT,
+ - if O_WRONLY or O_RDWR is specified, open() must fail because POSIX
+ <http://www.opengroup.org/susv3/functions/open.html> says that it
+ fails with errno = EISDIR in this case.
+ If the named file does not exist or does not name a directory, then
+ - if O_CREAT is specified, open() must fail since open() cannot create
+ directories,
+ - if O_WRONLY or O_RDWR is specified, open() must fail because the
+ file does not contain a '.' directory. */
+ if (flags & (O_CREAT | O_WRONLY | O_RDWR))
+ {
+ size_t len = strlen (filename);
+ if (len > 0 && filename[len - 1] == '/')
+ {
+ errno = EISDIR;
+ return -1;
+ }
+ }
+#endif
+
+ fd = orig_open (filename, flags, mode);
+
+#if REPLACE_FCHDIR
+ /* Implementing fchdir and fdopendir requires the ability to open a
+ directory file descriptor. If open doesn't support that (as on
+ mingw), we use a dummy file that behaves the same as directories
+ on Linux (ie. always reports EOF on attempts to read()), and
+ override fstat() in fchdir.c to hide the fact that we have a
+ dummy. */
+ if (REPLACE_OPEN_DIRECTORY && fd < 0 && errno == EACCES
+ && ((flags & O_ACCMODE) == O_RDONLY
+ || (O_SEARCH != O_RDONLY && (flags & O_ACCMODE) == O_SEARCH)))
+ {
+ struct stat statbuf;
+ if (stat (filename, &statbuf) == 0 && S_ISDIR (statbuf.st_mode))
+ {
+ /* Maximum recursion depth of 1. */
+ fd = open ("/dev/null", flags, mode);
+ if (0 <= fd)
+ fd = _gl_register_fd (fd, filename);
+ }
+ else
+ errno = EACCES;
+ }
+#endif
+
+#if OPEN_TRAILING_SLASH_BUG
+ /* If the filename ends in a slash and fd does not refer to a directory,
+ then fail.
+ Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html>
+ says that
+ "A pathname that contains at least one non-slash character and that
+ ends with one or more trailing slashes shall be resolved as if a
+ single dot character ( '.' ) were appended to the pathname."
+ and
+ "The special filename dot shall refer to the directory specified by
+ its predecessor."
+ If the named file without the slash is not a directory, open() must fail
+ with ENOTDIR. */
+ if (fd >= 0)
+ {
+ /* We know len is positive, since open did not fail with ENOENT. */
+ size_t len = strlen (filename);
+ if (filename[len - 1] == '/')
+ {
+ struct stat statbuf;
+
+ if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode))
+ {
+ close (fd);
+ errno = ENOTDIR;
+ return -1;
+ }
+ }
+ }
+#endif
+
+#if REPLACE_FCHDIR
+ if (!REPLACE_OPEN_DIRECTORY && 0 <= fd)
+ fd = _gl_register_fd (fd, filename);
+#endif
+
+ return fd;
+}
diff --git a/lib/pipe2.c b/lib/pipe2.c
new file mode 100644
index 000000000..e1884fadd
--- /dev/null
+++ b/lib/pipe2.c
@@ -0,0 +1,151 @@
+/* Create a pipe, with specific opening flags.
+ Copyright (C) 2009-2011 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. */
+
+#include <config.h>
+
+/* Specification. */
+#include <unistd.h>
+
+#include <errno.h>
+#include <fcntl.h>
+
+#include "binary-io.h"
+#include "verify.h"
+
+#if GNULIB_defined_O_NONBLOCK
+# include "nonblocking.h"
+#endif
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+/* Native Woe32 API. */
+
+# include <io.h>
+
+#endif
+
+int
+pipe2 (int fd[2], int flags)
+{
+#if HAVE_PIPE2
+# undef pipe2
+ /* Try the system call first, if it exists. (We may be running with a glibc
+ that has the function but with an older kernel that lacks it.) */
+ {
+ /* Cache the information whether the system call really exists. */
+ static int have_pipe2_really; /* 0 = unknown, 1 = yes, -1 = no */
+ if (have_pipe2_really >= 0)
+ {
+ int result = pipe2 (fd, flags);
+ if (!(result < 0 && errno == ENOSYS))
+ {
+ have_pipe2_really = 1;
+ return result;
+ }
+ have_pipe2_really = -1;
+ }
+ }
+#endif
+
+ /* Check the supported flags. */
+ if ((flags & ~(O_CLOEXEC | O_NONBLOCK | O_BINARY | O_TEXT)) != 0)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+/* Native Woe32 API. */
+
+ if (_pipe (fd, 4096, flags & ~O_NONBLOCK) < 0)
+ return -1;
+
+ /* O_NONBLOCK handling.
+ On native Windows platforms, O_NONBLOCK is defined by gnulib. Use the
+ functions defined by the gnulib module 'nonblocking'. */
+# if GNULIB_defined_O_NONBLOCK
+ if (flags & O_NONBLOCK)
+ {
+ if (set_nonblocking_flag (fd[0], true) != 0
+ || set_nonblocking_flag (fd[1], true) != 0)
+ goto fail;
+ }
+# else
+ verify (O_NONBLOCK == 0);
+# endif
+
+ return 0;
+
+#else
+/* Unix API. */
+
+ if (pipe (fd) < 0)
+ return -1;
+
+ /* POSIX <http://www.opengroup.org/onlinepubs/9699919799/functions/pipe.html>
+ says that initially, the O_NONBLOCK and FD_CLOEXEC flags are cleared on
+ both fd[0] and fd[1]. */
+
+ /* O_NONBLOCK handling.
+ On Unix platforms, O_NONBLOCK is defined by the system. Use fcntl(). */
+ if (flags & O_NONBLOCK)
+ {
+ int fcntl_flags;
+
+ if ((fcntl_flags = fcntl (fd[1], F_GETFL, 0)) < 0
+ || fcntl (fd[1], F_SETFL, fcntl_flags | O_NONBLOCK) == -1
+ || (fcntl_flags = fcntl (fd[0], F_GETFL, 0)) < 0
+ || fcntl (fd[0], F_SETFL, fcntl_flags | O_NONBLOCK) == -1)
+ goto fail;
+ }
+
+ if (flags & O_CLOEXEC)
+ {
+ int fcntl_flags;
+
+ if ((fcntl_flags = fcntl (fd[1], F_GETFD, 0)) < 0
+ || fcntl (fd[1], F_SETFD, fcntl_flags | FD_CLOEXEC) == -1
+ || (fcntl_flags = fcntl (fd[0], F_GETFD, 0)) < 0
+ || fcntl (fd[0], F_SETFD, fcntl_flags | FD_CLOEXEC) == -1)
+ goto fail;
+ }
+
+# if O_BINARY
+ if (flags & O_BINARY)
+ {
+ setmode (fd[1], O_BINARY);
+ setmode (fd[0], O_BINARY);
+ }
+ else if (flags & O_TEXT)
+ {
+ setmode (fd[1], O_TEXT);
+ setmode (fd[0], O_TEXT);
+ }
+# endif
+
+ return 0;
+
+#endif
+
+ fail:
+ {
+ int saved_errno = errno;
+ close (fd[0]);
+ close (fd[1]);
+ errno = saved_errno;
+ return -1;
+ }
+}
diff --git a/lib/sockets.c b/lib/sockets.c
index 25ab97f3d..432f3b584 100644
--- a/lib/sockets.c
+++ b/lib/sockets.c
@@ -37,6 +37,10 @@ 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;
diff --git a/lib/stat-time.h b/lib/stat-time.h
index 47a288a7e..2d0191096 100644
--- a/lib/stat-time.h
+++ b/lib/stat-time.h
@@ -142,7 +142,7 @@ get_stat_mtime (struct stat const *st)
}
/* Return *ST's birth time, if available; otherwise return a value
- with negative tv_nsec. */
+ with tv_sec and tv_nsec both equal to -1. */
static inline struct timespec
get_stat_birthtime (struct stat const *st)
{
@@ -161,7 +161,7 @@ get_stat_birthtime (struct stat const *st)
t.tv_sec = st->st_ctime;
t.tv_nsec = 0;
#else
- /* Birth time is not supported. Set tv_sec to avoid undefined behavior. */
+ /* Birth time is not supported. */
t.tv_sec = -1;
t.tv_nsec = -1;
/* Avoid a "parameter unused" warning. */
@@ -175,10 +175,12 @@ get_stat_birthtime (struct stat const *st)
using zero. Attempt to work around this problem. Alas, this can
report failure even for valid time stamps. Also, NetBSD
sometimes returns junk in the birth time fields; work around this
- bug if it is detected. There's no need to detect negative
- tv_nsec junk as negative tv_nsec already indicates an error. */
- if (t.tv_sec == 0 || 1000000000 <= t.tv_nsec)
- t.tv_nsec = -1;
+ bug if it is detected. */
+ if (! (t.tv_sec && 0 <= t.tv_nsec && t.tv_nsec < 1000000000))
+ {
+ t.tv_sec = -1;
+ t.tv_nsec = -1;
+ }
#endif
return t;
diff --git a/lib/stddef.in.h b/lib/stddef.in.h
index 70f5a8678..1668addbe 100644
--- a/lib/stddef.in.h
+++ b/lib/stddef.in.h
@@ -38,9 +38,9 @@
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)
+# if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T)
# ifdef __need_wint_t
-# undef _GL_STDDEF_H
+# undef _@GUARD_PREFIX@_STDDEF_H
# define _GL_STDDEF_WINT_T
# endif
# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
@@ -49,14 +49,14 @@
#else
/* Normal invocation convention. */
-# ifndef _GL_STDDEF_H
+# ifndef _@GUARD_PREFIX@_STDDEF_H
/* The include_next requires a split double-inclusion guard. */
# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
-# ifndef _GL_STDDEF_H
-# define _GL_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@
@@ -82,6 +82,6 @@
# define wchar_t int
#endif
-# endif /* _GL_STDDEF_H */
-# endif /* _GL_STDDEF_H */
+# endif /* _@GUARD_PREFIX@_STDDEF_H */
+# endif /* _@GUARD_PREFIX@_STDDEF_H */
#endif /* __need_XXX */
diff --git a/lib/stdint.in.h b/lib/stdint.in.h
index b60e9cc0b..547f6840a 100644
--- a/lib/stdint.in.h
+++ b/lib/stdint.in.h
@@ -21,7 +21,7 @@
* <http://www.opengroup.org/susv3xbd/stdint.h.html>
*/
-#ifndef _GL_STDINT_H
+#ifndef _@GUARD_PREFIX@_STDINT_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -52,13 +52,13 @@
/* 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
- _GL_STDINT_H is defined.
+ _@GUARD_PREFIX@_STDINT_H is defined.
The include_next requires a split double-inclusion guard. */
# @INCLUDE_NEXT@ @NEXT_STDINT_H@
#endif
-#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
-#define _GL_STDINT_H
+#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>).
@@ -93,7 +93,7 @@
#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
-/* Minimum and maximum values for a integer type under the usual assumption.
+/* 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. */
@@ -588,5 +588,5 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
-#endif /* _GL_STDINT_H */
-#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
+#endif /* _@GUARD_PREFIX@_STDINT_H */
+#endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h
new file mode 100644
index 000000000..03f1cf019
--- /dev/null
+++ b/lib/stdio-impl.h
@@ -0,0 +1,110 @@
+/* Implementation details of FILE streams.
+ Copyright (C) 2007-2008, 2010-2011 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/>. */
+
+/* Many stdio implementations have the same logic and therefore can share
+ the same implementation of stdio extension API, except that some fields
+ have different naming conventions, or their access requires some casts. */
+
+
+/* BSD stdio derived implementations. */
+
+#if defined __NetBSD__ /* NetBSD */
+/* Get __NetBSD_Version__. */
+# include <sys/param.h>
+#endif
+
+#if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
+
+# if defined __DragonFly__ /* DragonFly */
+ /* See <http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdio/priv_stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */
+# define fp_ ((struct { struct __FILE_public pub; \
+ struct { unsigned char *_base; int _size; } _bf; \
+ void *cookie; \
+ void *_close; \
+ void *_read; \
+ void *_seek; \
+ void *_write; \
+ struct { unsigned char *_base; int _size; } _ub; \
+ int _ur; \
+ unsigned char _ubuf[3]; \
+ unsigned char _nbuf[1]; \
+ struct { unsigned char *_base; int _size; } _lb; \
+ int _blksize; \
+ fpos_t _offset; \
+ /* More fields, not relevant here. */ \
+ } *) fp)
+ /* See <http://www.dragonflybsd.org/cvsweb/src/include/stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */
+# define _p pub._p
+# define _flags pub._flags
+# define _r pub._r
+# define _w pub._w
+# else
+# define fp_ fp
+# endif
+
+# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ /* NetBSD >= 1.5ZA, OpenBSD */
+ /* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
+ and <http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */
+ struct __sfileext
+ {
+ struct __sbuf _ub; /* ungetc buffer */
+ /* More fields, not relevant here. */
+ };
+# define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub
+# else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, MacOS X, Cygwin */
+# define fp_ub fp_->_ub
+# endif
+
+# define HASUB(fp) (fp_ub._base != NULL)
+
+#endif
+
+
+/* SystemV derived implementations. */
+
+#ifdef __TANDEM /* NonStop Kernel */
+# ifndef _IOERR
+/* These values were determined by the program 'stdioext-flags' at
+ <http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00165.html>. */
+# define _IOERR 0x40
+# define _IOREAD 0x80
+# define _IOWRT 0x4
+# define _IORW 0x100
+# endif
+#endif
+
+#if defined _IOERR
+
+# if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */
+# define fp_ ((struct { unsigned char *_ptr; \
+ unsigned char *_base; \
+ unsigned char *_end; \
+ long _cnt; \
+ int _file; \
+ unsigned int _flag; \
+ } *) fp)
+# else
+# define fp_ fp
+# endif
+
+# if defined _SCO_DS /* OpenServer */
+# define _cnt __cnt
+# define _ptr __ptr
+# define _base __base
+# define _flag __flag
+# endif
+
+#endif
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index b4469a9b8..53d2a6cdf 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -35,7 +35,7 @@
#else
/* Normal invocation convention. */
-#ifndef _GL_STDIO_H
+#ifndef _@GUARD_PREFIX@_STDIO_H
#define _GL_ALREADY_INCLUDING_STDIO_H
@@ -44,8 +44,8 @@
#undef _GL_ALREADY_INCLUDING_STDIO_H
-#ifndef _GL_STDIO_H
-#define _GL_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>
@@ -461,25 +461,6 @@ _GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)
_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
# endif
_GL_CXXALIASWARN (fseeko);
-# if (@REPLACE_FSEEKO@ || !@HAVE_FSEEKO@) && !@GNULIB_FSEEK@
- /* Provide an fseek function that is consistent with fseeko. */
- /* In order to avoid that fseek gets defined as a macro here, the
- developer can request the 'fseek' module. */
-# if !GNULIB_defined_fseek_function
-# undef fseek
-# define fseek rpl_fseek
-static inline int _GL_ARG_NONNULL ((1))
-rpl_fseek (FILE *fp, long offset, int whence)
-{
-# if @REPLACE_FSEEKO@
- return rpl_fseeko (fp, offset, whence);
-# else
- return fseeko (fp, offset, whence);
-# endif
-}
-# define GNULIB_defined_fseek_function 1
-# endif
-# endif
#elif defined GNULIB_POSIXCHECK
# define _GL_FSEEK_WARN /* Category 1, above. */
# undef fseek
@@ -539,25 +520,6 @@ _GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
# endif
_GL_CXXALIASWARN (ftello);
-# if (@REPLACE_FTELLO@ || !@HAVE_FTELLO@) && !@GNULIB_FTELL@
- /* Provide an ftell function that is consistent with ftello. */
- /* In order to avoid that ftell gets defined as a macro here, the
- developer can request the 'ftell' module. */
-# if !GNULIB_defined_ftell_function
-# undef ftell
-# define ftell rpl_ftell
-static inline long _GL_ARG_NONNULL ((1))
-rpl_ftell (FILE *f)
-{
-# if @REPLACE_FTELLO@
- return rpl_ftello (f);
-# else
- return ftello (f);
-# endif
-}
-# define GNULIB_defined_ftell_function 1
-# endif
-# endif
#elif defined GNULIB_POSIXCHECK
# define _GL_FTELL_WARN /* Category 1, above. */
# undef ftell
@@ -1345,6 +1307,6 @@ _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
#endif
-#endif /* _GL_STDIO_H */
-#endif /* _GL_STDIO_H */
+#endif /* _@GUARD_PREFIX@_STDIO_H */
+#endif /* _@GUARD_PREFIX@_STDIO_H */
#endif
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 9651e94cd..bced0037f 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -28,13 +28,13 @@
#else
/* Normal invocation convention. */
-#ifndef _GL_STDLIB_H
+#ifndef _@GUARD_PREFIX@_STDLIB_H
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
-#ifndef _GL_STDLIB_H
-#define _GL_STDLIB_H
+#ifndef _@GUARD_PREFIX@_STDLIB_H
+#define _@GUARD_PREFIX@_STDLIB_H
/* NetBSD 5.0 mis-defines NULL. */
#include <stddef.h>
@@ -81,8 +81,9 @@ struct random_data
# endif
#endif
-#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
+#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
/* On MacOS X 10.3, only <unistd.h> declares mkstemp. */
+/* On MacOS 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>
@@ -760,6 +761,6 @@ _GL_CXXALIASWARN (wctomb);
#endif
-#endif /* _GL_STDLIB_H */
-#endif /* _GL_STDLIB_H */
+#endif /* _@GUARD_PREFIX@_STDLIB_H */
+#endif /* _@GUARD_PREFIX@_STDLIB_H */
#endif
diff --git a/lib/string.in.h b/lib/string.in.h
index 9eb0d5c30..3a613fca0 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -16,7 +16,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-#ifndef _GL_STRING_H
+#ifndef _@GUARD_PREFIX@_STRING_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -26,8 +26,8 @@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_STRING_H@
-#ifndef _GL_STRING_H
-#define _GL_STRING_H
+#ifndef _@GUARD_PREFIX@_STRING_H
+#define _@GUARD_PREFIX@_STRING_H
/* NetBSD 5.0 mis-defines NULL. */
#include <stddef.h>
@@ -736,9 +736,9 @@ _GL_CXXALIASWARN (mbschr);
and return a pointer to it. Return NULL if C is not found in STRING.
Unlike strrchr(), this function works correctly in multibyte locales with
encodings such as GB18030. */
-# if defined __hpux
+# if defined __hpux || defined __INTERIX
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */
+# define mbsrchr rpl_mbsrchr /* avoid collision with system function */
# endif
_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c)
_GL_ARG_NONNULL ((1)));
@@ -977,5 +977,5 @@ _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
#endif
-#endif /* _GL_STRING_H */
-#endif /* _GL_STRING_H */
+#endif /* _@GUARD_PREFIX@_STRING_H */
+#endif /* _@GUARD_PREFIX@_STRING_H */
diff --git a/lib/sys_file.in.h b/lib/sys_file.in.h
index 2526ea68e..e518dfcc4 100644
--- a/lib/sys_file.in.h
+++ b/lib/sys_file.in.h
@@ -18,7 +18,7 @@
/* Written by Richard W.M. Jones. */
-#ifndef _GL_SYS_FILE_H
+#ifndef _@GUARD_PREFIX@_SYS_FILE_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -30,8 +30,8 @@
# @INCLUDE_NEXT@ @NEXT_SYS_FILE_H@
#endif
-#ifndef _GL_SYS_FILE_H
-#define _GL_SYS_FILE_H
+#ifndef _@GUARD_PREFIX@_SYS_FILE_H
+#define _@GUARD_PREFIX@_SYS_FILE_H
#ifndef LOCK_SH
/* Operations for the 'flock' call (same as Linux kernel constants). */
@@ -60,5 +60,5 @@ _GL_WARN_ON_USE (flock, "flock is unportable - "
#endif
-#endif /* _GL_SYS_FILE_H */
-#endif /* _GL_SYS_FILE_H */
+#endif /* _@GUARD_PREFIX@_SYS_FILE_H */
+#endif /* _@GUARD_PREFIX@_SYS_FILE_H */
diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h
index c13f33663..d04357c0a 100644
--- a/lib/sys_socket.in.h
+++ b/lib/sys_socket.in.h
@@ -40,7 +40,7 @@
#else
/* Normal invocation convention. */
-#ifndef _GL_SYS_SOCKET_H
+#ifndef _@GUARD_PREFIX@_SYS_SOCKET_H
#if @HAVE_SYS_SOCKET_H@
@@ -61,8 +61,8 @@
#endif
-#ifndef _GL_SYS_SOCKET_H
-#define _GL_SYS_SOCKET_H
+#ifndef _@GUARD_PREFIX@_SYS_SOCKET_H
+#define _@GUARD_PREFIX@_SYS_SOCKET_H
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -108,6 +108,12 @@ struct sockaddr_storage
#endif
+/* Get struct iovec. */
+/* But avoid namespace pollution on glibc systems. */
+#if ! defined __GLIBC__
+# include <sys/uio.h>
+#endif
+
#if @HAVE_SYS_SOCKET_H@
/* A platform that has <sys/socket.h>. */
@@ -176,9 +182,6 @@ typedef int socklen_t;
# endif
-/* For struct iovec */
-# include <sys/uio.h>
-
/* Rudimentary 'struct msghdr'; this works as long as you don't try to
access msg_control or msg_controllen. */
struct msghdr {
@@ -221,7 +224,7 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
/* Wrap everything else to use libc file descriptors for sockets. */
-#if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H
+#if @HAVE_WINSOCK2_H@ && !defined _@GUARD_PREFIX@_UNISTD_H
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef close
# define close close_used_without_including_unistd_h
@@ -231,7 +234,7 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
# endif
#endif
-#if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H
+#if @HAVE_WINSOCK2_H@ && !defined _@GUARD_PREFIX@_UNISTD_H
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef gethostname
# define gethostname gethostname_used_without_including_unistd_h
@@ -673,6 +676,6 @@ _GL_WARN_ON_USE (accept4, "accept4 is unportable - "
# endif
#endif
-#endif /* _GL_SYS_SOCKET_H */
-#endif /* _GL_SYS_SOCKET_H */
+#endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */
+#endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */
#endif
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index cc5ab1b37..a669edd97 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -34,7 +34,7 @@
#else
/* Normal invocation convention. */
-#ifndef _GL_SYS_STAT_H
+#ifndef _@GUARD_PREFIX@_SYS_STAT_H
/* Get nlink_t. */
#include <sys/types.h>
@@ -45,8 +45,8 @@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
-#ifndef _GL_SYS_STAT_H
-#define _GL_SYS_STAT_H
+#ifndef _@GUARD_PREFIX@_SYS_STAT_H
+#define _@GUARD_PREFIX@_SYS_STAT_H
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -653,6 +653,6 @@ _GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
#endif
-#endif /* _GL_SYS_STAT_H */
-#endif /* _GL_SYS_STAT_H */
+#endif /* _@GUARD_PREFIX@_SYS_STAT_H */
+#endif /* _@GUARD_PREFIX@_SYS_STAT_H */
#endif
diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h
index 1dbc0f210..7d829416d 100644
--- a/lib/sys_time.in.h
+++ b/lib/sys_time.in.h
@@ -23,7 +23,7 @@
#endif
@PRAGMA_COLUMNS@
-#if defined _GL_SYS_TIME_H
+#if defined _@GUARD_PREFIX@_SYS_TIME_H
/* Simply delegate to the system's header, without adding anything. */
# if @HAVE_SYS_TIME_H@
@@ -32,7 +32,7 @@
#else
-# define _GL_SYS_TIME_H
+# define _@GUARD_PREFIX@_SYS_TIME_H
# if @HAVE_SYS_TIME_H@
# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
@@ -98,4 +98,4 @@ _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
# endif
# endif
-#endif /* _GL_SYS_TIME_H */
+#endif /* _@GUARD_PREFIX@_SYS_TIME_H */
diff --git a/lib/sys_uio.in.h b/lib/sys_uio.in.h
index 28aea2838..b0f762de5 100644
--- a/lib/sys_uio.in.h
+++ b/lib/sys_uio.in.h
@@ -20,30 +20,45 @@
# endif
@PRAGMA_COLUMNS@
-#ifndef _GL_SYS_UIO_H
+#ifndef _@GUARD_PREFIX@_SYS_UIO_H
#if @HAVE_SYS_UIO_H@
+/* On OpenBSD 4.4, <sys/uio.h> assumes prior inclusion of <sys/types.h>. */
+# include <sys/types.h>
+
/* The include_next requires a split double-inclusion guard. */
# @INCLUDE_NEXT@ @NEXT_SYS_UIO_H@
#endif
-#ifndef _GL_SYS_UIO_H
-#define _GL_SYS_UIO_H
+#ifndef _@GUARD_PREFIX@_SYS_UIO_H
+#define _@GUARD_PREFIX@_SYS_UIO_H
#if !@HAVE_SYS_UIO_H@
/* A platform that lacks <sys/uio.h>. */
/* Get 'ssize_t'. */
# include <sys/types.h>
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+# if !GNULIB_defined_struct_iovec
/* All known platforms that lack <sys/uio.h> also lack any declaration
of struct iovec in any other header. */
struct iovec {
void *iov_base;
size_t iov_len;
};
+# define GNULIB_defined_struct_iovec 1
+# endif
+
+# ifdef __cplusplus
+}
+# endif
+
#endif
-#endif /* _GL_SYS_UIO_H */
-#endif /* _GL_SYS_UIO_H */
+#endif /* _@GUARD_PREFIX@_SYS_UIO_H */
+#endif /* _@GUARD_PREFIX@_SYS_UIO_H */
diff --git a/lib/time.in.h b/lib/time.in.h
index afccc78c0..a38fd13e9 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -28,13 +28,13 @@
without adding our own declarations. */
#if (defined __need_time_t || defined __need_clock_t \
|| defined __need_timespec \
- || defined _GL_TIME_H)
+ || defined _@GUARD_PREFIX@_TIME_H)
# @INCLUDE_NEXT@ @NEXT_TIME_H@
#else
-# define _GL_TIME_H
+# define _@GUARD_PREFIX@_TIME_H
# @INCLUDE_NEXT@ @NEXT_TIME_H@
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 1bbab0fe1..2101bced5 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -36,7 +36,7 @@
# define _GL_WINSOCK2_H_WITNESS
/* Normal invocation. */
-#elif !defined _GL_UNISTD_H
+#elif !defined _@GUARD_PREFIX@_UNISTD_H
/* The include_next requires a split double-inclusion guard. */
#if @HAVE_UNISTD_H@
@@ -51,8 +51,8 @@
# undef _GL_INCLUDING_WINSOCK2_H
#endif
-#if !defined _GL_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
-#define _GL_UNISTD_H
+#if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
+#define _@GUARD_PREFIX@_UNISTD_H
/* NetBSD 5.0 mis-defines NULL. Also get size_t. */
#include <stddef.h>
@@ -120,7 +120,7 @@
#if @GNULIB_GETHOSTNAME@
/* Get all possible declarations of gethostname(). */
# if @UNISTD_H_HAVE_WINSOCK2_H@
-# if !defined _GL_SYS_SOCKET_H
+# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef socket
# define socket socket_used_without_including_sys_socket_h
@@ -181,7 +181,7 @@
"shutdown() used without including <sys/socket.h>");
# endif
# endif
-# if !defined _GL_SYS_SELECT_H
+# if !defined _@GUARD_PREFIX@_SYS_SELECT_H
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef select
# define select select_used_without_including_sys_select_h
@@ -871,6 +871,22 @@ _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
#endif
+#if @GNULIB_GROUP_MEMBER@
+/* Determine whether group id is in calling user's group list. */
+# if !@HAVE_GROUP_MEMBER@
+_GL_FUNCDECL_SYS (group_member, int, (gid_t gid));
+# endif
+_GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
+_GL_CXXALIASWARN (group_member);
+#elif defined GNULIB_POSIXCHECK
+# undef group_member
+# if HAVE_RAW_DECL_GROUP_MEMBER
+_GL_WARN_ON_USE (group_member, "group_member is unportable - "
+ "use gnulib module group-member for portability");
+# endif
+#endif
+
+
#if @GNULIB_LCHOWN@
/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
to GID (if GID is not -1). Do not follow symbolic links.
@@ -1400,5 +1416,5 @@ _GL_CXXALIASWARN (write);
#endif
-#endif /* _GL_UNISTD_H */
-#endif /* _GL_UNISTD_H */
+#endif /* _@GUARD_PREFIX@_UNISTD_H */
+#endif /* _@GUARD_PREFIX@_UNISTD_H */
diff --git a/lib/verify.h b/lib/verify.h
index 9fa5111b6..330ff3bd4 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -17,42 +17,37 @@
/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */
-#ifndef VERIFY_H
-# define VERIFY_H 1
+#ifndef _GL_VERIFY_H
+# define _GL_VERIFY_H
-/* Define HAVE__STATIC_ASSERT to 1 if _Static_assert works as per the
+
+/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert works as per the
C1X draft N1548 section 6.7.10. This is supported by GCC 4.6.0 and
later, in C mode, and its use here generates easier-to-read diagnostics
when verify (R) fails.
- Define HAVE_STATIC_ASSERT to 1 if static_assert works as per the
- C1X draft N1548 section 7.2 or the C++0X draft N3242 section 7.(4).
+ Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per the
+ C++0X draft N3242 section 7.(4).
This will likely be supported by future GCC versions, in C++ mode.
- For now, use this only with GCC. Eventually whether _Static_assert
- and static_assert works should be determined by 'configure'. */
+ Use this only with GCC. If we were willing to slow 'configure'
+ down we could also use it with other compilers, but since this
+ affects only the quality of diagnostics, why bother? */
# if (4 < __GNUC__ || (__GNUC__ == 4 && 6 <= __GNUC_MINOR__)) && !defined __cplusplus
-# define HAVE__STATIC_ASSERT 1
+# define _GL_HAVE__STATIC_ASSERT 1
# endif
/* The condition (99 < __GNUC__) is temporary, until we know about the
first G++ release that supports static_assert. */
# if (99 < __GNUC__) && defined __cplusplus
-# define HAVE_STATIC_ASSERT 1
+# define _GL_HAVE_STATIC_ASSERT 1
# endif
/* Each of these macros verifies that its argument R is nonzero. To
be portable, R should be an integer constant expression. Unlike
assert (R), there is no run-time overhead.
- There are two macros, since no single macro can be used in all
- contexts in C. verify_true (R) is for scalar contexts, including
- integer constant expression contexts. verify (R) is for declaration
- contexts, e.g., the top level.
-
- Symbols ending in "__" are private to this header.
-
If _Static_assert works, verify (R) uses it directly. Similarly,
- verify_true (R) works by packaging a _Static_assert inside a struct
+ _GL_VERIFY_TRUE works by packaging a _Static_assert inside a struct
that is an operand of sizeof.
The code below uses several ideas for C++ compilers, and for C
@@ -64,7 +59,9 @@
constant and nonnegative.
* Next this expression W is wrapped in a type
- struct verify_type__ { unsigned int verify_error_if_negative_size__: W; }.
+ struct _gl_verify_type {
+ unsigned int _gl_verify_error_if_negative: W;
+ }.
If W is negative, this yields a compile-time error. No compiler can
deal with a bit-field of negative size.
@@ -78,7 +75,7 @@
void function (int n) { verify (n < 0); }
- * For the verify macro, the struct verify_type__ will need to
+ * For the verify macro, the struct _gl_verify_type will need to
somehow be embedded into a declaration. To be portable, this
declaration must declare an object, a constant, a function, or a
typedef name. If the declared entity uses the type directly,
@@ -116,11 +113,11 @@
Which of the following alternatives can be used?
extern int dummy [sizeof (struct {...})];
- extern int dummy [sizeof (struct verify_type__ {...})];
+ extern int dummy [sizeof (struct _gl_verify_type {...})];
extern void dummy (int [sizeof (struct {...})]);
- extern void dummy (int [sizeof (struct verify_type__ {...})]);
+ extern void dummy (int [sizeof (struct _gl_verify_type {...})]);
extern int (*dummy (void)) [sizeof (struct {...})];
- extern int (*dummy (void)) [sizeof (struct verify_type__ {...})];
+ extern int (*dummy (void)) [sizeof (struct _gl_verify_type {...})];
In the second and sixth case, the struct type is exported to the
outer scope; two such declarations therefore collide. GCC warns
@@ -159,44 +156,88 @@
possible. */
# define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER)
-/* Verify requirement R at compile-time, as an integer constant expression.
- Return 1. */
+/* Verify requirement R at compile-time, as an integer constant expression
+ that returns 1. If R is false, fail at compile-time, preferably
+ with a diagnostic that includes the string-literal DIAGNOSTIC. */
+
+# define _GL_VERIFY_TRUE(R, DIAGNOSTIC) \
+ (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC)))
# ifdef __cplusplus
+# if !GNULIB_defined_struct__gl_verify_type
template <int w>
- struct verify_type__ { unsigned int verify_error_if_negative_size__: w; };
-# define verify_true(R) \
- (!!sizeof (verify_type__<(R) ? 1 : -1>))
-# elif HAVE__STATIC_ASSERT
-# define verify_true(R) \
- (!!sizeof \
- (struct { \
- _Static_assert (R, "verify_true (" #R ")"); \
- int verify_dummy__; \
- }))
-# elif HAVE_STATIC_ASSERT
-# define verify_true(R) \
- (!!sizeof \
- (struct { \
- static_assert (R, "verify_true (" #R ")"); \
- int verify_dummy__; \
- }))
+ struct _gl_verify_type {
+ unsigned int _gl_verify_error_if_negative: w;
+ };
+# define GNULIB_defined_struct__gl_verify_type 1
+# endif
+# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
+ _gl_verify_type<(R) ? 1 : -1>
+# elif defined _GL_HAVE__STATIC_ASSERT
+# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
+ struct { \
+ _Static_assert (R, DIAGNOSTIC); \
+ int _gl_dummy; \
+ }
# else
-# define verify_true(R) \
- (!!sizeof \
- (struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; }))
+# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
+ struct { unsigned int _gl_verify_error_if_negative: (R) ? 1 : -1; }
# endif
/* Verify requirement R at compile-time, as a declaration without a
- trailing ';'. */
+ trailing ';'. If R is false, fail at compile-time, preferably
+ with a diagnostic that includes the string-literal DIAGNOSTIC.
+
+ Unfortunately, unlike C1X, this implementation must appear as an
+ ordinary declaration, and cannot appear inside struct { ... }. */
-# if HAVE__STATIC_ASSERT
-# define verify(R) _Static_assert (R, "verify (" #R ")")
-# elif HAVE_STATIC_ASSERT
-# define verify(R) static_assert (R, "verify (" #R ")")
+# ifdef _GL_HAVE__STATIC_ASSERT
+# define _GL_VERIFY _Static_assert
# else
-# define verify(R) \
- extern int (* _GL_GENSYM (verify_function) (void)) [verify_true (R)]
+# define _GL_VERIFY(R, DIAGNOSTIC) \
+ extern int (*_GL_GENSYM (_gl_verify_function) (void)) \
+ [_GL_VERIFY_TRUE (R, DIAGNOSTIC)]
+# endif
+
+/* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */
+# ifdef _GL_STATIC_ASSERT_H
+# if !defined _GL_HAVE__STATIC_ASSERT && !defined _Static_assert
+# define _Static_assert(R, DIAGNOSTIC) _GL_VERIFY (R, DIAGNOSTIC)
+# endif
+# if !defined _GL_HAVE_STATIC_ASSERT && !defined static_assert
+# define static_assert _Static_assert /* Draft C1X requires this #define. */
+# endif
# endif
+/* @assert.h omit start@ */
+
+/* Each of these macros verifies that its argument R is nonzero. To
+ be portable, R should be an integer constant expression. Unlike
+ assert (R), there is no run-time overhead.
+
+ There are two macros, since no single macro can be used in all
+ contexts in C. verify_true (R) is for scalar contexts, including
+ integer constant expression contexts. verify (R) is for declaration
+ contexts, e.g., the top level. */
+
+/* Verify requirement R at compile-time, as an integer constant expression.
+ Return 1. This is equivalent to verify_expr (R, 1).
+
+ verify_true is obsolescent; please use verify_expr instead. */
+
+# define verify_true(R) _GL_VERIFY_TRUE (R, "verify_true (" #R ")")
+
+/* Verify requirement R at compile-time. Return the value of the
+ expression E. */
+
+# define verify_expr(R, E) \
+ (_GL_VERIFY_TRUE (R, "verify_expr (" #R ", " #E ")") ? (E) : (E))
+
+/* Verify requirement R at compile-time, as a declaration without a
+ trailing ';'. */
+
+# define verify(R) _GL_VERIFY (R, "verify (" #R ")")
+
+/* @assert.h omit end@ */
+
#endif
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index 3cc0fc4b3..7514958fe 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -49,7 +49,7 @@
#else
/* Normal invocation convention. */
-#ifndef _GL_WCHAR_H
+#ifndef _@GUARD_PREFIX@_WCHAR_H
#define _GL_ALREADY_INCLUDING_WCHAR_H
@@ -81,8 +81,8 @@
#undef _GL_ALREADY_INCLUDING_WCHAR_H
-#ifndef _GL_WCHAR_H
-#define _GL_WCHAR_H
+#ifndef _@GUARD_PREFIX@_WCHAR_H
+#define _@GUARD_PREFIX@_WCHAR_H
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -989,6 +989,6 @@ _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
#endif
-#endif /* _GL_WCHAR_H */
-#endif /* _GL_WCHAR_H */
+#endif /* _@GUARD_PREFIX@_WCHAR_H */
+#endif /* _@GUARD_PREFIX@_WCHAR_H */
#endif