]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
removed unused gnulib crap
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Tue, 4 Mar 2014 11:00:56 +0000 (12:00 +0100)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Tue, 4 Mar 2014 11:10:00 +0000 (12:10 +0100)
117 files changed:
gl/Makefile.am
gl/accept.c [deleted file]
gl/arpa_inet.in.h [deleted file]
gl/close.c [deleted file]
gl/dup2.c [deleted file]
gl/fd-hook.c [deleted file]
gl/fd-hook.h [deleted file]
gl/gai_strerror.c [deleted file]
gl/getaddrinfo.c [deleted file]
gl/getpeername.c [deleted file]
gl/inet_ntop.c [deleted file]
gl/inet_pton.c [deleted file]
gl/listen.c [deleted file]
gl/m4/close.m4 [deleted file]
gl/m4/dup2.m4 [deleted file]
gl/m4/ftruncate.m4 [deleted file]
gl/m4/getaddrinfo.m4 [deleted file]
gl/m4/getcwd.m4 [deleted file]
gl/m4/getdtablesize.m4 [deleted file]
gl/m4/gnulib-cache.m4
gl/m4/gnulib-comp.m4
gl/m4/hostent.m4 [deleted file]
gl/m4/inet_ntop.m4 [deleted file]
gl/m4/ioctl.m4 [deleted file]
gl/m4/lstat.m4 [deleted file]
gl/m4/mode_t.m4 [deleted file]
gl/m4/open.m4 [deleted file]
gl/m4/pathmax.m4 [deleted file]
gl/m4/perror.m4 [deleted file]
gl/m4/pipe.m4 [deleted file]
gl/m4/select.m4 [deleted file]
gl/m4/servent.m4 [deleted file]
gl/m4/signal_h.m4 [deleted file]
gl/m4/stat.m4 [deleted file]
gl/m4/strerror.m4 [deleted file]
gl/m4/strerror_r.m4 [deleted file]
gl/m4/symlink.m4 [deleted file]
gl/m4/sys_ioctl_h.m4 [deleted file]
gl/m4/sys_select_h.m4 [deleted file]
gl/recv.c [deleted file]
gl/recvfrom.c [deleted file]
gl/select.c [deleted file]
gl/send.c [deleted file]
gl/sendto.c [deleted file]
gl/setsockopt.c [deleted file]
gl/shutdown.c [deleted file]
gl/signal.in.h [deleted file]
gl/socket.c [deleted file]
gl/sockets.c [deleted file]
gl/sockets.h [deleted file]
gl/strerror-override.c [deleted file]
gl/strerror-override.h [deleted file]
gl/strerror.c [deleted file]
gl/sys_select.in.h [deleted file]
gl/tests/Makefile.am
gl/tests/dosname.h [deleted file]
gl/tests/ftruncate.c [deleted file]
gl/tests/getcwd-lgpl.c [deleted file]
gl/tests/getdtablesize.c [deleted file]
gl/tests/glthread/lock.c [deleted file]
gl/tests/glthread/lock.h [deleted file]
gl/tests/glthread/threadlib.c [deleted file]
gl/tests/ignore-value.h [deleted file]
gl/tests/ioctl.c [deleted file]
gl/tests/lstat.c [deleted file]
gl/tests/open.c [deleted file]
gl/tests/pathmax.h [deleted file]
gl/tests/perror.c [deleted file]
gl/tests/pipe.c [deleted file]
gl/tests/same-inode.h [deleted file]
gl/tests/stat.c [deleted file]
gl/tests/strerror_r.c [deleted file]
gl/tests/symlink.c [deleted file]
gl/tests/sys_ioctl.in.h [deleted file]
gl/tests/test-accept.c [deleted file]
gl/tests/test-close.c [deleted file]
gl/tests/test-dup2.c [deleted file]
gl/tests/test-ftruncate.c [deleted file]
gl/tests/test-ftruncate.sh [deleted file]
gl/tests/test-getaddrinfo.c [deleted file]
gl/tests/test-getcwd-lgpl.c [deleted file]
gl/tests/test-getdtablesize.c [deleted file]
gl/tests/test-getpeername.c [deleted file]
gl/tests/test-ignore-value.c [deleted file]
gl/tests/test-inet_ntop.c [deleted file]
gl/tests/test-ioctl.c [deleted file]
gl/tests/test-listen.c [deleted file]
gl/tests/test-lstat.c [deleted file]
gl/tests/test-lstat.h [deleted file]
gl/tests/test-open.c [deleted file]
gl/tests/test-open.h [deleted file]
gl/tests/test-pathmax.c [deleted file]
gl/tests/test-perror.c [deleted file]
gl/tests/test-perror.sh [deleted file]
gl/tests/test-perror2.c [deleted file]
gl/tests/test-pipe.c [deleted file]
gl/tests/test-recv.c [deleted file]
gl/tests/test-recvfrom.c [deleted file]
gl/tests/test-select-fd.c [deleted file]
gl/tests/test-select-in.sh [deleted file]
gl/tests/test-select-out.sh [deleted file]
gl/tests/test-select-stdin.c [deleted file]
gl/tests/test-select.c [deleted file]
gl/tests/test-select.h [deleted file]
gl/tests/test-send.c [deleted file]
gl/tests/test-sendto.c [deleted file]
gl/tests/test-setsockopt.c [deleted file]
gl/tests/test-shutdown.c [deleted file]
gl/tests/test-signal-h.c [deleted file]
gl/tests/test-stat.c [deleted file]
gl/tests/test-stat.h [deleted file]
gl/tests/test-strerror.c [deleted file]
gl/tests/test-strerror_r.c [deleted file]
gl/tests/test-symlink.c [deleted file]
gl/tests/test-symlink.h [deleted file]
gl/tests/test-sys_ioctl.c [deleted file]
gl/tests/test-sys_select.c [deleted file]

index 8ca93d0ebb593e2f49b237f1b4648b6f92e9e6a9..1019d03a3fe35382660234c2857bdf1ae3ff2b35 100644 (file)
@@ -21,7 +21,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alloca base64 bind byteswap c-ctype close connect extensions func gendocs getaddrinfo getpass gettext gettimeofday hash-pjw-bare havelib iconv inet_ntop inet_pton intprops lib-msvc-compat lib-symbol-versions listen maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file recv recvfrom select send sendto servent setsockopt shutdown snprintf socket sockets socklen stdint strcase strerror strndup strtok_r strverscmp sys_socket sys_stat time_r u64 unistd valgrind-tests vasprintf vsnprintf warnings
+# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files alloca base64 bind byteswap c-ctype connect extensions func gendocs getpass gettext gettimeofday hash-pjw-bare havelib iconv intprops lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file snprintf stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r u64 unistd valgrind-tests vasprintf vsnprintf warnings
 
 AUTOMAKE_OPTIONS = 1.9.6 gnits
 
@@ -51,15 +51,9 @@ libgnu_la_DEPENDENCIES = $(gl_LTLIBOBJS)
 EXTRA_libgnu_la_SOURCES =
 libgnu_la_LDFLAGS = $(AM_LDFLAGS)
 libgnu_la_LDFLAGS += -no-undefined
-libgnu_la_LDFLAGS += $(GETADDRINFO_LIB)
-libgnu_la_LDFLAGS += $(HOSTENT_LIB)
-libgnu_la_LDFLAGS += $(INET_NTOP_LIB)
-libgnu_la_LDFLAGS += $(INET_PTON_LIB)
 libgnu_la_LDFLAGS += $(LIBSOCKET)
-libgnu_la_LDFLAGS += $(LIB_SELECT)
 libgnu_la_LDFLAGS += $(LTLIBICONV)
 libgnu_la_LDFLAGS += $(LTLIBINTL)
-libgnu_la_LDFLAGS += $(SERVENT_LIB)
 
 ## begin gnulib module absolute-header
 
@@ -70,15 +64,6 @@ HAVE_INCLUDE_NEXT = (__GNUC__ || 60000000 <= __DECC_VER)
 
 ## end   gnulib module absolute-header
 
-## begin gnulib module accept
-
-
-EXTRA_DIST += accept.c w32sock.h
-
-EXTRA_libgnu_la_SOURCES += accept.c
-
-## end   gnulib module accept
-
 ## begin gnulib module alloca
 
 
@@ -113,42 +98,6 @@ EXTRA_DIST += alloca.in.h
 
 ## end   gnulib module alloca-opt
 
-## begin gnulib module arpa_inet
-
-BUILT_SOURCES += arpa/inet.h
-
-# We need the following in order to create <arpa/inet.h> when the system
-# doesn't have one.
-arpa/inet.h: arpa_inet.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
-       $(AM_V_at)$(MKDIR_P) arpa
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-             -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-             -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \
-             -e 's|@''NEXT_ARPA_INET_H''@|$(NEXT_ARPA_INET_H)|g' \
-             -e 's|@''HAVE_ARPA_INET_H''@|$(HAVE_ARPA_INET_H)|g' \
-             -e 's/@''GNULIB_INET_NTOP''@/$(GNULIB_INET_NTOP)/g' \
-             -e 's/@''GNULIB_INET_PTON''@/$(GNULIB_INET_PTON)/g' \
-             -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \
-             -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \
-             -e 's|@''REPLACE_INET_NTOP''@|$(REPLACE_INET_NTOP)|g' \
-             -e 's|@''REPLACE_INET_PTON''@|$(REPLACE_INET_PTON)|g' \
-             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-             < $(srcdir)/arpa_inet.in.h; \
-       } > $@-t && \
-       mv $@-t $@
-MOSTLYCLEANFILES += arpa/inet.h arpa/inet.h-t
-MOSTLYCLEANDIRS += arpa
-
-EXTRA_DIST += arpa_inet.in.h
-
-## end   gnulib module arpa_inet
-
 ## begin gnulib module base64
 
 libgnu_la_SOURCES += base64.h base64.c
@@ -193,15 +142,6 @@ libgnu_la_SOURCES += c-ctype.h c-ctype.c
 
 ## end   gnulib module c-ctype
 
-## begin gnulib module close
-
-
-EXTRA_DIST += close.c
-
-EXTRA_libgnu_la_SOURCES += close.c
-
-## end   gnulib module close
-
 ## begin gnulib module connect
 
 
@@ -211,15 +151,6 @@ EXTRA_libgnu_la_SOURCES += connect.c
 
 ## end   gnulib module connect
 
-## begin gnulib module dup2
-
-
-EXTRA_DIST += dup2.c
-
-EXTRA_libgnu_la_SOURCES += dup2.c
-
-## end   gnulib module dup2
-
 ## begin gnulib module errno
 
 BUILT_SOURCES += $(ERRNO_H)
@@ -254,14 +185,6 @@ EXTRA_DIST += errno.in.h
 
 ## end   gnulib module errno
 
-## begin gnulib module fd-hook
-
-libgnu_la_SOURCES += fd-hook.c
-
-EXTRA_DIST += fd-hook.h
-
-## end   gnulib module fd-hook
-
 ## begin gnulib module float
 
 BUILT_SOURCES += $(FLOAT_H)
@@ -345,15 +268,6 @@ EXTRA_DIST += $(top_srcdir)/build-aux/gendocs.sh
 
 ## end   gnulib module gendocs
 
-## begin gnulib module getaddrinfo
-
-
-EXTRA_DIST += gai_strerror.c getaddrinfo.c
-
-EXTRA_libgnu_la_SOURCES += gai_strerror.c getaddrinfo.c
-
-## end   gnulib module getaddrinfo
-
 ## begin gnulib module getdelim
 
 
@@ -381,15 +295,6 @@ EXTRA_libgnu_la_SOURCES += getpass.c
 
 ## end   gnulib module getpass
 
-## begin gnulib module getpeername
-
-
-EXTRA_DIST += getpeername.c w32sock.h
-
-EXTRA_libgnu_la_SOURCES += getpeername.c
-
-## end   gnulib module getpeername
-
 ## begin gnulib module gettext
 
 # If your project uses "gettextize --intl" to put a source-code
@@ -445,24 +350,6 @@ EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath
 
 ## end   gnulib module havelib
 
-## begin gnulib module inet_ntop
-
-
-EXTRA_DIST += inet_ntop.c
-
-EXTRA_libgnu_la_SOURCES += inet_ntop.c
-
-## end   gnulib module inet_ntop
-
-## begin gnulib module inet_pton
-
-
-EXTRA_DIST += inet_pton.c
-
-EXTRA_libgnu_la_SOURCES += inet_pton.c
-
-## end   gnulib module inet_pton
-
 ## begin gnulib module intprops
 
 
@@ -470,15 +357,6 @@ EXTRA_DIST += intprops.h
 
 ## end   gnulib module intprops
 
-## begin gnulib module listen
-
-
-EXTRA_DIST += listen.c w32sock.h
-
-EXTRA_libgnu_la_SOURCES += listen.c
-
-## end   gnulib module listen
-
 ## begin gnulib module lseek
 
 
@@ -634,111 +512,6 @@ EXTRA_libgnu_la_SOURCES += realloc.c
 
 ## end   gnulib module realloc-posix
 
-## 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 select
-
-
-EXTRA_DIST += select.c
-
-EXTRA_libgnu_la_SOURCES += select.c
-
-## end   gnulib module select
-
-## 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 signal-h
-
-BUILT_SOURCES += signal.h
-
-# We need the following in order to create <signal.h> when the system
-# doesn't have a complete one.
-signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-             -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-             -e 's|@''NEXT_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \
-             -e 's|@''GNULIB_PTHREAD_SIGMASK''@|$(GNULIB_PTHREAD_SIGMASK)|g' \
-             -e 's|@''GNULIB_RAISE''@|$(GNULIB_RAISE)|g' \
-             -e 's/@''GNULIB_SIGNAL_H_SIGPIPE''@/$(GNULIB_SIGNAL_H_SIGPIPE)/g' \
-             -e 's/@''GNULIB_SIGPROCMASK''@/$(GNULIB_SIGPROCMASK)/g' \
-             -e 's/@''GNULIB_SIGACTION''@/$(GNULIB_SIGACTION)/g' \
-             -e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \
-             -e 's|@''HAVE_PTHREAD_SIGMASK''@|$(HAVE_PTHREAD_SIGMASK)|g' \
-             -e 's|@''HAVE_RAISE''@|$(HAVE_RAISE)|g' \
-             -e 's|@''HAVE_SIGSET_T''@|$(HAVE_SIGSET_T)|g' \
-             -e 's|@''HAVE_SIGINFO_T''@|$(HAVE_SIGINFO_T)|g' \
-             -e 's|@''HAVE_SIGACTION''@|$(HAVE_SIGACTION)|g' \
-             -e 's|@''HAVE_STRUCT_SIGACTION_SA_SIGACTION''@|$(HAVE_STRUCT_SIGACTION_SA_SIGACTION)|g' \
-             -e 's|@''HAVE_TYPE_VOLATILE_SIG_ATOMIC_T''@|$(HAVE_TYPE_VOLATILE_SIG_ATOMIC_T)|g' \
-             -e 's|@''HAVE_SIGHANDLER_T''@|$(HAVE_SIGHANDLER_T)|g' \
-             -e 's|@''REPLACE_PTHREAD_SIGMASK''@|$(REPLACE_PTHREAD_SIGMASK)|g' \
-             -e 's|@''REPLACE_RAISE''@|$(REPLACE_RAISE)|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)/signal.in.h; \
-       } > $@-t && \
-       mv $@-t $@
-MOSTLYCLEANFILES += signal.h signal.h-t
-
-EXTRA_DIST += signal.in.h
-
-## end   gnulib module signal-h
-
 ## begin gnulib module size_max
 
 libgnu_la_SOURCES += size_max.h
@@ -835,23 +608,6 @@ 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
-
-EXTRA_DIST += w32sock.h
-
-## end   gnulib module sockets
-
 ## begin gnulib module stdalign
 
 BUILT_SOURCES += $(STDALIGN_H)
@@ -1227,24 +983,6 @@ EXTRA_libgnu_la_SOURCES += strdup.c
 
 ## end   gnulib module strdup-posix
 
-## begin gnulib module strerror
-
-
-EXTRA_DIST += strerror.c
-
-EXTRA_libgnu_la_SOURCES += strerror.c
-
-## end   gnulib module strerror
-
-## begin gnulib module strerror-override
-
-
-EXTRA_DIST += strerror-override.c strerror-override.h
-
-EXTRA_libgnu_la_SOURCES += strerror-override.c
-
-## end   gnulib module strerror-override
-
 ## begin gnulib module string
 
 BUILT_SOURCES += string.h
@@ -1412,40 +1150,6 @@ EXTRA_libgnu_la_SOURCES += strverscmp.c
 
 ## end   gnulib module strverscmp
 
-## begin gnulib module sys_select
-
-BUILT_SOURCES += sys/select.h
-
-# We need the following in order to create <sys/select.h> when the system
-# doesn't have one that works with the given compiler.
-sys/select.h: sys_select.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
-       $(AM_V_at)$(MKDIR_P) sys
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-             -e 's|@''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_SELECT_H''@|$(NEXT_SYS_SELECT_H)|g' \
-             -e 's|@''HAVE_SYS_SELECT_H''@|$(HAVE_SYS_SELECT_H)|g' \
-             -e 's/@''GNULIB_PSELECT''@/$(GNULIB_PSELECT)/g' \
-             -e 's/@''GNULIB_SELECT''@/$(GNULIB_SELECT)/g' \
-             -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
-             -e 's|@''HAVE_PSELECT''@|$(HAVE_PSELECT)|g' \
-             -e 's|@''REPLACE_PSELECT''@|$(REPLACE_PSELECT)|g' \
-             -e 's|@''REPLACE_SELECT''@|$(REPLACE_SELECT)|g' \
-             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-             < $(srcdir)/sys_select.in.h; \
-       } > $@-t && \
-       mv $@-t $@
-MOSTLYCLEANFILES += sys/select.h sys/select.h-t
-MOSTLYCLEANDIRS += sys
-
-EXTRA_DIST += sys_select.in.h
-
-## end   gnulib module sys_select
-
 ## begin gnulib module sys_socket
 
 BUILT_SOURCES += sys/socket.h
diff --git a/gl/accept.c b/gl/accept.c
deleted file mode 100644 (file)
index 2983264..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/* accept.c --- wrappers for Windows accept function
-
-   Copyright (C) 2008-2014 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.1 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 sock = FD_TO_SOCKET (fd);
-
-  if (sock == INVALID_SOCKET)
-    {
-      errno = EBADF;
-      return -1;
-    }
-  else
-    {
-      SOCKET fh = accept (sock, addr, addrlen);
-      if (fh == INVALID_SOCKET)
-        {
-          set_winsock_errno ();
-          return -1;
-        }
-      else
-        return SOCKET_TO_FD (fh);
-    }
-}
diff --git a/gl/arpa_inet.in.h b/gl/arpa_inet.in.h
deleted file mode 100644 (file)
index 009e7a1..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-/* A GNU-like <arpa/inet.h>.
-
-   Copyright (C) 2005-2006, 2008-2014 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.1, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef _@GUARD_PREFIX@_ARPA_INET_H
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-#if @HAVE_FEATURES_H@
-# include <features.h> /* for __GLIBC__ */
-#endif
-
-/* Gnulib's sys/socket.h is responsible for defining socklen_t (used below) and
-   for pulling in winsock2.h etc. under MinGW.
-   But avoid namespace pollution on glibc systems.  */
-#ifndef __GLIBC__
-# include <sys/socket.h>
-#endif
-
-/* On NonStop Kernel, inet_ntop and inet_pton are declared in <netdb.h>.
-   But avoid namespace pollution on glibc systems.  */
-#if defined __TANDEM && !defined __GLIBC__
-# include <netdb.h>
-#endif
-
-#if @HAVE_ARPA_INET_H@
-
-/* The include_next requires a split double-inclusion guard.  */
-# @INCLUDE_NEXT@ @NEXT_ARPA_INET_H@
-
-#endif
-
-#ifndef _@GUARD_PREFIX@_ARPA_INET_H
-#define _@GUARD_PREFIX@_ARPA_INET_H
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
-
-/* The definition of _GL_ARG_NONNULL is copied here.  */
-
-/* The definition of _GL_WARN_ON_USE is copied here.  */
-
-
-#if @GNULIB_INET_NTOP@
-/* Converts an internet address from internal format to a printable,
-   presentable format.
-   AF is an internet address family, such as AF_INET or AF_INET6.
-   SRC points to a 'struct in_addr' (for AF_INET) or 'struct in6_addr'
-   (for AF_INET6).
-   DST points to a buffer having room for CNT bytes.
-   The printable representation of the address (in numeric form, not
-   surrounded by [...], no reverse DNS is done) is placed in DST, and
-   DST is returned.  If an error occurs, the return value is NULL and
-   errno is set.  If CNT bytes are not sufficient to hold the result,
-   the return value is NULL and errno is set to ENOSPC.  A good value
-   for CNT is 46.
-
-   For more details, see the POSIX:2001 specification
-   <http://www.opengroup.org/susv3xsh/inet_ntop.html>.  */
-# if @REPLACE_INET_NTOP@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef inet_ntop
-#   define inet_ntop rpl_inet_ntop
-#  endif
-_GL_FUNCDECL_RPL (inet_ntop, const char *,
-                  (int af, const void *restrict src,
-                   char *restrict dst, socklen_t cnt)
-                  _GL_ARG_NONNULL ((2, 3)));
-_GL_CXXALIAS_RPL (inet_ntop, const char *,
-                  (int af, const void *restrict src,
-                   char *restrict dst, socklen_t cnt));
-# else
-#  if !@HAVE_DECL_INET_NTOP@
-_GL_FUNCDECL_SYS (inet_ntop, const char *,
-                  (int af, const void *restrict src,
-                   char *restrict dst, socklen_t cnt)
-                  _GL_ARG_NONNULL ((2, 3)));
-#  endif
-/* Need to cast, because on NonStop Kernel, the fourth parameter is
-                                            size_t cnt.  */
-_GL_CXXALIAS_SYS_CAST (inet_ntop, const char *,
-                       (int af, const void *restrict src,
-                        char *restrict dst, socklen_t cnt));
-# endif
-_GL_CXXALIASWARN (inet_ntop);
-#elif defined GNULIB_POSIXCHECK
-# undef inet_ntop
-# if HAVE_RAW_DECL_INET_NTOP
-_GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - "
-                 "use gnulib module inet_ntop for portability");
-# endif
-#endif
-
-#if @GNULIB_INET_PTON@
-# if @REPLACE_INET_PTON@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef inet_pton
-#   define inet_pton rpl_inet_pton
-#  endif
-_GL_FUNCDECL_RPL (inet_pton, int,
-                  (int af, const char *restrict src, void *restrict dst)
-                  _GL_ARG_NONNULL ((2, 3)));
-_GL_CXXALIAS_RPL (inet_pton, int,
-                  (int af, const char *restrict src, void *restrict dst));
-# else
-#  if !@HAVE_DECL_INET_PTON@
-_GL_FUNCDECL_SYS (inet_pton, int,
-                  (int af, const char *restrict src, void *restrict dst)
-                  _GL_ARG_NONNULL ((2, 3)));
-#  endif
-_GL_CXXALIAS_SYS (inet_pton, int,
-                  (int af, const char *restrict src, void *restrict dst));
-# endif
-_GL_CXXALIASWARN (inet_pton);
-#elif defined GNULIB_POSIXCHECK
-# undef inet_pton
-# if HAVE_RAW_DECL_INET_PTON
-_GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - "
-                 "use gnulib module inet_pton for portability");
-# endif
-#endif
-
-
-#endif /* _@GUARD_PREFIX@_ARPA_INET_H */
-#endif /* _@GUARD_PREFIX@_ARPA_INET_H */
diff --git a/gl/close.c b/gl/close.c
deleted file mode 100644 (file)
index 1e14eca..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/* close replacement.
-   Copyright (C) 2008-2014 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.1 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 <unistd.h>
-
-#include <errno.h>
-
-#include "fd-hook.h"
-#include "msvc-inval.h"
-
-#undef close
-
-#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
-static int
-close_nothrow (int fd)
-{
-  int result;
-
-  TRY_MSVC_INVAL
-    {
-      result = close (fd);
-    }
-  CATCH_MSVC_INVAL
-    {
-      result = -1;
-      errno = EBADF;
-    }
-  DONE_MSVC_INVAL;
-
-  return result;
-}
-#else
-# define close_nothrow close
-#endif
-
-/* Override close() to call into other gnulib modules.  */
-
-int
-rpl_close (int fd)
-{
-#if WINDOWS_SOCKETS
-  int retval = execute_all_close_hooks (close_nothrow, fd);
-#else
-  int retval = close_nothrow (fd);
-#endif
-
-#if REPLACE_FCHDIR
-  if (retval >= 0)
-    _gl_unregister_fd (fd);
-#endif
-
-  return retval;
-}
diff --git a/gl/dup2.c b/gl/dup2.c
deleted file mode 100644 (file)
index faede45..0000000
--- a/gl/dup2.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/* Duplicate an open file descriptor to a specified file descriptor.
-
-   Copyright (C) 1999, 2004-2007, 2009-2014 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.1 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* written by Paul Eggert */
-
-#include <config.h>
-
-/* Specification.  */
-#include <unistd.h>
-
-#include <errno.h>
-#include <fcntl.h>
-
-#if HAVE_DUP2
-
-# undef dup2
-
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-
-/* Get declarations of the native Windows API functions.  */
-#  define WIN32_LEAN_AND_MEAN
-#  include <windows.h>
-
-#  include "msvc-inval.h"
-
-/* Get _get_osfhandle.  */
-#  include "msvc-nothrow.h"
-
-static int
-ms_windows_dup2 (int fd, int desired_fd)
-{
-  int result;
-
-  /* If fd is closed, mingw hangs on dup2 (fd, fd).  If fd is open,
-     dup2 (fd, fd) returns 0, but all further attempts to use fd in
-     future dup2 calls will hang.  */
-  if (fd == desired_fd)
-    {
-      if ((HANDLE) _get_osfhandle (fd) == INVALID_HANDLE_VALUE)
-        {
-          errno = EBADF;
-          return -1;
-        }
-      return fd;
-    }
-
-  /* Wine 1.0.1 return 0 when desired_fd is negative but not -1:
-     http://bugs.winehq.org/show_bug.cgi?id=21289 */
-  if (desired_fd < 0)
-    {
-      errno = EBADF;
-      return -1;
-    }
-
-  TRY_MSVC_INVAL
-    {
-      result = dup2 (fd, desired_fd);
-    }
-  CATCH_MSVC_INVAL
-    {
-      errno = EBADF;
-      result = -1;
-    }
-  DONE_MSVC_INVAL;
-
-  if (result == 0)
-    result = desired_fd;
-
-  return result;
-}
-
-#  define dup2 ms_windows_dup2
-
-# endif
-
-int
-rpl_dup2 (int fd, int desired_fd)
-{
-  int result;
-
-# ifdef F_GETFL
-  /* On Linux kernels 2.6.26-2.6.29, dup2 (fd, fd) returns -EBADF.
-     On Cygwin 1.5.x, dup2 (1, 1) returns 0.
-     On Cygwin 1.7.17, dup2 (1, -1) dumps core.
-     On Cygwin 1.7.25, dup2 (1, 256) can dump core.
-     On Haiku, dup2 (fd, fd) mistakenly clears FD_CLOEXEC.  */
-#  if HAVE_SETDTABLESIZE
-  setdtablesize (desired_fd + 1);
-#  endif
-  if (desired_fd < 0)
-    fd = desired_fd;
-  if (fd == desired_fd)
-    return fcntl (fd, F_GETFL) == -1 ? -1 : fd;
-# endif
-
-  result = dup2 (fd, desired_fd);
-
-  /* Correct an errno value on FreeBSD 6.1 and Cygwin 1.5.x.  */
-  if (result == -1 && errno == EMFILE)
-    errno = EBADF;
-# if REPLACE_FCHDIR
-  if (fd != desired_fd && result != -1)
-    result = _gl_register_dup (fd, result);
-# endif
-  return result;
-}
-
-#else /* !HAVE_DUP2 */
-
-/* On older platforms, dup2 did not exist.  */
-
-# ifndef F_DUPFD
-static int
-dupfd (int fd, int desired_fd)
-{
-  int duplicated_fd = dup (fd);
-  if (duplicated_fd < 0 || duplicated_fd == desired_fd)
-    return duplicated_fd;
-  else
-    {
-      int r = dupfd (fd, desired_fd);
-      int e = errno;
-      close (duplicated_fd);
-      errno = e;
-      return r;
-    }
-}
-# endif
-
-int
-dup2 (int fd, int desired_fd)
-{
-  int result = fcntl (fd, F_GETFL) < 0 ? -1 : fd;
-  if (result == -1 || fd == desired_fd)
-    return result;
-  close (desired_fd);
-# ifdef F_DUPFD
-  result = fcntl (fd, F_DUPFD, desired_fd);
-#  if REPLACE_FCHDIR
-  if (0 <= result)
-    result = _gl_register_dup (fd, result);
-#  endif
-# else
-  result = dupfd (fd, desired_fd);
-# endif
-  if (result == -1 && (errno == EMFILE || errno == EINVAL))
-    errno = EBADF;
-  return result;
-}
-#endif /* !HAVE_DUP2 */
diff --git a/gl/fd-hook.c b/gl/fd-hook.c
deleted file mode 100644 (file)
index 159d846..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Hook for making making file descriptor functions close(), ioctl() extensible.
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
-   Written by Bruno Haible <bruno@clisp.org>, 2009.
-
-   This program is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Lesser General Public License as published
-   by the Free Software Foundation; either version 2.1 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 "fd-hook.h"
-
-#include <stdlib.h>
-
-/* Currently, this entire code is only needed for the handling of sockets
-   on native Windows platforms.  */
-#if WINDOWS_SOCKETS
-
-/* The first and last link in the doubly linked list.
-   Initially the list is empty.  */
-static struct fd_hook anchor = { &anchor, &anchor, NULL, NULL };
-
-int
-execute_close_hooks (const struct fd_hook *remaining_list, gl_close_fn primary,
-                     int fd)
-{
-  if (remaining_list == &anchor)
-    /* End of list reached.  */
-    return primary (fd);
-  else
-    return remaining_list->private_close_fn (remaining_list->private_next,
-                                             primary, fd);
-}
-
-int
-execute_all_close_hooks (gl_close_fn primary, int fd)
-{
-  return execute_close_hooks (anchor.private_next, primary, fd);
-}
-
-int
-execute_ioctl_hooks (const struct fd_hook *remaining_list, gl_ioctl_fn primary,
-                     int fd, int request, void *arg)
-{
-  if (remaining_list == &anchor)
-    /* End of list reached.  */
-    return primary (fd, request, arg);
-  else
-    return remaining_list->private_ioctl_fn (remaining_list->private_next,
-                                             primary, fd, request, arg);
-}
-
-int
-execute_all_ioctl_hooks (gl_ioctl_fn primary,
-                         int fd, int request, void *arg)
-{
-  return execute_ioctl_hooks (anchor.private_next, primary, fd, request, arg);
-}
-
-void
-register_fd_hook (close_hook_fn close_hook, ioctl_hook_fn ioctl_hook, struct fd_hook *link)
-{
-  if (close_hook == NULL)
-    close_hook = execute_close_hooks;
-  if (ioctl_hook == NULL)
-    ioctl_hook = execute_ioctl_hooks;
-
-  if (link->private_next == NULL && link->private_prev == NULL)
-    {
-      /* Add the link to the doubly linked list.  */
-      link->private_next = anchor.private_next;
-      link->private_prev = &anchor;
-      link->private_close_fn = close_hook;
-      link->private_ioctl_fn = ioctl_hook;
-      anchor.private_next->private_prev = link;
-      anchor.private_next = link;
-    }
-  else
-    {
-      /* The link is already in use.  */
-      if (link->private_close_fn != close_hook
-          || link->private_ioctl_fn != ioctl_hook)
-        abort ();
-    }
-}
-
-void
-unregister_fd_hook (struct fd_hook *link)
-{
-  struct fd_hook *next = link->private_next;
-  struct fd_hook *prev = link->private_prev;
-
-  if (next != NULL && prev != NULL)
-    {
-      /* The link is in use.  Remove it from the doubly linked list.  */
-      prev->private_next = next;
-      next->private_prev = prev;
-      /* Clear the link, to mark it unused.  */
-      link->private_next = NULL;
-      link->private_prev = NULL;
-      link->private_close_fn = NULL;
-      link->private_ioctl_fn = NULL;
-    }
-}
-
-#endif
diff --git a/gl/fd-hook.h b/gl/fd-hook.h
deleted file mode 100644 (file)
index fab8337..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/* Hook for making making file descriptor functions close(), ioctl() extensible.
-   Copyright (C) 2009-2014 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.1 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-
-#ifndef FD_HOOK_H
-#define FD_HOOK_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Currently, this entire code is only needed for the handling of sockets
-   on native Windows platforms.  */
-#if WINDOWS_SOCKETS
-
-
-/* Type of function that closes FD.  */
-typedef int (*gl_close_fn) (int fd);
-
-/* Type of function that applies a control request to FD.  */
-typedef int (*gl_ioctl_fn) (int fd, int request, void *arg);
-
-/* An element of the list of file descriptor hooks.
-   In CLOS (Common Lisp Object System) speak, it consists of an "around"
-   method for the close() function and an "around" method for the ioctl()
-   function.
-   The fields of this structure are considered private.  */
-struct fd_hook
-{
-  /* Doubly linked list.  */
-  struct fd_hook *private_next;
-  struct fd_hook *private_prev;
-  /* Function that treats the types of FD that it knows about and calls
-     execute_close_hooks (REMAINING_LIST, PRIMARY, FD) as a fallback.  */
-  int (*private_close_fn) (const struct fd_hook *remaining_list,
-                           gl_close_fn primary,
-                           int fd);
-  /* Function that treats the types of FD that it knows about and calls
-     execute_ioctl_hooks (REMAINING_LIST, PRIMARY, FD, REQUEST, ARG) as a
-     fallback.  */
-  int (*private_ioctl_fn) (const struct fd_hook *remaining_list,
-                           gl_ioctl_fn primary,
-                           int fd, int request, void *arg);
-};
-
-/* This type of function closes FD, applying special knowledge for the FD
-   types it knows about, and calls
-   execute_close_hooks (REMAINING_LIST, PRIMARY, FD)
-   for the other FD types.
-   In CLOS speak, REMAINING_LIST is the remaining list of "around" methods,
-   and PRIMARY is the "primary" method for close().  */
-typedef int (*close_hook_fn) (const struct fd_hook *remaining_list,
-                              gl_close_fn primary,
-                              int fd);
-
-/* Execute the close hooks in REMAINING_LIST, with PRIMARY as "primary" method.
-   Return 0 or -1, like close() would do.  */
-extern int execute_close_hooks (const struct fd_hook *remaining_list,
-                                gl_close_fn primary,
-                                int fd);
-
-/* Execute all close hooks, with PRIMARY as "primary" method.
-   Return 0 or -1, like close() would do.  */
-extern int execute_all_close_hooks (gl_close_fn primary, int fd);
-
-/* This type of function applies a control request to FD, applying special
-   knowledge for the FD types it knows about, and calls
-   execute_ioctl_hooks (REMAINING_LIST, PRIMARY, FD, REQUEST, ARG)
-   for the other FD types.
-   In CLOS speak, REMAINING_LIST is the remaining list of "around" methods,
-   and PRIMARY is the "primary" method for ioctl().  */
-typedef int (*ioctl_hook_fn) (const struct fd_hook *remaining_list,
-                              gl_ioctl_fn primary,
-                              int fd, int request, void *arg);
-
-/* Execute the ioctl hooks in REMAINING_LIST, with PRIMARY as "primary" method.
-   Return 0 or -1, like ioctl() would do.  */
-extern int execute_ioctl_hooks (const struct fd_hook *remaining_list,
-                                gl_ioctl_fn primary,
-                                int fd, int request, void *arg);
-
-/* Execute all ioctl hooks, with PRIMARY as "primary" method.
-   Return 0 or -1, like ioctl() would do.  */
-extern int execute_all_ioctl_hooks (gl_ioctl_fn primary,
-                                    int fd, int request, void *arg);
-
-/* Add a function pair to the list of file descriptor hooks.
-   CLOSE_HOOK and IOCTL_HOOK may be NULL, indicating no change.
-   The LINK variable points to a piece of memory which is guaranteed to be
-   accessible until the corresponding call to unregister_fd_hook.  */
-extern void register_fd_hook (close_hook_fn close_hook, ioctl_hook_fn ioctl_hook,
-                              struct fd_hook *link);
-
-/* Removes a hook from the list of file descriptor hooks.  */
-extern void unregister_fd_hook (struct fd_hook *link);
-
-
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* FD_HOOK_H */
diff --git a/gl/gai_strerror.c b/gl/gai_strerror.c
deleted file mode 100644 (file)
index fff913e..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Copyright (C) 1997, 2001-2002, 2004-2006, 2008-2014 Free Software
-   Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU Lesser General Public License as published by
-   the Free Software Foundation; either version 2.1, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef _LIBC
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <netdb.h>
-
-#ifdef _LIBC
-# include <libintl.h>
-#else
-# include "gettext.h"
-# define _(String) gettext (String)
-# define N_(String) String
-#endif
-
-#if HAVE_DECL_GAI_STRERROR
-
-# include <sys/socket.h>
-# undef gai_strerror
-# if HAVE_DECL_GAI_STRERRORA
-#  define gai_strerror gai_strerrorA
-# endif
-
-const char *
-rpl_gai_strerror (int code)
-{
-  return gai_strerror (code);
-}
-
-#else /* !HAVE_DECL_GAI_STRERROR */
-
-static struct
-  {
-    int code;
-    const char *msg;
-  }
-values[] =
-  {
-    { EAI_ADDRFAMILY, N_("Address family for hostname not supported") },
-    { EAI_AGAIN, N_("Temporary failure in name resolution") },
-    { EAI_BADFLAGS, N_("Bad value for ai_flags") },
-    { EAI_FAIL, N_("Non-recoverable failure in name resolution") },
-    { EAI_FAMILY, N_("ai_family not supported") },
-    { EAI_MEMORY, N_("Memory allocation failure") },
-    { EAI_NODATA, N_("No address associated with hostname") },
-    { EAI_NONAME, N_("Name or service not known") },
-    { EAI_SERVICE, N_("Servname not supported for ai_socktype") },
-    { EAI_SOCKTYPE, N_("ai_socktype not supported") },
-    { EAI_SYSTEM, N_("System error") },
-    { EAI_OVERFLOW, N_("Argument buffer too small") },
-#ifdef EAI_INPROGRESS
-    { EAI_INPROGRESS, N_("Processing request in progress") },
-    { EAI_CANCELED, N_("Request canceled") },
-    { EAI_NOTCANCELED, N_("Request not canceled") },
-    { EAI_ALLDONE, N_("All requests done") },
-    { EAI_INTR, N_("Interrupted by a signal") },
-    { EAI_IDN_ENCODE, N_("Parameter string not correctly encoded") }
-#endif
-  };
-
-const char *
-gai_strerror (int code)
-{
-  size_t i;
-  for (i = 0; i < sizeof (values) / sizeof (values[0]); ++i)
-    if (values[i].code == code)
-      return _(values[i].msg);
-
-  return _("Unknown error");
-}
-# ifdef _LIBC
-libc_hidden_def (gai_strerror)
-# endif
-#endif /* !HAVE_DECL_GAI_STRERROR */
diff --git a/gl/getaddrinfo.c b/gl/getaddrinfo.c
deleted file mode 100644 (file)
index caac48e..0000000
+++ /dev/null
@@ -1,443 +0,0 @@
-/* Get address information (partial implementation).
-   Copyright (C) 1997, 2001-2002, 2004-2014 Free Software Foundation, Inc.
-   Contributed by Simon Josefsson <simon@josefsson.org>.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU Lesser General Public License as published by
-   the Free Software Foundation; either version 2.1, 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/>.  */
-
-/* Don't use __attribute__ __nonnull__ in this compilation unit.  Otherwise gcc
-   optimizes away the sa == NULL test below.  */
-#define _GL_ARG_NONNULL(params)
-
-#include <config.h>
-
-#include <netdb.h>
-
-#if HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-
-/* Get inet_ntop.  */
-#include <arpa/inet.h>
-
-/* Get calloc. */
-#include <stdlib.h>
-
-/* Get memcpy, strdup. */
-#include <string.h>
-
-/* Get snprintf. */
-#include <stdio.h>
-
-#include <stdbool.h>
-
-#include "gettext.h"
-#define _(String) gettext (String)
-#define N_(String) String
-
-/* BeOS has AF_INET, but not PF_INET.  */
-#ifndef PF_INET
-# define PF_INET AF_INET
-#endif
-/* BeOS also lacks PF_UNSPEC.  */
-#ifndef PF_UNSPEC
-# define PF_UNSPEC 0
-#endif
-
-#if defined _WIN32 || defined __WIN32__
-# define WINDOWS_NATIVE
-#endif
-
-/* gl_sockets_startup */
-#include "sockets.h"
-
-#ifdef WINDOWS_NATIVE
-typedef int (WSAAPI *getaddrinfo_func) (const char*, const char*,
-                                        const struct addrinfo*,
-                                        struct addrinfo**);
-typedef void (WSAAPI *freeaddrinfo_func) (struct addrinfo*);
-typedef int (WSAAPI *getnameinfo_func) (const struct sockaddr*,
-                                        socklen_t, char*, DWORD,
-                                        char*, DWORD, int);
-
-static getaddrinfo_func getaddrinfo_ptr = NULL;
-static freeaddrinfo_func freeaddrinfo_ptr = NULL;
-static getnameinfo_func getnameinfo_ptr = NULL;
-
-static int
-use_win32_p (void)
-{
-  static int done = 0;
-  HMODULE h;
-
-  if (done)
-    return getaddrinfo_ptr ? 1 : 0;
-
-  done = 1;
-
-  h = GetModuleHandle ("ws2_32.dll");
-
-  if (h)
-    {
-      getaddrinfo_ptr = (getaddrinfo_func) GetProcAddress (h, "getaddrinfo");
-      freeaddrinfo_ptr = (freeaddrinfo_func) GetProcAddress (h, "freeaddrinfo");
-      getnameinfo_ptr = (getnameinfo_func) GetProcAddress (h, "getnameinfo");
-    }
-
-  /* If either is missing, something is odd. */
-  if (!getaddrinfo_ptr || !freeaddrinfo_ptr || !getnameinfo_ptr)
-    {
-      getaddrinfo_ptr = NULL;
-      freeaddrinfo_ptr = NULL;
-      getnameinfo_ptr = NULL;
-      return 0;
-    }
-
-  gl_sockets_startup (SOCKETS_1_1);
-
-  return 1;
-}
-#endif
-
-static bool
-validate_family (int family)
-{
-  /* FIXME: Support more families. */
-#if HAVE_IPV4
-     if (family == PF_INET)
-       return true;
-#endif
-#if HAVE_IPV6
-     if (family == PF_INET6)
-       return true;
-#endif
-     if (family == PF_UNSPEC)
-       return true;
-     return false;
-}
-
-/* Translate name of a service location and/or a service name to set of
-   socket addresses. */
-int
-getaddrinfo (const char *restrict nodename,
-             const char *restrict servname,
-             const struct addrinfo *restrict hints,
-             struct addrinfo **restrict res)
-{
-  struct addrinfo *tmp;
-  int port = 0;
-  struct hostent *he;
-  void *storage;
-  size_t size;
-#if HAVE_IPV6
-  struct v6_pair {
-    struct addrinfo addrinfo;
-    struct sockaddr_in6 sockaddr_in6;
-  };
-#endif
-#if HAVE_IPV4
-  struct v4_pair {
-    struct addrinfo addrinfo;
-    struct sockaddr_in sockaddr_in;
-  };
-#endif
-
-#ifdef WINDOWS_NATIVE
-  if (use_win32_p ())
-    return getaddrinfo_ptr (nodename, servname, hints, res);
-#endif
-
-  if (hints && (hints->ai_flags & ~(AI_CANONNAME|AI_PASSIVE)))
-    /* FIXME: Support more flags. */
-    return EAI_BADFLAGS;
-
-  if (hints && !validate_family (hints->ai_family))
-    return EAI_FAMILY;
-
-  if (hints &&
-      hints->ai_socktype != SOCK_STREAM && hints->ai_socktype != SOCK_DGRAM)
-    /* FIXME: Support other socktype. */
-    return EAI_SOCKTYPE; /* FIXME: Better return code? */
-
-  if (!nodename)
-    {
-      if (!(hints->ai_flags & AI_PASSIVE))
-        return EAI_NONAME;
-
-#ifdef HAVE_IPV6
-      nodename = (hints->ai_family == AF_INET6) ? "::" : "0.0.0.0";
-#else
-      nodename = "0.0.0.0";
-#endif
-    }
-
-  if (servname)
-    {
-      struct servent *se = NULL;
-      const char *proto =
-        (hints && hints->ai_socktype == SOCK_DGRAM) ? "udp" : "tcp";
-
-      if (hints == NULL || !(hints->ai_flags & AI_NUMERICSERV))
-        /* FIXME: Use getservbyname_r if available. */
-        se = getservbyname (servname, proto);
-
-      if (!se)
-        {
-          char *c;
-          if (!(*servname >= '0' && *servname <= '9'))
-            return EAI_NONAME;
-          port = strtoul (servname, &c, 10);
-          if (*c || port > 0xffff)
-            return EAI_NONAME;
-          port = htons (port);
-        }
-      else
-        port = se->s_port;
-    }
-
-  /* FIXME: Use gethostbyname_r if available. */
-  he = gethostbyname (nodename);
-  if (!he || he->h_addr_list[0] == NULL)
-    return EAI_NONAME;
-
-  switch (he->h_addrtype)
-    {
-#if HAVE_IPV6
-    case PF_INET6:
-      size = sizeof (struct v6_pair);
-      break;
-#endif
-
-#if HAVE_IPV4
-    case PF_INET:
-      size = sizeof (struct v4_pair);
-      break;
-#endif
-
-    default:
-      return EAI_NODATA;
-    }
-
-  storage = calloc (1, size);
-  if (!storage)
-    return EAI_MEMORY;
-
-  switch (he->h_addrtype)
-    {
-#if HAVE_IPV6
-    case PF_INET6:
-      {
-        struct v6_pair *p = storage;
-        struct sockaddr_in6 *sinp = &p->sockaddr_in6;
-        tmp = &p->addrinfo;
-
-        if (port)
-          sinp->sin6_port = port;
-
-        if (he->h_length != sizeof (sinp->sin6_addr))
-          {
-            free (storage);
-            return EAI_SYSTEM; /* FIXME: Better return code?  Set errno? */
-          }
-
-        memcpy (&sinp->sin6_addr, he->h_addr_list[0], sizeof sinp->sin6_addr);
-
-        tmp->ai_addr = (struct sockaddr *) sinp;
-        tmp->ai_addrlen = sizeof *sinp;
-      }
-      break;
-#endif
-
-#if HAVE_IPV4
-    case PF_INET:
-      {
-        struct v4_pair *p = storage;
-        struct sockaddr_in *sinp = &p->sockaddr_in;
-        tmp = &p->addrinfo;
-
-        if (port)
-          sinp->sin_port = port;
-
-        if (he->h_length != sizeof (sinp->sin_addr))
-          {
-            free (storage);
-            return EAI_SYSTEM; /* FIXME: Better return code?  Set errno? */
-          }
-
-        memcpy (&sinp->sin_addr, he->h_addr_list[0], sizeof sinp->sin_addr);
-
-        tmp->ai_addr = (struct sockaddr *) sinp;
-        tmp->ai_addrlen = sizeof *sinp;
-      }
-      break;
-#endif
-
-    default:
-      free (storage);
-      return EAI_NODATA;
-    }
-
-  if (hints && hints->ai_flags & AI_CANONNAME)
-    {
-      const char *cn;
-      if (he->h_name)
-        cn = he->h_name;
-      else
-        cn = nodename;
-
-      tmp->ai_canonname = strdup (cn);
-      if (!tmp->ai_canonname)
-        {
-          free (storage);
-          return EAI_MEMORY;
-        }
-    }
-
-  tmp->ai_protocol = (hints) ? hints->ai_protocol : 0;
-  tmp->ai_socktype = (hints) ? hints->ai_socktype : 0;
-  tmp->ai_addr->sa_family = he->h_addrtype;
-  tmp->ai_family = he->h_addrtype;
-
-#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
-  switch (he->h_addrtype)
-    {
-#if HAVE_IPV4
-    case AF_INET:
-      tmp->ai_addr->sa_len = sizeof (struct sockaddr_in);
-      break;
-#endif
-#if HAVE_IPV6
-    case AF_INET6:
-      tmp->ai_addr->sa_len = sizeof (struct sockaddr_in6);
-      break;
-#endif
-    }
-#endif
-
-  /* FIXME: If more than one address, create linked list of addrinfo's. */
-
-  *res = tmp;
-
-  return 0;
-}
-
-/* Free 'addrinfo' structure AI including associated storage.  */
-void
-freeaddrinfo (struct addrinfo *ai)
-{
-#ifdef WINDOWS_NATIVE
-  if (use_win32_p ())
-    {
-      freeaddrinfo_ptr (ai);
-      return;
-    }
-#endif
-
-  while (ai)
-    {
-      struct addrinfo *cur;
-
-      cur = ai;
-      ai = ai->ai_next;
-
-      free (cur->ai_canonname);
-      free (cur);
-    }
-}
-
-int
-getnameinfo (const struct sockaddr *restrict sa, socklen_t salen,
-             char *restrict node, socklen_t nodelen,
-             char *restrict service, socklen_t servicelen,
-             int flags)
-{
-#ifdef WINDOWS_NATIVE
-  if (use_win32_p ())
-    return getnameinfo_ptr (sa, salen, node, nodelen,
-                            service, servicelen, flags);
-#endif
-
-  /* FIXME: Support other flags. */
-  if ((node && nodelen > 0 && !(flags & NI_NUMERICHOST)) ||
-      (service && servicelen > 0 && !(flags & NI_NUMERICHOST)) ||
-      (flags & ~(NI_NUMERICHOST|NI_NUMERICSERV)))
-    return EAI_BADFLAGS;
-
-  if (sa == NULL || salen < sizeof (sa->sa_family))
-    return EAI_FAMILY;
-
-  switch (sa->sa_family)
-    {
-#if HAVE_IPV4
-    case AF_INET:
-      if (salen < sizeof (struct sockaddr_in))
-        return EAI_FAMILY;
-      break;
-#endif
-#if HAVE_IPV6
-    case AF_INET6:
-      if (salen < sizeof (struct sockaddr_in6))
-        return EAI_FAMILY;
-      break;
-#endif
-    default:
-      return EAI_FAMILY;
-    }
-
-  if (node && nodelen > 0 && flags & NI_NUMERICHOST)
-    {
-      switch (sa->sa_family)
-        {
-#if HAVE_IPV4
-        case AF_INET:
-          if (!inet_ntop (AF_INET,
-                          &(((const struct sockaddr_in *) sa)->sin_addr),
-                          node, nodelen))
-            return EAI_SYSTEM;
-          break;
-#endif
-
-#if HAVE_IPV6
-        case AF_INET6:
-          if (!inet_ntop (AF_INET6,
-                          &(((const struct sockaddr_in6 *) sa)->sin6_addr),
-                          node, nodelen))
-            return EAI_SYSTEM;
-          break;
-#endif
-
-        default:
-          return EAI_FAMILY;
-        }
-    }
-
-  if (service && servicelen > 0 && flags & NI_NUMERICSERV)
-    switch (sa->sa_family)
-      {
-#if HAVE_IPV4
-      case AF_INET:
-#endif
-#if HAVE_IPV6
-      case AF_INET6:
-#endif
-        {
-          unsigned short int port
-            = ntohs (((const struct sockaddr_in *) sa)->sin_port);
-          if (servicelen <= snprintf (service, servicelen, "%u", port))
-            return EAI_OVERFLOW;
-        }
-        break;
-      }
-
-  return 0;
-}
diff --git a/gl/getpeername.c b/gl/getpeername.c
deleted file mode 100644 (file)
index 1b489fc..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* getpeername.c --- wrappers for Windows getpeername function
-
-   Copyright (C) 2008-2014 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.1 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);
-
-  if (sock == INVALID_SOCKET)
-    {
-      errno = EBADF;
-      return -1;
-    }
-  else
-    {
-      int r = getpeername (sock, addr, addrlen);
-      if (r < 0)
-        set_winsock_errno ();
-
-      return r;
-    }
-}
diff --git a/gl/inet_ntop.c b/gl/inet_ntop.c
deleted file mode 100644 (file)
index 268ccf8..0000000
+++ /dev/null
@@ -1,260 +0,0 @@
-/* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form
-
-   Copyright (C) 2005-2006, 2008-2014 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.1, 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/>.  */
-
-/*
- * Copyright (c) 1996-1999 by Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- */
-
-#include <config.h>
-
-/* Specification.  */
-#include <arpa/inet.h>
-
-/* Use this to suppress gcc's "...may be used before initialized" warnings.
-   Beware: The Code argument must not contain commas.  */
-#ifndef IF_LINT
-# ifdef lint
-#  define IF_LINT(Code) Code
-# else
-#  define IF_LINT(Code) /* empty */
-# endif
-#endif
-
-#if HAVE_DECL_INET_NTOP
-
-# undef inet_ntop
-
-const char *
-rpl_inet_ntop (int af, const void *restrict src,
-               char *restrict dst, socklen_t cnt)
-{
-  return inet_ntop (af, src, dst, cnt);
-}
-
-#else
-
-# include <stdio.h>
-# include <string.h>
-# include <errno.h>
-
-# define NS_IN6ADDRSZ 16
-# define NS_INT16SZ 2
-
-/*
- * WARNING: Don't even consider trying to compile this on a system where
- * sizeof(int) < 4.  sizeof(int) > 4 is fine; all the world's not a VAX.
- */
-typedef int verify_int_size[4 <= sizeof (int) ? 1 : -1];
-
-static const char *inet_ntop4 (const unsigned char *src, char *dst, socklen_t size);
-# if HAVE_IPV6
-static const char *inet_ntop6 (const unsigned char *src, char *dst, socklen_t size);
-# endif
-
-
-/* char *
- * inet_ntop(af, src, dst, size)
- *      convert a network format address to presentation format.
- * return:
- *      pointer to presentation format address ('dst'), or NULL (see errno).
- * author:
- *      Paul Vixie, 1996.
- */
-const char *
-inet_ntop (int af, const void *restrict src,
-           char *restrict dst, socklen_t cnt)
-{
-  switch (af)
-    {
-# if HAVE_IPV4
-    case AF_INET:
-      return (inet_ntop4 (src, dst, cnt));
-# endif
-
-# if HAVE_IPV6
-    case AF_INET6:
-      return (inet_ntop6 (src, dst, cnt));
-# endif
-
-    default:
-      errno = EAFNOSUPPORT;
-      return (NULL);
-    }
-  /* NOTREACHED */
-}
-
-/* const char *
- * inet_ntop4(src, dst, size)
- *      format an IPv4 address
- * return:
- *      'dst' (as a const)
- * notes:
- *      (1) uses no statics
- *      (2) takes a u_char* not an in_addr as input
- * author:
- *      Paul Vixie, 1996.
- */
-static const char *
-inet_ntop4 (const unsigned char *src, char *dst, socklen_t size)
-{
-  char tmp[sizeof "255.255.255.255"];
-  int len;
-
-  len = sprintf (tmp, "%u.%u.%u.%u", src[0], src[1], src[2], src[3]);
-  if (len < 0)
-    return NULL;
-
-  if (len > size)
-    {
-      errno = ENOSPC;
-      return NULL;
-    }
-
-  return strcpy (dst, tmp);
-}
-
-# if HAVE_IPV6
-
-/* const char *
- * inet_ntop6(src, dst, size)
- *      convert IPv6 binary address into presentation (printable) format
- * author:
- *      Paul Vixie, 1996.
- */
-static const char *
-inet_ntop6 (const unsigned char *src, char *dst, socklen_t size)
-{
-  /*
-   * Note that int32_t and int16_t need only be "at least" large enough
-   * to contain a value of the specified size.  On some systems, like
-   * Crays, there is no such thing as an integer variable with 16 bits.
-   * Keep this in mind if you think this function should have been coded
-   * to use pointer overlays.  All the world's not a VAX.
-   */
-  char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
-  struct
-  {
-    int base, len;
-  } best, cur;
-  unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ];
-  int i;
-
-  /*
-   * Preprocess:
-   *      Copy the input (bytewise) array into a wordwise array.
-   *      Find the longest run of 0x00's in src[] for :: shorthanding.
-   */
-  memset (words, '\0', sizeof words);
-  for (i = 0; i < NS_IN6ADDRSZ; i += 2)
-    words[i / 2] = (src[i] << 8) | src[i + 1];
-  best.base = -1;
-  cur.base = -1;
-  IF_LINT(best.len = 0);
-  IF_LINT(cur.len = 0);
-  for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
-    {
-      if (words[i] == 0)
-        {
-          if (cur.base == -1)
-            cur.base = i, cur.len = 1;
-          else
-            cur.len++;
-        }
-      else
-        {
-          if (cur.base != -1)
-            {
-              if (best.base == -1 || cur.len > best.len)
-                best = cur;
-              cur.base = -1;
-            }
-        }
-    }
-  if (cur.base != -1)
-    {
-      if (best.base == -1 || cur.len > best.len)
-        best = cur;
-    }
-  if (best.base != -1 && best.len < 2)
-    best.base = -1;
-
-  /*
-   * Format the result.
-   */
-  tp = tmp;
-  for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
-    {
-      /* Are we inside the best run of 0x00's? */
-      if (best.base != -1 && i >= best.base && i < (best.base + best.len))
-        {
-          if (i == best.base)
-            *tp++ = ':';
-          continue;
-        }
-      /* Are we following an initial run of 0x00s or any real hex? */
-      if (i != 0)
-        *tp++ = ':';
-      /* Is this address an encapsulated IPv4? */
-      if (i == 6 && best.base == 0 &&
-          (best.len == 6 || (best.len == 5 && words[5] == 0xffff)))
-        {
-          if (!inet_ntop4 (src + 12, tp, sizeof tmp - (tp - tmp)))
-            return (NULL);
-          tp += strlen (tp);
-          break;
-        }
-      {
-        int len = sprintf (tp, "%x", words[i]);
-        if (len < 0)
-          return NULL;
-        tp += len;
-      }
-    }
-  /* Was it a trailing run of 0x00's? */
-  if (best.base != -1 && (best.base + best.len) ==
-      (NS_IN6ADDRSZ / NS_INT16SZ))
-    *tp++ = ':';
-  *tp++ = '\0';
-
-  /*
-   * Check for overflow, copy, and we're done.
-   */
-  if ((socklen_t) (tp - tmp) > size)
-    {
-      errno = ENOSPC;
-      return NULL;
-    }
-
-  return strcpy (dst, tmp);
-}
-
-# endif
-
-#endif
diff --git a/gl/inet_pton.c b/gl/inet_pton.c
deleted file mode 100644 (file)
index e2f9ba1..0000000
+++ /dev/null
@@ -1,268 +0,0 @@
-/* inet_pton.c -- convert IPv4 and IPv6 addresses from text to binary form
-
-   Copyright (C) 2006, 2008-2014 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.1 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/>.  */
-
-/*
- * Copyright (c) 1996,1999 by Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- */
-
-#include <config.h>
-
-/* Specification.  */
-#include <arpa/inet.h>
-
-#if HAVE_DECL_INET_PTON
-
-# undef inet_pton
-
-int
-rpl_inet_pton (int af, const char *restrict src, void *restrict dst)
-{
-  return inet_pton (af, src, dst);
-}
-
-#else
-
-# include <c-ctype.h>
-# include <string.h>
-# include <errno.h>
-
-# define NS_INADDRSZ 4
-# define NS_IN6ADDRSZ 16
-# define NS_INT16SZ 2
-
-/*
- * WARNING: Don't even consider trying to compile this on a system where
- * sizeof(int) < 4.  sizeof(int) > 4 is fine; all the world's not a VAX.
- */
-
-static int inet_pton4 (const char *src, unsigned char *dst);
-# if HAVE_IPV6
-static int inet_pton6 (const char *src, unsigned char *dst);
-# endif
-
-/* int
- * inet_pton(af, src, dst)
- *      convert from presentation format (which usually means ASCII printable)
- *      to network format (which is usually some kind of binary format).
- * return:
- *      1 if the address was valid for the specified address family
- *      0 if the address wasn't valid ('dst' is untouched in this case)
- *      -1 if some other error occurred ('dst' is untouched in this case, too)
- * author:
- *      Paul Vixie, 1996.
- */
-int
-inet_pton (int af, const char *restrict src, void *restrict dst)
-{
-  switch (af)
-    {
-    case AF_INET:
-      return (inet_pton4 (src, dst));
-
-# if HAVE_IPV6
-    case AF_INET6:
-      return (inet_pton6 (src, dst));
-# endif
-
-    default:
-      errno = EAFNOSUPPORT;
-      return (-1);
-    }
-  /* NOTREACHED */
-}
-
-/* int
- * inet_pton4(src, dst)
- *      like inet_aton() but without all the hexadecimal, octal (with the
- *      exception of 0) and shorthand.
- * return:
- *      1 if 'src' is a valid dotted quad, else 0.
- * notice:
- *      does not touch 'dst' unless it's returning 1.
- * author:
- *      Paul Vixie, 1996.
- */
-static int
-inet_pton4 (const char *restrict src, unsigned char *restrict dst)
-{
-  int saw_digit, octets, ch;
-  unsigned char tmp[NS_INADDRSZ], *tp;
-
-  saw_digit = 0;
-  octets = 0;
-  *(tp = tmp) = 0;
-  while ((ch = *src++) != '\0')
-    {
-
-      if (ch >= '0' && ch <= '9')
-        {
-          unsigned new = *tp * 10 + (ch - '0');
-
-          if (saw_digit && *tp == 0)
-            return (0);
-          if (new > 255)
-            return (0);
-          *tp = new;
-          if (!saw_digit)
-            {
-              if (++octets > 4)
-                return (0);
-              saw_digit = 1;
-            }
-        }
-      else if (ch == '.' && saw_digit)
-        {
-          if (octets == 4)
-            return (0);
-          *++tp = 0;
-          saw_digit = 0;
-        }
-      else
-        return (0);
-    }
-  if (octets < 4)
-    return (0);
-  memcpy (dst, tmp, NS_INADDRSZ);
-  return (1);
-}
-
-# if HAVE_IPV6
-
-/* int
- * inet_pton6(src, dst)
- *      convert presentation level address to network order binary form.
- * return:
- *      1 if 'src' is a valid [RFC1884 2.2] address, else 0.
- * notice:
- *      (1) does not touch 'dst' unless it's returning 1.
- *      (2) :: in a full address is silently ignored.
- * credit:
- *      inspired by Mark Andrews.
- * author:
- *      Paul Vixie, 1996.
- */
-static int
-inet_pton6 (const char *restrict src, unsigned char *restrict dst)
-{
-  static const char xdigits[] = "0123456789abcdef";
-  unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
-  const char *curtok;
-  int ch, saw_xdigit;
-  unsigned val;
-
-  tp = memset (tmp, '\0', NS_IN6ADDRSZ);
-  endp = tp + NS_IN6ADDRSZ;
-  colonp = NULL;
-  /* Leading :: requires some special handling. */
-  if (*src == ':')
-    if (*++src != ':')
-      return (0);
-  curtok = src;
-  saw_xdigit = 0;
-  val = 0;
-  while ((ch = c_tolower (*src++)) != '\0')
-    {
-      const char *pch;
-
-      pch = strchr (xdigits, ch);
-      if (pch != NULL)
-        {
-          val <<= 4;
-          val |= (pch - xdigits);
-          if (val > 0xffff)
-            return (0);
-          saw_xdigit = 1;
-          continue;
-        }
-      if (ch == ':')
-        {
-          curtok = src;
-          if (!saw_xdigit)
-            {
-              if (colonp)
-                return (0);
-              colonp = tp;
-              continue;
-            }
-          else if (*src == '\0')
-            {
-              return (0);
-            }
-          if (tp + NS_INT16SZ > endp)
-            return (0);
-          *tp++ = (u_char) (val >> 8) & 0xff;
-          *tp++ = (u_char) val & 0xff;
-          saw_xdigit = 0;
-          val = 0;
-          continue;
-        }
-      if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) &&
-          inet_pton4 (curtok, tp) > 0)
-        {
-          tp += NS_INADDRSZ;
-          saw_xdigit = 0;
-          break;                /* '\0' was seen by inet_pton4(). */
-        }
-      return (0);
-    }
-  if (saw_xdigit)
-    {
-      if (tp + NS_INT16SZ > endp)
-        return (0);
-      *tp++ = (u_char) (val >> 8) & 0xff;
-      *tp++ = (u_char) val & 0xff;
-    }
-  if (colonp != NULL)
-    {
-      /*
-       * Since some memmove()'s erroneously fail to handle
-       * overlapping regions, we'll do the shift by hand.
-       */
-      const int n = tp - colonp;
-      int i;
-
-      if (tp == endp)
-        return (0);
-      for (i = 1; i <= n; i++)
-        {
-          endp[-i] = colonp[n - i];
-          colonp[n - i] = 0;
-        }
-      tp = endp;
-    }
-  if (tp != endp)
-    return (0);
-  memcpy (dst, tmp, NS_IN6ADDRSZ);
-  return (1);
-}
-
-# endif
-
-#endif
diff --git a/gl/listen.c b/gl/listen.c
deleted file mode 100644 (file)
index 40660fc..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* listen.c --- wrappers for Windows listen function
-
-   Copyright (C) 2008-2014 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.1 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);
-
-  if (sock == INVALID_SOCKET)
-    {
-      errno = EBADF;
-      return -1;
-    }
-  else
-    {
-      int r = listen (sock, backlog);
-      if (r < 0)
-        set_winsock_errno ();
-
-      return r;
-    }
-}
diff --git a/gl/m4/close.m4 b/gl/m4/close.m4
deleted file mode 100644 (file)
index 68510c5..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-# close.m4 serial 8
-dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_CLOSE],
-[
-  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-  AC_REQUIRE([gl_MSVC_INVAL])
-  if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
-    REPLACE_CLOSE=1
-  fi
-  m4_ifdef([gl_PREREQ_SYS_H_WINSOCK2], [
-    gl_PREREQ_SYS_H_WINSOCK2
-    if test $UNISTD_H_HAVE_WINSOCK2_H = 1; then
-      dnl Even if the 'socket' module is not used here, another part of the
-      dnl application may use it and pass file descriptors that refer to
-      dnl sockets to the close() function. So enable the support for sockets.
-      REPLACE_CLOSE=1
-    fi
-  ])
-  dnl Replace close() for supporting the gnulib-defined fchdir() function,
-  dnl to keep fchdir's bookkeeping up-to-date.
-  m4_ifdef([gl_FUNC_FCHDIR], [
-    if test $REPLACE_CLOSE = 0; then
-      gl_TEST_FCHDIR
-      if test $HAVE_FCHDIR = 0; then
-        REPLACE_CLOSE=1
-      fi
-    fi
-  ])
-])
diff --git a/gl/m4/dup2.m4 b/gl/m4/dup2.m4
deleted file mode 100644 (file)
index 89638a0..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-#serial 20
-dnl Copyright (C) 2002, 2005, 2007, 2009-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_DUP2],
-[
-  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-  AC_REQUIRE([AC_CANONICAL_HOST])
-  m4_ifdef([gl_FUNC_DUP2_OBSOLETE], [
-    AC_CHECK_FUNCS_ONCE([dup2])
-    if test $ac_cv_func_dup2 = no; then
-      HAVE_DUP2=0
-    fi
-  ], [
-    AC_DEFINE([HAVE_DUP2], [1], [Define to 1 if you have the 'dup2' function.])
-  ])
-  if test $HAVE_DUP2 = 1; then
-    AC_CACHE_CHECK([whether dup2 works], [gl_cv_func_dup2_works],
-      [AC_RUN_IFELSE([
-         AC_LANG_PROGRAM([[#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>]],
-           [int result = 0;
-#ifdef FD_CLOEXEC
-            if (fcntl (1, F_SETFD, FD_CLOEXEC) == -1)
-              result |= 1;
-#endif
-            if (dup2 (1, 1) == 0)
-              result |= 2;
-#ifdef FD_CLOEXEC
-            if (fcntl (1, F_GETFD) != FD_CLOEXEC)
-              result |= 4;
-#endif
-            close (0);
-            if (dup2 (0, 0) != -1)
-              result |= 8;
-            /* Many gnulib modules require POSIX conformance of EBADF.  */
-            if (dup2 (2, 1000000) == -1 && errno != EBADF)
-              result |= 16;
-            /* Flush out some cygwin core dumps.  */
-            if (dup2 (2, -1) != -1 || errno != EBADF)
-              result |= 32;
-            dup2 (2, 255);
-            dup2 (2, 256);
-            return result;
-           ])
-        ],
-        [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no],
-        [case "$host_os" in
-           mingw*) # on this platform, dup2 always returns 0 for success
-             gl_cv_func_dup2_works="guessing no" ;;
-           cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0
-             gl_cv_func_dup2_works="guessing no" ;;
-           linux*) # On linux between 2008-07-27 and 2009-05-11, dup2 of a
-                   # closed fd may yield -EBADF instead of -1 / errno=EBADF.
-             gl_cv_func_dup2_works="guessing no" ;;
-           freebsd*) # on FreeBSD 6.1, dup2(1,1000000) gives EMFILE, not EBADF.
-             gl_cv_func_dup2_works="guessing no" ;;
-           haiku*) # on Haiku alpha 2, dup2(1, 1) resets FD_CLOEXEC.
-             gl_cv_func_dup2_works="guessing no" ;;
-           *) gl_cv_func_dup2_works="guessing yes" ;;
-         esac])
-      ])
-    case "$gl_cv_func_dup2_works" in
-      *yes) ;;
-      *)
-        REPLACE_DUP2=1
-        AC_CHECK_FUNCS([setdtablesize])
-        ;;
-    esac
-  fi
-  dnl Replace dup2() for supporting the gnulib-defined fchdir() function,
-  dnl to keep fchdir's bookkeeping up-to-date.
-  m4_ifdef([gl_FUNC_FCHDIR], [
-    gl_TEST_FCHDIR
-    if test $HAVE_FCHDIR = 0; then
-      if test $HAVE_DUP2 = 1; then
-        REPLACE_DUP2=1
-      fi
-    fi
-  ])
-])
-
-# Prerequisites of lib/dup2.c.
-AC_DEFUN([gl_PREREQ_DUP2], [])
diff --git a/gl/m4/ftruncate.m4 b/gl/m4/ftruncate.m4
deleted file mode 100644 (file)
index 29c76cc..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-# serial 20
-
-# See if we need to emulate a missing ftruncate function using chsize.
-
-# Copyright (C) 2000-2001, 2003-2007, 2009-2014 Free Software Foundation, Inc.
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_FTRUNCATE],
-[
-  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-  AC_CHECK_FUNCS_ONCE([ftruncate])
-  if test $ac_cv_func_ftruncate = yes; then
-    m4_ifdef([gl_LARGEFILE], [
-      AC_REQUIRE([AC_CANONICAL_HOST])
-      case "$host_os" in
-        mingw*)
-          dnl Native Windows, and Large File Support is requested.
-          dnl The MSVCRT _chsize() function only accepts a 32-bit file size,
-          dnl and the mingw64 ftruncate64() function is unreliable (it may
-          dnl delete the file, see
-          dnl <http://mingw-w64.sourcearchive.com/documentation/2.0-1/ftruncate64_8c_source.html>).
-          dnl Use gnulib's ftruncate() implementation instead.
-          REPLACE_FTRUNCATE=1
-          ;;
-      esac
-    ], [
-      :
-    ])
-  else
-    HAVE_FTRUNCATE=0
-  fi
-])
-
-# Prerequisites of lib/ftruncate.c.
-AC_DEFUN([gl_PREREQ_FTRUNCATE],
-[
-  AC_CHECK_FUNCS([chsize])
-])
diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4
deleted file mode 100644 (file)
index 2e66584..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-# getaddrinfo.m4 serial 30
-dnl Copyright (C) 2004-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_GETADDRINFO],
-[
-  AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
-  AC_REQUIRE([gl_HEADER_NETDB])dnl for HAVE_NETDB_H
-  AC_MSG_NOTICE([checking how to do getaddrinfo, freeaddrinfo and getnameinfo])
-  GETADDRINFO_LIB=
-  gai_saved_LIBS="$LIBS"
-
-  dnl Where is getaddrinfo()?
-  dnl - On Solaris, it is in libsocket.
-  dnl - On Haiku, it is in libnetwork.
-  dnl - On BeOS, it is in libnet.
-  dnl - On native Windows, it is in ws2_32.dll.
-  dnl - Otherwise it is in libc.
-  AC_SEARCH_LIBS([getaddrinfo], [socket network net],
-    [if test "$ac_cv_search_getaddrinfo" != "none required"; then
-       GETADDRINFO_LIB="$ac_cv_search_getaddrinfo"
-     fi])
-  LIBS="$gai_saved_LIBS $GETADDRINFO_LIB"
-
-  HAVE_GETADDRINFO=1
-  AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [
-    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
-#include <sys/types.h>
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#include <stddef.h>
-]], [[getaddrinfo("", "", NULL, NULL);]])],
-      [gl_cv_func_getaddrinfo=yes],
-      [gl_cv_func_getaddrinfo=no])])
-  if test $gl_cv_func_getaddrinfo = no; then
-    AC_CACHE_CHECK([for getaddrinfo in ws2tcpip.h and -lws2_32],
-                   gl_cv_w32_getaddrinfo, [
-      gl_cv_w32_getaddrinfo=no
-      am_save_LIBS="$LIBS"
-      LIBS="$LIBS -lws2_32"
-      AC_LINK_IFELSE([AC_LANG_PROGRAM([[
-#ifdef HAVE_WS2TCPIP_H
-#include <ws2tcpip.h>
-#endif
-#include <stddef.h>
-]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])], [gl_cv_w32_getaddrinfo=yes])
-      LIBS="$am_save_LIBS"
-    ])
-    if test "$gl_cv_w32_getaddrinfo" = "yes"; then
-      GETADDRINFO_LIB="-lws2_32"
-      LIBS="$gai_saved_LIBS $GETADDRINFO_LIB"
-    else
-      HAVE_GETADDRINFO=0
-    fi
-  fi
-
-  # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an
-  # inline function declared in ws2tcpip.h, so we need to get that
-  # header included somehow.
-  AC_CHECK_DECLS([gai_strerror], [], [], [[
-#include <sys/types.h>
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#ifdef HAVE_WS2TCPIP_H
-#include <ws2tcpip.h>
-#endif
-#include <stddef.h>
-]])
-  if test $ac_cv_have_decl_gai_strerror = yes; then
-    AC_CHECK_DECLS([gai_strerrorA], [], [], [[
-#include <sys/types.h>
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#ifdef HAVE_WS2TCPIP_H
-#include <ws2tcpip.h>
-#endif
-#include <stddef.h>
-]])
-    dnl check for correct signature
-    AC_CACHE_CHECK([for gai_strerror with POSIX signature],
-     [gl_cv_func_gai_strerror_posix_signature], [
-      AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
-#include <sys/types.h>
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#ifdef HAVE_WS2TCPIP_H
-#include <ws2tcpip.h>
-#endif
-#include <stddef.h>
-extern
-#ifdef __cplusplus
-"C"
-#endif
-const char *gai_strerror(int);]])],
-        [gl_cv_func_gai_strerror_posix_signature=yes],
-        [gl_cv_func_gai_strerror_posix_signature=no])])
-    if test $gl_cv_func_gai_strerror_posix_signature = no; then
-      REPLACE_GAI_STRERROR=1
-    fi
-  fi
-
-  LIBS="$gai_saved_LIBS"
-
-  gl_PREREQ_GETADDRINFO
-
-  AC_SUBST([GETADDRINFO_LIB])
-])
-
-# Prerequisites of lib/netdb.in.h and lib/getaddrinfo.c.
-AC_DEFUN([gl_PREREQ_GETADDRINFO], [
-  AC_REQUIRE([gl_NETDB_H_DEFAULTS])
-  AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
-  AC_REQUIRE([gl_HOSTENT]) dnl for HOSTENT_LIB
-  AC_REQUIRE([gl_SERVENT]) dnl for SERVENT_LIB
-  AC_REQUIRE([gl_FUNC_INET_NTOP]) dnl for INET_NTOP_LIB
-  AC_REQUIRE([AC_C_RESTRICT])
-  AC_REQUIRE([gl_SOCKET_FAMILIES])
-  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
-  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-
-  dnl Including sys/socket.h is wrong for Windows, but Windows does not
-  dnl have sa_len so the result is correct anyway.
-  AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [
-#include <sys/types.h>
-#include <sys/socket.h>
-])
-
-  AC_CHECK_HEADERS_ONCE([netinet/in.h])
-
-  AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, getnameinfo],,,[[
-  /* sys/types.h is not needed according to POSIX, but the
-     sys/socket.h in i386-unknown-freebsd4.10 and
-     powerpc-apple-darwin5.5 required it. */
-#include <sys/types.h>
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#ifdef HAVE_WS2TCPIP_H
-#include <ws2tcpip.h>
-#endif
-]])
-  if test $ac_cv_have_decl_getaddrinfo = no; then
-    HAVE_DECL_GETADDRINFO=0
-  fi
-  if test $ac_cv_have_decl_freeaddrinfo = no; then
-    HAVE_DECL_FREEADDRINFO=0
-  fi
-  if test $ac_cv_have_decl_gai_strerror = no; then
-    HAVE_DECL_GAI_STRERROR=0
-  fi
-  if test $ac_cv_have_decl_getnameinfo = no; then
-    HAVE_DECL_GETNAMEINFO=0
-  fi
-
-  AC_CHECK_TYPES([struct addrinfo],,,[
-#include <sys/types.h>
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#ifdef HAVE_WS2TCPIP_H
-#include <ws2tcpip.h>
-#endif
-])
-  if test $ac_cv_type_struct_addrinfo = no; then
-    HAVE_STRUCT_ADDRINFO=0
-  fi
-
-  dnl Append $HOSTENT_LIB to GETADDRINFO_LIB, avoiding gratuitous duplicates.
-  case " $GETADDRINFO_LIB " in
-    *" $HOSTENT_LIB "*) ;;
-    *) GETADDRINFO_LIB="$GETADDRINFO_LIB $HOSTENT_LIB" ;;
-  esac
-
-  dnl Append $SERVENT_LIB to GETADDRINFO_LIB, avoiding gratuitous duplicates.
-  case " $GETADDRINFO_LIB " in
-    *" $SERVENT_LIB "*) ;;
-    *) GETADDRINFO_LIB="$GETADDRINFO_LIB $SERVENT_LIB" ;;
-  esac
-
-  dnl Append $INET_NTOP_LIB to GETADDRINFO_LIB, avoiding gratuitous duplicates.
-  case " $GETADDRINFO_LIB " in
-    *" $INET_NTOP_LIB "*) ;;
-    *) GETADDRINFO_LIB="$GETADDRINFO_LIB $INET_NTOP_LIB" ;;
-  esac
-])
diff --git a/gl/m4/getcwd.m4 b/gl/m4/getcwd.m4
deleted file mode 100644 (file)
index fc986cd..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-# getcwd.m4 - check for working getcwd that is compatible with glibc
-
-# Copyright (C) 2001, 2003-2007, 2009-2014 Free Software Foundation, Inc.
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# Written by Paul Eggert.
-# serial 12
-
-AC_DEFUN([gl_FUNC_GETCWD_NULL],
-  [
-   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
-   AC_CHECK_HEADERS_ONCE([unistd.h])
-   AC_CACHE_CHECK([whether getcwd (NULL, 0) allocates memory for result],
-     [gl_cv_func_getcwd_null],
-     [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-#        if HAVE_UNISTD_H
-#         include <unistd.h>
-#        else /* on Windows with MSVC */
-#         include <direct.h>
-#        endif
-#        ifndef getcwd
-         char *getcwd ();
-#        endif
-]], [[
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* mingw cwd does not start with '/', but getcwd does allocate.
-   However, mingw fails to honor non-zero size.  */
-#else
-           if (chdir ("/") != 0)
-             return 1;
-           else
-             {
-               char *f = getcwd (NULL, 0);
-               if (! f)
-                 return 2;
-               if (f[0] != '/')
-                 return 3;
-               if (f[1] != '\0')
-                 return 4;
-               return 0;
-             }
-#endif
-         ]])],
-        [gl_cv_func_getcwd_null=yes],
-        [gl_cv_func_getcwd_null=no],
-        [[case "$host_os" in
-                     # Guess yes on glibc systems.
-            *-gnu*)  gl_cv_func_getcwd_null="guessing yes";;
-                     # Guess yes on Cygwin.
-            cygwin*) gl_cv_func_getcwd_null="guessing yes";;
-                     # If we don't know, assume the worst.
-            *)       gl_cv_func_getcwd_null="guessing no";;
-          esac
-        ]])])
-])
-
-AC_DEFUN([gl_FUNC_GETCWD_SIGNATURE],
-[
-  AC_CACHE_CHECK([for getcwd with POSIX signature],
-    [gl_cv_func_getcwd_posix_signature],
-    [AC_COMPILE_IFELSE(
-      [AC_LANG_PROGRAM(
-         [[#include <unistd.h>]],
-         [[extern
-           #ifdef __cplusplus
-           "C"
-           #endif
-           char *getcwd (char *, size_t);
-         ]])
-      ],
-      [gl_cv_func_getcwd_posix_signature=yes],
-      [gl_cv_func_getcwd_posix_signature=no])
-   ])
-])
-
-dnl Guarantee that getcwd will malloc with a NULL first argument.  Assumes
-dnl that either the system getcwd is robust, or that calling code is okay
-dnl with spurious failures when run from a directory with an absolute name
-dnl larger than 4k bytes.
-dnl
-dnl Assumes that getcwd exists; if you are worried about obsolete
-dnl platforms that lacked getcwd(), then you need to use the GPL module.
-AC_DEFUN([gl_FUNC_GETCWD_LGPL],
-[
-  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-  AC_REQUIRE([gl_FUNC_GETCWD_NULL])
-  AC_REQUIRE([gl_FUNC_GETCWD_SIGNATURE])
-
-  case $gl_cv_func_getcwd_null,$gl_cv_func_getcwd_posix_signature in
-  *yes,yes) ;;
-  *)
-    dnl Minimal replacement lib/getcwd-lgpl.c.
-    REPLACE_GETCWD=1
-    ;;
-  esac
-])
-
-dnl Check for all known getcwd bugs; useful for a program likely to be
-dnl executed from an arbitrary location.
-AC_DEFUN([gl_FUNC_GETCWD],
-[
-  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-  AC_REQUIRE([gl_FUNC_GETCWD_NULL])
-  AC_REQUIRE([gl_FUNC_GETCWD_SIGNATURE])
-  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
-
-  gl_abort_bug=no
-  case "$host_os" in
-    mingw*)
-      gl_cv_func_getcwd_path_max=yes
-      ;;
-    *)
-      gl_FUNC_GETCWD_PATH_MAX
-      case "$gl_cv_func_getcwd_null" in
-        *yes)
-          gl_FUNC_GETCWD_ABORT_BUG([gl_abort_bug=yes])
-          ;;
-      esac
-      ;;
-  esac
-  dnl Define HAVE_MINIMALLY_WORKING_GETCWD and HAVE_PARTLY_WORKING_GETCWD
-  dnl if appropriate.
-  case "$gl_cv_func_getcwd_path_max" in
-    "no"|"no, it has the AIX bug") ;;
-    *)
-      AC_DEFINE([HAVE_MINIMALLY_WORKING_GETCWD], [1],
-        [Define to 1 if getcwd minimally works, that is, its result can be
-         trusted when it succeeds.])
-      ;;
-  esac
-  case "$gl_cv_func_getcwd_path_max" in
-    "no, but it is partly working")
-      AC_DEFINE([HAVE_PARTLY_WORKING_GETCWD], [1],
-        [Define to 1 if getcwd works, except it sometimes fails when it
-         shouldn't, setting errno to ERANGE, ENAMETOOLONG, or ENOENT.])
-      ;;
-  esac
-
-  if { case "$gl_cv_func_getcwd_null" in *yes) false;; *) true;; esac; } \
-     || test $gl_cv_func_getcwd_posix_signature != yes \
-     || test "$gl_cv_func_getcwd_path_max" != yes \
-     || test $gl_abort_bug = yes; then
-    REPLACE_GETCWD=1
-  fi
-])
-
-# Prerequisites of lib/getcwd.c, when full replacement is in effect.
-AC_DEFUN([gl_PREREQ_GETCWD],
-[
-  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-  AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO])
-  :
-])
diff --git a/gl/m4/getdtablesize.m4 b/gl/m4/getdtablesize.m4
deleted file mode 100644 (file)
index aa523b6..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-# getdtablesize.m4 serial 5
-dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_GETDTABLESIZE],
-[
-  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-  AC_REQUIRE([AC_CANONICAL_HOST])
-  AC_CHECK_FUNCS_ONCE([getdtablesize])
-  if test $ac_cv_func_getdtablesize = yes; then
-    # Cygwin 1.7.25 automatically increases the RLIMIT_NOFILE soft limit
-    # up to an unchangeable hard limit; all other platforms correctly
-    # require setrlimit before getdtablesize() can report a larger value.
-    AC_CACHE_CHECK([whether getdtablesize works],
-      [gl_cv_func_getdtablesize_works],
-      [AC_RUN_IFELSE([
-        AC_LANG_PROGRAM([[#include <unistd.h>]],
-          [int size = getdtablesize();
-           if (dup2 (0, getdtablesize()) != -1)
-             return 1;
-           if (size != getdtablesize())
-             return 2;
-          ])],
-        [gl_cv_func_getdtablesize_works=yes],
-        [gl_cv_func_getdtablesize_works=no],
-        [case "$host_os" in
-          cygwin*) # on cygwin 1.5.25, getdtablesize() automatically grows
-            gl_cv_func_getdtablesize_works="guessing no" ;;
-          *) gl_cv_func_getdtablesize_works="guessing yes" ;;
-         esac])
-      ])
-    case "$gl_cv_func_getdtablesize_works" in
-      *yes) ;;
-      *) REPLACE_GETDTABLESIZE=1 ;;
-    esac
-  else
-    HAVE_GETDTABLESIZE=0
-  fi
-])
-
-# Prerequisites of lib/getdtablesize.c.
-AC_DEFUN([gl_PREREQ_GETDTABLESIZE], [:])
index 1f55d540ca7369ee903def4d860a51d3e11555fd..2ac68e5d1f541f993054f17c04cb294b2e3bdda9 100644 (file)
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alloca base64 bind byteswap c-ctype close connect extensions func gendocs getaddrinfo getpass gettext gettimeofday hash-pjw-bare havelib iconv inet_ntop inet_pton intprops lib-msvc-compat lib-symbol-versions listen maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file recv recvfrom select send sendto servent setsockopt shutdown snprintf socket sockets socklen stdint strcase strerror strndup strtok_r strverscmp sys_socket sys_stat time_r u64 unistd valgrind-tests vasprintf vsnprintf warnings
+#   gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files alloca base64 bind byteswap c-ctype connect extensions func gendocs getpass gettext gettimeofday hash-pjw-bare havelib iconv intprops lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file snprintf stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r u64 unistd valgrind-tests vasprintf vsnprintf warnings
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([gl/override])
 gl_MODULES([
-  accept
   alloca
   base64
   bind
   byteswap
   c-ctype
-  close
   connect
   extensions
   func
   gendocs
-  getaddrinfo
   getpass
   gettext
   gettimeofday
   hash-pjw-bare
   havelib
   iconv
-  inet_ntop
-  inet_pton
   intprops
   lib-msvc-compat
   lib-symbol-versions
-  listen
   maintainer-makefile
   manywarnings
   memmem-simple
@@ -64,21 +58,9 @@ gl_MODULES([
   netinet_in
   pmccabe2html
   read-file
-  recv
-  recvfrom
-  select
-  send
-  sendto
-  servent
-  setsockopt
-  shutdown
   snprintf
-  socket
-  sockets
-  socklen
   stdint
   strcase
-  strerror
   strndup
   strtok_r
   strverscmp
index a3182204eef5cbfe087d6b39f0074c1aa1080228..8c7dbab045b8df128fd5db462e3e50eec946ce14 100644 (file)
@@ -39,8 +39,6 @@ AC_DEFUN([gl_EARLY],
   m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
   AC_REQUIRE([gl_PROG_AR_RANLIB])
   # Code from module absolute-header:
-  # Code from module accept:
-  # Code from module accept-tests:
   # Code from module alloca:
   # Code from module alloca-opt:
   # Code from module alloca-opt-tests:
@@ -56,13 +54,8 @@ AC_DEFUN([gl_EARLY],
   # Code from module byteswap-tests:
   # Code from module c-ctype:
   # Code from module c-ctype-tests:
-  # Code from module close:
-  # Code from module close-tests:
   # Code from module connect:
   # Code from module connect-tests:
-  # Code from module dosname:
-  # Code from module dup2:
-  # Code from module dup2-tests:
   # Code from module errno:
   # Code from module errno-tests:
   # Code from module extensions:
@@ -93,26 +86,16 @@ AC_DEFUN([gl_EARLY],
   # Code from module ftello:
   AC_REQUIRE([AC_FUNC_FSEEKO])
   # Code from module ftello-tests:
-  # Code from module ftruncate:
-  # Code from module ftruncate-tests:
   # Code from module func:
   # Code from module func-tests:
   # Code from module fwrite-tests:
   # Code from module gendocs:
-  # Code from module getaddrinfo:
-  # Code from module getaddrinfo-tests:
-  # Code from module getcwd-lgpl:
-  # Code from module getcwd-lgpl-tests:
   # Code from module getdelim:
   # Code from module getdelim-tests:
-  # Code from module getdtablesize:
-  # Code from module getdtablesize-tests:
   # Code from module getline:
   # Code from module getline-tests:
   # Code from module getpagesize:
   # Code from module getpass:
-  # Code from module getpeername:
-  # Code from module getpeername-tests:
   # Code from module gettext:
   # Code from module gettext-h:
   # Code from module gettimeofday:
@@ -120,14 +103,9 @@ AC_DEFUN([gl_EARLY],
   # Code from module gnumakefile:
   # Code from module hash-pjw-bare:
   # Code from module havelib:
-  # Code from module hostent:
   # Code from module iconv:
   # Code from module iconv-tests:
-  # Code from module ignore-value:
-  # Code from module ignore-value-tests:
   # Code from module include_next:
-  # Code from module inet_ntop:
-  # Code from module inet_ntop-tests:
   # Code from module inet_pton:
   # Code from module inet_pton-tests:
   # Code from module intprops:
@@ -135,18 +113,11 @@ AC_DEFUN([gl_EARLY],
   # Code from module inttypes:
   # Code from module inttypes-incomplete:
   # Code from module inttypes-tests:
-  # Code from module ioctl:
-  # Code from module ioctl-tests:
   # Code from module largefile:
   AC_REQUIRE([AC_SYS_LARGEFILE])
   # Code from module lib-msvc-compat:
   # Code from module lib-symbol-versions:
-  # Code from module listen:
-  # Code from module listen-tests:
-  # Code from module lock:
   # Code from module lseek:
-  # Code from module lstat:
-  # Code from module lstat-tests:
   # Code from module maintainer-makefile:
   # Code from module malloc-posix:
   # Code from module manywarnings:
@@ -161,36 +132,10 @@ AC_DEFUN([gl_EARLY],
   # Code from module netdb-tests:
   # Code from module netinet_in:
   # Code from module netinet_in-tests:
-  # Code from module open:
-  # Code from module open-tests:
-  # Code from module pathmax:
-  # Code from module pathmax-tests:
-  # Code from module perror:
-  # Code from module perror-tests:
-  # Code from module pipe-posix:
-  # Code from module pipe-posix-tests:
   # Code from module pmccabe2html:
   # Code from module read-file:
   # Code from module read-file-tests:
   # Code from module realloc-posix:
-  # Code from module recv:
-  # Code from module recv-tests:
-  # Code from module recvfrom:
-  # Code from module recvfrom-tests:
-  # Code from module same-inode:
-  # Code from module select:
-  # Code from module select-tests:
-  # Code from module send:
-  # Code from module send-tests:
-  # Code from module sendto:
-  # Code from module sendto-tests:
-  # Code from module servent:
-  # Code from module setsockopt:
-  # Code from module setsockopt-tests:
-  # Code from module shutdown:
-  # Code from module shutdown-tests:
-  # Code from module signal-h:
-  # Code from module signal-h-tests:
   # Code from module size_max:
   # Code from module snippet/_Noreturn:
   # Code from module snippet/arg-nonnull:
@@ -198,14 +143,11 @@ AC_DEFUN([gl_EARLY],
   # Code from module snippet/warn-on-use:
   # Code from module snprintf:
   # Code from module snprintf-tests:
-  # Code from module socket:
   # Code from module socketlib:
   # Code from module sockets:
   # Code from module sockets-tests:
   # Code from module socklen:
   # Code from module ssize_t:
-  # Code from module stat:
-  # Code from module stat-tests:
   # Code from module stdalign:
   # Code from module stdalign-tests:
   # Code from module stdbool:
@@ -220,11 +162,6 @@ AC_DEFUN([gl_EARLY],
   # Code from module stdlib-tests:
   # Code from module strcase:
   # Code from module strdup-posix:
-  # Code from module strerror:
-  # Code from module strerror-override:
-  # Code from module strerror-tests:
-  # Code from module strerror_r-posix:
-  # Code from module strerror_r-posix-tests:
   # Code from module string:
   # Code from module string-tests:
   # Code from module strings:
@@ -235,12 +172,6 @@ AC_DEFUN([gl_EARLY],
   # Code from module strtok_r:
   # Code from module strverscmp:
   # Code from module strverscmp-tests:
-  # Code from module symlink:
-  # Code from module symlink-tests:
-  # Code from module sys_ioctl:
-  # Code from module sys_ioctl-tests:
-  # Code from module sys_select:
-  # Code from module sys_select-tests:
   # Code from module sys_socket:
   # Code from module sys_socket-tests:
   # Code from module sys_stat:
@@ -253,8 +184,6 @@ AC_DEFUN([gl_EARLY],
   # Code from module sys_uio-tests:
   # Code from module test-framework-sh:
   # Code from module test-framework-sh-tests:
-  # Code from module threadlib:
-  gl_THREADLIB_EARLY
   # Code from module time:
   # Code from module time-tests:
   # Code from module time_r:
@@ -294,18 +223,11 @@ AC_DEFUN([gl_INIT],
   m4_pushdef([gl_LIBSOURCES_DIR], [])
   gl_COMMON
   gl_source_base='gl'
-  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
-  if test "$ac_cv_header_winsock2_h" = yes; then
-    AC_LIBOBJ([accept])
-  fi
-  gl_SYS_SOCKET_MODULE_INDICATOR([accept])
 changequote(,)dnl
 LTALLOCA=`echo "$ALLOCA" | sed -e 's/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'`
 changequote([, ])dnl
 AC_SUBST([LTALLOCA])
   gl_FUNC_ALLOCA
-  gl_HEADER_ARPA_INET
-  AC_PROG_MKDIR_P
   gl_FUNC_BASE64
   AC_REQUIRE([gl_HEADER_SYS_SOCKET])
   if test "$ac_cv_header_winsock2_h" = yes; then
@@ -313,22 +235,11 @@ AC_SUBST([LTALLOCA])
   fi
   gl_SYS_SOCKET_MODULE_INDICATOR([bind])
   gl_BYTESWAP
-  gl_FUNC_CLOSE
-  if test $REPLACE_CLOSE = 1; then
-    AC_LIBOBJ([close])
-  fi
-  gl_UNISTD_MODULE_INDICATOR([close])
   AC_REQUIRE([gl_HEADER_SYS_SOCKET])
   if test "$ac_cv_header_winsock2_h" = yes; then
     AC_LIBOBJ([connect])
   fi
   gl_SYS_SOCKET_MODULE_INDICATOR([connect])
-  gl_FUNC_DUP2
-  if test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1; then
-    AC_LIBOBJ([dup2])
-    gl_PREREQ_DUP2
-  fi
-  gl_UNISTD_MODULE_INDICATOR([dup2])
   gl_HEADER_ERRNO_H
   AC_REQUIRE([gl_EXTERN_INLINE])
   gl_FLOAT_H
@@ -367,14 +278,6 @@ AC_SUBST([LTALLOCA])
   fi
   gl_STDIO_MODULE_INDICATOR([ftello])
   gl_FUNC
-  gl_GETADDRINFO
-  if test $HAVE_GETADDRINFO = 0; then
-    AC_LIBOBJ([getaddrinfo])
-  fi
-  if test $HAVE_DECL_GAI_STRERROR = 0 || test $REPLACE_GAI_STRERROR = 1; then
-    AC_LIBOBJ([gai_strerror])
-  fi
-  gl_NETDB_MODULE_INDICATOR([getaddrinfo])
   gl_FUNC_GETDELIM
   if test $HAVE_GETDELIM = 0 || test $REPLACE_GETDELIM = 1; then
     AC_LIBOBJ([getdelim])
@@ -392,11 +295,6 @@ AC_SUBST([LTALLOCA])
     AC_LIBOBJ([getpass])
     gl_PREREQ_GETPASS
   fi
-  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
-  if test "$ac_cv_header_winsock2_h" = yes; then
-    AC_LIBOBJ([getpeername])
-  fi
-  gl_SYS_SOCKET_MODULE_INDICATOR([getpeername])
   dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac.
   AM_GNU_GETTEXT_VERSION([0.18.1])
   AC_SUBST([LIBINTL])
@@ -417,30 +315,12 @@ AC_SUBST([LTALLOCA])
           m4_defn([m4_PACKAGE_VERSION])), [1], [],
         [AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
           [GNUmakefile=$GNUmakefile])])
-  gl_HOSTENT
   AM_ICONV
   m4_ifdef([gl_ICONV_MODULE_INDICATOR],
     [gl_ICONV_MODULE_INDICATOR([iconv])])
-  gl_FUNC_INET_NTOP
-  if test $HAVE_INET_NTOP = 0 || test $REPLACE_INET_NTOP = 1; then
-    AC_LIBOBJ([inet_ntop])
-    gl_PREREQ_INET_NTOP
-  fi
-  gl_ARPA_INET_MODULE_INDICATOR([inet_ntop])
-  gl_FUNC_INET_PTON
-  if test $HAVE_INET_PTON = 0 || test $REPLACE_INET_NTOP = 1; then
-    AC_LIBOBJ([inet_pton])
-    gl_PREREQ_INET_PTON
-  fi
-  gl_ARPA_INET_MODULE_INDICATOR([inet_pton])
   AC_REQUIRE([gl_LARGEFILE])
   gl_LD_OUTPUT_DEF
   gl_LD_VERSION_SCRIPT
-  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
-  if test "$ac_cv_header_winsock2_h" = yes; then
-    AC_LIBOBJ([listen])
-  fi
-  gl_SYS_SOCKET_MODULE_INDICATOR([listen])
   gl_FUNC_LSEEK
   if test $REPLACE_LSEEK = 1; then
     AC_LIBOBJ([lseek])
@@ -485,63 +365,11 @@ AC_SUBST([LTALLOCA])
     AC_LIBOBJ([realloc])
   fi
   gl_STDLIB_MODULE_INDICATOR([realloc-posix])
-  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
-  if test "$ac_cv_header_winsock2_h" = yes; then
-    AC_LIBOBJ([recv])
-  fi
-  gl_SYS_SOCKET_MODULE_INDICATOR([recv])
-  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
-  if test "$ac_cv_header_winsock2_h" = yes; then
-    AC_LIBOBJ([recvfrom])
-  fi
-  gl_SYS_SOCKET_MODULE_INDICATOR([recvfrom])
-  gl_FUNC_SELECT
-  if test $REPLACE_SELECT = 1; then
-    AC_LIBOBJ([select])
-  fi
-  gl_SYS_SELECT_MODULE_INDICATOR([select])
-  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
-  if test "$ac_cv_header_winsock2_h" = yes; then
-    AC_LIBOBJ([send])
-  fi
-  gl_SYS_SOCKET_MODULE_INDICATOR([send])
-  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
-  if test "$ac_cv_header_winsock2_h" = yes; then
-    AC_LIBOBJ([sendto])
-  fi
-  gl_SYS_SOCKET_MODULE_INDICATOR([sendto])
-  gl_SERVENT
-  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
-  if test "$ac_cv_header_winsock2_h" = yes; then
-    AC_LIBOBJ([setsockopt])
-  fi
-  gl_SYS_SOCKET_MODULE_INDICATOR([setsockopt])
-  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
-  if test "$ac_cv_header_winsock2_h" = yes; then
-    AC_LIBOBJ([shutdown])
-  fi
-  gl_SYS_SOCKET_MODULE_INDICATOR([shutdown])
-  gl_SIGNAL_H
   gl_SIZE_MAX
   gl_FUNC_SNPRINTF
   gl_STDIO_MODULE_INDICATOR([snprintf])
   gl_MODULE_INDICATOR([snprintf])
-  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
-  if test "$ac_cv_header_winsock2_h" = yes; then
-    AC_LIBOBJ([socket])
-  fi
-  # When this module is used, sockets may actually occur as file descriptors,
-  # hence it is worth warning if the modules 'close' and 'ioctl' are not used.
-  m4_ifdef([gl_UNISTD_H_DEFAULTS], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])])
-  m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])])
-  AC_REQUIRE([gl_PREREQ_SYS_H_WINSOCK2])
-  if test "$ac_cv_header_winsock2_h" = yes; then
-    UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1
-    SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1
-  fi
-  gl_SYS_SOCKET_MODULE_INDICATOR([socket])
   gl_SOCKETLIB
-  gl_SOCKETS
   gl_TYPE_SOCKLEN_T
   gt_TYPE_SSIZE_T
   gl_STDALIGN_H
@@ -565,18 +393,6 @@ AC_SUBST([LTALLOCA])
     gl_PREREQ_STRDUP
   fi
   gl_STRING_MODULE_INDICATOR([strdup])
-  gl_FUNC_STRERROR
-  if test $REPLACE_STRERROR = 1; then
-    AC_LIBOBJ([strerror])
-  fi
-  gl_MODULE_INDICATOR([strerror])
-  gl_STRING_MODULE_INDICATOR([strerror])
-  AC_REQUIRE([gl_HEADER_ERRNO_H])
-  AC_REQUIRE([gl_FUNC_STRERROR_0])
-  if test -n "$ERRNO_H" || test $REPLACE_STRERROR_0 = 1; then
-    AC_LIBOBJ([strerror-override])
-    gl_PREREQ_SYS_H_WINSOCK2
-  fi
   gl_HEADER_STRING_H
   gl_HEADER_STRINGS_H
   gl_FUNC_STRNDUP
@@ -602,8 +418,6 @@ AC_SUBST([LTALLOCA])
     gl_PREREQ_STRVERSCMP
   fi
   gl_STRING_MODULE_INDICATOR([strverscmp])
-  gl_HEADER_SYS_SELECT
-  AC_PROG_MKDIR_P
   gl_HEADER_SYS_SOCKET
   AC_PROG_MKDIR_P
   gl_HEADER_SYS_STAT_H
@@ -679,6 +493,8 @@ changequote([, ])dnl
   AC_SUBST([gltests_WITNESS])
   gl_module_indicator_condition=$gltests_WITNESS
   m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$gl_module_indicator_condition])
+  gl_HEADER_ARPA_INET
+  AC_PROG_MKDIR_P
   gl_FCNTL_H
   gl_FUNC_FDOPEN
   if test $REPLACE_FDOPEN = 1; then
@@ -690,94 +506,32 @@ changequote([, ])dnl
   gl_FUNC_UNGETC_WORKS
   gl_FUNC_UNGETC_WORKS
   gl_FUNC_UNGETC_WORKS
-  gl_FUNC_FTRUNCATE
-  if test $HAVE_FTRUNCATE = 0 || test $REPLACE_FTRUNCATE = 1; then
-    AC_LIBOBJ([ftruncate])
-    gl_PREREQ_FTRUNCATE
-  fi
-  gl_UNISTD_MODULE_INDICATOR([ftruncate])
-  gl_FUNC_GETCWD_LGPL
-  if test $REPLACE_GETCWD = 1; then
-    AC_LIBOBJ([getcwd-lgpl])
-  fi
-  gl_UNISTD_MODULE_INDICATOR([getcwd])
-  gl_FUNC_GETDTABLESIZE
-  if test $HAVE_GETDTABLESIZE = 0 || test $REPLACE_GETDTABLESIZE = 1; then
-    AC_LIBOBJ([getdtablesize])
-    gl_PREREQ_GETDTABLESIZE
-  fi
-  gl_UNISTD_MODULE_INDICATOR([getdtablesize])
   gl_FUNC_GETPAGESIZE
   if test $REPLACE_GETPAGESIZE = 1; then
     AC_LIBOBJ([getpagesize])
   fi
   gl_UNISTD_MODULE_INDICATOR([getpagesize])
-  AC_C_BIGENDIAN
+  gl_FUNC_INET_PTON
+  if test $HAVE_INET_PTON = 0 || test $REPLACE_INET_NTOP = 1; then
+    AC_LIBOBJ([inet_pton])
+    gl_PREREQ_INET_PTON
+  fi
+  gl_ARPA_INET_MODULE_INDICATOR([inet_pton])
   AC_C_BIGENDIAN
   gl_INTTYPES_H
   gl_INTTYPES_INCOMPLETE
-  gl_FUNC_IOCTL
-  if test $HAVE_IOCTL = 0 || test $REPLACE_IOCTL = 1; then
-    AC_LIBOBJ([ioctl])
-  fi
-  gl_SYS_IOCTL_MODULE_INDICATOR([ioctl])
-  gl_LOCK
-  gl_MODULE_INDICATOR([lock])
-  gl_FUNC_LSTAT
-  if test $REPLACE_LSTAT = 1; then
-    AC_LIBOBJ([lstat])
-    gl_PREREQ_LSTAT
-  fi
-  gl_SYS_STAT_MODULE_INDICATOR([lstat])
   dnl Check for prerequisites for memory fence checks.
   gl_FUNC_MMAP_ANON
   AC_CHECK_HEADERS_ONCE([sys/mman.h])
   AC_CHECK_FUNCS_ONCE([mprotect])
-  gl_FUNC_OPEN
-  if test $REPLACE_OPEN = 1; then
-    AC_LIBOBJ([open])
-    gl_PREREQ_OPEN
-  fi
-  gl_FCNTL_MODULE_INDICATOR([open])
-  gl_PATHMAX
-  gl_FUNC_PERROR
-  if test $REPLACE_PERROR = 1; then
-    AC_LIBOBJ([perror])
-  fi
-  gl_STRING_MODULE_INDICATOR([perror])
-  gl_FUNC_PIPE
-  if test $HAVE_PIPE = 0; then
-    AC_LIBOBJ([pipe])
-  fi
-  gl_UNISTD_MODULE_INDICATOR([pipe])
-  AC_CHECK_HEADERS_ONCE([sys/wait.h])
-  gl_FUNC_STAT
-  if test $REPLACE_STAT = 1; then
-    AC_LIBOBJ([stat])
-    gl_PREREQ_STAT
-  fi
-  gl_SYS_STAT_MODULE_INDICATOR([stat])
+  gl_SOCKETS
   AC_REQUIRE([gt_TYPE_WCHAR_T])
   AC_REQUIRE([gt_TYPE_WINT_T])
-  gl_FUNC_STRERROR_R
-  if test $HAVE_DECL_STRERROR_R = 0 || test $REPLACE_STRERROR_R = 1; then
-    AC_LIBOBJ([strerror_r])
-    gl_PREREQ_STRERROR_R
-  fi
-  gl_STRING_MODULE_INDICATOR([strerror_r])
   dnl Check for prerequisites for memory fence checks.
   gl_FUNC_MMAP_ANON
   AC_CHECK_HEADERS_ONCE([sys/mman.h])
   AC_CHECK_FUNCS_ONCE([mprotect])
-  gl_FUNC_SYMLINK
-  if test $HAVE_SYMLINK = 0 || test $REPLACE_SYMLINK = 1; then
-    AC_LIBOBJ([symlink])
-  fi
-  gl_UNISTD_MODULE_INDICATOR([symlink])
-  gl_SYS_IOCTL_H
-  AC_PROG_MKDIR_P
   AC_CHECK_FUNCS_ONCE([shutdown])
-  gl_THREADLIB
   gl_VALGRIND_TESTS
   abs_aux_dir=`cd "$ac_aux_dir"; pwd`
   AC_SUBST([abs_aux_dir])
@@ -884,10 +638,8 @@ AC_DEFUN([gl_FILE_LIST], [
   build-aux/useless-if-before-free
   build-aux/vc-list-files
   doc/gendocs_template
-  lib/accept.c
   lib/alloca.c
   lib/alloca.in.h
-  lib/arpa_inet.in.h
   lib/asnprintf.c
   lib/asprintf.c
   lib/base64.c
@@ -896,12 +648,8 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/byteswap.in.h
   lib/c-ctype.c
   lib/c-ctype.h
-  lib/close.c
   lib/connect.c
-  lib/dup2.c
   lib/errno.in.h
-  lib/fd-hook.c
-  lib/fd-hook.h
   lib/float+.h
   lib/float.c
   lib/float.in.h
@@ -910,22 +658,16 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/fstat.c
   lib/ftell.c
   lib/ftello.c
-  lib/gai_strerror.c
-  lib/getaddrinfo.c
   lib/getdelim.c
   lib/getline.c
   lib/getpass.c
   lib/getpass.h
-  lib/getpeername.c
   lib/gettext.h
   lib/gettimeofday.c
   lib/hash-pjw-bare.c
   lib/hash-pjw-bare.h
-  lib/inet_ntop.c
-  lib/inet_pton.c
   lib/intprops.h
   lib/itold.c
-  lib/listen.c
   lib/lseek.c
   lib/malloc.c
   lib/memchr.c
@@ -945,19 +687,8 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/read-file.c
   lib/read-file.h
   lib/realloc.c
-  lib/recv.c
-  lib/recvfrom.c
-  lib/select.c
-  lib/send.c
-  lib/sendto.c
-  lib/setsockopt.c
-  lib/shutdown.c
-  lib/signal.in.h
   lib/size_max.h
   lib/snprintf.c
-  lib/socket.c
-  lib/sockets.c
-  lib/sockets.h
   lib/stdalign.in.h
   lib/stdbool.in.h
   lib/stddef.in.h
@@ -968,9 +699,6 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/str-two-way.h
   lib/strcasecmp.c
   lib/strdup.c
-  lib/strerror-override.c
-  lib/strerror-override.h
-  lib/strerror.c
   lib/string.in.h
   lib/strings.in.h
   lib/strncasecmp.c
@@ -978,7 +706,6 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/strnlen.c
   lib/strtok_r.c
   lib/strverscmp.c
-  lib/sys_select.in.h
   lib/sys_socket.c
   lib/sys_socket.in.h
   lib/sys_stat.in.h
@@ -1006,9 +733,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/arpa_inet_h.m4
   m4/base64.m4
   m4/byteswap.m4
-  m4/close.m4
   m4/codeset.m4
-  m4/dup2.m4
   m4/errno_h.m4
   m4/exponentd.m4
   m4/extensions.m4
@@ -1023,12 +748,8 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/fstat.m4
   m4/ftell.m4
   m4/ftello.m4
-  m4/ftruncate.m4
   m4/func.m4
-  m4/getaddrinfo.m4
-  m4/getcwd.m4
   m4/getdelim.m4
-  m4/getdtablesize.m4
   m4/getline.m4
   m4/getpagesize.m4
   m4/getpass.m4
@@ -1037,10 +758,8 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/glibc2.m4
   m4/glibc21.m4
   m4/gnulib-common.m4
-  m4/hostent.m4
   m4/iconv.m4
   m4/include_next.m4
-  m4/inet_ntop.m4
   m4/inet_pton.m4
   m4/intdiv0.m4
   m4/intl.m4
@@ -1051,7 +770,6 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/inttypes-pri.m4
   m4/inttypes.m4
   m4/inttypes_h.m4
-  m4/ioctl.m4
   m4/largefile.m4
   m4/lcmessage.m4
   m4/ld-output-def.m4
@@ -1062,7 +780,6 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/lock.m4
   m4/longlong.m4
   m4/lseek.m4
-  m4/lstat.m4
   m4/malloc.m4
   m4/manywarnings.m4
   m4/math_h.m4
@@ -1070,7 +787,6 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/memmem.m4
   m4/minmax.m4
   m4/mmap-anon.m4
-  m4/mode_t.m4
   m4/msvc-inval.m4
   m4/msvc-nothrow.m4
   m4/multiarch.m4
@@ -1078,19 +794,12 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/netinet_in_h.m4
   m4/nls.m4
   m4/off_t.m4
-  m4/open.m4
-  m4/pathmax.m4
-  m4/perror.m4
-  m4/pipe.m4
   m4/po.m4
   m4/printf-posix.m4
   m4/printf.m4
   m4/progtest.m4
   m4/read-file.m4
   m4/realloc.m4
-  m4/select.m4
-  m4/servent.m4
-  m4/signal_h.m4
   m4/size_max.m4
   m4/snprintf.m4
   m4/socketlib.m4
@@ -1098,7 +807,6 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/socklen.m4
   m4/sockpfaf.m4
   m4/ssize_t.m4
-  m4/stat.m4
   m4/stdalign.m4
   m4/stdbool.m4
   m4/stddef_h.m4
@@ -1108,17 +816,12 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/stdlib_h.m4
   m4/strcase.m4
   m4/strdup.m4
-  m4/strerror.m4
-  m4/strerror_r.m4
   m4/string_h.m4
   m4/strings_h.m4
   m4/strndup.m4
   m4/strnlen.m4
   m4/strtok_r.m4
   m4/strverscmp.m4
-  m4/symlink.m4
-  m4/sys_ioctl_h.m4
-  m4/sys_select_h.m4
   m4/sys_socket_h.m4
   m4/sys_stat_h.m4
   m4/sys_time_h.m4
@@ -1144,7 +847,6 @@ AC_DEFUN([gl_FILE_LIST], [
   tests/init.sh
   tests/macros.h
   tests/signature.h
-  tests/test-accept.c
   tests/test-alloca-opt.c
   tests/test-arpa_inet.c
   tests/test-base64.c
@@ -1153,9 +855,7 @@ AC_DEFUN([gl_FILE_LIST], [
   tests/test-bind.c
   tests/test-byteswap.c
   tests/test-c-ctype.c
-  tests/test-close.c
   tests/test-connect.c
-  tests/test-dup2.c
   tests/test-errno.c
   tests/test-fcntl-h.c
   tests/test-fdopen.c
@@ -1184,72 +884,32 @@ AC_DEFUN([gl_FILE_LIST], [
   tests/test-ftello3.c
   tests/test-ftello4.c
   tests/test-ftello4.sh
-  tests/test-ftruncate.c
-  tests/test-ftruncate.sh
   tests/test-func.c
   tests/test-fwrite.c
-  tests/test-getaddrinfo.c
-  tests/test-getcwd-lgpl.c
   tests/test-getdelim.c
-  tests/test-getdtablesize.c
   tests/test-getline.c
-  tests/test-getpeername.c
   tests/test-gettimeofday.c
   tests/test-iconv.c
-  tests/test-ignore-value.c
-  tests/test-inet_ntop.c
   tests/test-inet_pton.c
   tests/test-init.sh
   tests/test-intprops.c
   tests/test-inttypes.c
-  tests/test-ioctl.c
-  tests/test-listen.c
-  tests/test-lstat.c
-  tests/test-lstat.h
   tests/test-memchr.c
   tests/test-netdb.c
   tests/test-netinet_in.c
-  tests/test-open.c
-  tests/test-open.h
-  tests/test-pathmax.c
-  tests/test-perror.c
-  tests/test-perror.sh
-  tests/test-perror2.c
-  tests/test-pipe.c
   tests/test-read-file.c
-  tests/test-recv.c
-  tests/test-recvfrom.c
-  tests/test-select-fd.c
-  tests/test-select-in.sh
-  tests/test-select-out.sh
-  tests/test-select-stdin.c
-  tests/test-select.c
-  tests/test-select.h
-  tests/test-send.c
-  tests/test-sendto.c
-  tests/test-setsockopt.c
-  tests/test-shutdown.c
-  tests/test-signal-h.c
   tests/test-snprintf.c
   tests/test-sockets.c
-  tests/test-stat.c
-  tests/test-stat.h
   tests/test-stdalign.c
   tests/test-stdbool.c
   tests/test-stddef.c
   tests/test-stdint.c
   tests/test-stdio.c
   tests/test-stdlib.c
-  tests/test-strerror.c
-  tests/test-strerror_r.c
   tests/test-string.c
   tests/test-strings.c
   tests/test-strnlen.c
   tests/test-strverscmp.c
-  tests/test-symlink.c
-  tests/test-symlink.h
-  tests/test-sys_ioctl.c
-  tests/test-sys_select.c
   tests/test-sys_socket.c
   tests/test-sys_stat.c
   tests/test-sys_time.c
@@ -1268,32 +928,19 @@ AC_DEFUN([gl_FILE_LIST], [
   tests/test-vsnprintf.c
   tests/test-wchar.c
   tests/zerosize-ptr.h
+  tests=lib/arpa_inet.in.h
   tests=lib/binary-io.c
   tests=lib/binary-io.h
-  tests=lib/dosname.h
   tests=lib/fcntl.in.h
+  tests=lib/fd-hook.c
+  tests=lib/fd-hook.h
   tests=lib/fdopen.c
   tests=lib/fpucw.h
-  tests=lib/ftruncate.c
-  tests=lib/getcwd-lgpl.c
-  tests=lib/getdtablesize.c
   tests=lib/getpagesize.c
-  tests=lib/glthread/lock.c
-  tests=lib/glthread/lock.h
-  tests=lib/glthread/threadlib.c
-  tests=lib/ignore-value.h
+  tests=lib/inet_pton.c
   tests=lib/inttypes.in.h
-  tests=lib/ioctl.c
-  tests=lib/lstat.c
-  tests=lib/open.c
-  tests=lib/pathmax.h
-  tests=lib/perror.c
-  tests=lib/pipe.c
-  tests=lib/same-inode.h
-  tests=lib/stat.c
-  tests=lib/strerror_r.c
-  tests=lib/symlink.c
-  tests=lib/sys_ioctl.in.h
+  tests=lib/sockets.c
+  tests=lib/sockets.h
   tests=lib/w32sock.h
   top/GNUmakefile
   top/maint.mk
diff --git a/gl/m4/hostent.m4 b/gl/m4/hostent.m4
deleted file mode 100644 (file)
index dd8fc07..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-# hostent.m4 serial 2
-dnl Copyright (C) 2008, 2010-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_HOSTENT],
-[
-  dnl Where are gethostent(), sethostent(), endhostent(), gethostbyname(),
-  dnl gethostbyaddr() defined?
-  dnl - On Solaris, they are in libnsl. Ignore libxnet.
-  dnl - On Haiku, they are in libnetwork.
-  dnl - On BeOS, they are in libnet.
-  dnl - On native Windows, they are in ws2_32.dll.
-  dnl - Otherwise they are in libc.
-  AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
-  HOSTENT_LIB=
-  gl_saved_libs="$LIBS"
-  AC_SEARCH_LIBS([gethostbyname], [nsl network net],
-    [if test "$ac_cv_search_gethostbyname" != "none required"; then
-       HOSTENT_LIB="$ac_cv_search_gethostbyname"
-     fi])
-  LIBS="$gl_saved_libs"
-  if test -z "$HOSTENT_LIB"; then
-    AC_CHECK_FUNCS([gethostbyname], , [
-      AC_CACHE_CHECK([for gethostbyname in winsock2.h and -lws2_32],
-        [gl_cv_w32_gethostbyname],
-        [gl_cv_w32_gethostbyname=no
-         gl_save_LIBS="$LIBS"
-         LIBS="$LIBS -lws2_32"
-         AC_LINK_IFELSE(
-           [AC_LANG_PROGRAM(
-              [[
-#ifdef HAVE_WINSOCK2_H
-#include <winsock2.h>
-#endif
-#include <stddef.h>
-              ]],
-              [[gethostbyname(NULL);]])],
-           [gl_cv_w32_gethostbyname=yes])
-         LIBS="$gl_save_LIBS"
-        ])
-      if test "$gl_cv_w32_gethostbyname" = "yes"; then
-        HOSTENT_LIB="-lws2_32"
-      fi
-    ])
-  fi
-  AC_SUBST([HOSTENT_LIB])
-])
diff --git a/gl/m4/inet_ntop.m4 b/gl/m4/inet_ntop.m4
deleted file mode 100644 (file)
index 5b27759..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-# inet_ntop.m4 serial 19
-dnl Copyright (C) 2005-2006, 2008-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_INET_NTOP],
-[
-  AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
-
-  dnl Persuade Solaris <arpa/inet.h> to declare inet_ntop.
-  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
-  AC_REQUIRE([AC_C_RESTRICT])
-
-  dnl Most platforms that provide inet_ntop define it in libc.
-  dnl Solaris 8..10 provide inet_ntop in libnsl instead.
-  dnl Solaris 2.6..7 provide inet_ntop in libresolv instead.
-  dnl Native Windows provides it in -lws2_32 instead, with a declaration in
-  dnl <ws2tcpip.h>, and it uses stdcall calling convention, not cdecl
-  dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it).
-  HAVE_INET_NTOP=1
-  INET_NTOP_LIB=
-  gl_PREREQ_SYS_H_WINSOCK2
-  if test $HAVE_WINSOCK2_H = 1; then
-    AC_CHECK_DECLS([inet_ntop],,, [[#include <ws2tcpip.h>]])
-    if test $ac_cv_have_decl_inet_ntop = yes; then
-      dnl It needs to be overridden, because the stdcall calling convention
-      dnl is not compliant with POSIX.
-      REPLACE_INET_NTOP=1
-      INET_NTOP_LIB="-lws2_32"
-    else
-      HAVE_DECL_INET_NTOP=0
-      HAVE_INET_NTOP=0
-    fi
-  else
-    gl_save_LIBS=$LIBS
-    AC_SEARCH_LIBS([inet_ntop], [nsl resolv], [],
-      [AC_CHECK_FUNCS([inet_ntop])
-       if test $ac_cv_func_inet_ntop = no; then
-         HAVE_INET_NTOP=0
-       fi
-      ])
-    LIBS=$gl_save_LIBS
-
-    if test "$ac_cv_search_inet_ntop" != "no" \
-       && test "$ac_cv_search_inet_ntop" != "none required"; then
-      INET_NTOP_LIB="$ac_cv_search_inet_ntop"
-    fi
-
-    AC_CHECK_HEADERS_ONCE([netdb.h])
-    AC_CHECK_DECLS([inet_ntop],,,
-      [[#include <arpa/inet.h>
-        #if HAVE_NETDB_H
-        # include <netdb.h>
-        #endif
-      ]])
-    if test $ac_cv_have_decl_inet_ntop = no; then
-      HAVE_DECL_INET_NTOP=0
-    fi
-  fi
-  AC_SUBST([INET_NTOP_LIB])
-])
-
-# Prerequisites of lib/inet_ntop.c.
-AC_DEFUN([gl_PREREQ_INET_NTOP], [
-  AC_REQUIRE([gl_SOCKET_FAMILIES])
-])
diff --git a/gl/m4/ioctl.m4 b/gl/m4/ioctl.m4
deleted file mode 100644 (file)
index 5a31a39..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-# ioctl.m4 serial 4
-dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_IOCTL],
-[
-  AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])
-  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
-  HAVE_IOCTL=1
-  if test "$ac_cv_header_winsock2_h" = yes; then
-    dnl Even if the 'socket' module is not used here, another part of the
-    dnl application may use it and pass file descriptors that refer to
-    dnl sockets to the ioctl() function. So enable the support for sockets.
-    HAVE_IOCTL=0
-  else
-    AC_CHECK_FUNCS([ioctl])
-    dnl On glibc systems, the second parameter is 'unsigned long int request',
-    dnl not 'int request'. We cannot simply cast the function pointer, but
-    dnl instead need a wrapper.
-    AC_CACHE_CHECK([for ioctl with POSIX signature],
-      [gl_cv_func_ioctl_posix_signature],
-      [AC_COMPILE_IFELSE(
-         [AC_LANG_PROGRAM(
-            [[#include <sys/ioctl.h>]],
-            [[extern
-              #ifdef __cplusplus
-              "C"
-              #endif
-              int ioctl (int, int, ...);
-            ]])
-         ],
-         [gl_cv_func_ioctl_posix_signature=yes],
-         [gl_cv_func_ioctl_posix_signature=no])
-      ])
-    if test $gl_cv_func_ioctl_posix_signature != yes; then
-      REPLACE_IOCTL=1
-    fi
-  fi
-])
diff --git a/gl/m4/lstat.m4 b/gl/m4/lstat.m4
deleted file mode 100644 (file)
index c5e72b8..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-# serial 26
-
-# Copyright (C) 1997-2001, 2003-2014 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-dnl From Jim Meyering.
-
-AC_DEFUN([gl_FUNC_LSTAT],
-[
-  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
-  dnl If lstat does not exist, the replacement <sys/stat.h> does
-  dnl "#define lstat stat", and lstat.c is a no-op.
-  AC_CHECK_FUNCS_ONCE([lstat])
-  if test $ac_cv_func_lstat = yes; then
-    AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
-    case "$gl_cv_func_lstat_dereferences_slashed_symlink" in
-      *no)
-        REPLACE_LSTAT=1
-        ;;
-    esac
-  else
-    HAVE_LSTAT=0
-  fi
-])
-
-# Prerequisites of lib/lstat.c.
-AC_DEFUN([gl_PREREQ_LSTAT], [:])
-
-AC_DEFUN([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK],
-[
-  dnl We don't use AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK any more, because it
-  dnl is no longer maintained in Autoconf and because it invokes AC_LIBOBJ.
-  AC_CACHE_CHECK([whether lstat correctly handles trailing slash],
-    [gl_cv_func_lstat_dereferences_slashed_symlink],
-    [rm -f conftest.sym conftest.file
-     echo >conftest.file
-     if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
-       AC_RUN_IFELSE(
-         [AC_LANG_PROGRAM(
-            [AC_INCLUDES_DEFAULT],
-            [[struct stat sbuf;
-              /* Linux will dereference the symlink and fail, as required by
-                 POSIX.  That is better in the sense that it means we will not
-                 have to compile and use the lstat wrapper.  */
-              return lstat ("conftest.sym/", &sbuf) == 0;
-            ]])],
-         [gl_cv_func_lstat_dereferences_slashed_symlink=yes],
-         [gl_cv_func_lstat_dereferences_slashed_symlink=no],
-         [case "$host_os" in
-                    # Guess yes on glibc systems.
-            *-gnu*) gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;
-                    # If we don't know, assume the worst.
-            *)      gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;;
-          esac
-         ])
-     else
-       # If the 'ln -s' command failed, then we probably don't even
-       # have an lstat function.
-       gl_cv_func_lstat_dereferences_slashed_symlink="guessing no"
-     fi
-     rm -f conftest.sym conftest.file
-    ])
-  case "$gl_cv_func_lstat_dereferences_slashed_symlink" in
-    *yes)
-      AC_DEFINE_UNQUOTED([LSTAT_FOLLOWS_SLASHED_SYMLINK], [1],
-        [Define to 1 if 'lstat' dereferences a symlink specified
-         with a trailing slash.])
-      ;;
-  esac
-])
diff --git a/gl/m4/mode_t.m4 b/gl/m4/mode_t.m4
deleted file mode 100644 (file)
index db6e192..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# mode_t.m4 serial 2
-dnl Copyright (C) 2009-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-# For using mode_t, it's sufficient to use AC_TYPE_MODE_T and
-# include <sys/types.h>.
-
-# Define PROMOTED_MODE_T to the type that is the result of "default argument
-# promotion" (ISO C 6.5.2.2.(6)) of the type mode_t.
-AC_DEFUN([gl_PROMOTED_TYPE_MODE_T],
-[
-  AC_REQUIRE([AC_TYPE_MODE_T])
-  AC_CACHE_CHECK([for promoted mode_t type], [gl_cv_promoted_mode_t], [
-    dnl Assume mode_t promotes to 'int' if and only if it is smaller than 'int',
-    dnl and to itself otherwise. This assumption is not guaranteed by the ISO C
-    dnl standard, but we don't know of any real-world counterexamples.
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]],
-      [[typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1];]])],
-      [gl_cv_promoted_mode_t='int'],
-      [gl_cv_promoted_mode_t='mode_t'])
-  ])
-  AC_DEFINE_UNQUOTED([PROMOTED_MODE_T], [$gl_cv_promoted_mode_t],
-    [Define to the type that is the result of default argument promotions of type mode_t.])
-])
diff --git a/gl/m4/open.m4 b/gl/m4/open.m4
deleted file mode 100644 (file)
index 68f116f..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-# open.m4 serial 14
-dnl Copyright (C) 2007-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_OPEN],
-[
-  AC_REQUIRE([AC_CANONICAL_HOST])
-  case "$host_os" in
-    mingw* | pw*)
-      REPLACE_OPEN=1
-      ;;
-    *)
-      dnl open("foo/") should not create a file when the file name has a
-      dnl trailing slash.  FreeBSD only has the problem on symlinks.
-      AC_CHECK_FUNCS_ONCE([lstat])
-      AC_CACHE_CHECK([whether open recognizes a trailing slash],
-        [gl_cv_func_open_slash],
-        [# Assume that if we have lstat, we can also check symlinks.
-          if test $ac_cv_func_lstat = yes; then
-            touch conftest.tmp
-            ln -s conftest.tmp conftest.lnk
-          fi
-          AC_RUN_IFELSE(
-            [AC_LANG_SOURCE([[
-#include <fcntl.h>
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-int main ()
-{
-  int result = 0;
-#if HAVE_LSTAT
-  if (open ("conftest.lnk/", O_RDONLY) != -1)
-    result |= 1;
-#endif
-  if (open ("conftest.sl/", O_CREAT, 0600) >= 0)
-    result |= 2;
-  return result;
-}]])],
-            [gl_cv_func_open_slash=yes],
-            [gl_cv_func_open_slash=no],
-            [
-changequote(,)dnl
-             case "$host_os" in
-               freebsd* | aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*)
-                 gl_cv_func_open_slash="guessing no" ;;
-               *)
-                 gl_cv_func_open_slash="guessing yes" ;;
-             esac
-changequote([,])dnl
-            ])
-          rm -f conftest.sl conftest.tmp conftest.lnk
-        ])
-      case "$gl_cv_func_open_slash" in
-        *no)
-          AC_DEFINE([OPEN_TRAILING_SLASH_BUG], [1],
-            [Define to 1 if open() fails to recognize a trailing slash.])
-          REPLACE_OPEN=1
-          ;;
-      esac
-      ;;
-  esac
-  dnl Replace open() for supporting the gnulib-defined fchdir() function,
-  dnl to keep fchdir's bookkeeping up-to-date.
-  m4_ifdef([gl_FUNC_FCHDIR], [
-    if test $REPLACE_OPEN = 0; then
-      gl_TEST_FCHDIR
-      if test $HAVE_FCHDIR = 0; then
-        REPLACE_OPEN=1
-      fi
-    fi
-  ])
-  dnl Replace open() for supporting the gnulib-defined O_NONBLOCK flag.
-  m4_ifdef([gl_NONBLOCKING_IO], [
-    if test $REPLACE_OPEN = 0; then
-      gl_NONBLOCKING_IO
-      if test $gl_cv_have_open_O_NONBLOCK != yes; then
-        REPLACE_OPEN=1
-      fi
-    fi
-  ])
-])
-
-# Prerequisites of lib/open.c.
-AC_DEFUN([gl_PREREQ_OPEN],
-[
-  AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T])
-  :
-])
diff --git a/gl/m4/pathmax.m4 b/gl/m4/pathmax.m4
deleted file mode 100644 (file)
index 114f91f..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-# pathmax.m4 serial 10
-dnl Copyright (C) 2002-2003, 2005-2006, 2009-2014 Free Software Foundation,
-dnl Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_PATHMAX],
-[
-  dnl Prerequisites of lib/pathmax.h.
-  AC_CHECK_HEADERS_ONCE([sys/param.h])
-])
-
-# Expands to a piece of C program that defines PATH_MAX in the same way as
-# "pathmax.h" will do.
-AC_DEFUN([gl_PATHMAX_SNIPPET], [[
-/* Arrange to define PATH_MAX, like "pathmax.h" does. */
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#include <limits.h>
-#if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN
-# include <sys/param.h>
-#endif
-#if !defined PATH_MAX && defined MAXPATHLEN
-# define PATH_MAX MAXPATHLEN
-#endif
-#ifdef __hpux
-# undef PATH_MAX
-# define PATH_MAX 1024
-#endif
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-# undef PATH_MAX
-# define PATH_MAX 260
-#endif
-]])
-
-# Prerequisites of gl_PATHMAX_SNIPPET.
-AC_DEFUN([gl_PATHMAX_SNIPPET_PREREQ],
-[
-  AC_CHECK_HEADERS_ONCE([unistd.h sys/param.h])
-])
diff --git a/gl/m4/perror.m4 b/gl/m4/perror.m4
deleted file mode 100644 (file)
index ff9c08f..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-# perror.m4 serial 6
-dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_PERROR],
-[
-  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
-  AC_REQUIRE([gl_HEADER_ERRNO_H])
-  AC_REQUIRE([gl_FUNC_STRERROR_R])
-  AC_REQUIRE([gl_FUNC_STRERROR_0])
-  dnl We intentionally do not check for the broader REPLACE_STRERROR_R,
-  dnl since on glibc systems, strerror_r is replaced only for signature
-  dnl issues, and perror is just fine.  Rather, we only want to
-  dnl replace perror if strerror_r was replaced for a content fix.
-  if test "$ERRNO_H:$REPLACE_STRERROR_0" != :0; then
-    dnl The system's perror() cannot know about the new errno values we add
-    dnl to <errno.h>, or any fix for strerror(0). Replace it.
-    REPLACE_PERROR=1
-  fi
-  case ${gl_cv_func_strerror_r_works-unset} in
-    unset|*yes)
-      AC_CACHE_CHECK([whether perror matches strerror],
-        [gl_cv_func_perror_works],
-        [AC_RUN_IFELSE(
-           [AC_LANG_PROGRAM(
-              [[#include <errno.h>
-                #include <stdio.h>
-                #include <stdlib.h>
-                #include <string.h>
-              ]],
-              [[char *str = strerror (-1);
-                if (!getenv("CONFTEST_OUTPUT")) return 0;
-                if (!str) str = "";
-                puts (str);
-                errno = -1;
-                perror ("");
-                return 0;
-              ]])],
-           [if CONFTEST_OUTPUT=1 ./conftest$EXEEXT >conftest.txt1 2>conftest.txt2 \
-               && cmp conftest.txt1 conftest.txt2 >/dev/null; then
-              gl_cv_func_perror_works=yes
-            else
-              gl_cv_func_perror_works=no
-            fi
-            rm -rf conftest.txt1 conftest.txt2],
-           [gl_cv_func_perror_works=no],
-           [dnl Guess no when cross-compiling.
-            gl_cv_func_perror_works="guessing no"
-           ])
-        ])
-      if test "$gl_cv_func_perror_works" != yes; then
-        REPLACE_PERROR=1
-      fi
-      ;;
-    *)
-      dnl The system's perror() probably inherits the bugs in the
-      dnl system's strerror_r(). Replace it.
-      REPLACE_PERROR=1
-      ;;
-  esac
-])
diff --git a/gl/m4/pipe.m4 b/gl/m4/pipe.m4
deleted file mode 100644 (file)
index d3532d5..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-# pipe.m4 serial 2
-dnl Copyright (C) 2010-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_PIPE],
-[
-  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-
-  AC_CHECK_FUNCS_ONCE([pipe])
-  if test $ac_cv_func_pipe != yes; then
-    HAVE_PIPE=0
-  fi
-])
diff --git a/gl/m4/select.m4 b/gl/m4/select.m4
deleted file mode 100644 (file)
index 1d2fcb3..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-# select.m4 serial 7
-dnl Copyright (C) 2009-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_SELECT],
-[
-  AC_REQUIRE([gl_HEADER_SYS_SELECT])
-  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
-  AC_REQUIRE([gl_SOCKETS])
-  if test "$ac_cv_header_winsock2_h" = yes; then
-    REPLACE_SELECT=1
-  else
-    dnl On Interix 3.5, select(0, NULL, NULL, NULL, timeout) fails with error
-    dnl EFAULT.
-    AC_CHECK_HEADERS_ONCE([sys/select.h])
-    AC_CACHE_CHECK([whether select supports a 0 argument],
-      [gl_cv_func_select_supports0],
-      [
-        AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <sys/types.h>
-#include <sys/time.h>
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-int main ()
-{
-  struct timeval timeout;
-  timeout.tv_sec = 0;
-  timeout.tv_usec = 5;
-  return select (0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &timeout) < 0;
-}]])], [gl_cv_func_select_supports0=yes], [gl_cv_func_select_supports0=no],
-          [
-changequote(,)dnl
-           case "$host_os" in
-                       # Guess no on Interix.
-             interix*) gl_cv_func_select_supports0="guessing no";;
-                       # Guess yes otherwise.
-             *)        gl_cv_func_select_supports0="guessing yes";;
-           esac
-changequote([,])dnl
-          ])
-      ])
-    case "$gl_cv_func_select_supports0" in
-      *yes) ;;
-      *) REPLACE_SELECT=1 ;;
-    esac
-
-    dnl On FreeBSD 8.2, select() doesn't always reject bad fds.
-    AC_CACHE_CHECK([whether select detects invalid fds],
-      [gl_cv_func_select_detects_ebadf],
-      [
-        AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-#include <sys/types.h>
-#include <sys/time.h>
-#if HAVE_SYS_SELECT_H
-# include <sys/select.h>
-#endif
-#include <unistd.h>
-#include <errno.h>
-]],[[
-  fd_set set;
-  dup2(0, 16);
-  FD_ZERO(&set);
-  FD_SET(16, &set);
-  close(16);
-  struct timeval timeout;
-  timeout.tv_sec = 0;
-  timeout.tv_usec = 5;
-  return select (17, &set, NULL, NULL, &timeout) != -1 || errno != EBADF;
-]])], [gl_cv_func_select_detects_ebadf=yes],
-      [gl_cv_func_select_detects_ebadf=no],
-          [
-           case "$host_os" in
-                    # Guess yes on glibc systems.
-            *-gnu*) gl_cv_func_select_detects_ebadf="guessing yes" ;;
-                    # If we don't know, assume the worst.
-            *)      gl_cv_func_select_detects_ebadf="guessing no" ;;
-           esac
-          ])
-      ])
-    case $gl_cv_func_select_detects_ebadf in
-      *yes) ;;
-      *) REPLACE_SELECT=1 ;;
-    esac
-  fi
-
-  dnl Determine the needed libraries.
-  LIB_SELECT="$LIBSOCKET"
-  if test $REPLACE_SELECT = 1; then
-    case "$host_os" in
-      mingw*)
-        dnl On the MSVC platform, the function MsgWaitForMultipleObjects
-        dnl (used in lib/select.c) requires linking with -luser32. On mingw,
-        dnl it is implicit.
-        AC_LINK_IFELSE(
-          [AC_LANG_SOURCE([[
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-int
-main ()
-{
-  MsgWaitForMultipleObjects (0, NULL, 0, 0, 0);
-  return 0;
-}]])],
-          [],
-          [LIB_SELECT="$LIB_SELECT -luser32"])
-        ;;
-    esac
-  fi
-  AC_SUBST([LIB_SELECT])
-])
diff --git a/gl/m4/servent.m4 b/gl/m4/servent.m4
deleted file mode 100644 (file)
index 4dc7a9f..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-# servent.m4 serial 2
-dnl Copyright (C) 2008, 2010-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_SERVENT],
-[
-  dnl Where are getservent(), setservent(), endservent(), getservbyname(),
-  dnl getservbyport() defined?
-  dnl Where are getprotoent(), setprotoent(), endprotoent(), getprotobyname(),
-  dnl getprotobynumber() defined?
-  dnl - On Solaris, they are in libsocket. Ignore libxnet.
-  dnl - On Haiku, they are in libnetwork.
-  dnl - On BeOS, they are in libnet.
-  dnl - On native Windows, they are in ws2_32.dll.
-  dnl - Otherwise they are in libc.
-  AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
-  SERVENT_LIB=
-  gl_saved_libs="$LIBS"
-  AC_SEARCH_LIBS([getservbyname], [socket network net],
-    [if test "$ac_cv_search_getservbyname" != "none required"; then
-       SERVENT_LIB="$ac_cv_search_getservbyname"
-     fi])
-  LIBS="$gl_saved_libs"
-  if test -z "$SERVENT_LIB"; then
-    AC_CHECK_FUNCS([getservbyname], , [
-      AC_CACHE_CHECK([for getservbyname in winsock2.h and -lws2_32],
-        [gl_cv_w32_getservbyname],
-        [gl_cv_w32_getservbyname=no
-         gl_save_LIBS="$LIBS"
-         LIBS="$LIBS -lws2_32"
-         AC_LINK_IFELSE(
-           [AC_LANG_PROGRAM(
-              [[
-#ifdef HAVE_WINSOCK2_H
-#include <winsock2.h>
-#endif
-#include <stddef.h>
-              ]],
-              [[getservbyname(NULL,NULL);]])],
-           [gl_cv_w32_getservbyname=yes])
-         LIBS="$gl_save_LIBS"
-        ])
-      if test "$gl_cv_w32_getservbyname" = "yes"; then
-        SERVENT_LIB="-lws2_32"
-      fi
-    ])
-  fi
-  AC_SUBST([SERVENT_LIB])
-])
diff --git a/gl/m4/signal_h.m4 b/gl/m4/signal_h.m4
deleted file mode 100644 (file)
index c8f664f..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-# signal_h.m4 serial 18
-dnl Copyright (C) 2007-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_SIGNAL_H],
-[
-  AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
-  AC_REQUIRE([gl_CHECK_TYPE_SIGSET_T])
-  gl_NEXT_HEADERS([signal.h])
-
-# AIX declares sig_atomic_t to already include volatile, and C89 compilers
-# then choke on 'volatile sig_atomic_t'.  C99 requires that it compile.
-  AC_CHECK_TYPE([volatile sig_atomic_t], [],
-    [HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=0], [[
-#include <signal.h>
-    ]])
-
-  dnl Ensure the type pid_t gets defined.
-  AC_REQUIRE([AC_TYPE_PID_T])
-
-  AC_REQUIRE([AC_TYPE_UID_T])
-
-  dnl Persuade glibc <signal.h> to define sighandler_t.
-  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-  AC_CHECK_TYPE([sighandler_t], [], [HAVE_SIGHANDLER_T=0], [[
-#include <signal.h>
-    ]])
-
-  dnl Check for declarations of anything we want to poison if the
-  dnl corresponding gnulib module is not in use.
-  gl_WARN_ON_USE_PREPARE([[#include <signal.h>
-    ]], [pthread_sigmask sigaction
-    sigaddset sigdelset sigemptyset sigfillset sigismember
-    sigpending sigprocmask])
-])
-
-AC_DEFUN([gl_CHECK_TYPE_SIGSET_T],
-[
-  AC_CHECK_TYPES([sigset_t],
-    [gl_cv_type_sigset_t=yes], [gl_cv_type_sigset_t=no],
-    [[
-      #include <signal.h>
-      /* Mingw defines sigset_t not in <signal.h>, but in <sys/types.h>.  */
-      #include <sys/types.h>
-    ]])
-  if test $gl_cv_type_sigset_t != yes; then
-    HAVE_SIGSET_T=0
-  fi
-])
-
-AC_DEFUN([gl_SIGNAL_MODULE_INDICATOR],
-[
-  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
-  AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
-  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
-  dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR_FOR_TESTS([$1])
-])
-
-AC_DEFUN([gl_SIGNAL_H_DEFAULTS],
-[
-  GNULIB_PTHREAD_SIGMASK=0;    AC_SUBST([GNULIB_PTHREAD_SIGMASK])
-  GNULIB_RAISE=0;              AC_SUBST([GNULIB_RAISE])
-  GNULIB_SIGNAL_H_SIGPIPE=0;   AC_SUBST([GNULIB_SIGNAL_H_SIGPIPE])
-  GNULIB_SIGPROCMASK=0;        AC_SUBST([GNULIB_SIGPROCMASK])
-  GNULIB_SIGACTION=0;          AC_SUBST([GNULIB_SIGACTION])
-  dnl Assume proper GNU behavior unless another module says otherwise.
-  HAVE_POSIX_SIGNALBLOCKING=1; AC_SUBST([HAVE_POSIX_SIGNALBLOCKING])
-  HAVE_PTHREAD_SIGMASK=1;      AC_SUBST([HAVE_PTHREAD_SIGMASK])
-  HAVE_RAISE=1;                AC_SUBST([HAVE_RAISE])
-  HAVE_SIGSET_T=1;             AC_SUBST([HAVE_SIGSET_T])
-  HAVE_SIGINFO_T=1;            AC_SUBST([HAVE_SIGINFO_T])
-  HAVE_SIGACTION=1;            AC_SUBST([HAVE_SIGACTION])
-  HAVE_STRUCT_SIGACTION_SA_SIGACTION=1;
-                               AC_SUBST([HAVE_STRUCT_SIGACTION_SA_SIGACTION])
-  HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=1;
-                               AC_SUBST([HAVE_TYPE_VOLATILE_SIG_ATOMIC_T])
-  HAVE_SIGHANDLER_T=1;         AC_SUBST([HAVE_SIGHANDLER_T])
-  REPLACE_PTHREAD_SIGMASK=0;   AC_SUBST([REPLACE_PTHREAD_SIGMASK])
-  REPLACE_RAISE=0;             AC_SUBST([REPLACE_RAISE])
-])
diff --git a/gl/m4/stat.m4 b/gl/m4/stat.m4
deleted file mode 100644 (file)
index 1ae327b..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-# serial 11
-
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_STAT],
-[
-  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
-  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
-  AC_CHECK_FUNCS_ONCE([lstat])
-  dnl mingw is the only known platform where stat(".") and stat("./") differ
-  AC_CACHE_CHECK([whether stat handles trailing slashes on directories],
-      [gl_cv_func_stat_dir_slash],
-      [AC_RUN_IFELSE(
-         [AC_LANG_PROGRAM(
-           [[#include <sys/stat.h>
-]], [[struct stat st; return stat (".", &st) != stat ("./", &st);]])],
-         [gl_cv_func_stat_dir_slash=yes], [gl_cv_func_stat_dir_slash=no],
-         [case $host_os in
-            mingw*) gl_cv_func_stat_dir_slash="guessing no";;
-            *) gl_cv_func_stat_dir_slash="guessing yes";;
-          esac])])
-  dnl AIX 7.1, Solaris 9, mingw64 mistakenly succeed on stat("file/").
-  dnl (For mingw, this is due to a broken stat() override in libmingwex.a.)
-  dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/").
-  AC_CACHE_CHECK([whether stat handles trailing slashes on files],
-      [gl_cv_func_stat_file_slash],
-      [touch conftest.tmp
-       # Assume that if we have lstat, we can also check symlinks.
-       if test $ac_cv_func_lstat = yes; then
-         ln -s conftest.tmp conftest.lnk
-       fi
-       AC_RUN_IFELSE(
-         [AC_LANG_PROGRAM(
-           [[#include <sys/stat.h>
-]], [[int result = 0;
-      struct stat st;
-      if (!stat ("conftest.tmp/", &st))
-        result |= 1;
-#if HAVE_LSTAT
-      if (!stat ("conftest.lnk/", &st))
-        result |= 2;
-#endif
-      return result;
-           ]])],
-         [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no],
-         [case "$host_os" in
-                    # Guess yes on glibc systems.
-            *-gnu*) gl_cv_func_stat_file_slash="guessing yes" ;;
-                    # If we don't know, assume the worst.
-            *)      gl_cv_func_stat_file_slash="guessing no" ;;
-          esac
-         ])
-       rm -f conftest.tmp conftest.lnk])
-  case $gl_cv_func_stat_dir_slash in
-    *no) REPLACE_STAT=1
-      AC_DEFINE([REPLACE_FUNC_STAT_DIR], [1], [Define to 1 if stat needs
-        help when passed a directory name with a trailing slash]);;
-  esac
-  case $gl_cv_func_stat_file_slash in
-    *no) REPLACE_STAT=1
-      AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs
-        help when passed a file name with a trailing slash]);;
-  esac
-])
-
-# Prerequisites of lib/stat.c.
-AC_DEFUN([gl_PREREQ_STAT], [:])
diff --git a/gl/m4/strerror.m4 b/gl/m4/strerror.m4
deleted file mode 100644 (file)
index 0763fe3..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-# strerror.m4 serial 17
-dnl Copyright (C) 2002, 2007-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_STRERROR],
-[
-  AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
-  AC_REQUIRE([gl_HEADER_ERRNO_H])
-  AC_REQUIRE([gl_FUNC_STRERROR_0])
-  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
-  m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [
-    AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS])
-  ])
-  if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then
-    AC_CACHE_CHECK([for working strerror function],
-     [gl_cv_func_working_strerror],
-     [AC_RUN_IFELSE(
-        [AC_LANG_PROGRAM(
-           [[#include <string.h>
-           ]],
-           [[if (!*strerror (-2)) return 1;]])],
-        [gl_cv_func_working_strerror=yes],
-        [gl_cv_func_working_strerror=no],
-        [case "$host_os" in
-                   # Guess yes on glibc systems.
-           *-gnu*) gl_cv_func_working_strerror="guessing yes" ;;
-                   # If we don't know, assume the worst.
-           *)      gl_cv_func_working_strerror="guessing no" ;;
-         esac
-        ])
-    ])
-    case "$gl_cv_func_working_strerror" in
-      *yes) ;;
-      *)
-        dnl The system's strerror() fails to return a string for out-of-range
-        dnl integers. Replace it.
-        REPLACE_STRERROR=1
-        ;;
-    esac
-    m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [
-      dnl If the system's strerror_r or __xpg_strerror_r clobbers strerror's
-      dnl buffer, we must replace strerror.
-      case "$gl_cv_func_strerror_r_works" in
-        *no) REPLACE_STRERROR=1 ;;
-      esac
-    ])
-  else
-    dnl The system's strerror() cannot know about the new errno values we add
-    dnl to <errno.h>, or any fix for strerror(0). Replace it.
-    REPLACE_STRERROR=1
-  fi
-])
-
-dnl Detect if strerror(0) passes (that is, does not set errno, and does not
-dnl return a string that matches strerror(-1)).
-AC_DEFUN([gl_FUNC_STRERROR_0],
-[
-  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
-  REPLACE_STRERROR_0=0
-  AC_CACHE_CHECK([whether strerror(0) succeeds],
-   [gl_cv_func_strerror_0_works],
-   [AC_RUN_IFELSE(
-      [AC_LANG_PROGRAM(
-         [[#include <string.h>
-           #include <errno.h>
-         ]],
-         [[int result = 0;
-           char *str;
-           errno = 0;
-           str = strerror (0);
-           if (!*str) result |= 1;
-           if (errno) result |= 2;
-           if (strstr (str, "nknown") || strstr (str, "ndefined"))
-             result |= 4;
-           return result;]])],
-      [gl_cv_func_strerror_0_works=yes],
-      [gl_cv_func_strerror_0_works=no],
-      [case "$host_os" in
-                 # Guess yes on glibc systems.
-         *-gnu*) gl_cv_func_strerror_0_works="guessing yes" ;;
-                 # If we don't know, assume the worst.
-         *)      gl_cv_func_strerror_0_works="guessing no" ;;
-       esac
-      ])
-  ])
-  case "$gl_cv_func_strerror_0_works" in
-    *yes) ;;
-    *)
-      REPLACE_STRERROR_0=1
-      AC_DEFINE([REPLACE_STRERROR_0], [1], [Define to 1 if strerror(0)
-        does not return a message implying success.])
-      ;;
-  esac
-])
diff --git a/gl/m4/strerror_r.m4 b/gl/m4/strerror_r.m4
deleted file mode 100644 (file)
index e13a369..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-# strerror_r.m4 serial 15
-dnl Copyright (C) 2002, 2007-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_STRERROR_R],
-[
-  AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
-  AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS])
-
-  dnl Persuade Solaris <string.h> to declare strerror_r().
-  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
-  dnl Some systems don't declare strerror_r() if _THREAD_SAFE and _REENTRANT
-  dnl are not defined.
-  AC_CHECK_DECLS_ONCE([strerror_r])
-  if test $ac_cv_have_decl_strerror_r = no; then
-    HAVE_DECL_STRERROR_R=0
-  fi
-
-  if test $ac_cv_func_strerror_r = yes; then
-    if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then
-      if test $gl_cv_func_strerror_r_posix_signature = yes; then
-        case "$gl_cv_func_strerror_r_works" in
-          dnl The system's strerror_r has bugs.  Replace it.
-          *no) REPLACE_STRERROR_R=1 ;;
-        esac
-      else
-        dnl The system's strerror_r() has a wrong signature. Replace it.
-        REPLACE_STRERROR_R=1
-      fi
-    else
-      dnl The system's strerror_r() cannot know about the new errno values we
-      dnl add to <errno.h>, or any fix for strerror(0). Replace it.
-      REPLACE_STRERROR_R=1
-    fi
-  fi
-])
-
-# Prerequisites of lib/strerror_r.c.
-AC_DEFUN([gl_PREREQ_STRERROR_R], [
-  dnl glibc >= 2.3.4 and cygwin 1.7.9 have a function __xpg_strerror_r.
-  AC_CHECK_FUNCS_ONCE([__xpg_strerror_r])
-  AC_CHECK_FUNCS_ONCE([catgets])
-  AC_CHECK_FUNCS_ONCE([snprintf])
-])
-
-# Detect if strerror_r works, but without affecting whether a replacement
-# strerror_r will be used.
-AC_DEFUN([gl_FUNC_STRERROR_R_WORKS],
-[
-  AC_REQUIRE([gl_HEADER_ERRNO_H])
-  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
-  AC_REQUIRE([gl_FUNC_STRERROR_0])
-
-  AC_CHECK_FUNCS_ONCE([strerror_r])
-  if test $ac_cv_func_strerror_r = yes; then
-    if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then
-      dnl The POSIX prototype is:  int strerror_r (int, char *, size_t);
-      dnl glibc, Cygwin:           char *strerror_r (int, char *, size_t);
-      dnl AIX 5.1, OSF/1 5.1:      int strerror_r (int, char *, int);
-      AC_CACHE_CHECK([for strerror_r with POSIX signature],
-        [gl_cv_func_strerror_r_posix_signature],
-        [AC_COMPILE_IFELSE(
-           [AC_LANG_PROGRAM(
-              [[#include <string.h>
-                int strerror_r (int, char *, size_t);
-              ]],
-              [])],
-           [gl_cv_func_strerror_r_posix_signature=yes],
-           [gl_cv_func_strerror_r_posix_signature=no])
-        ])
-      if test $gl_cv_func_strerror_r_posix_signature = yes; then
-        dnl AIX 6.1 strerror_r fails by returning -1, not an error number.
-        dnl HP-UX 11.31 strerror_r always fails when the buffer length argument
-        dnl is less than 80.
-        dnl FreeBSD 8.s strerror_r claims failure on 0
-        dnl Mac OS X 10.5 strerror_r treats 0 like -1
-        dnl Solaris 10 strerror_r corrupts errno on failure
-        AC_CACHE_CHECK([whether strerror_r works],
-          [gl_cv_func_strerror_r_works],
-          [AC_RUN_IFELSE(
-             [AC_LANG_PROGRAM(
-                [[#include <errno.h>
-                  #include <string.h>
-                ]],
-                [[int result = 0;
-                  char buf[79];
-                  if (strerror_r (EACCES, buf, 0) < 0)
-                    result |= 1;
-                  errno = 0;
-                  if (strerror_r (EACCES, buf, sizeof buf) != 0)
-                    result |= 2;
-                  strcpy (buf, "Unknown");
-                  if (strerror_r (0, buf, sizeof buf) != 0)
-                    result |= 4;
-                  if (errno)
-                    result |= 8;
-                  if (strstr (buf, "nknown") || strstr (buf, "ndefined"))
-                    result |= 0x10;
-                  errno = 0;
-                  *buf = 0;
-                  if (strerror_r (-3, buf, sizeof buf) < 0)
-                    result |= 0x20;
-                  if (errno)
-                    result |= 0x40;
-                  if (!*buf)
-                    result |= 0x80;
-                  return result;
-                ]])],
-             [gl_cv_func_strerror_r_works=yes],
-             [gl_cv_func_strerror_r_works=no],
-             [
-changequote(,)dnl
-              case "$host_os" in
-                       # Guess no on AIX.
-                aix*)  gl_cv_func_strerror_r_works="guessing no";;
-                       # Guess no on HP-UX.
-                hpux*) gl_cv_func_strerror_r_works="guessing no";;
-                       # Guess no on BSD variants.
-                *bsd*)  gl_cv_func_strerror_r_works="guessing no";;
-                       # Guess yes otherwise.
-                *)     gl_cv_func_strerror_r_works="guessing yes";;
-              esac
-changequote([,])dnl
-             ])
-          ])
-      else
-        dnl The system's strerror() has a wrong signature.
-        dnl glibc >= 2.3.4 and cygwin 1.7.9 have a function __xpg_strerror_r.
-        AC_CHECK_FUNCS_ONCE([__xpg_strerror_r])
-        dnl In glibc < 2.14, __xpg_strerror_r does not populate buf on failure.
-        dnl In cygwin < 1.7.10, __xpg_strerror_r clobbers strerror's buffer.
-        if test $ac_cv_func___xpg_strerror_r = yes; then
-          AC_CACHE_CHECK([whether __xpg_strerror_r works],
-            [gl_cv_func_strerror_r_works],
-            [AC_RUN_IFELSE(
-               [AC_LANG_PROGRAM(
-                  [[#include <errno.h>
-                    #include <string.h>
-                    extern
-                    #ifdef __cplusplus
-                    "C"
-                    #endif
-                    int __xpg_strerror_r(int, char *, size_t);
-                  ]],
-                  [[int result = 0;
-                    char buf[256] = "^";
-                    char copy[256];
-                    char *str = strerror (-1);
-                    strcpy (copy, str);
-                    if (__xpg_strerror_r (-2, buf, 1) == 0)
-                      result |= 1;
-                    if (*buf)
-                      result |= 2;
-                    __xpg_strerror_r (-2, buf, 256);
-                    if (strcmp (str, copy))
-                      result |= 4;
-                    return result;
-                  ]])],
-               [gl_cv_func_strerror_r_works=yes],
-               [gl_cv_func_strerror_r_works=no],
-               [dnl Guess no on all platforms that have __xpg_strerror_r,
-                dnl at least until fixed glibc and cygwin are more common.
-                gl_cv_func_strerror_r_works="guessing no"
-               ])
-            ])
-        fi
-      fi
-    fi
-  fi
-])
diff --git a/gl/m4/symlink.m4 b/gl/m4/symlink.m4
deleted file mode 100644 (file)
index de4924b..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-# serial 6
-# See if we need to provide symlink replacement.
-
-dnl Copyright (C) 2009-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-# Written by Eric Blake.
-
-AC_DEFUN([gl_FUNC_SYMLINK],
-[
-  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
-  AC_CHECK_FUNCS_ONCE([symlink])
-  dnl The best we can do on mingw is provide a dummy that always fails, so
-  dnl that compilation can proceed with fewer ifdefs.  On FreeBSD 7.2, AIX 7.1,
-  dnl and Solaris 9, we want to fix a bug with trailing slash handling.
-  if test $ac_cv_func_symlink = no; then
-    HAVE_SYMLINK=0
-  else
-    AC_CACHE_CHECK([whether symlink handles trailing slash correctly],
-      [gl_cv_func_symlink_works],
-      [AC_RUN_IFELSE(
-         [AC_LANG_PROGRAM(
-           [[#include <unistd.h>
-           ]],
-           [[int result = 0;
-             if (!symlink ("a", "conftest.link/"))
-               result |= 1;
-             if (symlink ("conftest.f", "conftest.lnk2"))
-               result |= 2;
-             else if (!symlink ("a", "conftest.lnk2/"))
-               result |= 4;
-             return result;
-           ]])],
-         [gl_cv_func_symlink_works=yes], [gl_cv_func_symlink_works=no],
-         [case "$host_os" in
-                    # Guess yes on glibc systems.
-            *-gnu*) gl_cv_func_symlink_works="guessing yes" ;;
-                    # If we don't know, assume the worst.
-            *)      gl_cv_func_symlink_works="guessing no" ;;
-          esac
-         ])
-      rm -f conftest.f conftest.link conftest.lnk2])
-    case "$gl_cv_func_symlink_works" in
-      *yes) ;;
-      *)
-        REPLACE_SYMLINK=1
-        ;;
-    esac
-  fi
-])
diff --git a/gl/m4/sys_ioctl_h.m4 b/gl/m4/sys_ioctl_h.m4
deleted file mode 100644 (file)
index 1654231..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-# sys_ioctl_h.m4 serial 10
-dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl Written by Bruno Haible.
-
-AC_DEFUN([gl_SYS_IOCTL_H],
-[
-  dnl Use AC_REQUIRE here, so that the default behavior below is expanded
-  dnl once only, before all statements that occur in other macros.
-  AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])
-
-  AC_CHECK_HEADERS_ONCE([sys/ioctl.h])
-  if test $ac_cv_header_sys_ioctl_h = yes; then
-    HAVE_SYS_IOCTL_H=1
-    dnl Test whether <sys/ioctl.h> declares ioctl(), or whether some other
-    dnl header file, such as <unistd.h> or <stropts.h>, is needed for that.
-    AC_CACHE_CHECK([whether <sys/ioctl.h> declares ioctl],
-      [gl_cv_decl_ioctl_in_sys_ioctl_h],
-      [dnl We cannot use AC_CHECK_DECL because it produces its own messages.
-       AC_COMPILE_IFELSE(
-         [AC_LANG_PROGRAM(
-            [AC_INCLUDES_DEFAULT([#include <sys/ioctl.h>])],
-            [(void) ioctl;])],
-         [gl_cv_decl_ioctl_in_sys_ioctl_h=yes],
-         [gl_cv_decl_ioctl_in_sys_ioctl_h=no])
-      ])
-  else
-    HAVE_SYS_IOCTL_H=0
-  fi
-  AC_SUBST([HAVE_SYS_IOCTL_H])
-  dnl <sys/ioctl.h> is always overridden, because of GNULIB_POSIXCHECK.
-  gl_CHECK_NEXT_HEADERS([sys/ioctl.h])
-
-  dnl Check for declarations of anything we want to poison if the
-  dnl corresponding gnulib module is not in use.
-  gl_WARN_ON_USE_PREPARE([[#include <sys/ioctl.h>
-/* Some platforms declare ioctl in the wrong header.  */
-#if !(defined __GLIBC__ && !defined __UCLIBC__)
-# include <unistd.h>
-#endif
-    ]], [ioctl])
-])
-
-AC_DEFUN([gl_SYS_IOCTL_MODULE_INDICATOR],
-[
-  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
-  AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])
-  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
-  dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR_FOR_TESTS([$1])
-])
-
-AC_DEFUN([gl_SYS_IOCTL_H_DEFAULTS],
-[
-  GNULIB_IOCTL=0;         AC_SUBST([GNULIB_IOCTL])
-  dnl Assume proper GNU behavior unless another module says otherwise.
-  SYS_IOCTL_H_HAVE_WINSOCK2_H=0; AC_SUBST([SYS_IOCTL_H_HAVE_WINSOCK2_H])
-  SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0;
-                        AC_SUBST([SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS])
-  REPLACE_IOCTL=0;      AC_SUBST([REPLACE_IOCTL])
-])
diff --git a/gl/m4/sys_select_h.m4 b/gl/m4/sys_select_h.m4
deleted file mode 100644 (file)
index 1a502b4..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-# sys_select_h.m4 serial 20
-dnl Copyright (C) 2006-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_HEADER_SYS_SELECT],
-[
-  AC_REQUIRE([AC_C_RESTRICT])
-  AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS])
-  AC_CACHE_CHECK([whether <sys/select.h> is self-contained],
-    [gl_cv_header_sys_select_h_selfcontained],
-    [
-      dnl Test against two bugs:
-      dnl 1. On many platforms, <sys/select.h> assumes prior inclusion of
-      dnl    <sys/types.h>.
-      dnl 2. On OSF/1 4.0, <sys/select.h> provides only a forward declaration
-      dnl    of 'struct timeval', and no definition of this type.
-      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/select.h>]],
-                                         [[struct timeval b;]])],
-        [gl_cv_header_sys_select_h_selfcontained=yes],
-        [gl_cv_header_sys_select_h_selfcontained=no])
-      dnl Test against another bug:
-      dnl 3. On Solaris 10, <sys/select.h> provides an FD_ZERO implementation
-      dnl    that relies on memset(), but without including <string.h>.
-      if test $gl_cv_header_sys_select_h_selfcontained = yes; then
-        AC_COMPILE_IFELSE(
-          [AC_LANG_PROGRAM([[#include <sys/select.h>]],
-                           [[int memset; int bzero;]])
-          ],
-          [AC_LINK_IFELSE(
-             [AC_LANG_PROGRAM([[#include <sys/select.h>]], [[
-                  #undef memset
-                  #define memset nonexistent_memset
-                  extern
-                  #ifdef __cplusplus
-                  "C"
-                  #endif
-                  void *memset (void *, int, unsigned long);
-                  #undef bzero
-                  #define bzero nonexistent_bzero
-                  extern
-                  #ifdef __cplusplus
-                  "C"
-                  #endif
-                  void bzero (void *, unsigned long);
-                  fd_set fds;
-                  FD_ZERO (&fds);
-                ]])
-             ],
-             [],
-             [gl_cv_header_sys_select_h_selfcontained=no])
-          ])
-      fi
-    ])
-  dnl <sys/select.h> is always overridden, because of GNULIB_POSIXCHECK.
-  gl_CHECK_NEXT_HEADERS([sys/select.h])
-  if test $ac_cv_header_sys_select_h = yes; then
-    HAVE_SYS_SELECT_H=1
-  else
-    HAVE_SYS_SELECT_H=0
-  fi
-  AC_SUBST([HAVE_SYS_SELECT_H])
-  gl_PREREQ_SYS_H_WINSOCK2
-
-  dnl Check for declarations of anything we want to poison if the
-  dnl corresponding gnulib module is not in use.
-  gl_WARN_ON_USE_PREPARE([[
-/* Some systems require prerequisite headers.  */
-#include <sys/types.h>
-#if !(defined __GLIBC__ && !defined __UCLIBC__) && HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
-#include <sys/select.h>
-    ]], [pselect select])
-])
-
-AC_DEFUN([gl_SYS_SELECT_MODULE_INDICATOR],
-[
-  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
-  AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS])
-  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
-  dnl Define it also as a C macro, for the benefit of the unit tests.
-  gl_MODULE_INDICATOR_FOR_TESTS([$1])
-])
-
-AC_DEFUN([gl_SYS_SELECT_H_DEFAULTS],
-[
-  GNULIB_PSELECT=0; AC_SUBST([GNULIB_PSELECT])
-  GNULIB_SELECT=0; AC_SUBST([GNULIB_SELECT])
-  dnl Assume proper GNU behavior unless another module says otherwise.
-  HAVE_PSELECT=1; AC_SUBST([HAVE_PSELECT])
-  REPLACE_PSELECT=0; AC_SUBST([REPLACE_PSELECT])
-  REPLACE_SELECT=0; AC_SUBST([REPLACE_SELECT])
-])
diff --git a/gl/recv.c b/gl/recv.c
deleted file mode 100644 (file)
index 107cd13..0000000
--- a/gl/recv.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* recv.c --- wrappers for Windows recv function
-
-   Copyright (C) 2008-2014 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.1 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);
-
-  if (sock == INVALID_SOCKET)
-    {
-      errno = EBADF;
-      return -1;
-    }
-  else
-    {
-      int r = recv (sock, buf, len, flags);
-      if (r < 0)
-        set_winsock_errno ();
-
-      return r;
-    }
-}
diff --git a/gl/recvfrom.c b/gl/recvfrom.c
deleted file mode 100644 (file)
index 1748abd..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/* recvfrom.c --- wrappers for Windows recvfrom function
-
-   Copyright (C) 2008-2014 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.1 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)
-{
-  SOCKET sock = FD_TO_SOCKET (fd);
-
-  if (sock == INVALID_SOCKET)
-    {
-      errno = EBADF;
-      return -1;
-    }
-  else
-    {
-      int frombufsize = (from != NULL ? *fromlen : 0);
-      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/gl/select.c b/gl/select.c
deleted file mode 100644 (file)
index 1c8fd70..0000000
+++ /dev/null
@@ -1,547 +0,0 @@
-/* Emulation for select(2)
-   Contributed by Paolo Bonzini.
-
-   Copyright 2008-2014 Free Software Foundation, Inc.
-
-   This file is part of gnulib.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU Lesser General Public License as published by
-   the Free Software Foundation; either version 2.1, 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>
-#include <alloca.h>
-#include <assert.h>
-
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* Native Windows.  */
-
-#include <sys/types.h>
-#include <errno.h>
-#include <limits.h>
-
-#include <winsock2.h>
-#include <windows.h>
-#include <io.h>
-#include <stdio.h>
-#include <conio.h>
-#include <time.h>
-
-/* Get the overridden 'struct timeval'.  */
-#include <sys/time.h>
-
-#include "msvc-nothrow.h"
-
-#undef select
-
-struct bitset {
-  unsigned char in[FD_SETSIZE / CHAR_BIT];
-  unsigned char out[FD_SETSIZE / CHAR_BIT];
-};
-
-/* Declare data structures for ntdll functions.  */
-typedef struct _FILE_PIPE_LOCAL_INFORMATION {
-  ULONG NamedPipeType;
-  ULONG NamedPipeConfiguration;
-  ULONG MaximumInstances;
-  ULONG CurrentInstances;
-  ULONG InboundQuota;
-  ULONG ReadDataAvailable;
-  ULONG OutboundQuota;
-  ULONG WriteQuotaAvailable;
-  ULONG NamedPipeState;
-  ULONG NamedPipeEnd;
-} FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION;
-
-typedef struct _IO_STATUS_BLOCK
-{
-  union {
-    DWORD Status;
-    PVOID Pointer;
-  } u;
-  ULONG_PTR Information;
-} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
-
-typedef enum _FILE_INFORMATION_CLASS {
-  FilePipeLocalInformation = 24
-} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
-
-typedef DWORD (WINAPI *PNtQueryInformationFile)
-         (HANDLE, IO_STATUS_BLOCK *, VOID *, ULONG, FILE_INFORMATION_CLASS);
-
-#ifndef PIPE_BUF
-#define PIPE_BUF        512
-#endif
-
-/* Optimized test whether a HANDLE refers to a console.
-   See <http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00065.html>.  */
-#define IsConsoleHandle(h) (((intptr_t) (h) & 3) == 3)
-
-static BOOL
-IsSocketHandle (HANDLE h)
-{
-  WSANETWORKEVENTS ev;
-
-  if (IsConsoleHandle (h))
-    return FALSE;
-
-  /* Under Wine, it seems that getsockopt returns 0 for pipes too.
-     WSAEnumNetworkEvents instead distinguishes the two correctly.  */
-  ev.lNetworkEvents = 0xDEADBEEF;
-  WSAEnumNetworkEvents ((SOCKET) h, NULL, &ev);
-  return ev.lNetworkEvents != 0xDEADBEEF;
-}
-
-/* Compute output fd_sets for libc descriptor FD (whose Windows handle is
-   H).  */
-
-static int
-windows_poll_handle (HANDLE h, int fd,
-                     struct bitset *rbits,
-                     struct bitset *wbits,
-                     struct bitset *xbits)
-{
-  BOOL read, write, except;
-  int i, ret;
-  INPUT_RECORD *irbuffer;
-  DWORD avail, nbuffer;
-  BOOL bRet;
-  IO_STATUS_BLOCK iosb;
-  FILE_PIPE_LOCAL_INFORMATION fpli;
-  static PNtQueryInformationFile NtQueryInformationFile;
-  static BOOL once_only;
-
-  read = write = except = FALSE;
-  switch (GetFileType (h))
-    {
-    case FILE_TYPE_DISK:
-      read = TRUE;
-      write = TRUE;
-      break;
-
-    case FILE_TYPE_PIPE:
-      if (!once_only)
-        {
-          NtQueryInformationFile = (PNtQueryInformationFile)
-            GetProcAddress (GetModuleHandle ("ntdll.dll"),
-                            "NtQueryInformationFile");
-          once_only = TRUE;
-        }
-
-      if (PeekNamedPipe (h, NULL, 0, NULL, &avail, NULL) != 0)
-        {
-          if (avail)
-            read = TRUE;
-        }
-      else if (GetLastError () == ERROR_BROKEN_PIPE)
-        ;
-
-      else
-        {
-          /* It was the write-end of the pipe.  Check if it is writable.
-             If NtQueryInformationFile fails, optimistically assume the pipe is
-             writable.  This could happen on Windows 9x, where
-             NtQueryInformationFile is not available, or if we inherit a pipe
-             that doesn't permit FILE_READ_ATTRIBUTES access on the write end
-             (I think this should not happen since Windows XP SP2; WINE seems
-             fine too).  Otherwise, ensure that enough space is available for
-             atomic writes.  */
-          memset (&iosb, 0, sizeof (iosb));
-          memset (&fpli, 0, sizeof (fpli));
-
-          if (!NtQueryInformationFile
-              || NtQueryInformationFile (h, &iosb, &fpli, sizeof (fpli),
-                                         FilePipeLocalInformation)
-              || fpli.WriteQuotaAvailable >= PIPE_BUF
-              || (fpli.OutboundQuota < PIPE_BUF &&
-                  fpli.WriteQuotaAvailable == fpli.OutboundQuota))
-            write = TRUE;
-        }
-      break;
-
-    case FILE_TYPE_CHAR:
-      write = TRUE;
-      if (!(rbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1)))))
-        break;
-
-      ret = WaitForSingleObject (h, 0);
-      if (ret == WAIT_OBJECT_0)
-        {
-          if (!IsConsoleHandle (h))
-            {
-              read = TRUE;
-              break;
-            }
-
-          nbuffer = avail = 0;
-          bRet = GetNumberOfConsoleInputEvents (h, &nbuffer);
-
-          /* Screen buffers handles are filtered earlier.  */
-          assert (bRet);
-          if (nbuffer == 0)
-            {
-              except = TRUE;
-              break;
-            }
-
-          irbuffer = (INPUT_RECORD *) alloca (nbuffer * sizeof (INPUT_RECORD));
-          bRet = PeekConsoleInput (h, irbuffer, nbuffer, &avail);
-          if (!bRet || avail == 0)
-            {
-              except = TRUE;
-              break;
-            }
-
-          for (i = 0; i < avail; i++)
-            if (irbuffer[i].EventType == KEY_EVENT)
-              read = TRUE;
-        }
-      break;
-
-    default:
-      ret = WaitForSingleObject (h, 0);
-      write = TRUE;
-      if (ret == WAIT_OBJECT_0)
-        read = TRUE;
-
-      break;
-    }
-
-  ret = 0;
-  if (read && (rbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1)))))
-    {
-      rbits->out[fd / CHAR_BIT] |= (1 << (fd & (CHAR_BIT - 1)));
-      ret++;
-    }
-
-  if (write && (wbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1)))))
-    {
-      wbits->out[fd / CHAR_BIT] |= (1 << (fd & (CHAR_BIT - 1)));
-      ret++;
-    }
-
-  if (except && (xbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1)))))
-    {
-      xbits->out[fd / CHAR_BIT] |= (1 << (fd & (CHAR_BIT - 1)));
-      ret++;
-    }
-
-  return ret;
-}
-
-int
-rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
-            struct timeval *timeout)
-#undef timeval
-{
-  static struct timeval tv0;
-  static HANDLE hEvent;
-  HANDLE h, handle_array[FD_SETSIZE + 2];
-  fd_set handle_rfds, handle_wfds, handle_xfds;
-  struct bitset rbits, wbits, xbits;
-  unsigned char anyfds_in[FD_SETSIZE / CHAR_BIT];
-  DWORD ret, wait_timeout, nhandles, nsock, nbuffer;
-  MSG msg;
-  int i, fd, rc;
-
-  if (nfds > FD_SETSIZE)
-    nfds = FD_SETSIZE;
-
-  if (!timeout)
-    wait_timeout = INFINITE;
-  else
-    {
-      wait_timeout = timeout->tv_sec * 1000 + timeout->tv_usec / 1000;
-
-      /* select is also used as a portable usleep.  */
-      if (!rfds && !wfds && !xfds)
-        {
-          Sleep (wait_timeout);
-          return 0;
-        }
-    }
-
-  if (!hEvent)
-    hEvent = CreateEvent (NULL, FALSE, FALSE, NULL);
-
-  handle_array[0] = hEvent;
-  nhandles = 1;
-  nsock = 0;
-
-  /* Copy descriptors to bitsets.  At the same time, eliminate
-     bits in the "wrong" direction for console input buffers
-     and screen buffers, because screen buffers are waitable
-     and they will block until a character is available.  */
-  memset (&rbits, 0, sizeof (rbits));
-  memset (&wbits, 0, sizeof (wbits));
-  memset (&xbits, 0, sizeof (xbits));
-  memset (anyfds_in, 0, sizeof (anyfds_in));
-  if (rfds)
-    for (i = 0; i < rfds->fd_count; i++)
-      {
-        fd = rfds->fd_array[i];
-        h = (HANDLE) _get_osfhandle (fd);
-        if (IsConsoleHandle (h)
-            && !GetNumberOfConsoleInputEvents (h, &nbuffer))
-          continue;
-
-        rbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
-        anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
-      }
-  else
-    rfds = (fd_set *) alloca (sizeof (fd_set));
-
-  if (wfds)
-    for (i = 0; i < wfds->fd_count; i++)
-      {
-        fd = wfds->fd_array[i];
-        h = (HANDLE) _get_osfhandle (fd);
-        if (IsConsoleHandle (h)
-            && GetNumberOfConsoleInputEvents (h, &nbuffer))
-          continue;
-
-        wbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
-        anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
-      }
-  else
-    wfds = (fd_set *) alloca (sizeof (fd_set));
-
-  if (xfds)
-    for (i = 0; i < xfds->fd_count; i++)
-      {
-        fd = xfds->fd_array[i];
-        xbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
-        anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
-      }
-  else
-    xfds = (fd_set *) alloca (sizeof (fd_set));
-
-  /* Zero all the fd_sets, including the application's.  */
-  FD_ZERO (rfds);
-  FD_ZERO (wfds);
-  FD_ZERO (xfds);
-  FD_ZERO (&handle_rfds);
-  FD_ZERO (&handle_wfds);
-  FD_ZERO (&handle_xfds);
-
-  /* Classify handles.  Create fd sets for sockets, poll the others. */
-  for (i = 0; i < nfds; i++)
-    {
-      if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0)
-        continue;
-
-      h = (HANDLE) _get_osfhandle (i);
-      if (!h)
-        {
-          errno = EBADF;
-          return -1;
-        }
-
-      if (IsSocketHandle (h))
-        {
-          int requested = FD_CLOSE;
-
-          /* See above; socket handles are mapped onto select, but we
-             need to map descriptors to handles.  */
-          if (rbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
-            {
-              requested |= FD_READ | FD_ACCEPT;
-              FD_SET ((SOCKET) h, rfds);
-              FD_SET ((SOCKET) h, &handle_rfds);
-            }
-          if (wbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
-            {
-              requested |= FD_WRITE | FD_CONNECT;
-              FD_SET ((SOCKET) h, wfds);
-              FD_SET ((SOCKET) h, &handle_wfds);
-            }
-          if (xbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
-            {
-              requested |= FD_OOB;
-              FD_SET ((SOCKET) h, xfds);
-              FD_SET ((SOCKET) h, &handle_xfds);
-            }
-
-          WSAEventSelect ((SOCKET) h, hEvent, requested);
-          nsock++;
-        }
-      else
-        {
-          handle_array[nhandles++] = h;
-
-          /* Poll now.  If we get an event, do not wait below.  */
-          if (wait_timeout != 0
-              && windows_poll_handle (h, i, &rbits, &wbits, &xbits))
-            wait_timeout = 0;
-        }
-    }
-
-  /* Place a sentinel at the end of the array.  */
-  handle_array[nhandles] = NULL;
-
-restart:
-  if (wait_timeout == 0 || nsock == 0)
-    rc = 0;
-  else
-    {
-      /* See if we need to wait in the loop below.  If any select is ready,
-         do MsgWaitForMultipleObjects anyway to dispatch messages, but
-         no need to call select again.  */
-      rc = select (0, &handle_rfds, &handle_wfds, &handle_xfds, &tv0);
-      if (rc == 0)
-        {
-          /* Restore the fd_sets for the other select we do below.  */
-          memcpy (&handle_rfds, rfds, sizeof (fd_set));
-          memcpy (&handle_wfds, wfds, sizeof (fd_set));
-          memcpy (&handle_xfds, xfds, sizeof (fd_set));
-        }
-      else
-        wait_timeout = 0;
-    }
-
-  for (;;)
-    {
-      ret = MsgWaitForMultipleObjects (nhandles, handle_array, FALSE,
-                                       wait_timeout, QS_ALLINPUT);
-
-      if (ret == WAIT_OBJECT_0 + nhandles)
-        {
-          /* new input of some other kind */
-          BOOL bRet;
-          while ((bRet = PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) != 0)
-            {
-              TranslateMessage (&msg);
-              DispatchMessage (&msg);
-            }
-        }
-      else
-        break;
-    }
-
-  /* If we haven't done it yet, check the status of the sockets.  */
-  if (rc == 0 && nsock > 0)
-    rc = select (0, &handle_rfds, &handle_wfds, &handle_xfds, &tv0);
-
-  if (nhandles > 1)
-    {
-      /* Count results that are not counted in the return value of select.  */
-      nhandles = 1;
-      for (i = 0; i < nfds; i++)
-        {
-          if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0)
-            continue;
-
-          h = (HANDLE) _get_osfhandle (i);
-          if (h == handle_array[nhandles])
-            {
-              /* Not a socket.  */
-              nhandles++;
-              windows_poll_handle (h, i, &rbits, &wbits, &xbits);
-              if (rbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))
-                  || wbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))
-                  || xbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
-                rc++;
-            }
-        }
-
-      if (rc == 0 && wait_timeout == INFINITE)
-        {
-          /* Sleep 1 millisecond to avoid busy wait and retry with the
-             original fd_sets.  */
-          memcpy (&handle_rfds, rfds, sizeof (fd_set));
-          memcpy (&handle_wfds, wfds, sizeof (fd_set));
-          memcpy (&handle_xfds, xfds, sizeof (fd_set));
-          SleepEx (1, TRUE);
-          goto restart;
-        }
-    }
-
-  /* Now fill in the results.  */
-  FD_ZERO (rfds);
-  FD_ZERO (wfds);
-  FD_ZERO (xfds);
-  nhandles = 1;
-  for (i = 0; i < nfds; i++)
-    {
-      if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0)
-        continue;
-
-      h = (HANDLE) _get_osfhandle (i);
-      if (h != handle_array[nhandles])
-        {
-          /* Perform handle->descriptor mapping.  */
-          WSAEventSelect ((SOCKET) h, NULL, 0);
-          if (FD_ISSET (h, &handle_rfds))
-            FD_SET (i, rfds);
-          if (FD_ISSET (h, &handle_wfds))
-            FD_SET (i, wfds);
-          if (FD_ISSET (h, &handle_xfds))
-            FD_SET (i, xfds);
-        }
-      else
-        {
-          /* Not a socket.  */
-          nhandles++;
-          if (rbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
-            FD_SET (i, rfds);
-          if (wbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
-            FD_SET (i, wfds);
-          if (xbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
-            FD_SET (i, xfds);
-        }
-    }
-
-  return rc;
-}
-
-#else /* ! Native Windows.  */
-
-#include <sys/select.h>
-#include <stddef.h> /* NULL */
-#include <errno.h>
-#include <unistd.h>
-
-#undef select
-
-int
-rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
-            struct timeval *timeout)
-{
-  int i;
-
-  /* FreeBSD 8.2 has a bug: it does not always detect invalid fds.  */
-  if (nfds < 0 || nfds > FD_SETSIZE)
-    {
-      errno = EINVAL;
-      return -1;
-    }
-  for (i = 0; i < nfds; i++)
-    {
-      if (((rfds && FD_ISSET (i, rfds))
-           || (wfds && FD_ISSET (i, wfds))
-           || (xfds && FD_ISSET (i, xfds)))
-          && dup2 (i, i) != i)
-        return -1;
-    }
-
-  /* Interix 3.5 has a bug: it does not support nfds == 0.  */
-  if (nfds == 0)
-    {
-      nfds = 1;
-      rfds = NULL;
-      wfds = NULL;
-      xfds = NULL;
-    }
-  return select (nfds, rfds, wfds, xfds, timeout);
-}
-
-#endif
diff --git a/gl/send.c b/gl/send.c
deleted file mode 100644 (file)
index 6c78d70..0000000
--- a/gl/send.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* send.c --- wrappers for Windows send function
-
-   Copyright (C) 2008-2014 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.1 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);
-
-  if (sock == INVALID_SOCKET)
-    {
-      errno = EBADF;
-      return -1;
-    }
-  else
-    {
-      int r = send (sock, buf, len, flags);
-      if (r < 0)
-        set_winsock_errno ();
-
-      return r;
-    }
-}
diff --git a/gl/sendto.c b/gl/sendto.c
deleted file mode 100644 (file)
index 7dc4ed3..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/* sendto.c --- wrappers for Windows sendto function
-
-   Copyright (C) 2008-2014 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.1 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);
-
-  if (sock == INVALID_SOCKET)
-    {
-      errno = EBADF;
-      return -1;
-    }
-  else
-    {
-      int r = sendto (sock, buf, len, flags, to, tolen);
-      if (r < 0)
-        set_winsock_errno ();
-
-      return r;
-    }
-}
diff --git a/gl/setsockopt.c b/gl/setsockopt.c
deleted file mode 100644 (file)
index 9c72d3f..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/* setsockopt.c --- wrappers for Windows setsockopt function
-
-   Copyright (C) 2008-2014 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.1 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)
-{
-  SOCKET sock = FD_TO_SOCKET (fd);
-  int r;
-
-  if (sock == INVALID_SOCKET)
-    {
-      errno = EBADF;
-      return -1;
-    }
-  else
-    {
-      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/gl/shutdown.c b/gl/shutdown.c
deleted file mode 100644 (file)
index 4fd7a1c..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* shutdown.c --- wrappers for Windows shutdown function
-
-   Copyright (C) 2008-2014 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.1 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);
-
-  if (sock == INVALID_SOCKET)
-    {
-      errno = EBADF;
-      return -1;
-    }
-  else
-    {
-      int r = shutdown (sock, how);
-      if (r < 0)
-        set_winsock_errno ();
-
-      return r;
-    }
-}
diff --git a/gl/signal.in.h b/gl/signal.in.h
deleted file mode 100644 (file)
index a6a4257..0000000
+++ /dev/null
@@ -1,461 +0,0 @@
-/* A GNU-like <signal.h>.
-
-   Copyright (C) 2006-2014 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.1 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/>.  */
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-#if defined __need_sig_atomic_t || defined __need_sigset_t || defined _GL_ALREADY_INCLUDING_SIGNAL_H || (defined _SIGNAL_H && !defined __SIZEOF_PTHREAD_MUTEX_T)
-/* Special invocation convention:
-   - Inside glibc header files.
-   - On glibc systems we have a sequence of nested includes
-     <signal.h> -> <ucontext.h> -> <signal.h>.
-     In this situation, the functions are not yet declared, therefore we cannot
-     provide the C++ aliases.
-   - On glibc systems with GCC 4.3 we have a sequence of nested includes
-     <csignal> -> </usr/include/signal.h> -> <sys/ucontext.h> -> <signal.h>.
-     In this situation, some of the functions are not yet declared, therefore
-     we cannot provide the C++ aliases.  */
-
-# @INCLUDE_NEXT@ @NEXT_SIGNAL_H@
-
-#else
-/* Normal invocation convention.  */
-
-#ifndef _@GUARD_PREFIX@_SIGNAL_H
-
-#define _GL_ALREADY_INCLUDING_SIGNAL_H
-
-/* Define pid_t, uid_t.
-   Also, mingw defines sigset_t not in <signal.h>, but in <sys/types.h>.
-   On Solaris 10, <signal.h> includes <sys/types.h>, which eventually includes
-   us; so include <sys/types.h> now, before the second inclusion guard.  */
-#include <sys/types.h>
-
-/* The include_next requires a split double-inclusion guard.  */
-#@INCLUDE_NEXT@ @NEXT_SIGNAL_H@
-
-#undef _GL_ALREADY_INCLUDING_SIGNAL_H
-
-#ifndef _@GUARD_PREFIX@_SIGNAL_H
-#define _@GUARD_PREFIX@_SIGNAL_H
-
-/* Mac OS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6 declare
-   pthread_sigmask in <pthread.h>, not in <signal.h>.
-   But avoid namespace pollution on glibc systems.*/
-#if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \
-    && ((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || defined __osf__ || defined __sun) \
-    && ! defined __GLIBC__
-# include <pthread.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.  */
-
-/* On AIX, sig_atomic_t already includes volatile.  C99 requires that
-   'volatile sig_atomic_t' ignore the extra modifier, but C89 did not.
-   Hence, redefine this to a non-volatile type as needed.  */
-#if ! @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@
-# if !GNULIB_defined_sig_atomic_t
-typedef int rpl_sig_atomic_t;
-#  undef sig_atomic_t
-#  define sig_atomic_t rpl_sig_atomic_t
-#  define GNULIB_defined_sig_atomic_t 1
-# endif
-#endif
-
-/* A set or mask of signals.  */
-#if !@HAVE_SIGSET_T@
-# if !GNULIB_defined_sigset_t
-typedef unsigned int sigset_t;
-#  define GNULIB_defined_sigset_t 1
-# endif
-#endif
-
-/* Define sighandler_t, the type of signal handlers.  A GNU extension.  */
-#if !@HAVE_SIGHANDLER_T@
-# ifdef __cplusplus
-extern "C" {
-# endif
-# if !GNULIB_defined_sighandler_t
-typedef void (*sighandler_t) (int);
-#  define GNULIB_defined_sighandler_t 1
-# endif
-# ifdef __cplusplus
-}
-# endif
-#endif
-
-
-#if @GNULIB_SIGNAL_H_SIGPIPE@
-# ifndef SIGPIPE
-/* Define SIGPIPE to a value that does not overlap with other signals.  */
-#  define SIGPIPE 13
-#  define GNULIB_defined_SIGPIPE 1
-/* To actually use SIGPIPE, you also need the gnulib modules 'sigprocmask',
-   'write', 'stdio'.  */
-# endif
-#endif
-
-
-/* Maximum signal number + 1.  */
-#ifndef NSIG
-# if defined __TANDEM
-#  define NSIG 32
-# endif
-#endif
-
-
-#if @GNULIB_PTHREAD_SIGMASK@
-# if @REPLACE_PTHREAD_SIGMASK@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef pthread_sigmask
-#   define pthread_sigmask rpl_pthread_sigmask
-#  endif
-_GL_FUNCDECL_RPL (pthread_sigmask, int,
-                  (int how, const sigset_t *new_mask, sigset_t *old_mask));
-_GL_CXXALIAS_RPL (pthread_sigmask, int,
-                  (int how, const sigset_t *new_mask, sigset_t *old_mask));
-# else
-#  if !@HAVE_PTHREAD_SIGMASK@
-_GL_FUNCDECL_SYS (pthread_sigmask, int,
-                  (int how, const sigset_t *new_mask, sigset_t *old_mask));
-#  endif
-_GL_CXXALIAS_SYS (pthread_sigmask, int,
-                  (int how, const sigset_t *new_mask, sigset_t *old_mask));
-# endif
-_GL_CXXALIASWARN (pthread_sigmask);
-#elif defined GNULIB_POSIXCHECK
-# undef pthread_sigmask
-# if HAVE_RAW_DECL_PTHREAD_SIGMASK
-_GL_WARN_ON_USE (pthread_sigmask, "pthread_sigmask is not portable - "
-                 "use gnulib module pthread_sigmask for portability");
-# endif
-#endif
-
-
-#if @GNULIB_RAISE@
-# if @REPLACE_RAISE@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef raise
-#   define raise rpl_raise
-#  endif
-_GL_FUNCDECL_RPL (raise, int, (int sig));
-_GL_CXXALIAS_RPL (raise, int, (int sig));
-# else
-#  if !@HAVE_RAISE@
-_GL_FUNCDECL_SYS (raise, int, (int sig));
-#  endif
-_GL_CXXALIAS_SYS (raise, int, (int sig));
-# endif
-_GL_CXXALIASWARN (raise);
-#elif defined GNULIB_POSIXCHECK
-# undef raise
-/* Assume raise is always declared.  */
-_GL_WARN_ON_USE (raise, "raise can crash on native Windows - "
-                 "use gnulib module raise for portability");
-#endif
-
-
-#if @GNULIB_SIGPROCMASK@
-# if !@HAVE_POSIX_SIGNALBLOCKING@
-
-#  ifndef GNULIB_defined_signal_blocking
-#   define GNULIB_defined_signal_blocking 1
-#  endif
-
-/* Maximum signal number + 1.  */
-#  ifndef NSIG
-#   define NSIG 32
-#  endif
-
-/* This code supports only 32 signals.  */
-#  if !GNULIB_defined_verify_NSIG_constraint
-typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1];
-#   define GNULIB_defined_verify_NSIG_constraint 1
-#  endif
-
-# endif
-
-/* When also using extern inline, suppress the use of static inline in
-   standard headers of problematic Apple configurations, as Libc at
-   least through Libc-825.26 (2013-04-09) mishandles it; see, e.g.,
-   <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>.
-   Perhaps Apple will fix this some day.  */
-#if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \
-     && (defined __i386__ || defined __x86_64__))
-# undef sigaddset
-# undef sigdelset
-# undef sigemptyset
-# undef sigfillset
-# undef sigismember
-#endif
-
-/* Test whether a given signal is contained in a signal set.  */
-# if @HAVE_POSIX_SIGNALBLOCKING@
-/* This function is defined as a macro on Mac OS X.  */
-#  if defined __cplusplus && defined GNULIB_NAMESPACE
-#   undef sigismember
-#  endif
-# else
-_GL_FUNCDECL_SYS (sigismember, int, (const sigset_t *set, int sig)
-                                    _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (sigismember, int, (const sigset_t *set, int sig));
-_GL_CXXALIASWARN (sigismember);
-
-/* Initialize a signal set to the empty set.  */
-# if @HAVE_POSIX_SIGNALBLOCKING@
-/* This function is defined as a macro on Mac OS X.  */
-#  if defined __cplusplus && defined GNULIB_NAMESPACE
-#   undef sigemptyset
-#  endif
-# else
-_GL_FUNCDECL_SYS (sigemptyset, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (sigemptyset, int, (sigset_t *set));
-_GL_CXXALIASWARN (sigemptyset);
-
-/* Add a signal to a signal set.  */
-# if @HAVE_POSIX_SIGNALBLOCKING@
-/* This function is defined as a macro on Mac OS X.  */
-#  if defined __cplusplus && defined GNULIB_NAMESPACE
-#   undef sigaddset
-#  endif
-# else
-_GL_FUNCDECL_SYS (sigaddset, int, (sigset_t *set, int sig)
-                                  _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (sigaddset, int, (sigset_t *set, int sig));
-_GL_CXXALIASWARN (sigaddset);
-
-/* Remove a signal from a signal set.  */
-# if @HAVE_POSIX_SIGNALBLOCKING@
-/* This function is defined as a macro on Mac OS X.  */
-#  if defined __cplusplus && defined GNULIB_NAMESPACE
-#   undef sigdelset
-#  endif
-# else
-_GL_FUNCDECL_SYS (sigdelset, int, (sigset_t *set, int sig)
-                                  _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (sigdelset, int, (sigset_t *set, int sig));
-_GL_CXXALIASWARN (sigdelset);
-
-/* Fill a signal set with all possible signals.  */
-# if @HAVE_POSIX_SIGNALBLOCKING@
-/* This function is defined as a macro on Mac OS X.  */
-#  if defined __cplusplus && defined GNULIB_NAMESPACE
-#   undef sigfillset
-#  endif
-# else
-_GL_FUNCDECL_SYS (sigfillset, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (sigfillset, int, (sigset_t *set));
-_GL_CXXALIASWARN (sigfillset);
-
-/* Return the set of those blocked signals that are pending.  */
-# if !@HAVE_POSIX_SIGNALBLOCKING@
-_GL_FUNCDECL_SYS (sigpending, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (sigpending, int, (sigset_t *set));
-_GL_CXXALIASWARN (sigpending);
-
-/* If OLD_SET is not NULL, put the current set of blocked signals in *OLD_SET.
-   Then, if SET is not NULL, affect the current set of blocked signals by
-   combining it with *SET as indicated in OPERATION.
-   In this implementation, you are not allowed to change a signal handler
-   while the signal is blocked.  */
-# if !@HAVE_POSIX_SIGNALBLOCKING@
-#  define SIG_BLOCK   0  /* blocked_set = blocked_set | *set; */
-#  define SIG_SETMASK 1  /* blocked_set = *set; */
-#  define SIG_UNBLOCK 2  /* blocked_set = blocked_set & ~*set; */
-_GL_FUNCDECL_SYS (sigprocmask, int,
-                  (int operation, const sigset_t *set, sigset_t *old_set));
-# endif
-_GL_CXXALIAS_SYS (sigprocmask, int,
-                  (int operation, const sigset_t *set, sigset_t *old_set));
-_GL_CXXALIASWARN (sigprocmask);
-
-/* Install the handler FUNC for signal SIG, and return the previous
-   handler.  */
-# ifdef __cplusplus
-extern "C" {
-# endif
-# if !GNULIB_defined_function_taking_int_returning_void_t
-typedef void (*_gl_function_taking_int_returning_void_t) (int);
-#  define GNULIB_defined_function_taking_int_returning_void_t 1
-# endif
-# ifdef __cplusplus
-}
-# endif
-# if !@HAVE_POSIX_SIGNALBLOCKING@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define signal rpl_signal
-#  endif
-_GL_FUNCDECL_RPL (signal, _gl_function_taking_int_returning_void_t,
-                  (int sig, _gl_function_taking_int_returning_void_t func));
-_GL_CXXALIAS_RPL (signal, _gl_function_taking_int_returning_void_t,
-                  (int sig, _gl_function_taking_int_returning_void_t func));
-# else
-_GL_CXXALIAS_SYS (signal, _gl_function_taking_int_returning_void_t,
-                  (int sig, _gl_function_taking_int_returning_void_t func));
-# endif
-_GL_CXXALIASWARN (signal);
-
-# if !@HAVE_POSIX_SIGNALBLOCKING@ && GNULIB_defined_SIGPIPE
-/* Raise signal SIGPIPE.  */
-_GL_EXTERN_C int _gl_raise_SIGPIPE (void);
-# endif
-
-#elif defined GNULIB_POSIXCHECK
-# undef sigaddset
-# if HAVE_RAW_DECL_SIGADDSET
-_GL_WARN_ON_USE (sigaddset, "sigaddset is unportable - "
-                 "use the gnulib module sigprocmask for portability");
-# endif
-# undef sigdelset
-# if HAVE_RAW_DECL_SIGDELSET
-_GL_WARN_ON_USE (sigdelset, "sigdelset is unportable - "
-                 "use the gnulib module sigprocmask for portability");
-# endif
-# undef sigemptyset
-# if HAVE_RAW_DECL_SIGEMPTYSET
-_GL_WARN_ON_USE (sigemptyset, "sigemptyset is unportable - "
-                 "use the gnulib module sigprocmask for portability");
-# endif
-# undef sigfillset
-# if HAVE_RAW_DECL_SIGFILLSET
-_GL_WARN_ON_USE (sigfillset, "sigfillset is unportable - "
-                 "use the gnulib module sigprocmask for portability");
-# endif
-# undef sigismember
-# if HAVE_RAW_DECL_SIGISMEMBER
-_GL_WARN_ON_USE (sigismember, "sigismember is unportable - "
-                 "use the gnulib module sigprocmask for portability");
-# endif
-# undef sigpending
-# if HAVE_RAW_DECL_SIGPENDING
-_GL_WARN_ON_USE (sigpending, "sigpending is unportable - "
-                 "use the gnulib module sigprocmask for portability");
-# endif
-# undef sigprocmask
-# if HAVE_RAW_DECL_SIGPROCMASK
-_GL_WARN_ON_USE (sigprocmask, "sigprocmask is unportable - "
-                 "use the gnulib module sigprocmask for portability");
-# endif
-#endif /* @GNULIB_SIGPROCMASK@ */
-
-
-#if @GNULIB_SIGACTION@
-# if !@HAVE_SIGACTION@
-
-#  if !@HAVE_SIGINFO_T@
-
-#   if !GNULIB_defined_siginfo_types
-
-/* Present to allow compilation, but unsupported by gnulib.  */
-union sigval
-{
-  int sival_int;
-  void *sival_ptr;
-};
-
-/* Present to allow compilation, but unsupported by gnulib.  */
-struct siginfo_t
-{
-  int si_signo;
-  int si_code;
-  int si_errno;
-  pid_t si_pid;
-  uid_t si_uid;
-  void *si_addr;
-  int si_status;
-  long si_band;
-  union sigval si_value;
-};
-typedef struct siginfo_t siginfo_t;
-
-#    define GNULIB_defined_siginfo_types 1
-#   endif
-
-#  endif /* !@HAVE_SIGINFO_T@ */
-
-/* We assume that platforms which lack the sigaction() function also lack
-   the 'struct sigaction' type, and vice versa.  */
-
-#  if !GNULIB_defined_struct_sigaction
-
-struct sigaction
-{
-  union
-  {
-    void (*_sa_handler) (int);
-    /* Present to allow compilation, but unsupported by gnulib.  POSIX
-       says that implementations may, but not must, make sa_sigaction
-       overlap with sa_handler, but we know of no implementation where
-       they do not overlap.  */
-    void (*_sa_sigaction) (int, siginfo_t *, void *);
-  } _sa_func;
-  sigset_t sa_mask;
-  /* Not all POSIX flags are supported.  */
-  int sa_flags;
-};
-#   define sa_handler _sa_func._sa_handler
-#   define sa_sigaction _sa_func._sa_sigaction
-/* Unsupported flags are not present.  */
-#   define SA_RESETHAND 1
-#   define SA_NODEFER 2
-#   define SA_RESTART 4
-
-#   define GNULIB_defined_struct_sigaction 1
-#  endif
-
-_GL_FUNCDECL_SYS (sigaction, int, (int, const struct sigaction *restrict,
-                                   struct sigaction *restrict));
-
-# elif !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@
-
-#  define sa_sigaction sa_handler
-
-# endif /* !@HAVE_SIGACTION@, !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@ */
-
-_GL_CXXALIAS_SYS (sigaction, int, (int, const struct sigaction *restrict,
-                                   struct sigaction *restrict));
-_GL_CXXALIASWARN (sigaction);
-
-#elif defined GNULIB_POSIXCHECK
-# undef sigaction
-# if HAVE_RAW_DECL_SIGACTION
-_GL_WARN_ON_USE (sigaction, "sigaction is unportable - "
-                 "use the gnulib module sigaction for portability");
-# endif
-#endif
-
-/* Some systems don't have SA_NODEFER.  */
-#ifndef SA_NODEFER
-# define SA_NODEFER 0
-#endif
-
-
-#endif /* _@GUARD_PREFIX@_SIGNAL_H */
-#endif /* _@GUARD_PREFIX@_SIGNAL_H */
-#endif
diff --git a/gl/socket.c b/gl/socket.c
deleted file mode 100644 (file)
index a3e6e68..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* socket.c --- wrappers for Windows socket function
-
-   Copyright (C) 2008-2014 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.1 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/gl/sockets.c b/gl/sockets.c
deleted file mode 100644 (file)
index 62c51c4..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/* sockets.c --- wrappers for Windows socket functions
-
-   Copyright (C) 2008-2014 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.1 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 Simon Josefsson */
-
-#include <config.h>
-
-/* Specification.  */
-#include "sockets.h"
-
-#if WINDOWS_SOCKETS
-
-/* This includes winsock2.h on MinGW. */
-# include <sys/socket.h>
-
-# include "fd-hook.h"
-# include "msvc-nothrow.h"
-
-/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-# include "w32sock.h"
-
-static int
-close_fd_maybe_socket (const struct fd_hook *remaining_list,
-                       gl_close_fn primary,
-                       int fd)
-{
-  /* Note about multithread-safety: There is a race condition where, between
-     our calls to closesocket() and the primary close(), some other thread
-     could make system calls that allocate precisely the same HANDLE value
-     as sock; then the primary close() would call CloseHandle() on it.  */
-  SOCKET sock;
-  WSANETWORKEVENTS ev;
-
-  /* Test whether fd refers to a socket.  */
-  sock = FD_TO_SOCKET (fd);
-  ev.lNetworkEvents = 0xDEADBEEF;
-  WSAEnumNetworkEvents (sock, NULL, &ev);
-  if (ev.lNetworkEvents != 0xDEADBEEF)
-    {
-      /* fd refers to a socket.  */
-      /* FIXME: other applications, like squid, use an undocumented
-         _free_osfhnd free function.  But this is not enough: The 'osfile'
-         flags for fd also needs to be cleared, but it is hard to access it.
-         Instead, here we just close twice the file descriptor.  */
-      if (closesocket (sock))
-        {
-          set_winsock_errno ();
-          return -1;
-        }
-      else
-        {
-          /* This call frees the file descriptor and does a
-             CloseHandle ((HANDLE) _get_osfhandle (fd)), which fails.  */
-          _close (fd);
-          return 0;
-        }
-    }
-  else
-    /* Some other type of file descriptor.  */
-    return execute_close_hooks (remaining_list, primary, fd);
-}
-
-static int
-ioctl_fd_maybe_socket (const struct fd_hook *remaining_list,
-                       gl_ioctl_fn primary,
-                       int fd, int request, void *arg)
-{
-  SOCKET sock;
-  WSANETWORKEVENTS ev;
-
-  /* Test whether fd refers to a socket.  */
-  sock = FD_TO_SOCKET (fd);
-  ev.lNetworkEvents = 0xDEADBEEF;
-  WSAEnumNetworkEvents (sock, NULL, &ev);
-  if (ev.lNetworkEvents != 0xDEADBEEF)
-    {
-      /* fd refers to a socket.  */
-      if (ioctlsocket (sock, request, arg) < 0)
-        {
-          set_winsock_errno ();
-          return -1;
-        }
-      else
-        return 0;
-    }
-  else
-    /* Some other type of file descriptor.  */
-    return execute_ioctl_hooks (remaining_list, primary, fd, request, arg);
-}
-
-static struct fd_hook fd_sockets_hook;
-
-static int initialized_sockets_version /* = 0 */;
-
-#endif /* WINDOWS_SOCKETS */
-
-int
-gl_sockets_startup (int version _GL_UNUSED)
-{
-#if WINDOWS_SOCKETS
-  if (version > initialized_sockets_version)
-    {
-      WSADATA data;
-      int err;
-
-      err = WSAStartup (version, &data);
-      if (err != 0)
-        return 1;
-
-      if (data.wVersion < version)
-        return 2;
-
-      if (initialized_sockets_version == 0)
-        register_fd_hook (close_fd_maybe_socket, ioctl_fd_maybe_socket,
-                          &fd_sockets_hook);
-
-      initialized_sockets_version = version;
-    }
-#endif
-
-  return 0;
-}
-
-int
-gl_sockets_cleanup (void)
-{
-#if WINDOWS_SOCKETS
-  int err;
-
-  initialized_sockets_version = 0;
-
-  unregister_fd_hook (&fd_sockets_hook);
-
-  err = WSACleanup ();
-  if (err != 0)
-    return 1;
-#endif
-
-  return 0;
-}
diff --git a/gl/sockets.h b/gl/sockets.h
deleted file mode 100644 (file)
index 8778cf5..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/* sockets.h - wrappers for Windows socket functions
-
-   Copyright (C) 2008-2014 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.1 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 Simon Josefsson */
-
-#ifndef SOCKETS_H
-# define SOCKETS_H 1
-
-#define SOCKETS_1_0 0x100  /* don't use - does not work on Windows XP */
-#define SOCKETS_1_1 0x101
-#define SOCKETS_2_0 0x200  /* don't use - does not work on Windows XP */
-#define SOCKETS_2_1 0x201
-#define SOCKETS_2_2 0x202
-
-int gl_sockets_startup (int version)
-#if !WINDOWS_SOCKETS
-  _GL_ATTRIBUTE_CONST
-#endif
-  ;
-
-int gl_sockets_cleanup (void)
-#if !WINDOWS_SOCKETS
-  _GL_ATTRIBUTE_CONST
-#endif
-  ;
-
-/* This function is useful it you create a socket using gnulib's
-   Winsock wrappers but needs to pass on the socket handle to some
-   other library that only accepts sockets. */
-#if WINDOWS_SOCKETS
-
-#include <sys/socket.h>
-
-#include "msvc-nothrow.h"
-
-static inline SOCKET
-gl_fd_to_handle (int fd)
-{
-  return _get_osfhandle (fd);
-}
-
-#else
-
-#define gl_fd_to_handle(x) (x)
-
-#endif /* WINDOWS_SOCKETS */
-
-#endif /* SOCKETS_H */
diff --git a/gl/strerror-override.c b/gl/strerror-override.c
deleted file mode 100644 (file)
index 16947af..0000000
+++ /dev/null
@@ -1,302 +0,0 @@
-/* strerror-override.c --- POSIX compatible system error routine
-
-   Copyright (C) 2010-2014 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.1 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>, 2010.  */
-
-#include <config.h>
-
-#include "strerror-override.h"
-
-#include <errno.h>
-
-#if GNULIB_defined_EWINSOCK /* native Windows platforms */
-# if HAVE_WINSOCK2_H
-#  include <winsock2.h>
-# endif
-#endif
-
-/* If ERRNUM maps to an errno value defined by gnulib, return a string
-   describing the error.  Otherwise return NULL.  */
-const char *
-strerror_override (int errnum)
-{
-  /* These error messages are taken from glibc/sysdeps/gnu/errlist.c.  */
-  switch (errnum)
-    {
-#if REPLACE_STRERROR_0
-    case 0:
-      return "Success";
-#endif
-
-#if GNULIB_defined_ESOCK /* native Windows platforms with older <errno.h> */
-    case EINPROGRESS:
-      return "Operation now in progress";
-    case EALREADY:
-      return "Operation already in progress";
-    case ENOTSOCK:
-      return "Socket operation on non-socket";
-    case EDESTADDRREQ:
-      return "Destination address required";
-    case EMSGSIZE:
-      return "Message too long";
-    case EPROTOTYPE:
-      return "Protocol wrong type for socket";
-    case ENOPROTOOPT:
-      return "Protocol not available";
-    case EPROTONOSUPPORT:
-      return "Protocol not supported";
-    case EOPNOTSUPP:
-      return "Operation not supported";
-    case EAFNOSUPPORT:
-      return "Address family not supported by protocol";
-    case EADDRINUSE:
-      return "Address already in use";
-    case EADDRNOTAVAIL:
-      return "Cannot assign requested address";
-    case ENETDOWN:
-      return "Network is down";
-    case ENETUNREACH:
-      return "Network is unreachable";
-    case ECONNRESET:
-      return "Connection reset by peer";
-    case ENOBUFS:
-      return "No buffer space available";
-    case EISCONN:
-      return "Transport endpoint is already connected";
-    case ENOTCONN:
-      return "Transport endpoint is not connected";
-    case ETIMEDOUT:
-      return "Connection timed out";
-    case ECONNREFUSED:
-      return "Connection refused";
-    case ELOOP:
-      return "Too many levels of symbolic links";
-    case EHOSTUNREACH:
-      return "No route to host";
-    case EWOULDBLOCK:
-      return "Operation would block";
-#endif
-#if GNULIB_defined_ESTREAMS /* native Windows platforms with older <errno.h> */
-    case ETXTBSY:
-      return "Text file busy";
-    case ENODATA:
-      return "No data available";
-    case ENOSR:
-      return "Out of streams resources";
-    case ENOSTR:
-      return "Device not a stream";
-    case ETIME:
-      return "Timer expired";
-    case EOTHER:
-      return "Other error";
-#endif
-#if GNULIB_defined_EWINSOCK /* native Windows platforms */
-    case ESOCKTNOSUPPORT:
-      return "Socket type not supported";
-    case EPFNOSUPPORT:
-      return "Protocol family not supported";
-    case ESHUTDOWN:
-      return "Cannot send after transport endpoint shutdown";
-    case ETOOMANYREFS:
-      return "Too many references: cannot splice";
-    case EHOSTDOWN:
-      return "Host is down";
-    case EPROCLIM:
-      return "Too many processes";
-    case EUSERS:
-      return "Too many users";
-    case EDQUOT:
-      return "Disk quota exceeded";
-    case ESTALE:
-      return "Stale NFS file handle";
-    case EREMOTE:
-      return "Object is remote";
-# if HAVE_WINSOCK2_H
-      /* WSA_INVALID_HANDLE maps to EBADF */
-      /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */
-      /* WSA_INVALID_PARAMETER maps to EINVAL */
-    case WSA_OPERATION_ABORTED:
-      return "Overlapped operation aborted";
-    case WSA_IO_INCOMPLETE:
-      return "Overlapped I/O event object not in signaled state";
-    case WSA_IO_PENDING:
-      return "Overlapped operations will complete later";
-      /* WSAEINTR maps to EINTR */
-      /* WSAEBADF maps to EBADF */
-      /* WSAEACCES maps to EACCES */
-      /* WSAEFAULT maps to EFAULT */
-      /* WSAEINVAL maps to EINVAL */
-      /* WSAEMFILE maps to EMFILE */
-      /* WSAEWOULDBLOCK maps to EWOULDBLOCK */
-      /* WSAEINPROGRESS maps to EINPROGRESS */
-      /* WSAEALREADY maps to EALREADY */
-      /* WSAENOTSOCK maps to ENOTSOCK */
-      /* WSAEDESTADDRREQ maps to EDESTADDRREQ */
-      /* WSAEMSGSIZE maps to EMSGSIZE */
-      /* WSAEPROTOTYPE maps to EPROTOTYPE */
-      /* WSAENOPROTOOPT maps to ENOPROTOOPT */
-      /* WSAEPROTONOSUPPORT maps to EPROTONOSUPPORT */
-      /* WSAESOCKTNOSUPPORT is ESOCKTNOSUPPORT */
-      /* WSAEOPNOTSUPP maps to EOPNOTSUPP */
-      /* WSAEPFNOSUPPORT is EPFNOSUPPORT */
-      /* WSAEAFNOSUPPORT maps to EAFNOSUPPORT */
-      /* WSAEADDRINUSE maps to EADDRINUSE */
-      /* WSAEADDRNOTAVAIL maps to EADDRNOTAVAIL */
-      /* WSAENETDOWN maps to ENETDOWN */
-      /* WSAENETUNREACH maps to ENETUNREACH */
-      /* WSAENETRESET maps to ENETRESET */
-      /* WSAECONNABORTED maps to ECONNABORTED */
-      /* WSAECONNRESET maps to ECONNRESET */
-      /* WSAENOBUFS maps to ENOBUFS */
-      /* WSAEISCONN maps to EISCONN */
-      /* WSAENOTCONN maps to ENOTCONN */
-      /* WSAESHUTDOWN is ESHUTDOWN */
-      /* WSAETOOMANYREFS is ETOOMANYREFS */
-      /* WSAETIMEDOUT maps to ETIMEDOUT */
-      /* WSAECONNREFUSED maps to ECONNREFUSED */
-      /* WSAELOOP maps to ELOOP */
-      /* WSAENAMETOOLONG maps to ENAMETOOLONG */
-      /* WSAEHOSTDOWN is EHOSTDOWN */
-      /* WSAEHOSTUNREACH maps to EHOSTUNREACH */
-      /* WSAENOTEMPTY maps to ENOTEMPTY */
-      /* WSAEPROCLIM is EPROCLIM */
-      /* WSAEUSERS is EUSERS */
-      /* WSAEDQUOT is EDQUOT */
-      /* WSAESTALE is ESTALE */
-      /* WSAEREMOTE is EREMOTE */
-    case WSASYSNOTREADY:
-      return "Network subsystem is unavailable";
-    case WSAVERNOTSUPPORTED:
-      return "Winsock.dll version out of range";
-    case WSANOTINITIALISED:
-      return "Successful WSAStartup not yet performed";
-    case WSAEDISCON:
-      return "Graceful shutdown in progress";
-    case WSAENOMORE: case WSA_E_NO_MORE:
-      return "No more results";
-    case WSAECANCELLED: case WSA_E_CANCELLED:
-      return "Call was canceled";
-    case WSAEINVALIDPROCTABLE:
-      return "Procedure call table is invalid";
-    case WSAEINVALIDPROVIDER:
-      return "Service provider is invalid";
-    case WSAEPROVIDERFAILEDINIT:
-      return "Service provider failed to initialize";
-    case WSASYSCALLFAILURE:
-      return "System call failure";
-    case WSASERVICE_NOT_FOUND:
-      return "Service not found";
-    case WSATYPE_NOT_FOUND:
-      return "Class type not found";
-    case WSAEREFUSED:
-      return "Database query was refused";
-    case WSAHOST_NOT_FOUND:
-      return "Host not found";
-    case WSATRY_AGAIN:
-      return "Nonauthoritative host not found";
-    case WSANO_RECOVERY:
-      return "Nonrecoverable error";
-    case WSANO_DATA:
-      return "Valid name, no data record of requested type";
-      /* WSA_QOS_* omitted */
-# endif
-#endif
-
-#if GNULIB_defined_ENOMSG
-    case ENOMSG:
-      return "No message of desired type";
-#endif
-
-#if GNULIB_defined_EIDRM
-    case EIDRM:
-      return "Identifier removed";
-#endif
-
-#if GNULIB_defined_ENOLINK
-    case ENOLINK:
-      return "Link has been severed";
-#endif
-
-#if GNULIB_defined_EPROTO
-    case EPROTO:
-      return "Protocol error";
-#endif
-
-#if GNULIB_defined_EMULTIHOP
-    case EMULTIHOP:
-      return "Multihop attempted";
-#endif
-
-#if GNULIB_defined_EBADMSG
-    case EBADMSG:
-      return "Bad message";
-#endif
-
-#if GNULIB_defined_EOVERFLOW
-    case EOVERFLOW:
-      return "Value too large for defined data type";
-#endif
-
-#if GNULIB_defined_ENOTSUP
-    case ENOTSUP:
-      return "Not supported";
-#endif
-
-#if GNULIB_defined_ENETRESET
-    case ENETRESET:
-      return "Network dropped connection on reset";
-#endif
-
-#if GNULIB_defined_ECONNABORTED
-    case ECONNABORTED:
-      return "Software caused connection abort";
-#endif
-
-#if GNULIB_defined_ESTALE
-    case ESTALE:
-      return "Stale NFS file handle";
-#endif
-
-#if GNULIB_defined_EDQUOT
-    case EDQUOT:
-      return "Disk quota exceeded";
-#endif
-
-#if GNULIB_defined_ECANCELED
-    case ECANCELED:
-      return "Operation canceled";
-#endif
-
-#if GNULIB_defined_EOWNERDEAD
-    case EOWNERDEAD:
-      return "Owner died";
-#endif
-
-#if GNULIB_defined_ENOTRECOVERABLE
-    case ENOTRECOVERABLE:
-      return "State not recoverable";
-#endif
-
-#if GNULIB_defined_EILSEQ
-    case EILSEQ:
-      return "Invalid or incomplete multibyte or wide character";
-#endif
-
-    default:
-      return NULL;
-    }
-}
diff --git a/gl/strerror-override.h b/gl/strerror-override.h
deleted file mode 100644 (file)
index d4e741c..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/* strerror-override.h --- POSIX compatible system error routine
-
-   Copyright (C) 2010-2014 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.1 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef _GL_STRERROR_OVERRIDE_H
-# define _GL_STRERROR_OVERRIDE_H
-
-# include <errno.h>
-# include <stddef.h>
-
-/* Reasonable buffer size that should never trigger ERANGE; if this
-   proves too small, we intentionally abort(), to remind us to fix
-   this value.  */
-# define STACKBUF_LEN 256
-
-/* If ERRNUM maps to an errno value defined by gnulib, return a string
-   describing the error.  Otherwise return NULL.  */
-# if REPLACE_STRERROR_0 \
-     || GNULIB_defined_ESOCK \
-     || GNULIB_defined_ESTREAMS \
-     || GNULIB_defined_EWINSOCK \
-     || GNULIB_defined_ENOMSG \
-     || GNULIB_defined_EIDRM \
-     || GNULIB_defined_ENOLINK \
-     || GNULIB_defined_EPROTO \
-     || GNULIB_defined_EMULTIHOP \
-     || GNULIB_defined_EBADMSG \
-     || GNULIB_defined_EOVERFLOW \
-     || GNULIB_defined_ENOTSUP \
-     || GNULIB_defined_ENETRESET \
-     || GNULIB_defined_ECONNABORTED \
-     || GNULIB_defined_ESTALE \
-     || GNULIB_defined_EDQUOT \
-     || GNULIB_defined_ECANCELED \
-     || GNULIB_defined_EOWNERDEAD \
-     || GNULIB_defined_ENOTRECOVERABLE \
-     || GNULIB_defined_EILSEQ
-extern const char *strerror_override (int errnum) _GL_ATTRIBUTE_CONST;
-# else
-#  define strerror_override(ignored) NULL
-# endif
-
-#endif /* _GL_STRERROR_OVERRIDE_H */
diff --git a/gl/strerror.c b/gl/strerror.c
deleted file mode 100644 (file)
index d07b58d..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/* strerror.c --- POSIX compatible system error routine
-
-   Copyright (C) 2007-2014 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.1 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 <string.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "intprops.h"
-#include "strerror-override.h"
-#include "verify.h"
-
-/* Use the system functions, not the gnulib overrides in this file.  */
-#undef sprintf
-
-char *
-strerror (int n)
-#undef strerror
-{
-  static char buf[STACKBUF_LEN];
-  size_t len;
-
-  /* Cast away const, due to the historical signature of strerror;
-     callers should not be modifying the string.  */
-  const char *msg = strerror_override (n);
-  if (msg)
-    return (char *) msg;
-
-  msg = strerror (n);
-
-  /* Our strerror_r implementation might use the system's strerror
-     buffer, so all other clients of strerror have to see the error
-     copied into a buffer that we manage.  This is not thread-safe,
-     even if the system strerror is, but portable programs shouldn't
-     be using strerror if they care about thread-safety.  */
-  if (!msg || !*msg)
-    {
-      static char const fmt[] = "Unknown error %d";
-      verify (sizeof buf >= sizeof (fmt) + INT_STRLEN_BOUND (n));
-      sprintf (buf, fmt, n);
-      errno = EINVAL;
-      return buf;
-    }
-
-  /* Fix STACKBUF_LEN if this ever aborts.  */
-  len = strlen (msg);
-  if (sizeof buf <= len)
-    abort ();
-
-  return memcpy (buf, msg, len + 1);
-}
diff --git a/gl/sys_select.in.h b/gl/sys_select.in.h
deleted file mode 100644 (file)
index 3f7a2be..0000000
+++ /dev/null
@@ -1,313 +0,0 @@
-/* Substitute for <sys/select.h>.
-   Copyright (C) 2007-2014 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.1, 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/>.  */
-
-# if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-# endif
-@PRAGMA_COLUMNS@
-
-/* On OSF/1 and Solaris 2.6, <sys/types.h> and <sys/time.h>
-   both include <sys/select.h>.
-   On Cygwin, <sys/time.h> includes <sys/select.h>.
-   Simply delegate to the system's header in this case.  */
-#if (@HAVE_SYS_SELECT_H@                                                \
-     && ((defined __osf__ && defined _SYS_TYPES_H_                      \
-          && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H         \
-          && defined _OSF_SOURCE)                                       \
-         || (defined __sun && defined _SYS_TYPES_H                      \
-             && (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE)   \
-                 || defined __EXTENSIONS__))))
-
-# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H
-# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
-
-#elif (@HAVE_SYS_SELECT_H@                                              \
-       && (defined _CYGWIN_SYS_TIME_H                                   \
-           || (defined __osf__ && defined _SYS_TIME_H_                  \
-               && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H    \
-               && defined _OSF_SOURCE)                                  \
-           || (defined __sun && defined _SYS_TIME_H                     \
-               && (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE) \
-                   || defined __EXTENSIONS__))))
-
-# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H
-# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
-
-/* On IRIX 6.5, <sys/timespec.h> includes <sys/types.h>, which includes
-   <sys/bsd_types.h>, which includes <sys/select.h>.  At this point we cannot
-   include <signal.h>, because that includes <internal/signal_core.h>, which
-   gives a syntax error because <sys/timespec.h> has not been completely
-   processed.  Simply delegate to the system's header in this case.  */
-#elif @HAVE_SYS_SELECT_H@ && defined __sgi && (defined _SYS_BSD_TYPES_H && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_BSD_TYPES_H)
-
-# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_BSD_TYPES_H
-# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
-
-/* On OpenBSD 5.0, <pthread.h> includes <sys/types.h>, which includes
-   <sys/select.h>.  At this point we cannot include <signal.h>, because that
-   includes gnulib's pthread.h override, which gives a syntax error because
-   /usr/include/pthread.h has not been completely processed.  Simply delegate
-   to the system's header in this case.  */
-#elif @HAVE_SYS_SELECT_H@ && defined __OpenBSD__ && (defined _PTHREAD_H_ && !defined PTHREAD_MUTEX_INITIALIZER)
-
-# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
-
-#else
-
-#ifndef _@GUARD_PREFIX@_SYS_SELECT_H
-
-/* On many platforms, <sys/select.h> assumes prior inclusion of
-   <sys/types.h>.  Also, mingw defines sigset_t there, instead of
-   in <signal.h> where it belongs.  */
-#include <sys/types.h>
-
-#if @HAVE_SYS_SELECT_H@
-
-/* On OSF/1 4.0, <sys/select.h> provides only a forward declaration
-   of 'struct timeval', and no definition of this type.
-   Also, Mac OS X, AIX, HP-UX, IRIX, Solaris, Interix declare select()
-   in <sys/time.h>.
-   But avoid namespace pollution on glibc systems.  */
-# ifndef __GLIBC__
-#  include <sys/time.h>
-# endif
-
-/* On AIX 7 and Solaris 10, <sys/select.h> provides an FD_ZERO implementation
-   that relies on memset(), but without including <string.h>.
-   But in any case avoid namespace pollution on glibc systems.  */
-# if (defined __OpenBSD__ || defined _AIX || defined __sun || defined __osf__ || defined __BEOS__) \
-     && ! defined __GLIBC__
-#  include <string.h>
-# endif
-
-/* The include_next requires a split double-inclusion guard.  */
-# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
-
-#endif
-
-/* Get definition of 'sigset_t'.
-   But avoid namespace pollution on glibc systems.
-   Do this after the include_next (for the sake of OpenBSD 5.0) but before
-   the split double-inclusion guard (for the sake of Solaris).  */
-#if !(defined __GLIBC__ && !defined __UCLIBC__)
-# include <signal.h>
-#endif
-
-#ifndef _@GUARD_PREFIX@_SYS_SELECT_H
-#define _@GUARD_PREFIX@_SYS_SELECT_H
-
-#if !@HAVE_SYS_SELECT_H@
-/* A platform that lacks <sys/select.h>.  */
-/* Get the 'struct timeval' and 'fd_set' types and the FD_* macros
-   on most platforms.  */
-# include <sys/time.h>
-/* On HP-UX 11, <sys/time.h> provides an FD_ZERO implementation
-   that relies on memset(), but without including <string.h>.  */
-# if defined __hpux
-#  include <string.h>
-# endif
-/* On native Windows platforms:
-   Get the 'fd_set' type.
-   Get the close() declaration before we override it.  */
-# if @HAVE_WINSOCK2_H@
-#  if !defined _GL_INCLUDING_WINSOCK2_H
-#   define _GL_INCLUDING_WINSOCK2_H
-#   include <winsock2.h>
-#   undef _GL_INCLUDING_WINSOCK2_H
-#  endif
-#  include <io.h>
-# endif
-#endif
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
-
-/* The definition of _GL_WARN_ON_USE is copied here.  */
-
-
-/* Fix some definitions from <winsock2.h>.  */
-
-#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 int
-rpl_fd_isset (SOCKET fd, fd_set * set)
-{
-  u_int i;
-  if (set == NULL)
-    return 0;
-
-  for (i = 0; i < set->fd_count; i++)
-    if (set->fd_array[i] == fd)
-      return 1;
-
-  return 0;
-}
-
-#  define GNULIB_defined_rpl_fd_isset 1
-# endif
-
-# undef FD_ISSET
-# define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
-
-#endif
-
-/* Hide some function declarations from <winsock2.h>.  */
-
-#if @HAVE_WINSOCK2_H@
-# if !defined _@GUARD_PREFIX@_UNISTD_H
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef close
-#   define close close_used_without_including_unistd_h
-#  else
-    _GL_WARN_ON_USE (close,
-                     "close() used without including <unistd.h>");
-#  endif
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef gethostname
-#   define gethostname gethostname_used_without_including_unistd_h
-#  else
-    _GL_WARN_ON_USE (gethostname,
-                     "gethostname() used without including <unistd.h>");
-#  endif
-# endif
-# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef socket
-#   define socket              socket_used_without_including_sys_socket_h
-#   undef connect
-#   define connect             connect_used_without_including_sys_socket_h
-#   undef accept
-#   define accept              accept_used_without_including_sys_socket_h
-#   undef bind
-#   define bind                bind_used_without_including_sys_socket_h
-#   undef getpeername
-#   define getpeername         getpeername_used_without_including_sys_socket_h
-#   undef getsockname
-#   define getsockname         getsockname_used_without_including_sys_socket_h
-#   undef getsockopt
-#   define getsockopt          getsockopt_used_without_including_sys_socket_h
-#   undef listen
-#   define listen              listen_used_without_including_sys_socket_h
-#   undef recv
-#   define recv                recv_used_without_including_sys_socket_h
-#   undef send
-#   define send                send_used_without_including_sys_socket_h
-#   undef recvfrom
-#   define recvfrom            recvfrom_used_without_including_sys_socket_h
-#   undef sendto
-#   define sendto              sendto_used_without_including_sys_socket_h
-#   undef setsockopt
-#   define setsockopt          setsockopt_used_without_including_sys_socket_h
-#   undef shutdown
-#   define shutdown            shutdown_used_without_including_sys_socket_h
-#  else
-    _GL_WARN_ON_USE (socket,
-                     "socket() used without including <sys/socket.h>");
-    _GL_WARN_ON_USE (connect,
-                     "connect() used without including <sys/socket.h>");
-    _GL_WARN_ON_USE (accept,
-                     "accept() used without including <sys/socket.h>");
-    _GL_WARN_ON_USE (bind,
-                     "bind() used without including <sys/socket.h>");
-    _GL_WARN_ON_USE (getpeername,
-                     "getpeername() used without including <sys/socket.h>");
-    _GL_WARN_ON_USE (getsockname,
-                     "getsockname() used without including <sys/socket.h>");
-    _GL_WARN_ON_USE (getsockopt,
-                     "getsockopt() used without including <sys/socket.h>");
-    _GL_WARN_ON_USE (listen,
-                     "listen() used without including <sys/socket.h>");
-    _GL_WARN_ON_USE (recv,
-                     "recv() used without including <sys/socket.h>");
-    _GL_WARN_ON_USE (send,
-                     "send() used without including <sys/socket.h>");
-    _GL_WARN_ON_USE (recvfrom,
-                     "recvfrom() used without including <sys/socket.h>");
-    _GL_WARN_ON_USE (sendto,
-                     "sendto() used without including <sys/socket.h>");
-    _GL_WARN_ON_USE (setsockopt,
-                     "setsockopt() used without including <sys/socket.h>");
-    _GL_WARN_ON_USE (shutdown,
-                     "shutdown() used without including <sys/socket.h>");
-#  endif
-# endif
-#endif
-
-
-#if @GNULIB_PSELECT@
-# if @REPLACE_PSELECT@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef pselect
-#   define pselect rpl_pselect
-#  endif
-_GL_FUNCDECL_RPL (pselect, int,
-                  (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
-                   struct timespec const *restrict, const sigset_t *restrict));
-_GL_CXXALIAS_RPL (pselect, int,
-                  (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
-                   struct timespec const *restrict, const sigset_t *restrict));
-# else
-#  if !@HAVE_PSELECT@
-_GL_FUNCDECL_SYS (pselect, int,
-                  (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
-                   struct timespec const *restrict, const sigset_t *restrict));
-#  endif
-_GL_CXXALIAS_SYS (pselect, int,
-                  (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
-                   struct timespec const *restrict, const sigset_t *restrict));
-# endif
-_GL_CXXALIASWARN (pselect);
-#elif defined GNULIB_POSIXCHECK
-# undef pselect
-# if HAVE_RAW_DECL_PSELECT
-_GL_WARN_ON_USE (pselect, "pselect is not portable - "
-                 "use gnulib module pselect for portability");
-# endif
-#endif
-
-#if @GNULIB_SELECT@
-# if @REPLACE_SELECT@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef select
-#   define select rpl_select
-#  endif
-_GL_FUNCDECL_RPL (select, int,
-                  (int, fd_set *, fd_set *, fd_set *, struct timeval *));
-_GL_CXXALIAS_RPL (select, int,
-                  (int, fd_set *, fd_set *, fd_set *, struct timeval *));
-# else
-_GL_CXXALIAS_SYS (select, int,
-                  (int, fd_set *, fd_set *, fd_set *, struct timeval *));
-# endif
-_GL_CXXALIASWARN (select);
-#elif @HAVE_WINSOCK2_H@
-# undef select
-# define select select_used_without_requesting_gnulib_module_select
-#elif defined GNULIB_POSIXCHECK
-# undef select
-# if HAVE_RAW_DECL_SELECT
-_GL_WARN_ON_USE (select, "select is not always POSIX compliant - "
-                 "use gnulib module select for portability");
-# endif
-#endif
-
-
-#endif /* _@GUARD_PREFIX@_SYS_SELECT_H */
-#endif /* _@GUARD_PREFIX@_SYS_SELECT_H */
-#endif /* OSF/1 */
index 866652b870a488e114b0f1ce2f1e180abb171d7d..617c63c031165f256926573ae8f7fffd12533b24 100644 (file)
@@ -22,7 +22,7 @@
 #
 # Generated by gnulib-tool.
 
-AUTOMAKE_OPTIONS = 1.9.6 foreign subdir-objects
+AUTOMAKE_OPTIONS = 1.9.6 foreign
 
 SUBDIRS = .
 TESTS =
@@ -58,15 +58,6 @@ AM_LIBTOOLFLAGS = --preserve-dup-deps
 
 TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 
-## begin gnulib module accept-tests
-
-TESTS += test-accept
-check_PROGRAMS += test-accept
-test_accept_LDADD = $(LDADD) @LIBSOCKET@
-EXTRA_DIST += test-accept.c signature.h macros.h
-
-## end   gnulib module accept-tests
-
 ## begin gnulib module alloca-opt-tests
 
 TESTS += test-alloca-opt
@@ -76,6 +67,42 @@ EXTRA_DIST += test-alloca-opt.c
 
 ## end   gnulib module alloca-opt-tests
 
+## begin gnulib module arpa_inet
+
+BUILT_SOURCES += arpa/inet.h
+
+# We need the following in order to create <arpa/inet.h> when the system
+# doesn't have one.
+arpa/inet.h: arpa_inet.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+       $(AM_V_at)$(MKDIR_P) arpa
+       $(AM_V_GEN)rm -f $@-t $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+             -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \
+             -e 's|@''NEXT_ARPA_INET_H''@|$(NEXT_ARPA_INET_H)|g' \
+             -e 's|@''HAVE_ARPA_INET_H''@|$(HAVE_ARPA_INET_H)|g' \
+             -e 's/@''GNULIB_INET_NTOP''@/$(GNULIB_INET_NTOP)/g' \
+             -e 's/@''GNULIB_INET_PTON''@/$(GNULIB_INET_PTON)/g' \
+             -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \
+             -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \
+             -e 's|@''REPLACE_INET_NTOP''@|$(REPLACE_INET_NTOP)|g' \
+             -e 's|@''REPLACE_INET_PTON''@|$(REPLACE_INET_PTON)|g' \
+             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
+             < $(srcdir)/arpa_inet.in.h; \
+       } > $@-t && \
+       mv $@-t $@
+MOSTLYCLEANFILES += arpa/inet.h arpa/inet.h-t
+MOSTLYCLEANDIRS += arpa
+
+EXTRA_DIST += arpa_inet.in.h
+
+## end   gnulib module arpa_inet
+
 ## begin gnulib module arpa_inet-tests
 
 TESTS += test-arpa_inet
@@ -133,14 +160,6 @@ EXTRA_DIST += test-c-ctype.c macros.h
 
 ## end   gnulib module c-ctype-tests
 
-## begin gnulib module close-tests
-
-TESTS += test-close
-check_PROGRAMS += test-close
-EXTRA_DIST += test-close.c signature.h macros.h
-
-## end   gnulib module close-tests
-
 ## begin gnulib module connect-tests
 
 TESTS += test-connect
@@ -150,21 +169,6 @@ EXTRA_DIST += test-connect.c signature.h macros.h
 
 ## end   gnulib module connect-tests
 
-## begin gnulib module dosname
-
-
-EXTRA_DIST += dosname.h
-
-## end   gnulib module dosname
-
-## begin gnulib module dup2-tests
-
-TESTS += test-dup2
-check_PROGRAMS += test-dup2
-EXTRA_DIST += test-dup2.c signature.h macros.h
-
-## end   gnulib module dup2-tests
-
 ## begin gnulib module errno-tests
 
 TESTS += test-errno
@@ -217,6 +221,14 @@ EXTRA_DIST += test-fcntl-h.c
 
 ## end   gnulib module fcntl-h-tests
 
+## begin gnulib module fd-hook
+
+libtests_a_SOURCES += fd-hook.c
+
+EXTRA_DIST += fd-hook.h
+
+## end   gnulib module fd-hook
+
 ## begin gnulib module fdopen
 
 
@@ -315,23 +327,6 @@ EXTRA_DIST += test-ftello.c test-ftello.sh test-ftello2.sh test-ftello3.c test-f
 
 ## end   gnulib module ftello-tests
 
-## begin gnulib module ftruncate
-
-
-EXTRA_DIST += ftruncate.c
-
-EXTRA_libtests_a_SOURCES += ftruncate.c
-
-## end   gnulib module ftruncate
-
-## begin gnulib module ftruncate-tests
-
-TESTS += test-ftruncate.sh
-check_PROGRAMS += test-ftruncate
-EXTRA_DIST += test-ftruncate.c test-ftruncate.sh signature.h macros.h
-
-## end   gnulib module ftruncate-tests
-
 ## begin gnulib module func-tests
 
 TESTS += test-func
@@ -348,33 +343,6 @@ EXTRA_DIST += test-fwrite.c signature.h macros.h
 
 ## end   gnulib module fwrite-tests
 
-## begin gnulib module getaddrinfo-tests
-
-TESTS += test-getaddrinfo
-check_PROGRAMS += test-getaddrinfo
-test_getaddrinfo_LDADD = $(LDADD) @GETADDRINFO_LIB@ @LIBINTL@
-EXTRA_DIST += signature.h test-getaddrinfo.c
-
-## end   gnulib module getaddrinfo-tests
-
-## begin gnulib module getcwd-lgpl
-
-
-EXTRA_DIST += getcwd-lgpl.c
-
-EXTRA_libtests_a_SOURCES += getcwd-lgpl.c
-
-## end   gnulib module getcwd-lgpl
-
-## begin gnulib module getcwd-lgpl-tests
-
-TESTS += test-getcwd-lgpl
-check_PROGRAMS += test-getcwd-lgpl
-test_getcwd_lgpl_LDADD = $(LDADD) $(LIBINTL)
-EXTRA_DIST += test-getcwd-lgpl.c signature.h macros.h
-
-## end   gnulib module getcwd-lgpl-tests
-
 ## begin gnulib module getdelim-tests
 
 TESTS += test-getdelim
@@ -384,23 +352,6 @@ EXTRA_DIST += test-getdelim.c signature.h macros.h
 
 ## end   gnulib module getdelim-tests
 
-## begin gnulib module getdtablesize
-
-
-EXTRA_DIST += getdtablesize.c
-
-EXTRA_libtests_a_SOURCES += getdtablesize.c
-
-## end   gnulib module getdtablesize
-
-## begin gnulib module getdtablesize-tests
-
-TESTS += test-getdtablesize
-check_PROGRAMS += test-getdtablesize
-EXTRA_DIST += test-getdtablesize.c signature.h macros.h
-
-## end   gnulib module getdtablesize-tests
-
 ## begin gnulib module getline-tests
 
 TESTS += test-getline
@@ -419,15 +370,6 @@ EXTRA_libtests_a_SOURCES += getpagesize.c
 
 ## end   gnulib module getpagesize
 
-## begin gnulib module getpeername-tests
-
-TESTS += test-getpeername
-check_PROGRAMS += test-getpeername
-test_getpeername_LDADD = $(LDADD) @LIBSOCKET@
-EXTRA_DIST += test-getpeername.c signature.h macros.h
-
-## end   gnulib module getpeername-tests
-
 ## begin gnulib module gettimeofday-tests
 
 TESTS += test-gettimeofday
@@ -447,29 +389,14 @@ EXTRA_DIST += test-iconv.c signature.h macros.h
 
 ## end   gnulib module iconv-tests
 
-## begin gnulib module ignore-value
-
-
-EXTRA_DIST += ignore-value.h
+## begin gnulib module inet_pton
 
-## end   gnulib module ignore-value
 
-## begin gnulib module ignore-value-tests
+EXTRA_DIST += inet_pton.c
 
-TESTS += test-ignore-value
-check_PROGRAMS += test-ignore-value
-EXTRA_DIST += test-ignore-value.c
+EXTRA_libtests_a_SOURCES += inet_pton.c
 
-## end   gnulib module ignore-value-tests
-
-## begin gnulib module inet_ntop-tests
-
-TESTS += test-inet_ntop
-check_PROGRAMS += test-inet_ntop
-test_inet_ntop_LDADD = $(LDADD) @INET_NTOP_LIB@
-EXTRA_DIST += test-inet_ntop.c signature.h macros.h
-
-## end   gnulib module inet_ntop-tests
+## end   gnulib module inet_pton
 
 ## begin gnulib module inet_pton-tests
 
@@ -541,55 +468,6 @@ EXTRA_DIST += test-inttypes.c
 
 ## end   gnulib module inttypes-tests
 
-## begin gnulib module ioctl
-
-
-EXTRA_DIST += ioctl.c w32sock.h
-
-EXTRA_libtests_a_SOURCES += ioctl.c
-
-## end   gnulib module ioctl
-
-## begin gnulib module ioctl-tests
-
-TESTS += test-ioctl
-check_PROGRAMS += test-ioctl
-EXTRA_DIST += test-ioctl.c signature.h macros.h
-
-## end   gnulib module ioctl-tests
-
-## begin gnulib module listen-tests
-
-TESTS += test-listen
-check_PROGRAMS += test-listen
-test_listen_LDADD = $(LDADD) @LIBSOCKET@
-EXTRA_DIST += test-listen.c signature.h macros.h
-
-## end   gnulib module listen-tests
-
-## begin gnulib module lock
-
-libtests_a_SOURCES += glthread/lock.h glthread/lock.c
-
-## end   gnulib module lock
-
-## begin gnulib module lstat
-
-
-EXTRA_DIST += lstat.c
-
-EXTRA_libtests_a_SOURCES += lstat.c
-
-## end   gnulib module lstat
-
-## begin gnulib module lstat-tests
-
-TESTS += test-lstat
-check_PROGRAMS += test-lstat
-EXTRA_DIST += test-lstat.h test-lstat.c signature.h macros.h
-
-## end   gnulib module lstat-tests
-
 ## begin gnulib module memchr-tests
 
 TESTS += test-memchr
@@ -614,72 +492,6 @@ EXTRA_DIST += test-netinet_in.c
 
 ## end   gnulib module netinet_in-tests
 
-## begin gnulib module open
-
-
-EXTRA_DIST += open.c
-
-EXTRA_libtests_a_SOURCES += open.c
-
-## end   gnulib module open
-
-## begin gnulib module open-tests
-
-TESTS += test-open
-check_PROGRAMS += test-open
-EXTRA_DIST += test-open.h test-open.c signature.h macros.h
-
-## end   gnulib module open-tests
-
-## begin gnulib module pathmax
-
-
-EXTRA_DIST += pathmax.h
-
-## end   gnulib module pathmax
-
-## begin gnulib module pathmax-tests
-
-TESTS += test-pathmax
-check_PROGRAMS += test-pathmax
-EXTRA_DIST += test-pathmax.c
-
-## end   gnulib module pathmax-tests
-
-## begin gnulib module perror
-
-
-EXTRA_DIST += perror.c
-
-EXTRA_libtests_a_SOURCES += perror.c
-
-## end   gnulib module perror
-
-## begin gnulib module perror-tests
-
-TESTS += test-perror.sh test-perror2
-check_PROGRAMS += test-perror test-perror2
-EXTRA_DIST += macros.h signature.h test-perror.c test-perror2.c test-perror.sh
-
-## end   gnulib module perror-tests
-
-## begin gnulib module pipe-posix
-
-
-EXTRA_DIST += pipe.c
-
-EXTRA_libtests_a_SOURCES += pipe.c
-
-## end   gnulib module pipe-posix
-
-## begin gnulib module pipe-posix-tests
-
-TESTS += test-pipe
-check_PROGRAMS += test-pipe
-EXTRA_DIST += test-pipe.c signature.h macros.h
-
-## end   gnulib module pipe-posix-tests
-
 ## begin gnulib module read-file-tests
 
 TESTS += test-read-file
@@ -688,87 +500,6 @@ EXTRA_DIST += test-read-file.c
 
 ## end   gnulib module read-file-tests
 
-## begin gnulib module recv-tests
-
-TESTS += test-recv
-check_PROGRAMS += test-recv
-test_recv_LDADD = $(LDADD) @LIBSOCKET@
-EXTRA_DIST += test-recv.c signature.h macros.h
-
-## end   gnulib module recv-tests
-
-## begin gnulib module recvfrom-tests
-
-TESTS += test-recvfrom
-check_PROGRAMS += test-recvfrom
-test_recvfrom_LDADD = $(LDADD) @LIBSOCKET@
-EXTRA_DIST += test-recvfrom.c signature.h macros.h
-
-## end   gnulib module recvfrom-tests
-
-## begin gnulib module same-inode
-
-
-EXTRA_DIST += same-inode.h
-
-## end   gnulib module same-inode
-
-## begin gnulib module select-tests
-
-TESTS += test-select test-select-in.sh test-select-out.sh
-# test-select-stdin has to be run by hand.
-check_PROGRAMS += test-select test-select-fd test-select-stdin
-test_select_LDADD = $(LDADD) @LIB_SELECT@ @LIBSOCKET@ $(INET_PTON_LIB)
-test_select_fd_LDADD = $(LDADD) @LIB_SELECT@
-test_select_stdin_LDADD = $(LDADD) @LIB_SELECT@
-EXTRA_DIST += macros.h signature.h test-select.c test-select.h test-select-fd.c test-select-in.sh test-select-out.sh test-select-stdin.c
-
-## end   gnulib module select-tests
-
-## begin gnulib module send-tests
-
-TESTS += test-send
-check_PROGRAMS += test-send
-test_send_LDADD = $(LDADD) @LIBSOCKET@
-EXTRA_DIST += test-send.c signature.h macros.h
-
-## end   gnulib module send-tests
-
-## begin gnulib module sendto-tests
-
-TESTS += test-sendto
-check_PROGRAMS += test-sendto
-test_sendto_LDADD = $(LDADD) @LIBSOCKET@ $(INET_PTON_LIB)
-EXTRA_DIST += test-sendto.c signature.h macros.h
-
-## end   gnulib module sendto-tests
-
-## begin gnulib module setsockopt-tests
-
-TESTS += test-setsockopt
-check_PROGRAMS += test-setsockopt
-test_setsockopt_LDADD = $(LDADD) @LIBSOCKET@
-EXTRA_DIST += test-setsockopt.c signature.h macros.h
-
-## end   gnulib module setsockopt-tests
-
-## begin gnulib module shutdown-tests
-
-TESTS += test-shutdown
-check_PROGRAMS += test-shutdown
-test_shutdown_LDADD = $(LDADD) @LIBSOCKET@
-EXTRA_DIST += test-shutdown.c signature.h macros.h
-
-## end   gnulib module shutdown-tests
-
-## begin gnulib module signal-h-tests
-
-TESTS += test-signal-h
-check_PROGRAMS += test-signal-h
-EXTRA_DIST += test-signal-h.c
-
-## end   gnulib module signal-h-tests
-
 ## begin gnulib module snippet/_Noreturn
 
 # Because this Makefile snippet defines a variable used by other
@@ -859,6 +590,14 @@ EXTRA_DIST += test-snprintf.c signature.h macros.h
 
 ## end   gnulib module snprintf-tests
 
+## begin gnulib module sockets
+
+libtests_a_SOURCES += sockets.h sockets.c
+
+EXTRA_DIST += w32sock.h
+
+## end   gnulib module sockets
+
 ## begin gnulib module sockets-tests
 
 TESTS += test-sockets
@@ -868,24 +607,6 @@ EXTRA_DIST += test-sockets.c
 
 ## end   gnulib module sockets-tests
 
-## begin gnulib module stat
-
-
-EXTRA_DIST += stat.c
-
-EXTRA_libtests_a_SOURCES += stat.c
-
-## end   gnulib module stat
-
-## begin gnulib module stat-tests
-
-TESTS += test-stat
-check_PROGRAMS += test-stat
-test_stat_LDADD = $(LDADD) $(LIBINTL)
-EXTRA_DIST += test-stat.h test-stat.c signature.h macros.h
-
-## end   gnulib module stat-tests
-
 ## begin gnulib module stdalign-tests
 
 TESTS += test-stdalign
@@ -934,31 +655,6 @@ EXTRA_DIST += test-stdlib.c test-sys_wait.h
 
 ## end   gnulib module stdlib-tests
 
-## begin gnulib module strerror-tests
-
-TESTS += test-strerror
-check_PROGRAMS += test-strerror
-EXTRA_DIST += test-strerror.c signature.h macros.h
-
-## end   gnulib module strerror-tests
-
-## begin gnulib module strerror_r-posix
-
-
-EXTRA_DIST += strerror_r.c
-
-EXTRA_libtests_a_SOURCES += strerror_r.c
-
-## end   gnulib module strerror_r-posix
-
-## begin gnulib module strerror_r-posix-tests
-
-TESTS += test-strerror_r
-check_PROGRAMS += test-strerror_r
-EXTRA_DIST += test-strerror_r.c signature.h macros.h
-
-## end   gnulib module strerror_r-posix-tests
-
 ## begin gnulib module string-tests
 
 TESTS += test-string
@@ -991,71 +687,6 @@ EXTRA_DIST += test-strverscmp.c signature.h macros.h
 
 ## end   gnulib module strverscmp-tests
 
-## begin gnulib module symlink
-
-
-EXTRA_DIST += symlink.c
-
-EXTRA_libtests_a_SOURCES += symlink.c
-
-## end   gnulib module symlink
-
-## begin gnulib module symlink-tests
-
-TESTS += test-symlink
-check_PROGRAMS += test-symlink
-EXTRA_DIST += test-symlink.h test-symlink.c signature.h macros.h
-
-## end   gnulib module symlink-tests
-
-## begin gnulib module sys_ioctl
-
-BUILT_SOURCES += sys/ioctl.h
-
-# We need the following in order to create <sys/ioctl.h> when the system
-# does not have a complete one.
-sys/ioctl.h: sys_ioctl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
-       $(AM_V_at)$(MKDIR_P) sys
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-             -e 's|@''HAVE_SYS_IOCTL_H''@|$(HAVE_SYS_IOCTL_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_IOCTL_H''@|$(NEXT_SYS_IOCTL_H)|g' \
-             -e 's/@''GNULIB_IOCTL''@/$(GNULIB_IOCTL)/g' \
-             -e 's|@''SYS_IOCTL_H_HAVE_WINSOCK2_H''@|$(SYS_IOCTL_H_HAVE_WINSOCK2_H)|g' \
-             -e 's|@''SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \
-             -e 's|@''REPLACE_IOCTL''@|$(REPLACE_IOCTL)|g' \
-             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-             < $(srcdir)/sys_ioctl.in.h; \
-       } > $@-t && \
-       mv $@-t $@
-MOSTLYCLEANFILES += sys/ioctl.h sys/ioctl.h-t
-MOSTLYCLEANDIRS += sys
-
-EXTRA_DIST += sys_ioctl.in.h
-
-## end   gnulib module sys_ioctl
-
-## begin gnulib module sys_ioctl-tests
-
-TESTS += test-sys_ioctl
-check_PROGRAMS += test-sys_ioctl
-EXTRA_DIST += test-sys_ioctl.c
-
-## end   gnulib module sys_ioctl-tests
-
-## begin gnulib module sys_select-tests
-
-TESTS += test-sys_select
-check_PROGRAMS += test-sys_select
-EXTRA_DIST += test-sys_select.c signature.h
-
-## end   gnulib module sys_select-tests
-
 ## begin gnulib module sys_socket-tests
 
 TESTS += test-sys_socket
@@ -1104,14 +735,6 @@ EXTRA_DIST += test-init.sh
 
 ## end   gnulib module test-framework-sh-tests
 
-## begin gnulib module threadlib
-
-libtests_a_SOURCES += glthread/threadlib.c
-
-EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath
-
-## end   gnulib module threadlib
-
 ## begin gnulib module time-tests
 
 TESTS += test-time
diff --git a/gl/tests/dosname.h b/gl/tests/dosname.h
deleted file mode 100644 (file)
index b92adfa..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/* File names on MS-DOS/Windows systems.
-
-   Copyright (C) 2000-2001, 2004-2006, 2009-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-   From Paul Eggert and Jim Meyering.  */
-
-#ifndef _DOSNAME_H
-#define _DOSNAME_H
-
-#if (defined _WIN32 || defined __WIN32__ ||     \
-     defined __MSDOS__ || defined __CYGWIN__ || \
-     defined __EMX__ || defined __DJGPP__)
-   /* This internal macro assumes ASCII, but all hosts that support drive
-      letters use ASCII.  */
-# define _IS_DRIVE_LETTER(C) (((unsigned int) (C) | ('a' - 'A')) - 'a'  \
-                              <= 'z' - 'a')
-# define FILE_SYSTEM_PREFIX_LEN(Filename) \
-          (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0)
-# ifndef __CYGWIN__
-#  define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1
-# endif
-# define ISSLASH(C) ((C) == '/' || (C) == '\\')
-#else
-# define FILE_SYSTEM_PREFIX_LEN(Filename) 0
-# define ISSLASH(C) ((C) == '/')
-#endif
-
-#ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
-# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0
-#endif
-
-#if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
-#  define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)])
-# else
-#  define IS_ABSOLUTE_FILE_NAME(F)                              \
-     (ISSLASH ((F)[0]) || FILE_SYSTEM_PREFIX_LEN (F) != 0)
-#endif
-#define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F))
-
-#endif /* DOSNAME_H_ */
diff --git a/gl/tests/ftruncate.c b/gl/tests/ftruncate.c
deleted file mode 100644 (file)
index d7a5f20..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-/* ftruncate emulations for native Windows.
-   Copyright (C) 1992-2014 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include <unistd.h>
-
-#if HAVE_CHSIZE
-/* A native Windows platform.  */
-
-# include <errno.h>
-
-# if _GL_WINDOWS_64_BIT_OFF_T
-
-/* Large File Support: off_t is 64-bit, but chsize() takes only a 32-bit
-   argument.  So, define a 64-bit safe SetFileSize function ourselves.  */
-
-/* Ensure that <windows.h> declares GetFileSizeEx.  */
-#  undef _WIN32_WINNT
-#  define _WIN32_WINNT 0x500
-
-/* Get declarations of the native Windows API functions.  */
-#  define WIN32_LEAN_AND_MEAN
-#  include <windows.h>
-
-/* Get _get_osfhandle.  */
-#  include "msvc-nothrow.h"
-
-static BOOL
-SetFileSize (HANDLE h, LONGLONG size)
-{
-  LARGE_INTEGER old_size;
-
-  if (!GetFileSizeEx (h, &old_size))
-    return FALSE;
-
-  if (size != old_size.QuadPart)
-    {
-      /* Duplicate the handle, so we are free to modify its file position.  */
-      HANDLE curr_process = GetCurrentProcess ();
-      HANDLE tmph;
-
-      if (!DuplicateHandle (curr_process,           /* SourceProcessHandle */
-                            h,                      /* SourceHandle */
-                            curr_process,           /* TargetProcessHandle */
-                            (PHANDLE) &tmph,        /* TargetHandle */
-                            (DWORD) 0,              /* DesiredAccess */
-                            FALSE,                  /* InheritHandle */
-                            DUPLICATE_SAME_ACCESS)) /* Options */
-        return FALSE;
-
-      if (size < old_size.QuadPart)
-        {
-          /* Reduce the size.  */
-          LONG size_hi = (LONG) (size >> 32);
-          if (SetFilePointer (tmph, (LONG) size, &size_hi, FILE_BEGIN)
-              == INVALID_SET_FILE_POINTER
-              && GetLastError() != NO_ERROR)
-            {
-              CloseHandle (tmph);
-              return FALSE;
-            }
-          if (!SetEndOfFile (tmph))
-            {
-              CloseHandle (tmph);
-              return FALSE;
-            }
-        }
-      else
-        {
-          /* Increase the size by adding zero bytes at the end.  */
-          static char zero_bytes[1024];
-          LONG pos_hi = 0;
-          LONG pos_lo = SetFilePointer (tmph, (LONG) 0, &pos_hi, FILE_END);
-          LONGLONG pos;
-          if (pos_lo == INVALID_SET_FILE_POINTER
-              && GetLastError() != NO_ERROR)
-            {
-              CloseHandle (tmph);
-              return FALSE;
-            }
-          pos = ((LONGLONG) pos_hi << 32) | (ULONGLONG) (ULONG) pos_lo;
-          while (pos < size)
-            {
-              DWORD written;
-              LONGLONG count = size - pos;
-              if (count > sizeof (zero_bytes))
-                count = sizeof (zero_bytes);
-              if (!WriteFile (tmph, zero_bytes, (DWORD) count, &written, NULL)
-                  || written == 0)
-                {
-                  CloseHandle (tmph);
-                  return FALSE;
-                }
-              pos += (ULONGLONG) (ULONG) written;
-            }
-        }
-      /* Close the handle.  */
-      CloseHandle (tmph);
-    }
-  return TRUE;
-}
-
-int
-ftruncate (int fd, off_t length)
-{
-  HANDLE handle = (HANDLE) _get_osfhandle (fd);
-
-  if (handle == INVALID_HANDLE_VALUE)
-    {
-      errno = EBADF;
-      return -1;
-    }
-  if (length < 0)
-    {
-      errno = EINVAL;
-      return -1;
-    }
-  if (!SetFileSize (handle, length))
-    {
-      switch (GetLastError ())
-        {
-        case ERROR_ACCESS_DENIED:
-          errno = EACCES;
-          break;
-        case ERROR_HANDLE_DISK_FULL:
-        case ERROR_DISK_FULL:
-        case ERROR_DISK_TOO_FRAGMENTED:
-          errno = ENOSPC;
-          break;
-        default:
-          errno = EIO;
-          break;
-        }
-      return -1;
-    }
-  return 0;
-}
-
-# else
-
-#  include <io.h>
-
-#  if HAVE_MSVC_INVALID_PARAMETER_HANDLER
-#   include "msvc-inval.h"
-static int
-chsize_nothrow (int fd, long length)
-{
-  int result;
-
-  TRY_MSVC_INVAL
-    {
-      result = chsize (fd, length);
-    }
-  CATCH_MSVC_INVAL
-    {
-      result = -1;
-      errno = EBADF;
-    }
-  DONE_MSVC_INVAL;
-
-  return result;
-}
-#   define chsize chsize_nothrow
-#  endif
-
-int
-ftruncate (int fd, off_t length)
-{
-  return chsize (fd, length);
-}
-
-# endif
-#endif
diff --git a/gl/tests/getcwd-lgpl.c b/gl/tests/getcwd-lgpl.c
deleted file mode 100644 (file)
index 044c000..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/* Copyright (C) 2011-2014 Free Software Foundation, Inc.
-   This file is part of gnulib.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification */
-#include <unistd.h>
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-#if GNULIB_GETCWD
-/* Favor GPL getcwd.c if both getcwd and getcwd-lgpl modules are in use.  */
-typedef int dummy;
-#else
-
-/* Get the name of the current working directory, and put it in SIZE
-   bytes of BUF.  Returns NULL if the directory couldn't be determined
-   (perhaps because the absolute name was longer than PATH_MAX, or
-   because of missing read/search permissions on parent directories)
-   or SIZE was too small.  If successful, returns BUF.  If BUF is
-   NULL, an array is allocated with 'malloc'; the array is SIZE bytes
-   long, unless SIZE == 0, in which case it is as big as
-   necessary.  */
-
-# undef getcwd
-char *
-rpl_getcwd (char *buf, size_t size)
-{
-  char *ptr;
-  char *result;
-
-  /* Handle single size operations.  */
-  if (buf)
-    {
-      if (!size)
-        {
-          errno = EINVAL;
-          return NULL;
-        }
-      return getcwd (buf, size);
-    }
-
-  if (size)
-    {
-      buf = malloc (size);
-      if (!buf)
-        {
-          errno = ENOMEM;
-          return NULL;
-        }
-      result = getcwd (buf, size);
-      if (!result)
-        {
-          int saved_errno = errno;
-          free (buf);
-          errno = saved_errno;
-        }
-      return result;
-    }
-
-  /* Flexible sizing requested.  Avoid over-allocation for the common
-     case of a name that fits within a 4k page, minus some space for
-     local variables, to be sure we don't skip over a guard page.  */
-  {
-    char tmp[4032];
-    size = sizeof tmp;
-    ptr = getcwd (tmp, size);
-    if (ptr)
-      {
-        result = strdup (ptr);
-        if (!result)
-          errno = ENOMEM;
-        return result;
-      }
-    if (errno != ERANGE)
-      return NULL;
-  }
-
-  /* My what a large directory name we have.  */
-  do
-    {
-      size <<= 1;
-      ptr = realloc (buf, size);
-      if (ptr == NULL)
-        {
-          free (buf);
-          errno = ENOMEM;
-          return NULL;
-        }
-      buf = ptr;
-      result = getcwd (buf, size);
-    }
-  while (!result && errno == ERANGE);
-
-  if (!result)
-    {
-      int saved_errno = errno;
-      free (buf);
-      errno = saved_errno;
-    }
-  else
-    {
-      /* Trim to fit, if possible.  */
-      result = realloc (buf, strlen (buf) + 1);
-      if (!result)
-        result = buf;
-    }
-  return result;
-}
-
-#endif
diff --git a/gl/tests/getdtablesize.c b/gl/tests/getdtablesize.c
deleted file mode 100644 (file)
index 946738c..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/* getdtablesize() function for platforms that don't have it.
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
-   Written by Bruno Haible <bruno@clisp.org>, 2008.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include <unistd.h>
-
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-
-# include <stdio.h>
-
-# include "msvc-inval.h"
-
-# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
-static int
-_setmaxstdio_nothrow (int newmax)
-{
-  int result;
-
-  TRY_MSVC_INVAL
-    {
-      result = _setmaxstdio (newmax);
-    }
-  CATCH_MSVC_INVAL
-    {
-      result = -1;
-    }
-  DONE_MSVC_INVAL;
-
-  return result;
-}
-#  define _setmaxstdio _setmaxstdio_nothrow
-# endif
-
-/* Cache for the previous getdtablesize () result.  Safe to cache because
-   Windows also lacks setrlimit.  */
-static int dtablesize;
-
-int
-getdtablesize (void)
-{
-  if (dtablesize == 0)
-    {
-      /* We are looking for the number N such that the valid file descriptors
-         are 0..N-1.  It can be obtained through a loop as follows:
-           {
-             int fd;
-             for (fd = 3; fd < 65536; fd++)
-               if (dup2 (0, fd) == -1)
-                 break;
-             return fd;
-           }
-         On Windows XP, the result is 2048.
-         The drawback of this loop is that it allocates memory for a libc
-         internal array that is never freed.
-
-         The number N can also be obtained as the upper bound for
-         _getmaxstdio ().  _getmaxstdio () returns the maximum number of open
-         FILE objects.  The sanity check in _setmaxstdio reveals the maximum
-         number of file descriptors.  This too allocates memory, but it is
-         freed when we call _setmaxstdio with the original value.  */
-      int orig_max_stdio = _getmaxstdio ();
-      unsigned int bound;
-      for (bound = 0x10000; _setmaxstdio (bound) < 0; bound = bound / 2)
-        ;
-      _setmaxstdio (orig_max_stdio);
-      dtablesize = bound;
-    }
-  return dtablesize;
-}
-
-#elif HAVE_GETDTABLESIZE
-
-# include <sys/resource.h>
-# undef getdtablesize
-
-int
-rpl_getdtablesize(void)
-{
-  /* To date, this replacement is only compiled for Cygwin 1.7.25,
-     which auto-increased the RLIMIT_NOFILE soft limit until it
-     hits the compile-time constant hard limit of 3200.  Although
-     that version of cygwin supported a child process inheriting
-     a smaller soft limit, the smaller limit is not enforced, so
-     we might as well just report the hard limit.  */
-  struct rlimit lim;
-  if (!getrlimit (RLIMIT_NOFILE, &lim) && lim.rlim_max != RLIM_INFINITY)
-    return lim.rlim_max;
-  return getdtablesize ();
-}
-
-#endif
diff --git a/gl/tests/glthread/lock.c b/gl/tests/glthread/lock.c
deleted file mode 100644 (file)
index 33c15a0..0000000
+++ /dev/null
@@ -1,1057 +0,0 @@
-/* Locking in multithreaded situations.
-   Copyright (C) 2005-2014 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2005.
-   Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-solaris.h,
-   gthr-win32.h.  */
-
-#include <config.h>
-
-#include "glthread/lock.h"
-
-/* ========================================================================= */
-
-#if USE_POSIX_THREADS
-
-/* -------------------------- gl_lock_t datatype -------------------------- */
-
-/* ------------------------- gl_rwlock_t datatype ------------------------- */
-
-# if HAVE_PTHREAD_RWLOCK
-
-#  if !defined PTHREAD_RWLOCK_INITIALIZER
-
-int
-glthread_rwlock_init_multithreaded (gl_rwlock_t *lock)
-{
-  int err;
-
-  err = pthread_rwlock_init (&lock->rwlock, NULL);
-  if (err != 0)
-    return err;
-  lock->initialized = 1;
-  return 0;
-}
-
-int
-glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock)
-{
-  if (!lock->initialized)
-    {
-      int err;
-
-      err = pthread_mutex_lock (&lock->guard);
-      if (err != 0)
-        return err;
-      if (!lock->initialized)
-        {
-          err = glthread_rwlock_init_multithreaded (lock);
-          if (err != 0)
-            {
-              pthread_mutex_unlock (&lock->guard);
-              return err;
-            }
-        }
-      err = pthread_mutex_unlock (&lock->guard);
-      if (err != 0)
-        return err;
-    }
-  return pthread_rwlock_rdlock (&lock->rwlock);
-}
-
-int
-glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock)
-{
-  if (!lock->initialized)
-    {
-      int err;
-
-      err = pthread_mutex_lock (&lock->guard);
-      if (err != 0)
-        return err;
-      if (!lock->initialized)
-        {
-          err = glthread_rwlock_init_multithreaded (lock);
-          if (err != 0)
-            {
-              pthread_mutex_unlock (&lock->guard);
-              return err;
-            }
-        }
-      err = pthread_mutex_unlock (&lock->guard);
-      if (err != 0)
-        return err;
-    }
-  return pthread_rwlock_wrlock (&lock->rwlock);
-}
-
-int
-glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock)
-{
-  if (!lock->initialized)
-    return EINVAL;
-  return pthread_rwlock_unlock (&lock->rwlock);
-}
-
-int
-glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock)
-{
-  int err;
-
-  if (!lock->initialized)
-    return EINVAL;
-  err = pthread_rwlock_destroy (&lock->rwlock);
-  if (err != 0)
-    return err;
-  lock->initialized = 0;
-  return 0;
-}
-
-#  endif
-
-# else
-
-int
-glthread_rwlock_init_multithreaded (gl_rwlock_t *lock)
-{
-  int err;
-
-  err = pthread_mutex_init (&lock->lock, NULL);
-  if (err != 0)
-    return err;
-  err = pthread_cond_init (&lock->waiting_readers, NULL);
-  if (err != 0)
-    return err;
-  err = pthread_cond_init (&lock->waiting_writers, NULL);
-  if (err != 0)
-    return err;
-  lock->waiting_writers_count = 0;
-  lock->runcount = 0;
-  return 0;
-}
-
-int
-glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock)
-{
-  int err;
-
-  err = pthread_mutex_lock (&lock->lock);
-  if (err != 0)
-    return err;
-  /* Test whether only readers are currently running, and whether the runcount
-     field will not overflow.  */
-  /* POSIX says: "It is implementation-defined whether the calling thread
-     acquires the lock when a writer does not hold the lock and there are
-     writers blocked on the lock."  Let's say, no: give the writers a higher
-     priority.  */
-  while (!(lock->runcount + 1 > 0 && lock->waiting_writers_count == 0))
-    {
-      /* This thread has to wait for a while.  Enqueue it among the
-         waiting_readers.  */
-      err = pthread_cond_wait (&lock->waiting_readers, &lock->lock);
-      if (err != 0)
-        {
-          pthread_mutex_unlock (&lock->lock);
-          return err;
-        }
-    }
-  lock->runcount++;
-  return pthread_mutex_unlock (&lock->lock);
-}
-
-int
-glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock)
-{
-  int err;
-
-  err = pthread_mutex_lock (&lock->lock);
-  if (err != 0)
-    return err;
-  /* Test whether no readers or writers are currently running.  */
-  while (!(lock->runcount == 0))
-    {
-      /* This thread has to wait for a while.  Enqueue it among the
-         waiting_writers.  */
-      lock->waiting_writers_count++;
-      err = pthread_cond_wait (&lock->waiting_writers, &lock->lock);
-      if (err != 0)
-        {
-          lock->waiting_writers_count--;
-          pthread_mutex_unlock (&lock->lock);
-          return err;
-        }
-      lock->waiting_writers_count--;
-    }
-  lock->runcount--; /* runcount becomes -1 */
-  return pthread_mutex_unlock (&lock->lock);
-}
-
-int
-glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock)
-{
-  int err;
-
-  err = pthread_mutex_lock (&lock->lock);
-  if (err != 0)
-    return err;
-  if (lock->runcount < 0)
-    {
-      /* Drop a writer lock.  */
-      if (!(lock->runcount == -1))
-        {
-          pthread_mutex_unlock (&lock->lock);
-          return EINVAL;
-        }
-      lock->runcount = 0;
-    }
-  else
-    {
-      /* Drop a reader lock.  */
-      if (!(lock->runcount > 0))
-        {
-          pthread_mutex_unlock (&lock->lock);
-          return EINVAL;
-        }
-      lock->runcount--;
-    }
-  if (lock->runcount == 0)
-    {
-      /* POSIX recommends that "write locks shall take precedence over read
-         locks", to avoid "writer starvation".  */
-      if (lock->waiting_writers_count > 0)
-        {
-          /* Wake up one of the waiting writers.  */
-          err = pthread_cond_signal (&lock->waiting_writers);
-          if (err != 0)
-            {
-              pthread_mutex_unlock (&lock->lock);
-              return err;
-            }
-        }
-      else
-        {
-          /* Wake up all waiting readers.  */
-          err = pthread_cond_broadcast (&lock->waiting_readers);
-          if (err != 0)
-            {
-              pthread_mutex_unlock (&lock->lock);
-              return err;
-            }
-        }
-    }
-  return pthread_mutex_unlock (&lock->lock);
-}
-
-int
-glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock)
-{
-  int err;
-
-  err = pthread_mutex_destroy (&lock->lock);
-  if (err != 0)
-    return err;
-  err = pthread_cond_destroy (&lock->waiting_readers);
-  if (err != 0)
-    return err;
-  err = pthread_cond_destroy (&lock->waiting_writers);
-  if (err != 0)
-    return err;
-  return 0;
-}
-
-# endif
-
-/* --------------------- gl_recursive_lock_t datatype --------------------- */
-
-# if HAVE_PTHREAD_MUTEX_RECURSIVE
-
-#  if defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
-
-int
-glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock)
-{
-  pthread_mutexattr_t attributes;
-  int err;
-
-  err = pthread_mutexattr_init (&attributes);
-  if (err != 0)
-    return err;
-  err = pthread_mutexattr_settype (&attributes, PTHREAD_MUTEX_RECURSIVE);
-  if (err != 0)
-    {
-      pthread_mutexattr_destroy (&attributes);
-      return err;
-    }
-  err = pthread_mutex_init (lock, &attributes);
-  if (err != 0)
-    {
-      pthread_mutexattr_destroy (&attributes);
-      return err;
-    }
-  err = pthread_mutexattr_destroy (&attributes);
-  if (err != 0)
-    return err;
-  return 0;
-}
-
-#  else
-
-int
-glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock)
-{
-  pthread_mutexattr_t attributes;
-  int err;
-
-  err = pthread_mutexattr_init (&attributes);
-  if (err != 0)
-    return err;
-  err = pthread_mutexattr_settype (&attributes, PTHREAD_MUTEX_RECURSIVE);
-  if (err != 0)
-    {
-      pthread_mutexattr_destroy (&attributes);
-      return err;
-    }
-  err = pthread_mutex_init (&lock->recmutex, &attributes);
-  if (err != 0)
-    {
-      pthread_mutexattr_destroy (&attributes);
-      return err;
-    }
-  err = pthread_mutexattr_destroy (&attributes);
-  if (err != 0)
-    return err;
-  lock->initialized = 1;
-  return 0;
-}
-
-int
-glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock)
-{
-  if (!lock->initialized)
-    {
-      int err;
-
-      err = pthread_mutex_lock (&lock->guard);
-      if (err != 0)
-        return err;
-      if (!lock->initialized)
-        {
-          err = glthread_recursive_lock_init_multithreaded (lock);
-          if (err != 0)
-            {
-              pthread_mutex_unlock (&lock->guard);
-              return err;
-            }
-        }
-      err = pthread_mutex_unlock (&lock->guard);
-      if (err != 0)
-        return err;
-    }
-  return pthread_mutex_lock (&lock->recmutex);
-}
-
-int
-glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock)
-{
-  if (!lock->initialized)
-    return EINVAL;
-  return pthread_mutex_unlock (&lock->recmutex);
-}
-
-int
-glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock)
-{
-  int err;
-
-  if (!lock->initialized)
-    return EINVAL;
-  err = pthread_mutex_destroy (&lock->recmutex);
-  if (err != 0)
-    return err;
-  lock->initialized = 0;
-  return 0;
-}
-
-#  endif
-
-# else
-
-int
-glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock)
-{
-  int err;
-
-  err = pthread_mutex_init (&lock->mutex, NULL);
-  if (err != 0)
-    return err;
-  lock->owner = (pthread_t) 0;
-  lock->depth = 0;
-  return 0;
-}
-
-int
-glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock)
-{
-  pthread_t self = pthread_self ();
-  if (lock->owner != self)
-    {
-      int err;
-
-      err = pthread_mutex_lock (&lock->mutex);
-      if (err != 0)
-        return err;
-      lock->owner = self;
-    }
-  if (++(lock->depth) == 0) /* wraparound? */
-    {
-      lock->depth--;
-      return EAGAIN;
-    }
-  return 0;
-}
-
-int
-glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock)
-{
-  if (lock->owner != pthread_self ())
-    return EPERM;
-  if (lock->depth == 0)
-    return EINVAL;
-  if (--(lock->depth) == 0)
-    {
-      lock->owner = (pthread_t) 0;
-      return pthread_mutex_unlock (&lock->mutex);
-    }
-  else
-    return 0;
-}
-
-int
-glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock)
-{
-  if (lock->owner != (pthread_t) 0)
-    return EBUSY;
-  return pthread_mutex_destroy (&lock->mutex);
-}
-
-# endif
-
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-static const pthread_once_t fresh_once = PTHREAD_ONCE_INIT;
-
-int
-glthread_once_singlethreaded (pthread_once_t *once_control)
-{
-  /* We don't know whether pthread_once_t is an integer type, a floating-point
-     type, a pointer type, or a structure type.  */
-  char *firstbyte = (char *)once_control;
-  if (*firstbyte == *(const char *)&fresh_once)
-    {
-      /* First time use of once_control.  Invert the first byte.  */
-      *firstbyte = ~ *(const char *)&fresh_once;
-      return 1;
-    }
-  else
-    return 0;
-}
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_PTH_THREADS
-
-/* Use the GNU Pth threads library.  */
-
-/* -------------------------- gl_lock_t datatype -------------------------- */
-
-/* ------------------------- gl_rwlock_t datatype ------------------------- */
-
-/* --------------------- gl_recursive_lock_t datatype --------------------- */
-
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-static void
-glthread_once_call (void *arg)
-{
-  void (**gl_once_temp_addr) (void) = (void (**) (void)) arg;
-  void (*initfunction) (void) = *gl_once_temp_addr;
-  initfunction ();
-}
-
-int
-glthread_once_multithreaded (pth_once_t *once_control, void (*initfunction) (void))
-{
-  void (*temp) (void) = initfunction;
-  return (!pth_once (once_control, glthread_once_call, &temp) ? errno : 0);
-}
-
-int
-glthread_once_singlethreaded (pth_once_t *once_control)
-{
-  /* We know that pth_once_t is an integer type.  */
-  if (*once_control == PTH_ONCE_INIT)
-    {
-      /* First time use of once_control.  Invert the marker.  */
-      *once_control = ~ PTH_ONCE_INIT;
-      return 1;
-    }
-  else
-    return 0;
-}
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_SOLARIS_THREADS
-
-/* Use the old Solaris threads library.  */
-
-/* -------------------------- gl_lock_t datatype -------------------------- */
-
-/* ------------------------- gl_rwlock_t datatype ------------------------- */
-
-/* --------------------- gl_recursive_lock_t datatype --------------------- */
-
-int
-glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock)
-{
-  int err;
-
-  err = mutex_init (&lock->mutex, USYNC_THREAD, NULL);
-  if (err != 0)
-    return err;
-  lock->owner = (thread_t) 0;
-  lock->depth = 0;
-  return 0;
-}
-
-int
-glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock)
-{
-  thread_t self = thr_self ();
-  if (lock->owner != self)
-    {
-      int err;
-
-      err = mutex_lock (&lock->mutex);
-      if (err != 0)
-        return err;
-      lock->owner = self;
-    }
-  if (++(lock->depth) == 0) /* wraparound? */
-    {
-      lock->depth--;
-      return EAGAIN;
-    }
-  return 0;
-}
-
-int
-glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock)
-{
-  if (lock->owner != thr_self ())
-    return EPERM;
-  if (lock->depth == 0)
-    return EINVAL;
-  if (--(lock->depth) == 0)
-    {
-      lock->owner = (thread_t) 0;
-      return mutex_unlock (&lock->mutex);
-    }
-  else
-    return 0;
-}
-
-int
-glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock)
-{
-  if (lock->owner != (thread_t) 0)
-    return EBUSY;
-  return mutex_destroy (&lock->mutex);
-}
-
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-int
-glthread_once_multithreaded (gl_once_t *once_control, void (*initfunction) (void))
-{
-  if (!once_control->inited)
-    {
-      int err;
-
-      /* Use the mutex to guarantee that if another thread is already calling
-         the initfunction, this thread waits until it's finished.  */
-      err = mutex_lock (&once_control->mutex);
-      if (err != 0)
-        return err;
-      if (!once_control->inited)
-        {
-          once_control->inited = 1;
-          initfunction ();
-        }
-      return mutex_unlock (&once_control->mutex);
-    }
-  else
-    return 0;
-}
-
-int
-glthread_once_singlethreaded (gl_once_t *once_control)
-{
-  /* We know that gl_once_t contains an integer type.  */
-  if (!once_control->inited)
-    {
-      /* First time use of once_control.  Invert the marker.  */
-      once_control->inited = ~ 0;
-      return 1;
-    }
-  else
-    return 0;
-}
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_WINDOWS_THREADS
-
-/* -------------------------- gl_lock_t datatype -------------------------- */
-
-void
-glthread_lock_init_func (gl_lock_t *lock)
-{
-  InitializeCriticalSection (&lock->lock);
-  lock->guard.done = 1;
-}
-
-int
-glthread_lock_lock_func (gl_lock_t *lock)
-{
-  if (!lock->guard.done)
-    {
-      if (InterlockedIncrement (&lock->guard.started) == 0)
-        /* This thread is the first one to need this lock.  Initialize it.  */
-        glthread_lock_init (lock);
-      else
-        /* Yield the CPU while waiting for another thread to finish
-           initializing this lock.  */
-        while (!lock->guard.done)
-          Sleep (0);
-    }
-  EnterCriticalSection (&lock->lock);
-  return 0;
-}
-
-int
-glthread_lock_unlock_func (gl_lock_t *lock)
-{
-  if (!lock->guard.done)
-    return EINVAL;
-  LeaveCriticalSection (&lock->lock);
-  return 0;
-}
-
-int
-glthread_lock_destroy_func (gl_lock_t *lock)
-{
-  if (!lock->guard.done)
-    return EINVAL;
-  DeleteCriticalSection (&lock->lock);
-  lock->guard.done = 0;
-  return 0;
-}
-
-/* ------------------------- gl_rwlock_t datatype ------------------------- */
-
-/* In this file, the waitqueues are implemented as circular arrays.  */
-#define gl_waitqueue_t gl_carray_waitqueue_t
-
-static void
-gl_waitqueue_init (gl_waitqueue_t *wq)
-{
-  wq->array = NULL;
-  wq->count = 0;
-  wq->alloc = 0;
-  wq->offset = 0;
-}
-
-/* Enqueues the current thread, represented by an event, in a wait queue.
-   Returns INVALID_HANDLE_VALUE if an allocation failure occurs.  */
-static HANDLE
-gl_waitqueue_add (gl_waitqueue_t *wq)
-{
-  HANDLE event;
-  unsigned int index;
-
-  if (wq->count == wq->alloc)
-    {
-      unsigned int new_alloc = 2 * wq->alloc + 1;
-      HANDLE *new_array =
-        (HANDLE *) realloc (wq->array, new_alloc * sizeof (HANDLE));
-      if (new_array == NULL)
-        /* No more memory.  */
-        return INVALID_HANDLE_VALUE;
-      /* Now is a good opportunity to rotate the array so that its contents
-         starts at offset 0.  */
-      if (wq->offset > 0)
-        {
-          unsigned int old_count = wq->count;
-          unsigned int old_alloc = wq->alloc;
-          unsigned int old_offset = wq->offset;
-          unsigned int i;
-          if (old_offset + old_count > old_alloc)
-            {
-              unsigned int limit = old_offset + old_count - old_alloc;
-              for (i = 0; i < limit; i++)
-                new_array[old_alloc + i] = new_array[i];
-            }
-          for (i = 0; i < old_count; i++)
-            new_array[i] = new_array[old_offset + i];
-          wq->offset = 0;
-        }
-      wq->array = new_array;
-      wq->alloc = new_alloc;
-    }
-  /* Whether the created event is a manual-reset one or an auto-reset one,
-     does not matter, since we will wait on it only once.  */
-  event = CreateEvent (NULL, TRUE, FALSE, NULL);
-  if (event == INVALID_HANDLE_VALUE)
-    /* No way to allocate an event.  */
-    return INVALID_HANDLE_VALUE;
-  index = wq->offset + wq->count;
-  if (index >= wq->alloc)
-    index -= wq->alloc;
-  wq->array[index] = event;
-  wq->count++;
-  return event;
-}
-
-/* Notifies the first thread from a wait queue and dequeues it.  */
-static void
-gl_waitqueue_notify_first (gl_waitqueue_t *wq)
-{
-  SetEvent (wq->array[wq->offset + 0]);
-  wq->offset++;
-  wq->count--;
-  if (wq->count == 0 || wq->offset == wq->alloc)
-    wq->offset = 0;
-}
-
-/* Notifies all threads from a wait queue and dequeues them all.  */
-static void
-gl_waitqueue_notify_all (gl_waitqueue_t *wq)
-{
-  unsigned int i;
-
-  for (i = 0; i < wq->count; i++)
-    {
-      unsigned int index = wq->offset + i;
-      if (index >= wq->alloc)
-        index -= wq->alloc;
-      SetEvent (wq->array[index]);
-    }
-  wq->count = 0;
-  wq->offset = 0;
-}
-
-void
-glthread_rwlock_init_func (gl_rwlock_t *lock)
-{
-  InitializeCriticalSection (&lock->lock);
-  gl_waitqueue_init (&lock->waiting_readers);
-  gl_waitqueue_init (&lock->waiting_writers);
-  lock->runcount = 0;
-  lock->guard.done = 1;
-}
-
-int
-glthread_rwlock_rdlock_func (gl_rwlock_t *lock)
-{
-  if (!lock->guard.done)
-    {
-      if (InterlockedIncrement (&lock->guard.started) == 0)
-        /* This thread is the first one to need this lock.  Initialize it.  */
-        glthread_rwlock_init (lock);
-      else
-        /* Yield the CPU while waiting for another thread to finish
-           initializing this lock.  */
-        while (!lock->guard.done)
-          Sleep (0);
-    }
-  EnterCriticalSection (&lock->lock);
-  /* Test whether only readers are currently running, and whether the runcount
-     field will not overflow.  */
-  if (!(lock->runcount + 1 > 0))
-    {
-      /* This thread has to wait for a while.  Enqueue it among the
-         waiting_readers.  */
-      HANDLE event = gl_waitqueue_add (&lock->waiting_readers);
-      if (event != INVALID_HANDLE_VALUE)
-        {
-          DWORD result;
-          LeaveCriticalSection (&lock->lock);
-          /* Wait until another thread signals this event.  */
-          result = WaitForSingleObject (event, INFINITE);
-          if (result == WAIT_FAILED || result == WAIT_TIMEOUT)
-            abort ();
-          CloseHandle (event);
-          /* The thread which signalled the event already did the bookkeeping:
-             removed us from the waiting_readers, incremented lock->runcount.  */
-          if (!(lock->runcount > 0))
-            abort ();
-          return 0;
-        }
-      else
-        {
-          /* Allocation failure.  Weird.  */
-          do
-            {
-              LeaveCriticalSection (&lock->lock);
-              Sleep (1);
-              EnterCriticalSection (&lock->lock);
-            }
-          while (!(lock->runcount + 1 > 0));
-        }
-    }
-  lock->runcount++;
-  LeaveCriticalSection (&lock->lock);
-  return 0;
-}
-
-int
-glthread_rwlock_wrlock_func (gl_rwlock_t *lock)
-{
-  if (!lock->guard.done)
-    {
-      if (InterlockedIncrement (&lock->guard.started) == 0)
-        /* This thread is the first one to need this lock.  Initialize it.  */
-        glthread_rwlock_init (lock);
-      else
-        /* Yield the CPU while waiting for another thread to finish
-           initializing this lock.  */
-        while (!lock->guard.done)
-          Sleep (0);
-    }
-  EnterCriticalSection (&lock->lock);
-  /* Test whether no readers or writers are currently running.  */
-  if (!(lock->runcount == 0))
-    {
-      /* This thread has to wait for a while.  Enqueue it among the
-         waiting_writers.  */
-      HANDLE event = gl_waitqueue_add (&lock->waiting_writers);
-      if (event != INVALID_HANDLE_VALUE)
-        {
-          DWORD result;
-          LeaveCriticalSection (&lock->lock);
-          /* Wait until another thread signals this event.  */
-          result = WaitForSingleObject (event, INFINITE);
-          if (result == WAIT_FAILED || result == WAIT_TIMEOUT)
-            abort ();
-          CloseHandle (event);
-          /* The thread which signalled the event already did the bookkeeping:
-             removed us from the waiting_writers, set lock->runcount = -1.  */
-          if (!(lock->runcount == -1))
-            abort ();
-          return 0;
-        }
-      else
-        {
-          /* Allocation failure.  Weird.  */
-          do
-            {
-              LeaveCriticalSection (&lock->lock);
-              Sleep (1);
-              EnterCriticalSection (&lock->lock);
-            }
-          while (!(lock->runcount == 0));
-        }
-    }
-  lock->runcount--; /* runcount becomes -1 */
-  LeaveCriticalSection (&lock->lock);
-  return 0;
-}
-
-int
-glthread_rwlock_unlock_func (gl_rwlock_t *lock)
-{
-  if (!lock->guard.done)
-    return EINVAL;
-  EnterCriticalSection (&lock->lock);
-  if (lock->runcount < 0)
-    {
-      /* Drop a writer lock.  */
-      if (!(lock->runcount == -1))
-        abort ();
-      lock->runcount = 0;
-    }
-  else
-    {
-      /* Drop a reader lock.  */
-      if (!(lock->runcount > 0))
-        {
-          LeaveCriticalSection (&lock->lock);
-          return EPERM;
-        }
-      lock->runcount--;
-    }
-  if (lock->runcount == 0)
-    {
-      /* POSIX recommends that "write locks shall take precedence over read
-         locks", to avoid "writer starvation".  */
-      if (lock->waiting_writers.count > 0)
-        {
-          /* Wake up one of the waiting writers.  */
-          lock->runcount--;
-          gl_waitqueue_notify_first (&lock->waiting_writers);
-        }
-      else
-        {
-          /* Wake up all waiting readers.  */
-          lock->runcount += lock->waiting_readers.count;
-          gl_waitqueue_notify_all (&lock->waiting_readers);
-        }
-    }
-  LeaveCriticalSection (&lock->lock);
-  return 0;
-}
-
-int
-glthread_rwlock_destroy_func (gl_rwlock_t *lock)
-{
-  if (!lock->guard.done)
-    return EINVAL;
-  if (lock->runcount != 0)
-    return EBUSY;
-  DeleteCriticalSection (&lock->lock);
-  if (lock->waiting_readers.array != NULL)
-    free (lock->waiting_readers.array);
-  if (lock->waiting_writers.array != NULL)
-    free (lock->waiting_writers.array);
-  lock->guard.done = 0;
-  return 0;
-}
-
-/* --------------------- gl_recursive_lock_t datatype --------------------- */
-
-void
-glthread_recursive_lock_init_func (gl_recursive_lock_t *lock)
-{
-  lock->owner = 0;
-  lock->depth = 0;
-  InitializeCriticalSection (&lock->lock);
-  lock->guard.done = 1;
-}
-
-int
-glthread_recursive_lock_lock_func (gl_recursive_lock_t *lock)
-{
-  if (!lock->guard.done)
-    {
-      if (InterlockedIncrement (&lock->guard.started) == 0)
-        /* This thread is the first one to need this lock.  Initialize it.  */
-        glthread_recursive_lock_init (lock);
-      else
-        /* Yield the CPU while waiting for another thread to finish
-           initializing this lock.  */
-        while (!lock->guard.done)
-          Sleep (0);
-    }
-  {
-    DWORD self = GetCurrentThreadId ();
-    if (lock->owner != self)
-      {
-        EnterCriticalSection (&lock->lock);
-        lock->owner = self;
-      }
-    if (++(lock->depth) == 0) /* wraparound? */
-      {
-        lock->depth--;
-        return EAGAIN;
-      }
-  }
-  return 0;
-}
-
-int
-glthread_recursive_lock_unlock_func (gl_recursive_lock_t *lock)
-{
-  if (lock->owner != GetCurrentThreadId ())
-    return EPERM;
-  if (lock->depth == 0)
-    return EINVAL;
-  if (--(lock->depth) == 0)
-    {
-      lock->owner = 0;
-      LeaveCriticalSection (&lock->lock);
-    }
-  return 0;
-}
-
-int
-glthread_recursive_lock_destroy_func (gl_recursive_lock_t *lock)
-{
-  if (lock->owner != 0)
-    return EBUSY;
-  DeleteCriticalSection (&lock->lock);
-  lock->guard.done = 0;
-  return 0;
-}
-
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-void
-glthread_once_func (gl_once_t *once_control, void (*initfunction) (void))
-{
-  if (once_control->inited <= 0)
-    {
-      if (InterlockedIncrement (&once_control->started) == 0)
-        {
-          /* This thread is the first one to come to this once_control.  */
-          InitializeCriticalSection (&once_control->lock);
-          EnterCriticalSection (&once_control->lock);
-          once_control->inited = 0;
-          initfunction ();
-          once_control->inited = 1;
-          LeaveCriticalSection (&once_control->lock);
-        }
-      else
-        {
-          /* Undo last operation.  */
-          InterlockedDecrement (&once_control->started);
-          /* Some other thread has already started the initialization.
-             Yield the CPU while waiting for the other thread to finish
-             initializing and taking the lock.  */
-          while (once_control->inited < 0)
-            Sleep (0);
-          if (once_control->inited <= 0)
-            {
-              /* Take the lock.  This blocks until the other thread has
-                 finished calling the initfunction.  */
-              EnterCriticalSection (&once_control->lock);
-              LeaveCriticalSection (&once_control->lock);
-              if (!(once_control->inited > 0))
-                abort ();
-            }
-        }
-    }
-}
-
-#endif
-
-/* ========================================================================= */
diff --git a/gl/tests/glthread/lock.h b/gl/tests/glthread/lock.h
deleted file mode 100644 (file)
index 36096c4..0000000
+++ /dev/null
@@ -1,927 +0,0 @@
-/* Locking in multithreaded situations.
-   Copyright (C) 2005-2014 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2005.
-   Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-solaris.h,
-   gthr-win32.h.  */
-
-/* This file contains locking primitives for use with a given thread library.
-   It does not contain primitives for creating threads or for other
-   synchronization primitives.
-
-   Normal (non-recursive) locks:
-     Type:                gl_lock_t
-     Declaration:         gl_lock_define(extern, name)
-     Initializer:         gl_lock_define_initialized(, name)
-     Initialization:      gl_lock_init (name);
-     Taking the lock:     gl_lock_lock (name);
-     Releasing the lock:  gl_lock_unlock (name);
-     De-initialization:   gl_lock_destroy (name);
-   Equivalent functions with control of error handling:
-     Initialization:      err = glthread_lock_init (&name);
-     Taking the lock:     err = glthread_lock_lock (&name);
-     Releasing the lock:  err = glthread_lock_unlock (&name);
-     De-initialization:   err = glthread_lock_destroy (&name);
-
-   Read-Write (non-recursive) locks:
-     Type:                gl_rwlock_t
-     Declaration:         gl_rwlock_define(extern, name)
-     Initializer:         gl_rwlock_define_initialized(, name)
-     Initialization:      gl_rwlock_init (name);
-     Taking the lock:     gl_rwlock_rdlock (name);
-                          gl_rwlock_wrlock (name);
-     Releasing the lock:  gl_rwlock_unlock (name);
-     De-initialization:   gl_rwlock_destroy (name);
-   Equivalent functions with control of error handling:
-     Initialization:      err = glthread_rwlock_init (&name);
-     Taking the lock:     err = glthread_rwlock_rdlock (&name);
-                          err = glthread_rwlock_wrlock (&name);
-     Releasing the lock:  err = glthread_rwlock_unlock (&name);
-     De-initialization:   err = glthread_rwlock_destroy (&name);
-
-   Recursive locks:
-     Type:                gl_recursive_lock_t
-     Declaration:         gl_recursive_lock_define(extern, name)
-     Initializer:         gl_recursive_lock_define_initialized(, name)
-     Initialization:      gl_recursive_lock_init (name);
-     Taking the lock:     gl_recursive_lock_lock (name);
-     Releasing the lock:  gl_recursive_lock_unlock (name);
-     De-initialization:   gl_recursive_lock_destroy (name);
-   Equivalent functions with control of error handling:
-     Initialization:      err = glthread_recursive_lock_init (&name);
-     Taking the lock:     err = glthread_recursive_lock_lock (&name);
-     Releasing the lock:  err = glthread_recursive_lock_unlock (&name);
-     De-initialization:   err = glthread_recursive_lock_destroy (&name);
-
-  Once-only execution:
-     Type:                gl_once_t
-     Initializer:         gl_once_define(extern, name)
-     Execution:           gl_once (name, initfunction);
-   Equivalent functions with control of error handling:
-     Execution:           err = glthread_once (&name, initfunction);
-*/
-
-
-#ifndef _LOCK_H
-#define _LOCK_H
-
-#include <errno.h>
-#include <stdlib.h>
-
-/* ========================================================================= */
-
-#if USE_POSIX_THREADS
-
-/* Use the POSIX threads library.  */
-
-# include <pthread.h>
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-# if PTHREAD_IN_USE_DETECTION_HARD
-
-/* The pthread_in_use() detection needs to be done at runtime.  */
-#  define pthread_in_use() \
-     glthread_in_use ()
-extern int glthread_in_use (void);
-
-# endif
-
-# if USE_POSIX_THREADS_WEAK
-
-/* Use weak references to the POSIX threads library.  */
-
-/* Weak references avoid dragging in external libraries if the other parts
-   of the program don't use them.  Here we use them, because we don't want
-   every program that uses libintl to depend on libpthread.  This assumes
-   that libpthread would not be loaded after libintl; i.e. if libintl is
-   loaded first, by an executable that does not depend on libpthread, and
-   then a module is dynamically loaded that depends on libpthread, libintl
-   will not be multithread-safe.  */
-
-/* The way to test at runtime whether libpthread is present is to test
-   whether a function pointer's value, such as &pthread_mutex_init, is
-   non-NULL.  However, some versions of GCC have a bug through which, in
-   PIC mode, &foo != NULL always evaluates to true if there is a direct
-   call to foo(...) in the same function.  To avoid this, we test the
-   address of a function in libpthread that we don't use.  */
-
-#  pragma weak pthread_mutex_init
-#  pragma weak pthread_mutex_lock
-#  pragma weak pthread_mutex_unlock
-#  pragma weak pthread_mutex_destroy
-#  pragma weak pthread_rwlock_init
-#  pragma weak pthread_rwlock_rdlock
-#  pragma weak pthread_rwlock_wrlock
-#  pragma weak pthread_rwlock_unlock
-#  pragma weak pthread_rwlock_destroy
-#  pragma weak pthread_once
-#  pragma weak pthread_cond_init
-#  pragma weak pthread_cond_wait
-#  pragma weak pthread_cond_signal
-#  pragma weak pthread_cond_broadcast
-#  pragma weak pthread_cond_destroy
-#  pragma weak pthread_mutexattr_init
-#  pragma weak pthread_mutexattr_settype
-#  pragma weak pthread_mutexattr_destroy
-#  ifndef pthread_self
-#   pragma weak pthread_self
-#  endif
-
-#  if !PTHREAD_IN_USE_DETECTION_HARD
-#   pragma weak pthread_cancel
-#   define pthread_in_use() (pthread_cancel != NULL)
-#  endif
-
-# else
-
-#  if !PTHREAD_IN_USE_DETECTION_HARD
-#   define pthread_in_use() 1
-#  endif
-
-# endif
-
-/* -------------------------- gl_lock_t datatype -------------------------- */
-
-typedef pthread_mutex_t gl_lock_t;
-# define gl_lock_define(STORAGECLASS, NAME) \
-    STORAGECLASS pthread_mutex_t NAME;
-# define gl_lock_define_initialized(STORAGECLASS, NAME) \
-    STORAGECLASS pthread_mutex_t NAME = gl_lock_initializer;
-# define gl_lock_initializer \
-    PTHREAD_MUTEX_INITIALIZER
-# define glthread_lock_init(LOCK) \
-    (pthread_in_use () ? pthread_mutex_init (LOCK, NULL) : 0)
-# define glthread_lock_lock(LOCK) \
-    (pthread_in_use () ? pthread_mutex_lock (LOCK) : 0)
-# define glthread_lock_unlock(LOCK) \
-    (pthread_in_use () ? pthread_mutex_unlock (LOCK) : 0)
-# define glthread_lock_destroy(LOCK) \
-    (pthread_in_use () ? pthread_mutex_destroy (LOCK) : 0)
-
-/* ------------------------- gl_rwlock_t datatype ------------------------- */
-
-# if HAVE_PTHREAD_RWLOCK
-
-#  ifdef PTHREAD_RWLOCK_INITIALIZER
-
-typedef pthread_rwlock_t gl_rwlock_t;
-#   define gl_rwlock_define(STORAGECLASS, NAME) \
-      STORAGECLASS pthread_rwlock_t NAME;
-#   define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
-      STORAGECLASS pthread_rwlock_t NAME = gl_rwlock_initializer;
-#   define gl_rwlock_initializer \
-      PTHREAD_RWLOCK_INITIALIZER
-#   define glthread_rwlock_init(LOCK) \
-      (pthread_in_use () ? pthread_rwlock_init (LOCK, NULL) : 0)
-#   define glthread_rwlock_rdlock(LOCK) \
-      (pthread_in_use () ? pthread_rwlock_rdlock (LOCK) : 0)
-#   define glthread_rwlock_wrlock(LOCK) \
-      (pthread_in_use () ? pthread_rwlock_wrlock (LOCK) : 0)
-#   define glthread_rwlock_unlock(LOCK) \
-      (pthread_in_use () ? pthread_rwlock_unlock (LOCK) : 0)
-#   define glthread_rwlock_destroy(LOCK) \
-      (pthread_in_use () ? pthread_rwlock_destroy (LOCK) : 0)
-
-#  else
-
-typedef struct
-        {
-          int initialized;
-          pthread_mutex_t guard;   /* protects the initialization */
-          pthread_rwlock_t rwlock; /* read-write lock */
-        }
-        gl_rwlock_t;
-#   define gl_rwlock_define(STORAGECLASS, NAME) \
-      STORAGECLASS gl_rwlock_t NAME;
-#   define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
-      STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer;
-#   define gl_rwlock_initializer \
-      { 0, PTHREAD_MUTEX_INITIALIZER }
-#   define glthread_rwlock_init(LOCK) \
-      (pthread_in_use () ? glthread_rwlock_init_multithreaded (LOCK) : 0)
-#   define glthread_rwlock_rdlock(LOCK) \
-      (pthread_in_use () ? glthread_rwlock_rdlock_multithreaded (LOCK) : 0)
-#   define glthread_rwlock_wrlock(LOCK) \
-      (pthread_in_use () ? glthread_rwlock_wrlock_multithreaded (LOCK) : 0)
-#   define glthread_rwlock_unlock(LOCK) \
-      (pthread_in_use () ? glthread_rwlock_unlock_multithreaded (LOCK) : 0)
-#   define glthread_rwlock_destroy(LOCK) \
-      (pthread_in_use () ? glthread_rwlock_destroy_multithreaded (LOCK) : 0)
-extern int glthread_rwlock_init_multithreaded (gl_rwlock_t *lock);
-extern int glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock);
-extern int glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock);
-extern int glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock);
-extern int glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock);
-
-#  endif
-
-# else
-
-typedef struct
-        {
-          pthread_mutex_t lock; /* protects the remaining fields */
-          pthread_cond_t waiting_readers; /* waiting readers */
-          pthread_cond_t waiting_writers; /* waiting writers */
-          unsigned int waiting_writers_count; /* number of waiting writers */
-          int runcount; /* number of readers running, or -1 when a writer runs */
-        }
-        gl_rwlock_t;
-# define gl_rwlock_define(STORAGECLASS, NAME) \
-    STORAGECLASS gl_rwlock_t NAME;
-# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
-    STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer;
-# define gl_rwlock_initializer \
-    { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0 }
-# define glthread_rwlock_init(LOCK) \
-    (pthread_in_use () ? glthread_rwlock_init_multithreaded (LOCK) : 0)
-# define glthread_rwlock_rdlock(LOCK) \
-    (pthread_in_use () ? glthread_rwlock_rdlock_multithreaded (LOCK) : 0)
-# define glthread_rwlock_wrlock(LOCK) \
-    (pthread_in_use () ? glthread_rwlock_wrlock_multithreaded (LOCK) : 0)
-# define glthread_rwlock_unlock(LOCK) \
-    (pthread_in_use () ? glthread_rwlock_unlock_multithreaded (LOCK) : 0)
-# define glthread_rwlock_destroy(LOCK) \
-    (pthread_in_use () ? glthread_rwlock_destroy_multithreaded (LOCK) : 0)
-extern int glthread_rwlock_init_multithreaded (gl_rwlock_t *lock);
-extern int glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock);
-extern int glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock);
-extern int glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock);
-extern int glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock);
-
-# endif
-
-/* --------------------- gl_recursive_lock_t datatype --------------------- */
-
-# if HAVE_PTHREAD_MUTEX_RECURSIVE
-
-#  if defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
-
-typedef pthread_mutex_t gl_recursive_lock_t;
-#   define gl_recursive_lock_define(STORAGECLASS, NAME) \
-      STORAGECLASS pthread_mutex_t NAME;
-#   define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
-      STORAGECLASS pthread_mutex_t NAME = gl_recursive_lock_initializer;
-#   ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER
-#    define gl_recursive_lock_initializer \
-       PTHREAD_RECURSIVE_MUTEX_INITIALIZER
-#   else
-#    define gl_recursive_lock_initializer \
-       PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
-#   endif
-#   define glthread_recursive_lock_init(LOCK) \
-      (pthread_in_use () ? glthread_recursive_lock_init_multithreaded (LOCK) : 0)
-#   define glthread_recursive_lock_lock(LOCK) \
-      (pthread_in_use () ? pthread_mutex_lock (LOCK) : 0)
-#   define glthread_recursive_lock_unlock(LOCK) \
-      (pthread_in_use () ? pthread_mutex_unlock (LOCK) : 0)
-#   define glthread_recursive_lock_destroy(LOCK) \
-      (pthread_in_use () ? pthread_mutex_destroy (LOCK) : 0)
-extern int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock);
-
-#  else
-
-typedef struct
-        {
-          pthread_mutex_t recmutex; /* recursive mutex */
-          pthread_mutex_t guard;    /* protects the initialization */
-          int initialized;
-        }
-        gl_recursive_lock_t;
-#   define gl_recursive_lock_define(STORAGECLASS, NAME) \
-      STORAGECLASS gl_recursive_lock_t NAME;
-#   define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
-      STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer;
-#   define gl_recursive_lock_initializer \
-      { PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, 0 }
-#   define glthread_recursive_lock_init(LOCK) \
-      (pthread_in_use () ? glthread_recursive_lock_init_multithreaded (LOCK) : 0)
-#   define glthread_recursive_lock_lock(LOCK) \
-      (pthread_in_use () ? glthread_recursive_lock_lock_multithreaded (LOCK) : 0)
-#   define glthread_recursive_lock_unlock(LOCK) \
-      (pthread_in_use () ? glthread_recursive_lock_unlock_multithreaded (LOCK) : 0)
-#   define glthread_recursive_lock_destroy(LOCK) \
-      (pthread_in_use () ? glthread_recursive_lock_destroy_multithreaded (LOCK) : 0)
-extern int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock);
-extern int glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock);
-extern int glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock);
-extern int glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock);
-
-#  endif
-
-# else
-
-/* Old versions of POSIX threads on Solaris did not have recursive locks.
-   We have to implement them ourselves.  */
-
-typedef struct
-        {
-          pthread_mutex_t mutex;
-          pthread_t owner;
-          unsigned long depth;
-        }
-        gl_recursive_lock_t;
-#  define gl_recursive_lock_define(STORAGECLASS, NAME) \
-     STORAGECLASS gl_recursive_lock_t NAME;
-#  define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
-     STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer;
-#  define gl_recursive_lock_initializer \
-     { PTHREAD_MUTEX_INITIALIZER, (pthread_t) 0, 0 }
-#  define glthread_recursive_lock_init(LOCK) \
-     (pthread_in_use () ? glthread_recursive_lock_init_multithreaded (LOCK) : 0)
-#  define glthread_recursive_lock_lock(LOCK) \
-     (pthread_in_use () ? glthread_recursive_lock_lock_multithreaded (LOCK) : 0)
-#  define glthread_recursive_lock_unlock(LOCK) \
-     (pthread_in_use () ? glthread_recursive_lock_unlock_multithreaded (LOCK) : 0)
-#  define glthread_recursive_lock_destroy(LOCK) \
-     (pthread_in_use () ? glthread_recursive_lock_destroy_multithreaded (LOCK) : 0)
-extern int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock);
-extern int glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock);
-extern int glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock);
-extern int glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock);
-
-# endif
-
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-typedef pthread_once_t gl_once_t;
-# define gl_once_define(STORAGECLASS, NAME) \
-    STORAGECLASS pthread_once_t NAME = PTHREAD_ONCE_INIT;
-# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
-    (pthread_in_use ()                                                         \
-     ? pthread_once (ONCE_CONTROL, INITFUNCTION)                               \
-     : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0))
-extern int glthread_once_singlethreaded (pthread_once_t *once_control);
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_PTH_THREADS
-
-/* Use the GNU Pth threads library.  */
-
-# include <pth.h>
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-# if USE_PTH_THREADS_WEAK
-
-/* Use weak references to the GNU Pth threads library.  */
-
-#  pragma weak pth_mutex_init
-#  pragma weak pth_mutex_acquire
-#  pragma weak pth_mutex_release
-#  pragma weak pth_rwlock_init
-#  pragma weak pth_rwlock_acquire
-#  pragma weak pth_rwlock_release
-#  pragma weak pth_once
-
-#  pragma weak pth_cancel
-#  define pth_in_use() (pth_cancel != NULL)
-
-# else
-
-#  define pth_in_use() 1
-
-# endif
-
-/* -------------------------- gl_lock_t datatype -------------------------- */
-
-typedef pth_mutex_t gl_lock_t;
-# define gl_lock_define(STORAGECLASS, NAME) \
-    STORAGECLASS pth_mutex_t NAME;
-# define gl_lock_define_initialized(STORAGECLASS, NAME) \
-    STORAGECLASS pth_mutex_t NAME = gl_lock_initializer;
-# define gl_lock_initializer \
-    PTH_MUTEX_INIT
-# define glthread_lock_init(LOCK) \
-    (pth_in_use () && !pth_mutex_init (LOCK) ? errno : 0)
-# define glthread_lock_lock(LOCK) \
-    (pth_in_use () && !pth_mutex_acquire (LOCK, 0, NULL) ? errno : 0)
-# define glthread_lock_unlock(LOCK) \
-    (pth_in_use () && !pth_mutex_release (LOCK) ? errno : 0)
-# define glthread_lock_destroy(LOCK) \
-    ((void)(LOCK), 0)
-
-/* ------------------------- gl_rwlock_t datatype ------------------------- */
-
-typedef pth_rwlock_t gl_rwlock_t;
-#  define gl_rwlock_define(STORAGECLASS, NAME) \
-     STORAGECLASS pth_rwlock_t NAME;
-#  define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
-     STORAGECLASS pth_rwlock_t NAME = gl_rwlock_initializer;
-#  define gl_rwlock_initializer \
-     PTH_RWLOCK_INIT
-#  define glthread_rwlock_init(LOCK) \
-     (pth_in_use () && !pth_rwlock_init (LOCK) ? errno : 0)
-#  define glthread_rwlock_rdlock(LOCK) \
-     (pth_in_use () && !pth_rwlock_acquire (LOCK, PTH_RWLOCK_RD, 0, NULL) ? errno : 0)
-#  define glthread_rwlock_wrlock(LOCK) \
-     (pth_in_use () && !pth_rwlock_acquire (LOCK, PTH_RWLOCK_RW, 0, NULL) ? errno : 0)
-#  define glthread_rwlock_unlock(LOCK) \
-     (pth_in_use () && !pth_rwlock_release (LOCK) ? errno : 0)
-#  define glthread_rwlock_destroy(LOCK) \
-     ((void)(LOCK), 0)
-
-/* --------------------- gl_recursive_lock_t datatype --------------------- */
-
-/* In Pth, mutexes are recursive by default.  */
-typedef pth_mutex_t gl_recursive_lock_t;
-#  define gl_recursive_lock_define(STORAGECLASS, NAME) \
-     STORAGECLASS pth_mutex_t NAME;
-#  define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
-     STORAGECLASS pth_mutex_t NAME = gl_recursive_lock_initializer;
-#  define gl_recursive_lock_initializer \
-     PTH_MUTEX_INIT
-#  define glthread_recursive_lock_init(LOCK) \
-     (pth_in_use () && !pth_mutex_init (LOCK) ? errno : 0)
-#  define glthread_recursive_lock_lock(LOCK) \
-     (pth_in_use () && !pth_mutex_acquire (LOCK, 0, NULL) ? errno : 0)
-#  define glthread_recursive_lock_unlock(LOCK) \
-     (pth_in_use () && !pth_mutex_release (LOCK) ? errno : 0)
-#  define glthread_recursive_lock_destroy(LOCK) \
-     ((void)(LOCK), 0)
-
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-typedef pth_once_t gl_once_t;
-# define gl_once_define(STORAGECLASS, NAME) \
-    STORAGECLASS pth_once_t NAME = PTH_ONCE_INIT;
-# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
-    (pth_in_use ()                                                             \
-     ? glthread_once_multithreaded (ONCE_CONTROL, INITFUNCTION)                \
-     : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0))
-extern int glthread_once_multithreaded (pth_once_t *once_control, void (*initfunction) (void));
-extern int glthread_once_singlethreaded (pth_once_t *once_control);
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_SOLARIS_THREADS
-
-/* Use the old Solaris threads library.  */
-
-# include <thread.h>
-# include <synch.h>
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-# if USE_SOLARIS_THREADS_WEAK
-
-/* Use weak references to the old Solaris threads library.  */
-
-#  pragma weak mutex_init
-#  pragma weak mutex_lock
-#  pragma weak mutex_unlock
-#  pragma weak mutex_destroy
-#  pragma weak rwlock_init
-#  pragma weak rw_rdlock
-#  pragma weak rw_wrlock
-#  pragma weak rw_unlock
-#  pragma weak rwlock_destroy
-#  pragma weak thr_self
-
-#  pragma weak thr_suspend
-#  define thread_in_use() (thr_suspend != NULL)
-
-# else
-
-#  define thread_in_use() 1
-
-# endif
-
-/* -------------------------- gl_lock_t datatype -------------------------- */
-
-typedef mutex_t gl_lock_t;
-# define gl_lock_define(STORAGECLASS, NAME) \
-    STORAGECLASS mutex_t NAME;
-# define gl_lock_define_initialized(STORAGECLASS, NAME) \
-    STORAGECLASS mutex_t NAME = gl_lock_initializer;
-# define gl_lock_initializer \
-    DEFAULTMUTEX
-# define glthread_lock_init(LOCK) \
-    (thread_in_use () ? mutex_init (LOCK, USYNC_THREAD, NULL) : 0)
-# define glthread_lock_lock(LOCK) \
-    (thread_in_use () ? mutex_lock (LOCK) : 0)
-# define glthread_lock_unlock(LOCK) \
-    (thread_in_use () ? mutex_unlock (LOCK) : 0)
-# define glthread_lock_destroy(LOCK) \
-    (thread_in_use () ? mutex_destroy (LOCK) : 0)
-
-/* ------------------------- gl_rwlock_t datatype ------------------------- */
-
-typedef rwlock_t gl_rwlock_t;
-# define gl_rwlock_define(STORAGECLASS, NAME) \
-    STORAGECLASS rwlock_t NAME;
-# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
-    STORAGECLASS rwlock_t NAME = gl_rwlock_initializer;
-# define gl_rwlock_initializer \
-    DEFAULTRWLOCK
-# define glthread_rwlock_init(LOCK) \
-    (thread_in_use () ? rwlock_init (LOCK, USYNC_THREAD, NULL) : 0)
-# define glthread_rwlock_rdlock(LOCK) \
-    (thread_in_use () ? rw_rdlock (LOCK) : 0)
-# define glthread_rwlock_wrlock(LOCK) \
-    (thread_in_use () ? rw_wrlock (LOCK) : 0)
-# define glthread_rwlock_unlock(LOCK) \
-    (thread_in_use () ? rw_unlock (LOCK) : 0)
-# define glthread_rwlock_destroy(LOCK) \
-    (thread_in_use () ? rwlock_destroy (LOCK) : 0)
-
-/* --------------------- gl_recursive_lock_t datatype --------------------- */
-
-/* Old Solaris threads did not have recursive locks.
-   We have to implement them ourselves.  */
-
-typedef struct
-        {
-          mutex_t mutex;
-          thread_t owner;
-          unsigned long depth;
-        }
-        gl_recursive_lock_t;
-# define gl_recursive_lock_define(STORAGECLASS, NAME) \
-    STORAGECLASS gl_recursive_lock_t NAME;
-# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
-    STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer;
-# define gl_recursive_lock_initializer \
-    { DEFAULTMUTEX, (thread_t) 0, 0 }
-# define glthread_recursive_lock_init(LOCK) \
-    (thread_in_use () ? glthread_recursive_lock_init_multithreaded (LOCK) : 0)
-# define glthread_recursive_lock_lock(LOCK) \
-    (thread_in_use () ? glthread_recursive_lock_lock_multithreaded (LOCK) : 0)
-# define glthread_recursive_lock_unlock(LOCK) \
-    (thread_in_use () ? glthread_recursive_lock_unlock_multithreaded (LOCK) : 0)
-# define glthread_recursive_lock_destroy(LOCK) \
-    (thread_in_use () ? glthread_recursive_lock_destroy_multithreaded (LOCK) : 0)
-extern int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock);
-extern int glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock);
-extern int glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock);
-extern int glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock);
-
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-typedef struct
-        {
-          volatile int inited;
-          mutex_t mutex;
-        }
-        gl_once_t;
-# define gl_once_define(STORAGECLASS, NAME) \
-    STORAGECLASS gl_once_t NAME = { 0, DEFAULTMUTEX };
-# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
-    (thread_in_use ()                                                          \
-     ? glthread_once_multithreaded (ONCE_CONTROL, INITFUNCTION)                \
-     : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0))
-extern int glthread_once_multithreaded (gl_once_t *once_control, void (*initfunction) (void));
-extern int glthread_once_singlethreaded (gl_once_t *once_control);
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_WINDOWS_THREADS
-
-# define WIN32_LEAN_AND_MEAN  /* avoid including junk */
-# include <windows.h>
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-/* We can use CRITICAL_SECTION directly, rather than the native Windows Event,
-   Mutex, Semaphore types, because
-     - we need only to synchronize inside a single process (address space),
-       not inter-process locking,
-     - we don't need to support trylock operations.  (TryEnterCriticalSection
-       does not work on Windows 95/98/ME.  Packages that need trylock usually
-       define their own mutex type.)  */
-
-/* There is no way to statically initialize a CRITICAL_SECTION.  It needs
-   to be done lazily, once only.  For this we need spinlocks.  */
-
-typedef struct { volatile int done; volatile long started; } gl_spinlock_t;
-
-/* -------------------------- gl_lock_t datatype -------------------------- */
-
-typedef struct
-        {
-          gl_spinlock_t guard; /* protects the initialization */
-          CRITICAL_SECTION lock;
-        }
-        gl_lock_t;
-# define gl_lock_define(STORAGECLASS, NAME) \
-    STORAGECLASS gl_lock_t NAME;
-# define gl_lock_define_initialized(STORAGECLASS, NAME) \
-    STORAGECLASS gl_lock_t NAME = gl_lock_initializer;
-# define gl_lock_initializer \
-    { { 0, -1 } }
-# define glthread_lock_init(LOCK) \
-    (glthread_lock_init_func (LOCK), 0)
-# define glthread_lock_lock(LOCK) \
-    glthread_lock_lock_func (LOCK)
-# define glthread_lock_unlock(LOCK) \
-    glthread_lock_unlock_func (LOCK)
-# define glthread_lock_destroy(LOCK) \
-    glthread_lock_destroy_func (LOCK)
-extern void glthread_lock_init_func (gl_lock_t *lock);
-extern int glthread_lock_lock_func (gl_lock_t *lock);
-extern int glthread_lock_unlock_func (gl_lock_t *lock);
-extern int glthread_lock_destroy_func (gl_lock_t *lock);
-
-/* ------------------------- gl_rwlock_t datatype ------------------------- */
-
-/* It is impossible to implement read-write locks using plain locks, without
-   introducing an extra thread dedicated to managing read-write locks.
-   Therefore here we need to use the low-level Event type.  */
-
-typedef struct
-        {
-          HANDLE *array; /* array of waiting threads, each represented by an event */
-          unsigned int count; /* number of waiting threads */
-          unsigned int alloc; /* length of allocated array */
-          unsigned int offset; /* index of first waiting thread in array */
-        }
-        gl_carray_waitqueue_t;
-typedef struct
-        {
-          gl_spinlock_t guard; /* protects the initialization */
-          CRITICAL_SECTION lock; /* protects the remaining fields */
-          gl_carray_waitqueue_t waiting_readers; /* waiting readers */
-          gl_carray_waitqueue_t waiting_writers; /* waiting writers */
-          int runcount; /* number of readers running, or -1 when a writer runs */
-        }
-        gl_rwlock_t;
-# define gl_rwlock_define(STORAGECLASS, NAME) \
-    STORAGECLASS gl_rwlock_t NAME;
-# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
-    STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer;
-# define gl_rwlock_initializer \
-    { { 0, -1 } }
-# define glthread_rwlock_init(LOCK) \
-    (glthread_rwlock_init_func (LOCK), 0)
-# define glthread_rwlock_rdlock(LOCK) \
-    glthread_rwlock_rdlock_func (LOCK)
-# define glthread_rwlock_wrlock(LOCK) \
-    glthread_rwlock_wrlock_func (LOCK)
-# define glthread_rwlock_unlock(LOCK) \
-    glthread_rwlock_unlock_func (LOCK)
-# define glthread_rwlock_destroy(LOCK) \
-    glthread_rwlock_destroy_func (LOCK)
-extern void glthread_rwlock_init_func (gl_rwlock_t *lock);
-extern int glthread_rwlock_rdlock_func (gl_rwlock_t *lock);
-extern int glthread_rwlock_wrlock_func (gl_rwlock_t *lock);
-extern int glthread_rwlock_unlock_func (gl_rwlock_t *lock);
-extern int glthread_rwlock_destroy_func (gl_rwlock_t *lock);
-
-/* --------------------- gl_recursive_lock_t datatype --------------------- */
-
-/* The native Windows documentation says that CRITICAL_SECTION already
-   implements a recursive lock.  But we need not rely on it: It's easy to
-   implement a recursive lock without this assumption.  */
-
-typedef struct
-        {
-          gl_spinlock_t guard; /* protects the initialization */
-          DWORD owner;
-          unsigned long depth;
-          CRITICAL_SECTION lock;
-        }
-        gl_recursive_lock_t;
-# define gl_recursive_lock_define(STORAGECLASS, NAME) \
-    STORAGECLASS gl_recursive_lock_t NAME;
-# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
-    STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer;
-# define gl_recursive_lock_initializer \
-    { { 0, -1 }, 0, 0 }
-# define glthread_recursive_lock_init(LOCK) \
-    (glthread_recursive_lock_init_func (LOCK), 0)
-# define glthread_recursive_lock_lock(LOCK) \
-    glthread_recursive_lock_lock_func (LOCK)
-# define glthread_recursive_lock_unlock(LOCK) \
-    glthread_recursive_lock_unlock_func (LOCK)
-# define glthread_recursive_lock_destroy(LOCK) \
-    glthread_recursive_lock_destroy_func (LOCK)
-extern void glthread_recursive_lock_init_func (gl_recursive_lock_t *lock);
-extern int glthread_recursive_lock_lock_func (gl_recursive_lock_t *lock);
-extern int glthread_recursive_lock_unlock_func (gl_recursive_lock_t *lock);
-extern int glthread_recursive_lock_destroy_func (gl_recursive_lock_t *lock);
-
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-typedef struct
-        {
-          volatile int inited;
-          volatile long started;
-          CRITICAL_SECTION lock;
-        }
-        gl_once_t;
-# define gl_once_define(STORAGECLASS, NAME) \
-    STORAGECLASS gl_once_t NAME = { -1, -1 };
-# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
-    (glthread_once_func (ONCE_CONTROL, INITFUNCTION), 0)
-extern void glthread_once_func (gl_once_t *once_control, void (*initfunction) (void));
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif
-
-/* ========================================================================= */
-
-#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_SOLARIS_THREADS || USE_WINDOWS_THREADS)
-
-/* Provide dummy implementation if threads are not supported.  */
-
-/* -------------------------- gl_lock_t datatype -------------------------- */
-
-typedef int gl_lock_t;
-# define gl_lock_define(STORAGECLASS, NAME)
-# define gl_lock_define_initialized(STORAGECLASS, NAME)
-# define glthread_lock_init(NAME) 0
-# define glthread_lock_lock(NAME) 0
-# define glthread_lock_unlock(NAME) 0
-# define glthread_lock_destroy(NAME) 0
-
-/* ------------------------- gl_rwlock_t datatype ------------------------- */
-
-typedef int gl_rwlock_t;
-# define gl_rwlock_define(STORAGECLASS, NAME)
-# define gl_rwlock_define_initialized(STORAGECLASS, NAME)
-# define glthread_rwlock_init(NAME) 0
-# define glthread_rwlock_rdlock(NAME) 0
-# define glthread_rwlock_wrlock(NAME) 0
-# define glthread_rwlock_unlock(NAME) 0
-# define glthread_rwlock_destroy(NAME) 0
-
-/* --------------------- gl_recursive_lock_t datatype --------------------- */
-
-typedef int gl_recursive_lock_t;
-# define gl_recursive_lock_define(STORAGECLASS, NAME)
-# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME)
-# define glthread_recursive_lock_init(NAME) 0
-# define glthread_recursive_lock_lock(NAME) 0
-# define glthread_recursive_lock_unlock(NAME) 0
-# define glthread_recursive_lock_destroy(NAME) 0
-
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-typedef int gl_once_t;
-# define gl_once_define(STORAGECLASS, NAME) \
-    STORAGECLASS gl_once_t NAME = 0;
-# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
-    (*(ONCE_CONTROL) == 0 ? (*(ONCE_CONTROL) = ~ 0, INITFUNCTION (), 0) : 0)
-
-#endif
-
-/* ========================================================================= */
-
-/* Macros with built-in error handling.  */
-
-/* -------------------------- gl_lock_t datatype -------------------------- */
-
-#define gl_lock_init(NAME) \
-   do                                  \
-     {                                 \
-       if (glthread_lock_init (&NAME)) \
-         abort ();                     \
-     }                                 \
-   while (0)
-#define gl_lock_lock(NAME) \
-   do                                  \
-     {                                 \
-       if (glthread_lock_lock (&NAME)) \
-         abort ();                     \
-     }                                 \
-   while (0)
-#define gl_lock_unlock(NAME) \
-   do                                    \
-     {                                   \
-       if (glthread_lock_unlock (&NAME)) \
-         abort ();                       \
-     }                                   \
-   while (0)
-#define gl_lock_destroy(NAME) \
-   do                                     \
-     {                                    \
-       if (glthread_lock_destroy (&NAME)) \
-         abort ();                        \
-     }                                    \
-   while (0)
-
-/* ------------------------- gl_rwlock_t datatype ------------------------- */
-
-#define gl_rwlock_init(NAME) \
-   do                                    \
-     {                                   \
-       if (glthread_rwlock_init (&NAME)) \
-         abort ();                       \
-     }                                   \
-   while (0)
-#define gl_rwlock_rdlock(NAME) \
-   do                                      \
-     {                                     \
-       if (glthread_rwlock_rdlock (&NAME)) \
-         abort ();                         \
-     }                                     \
-   while (0)
-#define gl_rwlock_wrlock(NAME) \
-   do                                      \
-     {                                     \
-       if (glthread_rwlock_wrlock (&NAME)) \
-         abort ();                         \
-     }                                     \
-   while (0)
-#define gl_rwlock_unlock(NAME) \
-   do                                      \
-     {                                     \
-       if (glthread_rwlock_unlock (&NAME)) \
-         abort ();                         \
-     }                                     \
-   while (0)
-#define gl_rwlock_destroy(NAME) \
-   do                                       \
-     {                                      \
-       if (glthread_rwlock_destroy (&NAME)) \
-         abort ();                          \
-     }                                      \
-   while (0)
-
-/* --------------------- gl_recursive_lock_t datatype --------------------- */
-
-#define gl_recursive_lock_init(NAME) \
-   do                                            \
-     {                                           \
-       if (glthread_recursive_lock_init (&NAME)) \
-         abort ();                               \
-     }                                           \
-   while (0)
-#define gl_recursive_lock_lock(NAME) \
-   do                                            \
-     {                                           \
-       if (glthread_recursive_lock_lock (&NAME)) \
-         abort ();                               \
-     }                                           \
-   while (0)
-#define gl_recursive_lock_unlock(NAME) \
-   do                                              \
-     {                                             \
-       if (glthread_recursive_lock_unlock (&NAME)) \
-         abort ();                                 \
-     }                                             \
-   while (0)
-#define gl_recursive_lock_destroy(NAME) \
-   do                                               \
-     {                                              \
-       if (glthread_recursive_lock_destroy (&NAME)) \
-         abort ();                                  \
-     }                                              \
-   while (0)
-
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-#define gl_once(NAME, INITFUNCTION) \
-   do                                           \
-     {                                          \
-       if (glthread_once (&NAME, INITFUNCTION)) \
-         abort ();                              \
-     }                                          \
-   while (0)
-
-/* ========================================================================= */
-
-#endif /* _LOCK_H */
diff --git a/gl/tests/glthread/threadlib.c b/gl/tests/glthread/threadlib.c
deleted file mode 100644 (file)
index 26870de..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Multithreading primitives.
-   Copyright (C) 2005-2014 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2005.  */
-
-#include <config.h>
-
-/* ========================================================================= */
-
-#if USE_POSIX_THREADS
-
-/* Use the POSIX threads library.  */
-
-# include <pthread.h>
-# include <stdlib.h>
-
-# if PTHREAD_IN_USE_DETECTION_HARD
-
-/* The function to be executed by a dummy thread.  */
-static void *
-dummy_thread_func (void *arg)
-{
-  return arg;
-}
-
-int
-glthread_in_use (void)
-{
-  static int tested;
-  static int result; /* 1: linked with -lpthread, 0: only with libc */
-
-  if (!tested)
-    {
-      pthread_t thread;
-
-      if (pthread_create (&thread, NULL, dummy_thread_func, NULL) != 0)
-        /* Thread creation failed.  */
-        result = 0;
-      else
-        {
-          /* Thread creation works.  */
-          void *retval;
-          if (pthread_join (thread, &retval) != 0)
-            abort ();
-          result = 1;
-        }
-      tested = 1;
-    }
-  return result;
-}
-
-# endif
-
-#endif
-
-/* ========================================================================= */
-
-/* This declaration is solely to ensure that after preprocessing
-   this file is never empty.  */
-typedef int dummy;
diff --git a/gl/tests/ignore-value.h b/gl/tests/ignore-value.h
deleted file mode 100644 (file)
index 4dd0946..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/* ignore a function return without a compiler warning
-
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Jim Meyering, Eric Blake and Pádraig Brady.  */
-
-/* Use "ignore_value" to avoid a warning when using a function declared with
-   gcc's warn_unused_result attribute, but for which you really do want to
-   ignore the result.  Traditionally, people have used a "(void)" cast to
-   indicate that a function's return value is deliberately unused.  However,
-   if the function is declared with __attribute__((warn_unused_result)),
-   gcc issues a warning even with the cast.
-
-   Caution: most of the time, you really should heed gcc's warning, and
-   check the return value.  However, in those exceptional cases in which
-   you're sure you know what you're doing, use this function.
-
-   For the record, here's one of the ignorable warnings:
-   "copy.c:233: warning: ignoring return value of 'fchown',
-   declared with attribute warn_unused_result".  */
-
-#ifndef _GL_IGNORE_VALUE_H
-#define _GL_IGNORE_VALUE_H
-
-/* Normally casting an expression to void discards its value, but GCC
-   versions 3.4 and newer have __attribute__ ((__warn_unused_result__))
-   which may cause unwanted diagnostics in that case.  Use __typeof__
-   and __extension__ to work around the problem, if the workaround is
-   known to be needed.  */
-#if 3 < __GNUC__ + (4 <= __GNUC_MINOR__)
-# define ignore_value(x) \
-    (__extension__ ({ __typeof__ (x) __x = (x); (void) __x; }))
-#else
-# define ignore_value(x) ((void) (x))
-#endif
-
-#endif
diff --git a/gl/tests/ioctl.c b/gl/tests/ioctl.c
deleted file mode 100644 (file)
index 89afb4e..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/* ioctl.c --- wrappers for Windows ioctl function
-
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Paolo Bonzini */
-
-#include <config.h>
-
-#include <sys/ioctl.h>
-
-#include <stdarg.h>
-
-#if HAVE_IOCTL
-
-/* Provide a wrapper with the POSIX prototype.  */
-# undef ioctl
-int
-rpl_ioctl (int fd, int request, ... /* {void *,char *} arg */)
-{
-  void *buf;
-  va_list args;
-
-  va_start (args, request);
-  buf = va_arg (args, void *);
-  va_end (args);
-
-  /* Cast 'request' so that when the system's ioctl function takes a 64-bit
-     request argument, the value gets zero-extended, not sign-extended.  */
-  return ioctl (fd, (unsigned int) request, buf);
-}
-
-#else /* mingw */
-
-# include <errno.h>
-
-/* Get HANDLE.  */
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-
-# include "fd-hook.h"
-/* Get _get_osfhandle.  */
-# include "msvc-nothrow.h"
-
-static int
-primary_ioctl (int fd, int request, void *arg)
-{
-  /* We don't support FIONBIO on pipes here.  If you want to make pipe
-     fds non-blocking, use the gnulib 'nonblocking' module, until
-     gnulib implements fcntl F_GETFL / F_SETFL with O_NONBLOCK.  */
-
-  if ((HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE)
-    errno = ENOSYS;
-  else
-    errno = EBADF;
-  return -1;
-}
-
-int
-ioctl (int fd, int request, ... /* {void *,char *} arg */)
-{
-  void *arg;
-  va_list args;
-
-  va_start (args, request);
-  arg = va_arg (args, void *);
-  va_end (args);
-
-# if WINDOWS_SOCKETS
-  return execute_all_ioctl_hooks (primary_ioctl, fd, request, arg);
-# else
-  return primary_ioctl (fd, request, arg);
-# endif
-}
-
-#endif
diff --git a/gl/tests/lstat.c b/gl/tests/lstat.c
deleted file mode 100644 (file)
index f70fd43..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/* Work around a bug of lstat on some systems
-
-   Copyright (C) 1997-2006, 2008-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* written by Jim Meyering */
-
-/* If the user's config.h happens to include <sys/stat.h>, let it include only
-   the system's <sys/stat.h> here, so that orig_lstat doesn't recurse to
-   rpl_lstat.  */
-#define __need_system_sys_stat_h
-#include <config.h>
-
-#if !HAVE_LSTAT
-/* On systems that lack symlinks, our replacement <sys/stat.h> already
-   defined lstat as stat, so there is nothing further to do other than
-   avoid an empty file.  */
-typedef int dummy;
-#else /* HAVE_LSTAT */
-
-/* Get the original definition of lstat.  It might be defined as a macro.  */
-# include <sys/types.h>
-# include <sys/stat.h>
-# undef __need_system_sys_stat_h
-
-static int
-orig_lstat (const char *filename, struct stat *buf)
-{
-  return lstat (filename, buf);
-}
-
-/* Specification.  */
-/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
-   eliminates this include because of the preliminary #include <sys/stat.h>
-   above.  */
-# include "sys/stat.h"
-
-# include <string.h>
-# include <errno.h>
-
-/* lstat works differently on Linux and Solaris systems.  POSIX (see
-   "pathname resolution" in the glossary) requires that programs like
-   'ls' take into consideration the fact that FILE has a trailing slash
-   when FILE is a symbolic link.  On Linux and Solaris 10 systems, the
-   lstat function already has the desired semantics (in treating
-   'lstat ("symlink/", sbuf)' just like 'lstat ("symlink/.", sbuf)',
-   but on Solaris 9 and earlier it does not.
-
-   If FILE has a trailing slash and specifies a symbolic link,
-   then use stat() to get more info on the referent of FILE.
-   If the referent is a non-directory, then set errno to ENOTDIR
-   and return -1.  Otherwise, return stat's result.  */
-
-int
-rpl_lstat (const char *file, struct stat *sbuf)
-{
-  size_t len;
-  int lstat_result = orig_lstat (file, sbuf);
-
-  if (lstat_result != 0)
-    return lstat_result;
-
-  /* This replacement file can blindly check against '/' rather than
-     using the ISSLASH macro, because all platforms with '\\' either
-     lack symlinks (mingw) or have working lstat (cygwin) and thus do
-     not compile this file.  0 len should have already been filtered
-     out above, with a failure return of ENOENT.  */
-  len = strlen (file);
-  if (file[len - 1] != '/' || S_ISDIR (sbuf->st_mode))
-    return 0;
-
-  /* At this point, a trailing slash is only permitted on
-     symlink-to-dir; but it should have found information on the
-     directory, not the symlink.  Call stat() to get info about the
-     link's referent.  Our replacement stat guarantees valid results,
-     even if the symlink is not pointing to a directory.  */
-  if (!S_ISLNK (sbuf->st_mode))
-    {
-      errno = ENOTDIR;
-      return -1;
-    }
-  return stat (file, sbuf);
-}
-
-#endif /* HAVE_LSTAT */
diff --git a/gl/tests/open.c b/gl/tests/open.c
deleted file mode 100644 (file)
index d6f8e0d..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-/* Open a descriptor to a file.
-   Copyright (C) 2007-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
-
-/* If the user's config.h happens to include <fcntl.h>, let it include only
-   the system's <fcntl.h> here, so that orig_open doesn't recurse to
-   rpl_open.  */
-#define __need_system_fcntl_h
-#include <config.h>
-
-/* Get the original definition of open.  It might be defined as a macro.  */
-#include <fcntl.h>
-#include <sys/types.h>
-#undef __need_system_fcntl_h
-
-static int
-orig_open (const char *filename, int flags, mode_t mode)
-{
-  return open (filename, flags, mode);
-}
-
-/* Specification.  */
-/* Write "fcntl.h" here, not <fcntl.h>, otherwise OSF/1 5.1 DTK cc eliminates
-   this include because of the preliminary #include <fcntl.h> above.  */
-#include "fcntl.h"
-
-#include <errno.h>
-#include <stdarg.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#ifndef REPLACE_OPEN_DIRECTORY
-# define REPLACE_OPEN_DIRECTORY 0
-#endif
-
-int
-open (const char *filename, int flags, ...)
-{
-  mode_t mode;
-  int fd;
-
-  mode = 0;
-  if (flags & O_CREAT)
-    {
-      va_list arg;
-      va_start (arg, flags);
-
-      /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4
-         creates crashing code when 'mode_t' is smaller than 'int'.  */
-      mode = va_arg (arg, PROMOTED_MODE_T);
-
-      va_end (arg);
-    }
-
-#if GNULIB_defined_O_NONBLOCK
-  /* The only known platform that lacks O_NONBLOCK is mingw, but it
-     also lacks named pipes and Unix sockets, which are the only two
-     file types that require non-blocking handling in open().
-     Therefore, it is safe to ignore O_NONBLOCK here.  It is handy
-     that mingw also lacks openat(), so that is also covered here.  */
-  flags &= ~O_NONBLOCK;
-#endif
-
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-  if (strcmp (filename, "/dev/null") == 0)
-    filename = "NUL";
-#endif
-
-#if OPEN_TRAILING_SLASH_BUG
-  /* If the filename ends in a slash and one of O_CREAT, O_WRONLY, O_RDWR
-     is specified, then fail.
-     Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html>
-     says that
-       "A pathname that contains at least one non-slash character and that
-        ends with one or more trailing slashes shall be resolved as if a
-        single dot character ( '.' ) were appended to the pathname."
-     and
-       "The special filename dot shall refer to the directory specified by
-        its predecessor."
-     If the named file already exists as a directory, then
-       - if O_CREAT is specified, open() must fail because of the semantics
-         of O_CREAT,
-       - if O_WRONLY or O_RDWR is specified, open() must fail because POSIX
-         <http://www.opengroup.org/susv3/functions/open.html> says that it
-         fails with errno = EISDIR in this case.
-     If the named file does not exist or does not name a directory, then
-       - if O_CREAT is specified, open() must fail since open() cannot create
-         directories,
-       - if O_WRONLY or O_RDWR is specified, open() must fail because the
-         file does not contain a '.' directory.  */
-  if (flags & (O_CREAT | O_WRONLY | O_RDWR))
-    {
-      size_t len = strlen (filename);
-      if (len > 0 && filename[len - 1] == '/')
-        {
-          errno = EISDIR;
-          return -1;
-        }
-    }
-#endif
-
-  fd = orig_open (filename, flags, mode);
-
-#if REPLACE_FCHDIR
-  /* Implementing fchdir and fdopendir requires the ability to open a
-     directory file descriptor.  If open doesn't support that (as on
-     mingw), we use a dummy file that behaves the same as directories
-     on Linux (ie. always reports EOF on attempts to read()), and
-     override fstat() in fchdir.c to hide the fact that we have a
-     dummy.  */
-  if (REPLACE_OPEN_DIRECTORY && fd < 0 && errno == EACCES
-      && ((flags & O_ACCMODE) == O_RDONLY
-          || (O_SEARCH != O_RDONLY && (flags & O_ACCMODE) == O_SEARCH)))
-    {
-      struct stat statbuf;
-      if (stat (filename, &statbuf) == 0 && S_ISDIR (statbuf.st_mode))
-        {
-          /* Maximum recursion depth of 1.  */
-          fd = open ("/dev/null", flags, mode);
-          if (0 <= fd)
-            fd = _gl_register_fd (fd, filename);
-        }
-      else
-        errno = EACCES;
-    }
-#endif
-
-#if OPEN_TRAILING_SLASH_BUG
-  /* If the filename ends in a slash and fd does not refer to a directory,
-     then fail.
-     Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html>
-     says that
-       "A pathname that contains at least one non-slash character and that
-        ends with one or more trailing slashes shall be resolved as if a
-        single dot character ( '.' ) were appended to the pathname."
-     and
-       "The special filename dot shall refer to the directory specified by
-        its predecessor."
-     If the named file without the slash is not a directory, open() must fail
-     with ENOTDIR.  */
-  if (fd >= 0)
-    {
-      /* We know len is positive, since open did not fail with ENOENT.  */
-      size_t len = strlen (filename);
-      if (filename[len - 1] == '/')
-        {
-          struct stat statbuf;
-
-          if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode))
-            {
-              close (fd);
-              errno = ENOTDIR;
-              return -1;
-            }
-        }
-    }
-#endif
-
-#if REPLACE_FCHDIR
-  if (!REPLACE_OPEN_DIRECTORY && 0 <= fd)
-    fd = _gl_register_fd (fd, filename);
-#endif
-
-  return fd;
-}
diff --git a/gl/tests/pathmax.h b/gl/tests/pathmax.h
deleted file mode 100644 (file)
index 33fc355..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Define PATH_MAX somehow.  Requires sys/types.h.
-   Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2014 Free Software
-   Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef _PATHMAX_H
-# define _PATHMAX_H
-
-/* POSIX:2008 defines PATH_MAX to be the maximum number of bytes in a filename,
-   including the terminating NUL byte.
-   <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html>
-   PATH_MAX is not defined on systems which have no limit on filename length,
-   such as GNU/Hurd.
-
-   This file does *not* define PATH_MAX always.  Programs that use this file
-   can handle the GNU/Hurd case in several ways:
-     - Either with a package-wide handling, or with a per-file handling,
-     - Either through a
-         #ifdef PATH_MAX
-       or through a fallback like
-         #ifndef PATH_MAX
-         # define PATH_MAX 8192
-         #endif
-       or through a fallback like
-         #ifndef PATH_MAX
-         # define PATH_MAX pathconf ("/", _PC_PATH_MAX)
-         #endif
- */
-
-# include <unistd.h>
-
-# include <limits.h>
-
-# ifndef _POSIX_PATH_MAX
-#  define _POSIX_PATH_MAX 256
-# endif
-
-/* Don't include sys/param.h if it already has been.  */
-# if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN
-#  include <sys/param.h>
-# endif
-
-# if !defined PATH_MAX && defined MAXPATHLEN
-#  define PATH_MAX MAXPATHLEN
-# endif
-
-# ifdef __hpux
-/* On HP-UX, PATH_MAX designates the maximum number of bytes in a filename,
-   *not* including the terminating NUL byte, and is set to 1023.
-   Additionally, when _XOPEN_SOURCE is defined to 500 or more, PATH_MAX is
-   not defined at all any more.  */
-#  undef PATH_MAX
-#  define PATH_MAX 1024
-# endif
-
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* The page "Naming Files, Paths, and Namespaces" on msdn.microsoft.com,
-   section "Maximum Path Length Limitation",
-   <http://msdn.microsoft.com/en-us/library/aa365247(v=vs.85).aspx#maxpath>
-   explains that the maximum size of a filename, including the terminating
-   NUL byte, is 260 = 3 + 256 + 1.
-   This is the same value as
-     - FILENAME_MAX in <stdio.h>,
-     - _MAX_PATH in <stdlib.h>,
-     - MAX_PATH in <windef.h>.
-   Undefine the original value, because mingw's <limits.h> gets it wrong.  */
-#  undef PATH_MAX
-#  define PATH_MAX 260
-# endif
-
-#endif /* _PATHMAX_H */
diff --git a/gl/tests/perror.c b/gl/tests/perror.c
deleted file mode 100644 (file)
index c0548c9..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Print a message describing error code.
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
-   Written by Bruno Haible and Simon Josefsson.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include <stdio.h>
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "strerror-override.h"
-
-/* Use the system functions, not the gnulib overrides in this file.  */
-#undef fprintf
-
-void
-perror (const char *string)
-{
-  char stackbuf[STACKBUF_LEN];
-  int ret;
-
-  /* Our implementation guarantees that this will be a non-empty
-     string, even if it returns EINVAL; and stackbuf should be sized
-     large enough to avoid ERANGE.  */
-  ret = strerror_r (errno, stackbuf, sizeof stackbuf);
-  if (ret == ERANGE)
-    abort ();
-
-  if (string != NULL && *string != '\0')
-    fprintf (stderr, "%s: %s\n", string, stackbuf);
-  else
-    fprintf (stderr, "%s\n", stackbuf);
-}
diff --git a/gl/tests/pipe.c b/gl/tests/pipe.c
deleted file mode 100644 (file)
index 4db9041..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Create a pipe.
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include <unistd.h>
-
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* Native Windows API.  */
-
-/* Get _pipe().  */
-# include <io.h>
-
-/* Get _O_BINARY.  */
-# include <fcntl.h>
-
-int
-pipe (int fd[2])
-{
-  /* Mingw changes fd to {-1,-1} on failure, but this violates
-     http://austingroupbugs.net/view.php?id=467 */
-  int tmp[2];
-  int result = _pipe (tmp, 4096, _O_BINARY);
-  if (!result)
-    {
-      fd[0] = tmp[0];
-      fd[1] = tmp[1];
-    }
-  return result;
-}
-
-#else
-
-# error "This platform lacks a pipe function, and Gnulib doesn't provide a replacement. This is a bug in Gnulib."
-
-#endif
diff --git a/gl/tests/same-inode.h b/gl/tests/same-inode.h
deleted file mode 100644 (file)
index 584f606..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Determine whether two stat buffers refer to the same file.
-
-   Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef SAME_INODE_H
-# define SAME_INODE_H 1
-
-# ifdef __VMS
-#  define SAME_INODE(a, b)             \
-    ((a).st_ino[0] == (b).st_ino[0]    \
-     && (a).st_ino[1] == (b).st_ino[1] \
-     && (a).st_ino[2] == (b).st_ino[2] \
-     && (a).st_dev == (b).st_dev)
-# else
-#  define SAME_INODE(a, b)    \
-    ((a).st_ino == (b).st_ino \
-     && (a).st_dev == (b).st_dev)
-# endif
-
-#endif
diff --git a/gl/tests/stat.c b/gl/tests/stat.c
deleted file mode 100644 (file)
index 35f4b0b..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/* Work around platform bugs in stat.
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* written by Eric Blake */
-
-/* If the user's config.h happens to include <sys/stat.h>, let it include only
-   the system's <sys/stat.h> here, so that orig_stat doesn't recurse to
-   rpl_stat.  */
-#define __need_system_sys_stat_h
-#include <config.h>
-
-/* Get the original definition of stat.  It might be defined as a macro.  */
-#include <sys/types.h>
-#include <sys/stat.h>
-#undef __need_system_sys_stat_h
-
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-# if _GL_WINDOWS_64_BIT_ST_SIZE
-#  undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */
-#  define stat _stati64
-#  define REPLACE_FUNC_STAT_DIR 1
-#  undef REPLACE_FUNC_STAT_FILE
-# elif REPLACE_FUNC_STAT_FILE
-/* mingw64 has a broken stat() function, based on _stat(), in libmingwex.a.
-   Bypass it.  */
-#  define stat _stat
-#  define REPLACE_FUNC_STAT_DIR 1
-#  undef REPLACE_FUNC_STAT_FILE
-# endif
-#endif
-
-static int
-orig_stat (const char *filename, struct stat *buf)
-{
-  return stat (filename, buf);
-}
-
-/* Specification.  */
-/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
-   eliminates this include because of the preliminary #include <sys/stat.h>
-   above.  */
-#include "sys/stat.h"
-
-#include <errno.h>
-#include <limits.h>
-#include <stdbool.h>
-#include <string.h>
-#include "dosname.h"
-#include "verify.h"
-
-#if REPLACE_FUNC_STAT_DIR
-# include "pathmax.h"
-  /* The only known systems where REPLACE_FUNC_STAT_DIR is needed also
-     have a constant PATH_MAX.  */
-# ifndef PATH_MAX
-#  error "Please port this replacement to your platform"
-# endif
-#endif
-
-/* Store information about NAME into ST.  Work around bugs with
-   trailing slashes.  Mingw has other bugs (such as st_ino always
-   being 0 on success) which this wrapper does not work around.  But
-   at least this implementation provides the ability to emulate fchdir
-   correctly.  */
-
-int
-rpl_stat (char const *name, struct stat *st)
-{
-  int result = orig_stat (name, st);
-#if REPLACE_FUNC_STAT_FILE
-  /* Solaris 9 mistakenly succeeds when given a non-directory with a
-     trailing slash.  */
-  if (result == 0 && !S_ISDIR (st->st_mode))
-    {
-      size_t len = strlen (name);
-      if (ISSLASH (name[len - 1]))
-        {
-          errno = ENOTDIR;
-          return -1;
-        }
-    }
-#endif /* REPLACE_FUNC_STAT_FILE */
-#if REPLACE_FUNC_STAT_DIR
-
-  if (result == -1 && errno == ENOENT)
-    {
-      /* Due to mingw's oddities, there are some directories (like
-         c:\) where stat() only succeeds with a trailing slash, and
-         other directories (like c:\windows) where stat() only
-         succeeds without a trailing slash.  But we want the two to be
-         synonymous, since chdir() manages either style.  Likewise, Mingw also
-         reports ENOENT for names longer than PATH_MAX, when we want
-         ENAMETOOLONG, and for stat("file/"), when we want ENOTDIR.
-         Fortunately, mingw PATH_MAX is small enough for stack
-         allocation.  */
-      char fixed_name[PATH_MAX + 1] = {0};
-      size_t len = strlen (name);
-      bool check_dir = false;
-      verify (PATH_MAX <= 4096);
-      if (PATH_MAX <= len)
-        errno = ENAMETOOLONG;
-      else if (len)
-        {
-          strcpy (fixed_name, name);
-          if (ISSLASH (fixed_name[len - 1]))
-            {
-              check_dir = true;
-              while (len && ISSLASH (fixed_name[len - 1]))
-                fixed_name[--len] = '\0';
-              if (!len)
-                fixed_name[0] = '/';
-            }
-          else
-            fixed_name[len++] = '/';
-          result = orig_stat (fixed_name, st);
-          if (result == 0 && check_dir && !S_ISDIR (st->st_mode))
-            {
-              result = -1;
-              errno = ENOTDIR;
-            }
-        }
-    }
-#endif /* REPLACE_FUNC_STAT_DIR */
-  return result;
-}
diff --git a/gl/tests/strerror_r.c b/gl/tests/strerror_r.c
deleted file mode 100644 (file)
index 4aa96cb..0000000
+++ /dev/null
@@ -1,326 +0,0 @@
-/* strerror_r.c --- POSIX compatible system error routine
-
-   Copyright (C) 2010-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
-
-#include <config.h>
-
-/* Enable declaration of sys_nerr and sys_errlist in <errno.h> on NetBSD.  */
-#define _NETBSD_SOURCE 1
-
-/* Specification.  */
-#include <string.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "strerror-override.h"
-
-#if (__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__) && HAVE___XPG_STRERROR_R /* glibc >= 2.3.4, cygwin >= 1.7.9 */
-
-# define USE_XPG_STRERROR_R 1
-extern int __xpg_strerror_r (int errnum, char *buf, size_t buflen);
-
-#elif HAVE_DECL_STRERROR_R && !(__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__)
-
-/* The system's strerror_r function is OK, except that its third argument
-   is 'int', not 'size_t', or its return type is wrong.  */
-
-# include <limits.h>
-
-# define USE_SYSTEM_STRERROR_R 1
-
-#else /* (__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__ ? !HAVE___XPG_STRERROR_R : !HAVE_DECL_STRERROR_R) */
-
-/* Use the system's strerror().  Exclude glibc and cygwin because the
-   system strerror_r has the wrong return type, and cygwin 1.7.9
-   strerror_r clobbers strerror.  */
-# undef strerror
-
-# define USE_SYSTEM_STRERROR 1
-
-# if defined __NetBSD__ || defined __hpux || ((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) || defined __sgi || (defined __sun && !defined _LP64) || defined __CYGWIN__
-
-/* No locking needed.  */
-
-/* Get catgets internationalization functions.  */
-#  if HAVE_CATGETS
-#   include <nl_types.h>
-#  endif
-
-/* Get sys_nerr, sys_errlist on HP-UX (otherwise only declared in C++ mode).
-   Get sys_nerr, sys_errlist on IRIX (otherwise only declared with _SGIAPI).  */
-#  if defined __hpux || defined __sgi
-extern int sys_nerr;
-extern char *sys_errlist[];
-#  endif
-
-/* Get sys_nerr on Solaris.  */
-#  if defined __sun && !defined _LP64
-extern int sys_nerr;
-#  endif
-
-# else
-
-#  include "glthread/lock.h"
-
-/* This lock protects the buffer returned by strerror().  We assume that
-   no other uses of strerror() exist in the program.  */
-gl_lock_define_initialized(static, strerror_lock)
-
-# endif
-
-#endif
-
-/* On MSVC, there is no snprintf() function, just a _snprintf().
-   It is of lower quality, but sufficient for the simple use here.
-   We only have to make sure to NUL terminate the result (_snprintf
-   does not NUL terminate, like strncpy).  */
-#if !HAVE_SNPRINTF
-static int
-local_snprintf (char *buf, size_t buflen, const char *format, ...)
-{
-  va_list args;
-  int result;
-
-  va_start (args, format);
-  result = _vsnprintf (buf, buflen, format, args);
-  va_end (args);
-  if (buflen > 0 && (result < 0 || result >= buflen))
-    buf[buflen - 1] = '\0';
-  return result;
-}
-# define snprintf local_snprintf
-#endif
-
-/* Copy as much of MSG into BUF as possible, without corrupting errno.
-   Return 0 if MSG fit in BUFLEN, otherwise return ERANGE.  */
-static int
-safe_copy (char *buf, size_t buflen, const char *msg)
-{
-  size_t len = strlen (msg);
-  int ret;
-
-  if (len < buflen)
-    {
-      /* Although POSIX allows memcpy() to corrupt errno, we don't
-         know of any implementation where this is a real problem.  */
-      memcpy (buf, msg, len + 1);
-      ret = 0;
-    }
-  else
-    {
-      memcpy (buf, msg, buflen - 1);
-      buf[buflen - 1] = '\0';
-      ret = ERANGE;
-    }
-  return ret;
-}
-
-
-int
-strerror_r (int errnum, char *buf, size_t buflen)
-#undef strerror_r
-{
-  /* Filter this out now, so that rest of this replacement knows that
-     there is room for a non-empty message and trailing NUL.  */
-  if (buflen <= 1)
-    {
-      if (buflen)
-        *buf = '\0';
-      return ERANGE;
-    }
-  *buf = '\0';
-
-  /* Check for gnulib overrides.  */
-  {
-    char const *msg = strerror_override (errnum);
-
-    if (msg)
-      return safe_copy (buf, buflen, msg);
-  }
-
-  {
-    int ret;
-    int saved_errno = errno;
-
-#if USE_XPG_STRERROR_R
-
-    {
-      ret = __xpg_strerror_r (errnum, buf, buflen);
-      if (ret < 0)
-        ret = errno;
-      if (!*buf)
-        {
-          /* glibc 2.13 would not touch buf on err, so we have to fall
-             back to GNU strerror_r which always returns a thread-safe
-             untruncated string to (partially) copy into our buf.  */
-          safe_copy (buf, buflen, strerror_r (errnum, buf, buflen));
-        }
-    }
-
-#elif USE_SYSTEM_STRERROR_R
-
-    if (buflen > INT_MAX)
-      buflen = INT_MAX;
-
-# ifdef __hpux
-    /* On HP-UX 11.31, strerror_r always fails when buflen < 80; it
-       also fails to change buf on EINVAL.  */
-    {
-      char stackbuf[80];
-
-      if (buflen < sizeof stackbuf)
-        {
-          ret = strerror_r (errnum, stackbuf, sizeof stackbuf);
-          if (ret == 0)
-            ret = safe_copy (buf, buflen, stackbuf);
-        }
-      else
-        ret = strerror_r (errnum, buf, buflen);
-    }
-# else
-    ret = strerror_r (errnum, buf, buflen);
-
-    /* Some old implementations may return (-1, EINVAL) instead of EINVAL.  */
-    if (ret < 0)
-      ret = errno;
-# endif
-
-# ifdef _AIX
-    /* AIX returns 0 rather than ERANGE when truncating strings; try
-       again until we are sure we got the entire string.  */
-    if (!ret && strlen (buf) == buflen - 1)
-      {
-        char stackbuf[STACKBUF_LEN];
-        size_t len;
-        strerror_r (errnum, stackbuf, sizeof stackbuf);
-        len = strlen (stackbuf);
-        /* STACKBUF_LEN should have been large enough.  */
-        if (len + 1 == sizeof stackbuf)
-          abort ();
-        if (buflen <= len)
-          ret = ERANGE;
-      }
-# else
-    /* Solaris 10 does not populate buf on ERANGE.  OpenBSD 4.7
-       truncates early on ERANGE rather than return a partial integer.
-       We prefer the maximal string.  We set buf[0] earlier, and we
-       know of no implementation that modifies buf to be an
-       unterminated string, so this strlen should be portable in
-       practice (rather than pulling in a safer strnlen).  */
-    if (ret == ERANGE && strlen (buf) < buflen - 1)
-      {
-        char stackbuf[STACKBUF_LEN];
-
-        /* STACKBUF_LEN should have been large enough.  */
-        if (strerror_r (errnum, stackbuf, sizeof stackbuf) == ERANGE)
-          abort ();
-        safe_copy (buf, buflen, stackbuf);
-      }
-# endif
-
-#else /* USE_SYSTEM_STRERROR */
-
-    /* Try to do what strerror (errnum) does, but without clobbering the
-       buffer used by strerror().  */
-
-# if defined __NetBSD__ || defined __hpux || ((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) || defined __CYGWIN__ /* NetBSD, HP-UX, native Windows, Cygwin */
-
-    /* NetBSD:         sys_nerr, sys_errlist are declared through _NETBSD_SOURCE
-                       and <errno.h> above.
-       HP-UX:          sys_nerr, sys_errlist are declared explicitly above.
-       native Windows: sys_nerr, sys_errlist are declared in <stdlib.h>.
-       Cygwin:         sys_nerr, sys_errlist are declared in <errno.h>.  */
-    if (errnum >= 0 && errnum < sys_nerr)
-      {
-#  if HAVE_CATGETS && (defined __NetBSD__ || defined __hpux)
-#   if defined __NetBSD__
-        nl_catd catd = catopen ("libc", NL_CAT_LOCALE);
-        const char *errmsg =
-          (catd != (nl_catd)-1
-           ? catgets (catd, 1, errnum, sys_errlist[errnum])
-           : sys_errlist[errnum]);
-#   endif
-#   if defined __hpux
-        nl_catd catd = catopen ("perror", NL_CAT_LOCALE);
-        const char *errmsg =
-          (catd != (nl_catd)-1
-           ? catgets (catd, 1, 1 + errnum, sys_errlist[errnum])
-           : sys_errlist[errnum]);
-#   endif
-#  else
-        const char *errmsg = sys_errlist[errnum];
-#  endif
-        if (errmsg == NULL || *errmsg == '\0')
-          ret = EINVAL;
-        else
-          ret = safe_copy (buf, buflen, errmsg);
-#  if HAVE_CATGETS && (defined __NetBSD__ || defined __hpux)
-        if (catd != (nl_catd)-1)
-          catclose (catd);
-#  endif
-      }
-    else
-      ret = EINVAL;
-
-# elif defined __sgi || (defined __sun && !defined _LP64) /* IRIX, Solaris <= 9 32-bit */
-
-    /* For a valid error number, the system's strerror() function returns
-       a pointer to a not copied string, not to a buffer.  */
-    if (errnum >= 0 && errnum < sys_nerr)
-      {
-        char *errmsg = strerror (errnum);
-
-        if (errmsg == NULL || *errmsg == '\0')
-          ret = EINVAL;
-        else
-          ret = safe_copy (buf, buflen, errmsg);
-      }
-    else
-      ret = EINVAL;
-
-# else
-
-    gl_lock_lock (strerror_lock);
-
-    {
-      char *errmsg = strerror (errnum);
-
-      /* For invalid error numbers, strerror() on
-           - IRIX 6.5 returns NULL,
-           - HP-UX 11 returns an empty string.  */
-      if (errmsg == NULL || *errmsg == '\0')
-        ret = EINVAL;
-      else
-        ret = safe_copy (buf, buflen, errmsg);
-    }
-
-    gl_lock_unlock (strerror_lock);
-
-# endif
-
-#endif
-
-    if (ret == EINVAL && !*buf)
-      snprintf (buf, buflen, "Unknown error %d", errnum);
-
-    errno = saved_errno;
-    return ret;
-  }
-}
diff --git a/gl/tests/symlink.c b/gl/tests/symlink.c
deleted file mode 100644 (file)
index 0e3fae2..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Stub for symlink().
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include <unistd.h>
-
-#include <errno.h>
-#include <string.h>
-#include <sys/stat.h>
-
-
-#if HAVE_SYMLINK
-
-# undef symlink
-
-/* Create a symlink, but reject trailing slash.  */
-int
-rpl_symlink (char const *contents, char const *name)
-{
-  size_t len = strlen (name);
-  if (len && name[len - 1] == '/')
-    {
-      struct stat st;
-      if (lstat (name, &st) == 0)
-        errno = EEXIST;
-      return -1;
-    }
-  return symlink (contents, name);
-}
-
-#else /* !HAVE_SYMLINK */
-
-/* The system does not support symlinks.  */
-int
-symlink (char const *contents _GL_UNUSED,
-         char const *name _GL_UNUSED)
-{
-  errno = ENOSYS;
-  return -1;
-}
-
-#endif /* !HAVE_SYMLINK */
diff --git a/gl/tests/sys_ioctl.in.h b/gl/tests/sys_ioctl.in.h
deleted file mode 100644 (file)
index c13e317..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Substitute for and wrapper around <sys/ioctl.h>.
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef _@GUARD_PREFIX@_SYS_IOCTL_H
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-/* The include_next requires a split double-inclusion guard.  */
-#if @HAVE_SYS_IOCTL_H@
-# @INCLUDE_NEXT@ @NEXT_SYS_IOCTL_H@
-#endif
-
-#ifndef _@GUARD_PREFIX@_SYS_IOCTL_H
-#define _@GUARD_PREFIX@_SYS_IOCTL_H
-
-/* AIX 5.1 and Solaris 10 declare ioctl() in <unistd.h> and in <stropts.h>,
-   but not in <sys/ioctl.h>.
-   But avoid namespace pollution on glibc systems.  */
-#ifndef __GLIBC__
-# include <unistd.h>
-#endif
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
-
-/* The definition of _GL_WARN_ON_USE is copied here.  */
-
-
-/* Declare overridden functions.  */
-
-#if @GNULIB_IOCTL@
-# if @REPLACE_IOCTL@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef ioctl
-#   define ioctl rpl_ioctl
-#  endif
-_GL_FUNCDECL_RPL (ioctl, int,
-                  (int fd, int request, ... /* {void *,char *} arg */));
-_GL_CXXALIAS_RPL (ioctl, int,
-                  (int fd, int request, ... /* {void *,char *} arg */));
-# else
-#  if @SYS_IOCTL_H_HAVE_WINSOCK2_H@ || 1
-_GL_FUNCDECL_SYS (ioctl, int,
-                  (int fd, int request, ... /* {void *,char *} arg */));
-#  endif
-_GL_CXXALIAS_SYS (ioctl, int,
-                  (int fd, int request, ... /* {void *,char *} arg */));
-# endif
-_GL_CXXALIASWARN (ioctl);
-#elif @SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
-# undef ioctl
-# define ioctl ioctl_used_without_requesting_gnulib_module_ioctl
-#elif defined GNULIB_POSIXCHECK
-# undef ioctl
-# if HAVE_RAW_DECL_IOCTL
-_GL_WARN_ON_USE (ioctl, "ioctl does not portably work on sockets - "
-                 "use gnulib module ioctl for portability");
-# endif
-#endif
-
-
-#endif /* _@GUARD_PREFIX@_SYS_IOCTL_H */
-#endif /* _@GUARD_PREFIX@_SYS_IOCTL_H */
diff --git a/gl/tests/test-accept.c b/gl/tests/test-accept.c
deleted file mode 100644 (file)
index 58d796a..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Test accepting a connection to a server socket.
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include <sys/socket.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (accept, int, (int, struct sockaddr *, socklen_t *));
-
-#include <errno.h>
-#include <netinet/in.h>
-#include <unistd.h>
-
-#include "sockets.h"
-#include "macros.h"
-
-int
-main (void)
-{
-  (void) gl_sockets_startup (SOCKETS_1_1);
-
-  /* Test behaviour for invalid file descriptors.  */
-  {
-    struct sockaddr_in addr;
-    socklen_t addrlen = sizeof (addr);
-
-    errno = 0;
-    ASSERT (accept (-1, (struct sockaddr *) &addr, &addrlen) == -1);
-    ASSERT (errno == EBADF);
-  }
-  {
-    struct sockaddr_in addr;
-    socklen_t addrlen = sizeof (addr);
-
-    close (99);
-    errno = 0;
-    ASSERT (accept (99, (struct sockaddr *) &addr, &addrlen) == -1);
-    ASSERT (errno == EBADF);
-  }
-
-  return 0;
-}
diff --git a/gl/tests/test-close.c b/gl/tests/test-close.c
deleted file mode 100644 (file)
index 44bce54..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Test closing a file or socket.
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include <unistd.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (close, int, (int));
-
-#include <errno.h>
-
-#include "macros.h"
-
-int
-main (void)
-{
-  /* Test behaviour for invalid file descriptors.  */
-  {
-    errno = 0;
-    ASSERT (close (-1) == -1);
-    ASSERT (errno == EBADF);
-  }
-  {
-    close (99);
-    errno = 0;
-    ASSERT (close (99) == -1);
-    ASSERT (errno == EBADF);
-  }
-
-  return 0;
-}
diff --git a/gl/tests/test-dup2.c b/gl/tests/test-dup2.c
deleted file mode 100644 (file)
index c7cb965..0000000
+++ /dev/null
@@ -1,218 +0,0 @@
-/* Test duplicating file descriptors.
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
-
-#include <config.h>
-
-#include <unistd.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (dup2, int, (int, int));
-
-#include <errno.h>
-#include <fcntl.h>
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#include "binary-io.h"
-
-#if GNULIB_TEST_CLOEXEC
-# include "cloexec.h"
-#endif
-
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* Get declarations of the native Windows API functions.  */
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-/* Get _get_osfhandle.  */
-# include "msvc-nothrow.h"
-#endif
-
-#include "macros.h"
-
-/* Return non-zero if FD is open.  */
-static int
-is_open (int fd)
-{
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-  /* On native Windows, the initial state of unassigned standard file
-     descriptors is that they are open but point to an
-     INVALID_HANDLE_VALUE, and there is no fcntl.  */
-  return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE;
-#else
-# ifndef F_GETFL
-#  error Please port fcntl to your platform
-# endif
-  return 0 <= fcntl (fd, F_GETFL);
-#endif
-}
-
-#if GNULIB_TEST_CLOEXEC
-/* Return non-zero if FD is open and inheritable across exec/spawn.  */
-static int
-is_inheritable (int fd)
-{
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-  /* On native Windows, the initial state of unassigned standard file
-     descriptors is that they are open but point to an
-     INVALID_HANDLE_VALUE, and there is no fcntl.  */
-  HANDLE h = (HANDLE) _get_osfhandle (fd);
-  DWORD flags;
-  if (h == INVALID_HANDLE_VALUE || GetHandleInformation (h, &flags) == 0)
-    return 0;
-  return (flags & HANDLE_FLAG_INHERIT) != 0;
-# else
-#  ifndef F_GETFD
-#   error Please port fcntl to your platform
-#  endif
-  int i = fcntl (fd, F_GETFD);
-  return 0 <= i && (i & FD_CLOEXEC) == 0;
-# endif
-}
-#endif /* GNULIB_TEST_CLOEXEC */
-
-#if !O_BINARY
-# define setmode(f,m) zero ()
-static int zero (void) { return 0; }
-#endif
-
-/* Return non-zero if FD is open in the given MODE, which is either
-   O_TEXT or O_BINARY.  */
-static int
-is_mode (int fd, int mode)
-{
-  int value = setmode (fd, O_BINARY);
-  setmode (fd, value);
-  return mode == value;
-}
-
-int
-main (void)
-{
-  const char *file = "test-dup2.tmp";
-  char buffer[1];
-  int bad_fd = getdtablesize ();
-  int fd = open (file, O_CREAT | O_TRUNC | O_RDWR, 0600);
-
-  /* Assume std descriptors were provided by invoker.  */
-  ASSERT (STDERR_FILENO < fd);
-  ASSERT (is_open (fd));
-  /* Ignore any other fd's leaked into this process.  */
-  close (fd + 1);
-  close (fd + 2);
-  ASSERT (!is_open (fd + 1));
-  ASSERT (!is_open (fd + 2));
-
-  /* Assigning to self must be a no-op.  */
-  ASSERT (dup2 (fd, fd) == fd);
-  ASSERT (is_open (fd));
-
-  /* The source must be valid.  */
-  errno = 0;
-  ASSERT (dup2 (-1, fd) == -1);
-  ASSERT (errno == EBADF);
-  close (99);
-  errno = 0;
-  ASSERT (dup2 (99, fd) == -1);
-  ASSERT (errno == EBADF);
-  errno = 0;
-  ASSERT (dup2 (AT_FDCWD, fd) == -1);
-  ASSERT (errno == EBADF);
-  ASSERT (is_open (fd));
-
-  /* If the source is not open, then the destination is unaffected.  */
-  errno = 0;
-  ASSERT (dup2 (fd + 1, fd + 1) == -1);
-  ASSERT (errno == EBADF);
-  ASSERT (!is_open (fd + 1));
-  errno = 0;
-  ASSERT (dup2 (fd + 1, fd) == -1);
-  ASSERT (errno == EBADF);
-  ASSERT (is_open (fd));
-
-  /* The destination must be valid.  */
-  errno = 0;
-  ASSERT (dup2 (fd, -2) == -1);
-  ASSERT (errno == EBADF);
-  if (bad_fd > 256)
-    {
-      ASSERT (dup2 (fd, 255) == 255);
-      ASSERT (dup2 (fd, 256) == 256);
-      ASSERT (close (255) == 0);
-      ASSERT (close (256) == 0);
-    }
-  ASSERT (dup2 (fd, bad_fd - 1) == bad_fd - 1);
-  ASSERT (close (bad_fd - 1) == 0);
-  errno = 0;
-  ASSERT (dup2 (fd, bad_fd) == -1);
-  ASSERT (errno == EBADF);
-
-  /* Using dup2 can skip fds.  */
-  ASSERT (dup2 (fd, fd + 2) == fd + 2);
-  ASSERT (is_open (fd));
-  ASSERT (!is_open (fd + 1));
-  ASSERT (is_open (fd + 2));
-
-  /* Verify that dup2 closes the previous occupant of a fd.  */
-  ASSERT (open ("/dev/null", O_WRONLY, 0600) == fd + 1);
-  ASSERT (dup2 (fd + 1, fd) == fd);
-  ASSERT (close (fd + 1) == 0);
-  ASSERT (write (fd, "1", 1) == 1);
-  ASSERT (dup2 (fd + 2, fd) == fd);
-  ASSERT (lseek (fd, 0, SEEK_END) == 0);
-  ASSERT (write (fd + 2, "2", 1) == 1);
-  ASSERT (lseek (fd, 0, SEEK_SET) == 0);
-  ASSERT (read (fd, buffer, 1) == 1);
-  ASSERT (*buffer == '2');
-
-#if GNULIB_TEST_CLOEXEC
-  /* Any new fd created by dup2 must not be cloexec.  */
-  ASSERT (close (fd + 2) == 0);
-  ASSERT (dup_cloexec (fd) == fd + 1);
-  ASSERT (!is_inheritable (fd + 1));
-  ASSERT (dup2 (fd + 1, fd + 1) == fd + 1);
-  ASSERT (!is_inheritable (fd + 1));
-  ASSERT (dup2 (fd + 1, fd + 2) == fd + 2);
-  ASSERT (!is_inheritable (fd + 1));
-  ASSERT (is_inheritable (fd + 2));
-  errno = 0;
-  ASSERT (dup2 (fd + 1, -1) == -1);
-  ASSERT (errno == EBADF);
-  ASSERT (!is_inheritable (fd + 1));
-#endif
-
-  /* On systems that distinguish between text and binary mode, dup2
-     reuses the mode of the source.  */
-  setmode (fd, O_BINARY);
-  ASSERT (is_mode (fd, O_BINARY));
-  ASSERT (dup2 (fd, fd + 1) == fd + 1);
-  ASSERT (is_mode (fd + 1, O_BINARY));
-  setmode (fd, O_TEXT);
-  ASSERT (is_mode (fd, O_TEXT));
-  ASSERT (dup2 (fd, fd + 1) == fd + 1);
-  ASSERT (is_mode (fd + 1, O_TEXT));
-
-  /* Clean up.  */
-  ASSERT (close (fd + 2) == 0);
-  ASSERT (close (fd + 1) == 0);
-  ASSERT (close (fd) == 0);
-  ASSERT (unlink (file) == 0);
-
-  return 0;
-}
diff --git a/gl/tests/test-ftruncate.c b/gl/tests/test-ftruncate.c
deleted file mode 100644 (file)
index ae15411..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Test truncating a file.
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include <unistd.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (ftruncate, int, (int, off_t));
-
-#include <errno.h>
-#include <fcntl.h>
-
-#include "macros.h"
-
-int
-main (int argc, char *argv[])
-{
-  const char *filename = argv[1];
-
-  /* Test behaviour for invalid file descriptors.  */
-  {
-    errno = 0;
-    ASSERT (ftruncate (-1, 0) == -1);
-    ASSERT (errno == EBADF);
-  }
-  {
-    close (99);
-    errno = 0;
-    ASSERT (ftruncate (99, 0) == -1);
-    ASSERT (errno == EBADF);
-  }
-
-  /* Test behaviour for read-only file descriptors.  */
-  {
-    int fd = open (filename, O_RDONLY);
-    ASSERT (fd >= 0);
-    errno = 0;
-    ASSERT (ftruncate (fd, 0) == -1);
-    ASSERT (errno == EBADF || errno == EINVAL
-            || errno == EACCES /* seen on mingw */
-           );
-    close (fd);
-  }
-
-  return 0;
-}
diff --git a/gl/tests/test-ftruncate.sh b/gl/tests/test-ftruncate.sh
deleted file mode 100755 (executable)
index d7394d2..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-exec ./test-ftruncate${EXEEXT} "$srcdir/test-ftruncate.sh"
diff --git a/gl/tests/test-getaddrinfo.c b/gl/tests/test-getaddrinfo.c
deleted file mode 100644 (file)
index acf9cd6..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-/* Test the getaddrinfo module.
-
-   Copyright (C) 2006-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Simon Josefsson.  */
-
-#include <config.h>
-
-#include <netdb.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (freeaddrinfo, void, (struct addrinfo *));
-SIGNATURE_CHECK (gai_strerror, char const *, (int));
-SIGNATURE_CHECK (getaddrinfo, int, (char const *, char const *,
-                                    struct addrinfo const *,
-                                    struct addrinfo **));
-
-#include <arpa/inet.h>
-#include <errno.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <string.h>
-
-/* Whether to print debugging messages.  */
-#define ENABLE_DEBUGGING 0
-
-#if ENABLE_DEBUGGING
-# define dbgprintf printf
-#else
-# define dbgprintf if (0) printf
-#endif
-
-/* BeOS does not have AF_UNSPEC.  */
-#ifndef AF_UNSPEC
-# define AF_UNSPEC 0
-#endif
-
-#ifndef EAI_SERVICE
-# define EAI_SERVICE 0
-#endif
-
-static int
-simple (char const *host, char const *service)
-{
-  char buf[BUFSIZ];
-  static int skip = 0;
-  struct addrinfo hints;
-  struct addrinfo *ai0, *ai;
-  int res;
-  int err;
-
-  /* Once we skipped the test, do not try anything else */
-  if (skip)
-    return 0;
-
-  dbgprintf ("Finding %s service %s...\n", host, service);
-
-  /* This initializes "hints" but does not use it.  Is there a reason
-     for this?  If so, please fix this comment.  */
-  memset (&hints, 0, sizeof (hints));
-  hints.ai_flags = AI_CANONNAME;
-  hints.ai_family = AF_UNSPEC;
-  hints.ai_socktype = SOCK_STREAM;
-
-  res = getaddrinfo (host, service, 0, &ai0);
-  err = errno;
-
-  dbgprintf ("res %d: %s\n", res, gai_strerror (res));
-
-  if (res != 0)
-    {
-      /* EAI_AGAIN is returned if no network is available. Don't fail
-         the test merely because someone is down the country on their
-         in-law's farm. */
-      if (res == EAI_AGAIN)
-        {
-          skip++;
-          fprintf (stderr, "skipping getaddrinfo test: no network?\n");
-          return 77;
-        }
-      /* IRIX reports EAI_NONAME for "https".  Don't fail the test
-         merely because of this.  */
-      if (res == EAI_NONAME)
-        return 0;
-      /* Solaris reports EAI_SERVICE for "http" and "https".  Don't
-         fail the test merely because of this.  */
-      if (res == EAI_SERVICE)
-        return 0;
-#ifdef EAI_NODATA
-      /* AIX reports EAI_NODATA for "https".  Don't fail the test
-         merely because of this.  */
-      if (res == EAI_NODATA)
-        return 0;
-#endif
-      /* Provide details if errno was set.  */
-      if (res == EAI_SYSTEM)
-        fprintf (stderr, "system error: %s\n", strerror (err));
-
-      return 1;
-    }
-
-  for (ai = ai0; ai; ai = ai->ai_next)
-    {
-      void *ai_addr = ai->ai_addr;
-      struct sockaddr_in *sock_addr = ai_addr;
-      dbgprintf ("\tflags %x\n", ai->ai_flags);
-      dbgprintf ("\tfamily %x\n", ai->ai_family);
-      dbgprintf ("\tsocktype %x\n", ai->ai_socktype);
-      dbgprintf ("\tprotocol %x\n", ai->ai_protocol);
-      dbgprintf ("\taddrlen %ld: ", (unsigned long) ai->ai_addrlen);
-      dbgprintf ("\tFound %s\n",
-                 inet_ntop (ai->ai_family,
-                            &sock_addr->sin_addr,
-                            buf, sizeof (buf) - 1));
-      if (ai->ai_canonname)
-        dbgprintf ("\tFound %s...\n", ai->ai_canonname);
-
-      {
-        char ipbuf[BUFSIZ];
-        char portbuf[BUFSIZ];
-
-        res = getnameinfo (ai->ai_addr, ai->ai_addrlen,
-                           ipbuf, sizeof (ipbuf) - 1,
-                           portbuf, sizeof (portbuf) - 1,
-                           NI_NUMERICHOST|NI_NUMERICSERV);
-        dbgprintf ("\t\tgetnameinfo %d: %s\n", res, gai_strerror (res));
-        if (res == 0)
-          {
-            dbgprintf ("\t\tip %s\n", ipbuf);
-            dbgprintf ("\t\tport %s\n", portbuf);
-          }
-      }
-
-    }
-
-  freeaddrinfo (ai0);
-
-  return 0;
-}
-
-#define HOST1 "www.gnu.org"
-#define SERV1 "http"
-#define HOST2 "www.ibm.com"
-#define SERV2 "https"
-#define HOST3 "microsoft.com"
-#define SERV3 "http"
-#define HOST4 "google.org"
-#define SERV4 "ldap"
-
-int main (void)
-{
-  return simple (HOST1, SERV1)
-    + simple (HOST2, SERV2)
-    + simple (HOST3, SERV3)
-    + simple (HOST4, SERV4);
-}
diff --git a/gl/tests/test-getcwd-lgpl.c b/gl/tests/test-getcwd-lgpl.c
deleted file mode 100644 (file)
index 371c8df..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Test of getcwd() function.
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include <unistd.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (getcwd, char *, (char *, size_t));
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "macros.h"
-
-int
-main (int argc, char **argv)
-{
-  char *pwd1;
-  char *pwd2;
-  /* If the user provides an argument, attempt to chdir there first.  */
-  if (1 < argc)
-    {
-      if (chdir (argv[1]) == 0)
-        printf ("changed to directory %s\n", argv[1]);
-    }
-
-  pwd1 = getcwd (NULL, 0);
-  ASSERT (pwd1 && *pwd1);
-  if (1 < argc)
-    printf ("cwd=%s\n", pwd1);
-
-  /* Make sure the result is usable.  */
-  ASSERT (chdir (pwd1) == 0);
-  ASSERT (chdir (".//./.") == 0);
-
-  /* Make sure that result is normalized.  */
-  pwd2 = getcwd (NULL, 0);
-  ASSERT (pwd2);
-  ASSERT (strcmp (pwd1, pwd2) == 0);
-  free (pwd2);
-  {
-    size_t len = strlen (pwd1);
-    ssize_t i = len - 10;
-    if (i < 1)
-      i = 1;
-    pwd2 = getcwd (NULL, len + 1);
-    ASSERT (pwd2);
-    free (pwd2);
-    pwd2 = malloc (len + 2);
-    for ( ; i <= len; i++)
-      {
-        char *tmp;
-        errno = 0;
-        ASSERT (getcwd (pwd2, i) == NULL);
-        ASSERT (errno == ERANGE);
-        /* Allow either glibc or BSD behavior, since POSIX allows both.  */
-        errno = 0;
-        tmp = getcwd (NULL, i);
-        if (tmp)
-          {
-            ASSERT (strcmp (pwd1, tmp) == 0);
-            free (tmp);
-          }
-        else
-          {
-            ASSERT (errno == ERANGE);
-          }
-      }
-    ASSERT (getcwd (pwd2, len + 1) == pwd2);
-    pwd2[len] = '/';
-    pwd2[len + 1] = '\0';
-  }
-  ASSERT (strstr (pwd2, "/./") == NULL);
-  ASSERT (strstr (pwd2, "/../") == NULL);
-  ASSERT (strstr (pwd2 + 1 + (pwd2[1] == '/'), "//") == NULL);
-
-  /* Validate a POSIX requirement on size.  */
-  errno = 0;
-  ASSERT (getcwd(pwd2, 0) == NULL);
-  ASSERT (errno == EINVAL);
-
-  free (pwd1);
-  free (pwd2);
-
-  return 0;
-}
diff --git a/gl/tests/test-getdtablesize.c b/gl/tests/test-getdtablesize.c
deleted file mode 100644 (file)
index 86a0b4f..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Test of getdtablesize() function.
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
-
-#include <config.h>
-
-#include <unistd.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (getdtablesize, int, (void));
-
-#include "macros.h"
-
-int
-main (int argc, char *argv[])
-{
-  ASSERT (getdtablesize () >= 3);
-  ASSERT (dup2 (0, getdtablesize() - 1) == getdtablesize () - 1);
-  ASSERT (dup2 (0, getdtablesize()) == -1);
-
-  return 0;
-}
diff --git a/gl/tests/test-getpeername.c b/gl/tests/test-getpeername.c
deleted file mode 100644 (file)
index 96e8fa6..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Test getpeername() function.
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include <sys/socket.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (getpeername, int, (int, struct sockaddr *, socklen_t *));
-
-#include <errno.h>
-#include <netinet/in.h>
-#include <unistd.h>
-
-#include "sockets.h"
-#include "macros.h"
-
-int
-main (void)
-{
-  (void) gl_sockets_startup (SOCKETS_1_1);
-
-  /* Test behaviour for invalid file descriptors.  */
-  {
-    struct sockaddr_in addr;
-    socklen_t addrlen = sizeof (addr);
-
-    errno = 0;
-    ASSERT (getpeername (-1, (struct sockaddr *) &addr, &addrlen) == -1);
-    ASSERT (errno == EBADF);
-  }
-  {
-    struct sockaddr_in addr;
-    socklen_t addrlen = sizeof (addr);
-
-    close (99);
-    errno = 0;
-    ASSERT (getpeername (99, (struct sockaddr *) &addr, &addrlen) == -1);
-    ASSERT (errno == EBADF);
-  }
-
-  return 0;
-}
diff --git a/gl/tests/test-ignore-value.c b/gl/tests/test-ignore-value.c
deleted file mode 100644 (file)
index 3533d7c..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Test the "ignore-value" module.
-
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Eric Blake.  */
-
-#include <config.h>
-
-#include "ignore-value.h"
-
-#include <stdio.h>
-
-#ifndef _GL_ATTRIBUTE_RETURN_CHECK
-# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4)
-#  define _GL_ATTRIBUTE_RETURN_CHECK
-# else
-#  define _GL_ATTRIBUTE_RETURN_CHECK __attribute__((__warn_unused_result__))
-# endif
-#endif
-
-struct s { int i; };
-static char doChar (void) _GL_ATTRIBUTE_RETURN_CHECK;
-static int doInt (void) _GL_ATTRIBUTE_RETURN_CHECK;
-static off_t doOff (void) _GL_ATTRIBUTE_RETURN_CHECK;
-static void *doPtr (void) _GL_ATTRIBUTE_RETURN_CHECK;
-static struct s doStruct (void) _GL_ATTRIBUTE_RETURN_CHECK;
-
-static char
-doChar (void)
-{
-  return 0;
-}
-
-static int
-doInt (void)
-{
-  return 0;
-}
-
-static off_t
-doOff (void)
-{
-  return 0;
-}
-
-static void *
-doPtr (void)
-{
-  return NULL;
-}
-
-static struct s
-doStruct (void)
-{
-  static struct s s1;
-  return s1;
-}
-
-int
-main (void)
-{
-  /* If this test can compile with -Werror and the same warnings as
-     the rest of the project, then we are properly silencing warnings
-     about ignored return values.  */
-  ignore_value (doChar ());
-  ignore_value (doInt ());
-  ignore_value (doOff ());
-  ignore_value (doPtr ());
-  ignore_value (doStruct ());
-  return 0;
-}
diff --git a/gl/tests/test-inet_ntop.c b/gl/tests/test-inet_ntop.c
deleted file mode 100644 (file)
index eca86e7..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Test of inet_ntop function.
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2009.  */
-
-#include <config.h>
-
-#include <arpa/inet.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (inet_ntop, char const *, (int, void const *, char *,
-                                           socklen_t));
-
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <string.h>
-
-#include "macros.h"
-
-int
-main (void)
-{
-#if defined AF_INET /* HAVE_IPV4 */
-  {
-    struct in_addr internal;
-    char printable[16];
-    const char *result;
-
-    /* This machine was for a long time known as
-       ma2s2.mathematik.uni-karlsruhe.de.  */
-# ifdef WORDS_BIGENDIAN
-    internal.s_addr = 0x810D7302;
-# else
-    internal.s_addr = 0x02730D81;
-# endif
-    result = inet_ntop (AF_INET, &internal, printable, sizeof (printable));
-    ASSERT (result != NULL);
-    ASSERT (strcmp (result, "129.13.115.2") == 0);
-  }
-#endif
-
-  return 0;
-}
diff --git a/gl/tests/test-ioctl.c b/gl/tests/test-ioctl.c
deleted file mode 100644 (file)
index 8f31b68..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Test of ioctl() function.
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include <sys/ioctl.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (ioctl, int, (int, int, ...));
-
-#include <errno.h>
-#include <unistd.h>
-
-#include "macros.h"
-
-int
-main (void)
-{
-#ifdef FIONREAD
-  /* Test behaviour for invalid file descriptors.  */
-  {
-    int value;
-    errno = 0;
-    ASSERT (ioctl (-1, FIONREAD, &value) == -1);
-    ASSERT (errno == EBADF);
-  }
-  {
-    int value;
-    close (99);
-    errno = 0;
-    ASSERT (ioctl (99, FIONREAD, &value) == -1);
-    ASSERT (errno == EBADF);
-  }
-#endif
-
-  return 0;
-}
diff --git a/gl/tests/test-listen.c b/gl/tests/test-listen.c
deleted file mode 100644 (file)
index f2e6c06..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Test listen() function.
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include <sys/socket.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (listen, int, (int, int));
-
-#include <errno.h>
-#include <unistd.h>
-
-#include "sockets.h"
-#include "macros.h"
-
-int
-main (void)
-{
-  (void) gl_sockets_startup (SOCKETS_1_1);
-
-  /* Test behaviour for invalid file descriptors.  */
-  {
-    errno = 0;
-    ASSERT (listen (-1, 1) == -1);
-    ASSERT (errno == EBADF);
-  }
-  {
-    close (99);
-    errno = 0;
-    ASSERT (listen (99 ,1) == -1);
-    ASSERT (errno == EBADF);
-  }
-
-  return 0;
-}
diff --git a/gl/tests/test-lstat.c b/gl/tests/test-lstat.c
deleted file mode 100644 (file)
index eab2ad4..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Test of lstat() function.
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Simon Josefsson, 2008; and Eric Blake, 2009.  */
-
-#include <config.h>
-
-#include <sys/stat.h>
-
-/* Caution: lstat may be a function-like macro.  Although this
-   signature check must pass, it may be the signature of the real (and
-   broken) lstat rather than rpl_lstat.  Most code should not use the
-   address of lstat.  */
-#include "signature.h"
-SIGNATURE_CHECK (lstat, int, (char const *, struct stat *));
-
-#include <fcntl.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "same-inode.h"
-#include "ignore-value.h"
-#include "macros.h"
-
-#define BASE "test-lstat.t"
-
-#include "test-lstat.h"
-
-/* Wrapper around lstat, which works even if lstat is a function-like
-   macro, where test_lstat_func(lstat) would do the wrong thing.  */
-static int
-do_lstat (char const *name, struct stat *st)
-{
-  return lstat (name, st);
-}
-
-int
-main (void)
-{
-  /* Remove any leftovers from a previous partial run.  */
-  ignore_value (system ("rm -rf " BASE "*"));
-
-  return test_lstat_func (do_lstat, true);
-}
diff --git a/gl/tests/test-lstat.h b/gl/tests/test-lstat.h
deleted file mode 100644 (file)
index 45ca3bf..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Test of lstat() function.
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Simon Josefsson, 2008; and Eric Blake, 2009.  */
-
-/* This file is designed to test both lstat(n,buf) and
-   fstatat(AT_FDCWD,n,buf,AT_SYMLINK_NOFOLLOW).  FUNC is the function
-   to test.  Assumes that BASE and ASSERT are already defined, and
-   that appropriate headers are already included.  If PRINT, warn
-   before skipping symlink tests with status 77.  */
-
-static int
-test_lstat_func (int (*func) (char const *, struct stat *), bool print)
-{
-  struct stat st1;
-  struct stat st2;
-
-  /* Test for common directories.  */
-  ASSERT (func (".", &st1) == 0);
-  ASSERT (func ("./", &st2) == 0);
-  ASSERT (SAME_INODE (st1, st2));
-  ASSERT (S_ISDIR (st1.st_mode));
-  ASSERT (S_ISDIR (st2.st_mode));
-  ASSERT (func ("/", &st1) == 0);
-  ASSERT (func ("///", &st2) == 0);
-  ASSERT (SAME_INODE (st1, st2));
-  ASSERT (S_ISDIR (st1.st_mode));
-  ASSERT (S_ISDIR (st2.st_mode));
-  ASSERT (func ("..", &st1) == 0);
-  ASSERT (S_ISDIR (st1.st_mode));
-
-  /* Test for error conditions.  */
-  errno = 0;
-  ASSERT (func ("", &st1) == -1);
-  ASSERT (errno == ENOENT);
-  errno = 0;
-  ASSERT (func ("nosuch", &st1) == -1);
-  ASSERT (errno == ENOENT);
-  errno = 0;
-  ASSERT (func ("nosuch/", &st1) == -1);
-  ASSERT (errno == ENOENT);
-
-  ASSERT (close (creat (BASE "file", 0600)) == 0);
-  ASSERT (func (BASE "file", &st1) == 0);
-  ASSERT (S_ISREG (st1.st_mode));
-  errno = 0;
-  ASSERT (func (BASE "file/", &st1) == -1);
-  ASSERT (errno == ENOTDIR);
-
-  /* Now for some symlink tests, where supported.  We set up:
-     link1 -> directory
-     link2 -> file
-     link3 -> dangling
-     link4 -> loop
-     then test behavior both with and without trailing slash.
-  */
-  if (symlink (".", BASE "link1") != 0)
-    {
-      ASSERT (unlink (BASE "file") == 0);
-      if (print)
-        fputs ("skipping test: symlinks not supported on this file system\n",
-               stderr);
-      return 77;
-    }
-  ASSERT (symlink (BASE "file", BASE "link2") == 0);
-  ASSERT (symlink (BASE "nosuch", BASE "link3") == 0);
-  ASSERT (symlink (BASE "link4", BASE "link4") == 0);
-
-  ASSERT (func (BASE "link1", &st1) == 0);
-  ASSERT (S_ISLNK (st1.st_mode));
-  ASSERT (func (BASE "link1/", &st1) == 0);
-  ASSERT (stat (BASE "link1", &st2) == 0);
-  ASSERT (S_ISDIR (st1.st_mode));
-  ASSERT (S_ISDIR (st2.st_mode));
-  ASSERT (SAME_INODE (st1, st2));
-
-  ASSERT (func (BASE "link2", &st1) == 0);
-  ASSERT (S_ISLNK (st1.st_mode));
-  errno = 0;
-  ASSERT (func (BASE "link2/", &st1) == -1);
-  ASSERT (errno == ENOTDIR);
-
-  ASSERT (func (BASE "link3", &st1) == 0);
-  ASSERT (S_ISLNK (st1.st_mode));
-  errno = 0;
-  ASSERT (func (BASE "link3/", &st1) == -1);
-  ASSERT (errno == ENOENT);
-
-  ASSERT (func (BASE "link4", &st1) == 0);
-  ASSERT (S_ISLNK (st1.st_mode));
-  errno = 0;
-  ASSERT (func (BASE "link4/", &st1) == -1);
-  ASSERT (errno == ELOOP);
-
-  /* Cleanup.  */
-  ASSERT (unlink (BASE "file") == 0);
-  ASSERT (unlink (BASE "link1") == 0);
-  ASSERT (unlink (BASE "link2") == 0);
-  ASSERT (unlink (BASE "link3") == 0);
-  ASSERT (unlink (BASE "link4") == 0);
-
-  return 0;
-}
diff --git a/gl/tests/test-open.c b/gl/tests/test-open.c
deleted file mode 100644 (file)
index 985d901..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Test of opening a file descriptor.
-   Copyright (C) 2007-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
-
-#include <config.h>
-
-#include <fcntl.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (open, int, (char const *, int, ...));
-
-#include <errno.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include "macros.h"
-
-#define BASE "test-open.t"
-
-#include "test-open.h"
-
-int
-main (void)
-{
-  return test_open (open, true);
-}
diff --git a/gl/tests/test-open.h b/gl/tests/test-open.h
deleted file mode 100644 (file)
index d7bd5af..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Test of opening a file descriptor.
-   Copyright (C) 2007-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
-
-/* Make test_open always inline if we're using Fortify, which defines
-   __always_inline to do that.  Do nothing otherwise.  This works
-   around a glibc bug whereby 'open' cannot be used as a function
-   pointer when _FORTIFY_SOURCE is positive.  */
-
-#ifndef __always_inline
-#define __always_inline
-#endif
-
-/* This file is designed to test both open(n,buf[,mode]) and
-   openat(AT_FDCWD,n,buf[,mode]).  FUNC is the function to test.
-   Assumes that BASE and ASSERT are already defined, and that
-   appropriate headers are already included.  If PRINT, warn before
-   skipping symlink tests with status 77.  */
-
-static __always_inline int
-test_open (int (*func) (char const *, int, ...), bool print)
-{
-  int fd;
-  /* Remove anything from prior partial run.  */
-  unlink (BASE "file");
-
-  /* Cannot create directory.  */
-  errno = 0;
-  ASSERT (func ("nonexist.ent/", O_CREAT | O_RDONLY, 0600) == -1);
-  ASSERT (errno == ENOTDIR || errno == EISDIR || errno == ENOENT
-          || errno == EINVAL);
-
-  /* Create a regular file.  */
-  fd = func (BASE "file", O_CREAT | O_RDONLY, 0600);
-  ASSERT (0 <= fd);
-  ASSERT (close (fd) == 0);
-
-  /* Trailing slash handling.  */
-  errno = 0;
-  ASSERT (func (BASE "file/", O_RDONLY) == -1);
-  ASSERT (errno == ENOTDIR || errno == EISDIR || errno == EINVAL);
-
-  /* Directories cannot be opened for writing.  */
-  errno = 0;
-  ASSERT (func (".", O_WRONLY) == -1);
-  ASSERT (errno == EISDIR || errno == EACCES);
-
-  /* /dev/null must exist, and be writable.  */
-  fd = func ("/dev/null", O_RDONLY);
-  ASSERT (0 <= fd);
-  {
-    char c;
-    ASSERT (read (fd, &c, 1) == 0);
-  }
-  ASSERT (close (fd) == 0);
-  fd = func ("/dev/null", O_WRONLY);
-  ASSERT (0 <= fd);
-  ASSERT (write (fd, "c", 1) == 1);
-  ASSERT (close (fd) == 0);
-
-  /* Although O_NONBLOCK on regular files can be ignored, it must not
-     cause a failure.  */
-  fd = func (BASE "file", O_NONBLOCK | O_RDONLY);
-  ASSERT (0 <= fd);
-  ASSERT (close (fd) == 0);
-
-  /* Symlink handling, where supported.  */
-  if (symlink (BASE "file", BASE "link") != 0)
-    {
-      ASSERT (unlink (BASE "file") == 0);
-      if (print)
-        fputs ("skipping test: symlinks not supported on this file system\n",
-               stderr);
-      return 77;
-    }
-  errno = 0;
-  ASSERT (func (BASE "link/", O_RDONLY) == -1);
-  ASSERT (errno == ENOTDIR);
-  fd = func (BASE "link", O_RDONLY);
-  ASSERT (0 <= fd);
-  ASSERT (close (fd) == 0);
-
-  /* Cleanup.  */
-  ASSERT (unlink (BASE "file") == 0);
-  ASSERT (unlink (BASE "link") == 0);
-
-  return 0;
-}
diff --git a/gl/tests/test-pathmax.c b/gl/tests/test-pathmax.c
deleted file mode 100644 (file)
index 8bc7dbc..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Test of "pathmax.h".
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2011.  */
-
-#include <config.h>
-
-#include "pathmax.h"
-
-/* Check that PATH_MAX is a constant if it is defined.  */
-#ifdef PATH_MAX
-int a = PATH_MAX;
-#endif
-
-int
-main (void)
-{
-  return 0;
-}
diff --git a/gl/tests/test-perror.c b/gl/tests/test-perror.c
deleted file mode 100644 (file)
index c003faa..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Test of perror() function.
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include <stdio.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (perror, void, (char const *));
-
-#include <errno.h>
-
-int
-main (int argc, char **argv)
-{
-  const char *prefix = (argc > 1 ? argv[1] : NULL);
-
-  errno = EACCES;    perror (prefix);
-  errno = ETIMEDOUT; perror (prefix);
-  errno = EOVERFLOW; perror (prefix);
-
-  return 0;
-}
diff --git a/gl/tests/test-perror.sh b/gl/tests/test-perror.sh
deleted file mode 100755 (executable)
index 7274d32..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-: ${srcdir=.}
-. "$srcdir/init.sh"; path_prepend_ .
-
-# Test NULL prefix. Result should not contain a number.
-test-perror 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror.tmp
-grep '[0-9]' t-perror.tmp > /dev/null \
-  && fail_ "result should not contain a number"
-
-# Test empty prefix. Result should be the same.
-test-perror '' 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror1.tmp
-diff t-perror.tmp t-perror1.tmp \
-  || fail_ "empty prefix should behave like NULL argument"
-
-# Test non-empty prefix.
-test-perror foo 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror3.tmp
-sed -e 's/^/foo: /' < t-perror.tmp > t-perror2.tmp
-diff t-perror2.tmp t-perror3.tmp || fail_ "prefix applied incorrectly"
-
-# Test exit status.
-test-perror >out 2>/dev/null || fail_ "unexpected exit status"
-test -s out && fail_ "unexpected output"
-
-Exit 0
diff --git a/gl/tests/test-perror2.c b/gl/tests/test-perror2.c
deleted file mode 100644 (file)
index 7e98126..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/* Test of perror() function.
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include <stdio.h>
-
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-
-/* This test intentionally parses stderr.  So, we arrange to have fd 10
-   (outside the range of interesting fd's during the test) set up to
-   duplicate the original stderr.  */
-#define BACKUP_STDERR_FILENO 10
-#define ASSERT_STREAM myerr
-#include "macros.h"
-
-static FILE *myerr;
-
-#define BASE "test-perror2"
-
-int
-main (void)
-{
-  /* We change fd 2 later, so save it in fd 10.  */
-  if (dup2 (STDERR_FILENO, BACKUP_STDERR_FILENO) != BACKUP_STDERR_FILENO
-      || (myerr = fdopen (BACKUP_STDERR_FILENO, "w")) == NULL)
-    return 2;
-
-  ASSERT (freopen (BASE ".tmp", "w+", stderr) == stderr);
-
-  /* Test that perror does not clobber strerror buffer.  */
-  {
-    const char *msg1;
-    const char *msg2;
-    const char *msg3;
-    const char *msg4;
-    char *str1;
-    char *str2;
-    char *str3;
-    char *str4;
-
-    msg1 = strerror (ENOENT);
-    ASSERT (msg1);
-    str1 = strdup (msg1);
-    ASSERT (str1);
-
-    msg2 = strerror (ERANGE);
-    ASSERT (msg2);
-    str2 = strdup (msg2);
-    ASSERT (str2);
-
-    msg3 = strerror (-4);
-    ASSERT (msg3);
-    str3 = strdup (msg3);
-    ASSERT (str3);
-
-    msg4 = strerror (1729576);
-    ASSERT (msg4);
-    str4 = strdup (msg4);
-    ASSERT (str4);
-
-    errno = EACCES;
-    perror ("");
-    errno = -5;
-    perror ("");
-    ASSERT (!ferror (stderr));
-    ASSERT (msg1 == msg2 || msg1 == msg4 || STREQ (msg1, str1));
-    ASSERT (msg2 == msg4 || STREQ (msg2, str2));
-    ASSERT (msg3 == msg4 || STREQ (msg3, str3));
-    ASSERT (STREQ (msg4, str4));
-
-    free (str1);
-    free (str2);
-    free (str3);
-    free (str4);
-  }
-
-  /* Test that perror uses the same message as strerror.  */
-  {
-    int errs[] = { EACCES, 0, -3, };
-    int i;
-    for (i = 0; i < SIZEOF (errs); i++)
-      {
-        char buf[256];
-        char *err = strerror (errs[i]);
-
-        ASSERT (err);
-        ASSERT (strlen (err) < sizeof buf);
-        rewind (stderr);
-        ASSERT (ftruncate (fileno (stderr), 0) == 0);
-        errno = errs[i];
-        perror (NULL);
-        ASSERT (!ferror (stderr));
-        rewind (stderr);
-        ASSERT (fgets (buf, sizeof buf, stderr) == buf);
-        ASSERT (strstr (buf, err));
-      }
-  }
-
-  /* Test that perror reports write failure.  */
-  {
-    ASSERT (freopen (BASE ".tmp", "r", stderr) == stderr);
-    ASSERT (setvbuf (stderr, NULL, _IONBF, BUFSIZ) == 0);
-    errno = -1;
-    ASSERT (!ferror (stderr));
-    perror (NULL);
-#if 0
-    /* Commented out until cygwin behaves:
-       http://sourceware.org/ml/newlib/2011/msg00228.html */
-    ASSERT (errno > 0);
-    /* Commented out until glibc behaves:
-       http://sourceware.org/bugzilla/show_bug.cgi?id=12792 */
-    ASSERT (ferror (stderr));
-#endif
-  }
-
-  ASSERT (fclose (stderr) == 0);
-  ASSERT (remove (BASE ".tmp") == 0);
-
-  return 0;
-}
diff --git a/gl/tests/test-pipe.c b/gl/tests/test-pipe.c
deleted file mode 100644 (file)
index c951d1d..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/* Test of pipe.
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include <unistd.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (pipe, int, (int[2]));
-
-#include <fcntl.h>
-#include <stdbool.h>
-
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* Get declarations of the native Windows API functions.  */
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-/* Get _get_osfhandle.  */
-# include "msvc-nothrow.h"
-#endif
-
-#include "binary-io.h"
-#include "macros.h"
-
-/* Return true if FD is open.  */
-static bool
-is_open (int fd)
-{
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-  /* On native Windows, the initial state of unassigned standard file
-     descriptors is that they are open but point to an
-     INVALID_HANDLE_VALUE, and there is no fcntl.  */
-  return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE;
-#else
-# ifndef F_GETFL
-#  error Please port fcntl to your platform
-# endif
-  return 0 <= fcntl (fd, F_GETFL);
-#endif
-}
-
-/* Return true if FD is not inherited to child processes.  */
-static bool
-is_cloexec (int fd)
-{
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-  HANDLE h = (HANDLE) _get_osfhandle (fd);
-  DWORD flags;
-  ASSERT (GetHandleInformation (h, &flags));
-  return (flags & HANDLE_FLAG_INHERIT) == 0;
-#else
-  int flags;
-  ASSERT ((flags = fcntl (fd, F_GETFD)) >= 0);
-  return (flags & FD_CLOEXEC) != 0;
-#endif
-}
-
-/* Return true if FD is in non-blocking mode.  */
-static bool
-is_nonblocking (int fd)
-{
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-  /* We don't use the non-blocking mode for sockets here.  */
-  return 0;
-#else
-  int flags;
-  ASSERT ((flags = fcntl (fd, F_GETFL)) >= 0);
-  return (flags & O_NONBLOCK) != 0;
-#endif
-}
-
-int
-main ()
-{
-  int fd[2];
-
-  fd[0] = -1;
-  fd[1] = -1;
-  ASSERT (pipe (fd) >= 0);
-  ASSERT (fd[0] >= 0);
-  ASSERT (fd[1] >= 0);
-  ASSERT (fd[0] != fd[1]);
-  ASSERT (is_open (fd[0]));
-  ASSERT (is_open (fd[1]));
-  ASSERT (!is_cloexec (fd[0]));
-  ASSERT (!is_cloexec (fd[1]));
-  ASSERT (!is_nonblocking (fd[0]));
-  ASSERT (!is_nonblocking (fd[1]));
-
-  return 0;
-}
diff --git a/gl/tests/test-recv.c b/gl/tests/test-recv.c
deleted file mode 100644 (file)
index 114e332..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Test the recv() function.
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include <sys/socket.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (recv, ssize_t, (int, void *, size_t, int));
-
-#include <errno.h>
-#include <unistd.h>
-
-#include "sockets.h"
-#include "macros.h"
-
-int
-main (void)
-{
-  (void) gl_sockets_startup (SOCKETS_1_1);
-
-  /* Test behaviour for invalid file descriptors.  */
-  {
-    char byte;
-    errno = 0;
-    ASSERT (recv (-1, &byte, 1, 0) == -1);
-    ASSERT (errno == EBADF);
-  }
-  {
-    char byte;
-    close (99);
-    errno = 0;
-    ASSERT (recv (99, &byte, 1, 0) == -1);
-    ASSERT (errno == EBADF);
-  }
-
-  return 0;
-}
diff --git a/gl/tests/test-recvfrom.c b/gl/tests/test-recvfrom.c
deleted file mode 100644 (file)
index d0b8c61..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Test the recvfrom() function.
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include <sys/socket.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (recvfrom, ssize_t,
-                 (int, void *, size_t, int,
-                  struct sockaddr *, socklen_t *));
-
-#include <errno.h>
-#include <netinet/in.h>
-#include <unistd.h>
-
-#include "sockets.h"
-#include "macros.h"
-
-int
-main (void)
-{
-  (void) gl_sockets_startup (SOCKETS_1_1);
-
-  /* Test behaviour for invalid file descriptors.  */
-  {
-    char byte;
-    struct sockaddr_in addr;
-    socklen_t addrlen = sizeof (addr);
-
-    errno = 0;
-    ASSERT (recvfrom (-1, &byte, 1, 0, (struct sockaddr *) &addr, &addrlen)
-            == -1);
-    ASSERT (errno == EBADF);
-  }
-  {
-    char byte;
-    struct sockaddr_in addr;
-    socklen_t addrlen = sizeof (addr);
-
-    close (99);
-    errno = 0;
-    ASSERT (recvfrom (99, &byte, 1, 0, (struct sockaddr *) &addr, &addrlen)
-            == -1);
-    ASSERT (errno == EBADF);
-  }
-
-  return 0;
-}
diff --git a/gl/tests/test-select-fd.c b/gl/tests/test-select-fd.c
deleted file mode 100644 (file)
index ae9e83c..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Test of select() substitute, reading or writing from a given file descriptor.
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
-
-#include <config.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/select.h>
-
-int
-main (int argc, char *argv[])
-{
-  if (argc == 4)
-    {
-      char mode = argv[1][0];
-
-      if (mode == 'r' || mode == 'w')
-        {
-          int fd = atoi (argv[2]);
-
-          if (fd >= 0)
-            {
-              const char *result_file_name = argv[3];
-              FILE *result_file = fopen (result_file_name, "wb");
-
-              if (result_file != NULL)
-                {
-                  fd_set fds;
-                  struct timeval timeout;
-                  int ret;
-
-                  FD_ZERO (&fds);
-                  FD_SET (fd, &fds);
-                  timeout.tv_sec = 0;
-                  timeout.tv_usec = 10000;
-                  ret = (mode == 'r'
-                         ? select (fd + 1, &fds, NULL, NULL, &timeout)
-                         : select (fd + 1, NULL, &fds, NULL, &timeout));
-                  if (ret < 0)
-                    {
-                      perror ("select failed");
-                      exit (1);
-                    }
-                  if ((ret == 0) != ! FD_ISSET (fd, &fds))
-                    {
-                      fprintf (stderr, "incorrect return value\n");
-                      exit (1);
-                    }
-                  fprintf (result_file, "%d\n", ret);
-                  exit (0);
-                }
-            }
-        }
-    }
-  fprintf (stderr, "Usage: test-select-fd mode fd result-file-name\n");
-  exit (1);
-}
diff --git a/gl/tests/test-select-in.sh b/gl/tests/test-select-in.sh
deleted file mode 100755 (executable)
index 2a8b742..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-# Test select() on file descriptors opened for reading.
-
-# This test is known to fail on Solaris 2.6 and older, due to its handling
-# of /dev/null.
-
-tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
-
-tmpfiles="$tmpfiles t-select-in.tmp"
-
-# Regular files.
-
-rm -f t-select-in.tmp
-./test-select-fd${EXEEXT} r 0 t-select-in.tmp < ./test-select-fd${EXEEXT}
-test `cat t-select-in.tmp` = "1" || exit 1
-
-# Pipes.
-
-rm -f t-select-in.tmp
-{ sleep 1; echo abc; } | \
-  { ./test-select-fd${EXEEXT} r 0 t-select-in.tmp; cat > /dev/null; }
-test `cat t-select-in.tmp` = "0" || exit 1
-
-rm -f t-select-in.tmp
-echo abc | { sleep 1; ./test-select-fd${EXEEXT} r 0 t-select-in.tmp; }
-test `cat t-select-in.tmp` = "1" || exit 1
-
-# Special files.
-# This part of the test is known to fail on Solaris 2.6 and older.
-
-# Doesn't work under mingw -- simon@josefsson.org
-#rm -f t-select-in.tmp
-#./test-select-fd${EXEEXT} r 0 t-select-in.tmp < /dev/null
-#test `cat t-select-in.tmp` = "1" || exit 1
-
-rm -fr $tmpfiles
-
-exit 0
diff --git a/gl/tests/test-select-out.sh b/gl/tests/test-select-out.sh
deleted file mode 100755 (executable)
index c5fd861..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/sh
-# Test select() on file descriptors opened for writing.
-
-tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
-
-tmpfiles="$tmpfiles t-select-out.out t-select-out.tmp"
-
-# Regular files.
-
-rm -f t-select-out.tmp
-./test-select-fd${EXEEXT} w 1 t-select-out.tmp > t-select-out.out
-test `cat t-select-out.tmp` = "1" || exit 1
-
-# Pipes.
-
-if false; then # This test fails on some platforms.
-  rm -f t-select-out.tmp
-  ( { echo abc; ./test-select-fd${EXEEXT} w 1 t-select-out.tmp; } | { sleep 1; cat; } ) > /dev/null
-  test `cat t-select-out.tmp` = "0" || exit 1
-fi
-
-rm -f t-select-out.tmp
-( { sleep 1; echo abc; ./test-select-fd${EXEEXT} w 1 t-select-out.tmp; } | cat) > /dev/null
-test `cat t-select-out.tmp` = "1" || exit 1
-
-# Special files.
-
-rm -f t-select-out.tmp
-./test-select-fd${EXEEXT} w 1 t-select-out.tmp > /dev/null
-test `cat t-select-out.tmp` = "1" || exit 1
-
-rm -fr $tmpfiles
-
-exit 0
diff --git a/gl/tests/test-select-stdin.c b/gl/tests/test-select-stdin.c
deleted file mode 100644 (file)
index 8b242a2..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Test of select() substitute, reading from stdin.
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
-
-#include <config.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/select.h>
-#include <sys/time.h>
-#include <unistd.h>
-
-#include "macros.h"
-
-int
-main (void)
-{
-  printf ("Applying select() from standard input. Press Ctrl-C to abort.\n");
-  for (;;)
-    {
-      struct timeval before;
-      struct timeval after;
-      unsigned long spent_usec;
-      fd_set readfds;
-      struct timeval timeout;
-      int ret;
-
-      gettimeofday (&before, NULL);
-
-      FD_ZERO (&readfds);
-      FD_SET (0, &readfds);
-      timeout.tv_sec = 0;
-      timeout.tv_usec = 500000;
-      ret = select (1, &readfds, NULL, NULL, &timeout);
-
-      gettimeofday (&after, NULL);
-      spent_usec = (after.tv_sec - before.tv_sec) * 1000000
-                   + after.tv_usec - before.tv_usec;
-
-      if (ret < 0)
-        {
-          perror ("select failed");
-          exit (1);
-        }
-      if ((ret == 0) != ! FD_ISSET (0, &readfds))
-        {
-          fprintf (stderr, "incorrect return value\n");
-          exit (1);
-        }
-      if (ret == 0)
-        {
-          if (spent_usec < 250000)
-            {
-              fprintf (stderr, "returned too early\n");
-              exit (1);
-            }
-          /* Timeout */
-          printf (".");
-          ASSERT (fflush (stdout) == 0);
-        }
-      else
-        {
-          char c;
-
-          printf ("Input available! Trying to read 1 byte...\n");
-          ASSERT (read (0, &c, 1) == 1);
-        }
-    }
-}
diff --git a/gl/tests/test-select.c b/gl/tests/test-select.c
deleted file mode 100644 (file)
index ef7389a..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Test of select() substitute.
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Paolo Bonzini, 2008.  */
-
-#include <config.h>
-
-#include <sys/select.h>
-
-#include "signature.h"
-
-SIGNATURE_CHECK (select, int, (int, fd_set *, fd_set *, fd_set *,
-                               struct timeval *));
-
-#include "test-select.h"
-
-int
-main (void)
-{
-  return test_function (select);
-}
diff --git a/gl/tests/test-select.h b/gl/tests/test-select.h
deleted file mode 100644 (file)
index adf1dd4..0000000
+++ /dev/null
@@ -1,462 +0,0 @@
-/* Test of select() substitute.
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Paolo Bonzini, 2008.  */
-
-#include <stdio.h>
-#include <string.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <sys/ioctl.h>
-#include <errno.h>
-
-#include "macros.h"
-
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-# define WINDOWS_NATIVE
-#endif
-
-#ifdef HAVE_SYS_WAIT_H
-# include <sys/wait.h>
-#endif
-
-#ifndef SO_REUSEPORT
-# define SO_REUSEPORT    SO_REUSEADDR
-#endif
-
-#define TEST_PORT       12345
-
-
-typedef int (*select_fn) (int, fd_set *, fd_set *, fd_set *, struct timeval *);
-
-
-/* Minimal testing infrastructure.  */
-
-static int failures;
-
-static void
-failed (const char *reason)
-{
-  if (++failures > 1)
-    printf ("  ");
-  printf ("failed (%s)\n", reason);
-}
-
-static int
-test (void (*fn) (select_fn), select_fn my_select, const char *msg)
-{
-  failures = 0;
-  printf ("%s... ", msg);
-  fflush (stdout);
-  fn (my_select);
-
-  if (!failures)
-    printf ("passed\n");
-
-  return failures;
-}
-
-
-/* Funny socket code.  */
-
-static int
-open_server_socket (void)
-{
-  int s, x;
-  struct sockaddr_in ia;
-
-  s = socket (AF_INET, SOCK_STREAM, 0);
-
-  x = 1;
-  setsockopt (s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof (x));
-
-  memset (&ia, 0, sizeof (ia));
-  ia.sin_family = AF_INET;
-  inet_pton (AF_INET, "127.0.0.1", &ia.sin_addr);
-  ia.sin_port = htons (TEST_PORT);
-  if (bind (s, (struct sockaddr *) &ia, sizeof (ia)) < 0)
-    {
-      perror ("bind");
-      exit (77);
-    }
-
-  if (listen (s, 1) < 0)
-    {
-      perror ("listen");
-      exit (77);
-    }
-
-  return s;
-}
-
-static int
-connect_to_socket (bool blocking)
-{
-  int s;
-  struct sockaddr_in ia;
-
-  s = socket (AF_INET, SOCK_STREAM, 0);
-
-  memset (&ia, 0, sizeof (ia));
-  ia.sin_family = AF_INET;
-  inet_pton (AF_INET, "127.0.0.1", &ia.sin_addr);
-  ia.sin_port = htons (TEST_PORT);
-
-  if (!blocking)
-    {
-#ifdef WINDOWS_NATIVE
-      unsigned long iMode = 1;
-      ioctl (s, FIONBIO, (char *) &iMode);
-
-#elif defined F_GETFL
-      int oldflags = fcntl (s, F_GETFL, NULL);
-
-      if (!(oldflags & O_NONBLOCK))
-        fcntl (s, F_SETFL, oldflags | O_NONBLOCK);
-#endif
-    }
-
-  if (connect (s, (struct sockaddr *) &ia, sizeof (ia)) < 0
-      && (blocking || errno != EINPROGRESS))
-    {
-      perror ("connect");
-      exit (77);
-    }
-
-  return s;
-}
-
-
-/* A slightly more convenient interface to select(2).
-   Waits until a specific event occurs on a file descriptor FD.
-   EV is a bit mask of events to look for:
-     SEL_IN - input can be polled without blocking,
-     SEL_OUT - output can be provided without blocking,
-     SEL_EXC - an exception occurred,
-   A maximum wait time is specified by TIMEOUT.
-   *TIMEOUT = { 0, 0 } means to return immediately,
-   TIMEOUT = NULL means to wait indefinitely.  */
-
-enum { SEL_IN = 1, SEL_OUT = 2, SEL_EXC = 4 };
-
-static int
-do_select (int fd, int ev, struct timeval *timeout, select_fn my_select)
-{
-  fd_set rfds, wfds, xfds;
-  int r, rev;
-
-  FD_ZERO (&rfds);
-  FD_ZERO (&wfds);
-  FD_ZERO (&xfds);
-  if (ev & SEL_IN)
-    FD_SET (fd, &rfds);
-  if (ev & SEL_OUT)
-    FD_SET (fd, &wfds);
-  if (ev & SEL_EXC)
-    FD_SET (fd, &xfds);
-  r = my_select (fd + 1, &rfds, &wfds, &xfds, timeout);
-  if (r < 0)
-    return r;
-
-  rev = 0;
-  if (FD_ISSET (fd, &rfds))
-    rev |= SEL_IN;
-  if (FD_ISSET (fd, &wfds))
-    rev |= SEL_OUT;
-  if (FD_ISSET (fd, &xfds))
-    rev |= SEL_EXC;
-  if (rev && r == 0)
-    failed ("select returned 0");
-  if (rev & ~ev)
-    failed ("select returned unrequested events");
-
-  return rev;
-}
-
-static int
-do_select_nowait (int fd, int ev, select_fn my_select)
-{
-  struct timeval tv0;
-  tv0.tv_sec = 0;
-  tv0.tv_usec = 0;
-  return do_select (fd, ev, &tv0, my_select);
-}
-
-static int
-do_select_wait (int fd, int ev, select_fn my_select)
-{
-  return do_select (fd, ev, NULL, my_select);
-}
-
-
-/* Test select(2) for TTYs.  */
-
-#ifdef INTERACTIVE
-static void
-test_tty (select_fn my_select)
-{
-  if (do_select_nowait (0, SEL_IN, my_select) != 0)
-    failed ("can read");
-  if (do_select_nowait (0, SEL_OUT, my_select) == 0)
-    failed ("cannot write");
-
-  if (do_select_wait (0, SEL_IN, my_select) == 0)
-    failed ("return with infinite timeout");
-
-  getchar ();
-  if (do_select_nowait (0, SEL_IN, my_select) != 0)
-    failed ("can read after getc");
-}
-#endif
-
-
-static int
-do_select_bad_nfd_nowait (int nfd, select_fn my_select)
-{
-  struct timeval tv0;
-  tv0.tv_sec = 0;
-  tv0.tv_usec = 0;
-  errno = 0;
-  return my_select (nfd, NULL, NULL, NULL, &tv0);
-}
-
-static void
-test_bad_nfd (select_fn my_select)
-{
-  if (do_select_bad_nfd_nowait (-1, my_select) != -1 || errno != EINVAL)
-    failed ("invalid errno after negative nfds");
-  /* Can't test FD_SETSIZE + 1 for EINVAL, since some systems allow
-     dynamically larger set size by redefining FD_SETSIZE anywhere up
-     to the actual maximum fd.  */
-  /* if (do_select_bad_nfd_nowait (FD_SETSIZE + 1, my_select) != -1 */
-  /*     || errno != EINVAL) */
-  /*   failed ("invalid errno after bogus nfds"); */
-}
-
-/* Test select(2) on invalid file descriptors.  */
-
-static int
-do_select_bad_fd (int fd, int ev, struct timeval *timeout, select_fn my_select)
-{
-  fd_set rfds, wfds, xfds;
-
-  FD_ZERO (&rfds);
-  FD_ZERO (&wfds);
-  FD_ZERO (&xfds);
-  if (ev & SEL_IN)
-    FD_SET (fd, &rfds);
-  if (ev & SEL_OUT)
-    FD_SET (fd, &wfds);
-  if (ev & SEL_EXC)
-    FD_SET (fd, &xfds);
-  errno = 0;
-  return my_select (fd + 1, &rfds, &wfds, &xfds, timeout);
-  /* In this case, when fd is invalid, on some platforms, the bit for fd
-     is left alone in the fd_set, whereas on other platforms it is cleared.
-     So, don't check the bit for fd here.  */
-}
-
-static int
-do_select_bad_fd_nowait (int fd, int ev, select_fn my_select)
-{
-  struct timeval tv0;
-  tv0.tv_sec = 0;
-  tv0.tv_usec = 0;
-  return do_select_bad_fd (fd, ev, &tv0, my_select);
-}
-
-static void
-test_bad_fd (select_fn my_select)
-{
-  /* This tests fails on OSF/1 and native Windows, even with fd = 16.  */
-#if !(defined __osf__ || defined WINDOWS_NATIVE)
-  int fd;
-
-  /* On Linux, Mac OS X, *BSD, values of fd like 99 or 399 are discarded
-     by the kernel early and therefore do *not* lead to EBADF, as required
-     by POSIX.  */
-# if defined __linux__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__
-  fd = 16;
-# else
-  fd = 99;
-# endif
-  close (fd);
-
-  if (do_select_bad_fd_nowait (fd, SEL_IN, my_select) == 0 || errno != EBADF)
-    failed ("invalid fd among rfds");
-  if (do_select_bad_fd_nowait (fd, SEL_OUT, my_select) == 0 || errno != EBADF)
-    failed ("invalid fd among wfds");
-  if (do_select_bad_fd_nowait (fd, SEL_EXC, my_select) == 0 || errno != EBADF)
-    failed ("invalid fd among xfds");
-#endif
-}
-
-
-/* Test select(2) for unconnected nonblocking sockets.  */
-
-static void
-test_connect_first (select_fn my_select)
-{
-  int s = open_server_socket ();
-  struct sockaddr_in ia;
-  socklen_t addrlen;
-
-  int c1, c2;
-
-  if (do_select_nowait (s, SEL_IN | SEL_EXC, my_select) != 0)
-    failed ("can read, socket not connected");
-
-  c1 = connect_to_socket (false);
-
-  if (do_select_wait (s, SEL_IN | SEL_EXC, my_select) != SEL_IN)
-    failed ("expecting readability on passive socket");
-  if (do_select_nowait (s, SEL_IN | SEL_EXC, my_select) != SEL_IN)
-    failed ("expecting readability on passive socket");
-
-  addrlen = sizeof (ia);
-  c2 = accept (s, (struct sockaddr *) &ia, &addrlen);
-  ASSERT (close (s) == 0);
-  ASSERT (close (c1) == 0);
-  ASSERT (close (c2) == 0);
-}
-
-
-/* Test select(2) for unconnected blocking sockets.  */
-
-static void
-test_accept_first (select_fn my_select)
-{
-#ifndef WINDOWS_NATIVE
-  int s = open_server_socket ();
-  struct sockaddr_in ia;
-  socklen_t addrlen;
-  char buf[3];
-  int c, pid;
-
-  pid = fork ();
-  if (pid < 0)
-    return;
-
-  if (pid == 0)
-    {
-      addrlen = sizeof (ia);
-      c = accept (s, (struct sockaddr *) &ia, &addrlen);
-      ASSERT (close (s) == 0);
-      ASSERT (write (c, "foo", 3) == 3);
-      ASSERT (read (c, buf, 3) == 3);
-      shutdown (c, SHUT_RD);
-      ASSERT (close (c) == 0);
-      exit (0);
-    }
-  else
-    {
-      ASSERT (close (s) == 0);
-      c = connect_to_socket (true);
-      if (do_select_nowait (c, SEL_OUT, my_select) != SEL_OUT)
-        failed ("cannot write after blocking connect");
-      ASSERT (write (c, "foo", 3) == 3);
-      wait (&pid);
-      if (do_select_wait (c, SEL_IN, my_select) != SEL_IN)
-        failed ("cannot read data left in the socket by closed process");
-      ASSERT (read (c, buf, 3) == 3);
-      ASSERT (write (c, "foo", 3) == 3);
-      (void) close (c); /* may fail with errno = ECONNRESET */
-    }
-#endif
-}
-
-
-/* Common code for pipes and connected sockets.  */
-
-static void
-test_pair (int rd, int wd, select_fn my_select)
-{
-  char buf[3];
-  if (do_select_wait (wd, SEL_IN | SEL_OUT | SEL_EXC, my_select) != SEL_OUT)
-    failed ("expecting writability before writing");
-  if (do_select_nowait (wd, SEL_IN | SEL_OUT | SEL_EXC, my_select) != SEL_OUT)
-    failed ("expecting writability before writing");
-
-  ASSERT (write (wd, "foo", 3) == 3);
-  if (do_select_wait (rd, SEL_IN, my_select) != SEL_IN)
-    failed ("expecting readability after writing");
-  if (do_select_nowait (rd, SEL_IN, my_select) != SEL_IN)
-    failed ("expecting readability after writing");
-
-  ASSERT (read (rd, buf, 3) == 3);
-}
-
-
-/* Test select(2) on connected sockets.  */
-
-static void
-test_socket_pair (select_fn my_select)
-{
-  struct sockaddr_in ia;
-
-  socklen_t addrlen = sizeof (ia);
-  int s = open_server_socket ();
-  int c1 = connect_to_socket (false);
-  int c2 = accept (s, (struct sockaddr *) &ia, &addrlen);
-
-  ASSERT (close (s) == 0);
-
-  test_pair (c1, c2, my_select);
-  ASSERT (close (c1) == 0);
-  ASSERT (write (c2, "foo", 3) == 3);
-  (void) close (c2); /* may fail with errno = ECONNRESET */
-}
-
-
-/* Test select(2) on pipes.  */
-
-static void
-test_pipe (select_fn my_select)
-{
-  int fd[2];
-
-  ASSERT (pipe (fd) == 0);
-  test_pair (fd[0], fd[1], my_select);
-  ASSERT (close (fd[0]) == 0);
-  ASSERT (close (fd[1]) == 0);
-}
-
-
-/* Do them all.  */
-
-static int
-test_function (select_fn my_select)
-{
-  int result = 0;
-
-#ifdef INTERACTIVE
-  printf ("Please press Enter\n");
-  test (test_tty, "TTY", my_select);
-#endif
-
-  result += test (test_bad_nfd, my_select, "Invalid nfd test");
-  result += test (test_bad_fd, my_select, "Invalid fd test");
-  result += test (test_connect_first, my_select, "Unconnected socket test");
-  result += test (test_socket_pair, my_select, "Connected sockets test");
-  result += test (test_accept_first, my_select, "General socket test with fork");
-  result += test (test_pipe, my_select, "Pipe test");
-
-  return result;
-}
diff --git a/gl/tests/test-send.c b/gl/tests/test-send.c
deleted file mode 100644 (file)
index beb4638..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Test the send() function.
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include <sys/socket.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (send, ssize_t, (int, const void *, size_t, int));
-
-#include <errno.h>
-#include <unistd.h>
-
-#include "sockets.h"
-#include "macros.h"
-
-int
-main (void)
-{
-  (void) gl_sockets_startup (SOCKETS_1_1);
-
-  /* Test behaviour for invalid file descriptors.  */
-  {
-    char byte = 'x';
-    errno = 0;
-    ASSERT (send (-1, &byte, 1, 0) == -1);
-    ASSERT (errno == EBADF);
-  }
-  {
-    char byte = 'x';
-    close (99);
-    errno = 0;
-    ASSERT (send (99, &byte, 1, 0) == -1);
-    ASSERT (errno == EBADF);
-  }
-
-  return 0;
-}
diff --git a/gl/tests/test-sendto.c b/gl/tests/test-sendto.c
deleted file mode 100644 (file)
index 8df5d64..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Test the sendto() function.
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include <sys/socket.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (sendto, ssize_t,
-                 (int, const void *, size_t, int,
-                  const struct sockaddr *, socklen_t));
-
-#include <errno.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <unistd.h>
-
-#include "sockets.h"
-#include "macros.h"
-
-int
-main (void)
-{
-  (void) gl_sockets_startup (SOCKETS_1_1);
-
-  /* Test behaviour for invalid file descriptors.  */
-  {
-    struct sockaddr_in addr;
-
-    addr.sin_family = AF_INET;
-    inet_pton (AF_INET, "127.0.0.1", &addr.sin_addr);
-    addr.sin_port = htons (80);
-    {
-      char byte = 'x';
-      errno = 0;
-      ASSERT (sendto (-1, &byte, 1, 0,
-                      (const struct sockaddr *) &addr, sizeof (addr))
-              == -1);
-      ASSERT (errno == EBADF);
-    }
-    {
-      char byte = 'x';
-      close (99);
-      errno = 0;
-      ASSERT (sendto (99, &byte, 1, 0,
-                      (const struct sockaddr *) &addr, sizeof (addr))
-              == -1);
-      ASSERT (errno == EBADF);
-    }
-  }
-
-  return 0;
-}
diff --git a/gl/tests/test-setsockopt.c b/gl/tests/test-setsockopt.c
deleted file mode 100644 (file)
index ebf50a5..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Test setsockopt() function.
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include <sys/socket.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (setsockopt, int, (int, int, int, const void *, socklen_t));
-
-#include <errno.h>
-#include <unistd.h>
-
-#include "sockets.h"
-#include "macros.h"
-
-int
-main (void)
-{
-  (void) gl_sockets_startup (SOCKETS_1_1);
-
-  /* Test behaviour for invalid file descriptors.  */
-  {
-    int value = 1;
-
-    errno = 0;
-    ASSERT (setsockopt (-1, SOL_SOCKET, SO_REUSEADDR, &value, sizeof (value))
-            == -1);
-    ASSERT (errno == EBADF);
-  }
-  {
-    int value = 1;
-
-    close (99);
-    errno = 0;
-    ASSERT (setsockopt (99, SOL_SOCKET, SO_REUSEADDR, &value, sizeof (value))
-            == -1);
-    ASSERT (errno == EBADF);
-  }
-
-  return 0;
-}
diff --git a/gl/tests/test-shutdown.c b/gl/tests/test-shutdown.c
deleted file mode 100644 (file)
index d494609..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Test the shutdown() function.
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include <sys/socket.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (shutdown, int, (int, int));
-
-#include <errno.h>
-#include <unistd.h>
-
-#include "sockets.h"
-#include "macros.h"
-
-int
-main (void)
-{
-  (void) gl_sockets_startup (SOCKETS_1_1);
-
-  /* Test behaviour for invalid file descriptors.  */
-  {
-    errno = 0;
-    ASSERT (shutdown (-1, SHUT_RD) == -1);
-    ASSERT (errno == EBADF);
-  }
-  {
-    close (99);
-    errno = 0;
-    ASSERT (shutdown (99, SHUT_RD) == -1);
-    ASSERT (errno == EBADF);
-  }
-
-  return 0;
-}
diff --git a/gl/tests/test-signal-h.c b/gl/tests/test-signal-h.c
deleted file mode 100644 (file)
index 3bc9482..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Test of <signal.h> substitute.
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
-
-#include <config.h>
-
-#include <signal.h>
-
-/* Check for required types.  */
-struct
-{
-  size_t a;
-  uid_t b;
-  volatile sig_atomic_t c;
-  sigset_t d;
-  pid_t e;
-#if 0
-  /* Not guaranteed by gnulib.  */
-  pthread_t f;
-  struct timespec g;
-#endif
-} s;
-
-/* Check that NSIG is defined.  */
-int nsig = NSIG;
-
-int
-main (void)
-{
-  switch (0)
-    {
-      /* The following are guaranteed by C.  */
-    case 0:
-    case SIGABRT:
-    case SIGFPE:
-    case SIGILL:
-    case SIGINT:
-    case SIGSEGV:
-    case SIGTERM:
-      /* The following is guaranteed by gnulib.  */
-#if GNULIB_SIGPIPE || defined SIGPIPE
-    case SIGPIPE:
-#endif
-      /* Ensure no conflict with other standardized names.  */
-#ifdef SIGALRM
-    case SIGALRM:
-#endif
-      /* On Haiku, SIGBUS is mistakenly equal to SIGSEGV.  */
-#if defined SIGBUS && SIGBUS != SIGSEGV
-    case SIGBUS:
-#endif
-#ifdef SIGCHLD
-    case SIGCHLD:
-#endif
-#ifdef SIGCONT
-    case SIGCONT:
-#endif
-#ifdef SIGHUP
-    case SIGHUP:
-#endif
-#ifdef SIGKILL
-    case SIGKILL:
-#endif
-#ifdef SIGQUIT
-    case SIGQUIT:
-#endif
-#ifdef SIGSTOP
-    case SIGSTOP:
-#endif
-#ifdef SIGTSTP
-    case SIGTSTP:
-#endif
-#ifdef SIGTTIN
-    case SIGTTIN:
-#endif
-#ifdef SIGTTOU
-    case SIGTTOU:
-#endif
-#ifdef SIGUSR1
-    case SIGUSR1:
-#endif
-#ifdef SIGUSR2
-    case SIGUSR2:
-#endif
-#ifdef SIGSYS
-    case SIGSYS:
-#endif
-#ifdef SIGTRAP
-    case SIGTRAP:
-#endif
-#ifdef SIGURG
-    case SIGURG:
-#endif
-#ifdef SIGVTALRM
-    case SIGVTALRM:
-#endif
-#ifdef SIGXCPU
-    case SIGXCPU:
-#endif
-#ifdef SIGXFSZ
-    case SIGXFSZ:
-#endif
-      /* SIGRTMIN and SIGRTMAX need not be compile-time constants.  */
-#if 0
-# ifdef SIGRTMIN
-    case SIGRTMIN:
-# endif
-# ifdef SIGRTMAX
-    case SIGRTMAX:
-# endif
-#endif
-      ;
-    }
-  return s.a + s.b + s.c + s.e;
-}
diff --git a/gl/tests/test-stat.c b/gl/tests/test-stat.c
deleted file mode 100644 (file)
index 9ed462a..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Tests of stat.
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
-
-#include <config.h>
-
-#include <sys/stat.h>
-
-/* Caution: stat may be a function-like macro.  Although this
-   signature check must pass, it may be the signature of the real (and
-   broken) stat rather than rpl_stat.  Most code should not use the
-   address of stat.  */
-#include "signature.h"
-SIGNATURE_CHECK (stat, int, (char const *, struct stat *));
-
-#include <fcntl.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include "same-inode.h"
-#include "macros.h"
-
-#define BASE "test-stat.t"
-
-#include "test-stat.h"
-
-/* Wrapper around stat, which works even if stat is a function-like
-   macro, where test_stat_func(stat) would do the wrong thing.  */
-static int
-do_stat (char const *name, struct stat *st)
-{
-  return stat (name, st);
-}
-
-int
-main (void)
-{
-  return test_stat_func (do_stat, true);
-}
diff --git a/gl/tests/test-stat.h b/gl/tests/test-stat.h
deleted file mode 100644 (file)
index 6cfc958..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/* Tests of stat.
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
-
-/* This file is designed to test both stat(n,buf) and
-   fstatat(AT_FDCWD,n,buf,0).  FUNC is the function to test.  Assumes
-   that BASE and ASSERT are already defined, and that appropriate
-   headers are already included.  If PRINT, warn before skipping
-   symlink tests with status 77.  */
-
-static int
-test_stat_func (int (*func) (char const *, struct stat *), bool print)
-{
-  struct stat st1;
-  struct stat st2;
-  char *cwd = getcwd (NULL, 0);
-
-  ASSERT (cwd);
-  ASSERT (func (".", &st1) == 0);
-  ASSERT (func ("./", &st2) == 0);
-  ASSERT (SAME_INODE (st1, st2));
-  ASSERT (func (cwd, &st2) == 0);
-  ASSERT (SAME_INODE (st1, st2));
-  ASSERT (func ("/", &st1) == 0);
-  ASSERT (func ("///", &st2) == 0);
-  ASSERT (SAME_INODE (st1, st2));
-
-  errno = 0;
-  ASSERT (func ("", &st1) == -1);
-  ASSERT (errno == ENOENT);
-  errno = 0;
-  ASSERT (func ("nosuch", &st1) == -1);
-  ASSERT (errno == ENOENT);
-  errno = 0;
-  ASSERT (func ("nosuch/", &st1) == -1);
-  ASSERT (errno == ENOENT);
-
-  ASSERT (close (creat (BASE "file", 0600)) == 0);
-  ASSERT (func (BASE "file", &st1) == 0);
-  errno = 0;
-  ASSERT (func (BASE "file/", &st1) == -1);
-  ASSERT (errno == ENOTDIR);
-
-  /* Now for some symlink tests, where supported.  We set up:
-     link1 -> directory
-     link2 -> file
-     link3 -> dangling
-     link4 -> loop
-     then test behavior with trailing slash.
-  */
-  if (symlink (".", BASE "link1") != 0)
-    {
-      ASSERT (unlink (BASE "file") == 0);
-      if (print)
-        fputs ("skipping test: symlinks not supported on this file system\n",
-               stderr);
-      return 77;
-    }
-  ASSERT (symlink (BASE "file", BASE "link2") == 0);
-  ASSERT (symlink (BASE "nosuch", BASE "link3") == 0);
-  ASSERT (symlink (BASE "link4", BASE "link4") == 0);
-
-  ASSERT (func (BASE "link1/", &st1) == 0);
-  ASSERT (S_ISDIR (st1.st_mode));
-
-  errno = 0;
-  ASSERT (func (BASE "link2/", &st1) == -1);
-  ASSERT (errno == ENOTDIR);
-
-  errno = 0;
-  ASSERT (func (BASE "link3/", &st1) == -1);
-  ASSERT (errno == ENOENT);
-
-  errno = 0;
-  ASSERT (func (BASE "link4/", &st1) == -1);
-  ASSERT (errno == ELOOP);
-
-  /* Cleanup.  */
-  ASSERT (unlink (BASE "file") == 0);
-  ASSERT (unlink (BASE "link1") == 0);
-  ASSERT (unlink (BASE "link2") == 0);
-  ASSERT (unlink (BASE "link3") == 0);
-  ASSERT (unlink (BASE "link4") == 0);
-
-  return 0;
-}
diff --git a/gl/tests/test-strerror.c b/gl/tests/test-strerror.c
deleted file mode 100644 (file)
index 8e2ed7c..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Test of strerror() function.
-   Copyright (C) 2007-2014 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Eric Blake <ebb9@byu.net>, 2007.  */
-
-#include <config.h>
-
-#include <string.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (strerror, char *, (int));
-
-#include <errno.h>
-
-#include "macros.h"
-
-int
-main (void)
-{
-  char *str;
-
-  errno = 0;
-  str = strerror (EACCES);
-  ASSERT (str);
-  ASSERT (*str);
-  ASSERT (errno == 0);
-
-  errno = 0;
-  str = strerror (ETIMEDOUT);
-  ASSERT (str);
-  ASSERT (*str);
-  ASSERT (errno == 0);
-
-  errno = 0;
-  str = strerror (EOVERFLOW);
-  ASSERT (str);
-  ASSERT (*str);
-  ASSERT (errno == 0);
-
-  /* POSIX requires strerror (0) to succeed.  Reject use of "Unknown
-     error", but allow "Success", "No error", or even Solaris' "Error
-     0" which are distinct patterns from true out-of-range strings.
-     http://austingroupbugs.net/view.php?id=382  */
-  errno = 0;
-  str = strerror (0);
-  ASSERT (str);
-  ASSERT (*str);
-  ASSERT (errno == 0);
-  ASSERT (strstr (str, "nknown") == NULL);
-  ASSERT (strstr (str, "ndefined") == NULL);
-
-  /* POSIX requires strerror to produce a non-NULL result for all
-     inputs; as an extension, we also guarantee a non-empty result.
-     Reporting EINVAL is optional.  */
-  errno = 0;
-  str = strerror (-3);
-  ASSERT (str);
-  ASSERT (*str);
-  ASSERT (errno == 0 || errno == EINVAL);
-
-  return 0;
-}
diff --git a/gl/tests/test-strerror_r.c b/gl/tests/test-strerror_r.c
deleted file mode 100644 (file)
index 9e1f0be..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-/* Test of strerror_r() function.
-   Copyright (C) 2007-2014 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include <string.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (strerror_r, int, (int, char *, size_t));
-
-#include <errno.h>
-
-#include "macros.h"
-
-int
-main (void)
-{
-  char buf[100];
-  int ret;
-
-  /* Test results with valid errnum and enough room.  */
-
-  errno = 0;
-  buf[0] = '\0';
-  ASSERT (strerror_r (EACCES, buf, sizeof buf) == 0);
-  ASSERT (buf[0] != '\0');
-  ASSERT (errno == 0);
-  ASSERT (strlen (buf) < sizeof buf);
-
-  errno = 0;
-  buf[0] = '\0';
-  ASSERT (strerror_r (ETIMEDOUT, buf, sizeof buf) == 0);
-  ASSERT (buf[0] != '\0');
-  ASSERT (errno == 0);
-  ASSERT (strlen (buf) < sizeof buf);
-
-  errno = 0;
-  buf[0] = '\0';
-  ASSERT (strerror_r (EOVERFLOW, buf, sizeof buf) == 0);
-  ASSERT (buf[0] != '\0');
-  ASSERT (errno == 0);
-  ASSERT (strlen (buf) < sizeof buf);
-
-  /* POSIX requires strerror (0) to succeed.  Reject use of "Unknown
-     error", but allow "Success", "No error", or even Solaris' "Error
-     0" which are distinct patterns from true out-of-range strings.
-     http://austingroupbugs.net/view.php?id=382  */
-  errno = 0;
-  buf[0] = '\0';
-  ret = strerror_r (0, buf, sizeof buf);
-  ASSERT (ret == 0);
-  ASSERT (buf[0]);
-  ASSERT (errno == 0);
-  ASSERT (strstr (buf, "nknown") == NULL);
-  ASSERT (strstr (buf, "ndefined") == NULL);
-
-  /* Test results with out-of-range errnum and enough room.  POSIX
-     allows an empty string on success, and allows an unchanged buf on
-     error, but these are not useful, so we guarantee contents.  */
-  errno = 0;
-  buf[0] = '^';
-  ret = strerror_r (-3, buf, sizeof buf);
-  ASSERT (ret == 0 || ret == EINVAL);
-  ASSERT (buf[0] != '^');
-  ASSERT (*buf);
-  ASSERT (errno == 0);
-  ASSERT (strlen (buf) < sizeof buf);
-
-  /* Test results with a too small buffer.  POSIX requires an error;
-     only ERANGE for 0 and valid errors, and a choice of ERANGE or
-     EINVAL for out-of-range values.  On error, POSIX permits buf to
-     be empty, unchanged, or unterminated, but these are not useful,
-     so we guarantee NUL-terminated truncated contents for all but
-     size 0.  http://austingroupbugs.net/view.php?id=398.  Also ensure
-     that no out-of-bounds writes occur.  */
-  {
-    int errs[] = { EACCES, 0, -3, };
-    int j;
-
-    buf[sizeof buf - 1] = '\0';
-    for (j = 0; j < SIZEOF (errs); j++)
-      {
-        int err = errs[j];
-        char buf2[sizeof buf] = "";
-        size_t len;
-        size_t i;
-
-        strerror_r (err, buf2, sizeof buf2);
-        len = strlen (buf2);
-        ASSERT (len < sizeof buf);
-
-        for (i = 0; i <= len; i++)
-          {
-            memset (buf, '^', sizeof buf - 1);
-            errno = 0;
-            ret = strerror_r (err, buf, i);
-            ASSERT (errno == 0);
-            if (err < 0)
-              ASSERT (ret == ERANGE || ret == EINVAL);
-            else
-              ASSERT (ret == ERANGE);
-            if (i)
-              {
-                ASSERT (strncmp (buf, buf2, i - 1) == 0);
-                ASSERT (buf[i - 1] == '\0');
-              }
-            ASSERT (strspn (buf + i, "^") == sizeof buf - 1 - i);
-          }
-
-        strcpy (buf, "BADFACE");
-        errno = 0;
-        ret = strerror_r (err, buf, len + 1);
-        ASSERT (ret != ERANGE);
-        ASSERT (errno == 0);
-        ASSERT (strcmp (buf, buf2) == 0);
-      }
-  }
-
-#if GNULIB_STRERROR
-  /* Test that strerror_r does not clobber strerror buffer.  On some
-     platforms, this test can only succeed if gnulib also replaces
-     strerror.  */
-  {
-    const char *msg1;
-    const char *msg2;
-    const char *msg3;
-    const char *msg4;
-    char *str1;
-    char *str2;
-    char *str3;
-    char *str4;
-
-    msg1 = strerror (ENOENT);
-    ASSERT (msg1);
-    str1 = strdup (msg1);
-    ASSERT (str1);
-
-    msg2 = strerror (ERANGE);
-    ASSERT (msg2);
-    str2 = strdup (msg2);
-    ASSERT (str2);
-
-    msg3 = strerror (-4);
-    ASSERT (msg3);
-    str3 = strdup (msg3);
-    ASSERT (str3);
-
-    msg4 = strerror (1729576);
-    ASSERT (msg4);
-    str4 = strdup (msg4);
-    ASSERT (str4);
-
-    strerror_r (EACCES, buf, sizeof buf);
-    strerror_r (-5, buf, sizeof buf);
-    ASSERT (msg1 == msg2 || msg1 == msg4 || STREQ (msg1, str1));
-    ASSERT (msg2 == msg4 || STREQ (msg2, str2));
-    ASSERT (msg3 == msg4 || STREQ (msg3, str3));
-    ASSERT (STREQ (msg4, str4));
-
-    free (str1);
-    free (str2);
-    free (str3);
-    free (str4);
-  }
-#endif
-
-  return 0;
-}
diff --git a/gl/tests/test-symlink.c b/gl/tests/test-symlink.c
deleted file mode 100644 (file)
index 78d46c2..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Tests of symlink.
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
-
-#include <config.h>
-
-#include <unistd.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (symlink, int, (char const *, char const *));
-
-#include <fcntl.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-
-#include "ignore-value.h"
-#include "macros.h"
-
-#define BASE "test-symlink.t"
-
-#include "test-symlink.h"
-
-int
-main (void)
-{
-  /* Remove any leftovers from a previous partial run.  */
-  ignore_value (system ("rm -rf " BASE "*"));
-
-  return test_symlink (symlink, true);
-}
diff --git a/gl/tests/test-symlink.h b/gl/tests/test-symlink.h
deleted file mode 100644 (file)
index eb11cf6..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/* Tests of symlink.
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
-
-/* This file is designed to test both symlink(a,b) and
-   symlinkat(a,AT_FDCWD,b).  FUNC is the function to test.  Assumes
-   that BASE and ASSERT are already defined, and that appropriate
-   headers are already included.  If PRINT, warn before skipping
-   symlink tests with status 77.  */
-
-static int
-test_symlink (int (*func) (char const *, char const *), bool print)
-{
-  if (func ("nowhere", BASE "link1"))
-    {
-      if (print)
-        fputs ("skipping test: symlinks not supported on this file system\n",
-               stderr);
-      return 77;
-    }
-
-  /* Some systems allow the creation of 0-length symlinks as a synonym
-     for "."; but most reject it.  */
-  {
-    int status;
-    errno = 0;
-    status = func ("", BASE "link2");
-    if (status == -1)
-      ASSERT (errno == ENOENT || errno == EINVAL);
-    else
-      {
-        ASSERT (status == 0);
-        ASSERT (unlink (BASE "link2") == 0);
-      }
-  }
-
-  /* Sanity checks of failures.  */
-  errno = 0;
-  ASSERT (func ("nowhere", "") == -1);
-  ASSERT (errno == ENOENT);
-  errno = 0;
-  ASSERT (func ("nowhere", ".") == -1);
-  ASSERT (errno == EEXIST || errno == EINVAL);
-  errno = 0;
-  ASSERT (func ("somewhere", BASE "link1") == -1);
-  ASSERT (errno == EEXIST);
-  errno = 0;
-  ASSERT (func ("nowhere", BASE "link2/") == -1);
-  ASSERT (errno == ENOTDIR || errno == ENOENT);
-  ASSERT (mkdir (BASE "dir", 0700) == 0);
-  errno = 0;
-  ASSERT (func ("nowhere", BASE "dir") == -1);
-  ASSERT (errno == EEXIST);
-  errno = 0;
-  ASSERT (func ("nowhere", BASE "dir/") == -1);
-  ASSERT (errno == EEXIST || errno == EINVAL);
-  ASSERT (close (creat (BASE "file", 0600)) == 0);
-  errno = 0;
-  ASSERT (func ("nowhere", BASE "file") == -1);
-  ASSERT (errno == EEXIST);
-  errno = 0;
-  ASSERT (func ("nowhere", BASE "file/") == -1);
-  ASSERT (errno == EEXIST || errno == ENOTDIR || errno == ENOENT);
-
-  /* Trailing slash must always be rejected.  */
-  ASSERT (unlink (BASE "link1") == 0);
-  ASSERT (func (BASE "link2", BASE "link1") == 0);
-  errno = 0;
-  ASSERT (func (BASE "nowhere", BASE "link1/") == -1);
-  ASSERT (errno == EEXIST || errno == ENOTDIR || errno == ENOENT);
-  errno = 0;
-  ASSERT (unlink (BASE "link2") == -1);
-  ASSERT (errno == ENOENT);
-
-  /* Cleanup.  */
-  ASSERT (rmdir (BASE "dir") == 0);
-  ASSERT (unlink (BASE "file") == 0);
-  ASSERT (unlink (BASE "link1") == 0);
-
-  return 0;
-}
diff --git a/gl/tests/test-sys_ioctl.c b/gl/tests/test-sys_ioctl.c
deleted file mode 100644 (file)
index bd2a5af..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Test of <sys/ioctl.h> substitute.
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
-
-#include <config.h>
-
-#include <sys/ioctl.h>
-
-int
-main (void)
-{
-  return 0;
-}
diff --git a/gl/tests/test-sys_select.c b/gl/tests/test-sys_select.c
deleted file mode 100644 (file)
index 2e4f7c1..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Test of <sys/select.h> substitute.
-   Copyright (C) 2007-2014 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
-
-#include <config.h>
-
-#include <sys/select.h>
-
-#include "signature.h"
-
-/* The following may be macros without underlying functions, so only
-   check signature if they are not macros.  */
-#ifndef FD_CLR
-SIGNATURE_CHECK (FD_CLR, void, (int, fd_set *));
-#endif
-#ifndef FD_ISSET
-SIGNATURE_CHECK (FD_ISSET, void, (int, fd_set *));
-#endif
-#ifndef FD_SET
-SIGNATURE_CHECK (FD_SET, int, (int, fd_set *));
-#endif
-#ifndef FD_ZERO
-SIGNATURE_CHECK (FD_ZERO, void, (fd_set *));
-#endif
-
-/* Check that the 'struct timeval' type is defined.  */
-struct timeval a;
-
-/* Check that a.tv_sec is wide enough to hold a time_t, ignoring
-   signedness issues.  */
-typedef int verify_tv_sec_type[sizeof (time_t) <= sizeof (a.tv_sec) ? 1 : -1];
-
-/* Check that sigset_t is defined.  */
-sigset_t t2;
-
-int
-main (void)
-{
-  /* Check that FD_ZERO can be used.  This should not yield a warning
-     such as "warning: implicit declaration of function 'memset'".  */
-  fd_set fds;
-  FD_ZERO (&fds);
-
-  return 0;
-}