summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2011-02-14 11:36:25 +0100
committerLudovic Courtès <ludo@gnu.org>2011-02-14 11:36:25 +0100
commit49114fd43de833c0724fbb0b6dc9ca639d1ab74f (patch)
treebd33e1612cbbc37218ff18a229ff603018d2d5d5 /lib
parentd9a00aa53612b97b11847cfc03647a3ab54b2a48 (diff)
Update Gnulib; add new modules.
This updates Gnulib to v0.0-4889-ge375fe3. * m4/gnulib-cache.m4: Add `accept', `bind', `close', `connect', `getpeername', `getsockname', `getsockopt', `listen', `malloc', `malloca', `recv', `recvfrom', `send', `sendto', `setsockopt', `shutdown', `socket', and `sockets', requested by Jan Nieuwenhuizen <janneke-list@xs4all.nl> for cross-MinGW32 builds. Add `trunc', requested by Mark H Weaver <mhw@netris.org>.
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.am450
-rw-r--r--lib/accept.c42
-rw-r--r--lib/alignof.h2
-rw-r--r--lib/alloca.in.h4
-rw-r--r--lib/arpa_inet.in.h37
-rw-r--r--lib/asnprintf.c2
-rw-r--r--lib/bind.c40
-rw-r--r--lib/byteswap.in.h2
-rw-r--r--lib/c-ctype.c2
-rw-r--r--lib/c-ctype.h2
-rw-r--r--lib/c-strcase.h2
-rw-r--r--lib/c-strcasecmp.c2
-rw-r--r--lib/c-strcaseeq.h2
-rw-r--r--lib/c-strncasecmp.c2
-rw-r--r--lib/canonicalize-lgpl.c2
-rw-r--r--lib/close-hook.c2
-rw-r--r--lib/close-hook.h2
-rw-r--r--lib/close.c (renamed from lib/mbrlen.c)30
-rw-r--r--lib/config.charset683
-rw-r--r--lib/connect.c47
-rw-r--r--lib/duplocale.c2
-rw-r--r--lib/errno.in.h2
-rw-r--r--lib/fclose.c47
-rw-r--r--lib/float+.h2
-rw-r--r--lib/float.in.h2
-rw-r--r--lib/flock.c4
-rw-r--r--lib/full-read.c2
-rw-r--r--lib/full-read.h2
-rw-r--r--lib/full-write.c2
-rw-r--r--lib/full-write.h2
-rw-r--r--lib/gai_strerror.c4
-rw-r--r--lib/getaddrinfo.c2
-rw-r--r--lib/getpeername.c40
-rw-r--r--lib/getsockname.c40
-rw-r--r--lib/getsockopt.c67
-rw-r--r--lib/gettext.h8
-rw-r--r--lib/iconv.c2
-rw-r--r--lib/iconv.in.h2
-rw-r--r--lib/iconv_close.c2
-rw-r--r--lib/iconv_open.c2
-rw-r--r--lib/iconveh.h2
-rw-r--r--lib/inet_ntop.c2
-rw-r--r--lib/inet_pton.c2
-rw-r--r--lib/isinf.c2
-rw-r--r--lib/isnan.c2
-rw-r--r--lib/isnand.c2
-rw-r--r--lib/isnanf.c2
-rw-r--r--lib/isnanl.c2
-rw-r--r--lib/listen.c40
-rw-r--r--lib/localcharset.c548
-rw-r--r--lib/localcharset.h41
-rw-r--r--lib/locale.in.h23
-rw-r--r--lib/lstat.c2
-rw-r--r--lib/malloc.c2
-rw-r--r--lib/malloca.c2
-rw-r--r--lib/malloca.h2
-rw-r--r--lib/math.in.h77
-rw-r--r--lib/mbrtowc.c386
-rw-r--r--lib/mbsinit.c47
-rw-r--r--lib/memchr.c2
-rw-r--r--lib/netdb.in.h5
-rw-r--r--lib/netinet_in.in.h2
-rw-r--r--lib/nproc.c2
-rw-r--r--lib/nproc.h2
-rw-r--r--lib/pathmax.h2
-rw-r--r--lib/printf-args.c2
-rw-r--r--lib/printf-args.h6
-rw-r--r--lib/printf-parse.c41
-rw-r--r--lib/printf-parse.h9
-rw-r--r--lib/putenv.c2
-rw-r--r--lib/readlink.c2
-rw-r--r--lib/recv.c40
-rw-r--r--lib/recvfrom.c48
-rw-r--r--lib/ref-add.sin30
-rw-r--r--lib/ref-del.sin25
-rw-r--r--lib/safe-read.c2
-rw-r--r--lib/safe-read.h2
-rw-r--r--lib/safe-write.c2
-rw-r--r--lib/safe-write.h2
-rw-r--r--lib/send.c40
-rw-r--r--lib/sendto.c41
-rw-r--r--lib/setsockopt.c56
-rw-r--r--lib/shutdown.c40
-rw-r--r--lib/size_max.h2
-rw-r--r--lib/snprintf.c2
-rw-r--r--lib/socket.c49
-rw-r--r--lib/sockets.c2
-rw-r--r--lib/sockets.h2
-rw-r--r--lib/stat-time.h2
-rw-r--r--lib/stat.c2
-rw-r--r--lib/stdarg.in.h2
-rw-r--r--lib/stdbool.in.h2
-rw-r--r--lib/stddef.in.h2
-rw-r--r--lib/stdint.in.h14
-rw-r--r--lib/stdio-write.c2
-rw-r--r--lib/stdio.in.h92
-rw-r--r--lib/stdlib.in.h37
-rw-r--r--lib/strcasecmp.c2
-rw-r--r--lib/streq.h176
-rw-r--r--lib/strftime.c9
-rw-r--r--lib/strftime.h2
-rw-r--r--lib/striconveh.c2
-rw-r--r--lib/striconveh.h2
-rw-r--r--lib/string.in.h11
-rw-r--r--lib/strings.in.h2
-rw-r--r--lib/strncasecmp.c2
-rw-r--r--lib/sys_file.in.h2
-rw-r--r--lib/sys_socket.in.h46
-rw-r--r--lib/sys_stat.in.h5
-rw-r--r--lib/sys_time.in.h101
-rw-r--r--lib/time.in.h20
-rw-r--r--lib/time_r.c2
-rw-r--r--lib/trunc.c113
-rw-r--r--lib/unistd.in.h24
-rw-r--r--lib/unistr.in.h30
-rw-r--r--lib/unistr/u8-mbtouc-aux.c2
-rw-r--r--lib/unistr/u8-mbtouc-unsafe-aux.c2
-rw-r--r--lib/unistr/u8-mbtouc-unsafe.c2
-rw-r--r--lib/unistr/u8-mbtouc.c2
-rw-r--r--lib/unistr/u8-mbtoucr.c2
-rw-r--r--lib/unistr/u8-prev.c2
-rw-r--r--lib/unistr/u8-uctomb-aux.c2
-rw-r--r--lib/unistr/u8-uctomb.c2
-rw-r--r--lib/unitypes.in.h2
-rw-r--r--lib/vasnprintf.c7
-rw-r--r--lib/vasnprintf.h2
-rw-r--r--lib/verify.h2
-rw-r--r--lib/version-etc-fsf.c2
-rw-r--r--lib/version-etc.c4
-rw-r--r--lib/version-etc.h2
-rw-r--r--lib/vsnprintf.c2
-rw-r--r--lib/w32sock.h2
-rw-r--r--lib/wchar.in.h497
-rw-r--r--lib/write.c2
-rw-r--r--lib/xsize.h2
135 files changed, 2109 insertions, 2380 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 7e2d4d43c..6d59b8bc6 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,6 +1,6 @@
## DO NOT EDIT! GENERATED AUTOMATICALLY!
## Process this file with automake to produce Makefile.in.
-# Copyright (C) 2002-2010 Free Software Foundation, Inc.
+# Copyright (C) 2002-2011 Free Software Foundation, Inc.
#
# This file is free software, distributed under the terms of the GNU
# General Public License. As a special exception to the GNU General
@@ -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 alignof alloca-opt announce-gen autobuild byteswap canonicalize-lgpl duplocale environ extensions flock fpieee full-read full-write func gendocs getaddrinfo git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan lib-symbol-versions lib-symbol-visibility libunistring locale maintainer-makefile nproc putenv stat-time stdlib strcase strftime striconveh string sys_stat verify version-etc-fsf vsnprintf warnings
+# 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 close connect duplocale environ extensions flock fpieee 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 lib-symbol-versions lib-symbol-visibility libunistring listen locale maintainer-makefile malloc malloca nproc putenv recv recvfrom send sendto setsockopt shutdown socket sockets stat-time stdlib strcase strftime striconveh string sys_stat trunc verify version-etc-fsf vsnprintf warnings
AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
@@ -49,6 +49,16 @@ libgnu_la_LDFLAGS += $(LTLIBICONV)
libgnu_la_LDFLAGS += $(LTLIBINTL)
libgnu_la_LDFLAGS += $(LTLIBUNISTRING)
libgnu_la_LDFLAGS += $(SERVENT_LIB)
+libgnu_la_LDFLAGS += $(TRUNC_LIBM)
+
+## begin gnulib module accept
+
+
+EXTRA_DIST += accept.c w32sock.h
+
+EXTRA_libgnu_la_SOURCES += accept.c
+
+## end gnulib module accept
## begin gnulib module alignof
@@ -112,7 +122,7 @@ BUILT_SOURCES += arpa/inet.h
# We need the following in order to create <arpa/inet.h> when the system
# doesn't have one.
-arpa/inet.h: arpa_inet.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+arpa/inet.h: arpa_inet.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
$(AM_V_at)$(MKDIR_P) arpa
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -126,6 +136,7 @@ arpa/inet.h: arpa_inet.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
-e 's|@''GNULIB_INET_PTON''@|$(GNULIB_INET_PTON)|g' \
-e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \
-e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \
+ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
< $(srcdir)/arpa_inet.in.h; \
@@ -138,6 +149,15 @@ EXTRA_DIST += arpa_inet.in.h
## end gnulib module arpa_inet
+## begin gnulib module bind
+
+
+EXTRA_DIST += bind.c w32sock.h
+
+EXTRA_libgnu_la_SOURCES += bind.c
+
+## end gnulib module bind
+
## begin gnulib module byteswap
BUILT_SOURCES += $(BYTESWAP_H)
@@ -208,6 +228,15 @@ EXTRA_libgnu_la_SOURCES += canonicalize-lgpl.c
## end gnulib module canonicalize-lgpl
+## begin gnulib module close
+
+
+EXTRA_DIST += close.c
+
+EXTRA_libgnu_la_SOURCES += close.c
+
+## end gnulib module close
+
## begin gnulib module close-hook
libgnu_la_SOURCES += close-hook.c
@@ -216,67 +245,14 @@ EXTRA_DIST += close-hook.h
## end gnulib module close-hook
-## begin gnulib module configmake
+## begin gnulib module connect
-# Retrieve values of the variables through 'configure' followed by
-# 'make', not directly through 'configure', so that a user who
-# sets some of these variables consistently on the 'make' command
-# line gets correct results.
-#
-# One advantage of this approach, compared to the classical
-# approach of adding -DLIBDIR=\"$(libdir)\" etc. to AM_CPPFLAGS,
-# is that it protects against the use of undefined variables.
-# If, say, $(libdir) is not set in the Makefile, LIBDIR is not
-# defined by this module, and code using LIBDIR gives a
-# compilation error.
-#
-# Another advantage is that 'make' output is shorter.
-#
-# Listed in the same order as the GNU makefile conventions, and
-# provided by autoconf 2.59c+.
-# The Automake-defined pkg* macros are appended, in the order
-# listed in the Automake 1.10a+ documentation.
-configmake.h: Makefile
- $(AM_V_GEN)rm -f $@-t && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- echo '#define PREFIX "$(prefix)"'; \
- echo '#define EXEC_PREFIX "$(exec_prefix)"'; \
- echo '#define BINDIR "$(bindir)"'; \
- echo '#define SBINDIR "$(sbindir)"'; \
- echo '#define LIBEXECDIR "$(libexecdir)"'; \
- echo '#define DATAROOTDIR "$(datarootdir)"'; \
- echo '#define DATADIR "$(datadir)"'; \
- echo '#define SYSCONFDIR "$(sysconfdir)"'; \
- echo '#define SHAREDSTATEDIR "$(sharedstatedir)"'; \
- echo '#define LOCALSTATEDIR "$(localstatedir)"'; \
- echo '#define INCLUDEDIR "$(includedir)"'; \
- echo '#define OLDINCLUDEDIR "$(oldincludedir)"'; \
- echo '#define DOCDIR "$(docdir)"'; \
- echo '#define INFODIR "$(infodir)"'; \
- echo '#define HTMLDIR "$(htmldir)"'; \
- echo '#define DVIDIR "$(dvidir)"'; \
- echo '#define PDFDIR "$(pdfdir)"'; \
- echo '#define PSDIR "$(psdir)"'; \
- echo '#define LIBDIR "$(libdir)"'; \
- echo '#define LISPDIR "$(lispdir)"'; \
- echo '#define LOCALEDIR "$(localedir)"'; \
- echo '#define MANDIR "$(mandir)"'; \
- echo '#define MANEXT "$(manext)"'; \
- echo '#define PKGDATADIR "$(pkgdatadir)"'; \
- echo '#define PKGINCLUDEDIR "$(pkgincludedir)"'; \
- echo '#define PKGLIBDIR "$(pkglibdir)"'; \
- echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \
- } | sed '/""/d' > $@-t && \
- if test -f $@ && cmp $@-t $@ > /dev/null; then \
- rm -f $@-t; \
- else \
- rm -f $@; mv $@-t $@; \
- fi
-
-BUILT_SOURCES += configmake.h
-CLEANFILES += configmake.h configmake.h-t
-
-## end gnulib module configmake
+
+EXTRA_DIST += connect.c w32sock.h
+
+EXTRA_libgnu_la_SOURCES += connect.c
+
+## end gnulib module connect
## begin gnulib module duplocale
@@ -315,6 +291,15 @@ EXTRA_DIST += errno.in.h
## end gnulib module errno
+## begin gnulib module fclose
+
+
+EXTRA_DIST += fclose.c
+
+EXTRA_libgnu_la_SOURCES += fclose.c
+
+## end gnulib module fclose
+
## begin gnulib module float
BUILT_SOURCES += $(FLOAT_H)
@@ -374,6 +359,33 @@ EXTRA_libgnu_la_SOURCES += gai_strerror.c getaddrinfo.c
## end gnulib module getaddrinfo
+## begin gnulib module getpeername
+
+
+EXTRA_DIST += getpeername.c w32sock.h
+
+EXTRA_libgnu_la_SOURCES += getpeername.c
+
+## end gnulib module getpeername
+
+## begin gnulib module getsockname
+
+
+EXTRA_DIST += getsockname.c w32sock.h
+
+EXTRA_libgnu_la_SOURCES += getsockname.c
+
+## end gnulib module getsockname
+
+## begin gnulib module getsockopt
+
+
+EXTRA_DIST += getsockopt.c w32sock.h
+
+EXTRA_libgnu_la_SOURCES += getsockopt.c
+
+## end gnulib module getsockopt
+
## begin gnulib module gettext-h
libgnu_la_SOURCES += gettext.h
@@ -569,79 +581,14 @@ EXTRA_DIST += libunistring.valgrind
## end gnulib module libunistring
-## begin gnulib module localcharset
-
-libgnu_la_SOURCES += localcharset.h localcharset.c
-
-# We need the following in order to install a simple file in $(libdir)
-# which is shared with other installed packages. We use a list of referencing
-# packages so that "make uninstall" will remove the file if and only if it
-# is not used by another installed package.
-# On systems with glibc-2.1 or newer, the file is redundant, therefore we
-# avoid installing it.
-
-all-local: charset.alias ref-add.sed ref-del.sed
-
-charset_alias = $(DESTDIR)$(libdir)/charset.alias
-charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
-install-exec-local: install-exec-localcharset
-install-exec-localcharset: all-local
- if test $(GLIBC21) = no; then \
- case '$(host_os)' in \
- darwin[56]*) \
- need_charset_alias=true ;; \
- darwin* | cygwin* | mingw* | pw32* | cegcc*) \
- need_charset_alias=false ;; \
- *) \
- need_charset_alias=true ;; \
- esac ; \
- else \
- need_charset_alias=false ; \
- fi ; \
- if $$need_charset_alias; then \
- $(mkinstalldirs) $(DESTDIR)$(libdir) ; \
- fi ; \
- if test -f $(charset_alias); then \
- sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
- $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
- rm -f $(charset_tmp) ; \
- else \
- if $$need_charset_alias; then \
- sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
- $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
- rm -f $(charset_tmp) ; \
- fi ; \
- fi
-
-uninstall-local: uninstall-localcharset
-uninstall-localcharset: all-local
- if test -f $(charset_alias); then \
- sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
- if grep '^# Packages using this file: $$' $(charset_tmp) \
- > /dev/null; then \
- rm -f $(charset_alias); \
- else \
- $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
- fi; \
- rm -f $(charset_tmp); \
- fi
-
-charset.alias: config.charset
- $(AM_V_GEN)rm -f t-$@ $@ && \
- $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@ && \
- mv t-$@ $@
+## begin gnulib module listen
-SUFFIXES += .sed .sin
-.sin.sed:
- $(AM_V_GEN)rm -f t-$@ $@ && \
- sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@ && \
- mv t-$@ $@
-CLEANFILES += charset.alias ref-add.sed ref-del.sed
+EXTRA_DIST += listen.c w32sock.h
-EXTRA_DIST += config.charset ref-add.sin ref-del.sin
+EXTRA_libgnu_la_SOURCES += listen.c
-## end gnulib module localcharset
+## end gnulib module listen
## begin gnulib module locale
@@ -656,9 +603,11 @@ locale.h: locale.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-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|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \
-e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \
+ -e 's|@''REPLACE_SETLOCALE''@|$(REPLACE_SETLOCALE)|g' \
-e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
@@ -687,6 +636,15 @@ EXTRA_DIST += $(top_srcdir)/maint.mk
## end gnulib module maintainer-makefile
+## begin gnulib module malloc-gnu
+
+
+EXTRA_DIST += malloc.c
+
+EXTRA_libgnu_la_SOURCES += malloc.c
+
+## end gnulib module malloc-gnu
+
## begin gnulib module malloc-posix
@@ -720,10 +678,12 @@ math.h: math.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-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' \
@@ -747,7 +707,8 @@ math.h: math.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''GNULIB_TRUNC''@|$(GNULIB_TRUNC)|g' \
-e 's|@''GNULIB_TRUNCF''@|$(GNULIB_TRUNCF)|g' \
-e 's|@''GNULIB_TRUNCL''@|$(GNULIB_TRUNCL)|g' \
- -e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \
+ < $(srcdir)/math.in.h | \
+ sed -e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \
-e 's|@''HAVE_ASINL''@|$(HAVE_ASINL)|g' \
-e 's|@''HAVE_ATANL''@|$(HAVE_ATANL)|g' \
-e 's|@''HAVE_COSL''@|$(HAVE_COSL)|g' \
@@ -781,8 +742,11 @@ math.h: math.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''HAVE_DECL_TRUNC''@|$(HAVE_DECL_TRUNC)|g' \
-e 's|@''HAVE_DECL_TRUNCF''@|$(HAVE_DECL_TRUNCF)|g' \
-e 's|@''HAVE_DECL_TRUNCL''@|$(HAVE_DECL_TRUNCL)|g' \
+ | \
+ sed -e 's|@''REPLACE_CEIL''@|$(REPLACE_CEIL)|g' \
-e 's|@''REPLACE_CEILF''@|$(REPLACE_CEILF)|g' \
-e 's|@''REPLACE_CEILL''@|$(REPLACE_CEILL)|g' \
+ -e 's|@''REPLACE_FLOOR''@|$(REPLACE_FLOOR)|g' \
-e 's|@''REPLACE_FLOORF''@|$(REPLACE_FLOORF)|g' \
-e 's|@''REPLACE_FLOORL''@|$(REPLACE_FLOORL)|g' \
-e 's|@''REPLACE_FREXP''@|$(REPLACE_FREXP)|g' \
@@ -798,11 +762,12 @@ math.h: math.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''REPLACE_ROUNDL''@|$(REPLACE_ROUNDL)|g' \
-e 's|@''REPLACE_SIGNBIT''@|$(REPLACE_SIGNBIT)|g' \
-e 's|@''REPLACE_SIGNBIT_USING_GCC''@|$(REPLACE_SIGNBIT_USING_GCC)|g' \
+ -e 's|@''REPLACE_TRUNC''@|$(REPLACE_TRUNC)|g' \
+ -e 's|@''REPLACE_TRUNCF''@|$(REPLACE_TRUNCF)|g' \
-e 's|@''REPLACE_TRUNCL''@|$(REPLACE_TRUNCL)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
- -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
- < $(srcdir)/math.in.h; \
+ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
} > $@-t && \
mv $@-t $@
MOSTLYCLEANFILES += math.h math.h-t
@@ -811,33 +776,6 @@ EXTRA_DIST += math.in.h
## end gnulib module math
-## begin gnulib module mbrlen
-
-
-EXTRA_DIST += mbrlen.c
-
-EXTRA_libgnu_la_SOURCES += mbrlen.c
-
-## end gnulib module mbrlen
-
-## begin gnulib module mbrtowc
-
-
-EXTRA_DIST += mbrtowc.c
-
-EXTRA_libgnu_la_SOURCES += mbrtowc.c
-
-## end gnulib module mbrtowc
-
-## begin gnulib module mbsinit
-
-
-EXTRA_DIST += mbsinit.c
-
-EXTRA_libgnu_la_SOURCES += mbsinit.c
-
-## end gnulib module mbsinit
-
## begin gnulib module memchr
@@ -936,6 +874,24 @@ EXTRA_libgnu_la_SOURCES += readlink.c
## end gnulib module readlink
+## begin gnulib module recv
+
+
+EXTRA_DIST += recv.c w32sock.h
+
+EXTRA_libgnu_la_SOURCES += recv.c
+
+## end gnulib module recv
+
+## begin gnulib module recvfrom
+
+
+EXTRA_DIST += recvfrom.c w32sock.h
+
+EXTRA_libgnu_la_SOURCES += recvfrom.c
+
+## end gnulib module recvfrom
+
## begin gnulib module safe-read
@@ -954,6 +910,42 @@ EXTRA_libgnu_la_SOURCES += safe-write.c
## end gnulib module safe-write
+## begin gnulib module send
+
+
+EXTRA_DIST += send.c w32sock.h
+
+EXTRA_libgnu_la_SOURCES += send.c
+
+## end gnulib module send
+
+## begin gnulib module sendto
+
+
+EXTRA_DIST += sendto.c w32sock.h
+
+EXTRA_libgnu_la_SOURCES += sendto.c
+
+## end gnulib module sendto
+
+## begin gnulib module setsockopt
+
+
+EXTRA_DIST += setsockopt.c w32sock.h
+
+EXTRA_libgnu_la_SOURCES += setsockopt.c
+
+## end gnulib module setsockopt
+
+## begin gnulib module shutdown
+
+
+EXTRA_DIST += shutdown.c w32sock.h
+
+EXTRA_libgnu_la_SOURCES += shutdown.c
+
+## end gnulib module shutdown
+
## begin gnulib module size_max
libgnu_la_SOURCES += size_max.h
@@ -969,6 +961,15 @@ EXTRA_libgnu_la_SOURCES += snprintf.c
## end gnulib module snprintf
+## begin gnulib module socket
+
+
+EXTRA_DIST += socket.c w32sock.h
+
+EXTRA_libgnu_la_SOURCES += socket.c
+
+## end gnulib module socket
+
## begin gnulib module sockets
libgnu_la_SOURCES += sockets.h sockets.c
@@ -1252,7 +1253,8 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-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|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \
+ < $(srcdir)/stdlib.in.h | \
+ sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \
-e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \
-e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \
-e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \
@@ -1288,8 +1290,7 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|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)/stdlib.in.h; \
+ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
} > $@-t && \
mv $@-t $@
MOSTLYCLEANFILES += stdlib.h stdlib.h-t
@@ -1307,13 +1308,6 @@ EXTRA_libgnu_la_SOURCES += strcasecmp.c strncasecmp.c
## end gnulib module strcase
-## begin gnulib module streq
-
-
-EXTRA_DIST += streq.h
-
-## end gnulib module streq
-
## begin gnulib module strftime
@@ -1591,6 +1585,37 @@ EXTRA_DIST += sys_stat.in.h
## end gnulib module sys_stat
+## begin gnulib module sys_time
+
+BUILT_SOURCES += sys/time.h
+
+# We need the following in order to create <sys/time.h> when the system
+# doesn't have one that works with the given compiler.
+sys/time.h: sys_time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+ $(AM_V_at)$(MKDIR_P) sys
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ sed -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+ -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \
+ -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \
+ -e 's/@''HAVE_GETTIMEOFDAY''@/$(HAVE_GETTIMEOFDAY)/g' \
+ -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \
+ -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \
+ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
+ < $(srcdir)/sys_time.in.h; \
+ } > $@-t && \
+ mv $@-t $@
+MOSTLYCLEANFILES += sys/time.h sys/time.h-t
+
+EXTRA_DIST += sys_time.in.h
+
+## end gnulib module sys_time
+
## begin gnulib module time
BUILT_SOURCES += time.h
@@ -1609,7 +1634,7 @@ time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-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_LOCALTIME_R''@|$(HAVE_LOCALTIME_R)|g' \
+ -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \
-e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \
-e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \
-e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \
@@ -1641,6 +1666,15 @@ EXTRA_libgnu_la_SOURCES += time_r.c
## end gnulib module time_r
+## begin gnulib module trunc
+
+
+EXTRA_DIST += trunc.c
+
+EXTRA_libgnu_la_SOURCES += trunc.c
+
+## end gnulib module trunc
+
## begin gnulib module unistd
BUILT_SOURCES += unistd.h
@@ -1734,13 +1768,15 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \
-e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
-e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
- -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
+ | \
+ sed -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
-e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \
-e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \
-e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \
-e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \
-e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
-e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \
+ -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \
-e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \
-e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
-e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
@@ -1963,7 +1999,36 @@ wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''GNULIB_WCSRTOMBS''@|$(GNULIB_WCSRTOMBS)|g' \
-e 's|@''GNULIB_WCSNRTOMBS''@|$(GNULIB_WCSNRTOMBS)|g' \
-e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
- -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \
+ -e 's|@''GNULIB_WMEMCHR''@|$(GNULIB_WMEMCHR)|g' \
+ -e 's|@''GNULIB_WMEMCMP''@|$(GNULIB_WMEMCMP)|g' \
+ -e 's|@''GNULIB_WMEMCPY''@|$(GNULIB_WMEMCPY)|g' \
+ -e 's|@''GNULIB_WMEMMOVE''@|$(GNULIB_WMEMMOVE)|g' \
+ -e 's|@''GNULIB_WMEMSET''@|$(GNULIB_WMEMSET)|g' \
+ -e 's|@''GNULIB_WCSLEN''@|$(GNULIB_WCSLEN)|g' \
+ -e 's|@''GNULIB_WCSNLEN''@|$(GNULIB_WCSNLEN)|g' \
+ -e 's|@''GNULIB_WCSCPY''@|$(GNULIB_WCSCPY)|g' \
+ -e 's|@''GNULIB_WCPCPY''@|$(GNULIB_WCPCPY)|g' \
+ -e 's|@''GNULIB_WCSNCPY''@|$(GNULIB_WCSNCPY)|g' \
+ -e 's|@''GNULIB_WCPNCPY''@|$(GNULIB_WCPNCPY)|g' \
+ -e 's|@''GNULIB_WCSCAT''@|$(GNULIB_WCSCAT)|g' \
+ -e 's|@''GNULIB_WCSNCAT''@|$(GNULIB_WCSNCAT)|g' \
+ -e 's|@''GNULIB_WCSCMP''@|$(GNULIB_WCSCMP)|g' \
+ -e 's|@''GNULIB_WCSNCMP''@|$(GNULIB_WCSNCMP)|g' \
+ -e 's|@''GNULIB_WCSCASECMP''@|$(GNULIB_WCSCASECMP)|g' \
+ -e 's|@''GNULIB_WCSNCASECMP''@|$(GNULIB_WCSNCASECMP)|g' \
+ -e 's|@''GNULIB_WCSCOLL''@|$(GNULIB_WCSCOLL)|g' \
+ -e 's|@''GNULIB_WCSXFRM''@|$(GNULIB_WCSXFRM)|g' \
+ -e 's|@''GNULIB_WCSDUP''@|$(GNULIB_WCSDUP)|g' \
+ -e 's|@''GNULIB_WCSCHR''@|$(GNULIB_WCSCHR)|g' \
+ -e 's|@''GNULIB_WCSRCHR''@|$(GNULIB_WCSRCHR)|g' \
+ -e 's|@''GNULIB_WCSCSPN''@|$(GNULIB_WCSCSPN)|g' \
+ -e 's|@''GNULIB_WCSSPN''@|$(GNULIB_WCSSPN)|g' \
+ -e 's|@''GNULIB_WCSPBRK''@|$(GNULIB_WCSPBRK)|g' \
+ -e 's|@''GNULIB_WCSSTR''@|$(GNULIB_WCSSTR)|g' \
+ -e 's|@''GNULIB_WCSTOK''@|$(GNULIB_WCSTOK)|g' \
+ -e 's|@''GNULIB_WCSWIDTH''@|$(GNULIB_WCSWIDTH)|g' \
+ < $(srcdir)/wchar.in.h | \
+ sed -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \
-e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \
-e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \
-e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \
@@ -1973,9 +2038,38 @@ wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''HAVE_WCRTOMB''@|$(HAVE_WCRTOMB)|g' \
-e 's|@''HAVE_WCSRTOMBS''@|$(HAVE_WCSRTOMBS)|g' \
-e 's|@''HAVE_WCSNRTOMBS''@|$(HAVE_WCSNRTOMBS)|g' \
+ -e 's|@''HAVE_WMEMCHR''@|$(HAVE_WMEMCHR)|g' \
+ -e 's|@''HAVE_WMEMCMP''@|$(HAVE_WMEMCMP)|g' \
+ -e 's|@''HAVE_WMEMCPY''@|$(HAVE_WMEMCPY)|g' \
+ -e 's|@''HAVE_WMEMMOVE''@|$(HAVE_WMEMMOVE)|g' \
+ -e 's|@''HAVE_WMEMSET''@|$(HAVE_WMEMSET)|g' \
+ -e 's|@''HAVE_WCSLEN''@|$(HAVE_WCSLEN)|g' \
+ -e 's|@''HAVE_WCSNLEN''@|$(HAVE_WCSNLEN)|g' \
+ -e 's|@''HAVE_WCSCPY''@|$(HAVE_WCSCPY)|g' \
+ -e 's|@''HAVE_WCPCPY''@|$(HAVE_WCPCPY)|g' \
+ -e 's|@''HAVE_WCSNCPY''@|$(HAVE_WCSNCPY)|g' \
+ -e 's|@''HAVE_WCPNCPY''@|$(HAVE_WCPNCPY)|g' \
+ -e 's|@''HAVE_WCSCAT''@|$(HAVE_WCSCAT)|g' \
+ -e 's|@''HAVE_WCSNCAT''@|$(HAVE_WCSNCAT)|g' \
+ -e 's|@''HAVE_WCSCMP''@|$(HAVE_WCSCMP)|g' \
+ -e 's|@''HAVE_WCSNCMP''@|$(HAVE_WCSNCMP)|g' \
+ -e 's|@''HAVE_WCSCASECMP''@|$(HAVE_WCSCASECMP)|g' \
+ -e 's|@''HAVE_WCSNCASECMP''@|$(HAVE_WCSNCASECMP)|g' \
+ -e 's|@''HAVE_WCSCOLL''@|$(HAVE_WCSCOLL)|g' \
+ -e 's|@''HAVE_WCSXFRM''@|$(HAVE_WCSXFRM)|g' \
+ -e 's|@''HAVE_WCSDUP''@|$(HAVE_WCSDUP)|g' \
+ -e 's|@''HAVE_WCSCHR''@|$(HAVE_WCSCHR)|g' \
+ -e 's|@''HAVE_WCSRCHR''@|$(HAVE_WCSRCHR)|g' \
+ -e 's|@''HAVE_WCSCSPN''@|$(HAVE_WCSCSPN)|g' \
+ -e 's|@''HAVE_WCSSPN''@|$(HAVE_WCSSPN)|g' \
+ -e 's|@''HAVE_WCSPBRK''@|$(HAVE_WCSPBRK)|g' \
+ -e 's|@''HAVE_WCSSTR''@|$(HAVE_WCSSTR)|g' \
+ -e 's|@''HAVE_WCSTOK''@|$(HAVE_WCSTOK)|g' \
+ -e 's|@''HAVE_WCSWIDTH''@|$(HAVE_WCSWIDTH)|g' \
-e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \
-e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
- -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \
+ | \
+ sed -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \
-e 's|@''REPLACE_BTOWC''@|$(REPLACE_BTOWC)|g' \
-e 's|@''REPLACE_WCTOB''@|$(REPLACE_WCTOB)|g' \
-e 's|@''REPLACE_MBSINIT''@|$(REPLACE_MBSINIT)|g' \
@@ -1987,10 +2081,10 @@ wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \
-e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \
-e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
+ -e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
- -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
- < $(srcdir)/wchar.in.h; \
+ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
} > $@-t && \
mv $@-t $@
MOSTLYCLEANFILES += wchar.h wchar.h-t
diff --git a/lib/accept.c b/lib/accept.c
new file mode 100644
index 000000000..911c18436
--- /dev/null
+++ b/lib/accept.c
@@ -0,0 +1,42 @@
+/* accept.c --- wrappers for Windows accept function
+
+ Copyright (C) 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/>. */
+
+/* Written by Paolo Bonzini */
+
+#include <config.h>
+
+#define WIN32_LEAN_AND_MEAN
+/* Get winsock2.h. */
+#include <sys/socket.h>
+
+/* Get set_winsock_errno, FD_TO_SOCKET etc. */
+#include "w32sock.h"
+
+#undef accept
+
+int
+rpl_accept (int fd, struct sockaddr *addr, socklen_t *addrlen)
+{
+ SOCKET fh = accept (FD_TO_SOCKET (fd), addr, addrlen);
+ if (fh == INVALID_SOCKET)
+ {
+ set_winsock_errno ();
+ return -1;
+ }
+ else
+ return SOCKET_TO_FD (fh);
+}
diff --git a/lib/alignof.h b/lib/alignof.h
index 13687ab7c..5e71f6cbb 100644
--- a/lib/alignof.h
+++ b/lib/alignof.h
@@ -1,5 +1,5 @@
/* Determine alignment of types.
- Copyright (C) 2003-2004, 2006, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2003-2004, 2006, 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
diff --git a/lib/alloca.in.h b/lib/alloca.in.h
index ee7aa9a8d..8760ae7b1 100644
--- a/lib/alloca.in.h
+++ b/lib/alloca.in.h
@@ -1,6 +1,6 @@
/* Memory allocation on the stack.
- Copyright (C) 1995, 1999, 2001-2004, 2006-2010 Free Software Foundation,
+ Copyright (C) 1995, 1999, 2001-2004, 2006-2011 Free Software Foundation,
Inc.
This program is free software; you can redistribute it and/or modify it
@@ -11,7 +11,7 @@
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
+ 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
diff --git a/lib/arpa_inet.in.h b/lib/arpa_inet.in.h
index 6d9b8c71d..3df6fd2a4 100644
--- a/lib/arpa_inet.in.h
+++ b/lib/arpa_inet.in.h
@@ -1,6 +1,6 @@
/* A GNU-like <arpa/inet.h>.
- Copyright (C) 2005-2006, 2008-2010 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 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
@@ -34,6 +34,12 @@
# include <sys/socket.h>
#endif
+/* On NonStop Kernel, inet_ntop and inet_pton are declared in <netdb.h>.
+ But avoid namespace pollution on glibc systems. */
+#if defined __TANDEM && !defined __GLIBC__
+# include <netdb.h>
+#endif
+
#if @HAVE_ARPA_INET_H@
/* The include_next requires a split double-inclusion guard. */
@@ -44,13 +50,12 @@
#ifndef _GL_ARPA_INET_H
#define _GL_ARPA_INET_H
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
+
/* The definition of _GL_ARG_NONNULL is copied here. */
/* The definition of _GL_WARN_ON_USE is copied here. */
-#ifdef __cplusplus
-extern "C" {
-#endif
#if @GNULIB_INET_NTOP@
# if !@HAVE_DECL_INET_NTOP@
@@ -69,10 +74,17 @@ extern "C" {
For more details, see the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/inet_ntop.html>. */
-extern const char *inet_ntop (int af, const void *restrict src,
- char *restrict dst, socklen_t cnt)
- _GL_ARG_NONNULL ((2, 3));
+_GL_FUNCDECL_SYS (inet_ntop, const char *,
+ (int af, const void *restrict src,
+ char *restrict dst, socklen_t cnt)
+ _GL_ARG_NONNULL ((2, 3)));
# endif
+/* Need to cast, because on NonStop Kernel, the fourth parameter is
+ size_t cnt. */
+_GL_CXXALIAS_SYS_CAST (inet_ntop, const char *,
+ (int af, const void *restrict src,
+ char *restrict dst, socklen_t cnt));
+_GL_CXXALIASWARN (inet_ntop);
#elif defined GNULIB_POSIXCHECK
# undef inet_ntop
# if HAVE_RAW_DECL_INET_NTOP
@@ -83,9 +95,13 @@ _GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - "
#if @GNULIB_INET_PTON@
# if !@HAVE_DECL_INET_PTON@
-extern int inet_pton (int af, const char *restrict src, void *restrict dst)
- _GL_ARG_NONNULL ((2, 3));
+_GL_FUNCDECL_SYS (inet_pton, int,
+ (int af, const char *restrict src, void *restrict dst)
+ _GL_ARG_NONNULL ((2, 3)));
# endif
+_GL_CXXALIAS_SYS (inet_pton, int,
+ (int af, const char *restrict src, void *restrict dst));
+_GL_CXXALIASWARN (inet_pton);
#elif defined GNULIB_POSIXCHECK
# undef inet_pton
# if HAVE_RAW_DECL_INET_PTON
@@ -94,9 +110,6 @@ _GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - "
# endif
#endif
-#ifdef __cplusplus
-}
-#endif
#endif /* _GL_ARPA_INET_H */
#endif /* _GL_ARPA_INET_H */
diff --git a/lib/asnprintf.c b/lib/asnprintf.c
index bc5a8af48..f1fb7466b 100644
--- a/lib/asnprintf.c
+++ b/lib/asnprintf.c
@@ -1,5 +1,5 @@
/* Formatted output to strings.
- Copyright (C) 1999, 2002, 2006, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 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
diff --git a/lib/bind.c b/lib/bind.c
new file mode 100644
index 000000000..512f3641d
--- /dev/null
+++ b/lib/bind.c
@@ -0,0 +1,40 @@
+/* bind.c --- wrappers for Windows bind function
+
+ Copyright (C) 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/>. */
+
+/* Written by Paolo Bonzini */
+
+#include <config.h>
+
+#define WIN32_LEAN_AND_MEAN
+/* Get winsock2.h. */
+#include <sys/socket.h>
+
+/* Get set_winsock_errno, FD_TO_SOCKET etc. */
+#include "w32sock.h"
+
+#undef bind
+
+int
+rpl_bind (int fd, const struct sockaddr *sockaddr, socklen_t len)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = bind (sock, sockaddr, len);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
diff --git a/lib/byteswap.in.h b/lib/byteswap.in.h
index cf2accb0f..049178122 100644
--- a/lib/byteswap.in.h
+++ b/lib/byteswap.in.h
@@ -1,5 +1,5 @@
/* byteswap.h - Byte swapping
- Copyright (C) 2005, 2007, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007, 2009-2011 Free Software Foundation, Inc.
Written by Oskar Liljeblad <oskar@osk.mine.nu>, 2005.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/c-ctype.c b/lib/c-ctype.c
index 403adc2ab..06f87d0c6 100644
--- a/lib/c-ctype.c
+++ b/lib/c-ctype.c
@@ -1,6 +1,6 @@
/* Character handling in C locale.
- Copyright 2000-2003, 2006, 2009-2010 Free Software Foundation, Inc.
+ Copyright 2000-2003, 2006, 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
diff --git a/lib/c-ctype.h b/lib/c-ctype.h
index 00c0a26cc..ccf53e774 100644
--- a/lib/c-ctype.h
+++ b/lib/c-ctype.h
@@ -5,7 +5,7 @@
<ctype.h> functions' behaviour depends on the current locale set via
setlocale.
- Copyright (C) 2000-2003, 2006, 2008-2010 Free Software Foundation, Inc.
+ Copyright (C) 2000-2003, 2006, 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
diff --git a/lib/c-strcase.h b/lib/c-strcase.h
index 99e7fafa5..1e3d45a85 100644
--- a/lib/c-strcase.h
+++ b/lib/c-strcase.h
@@ -1,5 +1,5 @@
/* Case-insensitive string comparison functions in C locale.
- Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2010 Free Software
+ Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2011 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/c-strcasecmp.c b/lib/c-strcasecmp.c
index bc3e76d00..5216c4444 100644
--- a/lib/c-strcasecmp.c
+++ b/lib/c-strcasecmp.c
@@ -1,5 +1,5 @@
/* c-strcasecmp.c -- case insensitive string comparator in C locale
- Copyright (C) 1998-1999, 2005-2006, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 1998-1999, 2005-2006, 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
diff --git a/lib/c-strcaseeq.h b/lib/c-strcaseeq.h
index 0af82f30a..754303df2 100644
--- a/lib/c-strcaseeq.h
+++ b/lib/c-strcaseeq.h
@@ -1,5 +1,5 @@
/* Optimized case-insensitive string comparison in C locale.
- Copyright (C) 2001-2002, 2007, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002, 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
diff --git a/lib/c-strncasecmp.c b/lib/c-strncasecmp.c
index 01dbf3915..2d5a324f1 100644
--- a/lib/c-strncasecmp.c
+++ b/lib/c-strncasecmp.c
@@ -1,5 +1,5 @@
/* c-strncasecmp.c -- case insensitive string comparator in C locale
- Copyright (C) 1998-1999, 2005-2006, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 1998-1999, 2005-2006, 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
diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c
index ec55f2619..7e2fdbd5e 100644
--- a/lib/canonicalize-lgpl.c
+++ b/lib/canonicalize-lgpl.c
@@ -1,5 +1,5 @@
/* Return the canonical absolute name of a given file.
- Copyright (C) 1996-2010 Free Software Foundation, Inc.
+ Copyright (C) 1996-2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/close-hook.c b/lib/close-hook.c
index 15d67fb62..0fdf32358 100644
--- a/lib/close-hook.c
+++ b/lib/close-hook.c
@@ -1,5 +1,5 @@
/* Hook for making the close() function extensible.
- Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2009-2011 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2009.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/close-hook.h b/lib/close-hook.h
index aff57574b..adcf11c22 100644
--- a/lib/close-hook.h
+++ b/lib/close-hook.h
@@ -1,5 +1,5 @@
/* Hook for making the close() function extensible.
- Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+ 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
diff --git a/lib/mbrlen.c b/lib/close.c
index 1bd1cf453..9d72f7cad 100644
--- a/lib/mbrlen.c
+++ b/lib/close.c
@@ -1,6 +1,5 @@
-/* Recognize multibyte character.
- Copyright (C) 1999-2000, 2008-2010 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2008.
+/* close replacement.
+ Copyright (C) 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
@@ -18,15 +17,26 @@
#include <config.h>
/* Specification. */
-#include <wchar.h>
+#include <unistd.h>
+#include "close-hook.h"
-static mbstate_t internal_state;
+/* Override close() to call into other gnulib modules. */
-size_t
-mbrlen (const char *s, size_t n, mbstate_t *ps)
+int
+rpl_close (int fd)
+#undef close
{
- if (ps == NULL)
- ps = &internal_state;
- return mbrtowc (NULL, s, n, ps);
+#if WINDOWS_SOCKETS
+ int retval = execute_all_close_hooks (fd);
+#else
+ int retval = close (fd);
+#endif
+
+#if REPLACE_FCHDIR
+ if (retval >= 0)
+ _gl_unregister_fd (fd);
+#endif
+
+ return retval;
}
diff --git a/lib/config.charset b/lib/config.charset
deleted file mode 100644
index 7435711c6..000000000
--- a/lib/config.charset
+++ /dev/null
@@ -1,683 +0,0 @@
-#! /bin/sh
-# Output a system dependent table of character encoding aliases.
-#
-# Copyright (C) 2000-2004, 2006-2010 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published 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.
-#
-# The table consists of lines of the form
-# ALIAS CANONICAL
-#
-# ALIAS is the (system dependent) result of "nl_langinfo (CODESET)".
-# ALIAS is compared in a case sensitive way.
-#
-# CANONICAL is the GNU canonical name for this character encoding.
-# It must be an encoding supported by libiconv. Support by GNU libc is
-# also desirable. CANONICAL is case insensitive. Usually an upper case
-# MIME charset name is preferred.
-# The current list of GNU canonical charset names is as follows.
-#
-# name MIME? used by which systems
-# ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin cygwin
-# ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin
-# ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin
-# ISO-8859-3 Y glibc solaris cygwin
-# ISO-8859-4 Y osf solaris freebsd netbsd openbsd darwin
-# ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin
-# ISO-8859-6 Y glibc aix hpux solaris cygwin
-# ISO-8859-7 Y glibc aix hpux irix osf solaris netbsd openbsd darwin cygwin
-# ISO-8859-8 Y glibc aix hpux osf solaris cygwin
-# ISO-8859-9 Y glibc aix hpux irix osf solaris darwin cygwin
-# ISO-8859-13 glibc netbsd openbsd darwin cygwin
-# ISO-8859-14 glibc cygwin
-# ISO-8859-15 glibc aix osf solaris freebsd netbsd openbsd darwin cygwin
-# KOI8-R Y glibc solaris freebsd netbsd openbsd darwin
-# KOI8-U Y glibc freebsd netbsd openbsd darwin cygwin
-# KOI8-T glibc
-# CP437 dos
-# CP775 dos
-# CP850 aix osf dos
-# CP852 dos
-# CP855 dos
-# CP856 aix
-# CP857 dos
-# CP861 dos
-# CP862 dos
-# CP864 dos
-# CP865 dos
-# CP866 freebsd netbsd openbsd darwin dos
-# CP869 dos
-# CP874 woe32 dos
-# CP922 aix
-# CP932 aix cygwin woe32 dos
-# CP943 aix
-# CP949 osf darwin woe32 dos
-# CP950 woe32 dos
-# CP1046 aix
-# CP1124 aix
-# CP1125 dos
-# CP1129 aix
-# CP1131 darwin
-# CP1250 woe32
-# CP1251 glibc solaris netbsd openbsd darwin cygwin woe32
-# CP1252 aix woe32
-# CP1253 woe32
-# CP1254 woe32
-# CP1255 glibc woe32
-# CP1256 woe32
-# CP1257 woe32
-# GB2312 Y glibc aix hpux irix solaris freebsd netbsd darwin
-# EUC-JP Y glibc aix hpux irix osf solaris freebsd netbsd darwin
-# EUC-KR Y glibc aix hpux irix osf solaris freebsd netbsd darwin cygwin
-# EUC-TW glibc aix hpux irix osf solaris netbsd
-# BIG5 Y glibc aix hpux osf solaris freebsd netbsd darwin cygwin
-# BIG5-HKSCS glibc solaris darwin
-# GBK glibc aix osf solaris darwin cygwin woe32 dos
-# GB18030 glibc solaris netbsd darwin
-# SHIFT_JIS Y hpux osf solaris freebsd netbsd darwin
-# JOHAB glibc solaris woe32
-# TIS-620 glibc aix hpux osf solaris cygwin
-# VISCII Y glibc
-# TCVN5712-1 glibc
-# ARMSCII-8 glibc darwin
-# GEORGIAN-PS glibc cygwin
-# PT154 glibc
-# HP-ROMAN8 hpux
-# HP-ARABIC8 hpux
-# HP-GREEK8 hpux
-# HP-HEBREW8 hpux
-# HP-TURKISH8 hpux
-# HP-KANA8 hpux
-# DEC-KANJI osf
-# DEC-HANYU osf
-# UTF-8 Y glibc aix hpux osf solaris netbsd darwin cygwin
-#
-# Note: Names which are not marked as being a MIME name should not be used in
-# Internet protocols for information interchange (mail, news, etc.).
-#
-# Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications
-# must understand both names and treat them as equivalent.
-#
-# The first argument passed to this file is the canonical host specification,
-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or
-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-
-host="$1"
-os=`echo "$host" | sed -e 's/^[^-]*-[^-]*-\(.*\)$/\1/'`
-echo "# This file contains a table of character encoding aliases,"
-echo "# suitable for operating system '${os}'."
-echo "# It was automatically generated from config.charset."
-# List of references, updated during installation:
-echo "# Packages using this file: "
-case "$os" in
- linux-gnulibc1*)
- # Linux libc5 doesn't have nl_langinfo(CODESET); therefore
- # localcharset.c falls back to using the full locale name
- # from the environment variables.
- echo "C ASCII"
- echo "POSIX ASCII"
- for l in af af_ZA ca ca_ES da da_DK de de_AT de_BE de_CH de_DE de_LU \
- en en_AU en_BW en_CA en_DK en_GB en_IE en_NZ en_US en_ZA \
- en_ZW es es_AR es_BO es_CL es_CO es_DO es_EC es_ES es_GT \
- es_HN es_MX es_PA es_PE es_PY es_SV es_US es_UY es_VE et \
- et_EE eu eu_ES fi fi_FI fo fo_FO fr fr_BE fr_CA fr_CH fr_FR \
- fr_LU ga ga_IE gl gl_ES id id_ID in in_ID is is_IS it it_CH \
- it_IT kl kl_GL nl nl_BE nl_NL no no_NO pt pt_BR pt_PT sv \
- sv_FI sv_SE; do
- echo "$l ISO-8859-1"
- echo "$l.iso-8859-1 ISO-8859-1"
- echo "$l.iso-8859-15 ISO-8859-15"
- echo "$l.iso-8859-15@euro ISO-8859-15"
- echo "$l@euro ISO-8859-15"
- echo "$l.cp-437 CP437"
- echo "$l.cp-850 CP850"
- echo "$l.cp-1252 CP1252"
- echo "$l.cp-1252@euro CP1252"
- #echo "$l.atari-st ATARI-ST" # not a commonly used encoding
- echo "$l.utf-8 UTF-8"
- echo "$l.utf-8@euro UTF-8"
- done
- for l in cs cs_CZ hr hr_HR hu hu_HU pl pl_PL ro ro_RO sk sk_SK sl \
- sl_SI sr sr_CS sr_YU; do
- echo "$l ISO-8859-2"
- echo "$l.iso-8859-2 ISO-8859-2"
- echo "$l.cp-852 CP852"
- echo "$l.cp-1250 CP1250"
- echo "$l.utf-8 UTF-8"
- done
- for l in mk mk_MK ru ru_RU; do
- echo "$l ISO-8859-5"
- echo "$l.iso-8859-5 ISO-8859-5"
- echo "$l.koi8-r KOI8-R"
- echo "$l.cp-866 CP866"
- echo "$l.cp-1251 CP1251"
- echo "$l.utf-8 UTF-8"
- done
- for l in ar ar_SA; do
- echo "$l ISO-8859-6"
- echo "$l.iso-8859-6 ISO-8859-6"
- echo "$l.cp-864 CP864"
- #echo "$l.cp-868 CP868" # not a commonly used encoding
- echo "$l.cp-1256 CP1256"
- echo "$l.utf-8 UTF-8"
- done
- for l in el el_GR gr gr_GR; do
- echo "$l ISO-8859-7"
- echo "$l.iso-8859-7 ISO-8859-7"
- echo "$l.cp-869 CP869"
- echo "$l.cp-1253 CP1253"
- echo "$l.cp-1253@euro CP1253"
- echo "$l.utf-8 UTF-8"
- echo "$l.utf-8@euro UTF-8"
- done
- for l in he he_IL iw iw_IL; do
- echo "$l ISO-8859-8"
- echo "$l.iso-8859-8 ISO-8859-8"
- echo "$l.cp-862 CP862"
- echo "$l.cp-1255 CP1255"
- echo "$l.utf-8 UTF-8"
- done
- for l in tr tr_TR; do
- echo "$l ISO-8859-9"
- echo "$l.iso-8859-9 ISO-8859-9"
- echo "$l.cp-857 CP857"
- echo "$l.cp-1254 CP1254"
- echo "$l.utf-8 UTF-8"
- done
- for l in lt lt_LT lv lv_LV; do
- #echo "$l BALTIC" # not a commonly used encoding, wrong encoding name
- echo "$l ISO-8859-13"
- done
- for l in ru_UA uk uk_UA; do
- echo "$l KOI8-U"
- done
- for l in zh zh_CN; do
- #echo "$l GB_2312-80" # not a commonly used encoding, wrong encoding name
- echo "$l GB2312"
- done
- for l in ja ja_JP ja_JP.EUC; do
- echo "$l EUC-JP"
- done
- for l in ko ko_KR; do
- echo "$l EUC-KR"
- done
- for l in th th_TH; do
- echo "$l TIS-620"
- done
- for l in fa fa_IR; do
- #echo "$l ISIRI-3342" # a broken encoding
- echo "$l.utf-8 UTF-8"
- done
- ;;
- linux* | *-gnu*)
- # With glibc-2.1 or newer, we don't need any canonicalization,
- # because glibc has iconv and both glibc and libiconv support all
- # GNU canonical names directly. Therefore, the Makefile does not
- # need to install the alias file at all.
- # The following applies only to glibc-2.0.x and older libcs.
- echo "ISO_646.IRV:1983 ASCII"
- ;;
- aix*)
- echo "ISO8859-1 ISO-8859-1"
- echo "ISO8859-2 ISO-8859-2"
- echo "ISO8859-5 ISO-8859-5"
- echo "ISO8859-6 ISO-8859-6"
- echo "ISO8859-7 ISO-8859-7"
- echo "ISO8859-8 ISO-8859-8"
- echo "ISO8859-9 ISO-8859-9"
- echo "ISO8859-15 ISO-8859-15"
- echo "IBM-850 CP850"
- echo "IBM-856 CP856"
- echo "IBM-921 ISO-8859-13"
- echo "IBM-922 CP922"
- echo "IBM-932 CP932"
- echo "IBM-943 CP943"
- echo "IBM-1046 CP1046"
- echo "IBM-1124 CP1124"
- echo "IBM-1129 CP1129"
- echo "IBM-1252 CP1252"
- echo "IBM-eucCN GB2312"
- echo "IBM-eucJP EUC-JP"
- echo "IBM-eucKR EUC-KR"
- echo "IBM-eucTW EUC-TW"
- echo "big5 BIG5"
- echo "GBK GBK"
- echo "TIS-620 TIS-620"
- echo "UTF-8 UTF-8"
- ;;
- hpux*)
- echo "iso88591 ISO-8859-1"
- echo "iso88592 ISO-8859-2"
- echo "iso88595 ISO-8859-5"
- echo "iso88596 ISO-8859-6"
- echo "iso88597 ISO-8859-7"
- echo "iso88598 ISO-8859-8"
- echo "iso88599 ISO-8859-9"
- echo "iso885915 ISO-8859-15"
- echo "roman8 HP-ROMAN8"
- echo "arabic8 HP-ARABIC8"
- echo "greek8 HP-GREEK8"
- echo "hebrew8 HP-HEBREW8"
- echo "turkish8 HP-TURKISH8"
- echo "kana8 HP-KANA8"
- echo "tis620 TIS-620"
- echo "big5 BIG5"
- echo "eucJP EUC-JP"
- echo "eucKR EUC-KR"
- echo "eucTW EUC-TW"
- echo "hp15CN GB2312"
- #echo "ccdc ?" # what is this?
- echo "SJIS SHIFT_JIS"
- echo "utf8 UTF-8"
- ;;
- irix*)
- echo "ISO8859-1 ISO-8859-1"
- echo "ISO8859-2 ISO-8859-2"
- echo "ISO8859-5 ISO-8859-5"
- echo "ISO8859-7 ISO-8859-7"
- echo "ISO8859-9 ISO-8859-9"
- echo "eucCN GB2312"
- echo "eucJP EUC-JP"
- echo "eucKR EUC-KR"
- echo "eucTW EUC-TW"
- ;;
- osf*)
- echo "ISO8859-1 ISO-8859-1"
- echo "ISO8859-2 ISO-8859-2"
- echo "ISO8859-4 ISO-8859-4"
- echo "ISO8859-5 ISO-8859-5"
- echo "ISO8859-7 ISO-8859-7"
- echo "ISO8859-8 ISO-8859-8"
- echo "ISO8859-9 ISO-8859-9"
- echo "ISO8859-15 ISO-8859-15"
- echo "cp850 CP850"
- echo "big5 BIG5"
- echo "dechanyu DEC-HANYU"
- echo "dechanzi GB2312"
- echo "deckanji DEC-KANJI"
- echo "deckorean EUC-KR"
- echo "eucJP EUC-JP"
- echo "eucKR EUC-KR"
- echo "eucTW EUC-TW"
- echo "GBK GBK"
- echo "KSC5601 CP949"
- echo "sdeckanji EUC-JP"
- echo "SJIS SHIFT_JIS"
- echo "TACTIS TIS-620"
- echo "UTF-8 UTF-8"
- ;;
- solaris*)
- echo "646 ASCII"
- echo "ISO8859-1 ISO-8859-1"
- echo "ISO8859-2 ISO-8859-2"
- echo "ISO8859-3 ISO-8859-3"
- echo "ISO8859-4 ISO-8859-4"
- echo "ISO8859-5 ISO-8859-5"
- echo "ISO8859-6 ISO-8859-6"
- echo "ISO8859-7 ISO-8859-7"
- echo "ISO8859-8 ISO-8859-8"
- echo "ISO8859-9 ISO-8859-9"
- echo "ISO8859-15 ISO-8859-15"
- echo "koi8-r KOI8-R"
- echo "ansi-1251 CP1251"
- echo "BIG5 BIG5"
- echo "Big5-HKSCS BIG5-HKSCS"
- echo "gb2312 GB2312"
- echo "GBK GBK"
- echo "GB18030 GB18030"
- echo "cns11643 EUC-TW"
- echo "5601 EUC-KR"
- echo "ko_KR.johap92 JOHAB"
- echo "eucJP EUC-JP"
- echo "PCK SHIFT_JIS"
- echo "TIS620.2533 TIS-620"
- #echo "sun_eu_greek ?" # what is this?
- echo "UTF-8 UTF-8"
- ;;
- freebsd* | os2*)
- # FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore
- # localcharset.c falls back to using the full locale name
- # from the environment variables.
- # Likewise for OS/2. OS/2 has XFree86 just like FreeBSD. Just
- # reuse FreeBSD's locale data for OS/2.
- echo "C ASCII"
- echo "US-ASCII ASCII"
- for l in la_LN lt_LN; do
- echo "$l.ASCII ASCII"
- done
- for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
- fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \
- lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do
- echo "$l.ISO_8859-1 ISO-8859-1"
- echo "$l.DIS_8859-15 ISO-8859-15"
- done
- for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do
- echo "$l.ISO_8859-2 ISO-8859-2"
- done
- for l in la_LN lt_LT; do
- echo "$l.ISO_8859-4 ISO-8859-4"
- done
- for l in ru_RU ru_SU; do
- echo "$l.KOI8-R KOI8-R"
- echo "$l.ISO_8859-5 ISO-8859-5"
- echo "$l.CP866 CP866"
- done
- echo "uk_UA.KOI8-U KOI8-U"
- echo "zh_TW.BIG5 BIG5"
- echo "zh_TW.Big5 BIG5"
- echo "zh_CN.EUC GB2312"
- echo "ja_JP.EUC EUC-JP"
- echo "ja_JP.SJIS SHIFT_JIS"
- echo "ja_JP.Shift_JIS SHIFT_JIS"
- echo "ko_KR.EUC EUC-KR"
- ;;
- netbsd*)
- echo "646 ASCII"
- echo "ISO8859-1 ISO-8859-1"
- echo "ISO8859-2 ISO-8859-2"
- echo "ISO8859-4 ISO-8859-4"
- echo "ISO8859-5 ISO-8859-5"
- echo "ISO8859-7 ISO-8859-7"
- echo "ISO8859-13 ISO-8859-13"
- echo "ISO8859-15 ISO-8859-15"
- echo "eucCN GB2312"
- echo "eucJP EUC-JP"
- echo "eucKR EUC-KR"
- echo "eucTW EUC-TW"
- echo "BIG5 BIG5"
- echo "SJIS SHIFT_JIS"
- ;;
- openbsd*)
- echo "646 ASCII"
- echo "ISO8859-1 ISO-8859-1"
- echo "ISO8859-2 ISO-8859-2"
- echo "ISO8859-4 ISO-8859-4"
- echo "ISO8859-5 ISO-8859-5"
- echo "ISO8859-7 ISO-8859-7"
- echo "ISO8859-13 ISO-8859-13"
- echo "ISO8859-15 ISO-8859-15"
- ;;
- darwin[56]*)
- # Darwin 6.8 doesn't have nl_langinfo(CODESET); therefore
- # localcharset.c falls back to using the full locale name
- # from the environment variables.
- echo "C ASCII"
- for l in en_AU en_CA en_GB en_US la_LN; do
- echo "$l.US-ASCII ASCII"
- done
- for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
- fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT nl_BE \
- nl_NL no_NO pt_PT sv_SE; do
- echo "$l ISO-8859-1"
- echo "$l.ISO8859-1 ISO-8859-1"
- echo "$l.ISO8859-15 ISO-8859-15"
- done
- for l in la_LN; do
- echo "$l.ISO8859-1 ISO-8859-1"
- echo "$l.ISO8859-15 ISO-8859-15"
- done
- for l in cs_CZ hr_HR hu_HU la_LN pl_PL sl_SI; do
- echo "$l.ISO8859-2 ISO-8859-2"
- done
- for l in la_LN lt_LT; do
- echo "$l.ISO8859-4 ISO-8859-4"
- done
- for l in ru_RU; do
- echo "$l.KOI8-R KOI8-R"
- echo "$l.ISO8859-5 ISO-8859-5"
- echo "$l.CP866 CP866"
- done
- for l in bg_BG; do
- echo "$l.CP1251 CP1251"
- done
- echo "uk_UA.KOI8-U KOI8-U"
- echo "zh_TW.BIG5 BIG5"
- echo "zh_TW.Big5 BIG5"
- echo "zh_CN.EUC GB2312"
- echo "ja_JP.EUC EUC-JP"
- echo "ja_JP.SJIS SHIFT_JIS"
- echo "ko_KR.EUC EUC-KR"
- ;;
- darwin*)
- # Darwin 7.5 has nl_langinfo(CODESET), but sometimes its value is
- # useless:
- # - It returns the empty string when LANG is set to a locale of the
- # form ll_CC, although ll_CC/LC_CTYPE is a symlink to an UTF-8
- # LC_CTYPE file.
- # - The environment variables LANG, LC_CTYPE, LC_ALL are not set by
- # the system; nl_langinfo(CODESET) returns "US-ASCII" in this case.
- # - The documentation says:
- # "... all code that calls BSD system routines should ensure
- # that the const *char parameters of these routines are in UTF-8
- # encoding. All BSD system functions expect their string
- # parameters to be in UTF-8 encoding and nothing else."
- # It also says
- # "An additional caveat is that string parameters for files,
- # paths, and other file-system entities must be in canonical
- # UTF-8. In a canonical UTF-8 Unicode string, all decomposable
- # characters are decomposed ..."
- # but this is not true: You can pass non-decomposed UTF-8 strings
- # to file system functions, and it is the OS which will convert
- # them to decomposed UTF-8 before accessing the file system.
- # - The Apple Terminal application displays UTF-8 by default.
- # - However, other applications are free to use different encodings:
- # - xterm uses ISO-8859-1 by default.
- # - TextEdit uses MacRoman by default.
- # We prefer UTF-8 over decomposed UTF-8-MAC because one should
- # minimize the use of decomposed Unicode. Unfortunately, through the
- # Darwin file system, decomposed UTF-8 strings are leaked into user
- # space nevertheless.
- # Then there are also the locales with encodings other than US-ASCII
- # and UTF-8. These locales can be occasionally useful to users (e.g.
- # when grepping through ISO-8859-1 encoded text files), when all their
- # file names are in US-ASCII.
- echo "ISO8859-1 ISO-8859-1"
- echo "ISO8859-2 ISO-8859-2"
- echo "ISO8859-4 ISO-8859-4"
- echo "ISO8859-5 ISO-8859-5"
- echo "ISO8859-7 ISO-8859-7"
- echo "ISO8859-9 ISO-8859-9"
- echo "ISO8859-13 ISO-8859-13"
- echo "ISO8859-15 ISO-8859-15"
- echo "KOI8-R KOI8-R"
- echo "KOI8-U KOI8-U"
- echo "CP866 CP866"
- echo "CP949 CP949"
- echo "CP1131 CP1131"
- echo "CP1251 CP1251"
- echo "eucCN GB2312"
- echo "GB2312 GB2312"
- echo "eucJP EUC-JP"
- echo "eucKR EUC-KR"
- echo "Big5 BIG5"
- echo "Big5HKSCS BIG5-HKSCS"
- echo "GBK GBK"
- echo "GB18030 GB18030"
- echo "SJIS SHIFT_JIS"
- echo "ARMSCII-8 ARMSCII-8"
- echo "PT154 PT154"
- #echo "ISCII-DEV ?"
- echo "* UTF-8"
- ;;
- beos* | haiku*)
- # BeOS and Haiku have a single locale, and it has UTF-8 encoding.
- echo "* UTF-8"
- ;;
- msdosdjgpp*)
- # DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore
- # localcharset.c falls back to using the full locale name
- # from the environment variables.
- echo "#"
- echo "# The encodings given here may not all be correct."
- echo "# If you find that the encoding given for your language and"
- echo "# country is not the one your DOS machine actually uses, just"
- echo "# correct it in this file, and send a mail to"
- echo "# Juan Manuel Guerrero <juan.guerrero@gmx.de>"
- echo "# and Bruno Haible <bruno@clisp.org>."
- echo "#"
- echo "C ASCII"
- # ISO-8859-1 languages
- echo "ca CP850"
- echo "ca_ES CP850"
- echo "da CP865" # not CP850 ??
- echo "da_DK CP865" # not CP850 ??
- echo "de CP850"
- echo "de_AT CP850"
- echo "de_CH CP850"
- echo "de_DE CP850"
- echo "en CP850"
- echo "en_AU CP850" # not CP437 ??
- echo "en_CA CP850"
- echo "en_GB CP850"
- echo "en_NZ CP437"
- echo "en_US CP437"
- echo "en_ZA CP850" # not CP437 ??
- echo "es CP850"
- echo "es_AR CP850"
- echo "es_BO CP850"
- echo "es_CL CP850"
- echo "es_CO CP850"
- echo "es_CR CP850"
- echo "es_CU CP850"
- echo "es_DO CP850"
- echo "es_EC CP850"
- echo "es_ES CP850"
- echo "es_GT CP850"
- echo "es_HN CP850"
- echo "es_MX CP850"
- echo "es_NI CP850"
- echo "es_PA CP850"
- echo "es_PY CP850"
- echo "es_PE CP850"
- echo "es_SV CP850"
- echo "es_UY CP850"
- echo "es_VE CP850"
- echo "et CP850"
- echo "et_EE CP850"
- echo "eu CP850"
- echo "eu_ES CP850"
- echo "fi CP850"
- echo "fi_FI CP850"
- echo "fr CP850"
- echo "fr_BE CP850"
- echo "fr_CA CP850"
- echo "fr_CH CP850"
- echo "fr_FR CP850"
- echo "ga CP850"
- echo "ga_IE CP850"
- echo "gd CP850"
- echo "gd_GB CP850"
- echo "gl CP850"
- echo "gl_ES CP850"
- echo "id CP850" # not CP437 ??
- echo "id_ID CP850" # not CP437 ??
- echo "is CP861" # not CP850 ??
- echo "is_IS CP861" # not CP850 ??
- echo "it CP850"
- echo "it_CH CP850"
- echo "it_IT CP850"
- echo "lt CP775"
- echo "lt_LT CP775"
- echo "lv CP775"
- echo "lv_LV CP775"
- echo "nb CP865" # not CP850 ??
- echo "nb_NO CP865" # not CP850 ??
- echo "nl CP850"
- echo "nl_BE CP850"
- echo "nl_NL CP850"
- echo "nn CP865" # not CP850 ??
- echo "nn_NO CP865" # not CP850 ??
- echo "no CP865" # not CP850 ??
- echo "no_NO CP865" # not CP850 ??
- echo "pt CP850"
- echo "pt_BR CP850"
- echo "pt_PT CP850"
- echo "sv CP850"
- echo "sv_SE CP850"
- # ISO-8859-2 languages
- echo "cs CP852"
- echo "cs_CZ CP852"
- echo "hr CP852"
- echo "hr_HR CP852"
- echo "hu CP852"
- echo "hu_HU CP852"
- echo "pl CP852"
- echo "pl_PL CP852"
- echo "ro CP852"
- echo "ro_RO CP852"
- echo "sk CP852"
- echo "sk_SK CP852"
- echo "sl CP852"
- echo "sl_SI CP852"
- echo "sq CP852"
- echo "sq_AL CP852"
- echo "sr CP852" # CP852 or CP866 or CP855 ??
- echo "sr_CS CP852" # CP852 or CP866 or CP855 ??
- echo "sr_YU CP852" # CP852 or CP866 or CP855 ??
- # ISO-8859-3 languages
- echo "mt CP850"
- echo "mt_MT CP850"
- # ISO-8859-5 languages
- echo "be CP866"
- echo "be_BE CP866"
- echo "bg CP866" # not CP855 ??
- echo "bg_BG CP866" # not CP855 ??
- echo "mk CP866" # not CP855 ??
- echo "mk_MK CP866" # not CP855 ??
- echo "ru CP866"
- echo "ru_RU CP866"
- echo "uk CP1125"
- echo "uk_UA CP1125"
- # ISO-8859-6 languages
- echo "ar CP864"
- echo "ar_AE CP864"
- echo "ar_DZ CP864"
- echo "ar_EG CP864"
- echo "ar_IQ CP864"
- echo "ar_IR CP864"
- echo "ar_JO CP864"
- echo "ar_KW CP864"
- echo "ar_MA CP864"
- echo "ar_OM CP864"
- echo "ar_QA CP864"
- echo "ar_SA CP864"
- echo "ar_SY CP864"
- # ISO-8859-7 languages
- echo "el CP869"
- echo "el_GR CP869"
- # ISO-8859-8 languages
- echo "he CP862"
- echo "he_IL CP862"
- # ISO-8859-9 languages
- echo "tr CP857"
- echo "tr_TR CP857"
- # Japanese
- echo "ja CP932"
- echo "ja_JP CP932"
- # Chinese
- echo "zh_CN GBK"
- echo "zh_TW CP950" # not CP938 ??
- # Korean
- echo "kr CP949" # not CP934 ??
- echo "kr_KR CP949" # not CP934 ??
- # Thai
- echo "th CP874"
- echo "th_TH CP874"
- # Other
- echo "eo CP850"
- echo "eo_EO CP850"
- ;;
-esac
diff --git a/lib/connect.c b/lib/connect.c
new file mode 100644
index 000000000..730331b52
--- /dev/null
+++ b/lib/connect.c
@@ -0,0 +1,47 @@
+/* connect.c --- wrappers for Windows connect function
+
+ Copyright (C) 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/>. */
+
+/* Written by Paolo Bonzini */
+
+#include <config.h>
+
+#define WIN32_LEAN_AND_MEAN
+/* Get winsock2.h. */
+#include <sys/socket.h>
+
+/* Get set_winsock_errno, FD_TO_SOCKET etc. */
+#include "w32sock.h"
+
+#undef connect
+
+int
+rpl_connect (int fd, const struct sockaddr *sockaddr, socklen_t len)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = connect (sock, sockaddr, len);
+ if (r < 0)
+ {
+ /* EINPROGRESS is not returned by WinSock 2.0; for backwards
+ compatibility, connect(2) uses EWOULDBLOCK. */
+ if (WSAGetLastError () == WSAEWOULDBLOCK)
+ WSASetLastError (WSAEINPROGRESS);
+
+ set_winsock_errno ();
+ }
+
+ return r;
+}
diff --git a/lib/duplocale.c b/lib/duplocale.c
index 23527b1da..8b1bf34da 100644
--- a/lib/duplocale.c
+++ b/lib/duplocale.c
@@ -1,5 +1,5 @@
/* Duplicate a locale object.
- Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+ 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
diff --git a/lib/errno.in.h b/lib/errno.in.h
index 3543adc12..98355be69 100644
--- a/lib/errno.in.h
+++ b/lib/errno.in.h
@@ -1,6 +1,6 @@
/* A POSIX-like <errno.h>.
- Copyright (C) 2008-2010 Free Software Foundation, Inc.
+ Copyright (C) 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
diff --git a/lib/fclose.c b/lib/fclose.c
new file mode 100644
index 000000000..805449a20
--- /dev/null
+++ b/lib/fclose.c
@@ -0,0 +1,47 @@
+/* fclose replacement.
+ Copyright (C) 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/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include <stdio.h>
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Override fclose() to call the overridden close(). */
+
+int
+rpl_fclose (FILE *fp)
+#undef fclose
+{
+ int saved_errno = 0;
+
+ if (fflush (fp))
+ saved_errno = errno;
+
+ if (close (fileno (fp)) < 0 && saved_errno == 0)
+ saved_errno = errno;
+
+ fclose (fp); /* will fail with errno = EBADF */
+
+ if (saved_errno != 0)
+ {
+ errno = saved_errno;
+ return EOF;
+ }
+ return 0;
+}
diff --git a/lib/float+.h b/lib/float+.h
index 5a4955f24..78019e50b 100644
--- a/lib/float+.h
+++ b/lib/float+.h
@@ -1,5 +1,5 @@
/* Supplemental information about the floating-point formats.
- Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/float.in.h b/lib/float.in.h
index 83fbf9f9d..d252bf074 100644
--- a/lib/float.in.h
+++ b/lib/float.in.h
@@ -1,6 +1,6 @@
/* A correct <float.h>.
- Copyright (C) 2007-2010 Free Software Foundation, Inc.
+ 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
diff --git a/lib/flock.c b/lib/flock.c
index 72eef5bd3..bdec6d48e 100644
--- a/lib/flock.c
+++ b/lib/flock.c
@@ -6,7 +6,7 @@
Written by Richard W.M. Jones <rjones.at.redhat.com>
- Copyright (C) 2008-2010 Free Software Foundation, Inc.
+ Copyright (C) 2008-2011 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -163,9 +163,7 @@ flock (int fd, int operation)
#ifdef HAVE_STRUCT_FLOCK_L_TYPE
/* We know how to implement flock in terms of fcntl. */
-#ifdef HAVE_FCNTL_H
#include <fcntl.h>
-#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
diff --git a/lib/full-read.c b/lib/full-read.c
index 93d378d77..2f7802087 100644
--- a/lib/full-read.c
+++ b/lib/full-read.c
@@ -1,5 +1,5 @@
/* An interface to read that retries after partial reads and interrupts.
- Copyright (C) 2002-2003, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 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
diff --git a/lib/full-read.h b/lib/full-read.h
index 71817a725..313d4748d 100644
--- a/lib/full-read.h
+++ b/lib/full-read.h
@@ -1,6 +1,6 @@
/* An interface to read() that reads all it is asked to read.
- Copyright (C) 2002, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2002, 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
diff --git a/lib/full-write.c b/lib/full-write.c
index b0f6b2702..b60ba0286 100644
--- a/lib/full-write.c
+++ b/lib/full-write.c
@@ -1,6 +1,6 @@
/* An interface to read and write that retries (if necessary) until complete.
- Copyright (C) 1993-1994, 1997-2006, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 1993-1994, 1997-2006, 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
diff --git a/lib/full-write.h b/lib/full-write.h
index 03dabfb9d..c059a63c7 100644
--- a/lib/full-write.h
+++ b/lib/full-write.h
@@ -1,6 +1,6 @@
/* An interface to write() that writes all it is asked to write.
- Copyright (C) 2002-2003, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 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
diff --git a/lib/gai_strerror.c b/lib/gai_strerror.c
index 21e80765c..92b4dd054 100644
--- a/lib/gai_strerror.c
+++ b/lib/gai_strerror.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006, 2008, 2009, 2010 Free
- Software Foundation, Inc.
+/* Copyright (C) 1997, 2001-2002, 2004-2006, 2008-2011 Free Software
+ Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.
diff --git a/lib/getaddrinfo.c b/lib/getaddrinfo.c
index 13148713c..26100313c 100644
--- a/lib/getaddrinfo.c
+++ b/lib/getaddrinfo.c
@@ -1,5 +1,5 @@
/* Get address information (partial implementation).
- Copyright (C) 1997, 2001-2002, 2004-2010 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2001-2002, 2004-2011 Free Software Foundation, Inc.
Contributed by Simon Josefsson <simon@josefsson.org>.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/getpeername.c b/lib/getpeername.c
new file mode 100644
index 000000000..806bb4943
--- /dev/null
+++ b/lib/getpeername.c
@@ -0,0 +1,40 @@
+/* getpeername.c --- wrappers for Windows getpeername function
+
+ Copyright (C) 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/>. */
+
+/* Written by Paolo Bonzini */
+
+#include <config.h>
+
+#define WIN32_LEAN_AND_MEAN
+/* Get winsock2.h. */
+#include <sys/socket.h>
+
+/* Get set_winsock_errno, FD_TO_SOCKET etc. */
+#include "w32sock.h"
+
+#undef getpeername
+
+int
+rpl_getpeername (int fd, struct sockaddr *addr, socklen_t *addrlen)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = getpeername (sock, addr, addrlen);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
diff --git a/lib/getsockname.c b/lib/getsockname.c
new file mode 100644
index 000000000..d48f26f23
--- /dev/null
+++ b/lib/getsockname.c
@@ -0,0 +1,40 @@
+/* getsockname.c --- wrappers for Windows getsockname function
+
+ Copyright (C) 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/>. */
+
+/* Written by Paolo Bonzini */
+
+#include <config.h>
+
+#define WIN32_LEAN_AND_MEAN
+/* Get winsock2.h. */
+#include <sys/socket.h>
+
+/* Get set_winsock_errno, FD_TO_SOCKET etc. */
+#include "w32sock.h"
+
+#undef getsockname
+
+int
+rpl_getsockname (int fd, struct sockaddr *addr, socklen_t *addrlen)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = getsockname (sock, addr, addrlen);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
diff --git a/lib/getsockopt.c b/lib/getsockopt.c
new file mode 100644
index 000000000..7c83f01aa
--- /dev/null
+++ b/lib/getsockopt.c
@@ -0,0 +1,67 @@
+/* getsockopt.c --- wrappers for Windows getsockopt function
+
+ Copyright (C) 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/>. */
+
+/* Written by Paolo Bonzini */
+
+#include <config.h>
+
+#define WIN32_LEAN_AND_MEAN
+/* Get winsock2.h. */
+#include <sys/socket.h>
+
+/* Get struct timeval. */
+#include <sys/time.h>
+
+/* Get memcpy. */
+#include <string.h>
+
+/* Get set_winsock_errno, FD_TO_SOCKET etc. */
+#include "w32sock.h"
+
+#undef getsockopt
+
+int
+rpl_getsockopt (int fd, int level, int optname, void *optval, socklen_t *optlen)
+{
+ int r;
+ SOCKET sock = FD_TO_SOCKET (fd);
+
+ if (level == SOL_SOCKET && (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO))
+ {
+ int milliseconds;
+ int milliseconds_len = sizeof (int);
+ struct timeval tv;
+ size_t n;
+ r = getsockopt (sock, level, optname, &milliseconds, &milliseconds_len);
+ tv.tv_sec = milliseconds / 1000;
+ tv.tv_usec = (milliseconds - 1000 * tv.tv_sec) * 1000;
+ n = sizeof (struct timeval);
+ if (n > *optlen)
+ n = *optlen;
+ memcpy (optval, &tv, n);
+ *optlen = n;
+ }
+ else
+ {
+ r = getsockopt (sock, level, optname, optval, optlen);
+ }
+
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
diff --git a/lib/gettext.h b/lib/gettext.h
index d7705b594..9d339a6d1 100644
--- a/lib/gettext.h
+++ b/lib/gettext.h
@@ -1,5 +1,5 @@
/* Convenience header for conditional use of GNU <libintl.h>.
- Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2010 Free Software
+ Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2011 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -93,6 +93,12 @@
#endif
+/* Prefer gnulib's setlocale override over libintl's setlocale override. */
+#ifdef GNULIB_defined_setlocale
+# undef setlocale
+# define setlocale rpl_setlocale
+#endif
+
/* A pseudo function call that serves as a marker for the automated
extraction of messages, but does not call gettext(). The run-time
translation is done at a different place in the code.
diff --git a/lib/iconv.c b/lib/iconv.c
index 5b29d9af3..f607ed3aa 100644
--- a/lib/iconv.c
+++ b/lib/iconv.c
@@ -1,5 +1,5 @@
/* Character set conversion.
- Copyright (C) 1999-2001, 2007, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 1999-2001, 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
diff --git a/lib/iconv.in.h b/lib/iconv.in.h
index 260c75855..6cb698e92 100644
--- a/lib/iconv.in.h
+++ b/lib/iconv.in.h
@@ -1,6 +1,6 @@
/* A GNU-like <iconv.h>.
- Copyright (C) 2007-2010 Free Software Foundation, Inc.
+ 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
diff --git a/lib/iconv_close.c b/lib/iconv_close.c
index 1b300ec7b..d015f7457 100644
--- a/lib/iconv_close.c
+++ b/lib/iconv_close.c
@@ -1,5 +1,5 @@
/* Character set conversion.
- Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
+ 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
diff --git a/lib/iconv_open.c b/lib/iconv_open.c
index 1d1c05368..b17a3b2f6 100644
--- a/lib/iconv_open.c
+++ b/lib/iconv_open.c
@@ -1,5 +1,5 @@
/* Character set conversion.
- Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
+ 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
diff --git a/lib/iconveh.h b/lib/iconveh.h
index da15126b1..2a4f34b4c 100644
--- a/lib/iconveh.h
+++ b/lib/iconveh.h
@@ -1,5 +1,5 @@
/* Character set conversion handler type.
- Copyright (C) 2001-2007, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2001-2007, 2009-2011 Free Software Foundation, Inc.
Written by Bruno Haible.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/inet_ntop.c b/lib/inet_ntop.c
index fc8c683fa..64f90a1fd 100644
--- a/lib/inet_ntop.c
+++ b/lib/inet_ntop.c
@@ -1,6 +1,6 @@
/* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form
- Copyright (C) 2005-2006, 2008-2010 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 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
diff --git a/lib/inet_pton.c b/lib/inet_pton.c
index e7d4ba024..bceeec6ca 100644
--- a/lib/inet_pton.c
+++ b/lib/inet_pton.c
@@ -1,6 +1,6 @@
/* inet_pton.c -- convert IPv4 and IPv6 addresses from text to binary form
- Copyright (C) 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2006, 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
diff --git a/lib/isinf.c b/lib/isinf.c
index a2d6d1085..28cfc4d49 100644
--- a/lib/isinf.c
+++ b/lib/isinf.c
@@ -1,5 +1,5 @@
/* Test for positive or negative infinity.
- Copyright (C) 2007-2010 Free Software Foundation, Inc.
+ 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
diff --git a/lib/isnan.c b/lib/isnan.c
index ad96c1f56..e977be15d 100644
--- a/lib/isnan.c
+++ b/lib/isnan.c
@@ -1,5 +1,5 @@
/* Test for NaN that does not need libm.
- Copyright (C) 2007-2010 Free Software Foundation, Inc.
+ 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
diff --git a/lib/isnand.c b/lib/isnand.c
index f7a156587..adfac2788 100644
--- a/lib/isnand.c
+++ b/lib/isnand.c
@@ -1,5 +1,5 @@
/* Test for NaN that does not need libm.
- Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 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
diff --git a/lib/isnanf.c b/lib/isnanf.c
index a352fdbef..2fd06f8ac 100644
--- a/lib/isnanf.c
+++ b/lib/isnanf.c
@@ -1,5 +1,5 @@
/* Test for NaN that does not need libm.
- Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
+ 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
diff --git a/lib/isnanl.c b/lib/isnanl.c
index b45fef0a9..2e68d2826 100644
--- a/lib/isnanl.c
+++ b/lib/isnanl.c
@@ -1,5 +1,5 @@
/* Test for NaN that does not need libm.
- Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
+ 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
diff --git a/lib/listen.c b/lib/listen.c
new file mode 100644
index 000000000..a29090db7
--- /dev/null
+++ b/lib/listen.c
@@ -0,0 +1,40 @@
+/* listen.c --- wrappers for Windows listen function
+
+ Copyright (C) 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/>. */
+
+/* Written by Paolo Bonzini */
+
+#include <config.h>
+
+#define WIN32_LEAN_AND_MEAN
+/* Get winsock2.h. */
+#include <sys/socket.h>
+
+/* Get set_winsock_errno, FD_TO_SOCKET etc. */
+#include "w32sock.h"
+
+#undef listen
+
+int
+rpl_listen (int fd, int backlog)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = listen (sock, backlog);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
diff --git a/lib/localcharset.c b/lib/localcharset.c
deleted file mode 100644
index 6c233d1c0..000000000
--- a/lib/localcharset.c
+++ /dev/null
@@ -1,548 +0,0 @@
-/* Determine a canonical name for the current locale's character encoding.
-
- Copyright (C) 2000-2006, 2008-2010 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Written by Bruno Haible <bruno@clisp.org>. */
-
-#include <config.h>
-
-/* Specification. */
-#include "localcharset.h"
-
-#include <fcntl.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#if defined __APPLE__ && defined __MACH__ && HAVE_LANGINFO_CODESET
-# define DARWIN7 /* Darwin 7 or newer, i.e. MacOS X 10.3 or newer */
-#endif
-
-#if defined _WIN32 || defined __WIN32__
-# define WIN32_NATIVE
-#endif
-
-#if defined __EMX__
-/* Assume EMX program runs on OS/2, even if compiled under DOS. */
-# ifndef OS2
-# define OS2
-# endif
-#endif
-
-#if !defined WIN32_NATIVE
-# include <unistd.h>
-# if HAVE_LANGINFO_CODESET
-# include <langinfo.h>
-# else
-# if 0 /* see comment below */
-# include <locale.h>
-# endif
-# endif
-# ifdef __CYGWIN__
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-# endif
-#elif defined WIN32_NATIVE
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-#endif
-#if defined OS2
-# define INCL_DOS
-# include <os2.h>
-#endif
-
-#if ENABLE_RELOCATABLE
-# include "relocatable.h"
-#else
-# define relocate(pathname) (pathname)
-#endif
-
-/* Get LIBDIR. */
-#ifndef LIBDIR
-# include "configmake.h"
-#endif
-
-/* Define O_NOFOLLOW to 0 on platforms where it does not exist. */
-#ifndef O_NOFOLLOW
-# define O_NOFOLLOW 0
-#endif
-
-#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
- /* Win32, Cygwin, OS/2, DOS */
-# define ISSLASH(C) ((C) == '/' || (C) == '\\')
-#endif
-
-#ifndef DIRECTORY_SEPARATOR
-# define DIRECTORY_SEPARATOR '/'
-#endif
-
-#ifndef ISSLASH
-# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
-#endif
-
-#if HAVE_DECL_GETC_UNLOCKED
-# undef getc
-# define getc getc_unlocked
-#endif
-
-/* The following static variable is declared 'volatile' to avoid a
- possible multithread problem in the function get_charset_aliases. If we
- are running in a threaded environment, and if two threads initialize
- 'charset_aliases' simultaneously, both will produce the same value,
- and everything will be ok if the two assignments to 'charset_aliases'
- are atomic. But I don't know what will happen if the two assignments mix. */
-#if __STDC__ != 1
-# define volatile /* empty */
-#endif
-/* Pointer to the contents of the charset.alias file, if it has already been
- read, else NULL. Its format is:
- ALIAS_1 '\0' CANONICAL_1 '\0' ... ALIAS_n '\0' CANONICAL_n '\0' '\0' */
-static const char * volatile charset_aliases;
-
-/* Return a pointer to the contents of the charset.alias file. */
-static const char *
-get_charset_aliases (void)
-{
- const char *cp;
-
- cp = charset_aliases;
- if (cp == NULL)
- {
-#if !(defined DARWIN7 || defined VMS || defined WIN32_NATIVE || defined __CYGWIN__)
- const char *dir;
- const char *base = "charset.alias";
- char *file_name;
-
- /* Make it possible to override the charset.alias location. This is
- necessary for running the testsuite before "make install". */
- dir = getenv ("CHARSETALIASDIR");
- if (dir == NULL || dir[0] == '\0')
- dir = relocate (LIBDIR);
-
- /* Concatenate dir and base into freshly allocated file_name. */
- {
- size_t dir_len = strlen (dir);
- size_t base_len = strlen (base);
- int add_slash = (dir_len > 0 && !ISSLASH (dir[dir_len - 1]));
- file_name = (char *) malloc (dir_len + add_slash + base_len + 1);
- if (file_name != NULL)
- {
- memcpy (file_name, dir, dir_len);
- if (add_slash)
- file_name[dir_len] = DIRECTORY_SEPARATOR;
- memcpy (file_name + dir_len + add_slash, base, base_len + 1);
- }
- }
-
- if (file_name == NULL)
- /* Out of memory. Treat the file as empty. */
- cp = "";
- else
- {
- int fd;
-
- /* Open the file. Reject symbolic links on platforms that support
- O_NOFOLLOW. This is a security feature. Without it, an attacker
- could retrieve parts of the contents (namely, the tail of the
- first line that starts with "* ") of an arbitrary file by placing
- a symbolic link to that file under the name "charset.alias" in
- some writable directory and defining the environment variable
- CHARSETALIASDIR to point to that directory. */
- fd = open (file_name,
- O_RDONLY | (HAVE_WORKING_O_NOFOLLOW ? O_NOFOLLOW : 0));
- if (fd < 0)
- /* File not found. Treat it as empty. */
- cp = "";
- else
- {
- FILE *fp;
-
- fp = fdopen (fd, "r");
- if (fp == NULL)
- {
- /* Out of memory. Treat the file as empty. */
- close (fd);
- cp = "";
- }
- else
- {
- /* Parse the file's contents. */
- char *res_ptr = NULL;
- size_t res_size = 0;
-
- for (;;)
- {
- int c;
- char buf1[50+1];
- char buf2[50+1];
- size_t l1, l2;
- char *old_res_ptr;
-
- c = getc (fp);
- if (c == EOF)
- break;
- if (c == '\n' || c == ' ' || c == '\t')
- continue;
- if (c == '#')
- {
- /* Skip comment, to end of line. */
- do
- c = getc (fp);
- while (!(c == EOF || c == '\n'));
- if (c == EOF)
- break;
- continue;
- }
- ungetc (c, fp);
- if (fscanf (fp, "%50s %50s", buf1, buf2) < 2)
- break;
- l1 = strlen (buf1);
- l2 = strlen (buf2);
- old_res_ptr = res_ptr;
- if (res_size == 0)
- {
- res_size = l1 + 1 + l2 + 1;
- res_ptr = (char *) malloc (res_size + 1);
- }
- else
- {
- res_size += l1 + 1 + l2 + 1;
- res_ptr = (char *) realloc (res_ptr, res_size + 1);
- }
- if (res_ptr == NULL)
- {
- /* Out of memory. */
- res_size = 0;
- if (old_res_ptr != NULL)
- free (old_res_ptr);
- break;
- }
- strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1);
- strcpy (res_ptr + res_size - (l2 + 1), buf2);
- }
- fclose (fp);
- if (res_size == 0)
- cp = "";
- else
- {
- *(res_ptr + res_size) = '\0';
- cp = res_ptr;
- }
- }
- }
-
- free (file_name);
- }
-
-#else
-
-# if defined DARWIN7
- /* To avoid the trouble of installing a file that is shared by many
- GNU packages -- many packaging systems have problems with this --,
- simply inline the aliases here. */
- cp = "ISO8859-1" "\0" "ISO-8859-1" "\0"
- "ISO8859-2" "\0" "ISO-8859-2" "\0"
- "ISO8859-4" "\0" "ISO-8859-4" "\0"
- "ISO8859-5" "\0" "ISO-8859-5" "\0"
- "ISO8859-7" "\0" "ISO-8859-7" "\0"
- "ISO8859-9" "\0" "ISO-8859-9" "\0"
- "ISO8859-13" "\0" "ISO-8859-13" "\0"
- "ISO8859-15" "\0" "ISO-8859-15" "\0"
- "KOI8-R" "\0" "KOI8-R" "\0"
- "KOI8-U" "\0" "KOI8-U" "\0"
- "CP866" "\0" "CP866" "\0"
- "CP949" "\0" "CP949" "\0"
- "CP1131" "\0" "CP1131" "\0"
- "CP1251" "\0" "CP1251" "\0"
- "eucCN" "\0" "GB2312" "\0"
- "GB2312" "\0" "GB2312" "\0"
- "eucJP" "\0" "EUC-JP" "\0"
- "eucKR" "\0" "EUC-KR" "\0"
- "Big5" "\0" "BIG5" "\0"
- "Big5HKSCS" "\0" "BIG5-HKSCS" "\0"
- "GBK" "\0" "GBK" "\0"
- "GB18030" "\0" "GB18030" "\0"
- "SJIS" "\0" "SHIFT_JIS" "\0"
- "ARMSCII-8" "\0" "ARMSCII-8" "\0"
- "PT154" "\0" "PT154" "\0"
- /*"ISCII-DEV" "\0" "?" "\0"*/
- "*" "\0" "UTF-8" "\0";
-# endif
-
-# if defined VMS
- /* To avoid the troubles of an extra file charset.alias_vms in the
- sources of many GNU packages, simply inline the aliases here. */
- /* The list of encodings is taken from the OpenVMS 7.3-1 documentation
- "Compaq C Run-Time Library Reference Manual for OpenVMS systems"
- section 10.7 "Handling Different Character Sets". */
- cp = "ISO8859-1" "\0" "ISO-8859-1" "\0"
- "ISO8859-2" "\0" "ISO-8859-2" "\0"
- "ISO8859-5" "\0" "ISO-8859-5" "\0"
- "ISO8859-7" "\0" "ISO-8859-7" "\0"
- "ISO8859-8" "\0" "ISO-8859-8" "\0"
- "ISO8859-9" "\0" "ISO-8859-9" "\0"
- /* Japanese */
- "eucJP" "\0" "EUC-JP" "\0"
- "SJIS" "\0" "SHIFT_JIS" "\0"
- "DECKANJI" "\0" "DEC-KANJI" "\0"
- "SDECKANJI" "\0" "EUC-JP" "\0"
- /* Chinese */
- "eucTW" "\0" "EUC-TW" "\0"
- "DECHANYU" "\0" "DEC-HANYU" "\0"
- "DECHANZI" "\0" "GB2312" "\0"
- /* Korean */
- "DECKOREAN" "\0" "EUC-KR" "\0";
-# endif
-
-# if defined WIN32_NATIVE || defined __CYGWIN__
- /* To avoid the troubles of installing a separate file in the same
- directory as the DLL and of retrieving the DLL's directory at
- runtime, simply inline the aliases here. */
-
- cp = "CP936" "\0" "GBK" "\0"
- "CP1361" "\0" "JOHAB" "\0"
- "CP20127" "\0" "ASCII" "\0"
- "CP20866" "\0" "KOI8-R" "\0"
- "CP20936" "\0" "GB2312" "\0"
- "CP21866" "\0" "KOI8-RU" "\0"
- "CP28591" "\0" "ISO-8859-1" "\0"
- "CP28592" "\0" "ISO-8859-2" "\0"
- "CP28593" "\0" "ISO-8859-3" "\0"
- "CP28594" "\0" "ISO-8859-4" "\0"
- "CP28595" "\0" "ISO-8859-5" "\0"
- "CP28596" "\0" "ISO-8859-6" "\0"
- "CP28597" "\0" "ISO-8859-7" "\0"
- "CP28598" "\0" "ISO-8859-8" "\0"
- "CP28599" "\0" "ISO-8859-9" "\0"
- "CP28605" "\0" "ISO-8859-15" "\0"
- "CP38598" "\0" "ISO-8859-8" "\0"
- "CP51932" "\0" "EUC-JP" "\0"
- "CP51936" "\0" "GB2312" "\0"
- "CP51949" "\0" "EUC-KR" "\0"
- "CP51950" "\0" "EUC-TW" "\0"
- "CP54936" "\0" "GB18030" "\0"
- "CP65001" "\0" "UTF-8" "\0";
-# endif
-#endif
-
- charset_aliases = cp;
- }
-
- return cp;
-}
-
-/* Determine the current locale's character encoding, and canonicalize it
- into one of the canonical names listed in config.charset.
- The result must not be freed; it is statically allocated.
- If the canonical name cannot be determined, the result is a non-canonical
- name. */
-
-#ifdef STATIC
-STATIC
-#endif
-const char *
-locale_charset (void)
-{
- const char *codeset;
- const char *aliases;
-
-#if !(defined WIN32_NATIVE || defined OS2)
-
-# if HAVE_LANGINFO_CODESET
-
- /* Most systems support nl_langinfo (CODESET) nowadays. */
- codeset = nl_langinfo (CODESET);
-
-# ifdef __CYGWIN__
- /* Cygwin < 1.7 does not have locales. nl_langinfo (CODESET) always
- returns "US-ASCII". Return the suffix of the locale name from the
- environment variables (if present) or the codepage as a number. */
- if (codeset != NULL && strcmp (codeset, "US-ASCII") == 0)
- {
- const char *locale;
- static char buf[2 + 10 + 1];
-
- locale = getenv ("LC_ALL");
- if (locale == NULL || locale[0] == '\0')
- {
- locale = getenv ("LC_CTYPE");
- if (locale == NULL || locale[0] == '\0')
- locale = getenv ("LANG");
- }
- if (locale != NULL && locale[0] != '\0')
- {
- /* If the locale name contains an encoding after the dot, return
- it. */
- const char *dot = strchr (locale, '.');
-
- if (dot != NULL)
- {
- const char *modifier;
-
- dot++;
- /* Look for the possible @... trailer and remove it, if any. */
- modifier = strchr (dot, '@');
- if (modifier == NULL)
- return dot;
- if (modifier - dot < sizeof (buf))
- {
- memcpy (buf, dot, modifier - dot);
- buf [modifier - dot] = '\0';
- return buf;
- }
- }
- }
-
- /* Woe32 has a function returning the locale's codepage as a number:
- GetACP(). This encoding is used by Cygwin, unless the user has set
- the environment variable CYGWIN=codepage:oem (which very few people
- do).
- Output directed to console windows needs to be converted (to
- GetOEMCP() if the console is using a raster font, or to
- GetConsoleOutputCP() if it is using a TrueType font). Cygwin does
- this conversion transparently (see winsup/cygwin/fhandler_console.cc),
- converting to GetConsoleOutputCP(). This leads to correct results,
- except when SetConsoleOutputCP has been called and a raster font is
- in use. */
- sprintf (buf, "CP%u", GetACP ());
- codeset = buf;
- }
-# endif
-
-# else
-
- /* On old systems which lack it, use setlocale or getenv. */
- const char *locale = NULL;
-
- /* But most old systems don't have a complete set of locales. Some
- (like SunOS 4 or DJGPP) have only the C locale. Therefore we don't
- use setlocale here; it would return "C" when it doesn't support the
- locale name the user has set. */
-# if 0
- locale = setlocale (LC_CTYPE, NULL);
-# endif
- if (locale == NULL || locale[0] == '\0')
- {
- locale = getenv ("LC_ALL");
- if (locale == NULL || locale[0] == '\0')
- {
- locale = getenv ("LC_CTYPE");
- if (locale == NULL || locale[0] == '\0')
- locale = getenv ("LANG");
- }
- }
-
- /* On some old systems, one used to set locale = "iso8859_1". On others,
- you set it to "language_COUNTRY.charset". In any case, we resolve it
- through the charset.alias file. */
- codeset = locale;
-
-# endif
-
-#elif defined WIN32_NATIVE
-
- static char buf[2 + 10 + 1];
-
- /* Woe32 has a function returning the locale's codepage as a number:
- GetACP().
- When the output goes to a console window, it needs to be provided in
- GetOEMCP() encoding if the console is using a raster font, or in
- GetConsoleOutputCP() encoding if it is using a TrueType font.
- But in GUI programs and for output sent to files and pipes, GetACP()
- encoding is the best bet. */
- sprintf (buf, "CP%u", GetACP ());
- codeset = buf;
-
-#elif defined OS2
-
- const char *locale;
- static char buf[2 + 10 + 1];
- ULONG cp[3];
- ULONG cplen;
-
- /* Allow user to override the codeset, as set in the operating system,
- with standard language environment variables. */
- locale = getenv ("LC_ALL");
- if (locale == NULL || locale[0] == '\0')
- {
- locale = getenv ("LC_CTYPE");
- if (locale == NULL || locale[0] == '\0')
- locale = getenv ("LANG");
- }
- if (locale != NULL && locale[0] != '\0')
- {
- /* If the locale name contains an encoding after the dot, return it. */
- const char *dot = strchr (locale, '.');
-
- if (dot != NULL)
- {
- const char *modifier;
-
- dot++;
- /* Look for the possible @... trailer and remove it, if any. */
- modifier = strchr (dot, '@');
- if (modifier == NULL)
- return dot;
- if (modifier - dot < sizeof (buf))
- {
- memcpy (buf, dot, modifier - dot);
- buf [modifier - dot] = '\0';
- return buf;
- }
- }
-
- /* Resolve through the charset.alias file. */
- codeset = locale;
- }
- else
- {
- /* OS/2 has a function returning the locale's codepage as a number. */
- if (DosQueryCp (sizeof (cp), cp, &cplen))
- codeset = "";
- else
- {
- sprintf (buf, "CP%u", cp[0]);
- codeset = buf;
- }
- }
-
-#endif
-
- if (codeset == NULL)
- /* The canonical name cannot be determined. */
- codeset = "";
-
- /* Resolve alias. */
- for (aliases = get_charset_aliases ();
- *aliases != '\0';
- aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
- if (strcmp (codeset, aliases) == 0
- || (aliases[0] == '*' && aliases[1] == '\0'))
- {
- codeset = aliases + strlen (aliases) + 1;
- break;
- }
-
- /* Don't return an empty string. GNU libc and GNU libiconv interpret
- the empty string as denoting "the locale's character encoding",
- thus GNU libiconv would call this function a second time. */
- if (codeset[0] == '\0')
- codeset = "ASCII";
-
- return codeset;
-}
diff --git a/lib/localcharset.h b/lib/localcharset.h
deleted file mode 100644
index c18f492c0..000000000
--- a/lib/localcharset.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Determine a canonical name for the current locale's character encoding.
- Copyright (C) 2000-2003, 2009-2010 Free Software Foundation, Inc.
- This file is part of the GNU CHARSET Library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU 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. */
-
-#ifndef _LOCALCHARSET_H
-#define _LOCALCHARSET_H
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Determine the current locale's character encoding, and canonicalize it
- into one of the canonical names listed in config.charset.
- The result must not be freed; it is statically allocated.
- If the canonical name cannot be determined, the result is a non-canonical
- name. */
-extern const char * locale_charset (void);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* _LOCALCHARSET_H */
diff --git a/lib/locale.in.h b/lib/locale.in.h
index 9464877c0..02db8dadb 100644
--- a/lib/locale.in.h
+++ b/lib/locale.in.h
@@ -1,5 +1,5 @@
/* A POSIX <locale.h>.
- Copyright (C) 2007-2010 Free Software Foundation, Inc.
+ 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
@@ -47,6 +47,27 @@
# define LC_MESSAGES 1729
#endif
+#if @GNULIB_SETLOCALE@
+# if @REPLACE_SETLOCALE@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef setlocale
+# define setlocale rpl_setlocale
+# define GNULIB_defined_setlocale 1
+# endif
+_GL_FUNCDECL_RPL (setlocale, char *, (int category, const char *locale));
+_GL_CXXALIAS_RPL (setlocale, char *, (int category, const char *locale));
+# else
+_GL_CXXALIAS_SYS (setlocale, char *, (int category, const char *locale));
+# endif
+_GL_CXXALIASWARN (setlocale);
+#elif defined GNULIB_POSIXCHECK
+# undef setlocale
+# if HAVE_RAW_DECL_SETLOCALE
+_GL_WARN_ON_USE (setlocale, "setlocale works differently on native Windows - "
+ "use gnulib module setlocale for portability");
+# endif
+#endif
+
#if @GNULIB_DUPLOCALE@
# if @REPLACE_DUPLOCALE@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
diff --git a/lib/lstat.c b/lib/lstat.c
index a8e95e69f..0fc3b2c51 100644
--- a/lib/lstat.c
+++ b/lib/lstat.c
@@ -1,6 +1,6 @@
/* Work around a bug of lstat on some systems
- Copyright (C) 1997-2006, 2008-2010 Free Software Foundation, Inc.
+ Copyright (C) 1997-2006, 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
diff --git a/lib/malloc.c b/lib/malloc.c
index c8d76c335..6a417c37a 100644
--- a/lib/malloc.c
+++ b/lib/malloc.c
@@ -1,6 +1,6 @@
/* malloc() function that is glibc compatible.
- Copyright (C) 1997-1998, 2006-2007, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 1997-1998, 2006-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
diff --git a/lib/malloca.c b/lib/malloca.c
index 386a506e1..b79e7d7a6 100644
--- a/lib/malloca.c
+++ b/lib/malloca.c
@@ -1,5 +1,5 @@
/* Safe automatic memory allocation.
- Copyright (C) 2003, 2006-2007, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006-2007, 2009-2011 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/malloca.h b/lib/malloca.h
index e39d0f420..15e37aa66 100644
--- a/lib/malloca.h
+++ b/lib/malloca.h
@@ -1,5 +1,5 @@
/* Safe automatic memory allocation.
- Copyright (C) 2003-2007, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2003-2007, 2009-2011 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/math.in.h b/lib/math.in.h
index b04c9e630..7ff01026b 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -1,6 +1,6 @@
/* A GNU-like <math.h>.
- Copyright (C) 2002-2003, 2007-2010 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 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
@@ -73,18 +73,21 @@ _GL_WARN_ON_USE (rpl_ ## func ## l, #func " is unportable - " \
it on platforms like Solaris 10, where NAN is present but defined
as a function pointer rather than a floating point constant. */
#if !defined NAN || @REPLACE_NAN@
-# undef NAN
+# if !GNULIB_defined_NAN
+# undef NAN
/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */
-# ifdef __DECC
+# ifdef __DECC
static float
_NaN ()
{
static float zero = 0.0f;
return zero / zero;
}
-# define NAN (_NaN())
-# else
-# define NAN (0.0f / 0.0f)
+# define NAN (_NaN())
+# else
+# define NAN (0.0f / 0.0f)
+# endif
+# define GNULIB_defined_NAN 1
# endif
#endif
@@ -202,6 +205,19 @@ _GL_WARN_ON_USE (ceilf, "ceilf is unportable - "
# endif
#endif
+#if @GNULIB_CEIL@
+# if @REPLACE_CEIL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# define ceil rpl_ceil
+# endif
+_GL_FUNCDECL_RPL (ceil, double, (double x));
+_GL_CXXALIAS_RPL (ceil, double, (double x));
+# else
+_GL_CXXALIAS_SYS (ceil, double, (double x));
+# endif
+_GL_CXXALIASWARN (ceil);
+#endif
+
#if @GNULIB_CEILL@
# if @REPLACE_CEILL@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -262,7 +278,7 @@ _GL_WARN_ON_USE (expl, "expl is unportable - "
# endif
_GL_FUNCDECL_RPL (floorf, float, (float x));
_GL_CXXALIAS_RPL (floorf, float, (float x));
-#else
+# else
# if !@HAVE_DECL_FLOORF@
_GL_FUNCDECL_SYS (floorf, float, (float x));
# endif
@@ -277,6 +293,19 @@ _GL_WARN_ON_USE (floorf, "floorf is unportable - "
# endif
#endif
+#if @GNULIB_FLOOR@
+# if @REPLACE_FLOOR@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# define floor rpl_floor
+# endif
+_GL_FUNCDECL_RPL (floor, double, (double x));
+_GL_CXXALIAS_RPL (floor, double, (double x));
+# else
+_GL_CXXALIAS_SYS (floor, double, (double x));
+# endif
+_GL_CXXALIASWARN (floor);
+#endif
+
#if @GNULIB_FLOORL@
# if @REPLACE_FLOORL@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -493,10 +522,18 @@ _GL_WARN_ON_USE (tanl, "tanl is unportable - "
#if @GNULIB_TRUNCF@
-# if !@HAVE_DECL_TRUNCF@
+# if @REPLACE_TRUNCF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# define truncf rpl_truncf
+# endif
+_GL_FUNCDECL_RPL (truncf, float, (float x));
+_GL_CXXALIAS_RPL (truncf, float, (float x));
+# else
+# if !@HAVE_DECL_TRUNCF@
_GL_FUNCDECL_SYS (truncf, float, (float x));
-# endif
+# endif
_GL_CXXALIAS_SYS (truncf, float, (float x));
+# endif
_GL_CXXALIASWARN (truncf);
#elif defined GNULIB_POSIXCHECK
# undef truncf
@@ -507,10 +544,18 @@ _GL_WARN_ON_USE (truncf, "truncf is unportable - "
#endif
#if @GNULIB_TRUNC@
-# if !@HAVE_DECL_TRUNC@
+# if @REPLACE_TRUNC@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# define trunc rpl_trunc
+# endif
+_GL_FUNCDECL_RPL (trunc, double, (double x));
+_GL_CXXALIAS_RPL (trunc, double, (double x));
+# else
+# if !@HAVE_DECL_TRUNC@
_GL_FUNCDECL_SYS (trunc, double, (double x));
-# endif
+# endif
_GL_CXXALIAS_SYS (trunc, double, (double x));
+# endif
_GL_CXXALIASWARN (trunc);
#elif defined GNULIB_POSIXCHECK
# undef trunc
@@ -657,7 +702,7 @@ _GL_EXTERN_C int isnanl (long double x);
that recursively expand back to isnan. So use the gnulib
replacements for them directly. */
# if @HAVE_ISNANF@ && __GNUC__ >= 4
-# define gl_isnan_f(x) __builtin_isnan ((float)(x))
+# define gl_isnan_f(x) __builtin_isnanf ((float)(x))
# else
_GL_EXTERN_C int rpl_isnanf (float x);
# define gl_isnan_f(x) rpl_isnanf (x)
@@ -669,7 +714,7 @@ _GL_EXTERN_C int rpl_isnand (double x);
# define gl_isnan_d(x) rpl_isnand (x)
# endif
# if @HAVE_ISNANL@ && __GNUC__ >= 4
-# define gl_isnan_l(x) __builtin_isnan ((long double)(x))
+# define gl_isnan_l(x) __builtin_isnanl ((long double)(x))
# else
_GL_EXTERN_C int rpl_isnanl (long double x);
# define gl_isnan_l(x) rpl_isnanl (x)
@@ -679,6 +724,12 @@ _GL_EXTERN_C int rpl_isnanl (long double x);
(sizeof (x) == sizeof (long double) ? gl_isnan_l (x) : \
sizeof (x) == sizeof (double) ? gl_isnan_d (x) : \
gl_isnan_f (x))
+# elif __GNUC__ >= 4
+# undef isnan
+# define isnan(x) \
+ (sizeof (x) == sizeof (long double) ? __builtin_isnanl ((long double)(x)) : \
+ sizeof (x) == sizeof (double) ? __builtin_isnan ((double)(x)) : \
+ __builtin_isnanf ((float)(x)))
# endif
/* Ensure isnan is a macro. */
# ifndef isnan
diff --git a/lib/mbrtowc.c b/lib/mbrtowc.c
deleted file mode 100644
index 85f251ccf..000000000
--- a/lib/mbrtowc.c
+++ /dev/null
@@ -1,386 +0,0 @@
-/* Convert multibyte character to wide character.
- Copyright (C) 1999-2002, 2005-2010 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2008.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU 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 <wchar.h>
-
-#if GNULIB_defined_mbstate_t
-/* Implement mbrtowc() on top of mbtowc(). */
-
-# include <errno.h>
-# include <stdlib.h>
-
-# include "localcharset.h"
-# include "streq.h"
-# include "verify.h"
-
-
-verify (sizeof (mbstate_t) >= 4);
-
-static char internal_state[4];
-
-size_t
-mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
-{
- char *pstate = (char *)ps;
-
- if (pstate == NULL)
- pstate = internal_state;
-
- if (s == NULL)
- {
- pwc = NULL;
- s = "";
- n = 1;
- }
-
- if (n == 0)
- return (size_t)(-2);
-
- /* Here n > 0. */
- {
- size_t nstate = pstate[0];
- char buf[4];
- const char *p;
- size_t m;
-
- switch (nstate)
- {
- case 0:
- p = s;
- m = n;
- break;
- case 3:
- buf[2] = pstate[3];
- /*FALLTHROUGH*/
- case 2:
- buf[1] = pstate[2];
- /*FALLTHROUGH*/
- case 1:
- buf[0] = pstate[1];
- p = buf;
- m = nstate;
- buf[m++] = s[0];
- if (n >= 2 && m < 4)
- {
- buf[m++] = s[1];
- if (n >= 3 && m < 4)
- buf[m++] = s[2];
- }
- break;
- default:
- errno = EINVAL;
- return (size_t)(-1);
- }
-
- /* Here m > 0. */
-
-# if __GLIBC__ || defined __UCLIBC__
- /* Work around bug <http://sourceware.org/bugzilla/show_bug.cgi?id=9674> */
- mbtowc (NULL, NULL, 0);
-# endif
- {
- int res = mbtowc (pwc, p, m);
-
- if (res >= 0)
- {
- if (pwc != NULL && ((*pwc == 0) != (res == 0)))
- abort ();
- if (nstate >= (res > 0 ? res : 1))
- abort ();
- res -= nstate;
- pstate[0] = 0;
- return res;
- }
-
- /* mbtowc does not distinguish between invalid and incomplete multibyte
- sequences. But mbrtowc needs to make this distinction.
- There are two possible approaches:
- - Use iconv() and its return value.
- - Use built-in knowledge about the possible encodings.
- Given the low quality of implementation of iconv() on the systems that
- lack mbrtowc(), we use the second approach.
- The possible encodings are:
- - 8-bit encodings,
- - EUC-JP, EUC-KR, GB2312, EUC-TW, BIG5, GB18030, SJIS,
- - UTF-8.
- Use specialized code for each. */
- if (m >= 4 || m >= MB_CUR_MAX)
- goto invalid;
- /* Here MB_CUR_MAX > 1 and 0 < m < 4. */
- {
- const char *encoding = locale_charset ();
-
- if (STREQ (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
- {
- /* Cf. unistr/u8-mblen.c. */
- unsigned char c = (unsigned char) p[0];
-
- if (c >= 0xc2)
- {
- if (c < 0xe0)
- {
- if (m == 1)
- goto incomplete;
- }
- else if (c < 0xf0)
- {
- if (m == 1)
- goto incomplete;
- if (m == 2)
- {
- unsigned char c2 = (unsigned char) p[1];
-
- if ((c2 ^ 0x80) < 0x40
- && (c >= 0xe1 || c2 >= 0xa0)
- && (c != 0xed || c2 < 0xa0))
- goto incomplete;
- }
- }
- else if (c <= 0xf4)
- {
- if (m == 1)
- goto incomplete;
- else /* m == 2 || m == 3 */
- {
- unsigned char c2 = (unsigned char) p[1];
-
- if ((c2 ^ 0x80) < 0x40
- && (c >= 0xf1 || c2 >= 0x90)
- && (c < 0xf4 || (c == 0xf4 && c2 < 0x90)))
- {
- if (m == 2)
- goto incomplete;
- else /* m == 3 */
- {
- unsigned char c3 = (unsigned char) p[2];
-
- if ((c3 ^ 0x80) < 0x40)
- goto incomplete;
- }
- }
- }
- }
- }
- goto invalid;
- }
-
- /* As a reference for this code, you can use the GNU libiconv
- implementation. Look for uses of the RET_TOOFEW macro. */
-
- if (STREQ (encoding, "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0))
- {
- if (m == 1)
- {
- unsigned char c = (unsigned char) p[0];
-
- if ((c >= 0xa1 && c < 0xff) || c == 0x8e || c == 0x8f)
- goto incomplete;
- }
- if (m == 2)
- {
- unsigned char c = (unsigned char) p[0];
-
- if (c == 0x8f)
- {
- unsigned char c2 = (unsigned char) p[1];
-
- if (c2 >= 0xa1 && c2 < 0xff)
- goto incomplete;
- }
- }
- goto invalid;
- }
- if (STREQ (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
- || STREQ (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0)
- || STREQ (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0))
- {
- if (m == 1)
- {
- unsigned char c = (unsigned char) p[0];
-
- if (c >= 0xa1 && c < 0xff)
- goto incomplete;
- }
- goto invalid;
- }
- if (STREQ (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0))
- {
- if (m == 1)
- {
- unsigned char c = (unsigned char) p[0];
-
- if ((c >= 0xa1 && c < 0xff) || c == 0x8e)
- goto incomplete;
- }
- else /* m == 2 || m == 3 */
- {
- unsigned char c = (unsigned char) p[0];
-
- if (c == 0x8e)
- goto incomplete;
- }
- goto invalid;
- }
- if (STREQ (encoding, "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0))
- {
- if (m == 1)
- {
- unsigned char c = (unsigned char) p[0];
-
- if ((c >= 0x90 && c <= 0xe3) || (c >= 0xf8 && c <= 0xfe))
- goto incomplete;
- }
- else /* m == 2 || m == 3 */
- {
- unsigned char c = (unsigned char) p[0];
-
- if (c >= 0x90 && c <= 0xe3)
- {
- unsigned char c2 = (unsigned char) p[1];
-
- if (c2 >= 0x30 && c2 <= 0x39)
- {
- if (m == 2)
- goto incomplete;
- else /* m == 3 */
- {
- unsigned char c3 = (unsigned char) p[2];
-
- if (c3 >= 0x81 && c3 <= 0xfe)
- goto incomplete;
- }
- }
- }
- }
- goto invalid;
- }
- if (STREQ (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0))
- {
- if (m == 1)
- {
- unsigned char c = (unsigned char) p[0];
-
- if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xea)
- || (c >= 0xf0 && c <= 0xf9))
- goto incomplete;
- }
- goto invalid;
- }
-
- /* An unknown multibyte encoding. */
- goto incomplete;
- }
-
- incomplete:
- {
- size_t k = nstate;
- /* Here 0 <= k < m < 4. */
- pstate[++k] = s[0];
- if (k < m)
- {
- pstate[++k] = s[1];
- if (k < m)
- pstate[++k] = s[2];
- }
- if (k != m)
- abort ();
- }
- pstate[0] = m;
- return (size_t)(-2);
-
- invalid:
- errno = EILSEQ;
- /* The conversion state is undefined, says POSIX. */
- return (size_t)(-1);
- }
- }
-}
-
-#else
-/* Override the system's mbrtowc() function. */
-
-# undef mbrtowc
-
-size_t
-rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
-{
-# if MBRTOWC_NULL_ARG_BUG || MBRTOWC_RETVAL_BUG
- if (s == NULL)
- {
- pwc = NULL;
- s = "";
- n = 1;
- }
-# endif
-
-# if MBRTOWC_RETVAL_BUG
- {
- static mbstate_t internal_state;
-
- /* Override mbrtowc's internal state. We can not call mbsinit() on the
- hidden internal state, but we can call it on our variable. */
- if (ps == NULL)
- ps = &internal_state;
-
- if (!mbsinit (ps))
- {
- /* Parse the rest of the multibyte character byte for byte. */
- size_t count = 0;
- for (; n > 0; s++, n--)
- {
- wchar_t wc;
- size_t ret = mbrtowc (&wc, s, 1, ps);
-
- if (ret == (size_t)(-1))
- return (size_t)(-1);
- count++;
- if (ret != (size_t)(-2))
- {
- /* The multibyte character has been completed. */
- if (pwc != NULL)
- *pwc = wc;
- return (wc == 0 ? 0 : count);
- }
- }
- return (size_t)(-2);
- }
- }
-# endif
-
-# if MBRTOWC_NUL_RETVAL_BUG
- {
- wchar_t wc;
- size_t ret = mbrtowc (&wc, s, n, ps);
-
- if (ret != (size_t)(-1) && ret != (size_t)(-2))
- {
- if (pwc != NULL)
- *pwc = wc;
- if (wc == 0)
- ret = 0;
- }
- return ret;
- }
-# else
- return mbrtowc (pwc, s, n, ps);
-# endif
-}
-
-#endif
diff --git a/lib/mbsinit.c b/lib/mbsinit.c
deleted file mode 100644
index 811e39bb9..000000000
--- a/lib/mbsinit.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Test for initial conversion state.
- Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2008.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU 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 <wchar.h>
-
-#include "verify.h"
-
-/* Platforms that lack mbsinit() also lack mbrlen(), mbrtowc(), mbsrtowcs()
- and wcrtomb(), wcsrtombs().
- We assume that
- - sizeof (mbstate_t) >= 4,
- - only stateless encodings are supported (such as UTF-8 and EUC-JP, but
- not ISO-2022 variants),
- - for each encoding, the number of bytes for a wide character is <= 4.
- (This maximum is attained for UTF-8, GB18030, EUC-TW.)
- We define the meaning of mbstate_t as follows:
- - In mb -> wc direction, mbstate_t's first byte contains the number of
- buffered bytes (in the range 0..3), followed by up to 3 buffered bytes.
- - In wc -> mb direction, mbstate_t contains no information. In other
- words, it is always in the initial state. */
-
-verify (sizeof (mbstate_t) >= 4);
-
-int
-mbsinit (const mbstate_t *ps)
-{
- const char *pstate = (const char *)ps;
-
- return pstate[0] == 0;
-}
diff --git a/lib/memchr.c b/lib/memchr.c
index 1e897cd94..16546e4bb 100644
--- a/lib/memchr.c
+++ b/lib/memchr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2010
+/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2011
Free Software Foundation, Inc.
Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
diff --git a/lib/netdb.in.h b/lib/netdb.in.h
index 6f761f165..21e3d55eb 100644
--- a/lib/netdb.in.h
+++ b/lib/netdb.in.h
@@ -1,5 +1,5 @@
/* Provide a netdb.h header file for systems lacking it (read: MinGW).
- Copyright (C) 2008-2010 Free Software Foundation, Inc.
+ Copyright (C) 2008-2011 Free Software Foundation, Inc.
Written by Simon Josefsson.
This program is free software; you can redistribute it and/or modify
@@ -51,6 +51,7 @@
# if !@HAVE_STRUCT_ADDRINFO@
+# if !GNULIB_defined_struct_addrinfo
/* Structure to contain information about address of a service provider. */
struct addrinfo
{
@@ -63,6 +64,8 @@ struct addrinfo
char *ai_canonname; /* Canonical name for service location. */
struct addrinfo *ai_next; /* Pointer to next in list. */
};
+# define GNULIB_defined_struct_addrinfo 1
+# endif
# endif
/* Possible values for `ai_flags' field in `addrinfo' structure. */
diff --git a/lib/netinet_in.in.h b/lib/netinet_in.in.h
index e9af2a97d..11c587a47 100644
--- a/lib/netinet_in.in.h
+++ b/lib/netinet_in.in.h
@@ -1,5 +1,5 @@
/* Substitute for <netinet/in.h>.
- Copyright (C) 2007-2010 Free Software Foundation, Inc.
+ 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
diff --git a/lib/nproc.c b/lib/nproc.c
index e4cdb3a40..a1e13e2e2 100644
--- a/lib/nproc.c
+++ b/lib/nproc.c
@@ -1,6 +1,6 @@
/* Detect the number of processors.
- Copyright (C) 2009-2010 Free Software Foundation, Inc.
+ 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
diff --git a/lib/nproc.h b/lib/nproc.h
index 56af19edf..8dbb02ff0 100644
--- a/lib/nproc.h
+++ b/lib/nproc.h
@@ -1,6 +1,6 @@
/* Detect the number of processors.
- Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+ 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
diff --git a/lib/pathmax.h b/lib/pathmax.h
index c53aa9d86..8056fef22 100644
--- a/lib/pathmax.h
+++ b/lib/pathmax.h
@@ -1,5 +1,5 @@
/* Define PATH_MAX somehow. Requires sys/types.h.
- Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2010 Free Software
+ Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2011 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/printf-args.c b/lib/printf-args.c
index 597bba980..68e52fdb8 100644
--- a/lib/printf-args.c
+++ b/lib/printf-args.c
@@ -1,5 +1,5 @@
/* Decomposed printf argument list.
- Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2010 Free Software
+ Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2011 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/printf-args.h b/lib/printf-args.h
index d76352d98..998e95d98 100644
--- a/lib/printf-args.h
+++ b/lib/printf-args.h
@@ -1,5 +1,5 @@
/* Decomposed printf argument list.
- Copyright (C) 1999, 2002-2003, 2006-2007, 2009-2010 Free Software
+ Copyright (C) 1999, 2002-2003, 2006-2007, 2011 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -136,10 +136,14 @@ typedef struct
}
argument;
+/* Number of directly allocated arguments (no malloc() needed). */
+#define N_DIRECT_ALLOC_ARGUMENTS 7
+
typedef struct
{
size_t count;
argument *arg;
+ argument direct_alloc_arg[N_DIRECT_ALLOC_ARGUMENTS];
}
arguments;
diff --git a/lib/printf-parse.c b/lib/printf-parse.c
index 8c68fda15..01438614a 100644
--- a/lib/printf-parse.c
+++ b/lib/printf-parse.c
@@ -1,5 +1,5 @@
/* Formatted output to strings.
- Copyright (C) 1999-2000, 2002-2003, 2006-2010 Free Software Foundation, Inc.
+ Copyright (C) 1999-2000, 2002-2003, 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
@@ -63,6 +63,9 @@
/* malloc(), realloc(), free(). */
#include <stdlib.h>
+/* memcpy(). */
+#include <string.h>
+
/* errno. */
#include <errno.h>
@@ -80,23 +83,20 @@ STATIC
int
PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
{
- const CHAR_T *cp = format; /* pointer into format */
+ const CHAR_T *cp = format; /* pointer into format */
size_t arg_posn = 0; /* number of regular arguments consumed */
- size_t d_allocated; /* allocated elements of d->dir */
- size_t a_allocated; /* allocated elements of a->arg */
+ size_t d_allocated; /* allocated elements of d->dir */
+ size_t a_allocated; /* allocated elements of a->arg */
size_t max_width_length = 0;
size_t max_precision_length = 0;
d->count = 0;
- d_allocated = 1;
- d->dir = (DIRECTIVE *) malloc (d_allocated * sizeof (DIRECTIVE));
- if (d->dir == NULL)
- /* Out of memory. */
- goto out_of_memory_1;
+ d_allocated = N_DIRECT_ALLOC_DIRECTIVES;
+ d->dir = d->direct_alloc_dir;
a->count = 0;
- a_allocated = 0;
- a->arg = NULL;
+ a_allocated = N_DIRECT_ALLOC_ARGUMENTS;
+ a->arg = a->direct_alloc_arg;
#define REGISTER_ARG(_index_,_type_) \
{ \
@@ -113,12 +113,14 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
if (size_overflow_p (memory_size)) \
/* Overflow, would lead to out of memory. */ \
goto out_of_memory; \
- memory = (argument *) (a->arg \
+ memory = (argument *) (a->arg != a->direct_alloc_arg \
? realloc (a->arg, memory_size) \
: malloc (memory_size)); \
if (memory == NULL) \
/* Out of memory. */ \
goto out_of_memory; \
+ if (a->arg == a->direct_alloc_arg) \
+ memcpy (memory, a->arg, a->count * sizeof (argument)); \
a->arg = memory; \
} \
while (a->count <= n) \
@@ -588,10 +590,14 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
if (size_overflow_p (memory_size))
/* Overflow, would lead to out of memory. */
goto out_of_memory;
- memory = (DIRECTIVE *) realloc (d->dir, memory_size);
+ memory = (DIRECTIVE *) (d->dir != d->direct_alloc_dir
+ ? realloc (d->dir, memory_size)
+ : malloc (memory_size));
if (memory == NULL)
/* Out of memory. */
goto out_of_memory;
+ if (d->dir == d->direct_alloc_dir)
+ memcpy (memory, d->dir, d->count * sizeof (DIRECTIVE));
d->dir = memory;
}
}
@@ -610,19 +616,18 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
return 0;
error:
- if (a->arg)
+ if (a->arg != a->direct_alloc_arg)
free (a->arg);
- if (d->dir)
+ if (d->dir != d->direct_alloc_dir)
free (d->dir);
errno = EINVAL;
return -1;
out_of_memory:
- if (a->arg)
+ if (a->arg != a->direct_alloc_arg)
free (a->arg);
- if (d->dir)
+ if (d->dir != d->direct_alloc_dir)
free (d->dir);
-out_of_memory_1:
errno = ENOMEM;
return -1;
}
diff --git a/lib/printf-parse.h b/lib/printf-parse.h
index 777bf4d02..281f0d9a4 100644
--- a/lib/printf-parse.h
+++ b/lib/printf-parse.h
@@ -1,5 +1,5 @@
/* Parse printf format string.
- Copyright (C) 1999, 2002-2003, 2005, 2007, 2009-2010 Free Software
+ Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2011 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -47,6 +47,9 @@
/* xxx_directive: A parsed directive.
xxx_directives: A parsed format string. */
+/* Number of directly allocated directives (no malloc() needed). */
+#define N_DIRECT_ALLOC_DIRECTIVES 7
+
/* A parsed directive. */
typedef struct
{
@@ -71,6 +74,7 @@ typedef struct
char_directive *dir;
size_t max_width_length;
size_t max_precision_length;
+ char_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
}
char_directives;
@@ -100,6 +104,7 @@ typedef struct
u8_directive *dir;
size_t max_width_length;
size_t max_precision_length;
+ u8_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
}
u8_directives;
@@ -127,6 +132,7 @@ typedef struct
u16_directive *dir;
size_t max_width_length;
size_t max_precision_length;
+ u16_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
}
u16_directives;
@@ -154,6 +160,7 @@ typedef struct
u32_directive *dir;
size_t max_width_length;
size_t max_precision_length;
+ u32_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
}
u32_directives;
diff --git a/lib/putenv.c b/lib/putenv.c
index 36c51239c..0e6e65f5c 100644
--- a/lib/putenv.c
+++ b/lib/putenv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2010 Free Software
+/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2011 Free Software
Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C
diff --git a/lib/readlink.c b/lib/readlink.c
index 7d326b48f..8a6cbc61a 100644
--- a/lib/readlink.c
+++ b/lib/readlink.c
@@ -1,5 +1,5 @@
/* Stub for readlink().
- Copyright (C) 2003-2007, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2003-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
diff --git a/lib/recv.c b/lib/recv.c
new file mode 100644
index 000000000..b648fc464
--- /dev/null
+++ b/lib/recv.c
@@ -0,0 +1,40 @@
+/* recv.c --- wrappers for Windows recv function
+
+ Copyright (C) 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/>. */
+
+/* Written by Paolo Bonzini */
+
+#include <config.h>
+
+#define WIN32_LEAN_AND_MEAN
+/* Get winsock2.h. */
+#include <sys/socket.h>
+
+/* Get set_winsock_errno, FD_TO_SOCKET etc. */
+#include "w32sock.h"
+
+#undef recv
+
+ssize_t
+rpl_recv (int fd, void *buf, size_t len, int flags)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = recv (sock, buf, len, flags);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
diff --git a/lib/recvfrom.c b/lib/recvfrom.c
new file mode 100644
index 000000000..068f5a576
--- /dev/null
+++ b/lib/recvfrom.c
@@ -0,0 +1,48 @@
+/* recvfrom.c --- wrappers for Windows recvfrom function
+
+ Copyright (C) 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/>. */
+
+/* Written by Paolo Bonzini */
+
+#include <config.h>
+
+#define WIN32_LEAN_AND_MEAN
+/* Get winsock2.h. */
+#include <sys/socket.h>
+
+/* Get set_winsock_errno, FD_TO_SOCKET etc. */
+#include "w32sock.h"
+
+#undef recvfrom
+
+ssize_t
+rpl_recvfrom (int fd, void *buf, size_t len, int flags, struct sockaddr *from,
+ socklen_t *fromlen)
+{
+ int frombufsize = (from != NULL ? *fromlen : 0);
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = recvfrom (sock, buf, len, flags, from, fromlen);
+
+ if (r < 0)
+ set_winsock_errno ();
+
+ /* Winsock recvfrom() only returns a valid 'from' when the socket is
+ connectionless. POSIX gives a valid 'from' for all types of sockets. */
+ else if (from != NULL && *fromlen == frombufsize)
+ rpl_getpeername (fd, from, fromlen);
+
+ return r;
+}
diff --git a/lib/ref-add.sin b/lib/ref-add.sin
deleted file mode 100644
index cb482d765..000000000
--- a/lib/ref-add.sin
+++ /dev/null
@@ -1,30 +0,0 @@
-# Add this package to a list of references stored in a text file.
-#
-# Copyright (C) 2000, 2009, 2010 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Written by Bruno Haible <haible@clisp.cons.org>.
-#
-/^# Packages using this file: / {
- s/# Packages using this file://
- ta
- :a
- s/ @PACKAGE@ / @PACKAGE@ /
- tb
- s/ $/ @PACKAGE@ /
- :b
- s/^/# Packages using this file:/
-}
diff --git a/lib/ref-del.sin b/lib/ref-del.sin
deleted file mode 100644
index 74f8e1cdf..000000000
--- a/lib/ref-del.sin
+++ /dev/null
@@ -1,25 +0,0 @@
-# Remove this package from a list of references stored in a text file.
-#
-# Copyright (C) 2000, 2009, 2010 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Written by Bruno Haible <haible@clisp.cons.org>.
-#
-/^# Packages using this file: / {
- s/# Packages using this file://
- s/ @PACKAGE@ / /
- s/^/# Packages using this file:/
-}
diff --git a/lib/safe-read.c b/lib/safe-read.c
index 1a240966f..a7cef32ab 100644
--- a/lib/safe-read.c
+++ b/lib/safe-read.c
@@ -1,6 +1,6 @@
/* An interface to read and write that retries after interrupts.
- Copyright (C) 1993-1994, 1998, 2002-2006, 2009-2010 Free Software
+ Copyright (C) 1993-1994, 1998, 2002-2006, 2009-2011 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/safe-read.h b/lib/safe-read.h
index 21c860b33..5d65b51ee 100644
--- a/lib/safe-read.h
+++ b/lib/safe-read.h
@@ -1,5 +1,5 @@
/* An interface to read() that retries after interrupts.
- Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 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
diff --git a/lib/safe-write.c b/lib/safe-write.c
index 6e8c8d7a7..dce327754 100644
--- a/lib/safe-write.c
+++ b/lib/safe-write.c
@@ -1,5 +1,5 @@
/* An interface to write that retries after interrupts.
- Copyright (C) 2002, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2002, 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
diff --git a/lib/safe-write.h b/lib/safe-write.h
index 5c249967f..556fe29a7 100644
--- a/lib/safe-write.h
+++ b/lib/safe-write.h
@@ -1,5 +1,5 @@
/* An interface to write() that retries after interrupts.
- Copyright (C) 2002, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2002, 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
diff --git a/lib/send.c b/lib/send.c
new file mode 100644
index 000000000..2a4d20d02
--- /dev/null
+++ b/lib/send.c
@@ -0,0 +1,40 @@
+/* send.c --- wrappers for Windows send function
+
+ Copyright (C) 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/>. */
+
+/* Written by Paolo Bonzini */
+
+#include <config.h>
+
+#define WIN32_LEAN_AND_MEAN
+/* Get winsock2.h. */
+#include <sys/socket.h>
+
+/* Get set_winsock_errno, FD_TO_SOCKET etc. */
+#include "w32sock.h"
+
+#undef send
+
+ssize_t
+rpl_send (int fd, const void *buf, size_t len, int flags)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = send (sock, buf, len, flags);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
diff --git a/lib/sendto.c b/lib/sendto.c
new file mode 100644
index 000000000..fb2231336
--- /dev/null
+++ b/lib/sendto.c
@@ -0,0 +1,41 @@
+/* sendto.c --- wrappers for Windows sendto function
+
+ Copyright (C) 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/>. */
+
+/* Written by Paolo Bonzini */
+
+#include <config.h>
+
+#define WIN32_LEAN_AND_MEAN
+/* Get winsock2.h. */
+#include <sys/socket.h>
+
+/* Get set_winsock_errno, FD_TO_SOCKET etc. */
+#include "w32sock.h"
+
+#undef sendto
+
+ssize_t
+rpl_sendto (int fd, const void *buf, size_t len, int flags,
+ const struct sockaddr *to, socklen_t tolen)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = sendto (sock, buf, len, flags, to, tolen);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
diff --git a/lib/setsockopt.c b/lib/setsockopt.c
new file mode 100644
index 000000000..5623ca387
--- /dev/null
+++ b/lib/setsockopt.c
@@ -0,0 +1,56 @@
+/* setsockopt.c --- wrappers for Windows setsockopt function
+
+ Copyright (C) 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/>. */
+
+/* Written by Paolo Bonzini */
+
+#include <config.h>
+
+#define WIN32_LEAN_AND_MEAN
+/* Get winsock2.h. */
+#include <sys/socket.h>
+
+/* Get struct timeval. */
+#include <sys/time.h>
+
+/* Get set_winsock_errno, FD_TO_SOCKET etc. */
+#include "w32sock.h"
+
+#undef setsockopt
+
+int
+rpl_setsockopt (int fd, int level, int optname, const void *optval, socklen_t optlen)
+{
+ int r;
+ SOCKET sock = FD_TO_SOCKET (fd);
+
+ if (level == SOL_SOCKET && (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO))
+ {
+ const struct timeval *tv = optval;
+ int milliseconds = tv->tv_sec * 1000 + tv->tv_usec / 1000;
+ optval = &milliseconds;
+ r = setsockopt (sock, level, optname, optval, sizeof (int));
+ }
+ else
+ {
+ r = setsockopt (sock, level, optname, optval, optlen);
+ }
+
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
diff --git a/lib/shutdown.c b/lib/shutdown.c
new file mode 100644
index 000000000..a7d9ac519
--- /dev/null
+++ b/lib/shutdown.c
@@ -0,0 +1,40 @@
+/* shutdown.c --- wrappers for Windows shutdown function
+
+ Copyright (C) 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/>. */
+
+/* Written by Paolo Bonzini */
+
+#include <config.h>
+
+#define WIN32_LEAN_AND_MEAN
+/* Get winsock2.h. */
+#include <sys/socket.h>
+
+/* Get set_winsock_errno, FD_TO_SOCKET etc. */
+#include "w32sock.h"
+
+#undef shutdown
+
+int
+rpl_shutdown (int fd, int how)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = shutdown (sock, how);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
diff --git a/lib/size_max.h b/lib/size_max.h
index 381eea12e..aedf29ed2 100644
--- a/lib/size_max.h
+++ b/lib/size_max.h
@@ -1,5 +1,5 @@
/* size_max.h -- declare SIZE_MAX through system headers
- Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2011 Free Software Foundation, Inc.
Written by Simon Josefsson.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/snprintf.c b/lib/snprintf.c
index 424367934..662ad8e2e 100644
--- a/lib/snprintf.c
+++ b/lib/snprintf.c
@@ -1,5 +1,5 @@
/* Formatted output to strings.
- Copyright (C) 2004, 2006-2010 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006-2011 Free Software Foundation, Inc.
Written by Simon Josefsson and Paul Eggert.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/socket.c b/lib/socket.c
new file mode 100644
index 000000000..600a1457a
--- /dev/null
+++ b/lib/socket.c
@@ -0,0 +1,49 @@
+/* socket.c --- wrappers for Windows socket function
+
+ Copyright (C) 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/>. */
+
+/* Written by Paolo Bonzini */
+
+#include <config.h>
+
+#define WIN32_LEAN_AND_MEAN
+/* Get winsock2.h. */
+#include <sys/socket.h>
+
+/* Get set_winsock_errno, FD_TO_SOCKET etc. */
+#include "w32sock.h"
+
+#include "sockets.h"
+
+int
+rpl_socket (int domain, int type, int protocol)
+{
+ SOCKET fh;
+
+ gl_sockets_startup (SOCKETS_1_1);
+
+ /* We have to use WSASocket() to create non-overlapped IO sockets.
+ Overlapped IO sockets cannot be used with read/write. */
+ fh = WSASocket (domain, type, protocol, NULL, 0, 0);
+
+ if (fh == INVALID_SOCKET)
+ {
+ set_winsock_errno ();
+ return -1;
+ }
+ else
+ return SOCKET_TO_FD (fh);
+}
diff --git a/lib/sockets.c b/lib/sockets.c
index a853c8cce..27da15f8d 100644
--- a/lib/sockets.c
+++ b/lib/sockets.c
@@ -1,6 +1,6 @@
/* sockets.c --- wrappers for Windows socket functions
- Copyright (C) 2008-2010 Free Software Foundation, Inc.
+ Copyright (C) 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
diff --git a/lib/sockets.h b/lib/sockets.h
index 0ecedce94..518565df2 100644
--- a/lib/sockets.h
+++ b/lib/sockets.h
@@ -1,6 +1,6 @@
/* sockets.h - wrappers for Windows socket functions
- Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 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
diff --git a/lib/stat-time.h b/lib/stat-time.h
index 1cb73ab11..b4a914c71 100644
--- a/lib/stat-time.h
+++ b/lib/stat-time.h
@@ -1,6 +1,6 @@
/* stat-related time functions.
- Copyright (C) 2005, 2007, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2005, 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
diff --git a/lib/stat.c b/lib/stat.c
index 60fe1270d..d154a18b0 100644
--- a/lib/stat.c
+++ b/lib/stat.c
@@ -1,5 +1,5 @@
/* Work around platform bugs in stat.
- Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+ 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
diff --git a/lib/stdarg.in.h b/lib/stdarg.in.h
index 1062a12d0..957fa9a8b 100644
--- a/lib/stdarg.in.h
+++ b/lib/stdarg.in.h
@@ -1,5 +1,5 @@
/* Substitute for and wrapper around <stdarg.h>.
- Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 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
diff --git a/lib/stdbool.in.h b/lib/stdbool.in.h
index f2510a9e0..0f33b19bb 100644
--- a/lib/stdbool.in.h
+++ b/lib/stdbool.in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2003, 2006-2010 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2003, 2006-2011 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/stddef.in.h b/lib/stddef.in.h
index a69683ec8..70f5a8678 100644
--- a/lib/stddef.in.h
+++ b/lib/stddef.in.h
@@ -1,6 +1,6 @@
/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
- Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+ 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
diff --git a/lib/stdint.in.h b/lib/stdint.in.h
index db1eec8b0..319b8aa15 100644
--- a/lib/stdint.in.h
+++ b/lib/stdint.in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2002, 2004-2010 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2002, 2004-2011 Free Software Foundation, Inc.
Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
This file is part of gnulib.
@@ -108,6 +108,8 @@
warnings in the signed case. */ \
((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
+#if !GNULIB_defined_stdint_types
+
/* 7.18.1.1. Exact-width integer types */
/* Here we assume a standard architecture where the hardware integer
@@ -137,9 +139,10 @@ typedef unsigned int gl_uint32_t;
/* If the system defines INT64_MAX, assume int64_t works. That way,
if the underlying platform defines int64_t to be a 64-bit long long
int, the code below won't mistakenly define it to be a 64-bit long
- int, which would mess up C++ name mangling. */
+ int, which would mess up C++ name mangling. We must use #ifdef
+ rather than #if, to avoid an error with HP-UX 10.20 cc. */
-#if INT64_MAX
+#ifdef INT64_MAX
# define GL_INT64_T
#else
/* Do not undefine int64_t if gnulib is not being used with 64-bit
@@ -162,7 +165,7 @@ typedef long long int gl_int64_t;
# endif
#endif
-#if UINT64_MAX
+#ifdef UINT64_MAX
# define GL_UINT64_T
#else
# if ULONG_MAX >> 31 >> 31 >> 1 == 1
@@ -295,6 +298,9 @@ typedef unsigned long int gl_uintmax_t;
typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
? 1 : -1];
+#define GNULIB_defined_stdint_types 1
+#endif /* !GNULIB_defined_stdint_types */
+
/* 7.18.2. Limits of specified-width integer types */
#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
diff --git a/lib/stdio-write.c b/lib/stdio-write.c
index 21d07b996..252d9bce8 100644
--- a/lib/stdio-write.c
+++ b/lib/stdio-write.c
@@ -1,5 +1,5 @@
/* POSIX compatible FILE stream write function.
- Copyright (C) 2008-2010 Free Software Foundation, Inc.
+ Copyright (C) 2008-2011 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 1aa122796..4a82174de 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -1,6 +1,6 @@
/* A GNU-like <stdio.h>.
- Copyright (C) 2004, 2007-2010 Free Software Foundation, Inc.
+ Copyright (C) 2004, 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
@@ -52,20 +52,23 @@
#include <stddef.h>
-/* Get off_t and ssize_t. Needed on many systems, including glibc 2.8. */
+/* Get off_t and ssize_t. Needed on many systems, including glibc 2.8
+ and eglibc 2.11.2. */
#include <sys/types.h>
-#ifndef __attribute__
/* The __attribute__ feature is available in gcc versions 2.5 and later.
The __-protected variants of the attributes 'format' and 'printf' are
accepted by gcc versions 2.6.4 (effectively 2.7) and later.
- We enable __attribute__ only if these are supported too, because
+ We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
gnulib and libintl do '#define printf __printf__' when they override
the 'printf' function. */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-# define __attribute__(Spec) /* empty */
-# endif
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
+#else
+# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
#endif
+#define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
+ _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
/* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>. */
/* But in any case avoid namespace pollution on glibc systems. */
@@ -92,13 +95,13 @@
# define dprintf rpl_dprintf
# endif
_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...)
- __attribute__ ((__format__ (__printf__, 2, 3)))
+ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...));
# else
# if !@HAVE_DPRINTF@
_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...)
- __attribute__ ((__format__ (__printf__, 2, 3)))
+ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...));
@@ -189,7 +192,7 @@ _GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - "
# endif
# define GNULIB_overrides_fprintf 1
_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
- __attribute__ ((__format__ (__printf__, 2, 3)))
+ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...));
# else
@@ -366,17 +369,20 @@ _GL_CXXALIASWARN (fseeko);
/* 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. */
-# undef fseek
-# define fseek rpl_fseek
+# 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@
+# if @REPLACE_FSEEKO@
return rpl_fseeko (fp, offset, whence);
-# else
+# else
return fseeko (fp, offset, whence);
-# endif
+# endif
}
+# define GNULIB_defined_fseek_function 1
+# endif
# endif
#elif defined GNULIB_POSIXCHECK
# define _GL_FSEEK_WARN /* Category 1, above. */
@@ -441,17 +447,20 @@ _GL_CXXALIASWARN (ftello);
/* 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. */
-# undef ftell
-# define ftell rpl_ftell
+# 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@
+# if @REPLACE_FTELLO@
return rpl_ftello (f);
-# else
+# else
return ftello (f);
-# endif
+# endif
}
+# define GNULIB_defined_ftell_function 1
+# endif
# endif
#elif defined GNULIB_POSIXCHECK
# define _GL_FTELL_WARN /* Category 1, above. */
@@ -580,7 +589,7 @@ struct obstack;
# endif
_GL_FUNCDECL_RPL (obstack_printf, int,
(struct obstack *obs, const char *format, ...)
- __attribute__ ((__format__ (__printf__, 2, 3)))
+ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (obstack_printf, int,
(struct obstack *obs, const char *format, ...));
@@ -588,7 +597,7 @@ _GL_CXXALIAS_RPL (obstack_printf, int,
# if !@HAVE_DECL_OBSTACK_PRINTF@
_GL_FUNCDECL_SYS (obstack_printf, int,
(struct obstack *obs, const char *format, ...)
- __attribute__ ((__format__ (__printf__, 2, 3)))
+ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (obstack_printf, int,
@@ -601,7 +610,7 @@ _GL_CXXALIASWARN (obstack_printf);
# endif
_GL_FUNCDECL_RPL (obstack_vprintf, int,
(struct obstack *obs, const char *format, va_list args)
- __attribute__ ((__format__ (__printf__, 2, 0)))
+ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (obstack_vprintf, int,
(struct obstack *obs, const char *format, va_list args));
@@ -609,7 +618,7 @@ _GL_CXXALIAS_RPL (obstack_vprintf, int,
# if !@HAVE_DECL_OBSTACK_PRINTF@
_GL_FUNCDECL_SYS (obstack_vprintf, int,
(struct obstack *obs, const char *format, va_list args)
- __attribute__ ((__format__ (__printf__, 2, 0)))
+ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (obstack_vprintf, int,
@@ -672,13 +681,16 @@ _GL_FUNCDECL_RPL_1 (__printf__, int,
(const char *format, ...)
__asm__ (@ASM_SYMBOL_PREFIX@
_GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
- __attribute__ ((__format__ (__printf__, 1, 2)))
+ _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
# else
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# define printf rpl_printf
+# endif
_GL_FUNCDECL_RPL (printf, int,
(const char *format, ...)
- __attribute__ ((__format__ (__printf__, 1, 2)))
+ _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (printf, int, (const char *format, ...));
# endif
@@ -818,7 +830,7 @@ _GL_WARN_ON_USE (renameat, "renameat is not portable - "
# endif
_GL_FUNCDECL_RPL (snprintf, int,
(char *str, size_t size, const char *format, ...)
- __attribute__ ((__format__ (__printf__, 3, 4)))
+ _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
_GL_ARG_NONNULL ((3)));
_GL_CXXALIAS_RPL (snprintf, int,
(char *str, size_t size, const char *format, ...));
@@ -826,7 +838,7 @@ _GL_CXXALIAS_RPL (snprintf, int,
# if !@HAVE_DECL_SNPRINTF@
_GL_FUNCDECL_SYS (snprintf, int,
(char *str, size_t size, const char *format, ...)
- __attribute__ ((__format__ (__printf__, 3, 4)))
+ _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
_GL_ARG_NONNULL ((3)));
# endif
_GL_CXXALIAS_SYS (snprintf, int,
@@ -856,7 +868,7 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
# define sprintf rpl_sprintf
# endif
_GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...)
- __attribute__ ((__format__ (__printf__, 2, 3)))
+ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...));
# else
@@ -901,7 +913,7 @@ _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - "
# endif
_GL_FUNCDECL_RPL (asprintf, int,
(char **result, const char *format, ...)
- __attribute__ ((__format__ (__printf__, 2, 3)))
+ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (asprintf, int,
(char **result, const char *format, ...));
@@ -909,7 +921,7 @@ _GL_CXXALIAS_RPL (asprintf, int,
# if !@HAVE_VASPRINTF@
_GL_FUNCDECL_SYS (asprintf, int,
(char **result, const char *format, ...)
- __attribute__ ((__format__ (__printf__, 2, 3)))
+ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (asprintf, int,
@@ -922,7 +934,7 @@ _GL_CXXALIASWARN (asprintf);
# endif
_GL_FUNCDECL_RPL (vasprintf, int,
(char **result, const char *format, va_list args)
- __attribute__ ((__format__ (__printf__, 2, 0)))
+ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (vasprintf, int,
(char **result, const char *format, va_list args));
@@ -930,7 +942,7 @@ _GL_CXXALIAS_RPL (vasprintf, int,
# if !@HAVE_VASPRINTF@
_GL_FUNCDECL_SYS (vasprintf, int,
(char **result, const char *format, va_list args)
- __attribute__ ((__format__ (__printf__, 2, 0)))
+ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (vasprintf, int,
@@ -945,13 +957,13 @@ _GL_CXXALIASWARN (vasprintf);
# define vdprintf rpl_vdprintf
# endif
_GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args)
- __attribute__ ((__format__ (__printf__, 2, 0)))
+ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args));
# else
# if !@HAVE_VDPRINTF@
_GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args)
- __attribute__ ((__format__ (__printf__, 2, 0)))
+ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
_GL_ARG_NONNULL ((2)));
# endif
/* Need to cast, because on Solaris, the third parameter will likely be
@@ -976,7 +988,7 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
# endif
# define GNULIB_overrides_vfprintf 1
_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
- __attribute__ ((__format__ (__printf__, 2, 0)))
+ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args));
# else
@@ -1006,7 +1018,7 @@ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
# endif
# define GNULIB_overrides_vprintf 1
_GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
- __attribute__ ((__format__ (__printf__, 1, 0)))
+ _GL_ATTRIBUTE_FORMAT_PRINTF (1, 0)
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args));
# else
@@ -1034,7 +1046,7 @@ _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
# endif
_GL_FUNCDECL_RPL (vsnprintf, int,
(char *str, size_t size, const char *format, va_list args)
- __attribute__ ((__format__ (__printf__, 3, 0)))
+ _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
_GL_ARG_NONNULL ((3)));
_GL_CXXALIAS_RPL (vsnprintf, int,
(char *str, size_t size, const char *format, va_list args));
@@ -1042,7 +1054,7 @@ _GL_CXXALIAS_RPL (vsnprintf, int,
# if !@HAVE_DECL_VSNPRINTF@
_GL_FUNCDECL_SYS (vsnprintf, int,
(char *str, size_t size, const char *format, va_list args)
- __attribute__ ((__format__ (__printf__, 3, 0)))
+ _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
_GL_ARG_NONNULL ((3)));
# endif
_GL_CXXALIAS_SYS (vsnprintf, int,
@@ -1064,7 +1076,7 @@ _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
# endif
_GL_FUNCDECL_RPL (vsprintf, int,
(char *str, const char *format, va_list args)
- __attribute__ ((__format__ (__printf__, 2, 0)))
+ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (vsprintf, int,
(char *str, const char *format, va_list args));
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 1bae6c7d2..e2d945767 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -1,6 +1,6 @@
/* A GNU-like <stdlib.h>.
- Copyright (C) 1995, 2001-2004, 2006-2010 Free Software Foundation, Inc.
+ Copyright (C) 1995, 2001-2004, 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
@@ -49,21 +49,23 @@
# include <sys/loadavg.h>
#endif
+#if @GNULIB_RANDOM_R@
+
/* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
- from <stdlib.h> if _REENTRANT is defined. Include it always. */
-#if @HAVE_RANDOM_H@
-# include <random.h>
-#endif
+ from <stdlib.h> if _REENTRANT is defined. Include it whenever we need
+ 'struct random_data'. */
+# if @HAVE_RANDOM_H@
+# include <random.h>
+# endif
-#if !@HAVE_STRUCT_RANDOM_DATA@ || (@GNULIB_RANDOM_R@ && !@HAVE_RANDOM_R@) \
- || defined GNULIB_POSIXCHECK
-# include <stdint.h>
-#endif
+# if !@HAVE_STRUCT_RANDOM_DATA@ || !@HAVE_RANDOM_R@
+# include <stdint.h>
+# endif
-#if !@HAVE_STRUCT_RANDOM_DATA@
+# if !@HAVE_STRUCT_RANDOM_DATA@
/* Define 'struct random_data'.
But allow multiple gnulib generated <stdlib.h> replacements to coexist. */
-# if !GNULIB_defined_struct_random_data
+# if !GNULIB_defined_struct_random_data
struct random_data
{
int32_t *fptr; /* Front pointer. */
@@ -74,7 +76,8 @@ struct random_data
int rand_sep; /* Distance between front and rear. */
int32_t *end_ptr; /* Pointer behind state table. */
};
-# define GNULIB_defined_struct_random_data 1
+# define GNULIB_defined_struct_random_data 1
+# endif
# endif
#endif
@@ -85,10 +88,10 @@ struct random_data
# include <unistd.h>
#endif
-#ifndef __attribute__
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
-# define __attribute__(Spec) /* empty */
-# endif
+#if 3 <= __GNUC__ || __GNUC__ == 2 && 8 <= __GNUC_MINOR__
+# define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
+#else
+# define _GL_ATTRIBUTE_NORETURN
#endif
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -116,7 +119,7 @@ struct random_data
/* Terminate the current process with the given return code, without running
the 'atexit' handlers. */
# if !@HAVE__EXIT@
-_GL_FUNCDECL_SYS (_Exit, void, (int status) __attribute__ ((__noreturn__)));
+_GL_FUNCDECL_SYS (_Exit, void, (int status) _GL_ATTRIBUTE_NORETURN);
# endif
_GL_CXXALIAS_SYS (_Exit, void, (int status));
_GL_CXXALIASWARN (_Exit);
diff --git a/lib/strcasecmp.c b/lib/strcasecmp.c
index 2891544d9..a98a3a0ca 100644
--- a/lib/strcasecmp.c
+++ b/lib/strcasecmp.c
@@ -1,5 +1,5 @@
/* Case-insensitive string comparison function.
- Copyright (C) 1998-1999, 2005-2007, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 1998-1999, 2005-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
diff --git a/lib/streq.h b/lib/streq.h
deleted file mode 100644
index 87915988f..000000000
--- a/lib/streq.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/* Optimized string comparison.
- Copyright (C) 2001-2002, 2007, 2009-2010 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU 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>. */
-
-#ifndef _GL_STREQ_H
-#define _GL_STREQ_H
-
-#include <string.h>
-
-/* STREQ allows to optimize string comparison with a small literal string.
- STREQ (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
- is semantically equivalent to
- strcmp (s, "EUC-KR") == 0
- just faster. */
-
-/* Help GCC to generate good code for string comparisons with
- immediate strings. */
-#if defined (__GNUC__) && defined (__OPTIMIZE__)
-
-static inline int
-streq9 (const char *s1, const char *s2)
-{
- return strcmp (s1 + 9, s2 + 9) == 0;
-}
-
-static inline int
-streq8 (const char *s1, const char *s2, char s28)
-{
- if (s1[8] == s28)
- {
- if (s28 == 0)
- return 1;
- else
- return streq9 (s1, s2);
- }
- else
- return 0;
-}
-
-static inline int
-streq7 (const char *s1, const char *s2, char s27, char s28)
-{
- if (s1[7] == s27)
- {
- if (s27 == 0)
- return 1;
- else
- return streq8 (s1, s2, s28);
- }
- else
- return 0;
-}
-
-static inline int
-streq6 (const char *s1, const char *s2, char s26, char s27, char s28)
-{
- if (s1[6] == s26)
- {
- if (s26 == 0)
- return 1;
- else
- return streq7 (s1, s2, s27, s28);
- }
- else
- return 0;
-}
-
-static inline int
-streq5 (const char *s1, const char *s2, char s25, char s26, char s27, char s28)
-{
- if (s1[5] == s25)
- {
- if (s25 == 0)
- return 1;
- else
- return streq6 (s1, s2, s26, s27, s28);
- }
- else
- return 0;
-}
-
-static inline int
-streq4 (const char *s1, const char *s2, char s24, char s25, char s26, char s27, char s28)
-{
- if (s1[4] == s24)
- {
- if (s24 == 0)
- return 1;
- else
- return streq5 (s1, s2, s25, s26, s27, s28);
- }
- else
- return 0;
-}
-
-static inline int
-streq3 (const char *s1, const char *s2, char s23, char s24, char s25, char s26, char s27, char s28)
-{
- if (s1[3] == s23)
- {
- if (s23 == 0)
- return 1;
- else
- return streq4 (s1, s2, s24, s25, s26, s27, s28);
- }
- else
- return 0;
-}
-
-static inline int
-streq2 (const char *s1, const char *s2, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
-{
- if (s1[2] == s22)
- {
- if (s22 == 0)
- return 1;
- else
- return streq3 (s1, s2, s23, s24, s25, s26, s27, s28);
- }
- else
- return 0;
-}
-
-static inline int
-streq1 (const char *s1, const char *s2, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
-{
- if (s1[1] == s21)
- {
- if (s21 == 0)
- return 1;
- else
- return streq2 (s1, s2, s22, s23, s24, s25, s26, s27, s28);
- }
- else
- return 0;
-}
-
-static inline int
-streq0 (const char *s1, const char *s2, char s20, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
-{
- if (s1[0] == s20)
- {
- if (s20 == 0)
- return 1;
- else
- return streq1 (s1, s2, s21, s22, s23, s24, s25, s26, s27, s28);
- }
- else
- return 0;
-}
-
-#define STREQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
- streq0 (s1, s2, s20, s21, s22, s23, s24, s25, s26, s27, s28)
-
-#else
-
-#define STREQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
- (strcmp (s1, s2) == 0)
-
-#endif
-
-#endif /* _GL_STREQ_H */
diff --git a/lib/strftime.c b/lib/strftime.c
index c6a9ed240..be7750de1 100644
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2001, 2003-2007, 2009-2010 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2001, 2003-2007, 2009-2011 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
@@ -48,8 +48,11 @@ extern char *tzname[];
GB18030, EUC-TW, BIG5, BIG5-HKSCS, CP950, EUC-JP, EUC-KR, CP949,
SHIFT_JIS, CP932, JOHAB) are safe for formats, because the byte '%'
cannot occur in a multibyte character except in the first byte.
- But this does not hold for the DEC-HANYU encoding used on OSF/1. */
-#if !defined __osf__
+
+ The DEC-HANYU encoding used on OSF/1 is not safe for formats, but
+ this encoding has never been seen in real-life use, so we ignore
+ it. */
+#if !(defined __osf__ && 0)
# define MULTIBYTE_IS_FORMAT_SAFE 1
#endif
#define DO_MULTIBYTE (! MULTIBYTE_IS_FORMAT_SAFE)
diff --git a/lib/strftime.h b/lib/strftime.h
index 92501c35c..c8cac90ea 100644
--- a/lib/strftime.h
+++ b/lib/strftime.h
@@ -1,6 +1,6 @@
/* declarations for strftime.c
- Copyright (C) 2002, 2004, 2008-2010 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 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
diff --git a/lib/striconveh.c b/lib/striconveh.c
index 4fa4ea080..5052f02f7 100644
--- a/lib/striconveh.c
+++ b/lib/striconveh.c
@@ -1,5 +1,5 @@
/* Character set conversion with error handling.
- Copyright (C) 2001-2010 Free Software Foundation, Inc.
+ Copyright (C) 2001-2011 Free Software Foundation, Inc.
Written by Bruno Haible and Simon Josefsson.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/striconveh.h b/lib/striconveh.h
index 1f1c3bced..8c0e6c493 100644
--- a/lib/striconveh.h
+++ b/lib/striconveh.h
@@ -1,5 +1,5 @@
/* Character set conversion with error handling.
- Copyright (C) 2001-2007, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2001-2007, 2009-2011 Free Software Foundation, Inc.
Written by Bruno Haible and Simon Josefsson.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/string.in.h b/lib/string.in.h
index 57c10191c..3926c0c60 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -1,6 +1,6 @@
/* A GNU-like <string.h>.
- Copyright (C) 1995-1996, 2001-2010 Free Software Foundation, Inc.
+ Copyright (C) 1995-1996, 2001-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
@@ -37,13 +37,8 @@
# include <wchar.h>
#endif
-#ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later. */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-# define __attribute__(Spec) /* empty */
-# endif
-#endif
-/* The attribute __pure__ was added in gcc 2.96. */
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+ The attribute __pure__ was added in gcc 2.96. */
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
#else
diff --git a/lib/strings.in.h b/lib/strings.in.h
index 83b58238b..d8f1770c8 100644
--- a/lib/strings.in.h
+++ b/lib/strings.in.h
@@ -1,6 +1,6 @@
/* A substitute <strings.h>.
- Copyright (C) 2007-2010 Free Software Foundation, Inc.
+ 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
diff --git a/lib/strncasecmp.c b/lib/strncasecmp.c
index d525deb58..35cd4cccd 100644
--- a/lib/strncasecmp.c
+++ b/lib/strncasecmp.c
@@ -1,5 +1,5 @@
/* strncasecmp.c -- case insensitive string comparator
- Copyright (C) 1998-1999, 2005-2007, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 1998-1999, 2005-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
diff --git a/lib/sys_file.in.h b/lib/sys_file.in.h
index c879f2331..2526ea68e 100644
--- a/lib/sys_file.in.h
+++ b/lib/sys_file.in.h
@@ -1,6 +1,6 @@
/* Provide a more complete sys/file.h.
- Copyright (C) 2007-2010 Free Software Foundation, Inc.
+ 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
diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h
index 5c8462716..12f6d1bc7 100644
--- a/lib/sys_socket.in.h
+++ b/lib/sys_socket.in.h
@@ -1,6 +1,6 @@
/* Provide a sys/socket header file for systems lacking it (read: MinGW)
and for systems where it is incomplete.
- Copyright (C) 2005-2010 Free Software Foundation, Inc.
+ Copyright (C) 2005-2011 Free Software Foundation, Inc.
Written by Simon Josefsson.
This program is free software; you can redistribute it and/or modify
@@ -67,7 +67,10 @@
/* The definition of _GL_WARN_ON_USE is copied here. */
#if !@HAVE_SA_FAMILY_T@
+# if !GNULIB_defined_sa_family_t
typedef unsigned short sa_family_t;
+# define GNULIB_defined_sa_family_t 1
+# endif
#endif
#if @HAVE_STRUCT_SOCKADDR_STORAGE@
@@ -89,12 +92,16 @@ typedef unsigned short sa_family_t;
: alignof (__ss_aligntype)) \
+ sizeof (__ss_aligntype)))
+# if !GNULIB_defined_struct_sockaddr_storage
struct sockaddr_storage
{
sa_family_t ss_family; /* Address family, etc. */
__ss_aligntype __ss_align; /* Force desired alignment. */
char __ss_padding[_SS_PADSIZE];
};
+# define GNULIB_defined_struct_sockaddr_storage 1
+# endif
+
#endif
#if @HAVE_SYS_SOCKET_H@
@@ -159,7 +166,10 @@ struct sockaddr_storage
# include <sys/types.h>
# include <io.h>
+# if !GNULIB_defined_socklen_t
typedef int socklen_t;
+# define GNULIB_defined_socklen_t 1
+# endif
# endif
@@ -167,6 +177,8 @@ typedef int socklen_t;
#if @HAVE_WINSOCK2_H@
+# if !GNULIB_defined_rpl_fd_isset
+
/* Re-define FD_ISSET to avoid a WSA call while we are not using
network sockets. */
static inline int
@@ -183,6 +195,9 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
return 0;
}
+# define GNULIB_defined_rpl_fd_isset 1
+# endif
+
# undef FD_ISSET
# define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
@@ -245,8 +260,11 @@ _GL_FUNCDECL_RPL (connect, int,
_GL_CXXALIAS_RPL (connect, int,
(int fd, const struct sockaddr *addr, socklen_t addrlen));
# else
-_GL_CXXALIAS_SYS (connect, int,
- (int fd, const struct sockaddr *addr, socklen_t addrlen));
+/* Need to cast, because on NonStop Kernel, the third parameter is
+ size_t addrlen. */
+_GL_CXXALIAS_SYS_CAST (connect, int,
+ (int fd,
+ const struct sockaddr *addr, socklen_t addrlen));
# endif
_GL_CXXALIASWARN (connect);
#elif @HAVE_WINSOCK2_H@
@@ -300,8 +318,11 @@ _GL_FUNCDECL_RPL (bind, int,
_GL_CXXALIAS_RPL (bind, int,
(int fd, const struct sockaddr *addr, socklen_t addrlen));
# else
-_GL_CXXALIAS_SYS (bind, int,
- (int fd, const struct sockaddr *addr, socklen_t addrlen));
+/* Need to cast, because on NonStop Kernel, the third parameter is
+ size_t addrlen. */
+_GL_CXXALIAS_SYS_CAST (bind, int,
+ (int fd,
+ const struct sockaddr *addr, socklen_t addrlen));
# endif
_GL_CXXALIASWARN (bind);
#elif @HAVE_WINSOCK2_H@
@@ -522,9 +543,11 @@ _GL_CXXALIAS_RPL (sendto, ssize_t,
(int fd, const void *buf, size_t len, int flags,
const struct sockaddr *to, socklen_t tolen));
# else
-_GL_CXXALIAS_SYS (sendto, ssize_t,
- (int fd, const void *buf, size_t len, int flags,
- const struct sockaddr *to, socklen_t tolen));
+/* Need to cast, because on NonStop Kernel, the sixth parameter is
+ size_t tolen. */
+_GL_CXXALIAS_SYS_CAST (sendto, ssize_t,
+ (int fd, const void *buf, size_t len, int flags,
+ const struct sockaddr *to, socklen_t tolen));
# endif
_GL_CXXALIASWARN (sendto);
#elif @HAVE_WINSOCK2_H@
@@ -550,8 +573,11 @@ _GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname,
_GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname,
const void * optval, socklen_t optlen));
# else
-_GL_CXXALIAS_SYS (setsockopt, int, (int fd, int level, int optname,
- const void * optval, socklen_t optlen));
+/* Need to cast, because on NonStop Kernel, the fifth parameter is
+ size_t optlen. */
+_GL_CXXALIAS_SYS_CAST (setsockopt, int,
+ (int fd, int level, int optname,
+ const void * optval, socklen_t optlen));
# endif
_GL_CXXALIASWARN (setsockopt);
#elif @HAVE_WINSOCK2_H@
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index f969ab9d1..3755e4e64 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -1,5 +1,5 @@
/* Provide a more complete sys/stat header file.
- Copyright (C) 2005-2010 Free Software Foundation, Inc.
+ Copyright (C) 2005-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
@@ -461,11 +461,14 @@ _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
which are included above. */
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+# if !GNULIB_defined_rpl_mkdir
static inline int
rpl_mkdir (char const *name, mode_t mode)
{
return _mkdir (name);
}
+# define GNULIB_defined_rpl_mkdir 1
+# endif
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define mkdir rpl_mkdir
diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h
new file mode 100644
index 000000000..1dbc0f210
--- /dev/null
+++ b/lib/sys_time.in.h
@@ -0,0 +1,101 @@
+/* Provide a more complete sys/time.h.
+
+ 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. */
+
+/* Written by Paul Eggert. */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#if defined _GL_SYS_TIME_H
+
+/* Simply delegate to the system's header, without adding anything. */
+# if @HAVE_SYS_TIME_H@
+# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
+# endif
+
+#else
+
+# define _GL_SYS_TIME_H
+
+# if @HAVE_SYS_TIME_H@
+# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
+# else
+# include <time.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. */
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+# if ! @HAVE_STRUCT_TIMEVAL@
+
+# if !GNULIB_defined_struct_timeval
+struct timeval
+{
+ time_t tv_sec;
+ long int tv_usec;
+};
+# define GNULIB_defined_struct_timeval 1
+# endif
+
+# endif
+
+# ifdef __cplusplus
+}
+# endif
+
+# if @GNULIB_GETTIMEOFDAY@
+# if @REPLACE_GETTIMEOFDAY@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef gettimeofday
+# define gettimeofday rpl_gettimeofday
+# endif
+_GL_FUNCDECL_RPL (gettimeofday, int,
+ (struct timeval *restrict, void *restrict)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (gettimeofday, int,
+ (struct timeval *restrict, void *restrict));
+# else
+# if !@HAVE_GETTIMEOFDAY@
+_GL_FUNCDECL_SYS (gettimeofday, int,
+ (struct timeval *restrict, void *restrict)
+ _GL_ARG_NONNULL ((1)));
+# endif
+/* Need to cast, because on glibc systems, by default, the second argument is
+ struct timezone *. */
+_GL_CXXALIAS_SYS_CAST (gettimeofday, int,
+ (struct timeval *restrict, void *restrict));
+# endif
+_GL_CXXALIASWARN (gettimeofday);
+# elif defined GNULIB_POSIXCHECK
+# undef gettimeofday
+# if HAVE_RAW_DECL_GETTIMEOFDAY
+_GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
+ "use gnulib module gettimeofday for portability");
+# endif
+# endif
+
+#endif /* _GL_SYS_TIME_H */
diff --git a/lib/time.in.h b/lib/time.in.h
index e2974cdca..afccc78c0 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -1,6 +1,6 @@
/* A more-standard <time.h>.
- Copyright (C) 2007-2010 Free Software Foundation, Inc.
+ 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
@@ -69,13 +69,16 @@
extern "C" {
# endif
-# undef timespec
-# define timespec rpl_timespec
+# if !GNULIB_defined_struct_timespec
+# undef timespec
+# define timespec rpl_timespec
struct timespec
{
time_t tv_sec;
long int tv_nsec;
};
+# define GNULIB_defined_struct_timespec 1
+# endif
# ifdef __cplusplus
}
@@ -84,6 +87,7 @@ struct timespec
# endif
# endif
+# if !GNULIB_defined_struct_time_t_must_be_integral
/* Per http://austingroupbugs.net/view.php?id=327, POSIX requires
time_t to be an integer type, even though C99 permits floating
point. We don't know of any implementation that uses floating
@@ -92,6 +96,8 @@ struct timespec
struct __time_t_must_be_integral {
unsigned int __floating_time_t_unsupported : (time_t) 1;
};
+# define GNULIB_defined_struct_time_t_must_be_integral 1
+# endif
/* Sleep for at least RQTP seconds unless interrupted, If interrupted,
return -1 and store the remaining time into RMTP. See
@@ -147,7 +153,7 @@ _GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result));
# else
-# if ! @HAVE_LOCALTIME_R@
+# if ! @HAVE_DECL_LOCALTIME_R@
_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result)
_GL_ARG_NONNULL ((1, 2)));
@@ -155,7 +161,9 @@ _GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result));
# endif
+# if @HAVE_DECL_LOCALTIME_R@
_GL_CXXALIASWARN (localtime_r);
+# endif
# if @REPLACE_LOCALTIME_R@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef gmtime_r
@@ -167,7 +175,7 @@ _GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result));
# else
-# if ! @HAVE_LOCALTIME_R@
+# if ! @HAVE_DECL_LOCALTIME_R@
_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result)
_GL_ARG_NONNULL ((1, 2)));
@@ -175,7 +183,9 @@ _GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result));
# endif
+# if @HAVE_DECL_LOCALTIME_R@
_GL_CXXALIASWARN (gmtime_r);
+# endif
# endif
/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
diff --git a/lib/time_r.c b/lib/time_r.c
index a3c29c676..383c9d0eb 100644
--- a/lib/time_r.c
+++ b/lib/time_r.c
@@ -1,6 +1,6 @@
/* Reentrant time functions like localtime_r.
- Copyright (C) 2003, 2006-2007, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006-2007, 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
diff --git a/lib/trunc.c b/lib/trunc.c
new file mode 100644
index 000000000..f213b26b5
--- /dev/null
+++ b/lib/trunc.c
@@ -0,0 +1,113 @@
+/* Round towards zero.
+ Copyright (C) 2007, 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/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
+
+#include <config.h>
+
+/* Specification. */
+#include <math.h>
+
+#include <float.h>
+
+#undef MIN
+
+#ifdef USE_LONG_DOUBLE
+# define FUNC truncl
+# define DOUBLE long double
+# define MANT_DIG LDBL_MANT_DIG
+# define MIN LDBL_MIN
+# define L_(literal) literal##L
+#elif ! defined USE_FLOAT
+# define FUNC trunc
+# define DOUBLE double
+# define MANT_DIG DBL_MANT_DIG
+# define MIN DBL_MIN
+# define L_(literal) literal
+#else /* defined USE_FLOAT */
+# define FUNC truncf
+# define DOUBLE float
+# define MANT_DIG FLT_MANT_DIG
+# define MIN FLT_MIN
+# define L_(literal) literal##f
+#endif
+
+/* -0.0. See minus-zero.h. */
+#if defined __hpux || defined __sgi || defined __ICC
+# define MINUS_ZERO (-MIN * MIN)
+#else
+# define MINUS_ZERO L_(-0.0)
+#endif
+
+/* 2^(MANT_DIG-1). */
+static const DOUBLE TWO_MANT_DIG =
+ /* Assume MANT_DIG <= 5 * 31.
+ Use the identity
+ n = floor(n/5) + floor((n+1)/5) + ... + floor((n+4)/5). */
+ (DOUBLE) (1U << ((MANT_DIG - 1) / 5))
+ * (DOUBLE) (1U << ((MANT_DIG - 1 + 1) / 5))
+ * (DOUBLE) (1U << ((MANT_DIG - 1 + 2) / 5))
+ * (DOUBLE) (1U << ((MANT_DIG - 1 + 3) / 5))
+ * (DOUBLE) (1U << ((MANT_DIG - 1 + 4) / 5));
+
+DOUBLE
+FUNC (DOUBLE x)
+{
+ /* The use of 'volatile' guarantees that excess precision bits are dropped
+ at each addition step and before the following comparison at the caller's
+ site. It is necessary on x86 systems where double-floats are not IEEE
+ compliant by default, to avoid that the results become platform and compiler
+ option dependent. 'volatile' is a portable alternative to gcc's
+ -ffloat-store option. */
+ volatile DOUBLE y = x;
+ volatile DOUBLE z = y;
+
+ if (z > L_(0.0))
+ {
+ /* For 0 < x < 1, return +0.0 even if the current rounding mode is
+ FE_DOWNWARD. */
+ if (z < L_(1.0))
+ z = L_(0.0);
+ /* Avoid rounding errors for values near 2^k, where k >= MANT_DIG-1. */
+ else if (z < TWO_MANT_DIG)
+ {
+ /* Round to the next integer (nearest or up or down, doesn't matter). */
+ z += TWO_MANT_DIG;
+ z -= TWO_MANT_DIG;
+ /* Enforce rounding down. */
+ if (z > y)
+ z -= L_(1.0);
+ }
+ }
+ else if (z < L_(0.0))
+ {
+ /* For -1 < x < 0, return -0.0 regardless of the current rounding
+ mode. */
+ if (z > L_(-1.0))
+ z = MINUS_ZERO;
+ /* Avoid rounding errors for values near -2^k, where k >= MANT_DIG-1. */
+ else if (z > - TWO_MANT_DIG)
+ {
+ /* Round to the next integer (nearest or up or down, doesn't matter). */
+ z -= TWO_MANT_DIG;
+ z += TWO_MANT_DIG;
+ /* Enforce rounding up. */
+ if (z < y)
+ z += L_(1.0);
+ }
+ }
+ return z;
+}
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 0a4fa6bd0..adc9b24df 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -1,5 +1,5 @@
/* Substitute for and wrapper around <unistd.h>.
- Copyright (C) 2003-2010 Free Software Foundation, Inc.
+ Copyright (C) 2003-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
@@ -88,9 +88,11 @@
# include <io.h>
#endif
-/* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>. */
+/* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
+ NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */
/* But avoid namespace pollution on glibc systems. */
-#if @GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__) \
+#if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \
+ || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \
&& !defined __GLIBC__
# include <netdb.h>
#endif
@@ -712,13 +714,22 @@ _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
${LOGNAME-$USER} on Unix platforms,
$USERNAME on native Windows platforms.
*/
-# if !@HAVE_DECL_GETLOGIN_R@
+# if @REPLACE_GETLOGIN_R@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# define getlogin_r rpl_getlogin_r
+# endif
+_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
+# else
+# if !@HAVE_DECL_GETLOGIN_R@
_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
_GL_ARG_NONNULL ((1)));
-# endif
+# endif
/* Need to cast, because on Solaris 10 systems, the second argument is
int size. */
_GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
+# endif
_GL_CXXALIASWARN (getlogin_r);
#elif defined GNULIB_POSIXCHECK
# undef getlogin_r
@@ -785,11 +796,14 @@ _GL_CXXALIAS_RPL (getpagesize, int, (void));
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define getpagesize() _gl_getpagesize ()
# else
+# if !GNULIB_defined_getpagesize_function
static inline int
getpagesize ()
{
return _gl_getpagesize ();
}
+# define GNULIB_defined_getpagesize_function 1
+# endif
# endif
# endif
# endif
diff --git a/lib/unistr.in.h b/lib/unistr.in.h
index 2164d9d34..c665aa8a5 100644
--- a/lib/unistr.in.h
+++ b/lib/unistr.in.h
@@ -1,5 +1,5 @@
/* Elementary Unicode string functions.
- Copyright (C) 2001-2002, 2005-2010 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002, 2005-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
@@ -134,7 +134,7 @@ extern int
/* The variants with _safe suffix are safe, even if the library is compiled
without --enable-safety. */
-#if defined GNULIB_UNISTR_U8_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U8_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n);
@@ -157,7 +157,7 @@ u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n)
# endif
#endif
-#if defined GNULIB_UNISTR_U16_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U16_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u16_mbtouc_unsafe (ucs4_t *puc, const uint16_t *s, size_t n);
@@ -180,7 +180,7 @@ u16_mbtouc_unsafe (ucs4_t *puc, const uint16_t *s, size_t n)
# endif
#endif
-#if defined GNULIB_UNISTR_U32_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U32_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, size_t n);
@@ -191,11 +191,11 @@ u32_mbtouc_unsafe (ucs4_t *puc,
{
uint32_t c = *s;
-# ifdef CONFIG_UNICODE_SAFETY
+# if CONFIG_UNICODE_SAFETY
if (c < 0xd800 || (c >= 0xe000 && c < 0x110000))
# endif
*puc = c;
-# ifdef CONFIG_UNICODE_SAFETY
+# if CONFIG_UNICODE_SAFETY
else
/* invalid multibyte character */
*puc = 0xfffd;
@@ -205,7 +205,7 @@ u32_mbtouc_unsafe (ucs4_t *puc,
# endif
#endif
-#if defined GNULIB_UNISTR_U8_MBTOUC || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U8_MBTOUC || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n);
@@ -228,7 +228,7 @@ u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n)
# endif
#endif
-#if defined GNULIB_UNISTR_U16_MBTOUC || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U16_MBTOUC || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u16_mbtouc (ucs4_t *puc, const uint16_t *s, size_t n);
@@ -251,7 +251,7 @@ u16_mbtouc (ucs4_t *puc, const uint16_t *s, size_t n)
# endif
#endif
-#if defined GNULIB_UNISTR_U32_MBTOUC || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U32_MBTOUC || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n);
@@ -279,17 +279,17 @@ u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n _GL_UNUSED_PARAMETER)
/* Similar to u*_mbtouc(), except that the return value gives more details
about the failure, similar to mbrtowc(). */
-#if defined GNULIB_UNISTR_U8_MBTOUCR || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U8_MBTOUCR || HAVE_LIBUNISTRING
extern int
u8_mbtoucr (ucs4_t *puc, const uint8_t *s, size_t n);
#endif
-#if defined GNULIB_UNISTR_U16_MBTOUCR || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U16_MBTOUCR || HAVE_LIBUNISTRING
extern int
u16_mbtoucr (ucs4_t *puc, const uint16_t *s, size_t n);
#endif
-#if defined GNULIB_UNISTR_U32_MBTOUCR || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U32_MBTOUCR || HAVE_LIBUNISTRING
extern int
u32_mbtoucr (ucs4_t *puc, const uint32_t *s, size_t n);
#endif
@@ -300,7 +300,7 @@ extern int
/* Similar to wctomb(), except that s must not be NULL, and the argument n
must be specified. */
-#if defined GNULIB_UNISTR_U8_UCTOMB || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U8_UCTOMB || HAVE_LIBUNISTRING
/* Auxiliary function, also used by u8_chr, u8_strchr, u8_strrchr. */
extern int
u8_uctomb_aux (uint8_t *s, ucs4_t uc, int n);
@@ -322,7 +322,7 @@ u8_uctomb (uint8_t *s, ucs4_t uc, int n)
# endif
#endif
-#if defined GNULIB_UNISTR_U16_UCTOMB || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U16_UCTOMB || HAVE_LIBUNISTRING
/* Auxiliary function, also used by u16_chr, u16_strchr, u16_strrchr. */
extern int
u16_uctomb_aux (uint16_t *s, ucs4_t uc, int n);
@@ -344,7 +344,7 @@ u16_uctomb (uint16_t *s, ucs4_t uc, int n)
# endif
#endif
-#if defined GNULIB_UNISTR_U32_UCTOMB || HAVE_LIBUNISTRING
+#if GNULIB_UNISTR_U32_UCTOMB || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u32_uctomb (uint32_t *s, ucs4_t uc, int n);
diff --git a/lib/unistr/u8-mbtouc-aux.c b/lib/unistr/u8-mbtouc-aux.c
index 378680285..1ac295710 100644
--- a/lib/unistr/u8-mbtouc-aux.c
+++ b/lib/unistr/u8-mbtouc-aux.c
@@ -1,5 +1,5 @@
/* Conversion UTF-8 to UCS-4.
- Copyright (C) 2001-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002, 2006-2007, 2009-2011 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/unistr/u8-mbtouc-unsafe-aux.c b/lib/unistr/u8-mbtouc-unsafe-aux.c
index 1965e9636..deea15123 100644
--- a/lib/unistr/u8-mbtouc-unsafe-aux.c
+++ b/lib/unistr/u8-mbtouc-unsafe-aux.c
@@ -1,5 +1,5 @@
/* Conversion UTF-8 to UCS-4.
- Copyright (C) 2001-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002, 2006-2007, 2009-2011 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/unistr/u8-mbtouc-unsafe.c b/lib/unistr/u8-mbtouc-unsafe.c
index 16af8f98f..b29892559 100644
--- a/lib/unistr/u8-mbtouc-unsafe.c
+++ b/lib/unistr/u8-mbtouc-unsafe.c
@@ -1,5 +1,5 @@
/* Look at first character in UTF-8 string.
- Copyright (C) 1999-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 1999-2002, 2006-2007, 2009-2011 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/unistr/u8-mbtouc.c b/lib/unistr/u8-mbtouc.c
index 2ddd864a0..a62539e63 100644
--- a/lib/unistr/u8-mbtouc.c
+++ b/lib/unistr/u8-mbtouc.c
@@ -1,5 +1,5 @@
/* Look at first character in UTF-8 string.
- Copyright (C) 1999-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 1999-2002, 2006-2007, 2009-2011 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/unistr/u8-mbtoucr.c b/lib/unistr/u8-mbtoucr.c
index a749c48cd..ffcc134a1 100644
--- a/lib/unistr/u8-mbtoucr.c
+++ b/lib/unistr/u8-mbtoucr.c
@@ -1,5 +1,5 @@
/* Look at first character in UTF-8 string, returning an error code.
- Copyright (C) 1999-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 1999-2002, 2006-2007, 2009-2011 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/unistr/u8-prev.c b/lib/unistr/u8-prev.c
index 47f89b470..29118d6b6 100644
--- a/lib/unistr/u8-prev.c
+++ b/lib/unistr/u8-prev.c
@@ -1,5 +1,5 @@
/* Iterate over previous character in UTF-8 string.
- Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2011 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/unistr/u8-uctomb-aux.c b/lib/unistr/u8-uctomb-aux.c
index 695921d60..2014c8c44 100644
--- a/lib/unistr/u8-uctomb-aux.c
+++ b/lib/unistr/u8-uctomb-aux.c
@@ -1,5 +1,5 @@
/* Conversion UCS-4 to UTF-8.
- Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2011 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/unistr/u8-uctomb.c b/lib/unistr/u8-uctomb.c
index fd33c05cd..65a405326 100644
--- a/lib/unistr/u8-uctomb.c
+++ b/lib/unistr/u8-uctomb.c
@@ -1,5 +1,5 @@
/* Store a character in UTF-8 string.
- Copyright (C) 2002, 2005-2006, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005-2006, 2009-2011 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/unitypes.in.h b/lib/unitypes.in.h
index 3e524f875..e78c97de4 100644
--- a/lib/unitypes.in.h
+++ b/lib/unitypes.in.h
@@ -1,5 +1,5 @@
/* Elementary types for the GNU UniString library.
- Copyright (C) 2002, 2005-2006, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005-2006, 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
diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index 13e0ebc56..cad862f9d 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -1,5 +1,5 @@
/* vsprintf with automatic memory allocation.
- Copyright (C) 1999, 2002-2010 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002-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
@@ -1753,8 +1753,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
return NULL;
#define CLEANUP() \
- free (d.dir); \
- if (a.arg) \
+ if (d.dir != d.direct_alloc_dir) \
+ free (d.dir); \
+ if (a.arg != a.direct_alloc_arg) \
free (a.arg);
if (PRINTF_FETCHARGS (args, &a) < 0)
diff --git a/lib/vasnprintf.h b/lib/vasnprintf.h
index b55faf525..7ae03da8e 100644
--- a/lib/vasnprintf.h
+++ b/lib/vasnprintf.h
@@ -1,5 +1,5 @@
/* vsprintf with automatic memory allocation.
- Copyright (C) 2002-2004, 2007-2010 Free Software Foundation, Inc.
+ Copyright (C) 2002-2004, 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
diff --git a/lib/verify.h b/lib/verify.h
index 9bd9cb812..a40d58a63 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -1,6 +1,6 @@
/* Compile-time assert-like macros.
- Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 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
diff --git a/lib/version-etc-fsf.c b/lib/version-etc-fsf.c
index 926a6962e..17c8bc3c4 100644
--- a/lib/version-etc-fsf.c
+++ b/lib/version-etc-fsf.c
@@ -1,5 +1,5 @@
/* Variable with FSF copyright information, for version-etc.
- Copyright (C) 1999-2006, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 1999-2006, 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
diff --git a/lib/version-etc.c b/lib/version-etc.c
index 2648c9a34..60c6f01c7 100644
--- a/lib/version-etc.c
+++ b/lib/version-etc.c
@@ -1,5 +1,5 @@
/* Print --version and bug-reporting information in a consistent format.
- Copyright (C) 1999-2010 Free Software Foundation, Inc.
+ Copyright (C) 1999-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
@@ -38,7 +38,7 @@
# define PACKAGE PACKAGE_TARNAME
#endif
-enum { COPYRIGHT_YEAR = 2010 };
+enum { COPYRIGHT_YEAR = 2011 };
/* The three functions below display the --version information the
standard way.
diff --git a/lib/version-etc.h b/lib/version-etc.h
index 1cbbe3217..9446dec14 100644
--- a/lib/version-etc.h
+++ b/lib/version-etc.h
@@ -1,5 +1,5 @@
/* Print --version and bug-reporting information in a consistent format.
- Copyright (C) 1999, 2003, 2005, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2003, 2005, 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
diff --git a/lib/vsnprintf.c b/lib/vsnprintf.c
index 35eba1574..9abb7a94d 100644
--- a/lib/vsnprintf.c
+++ b/lib/vsnprintf.c
@@ -1,5 +1,5 @@
/* Formatted output to strings.
- Copyright (C) 2004, 2006-2010 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006-2011 Free Software Foundation, Inc.
Written by Simon Josefsson and Yoann Vandoorselaere <yoann@prelude-ids.org>.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/w32sock.h b/lib/w32sock.h
index bc0845cdb..28b0f829c 100644
--- a/lib/w32sock.h
+++ b/lib/w32sock.h
@@ -1,6 +1,6 @@
/* w32sock.h --- internal auxilliary functions for Windows socket functions
- Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 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
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index 0cd471a9e..4abc8759a 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -1,6 +1,6 @@
/* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
- Copyright (C) 2007-2010 Free Software Foundation, Inc.
+ 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
@@ -104,10 +104,12 @@
On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
implementing mbrtowc for encodings like UTF-8. */
#if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
+# if !GNULIB_defined_mbstate_t
typedef int rpl_mbstate_t;
-# undef mbstate_t
-# define mbstate_t rpl_mbstate_t
-# define GNULIB_defined_mbstate_t 1
+# undef mbstate_t
+# define mbstate_t rpl_mbstate_t
+# define GNULIB_defined_mbstate_t 1
+# endif
#endif
@@ -428,6 +430,493 @@ _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
#endif
+/* Search N wide characters of S for C. */
+#if @GNULIB_WMEMCHR@
+# if !@HAVE_WMEMCHR@
+_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n));
+_GL_CXXALIASWARN (wmemchr);
+#elif defined GNULIB_POSIXCHECK
+# undef wmemchr
+# if HAVE_RAW_DECL_WMEMCHR
+_GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
+ "use gnulib module wmemchr for portability");
+# endif
+#endif
+
+
+/* Compare N wide characters of S1 and S2. */
+#if @GNULIB_WMEMCMP@
+# if !@HAVE_WMEMCMP@
+_GL_FUNCDECL_SYS (wmemcmp, int,
+ (const wchar_t *s1, const wchar_t *s2, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wmemcmp, int,
+ (const wchar_t *s1, const wchar_t *s2, size_t n));
+_GL_CXXALIASWARN (wmemcmp);
+#elif defined GNULIB_POSIXCHECK
+# undef wmemcmp
+# if HAVE_RAW_DECL_WMEMCMP
+_GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
+ "use gnulib module wmemcmp for portability");
+# endif
+#endif
+
+
+/* Copy N wide characters of SRC to DEST. */
+#if @GNULIB_WMEMCPY@
+# if !@HAVE_WMEMCPY@
+_GL_FUNCDECL_SYS (wmemcpy, wchar_t *,
+ (wchar_t *dest, const wchar_t *src, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
+ (wchar_t *dest, const wchar_t *src, size_t n));
+_GL_CXXALIASWARN (wmemcpy);
+#elif defined GNULIB_POSIXCHECK
+# undef wmemcpy
+# if HAVE_RAW_DECL_WMEMCPY
+_GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - "
+ "use gnulib module wmemcpy for portability");
+# endif
+#endif
+
+
+/* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for
+ overlapping memory areas. */
+#if @GNULIB_WMEMMOVE@
+# if !@HAVE_WMEMMOVE@
+_GL_FUNCDECL_SYS (wmemmove, wchar_t *,
+ (wchar_t *dest, const wchar_t *src, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wmemmove, wchar_t *,
+ (wchar_t *dest, const wchar_t *src, size_t n));
+_GL_CXXALIASWARN (wmemmove);
+#elif defined GNULIB_POSIXCHECK
+# undef wmemmove
+# if HAVE_RAW_DECL_WMEMMOVE
+_GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
+ "use gnulib module wmemmove for portability");
+# endif
+#endif
+
+
+/* Set N wide characters of S to C. */
+#if @GNULIB_WMEMSET@
+# if !@HAVE_WMEMSET@
+_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
+_GL_CXXALIASWARN (wmemset);
+#elif defined GNULIB_POSIXCHECK
+# undef wmemset
+# if HAVE_RAW_DECL_WMEMSET
+_GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
+ "use gnulib module wmemset for portability");
+# endif
+#endif
+
+
+/* Return the number of wide characters in S. */
+#if @GNULIB_WCSLEN@
+# if !@HAVE_WCSLEN@
+_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s));
+# endif
+_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
+_GL_CXXALIASWARN (wcslen);
+#elif defined GNULIB_POSIXCHECK
+# undef wcslen
+# if HAVE_RAW_DECL_WCSLEN
+_GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
+ "use gnulib module wcslen for portability");
+# endif
+#endif
+
+
+/* Return the number of wide characters in S, but at most MAXLEN. */
+#if @GNULIB_WCSNLEN@
+# if !@HAVE_WCSNLEN@
+_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
+# endif
+_GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
+_GL_CXXALIASWARN (wcsnlen);
+#elif defined GNULIB_POSIXCHECK
+# undef wcsnlen
+# if HAVE_RAW_DECL_WCSNLEN
+_GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
+ "use gnulib module wcsnlen for portability");
+# endif
+#endif
+
+
+/* Copy SRC to DEST. */
+#if @GNULIB_WCSCPY@
+# if !@HAVE_WCSCPY@
+_GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
+# endif
+_GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
+_GL_CXXALIASWARN (wcscpy);
+#elif defined GNULIB_POSIXCHECK
+# undef wcscpy
+# if HAVE_RAW_DECL_WCSCPY
+_GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
+ "use gnulib module wcscpy for portability");
+# endif
+#endif
+
+
+/* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */
+#if @GNULIB_WCPCPY@
+# if !@HAVE_WCPCPY@
+_GL_FUNCDECL_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
+# endif
+_GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
+_GL_CXXALIASWARN (wcpcpy);
+#elif defined GNULIB_POSIXCHECK
+# undef wcpcpy
+# if HAVE_RAW_DECL_WCPCPY
+_GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
+ "use gnulib module wcpcpy for portability");
+# endif
+#endif
+
+
+/* Copy no more than N wide characters of SRC to DEST. */
+#if @GNULIB_WCSNCPY@
+# if !@HAVE_WCSNCPY@
+_GL_FUNCDECL_SYS (wcsncpy, wchar_t *,
+ (wchar_t *dest, const wchar_t *src, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
+ (wchar_t *dest, const wchar_t *src, size_t n));
+_GL_CXXALIASWARN (wcsncpy);
+#elif defined GNULIB_POSIXCHECK
+# undef wcsncpy
+# if HAVE_RAW_DECL_WCSNCPY
+_GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
+ "use gnulib module wcsncpy for portability");
+# endif
+#endif
+
+
+/* Copy no more than N characters of SRC to DEST, returning the address of
+ the last character written into DEST. */
+#if @GNULIB_WCPNCPY@
+# if !@HAVE_WCPNCPY@
+_GL_FUNCDECL_SYS (wcpncpy, wchar_t *,
+ (wchar_t *dest, const wchar_t *src, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wcpncpy, wchar_t *,
+ (wchar_t *dest, const wchar_t *src, size_t n));
+_GL_CXXALIASWARN (wcpncpy);
+#elif defined GNULIB_POSIXCHECK
+# undef wcpncpy
+# if HAVE_RAW_DECL_WCPNCPY
+_GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
+ "use gnulib module wcpncpy for portability");
+# endif
+#endif
+
+
+/* Append SRC onto DEST. */
+#if @GNULIB_WCSCAT@
+# if !@HAVE_WCSCAT@
+_GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
+# endif
+_GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
+_GL_CXXALIASWARN (wcscat);
+#elif defined GNULIB_POSIXCHECK
+# undef wcscat
+# if HAVE_RAW_DECL_WCSCAT
+_GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
+ "use gnulib module wcscat for portability");
+# endif
+#endif
+
+
+/* Append no more than N wide characters of SRC onto DEST. */
+#if @GNULIB_WCSNCAT@
+# if !@HAVE_WCSNCAT@
+_GL_FUNCDECL_SYS (wcsncat, wchar_t *,
+ (wchar_t *dest, const wchar_t *src, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wcsncat, wchar_t *,
+ (wchar_t *dest, const wchar_t *src, size_t n));
+_GL_CXXALIASWARN (wcsncat);
+#elif defined GNULIB_POSIXCHECK
+# undef wcsncat
+# if HAVE_RAW_DECL_WCSNCAT
+_GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
+ "use gnulib module wcsncat for portability");
+# endif
+#endif
+
+
+/* Compare S1 and S2. */
+#if @GNULIB_WCSCMP@
+# if !@HAVE_WCSCMP@
+_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
+# endif
+_GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
+_GL_CXXALIASWARN (wcscmp);
+#elif defined GNULIB_POSIXCHECK
+# undef wcscmp
+# if HAVE_RAW_DECL_WCSCMP
+_GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
+ "use gnulib module wcscmp for portability");
+# endif
+#endif
+
+
+/* Compare no more than N wide characters of S1 and S2. */
+#if @GNULIB_WCSNCMP@
+# if !@HAVE_WCSNCMP@
+_GL_FUNCDECL_SYS (wcsncmp, int,
+ (const wchar_t *s1, const wchar_t *s2, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wcsncmp, int,
+ (const wchar_t *s1, const wchar_t *s2, size_t n));
+_GL_CXXALIASWARN (wcsncmp);
+#elif defined GNULIB_POSIXCHECK
+# undef wcsncmp
+# if HAVE_RAW_DECL_WCSNCMP
+_GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
+ "use gnulib module wcsncmp for portability");
+# endif
+#endif
+
+
+/* Compare S1 and S2, ignoring case. */
+#if @GNULIB_WCSCASECMP@
+# if !@HAVE_WCSCASECMP@
+_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
+# endif
+_GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
+_GL_CXXALIASWARN (wcscasecmp);
+#elif defined GNULIB_POSIXCHECK
+# undef wcscasecmp
+# if HAVE_RAW_DECL_WCSCASECMP
+_GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
+ "use gnulib module wcscasecmp for portability");
+# endif
+#endif
+
+
+/* Compare no more than N chars of S1 and S2, ignoring case. */
+#if @GNULIB_WCSNCASECMP@
+# if !@HAVE_WCSNCASECMP@
+_GL_FUNCDECL_SYS (wcsncasecmp, int,
+ (const wchar_t *s1, const wchar_t *s2, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wcsncasecmp, int,
+ (const wchar_t *s1, const wchar_t *s2, size_t n));
+_GL_CXXALIASWARN (wcsncasecmp);
+#elif defined GNULIB_POSIXCHECK
+# undef wcsncasecmp
+# if HAVE_RAW_DECL_WCSNCASECMP
+_GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - "
+ "use gnulib module wcsncasecmp for portability");
+# endif
+#endif
+
+
+/* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE
+ category of the current locale. */
+#if @GNULIB_WCSCOLL@
+# if !@HAVE_WCSCOLL@
+_GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
+# endif
+_GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
+_GL_CXXALIASWARN (wcscoll);
+#elif defined GNULIB_POSIXCHECK
+# undef wcscoll
+# if HAVE_RAW_DECL_WCSCOLL
+_GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
+ "use gnulib module wcscoll for portability");
+# endif
+#endif
+
+
+/* Transform S2 into array pointed to by S1 such that if wcscmp is applied
+ to two transformed strings the result is the as applying 'wcscoll' to the
+ original strings. */
+#if @GNULIB_WCSXFRM@
+# if !@HAVE_WCSXFRM@
+_GL_FUNCDECL_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n));
+_GL_CXXALIASWARN (wcsxfrm);
+#elif defined GNULIB_POSIXCHECK
+# undef wcsxfrm
+# if HAVE_RAW_DECL_WCSXFRM
+_GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - "
+ "use gnulib module wcsxfrm for portability");
+# endif
+#endif
+
+
+/* Duplicate S, returning an identical malloc'd string. */
+#if @GNULIB_WCSDUP@
+# if !@HAVE_WCSDUP@
+_GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s));
+# endif
+_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
+_GL_CXXALIASWARN (wcsdup);
+#elif defined GNULIB_POSIXCHECK
+# undef wcsdup
+# if HAVE_RAW_DECL_WCSDUP
+_GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
+ "use gnulib module wcsdup for portability");
+# endif
+#endif
+
+
+/* Find the first occurrence of WC in WCS. */
+#if @GNULIB_WCSCHR@
+# if !@HAVE_WCSCHR@
+_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
+# endif
+_GL_CXXALIAS_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
+_GL_CXXALIASWARN (wcschr);
+#elif defined GNULIB_POSIXCHECK
+# undef wcschr
+# if HAVE_RAW_DECL_WCSCHR
+_GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
+ "use gnulib module wcschr for portability");
+# endif
+#endif
+
+
+/* Find the last occurrence of WC in WCS. */
+#if @GNULIB_WCSRCHR@
+# if !@HAVE_WCSRCHR@
+_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
+# endif
+_GL_CXXALIAS_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
+_GL_CXXALIASWARN (wcsrchr);
+#elif defined GNULIB_POSIXCHECK
+# undef wcsrchr
+# if HAVE_RAW_DECL_WCSRCHR
+_GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
+ "use gnulib module wcsrchr for portability");
+# endif
+#endif
+
+
+/* Return the length of the initial segmet of WCS which consists entirely
+ of wide characters not in REJECT. */
+#if @GNULIB_WCSCSPN@
+# if !@HAVE_WCSCSPN@
+_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
+# endif
+_GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
+_GL_CXXALIASWARN (wcscspn);
+#elif defined GNULIB_POSIXCHECK
+# undef wcscspn
+# if HAVE_RAW_DECL_WCSCSPN
+_GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
+ "use gnulib module wcscspn for portability");
+# endif
+#endif
+
+
+/* Return the length of the initial segmet of WCS which consists entirely
+ of wide characters in ACCEPT. */
+#if @GNULIB_WCSSPN@
+# if !@HAVE_WCSSPN@
+_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
+# endif
+_GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
+_GL_CXXALIASWARN (wcsspn);
+#elif defined GNULIB_POSIXCHECK
+# undef wcsspn
+# if HAVE_RAW_DECL_WCSSPN
+_GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
+ "use gnulib module wcsspn for portability");
+# endif
+#endif
+
+
+/* Find the first occurrence in WCS of any character in ACCEPT. */
+#if @GNULIB_WCSPBRK@
+# if !@HAVE_WCSPBRK@
+_GL_FUNCDECL_SYS (wcspbrk, wchar_t *,
+ (const wchar_t *wcs, const wchar_t *accept));
+# endif
+_GL_CXXALIAS_SYS (wcspbrk, wchar_t *,
+ (const wchar_t *wcs, const wchar_t *accept));
+_GL_CXXALIASWARN (wcspbrk);
+#elif defined GNULIB_POSIXCHECK
+# undef wcspbrk
+# if HAVE_RAW_DECL_WCSPBRK
+_GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
+ "use gnulib module wcspbrk for portability");
+# endif
+#endif
+
+
+/* Find the first occurrence of NEEDLE in HAYSTACK. */
+#if @GNULIB_WCSSTR@
+# if !@HAVE_WCSSTR@
+_GL_FUNCDECL_SYS (wcsstr, wchar_t *,
+ (const wchar_t *haystack, const wchar_t *needle));
+# endif
+_GL_CXXALIAS_SYS (wcsstr, wchar_t *,
+ (const wchar_t *haystack, const wchar_t *needle));
+_GL_CXXALIASWARN (wcsstr);
+#elif defined GNULIB_POSIXCHECK
+# undef wcsstr
+# if HAVE_RAW_DECL_WCSSTR
+_GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - "
+ "use gnulib module wcsstr for portability");
+# endif
+#endif
+
+
+/* Divide WCS into tokens separated by characters in DELIM. */
+#if @GNULIB_WCSTOK@
+# if !@HAVE_WCSTOK@
+_GL_FUNCDECL_SYS (wcstok, wchar_t *,
+ (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
+# endif
+_GL_CXXALIAS_SYS (wcstok, wchar_t *,
+ (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
+_GL_CXXALIASWARN (wcstok);
+#elif defined GNULIB_POSIXCHECK
+# undef wcstok
+# if HAVE_RAW_DECL_WCSTOK
+_GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
+ "use gnulib module wcstok for portability");
+# endif
+#endif
+
+
+/* Determine number of column positions required for first N wide
+ characters (or fewer if S ends before this) in S. */
+#if @GNULIB_WCSWIDTH@
+# if @REPLACE_WCSWIDTH@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef wcswidth
+# define wcswidth rpl_wcswidth
+# endif
+_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n));
+_GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n));
+# else
+# if !@HAVE_WCSWIDTH@
+_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
+# endif
+_GL_CXXALIASWARN (wcswidth);
+#elif defined GNULIB_POSIXCHECK
+# undef wcswidth
+# if HAVE_RAW_DECL_WCSWIDTH
+_GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
+ "use gnulib module wcswidth for portability");
+# endif
+#endif
+
+
#endif /* _GL_WCHAR_H */
#endif /* _GL_WCHAR_H */
#endif
diff --git a/lib/write.c b/lib/write.c
index 8e64659d3..7d02daabd 100644
--- a/lib/write.c
+++ b/lib/write.c
@@ -1,5 +1,5 @@
/* POSIX compatible write() function.
- Copyright (C) 2008-2010 Free Software Foundation, Inc.
+ Copyright (C) 2008-2011 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xsize.h b/lib/xsize.h
index 338228090..1bd9ca7f1 100644
--- a/lib/xsize.h
+++ b/lib/xsize.h
@@ -1,6 +1,6 @@
/* xsize.h -- Checked size_t computations.
- Copyright (C) 2003, 2008, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2003, 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