]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Update gnulib files.
authorSimon Josefsson <simon@josefsson.org>
Thu, 6 Aug 2009 14:30:15 +0000 (16:30 +0200)
committerSimon Josefsson <simon@josefsson.org>
Thu, 6 Aug 2009 14:30:15 +0000 (16:30 +0200)
40 files changed:
build-aux/vc-list-files
gl/Makefile.am
gl/error.c
gl/fseeko.c
gl/m4/gnulib-comp.m4
gl/m4/lib-link.m4
gl/m4/stdio_h.m4
gl/m4/unistd_h.m4
gl/socket.c
gl/sockets.c
gl/stdio.in.h
gl/tests/Makefile.am
gl/tests/test-select.c
gl/tests/test-stdio.c
gl/tests/test-stdlib.c
gl/tests/test-string.c
gl/tests/test-unistd.c
gl/tests/test-version-etc.c [new file with mode: 0644]
gl/tests/test-version-etc.sh [new file with mode: 0755]
gl/unistd.in.h
gl/version-etc.c
gl/version-etc.h
lib/gl/Makefile.am
lib/gl/fseeko.c
lib/gl/m4/iconv.m4
lib/gl/m4/lib-link.m4
lib/gl/m4/stdio_h.m4
lib/gl/m4/time_h.m4
lib/gl/m4/unistd_h.m4
lib/gl/sockets.c
lib/gl/stdio.in.h
lib/gl/tests/test-stdio.c
lib/gl/tests/test-stdlib.c
lib/gl/tests/test-string.c
lib/gl/tests/test-unistd.c
lib/gl/time.in.h
lib/gl/unistd.in.h
libextra/gl/m4/lib-link.m4
libextra/gl/md5.h
maint.mk

index 9376e3dc2f1dce96e7b22d8e3ac4f799c8a72baa..cc716e9c3500809a6143a8b18b316a15880938a8 100755 (executable)
@@ -2,7 +2,7 @@
 # List version-controlled file names.
 
 # Print a version string.
-scriptversion=2009-04-25.13; # UTC
+scriptversion=2009-07-21.16; # UTC
 
 # Copyright (C) 2006-2009 Free Software Foundation, Inc.
 
@@ -74,7 +74,7 @@ test "x$dir" = x && dir=.
 if test -d .git; then
   test "x$dir" = x. \
     && dir= sed_esc= \
-    || dir="$dir/" sed_esc=`echo "$dir"|sed 's,\([\\/]\),\\\\\1,g'`
+    || { dir="$dir/"; sed_esc=`echo "$dir"|env sed 's,\([\\/]\),\\\\\1,g'`; }
   # Ignore git symlinks - either they point into the tree, in which case
   # we don't need to visit the target twice, or they point somewhere
   # else (often into a submodule), in which case the content does not
index b40d7bad8df6ed0255a3f4202daca0807c0331dc..28f1560f39fb0247211173ce3192111aea3a73b9 100644 (file)
@@ -677,6 +677,7 @@ stdio.h: stdio.in.h
              -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \
              -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \
              -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \
+             -e 's|@''GNULIB_FPURGE''@|$(GNULIB_FPURGE)|g' \
              -e 's|@''GNULIB_FCLOSE''@|$(GNULIB_FCLOSE)|g' \
              -e 's|@''GNULIB_FPUTC''@|$(GNULIB_FPUTC)|g' \
              -e 's|@''GNULIB_PUTC''@|$(GNULIB_PUTC)|g' \
@@ -714,6 +715,8 @@ stdio.h: stdio.in.h
              -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
              -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \
              -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
+             -e 's|@''REPLACE_FPURGE''@|$(REPLACE_FPURGE)|g' \
+             -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \
              -e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \
              -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \
              -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
@@ -1058,6 +1061,7 @@ unistd.h: unistd.in.h
              -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
              -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
              -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \
+             -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \
              -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
              -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
              -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
index 3177bd5d2cbc3802e3590e40732ca6c376762a31..af2287b2713eaf792093e27adf7d7beeac99ac30 100644 (file)
@@ -1,5 +1,5 @@
 /* Error handler for noninteractive utilities
-   Copyright (C) 1990-1998, 2000-2007 Free Software Foundation, Inc.
+   Copyright (C) 1990-1998, 2000-2007, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software: you can redistribute it and/or modify
@@ -85,6 +85,8 @@ extern void __error_at_line (int status, int errnum, const char *file_name,
 
 #else /* not _LIBC */
 
+# include <fcntl.h>
+
 # if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P
 #  ifndef HAVE_DECL_STRERROR_R
 "this configure-time declaration test was not run"
@@ -236,6 +238,12 @@ error (int status, int errnum, const char *message, ...)
                   0);
 #endif
 
+#if !_LIBC && defined F_GETFL
+  /* POSIX states that fflush (stdout) after fclose is unspecified; it
+     is safe in glibc, but not on all other platforms.  fflush (NULL)
+     is always defined, but too draconian.  */
+  if (0 <= fcntl (1, F_GETFL))
+#endif
   fflush (stdout);
 #ifdef _LIBC
   _IO_flockfile (stderr);
@@ -295,6 +303,12 @@ error_at_line (int status, int errnum, const char *file_name,
                   0);
 #endif
 
+#if !_LIBC && defined F_GETFL
+  /* POSIX states that fflush (stdout) after fclose is unspecified; it
+     is safe in glibc, but not on all other platforms.  fflush (NULL)
+     is always defined, but too draconian.  */
+  if (0 <= fcntl (1, F_GETFL))
+#endif
   fflush (stdout);
 #ifdef _LIBC
   _IO_flockfile (stderr);
index cf7c42fbfd6611ed4b8cef2256f3ca879c36eef3..a7ac9fc4dc0f5397a0477549762e90726e9ffa4c 100644 (file)
@@ -79,7 +79,7 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
       && ((fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) == 0
          || fp->__bufpos == fp->__bufread))
 #elif defined __QNX__               /* QNX */
-  if ((fp->_Mode & _MWRITE ? fp->_Next == fp->_Buf : fp->_Next == fp->_Rend)
+  if ((fp->_Mode & 0x2000 /* _MWRITE */ ? fp->_Next == fp->_Buf : fp->_Next == fp->_Rend)
       && fp->_Rback == fp->_Back + sizeof (fp->_Back)
       && fp->_Rsave == NULL)
 #elif defined __MINT__              /* Atari FreeMiNT */
index 56d0e4a036a00cfaec8e5643d6eef01882258e8b..cf3336d3ccdf9bb86b7662a2dbcdbb213e2af92a 100644 (file)
@@ -538,6 +538,8 @@ AC_DEFUN([gl_FILE_LIST], [
   tests/test-vasnprintf.c
   tests/test-vc-list-files-cvs.sh
   tests/test-vc-list-files-git.sh
+  tests/test-version-etc.c
+  tests/test-version-etc.sh
   tests/test-wchar.c
   tests/zerosize-ptr.h
   tests=lib/dummy.c
index 21442033c87bd65912d4337d2f3fe686da708e01..2f8b7ff38f59356b30df8a0d627ea0a809e1bdf0 100644 (file)
@@ -1,4 +1,4 @@
-# lib-link.m4 serial 19 (gettext-0.18)
+# lib-link.m4 serial 20 (gettext-0.18)
 dnl Copyright (C) 2001-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -82,7 +82,7 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
   ])
   if test "$ac_cv_lib[]Name" = yes; then
     HAVE_LIB[]NAME=yes
-    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib[]$1 library.])
+    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
     AC_MSG_CHECKING([how to link with lib[]$1])
     AC_MSG_RESULT([$LIB[]NAME])
   else
@@ -210,6 +210,9 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
   LTLIB[]NAME=
   INC[]NAME=
   LIB[]NAME[]_PREFIX=
+  dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
+  dnl computed. So it has to be reset here.
+  HAVE_LIB[]NAME=
   rpathdirs=
   ltrpathdirs=
   names_already_handled=
index 846b65d302cbe5197c136ab96f019c88f6392d00..fcbe68f6ba6af3ce982fb68c7e5ab66ae0703228 100644 (file)
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 15
+# stdio_h.m4 serial 16
 dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -65,6 +65,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   GNULIB_FTELL=0;                AC_SUBST([GNULIB_FTELL])
   GNULIB_FTELLO=0;               AC_SUBST([GNULIB_FTELLO])
   GNULIB_FFLUSH=0;               AC_SUBST([GNULIB_FFLUSH])
+  GNULIB_FPURGE=0;               AC_SUBST([GNULIB_FPURGE])
   GNULIB_FCLOSE=0;               AC_SUBST([GNULIB_FCLOSE])
   GNULIB_FPUTC=0;                AC_SUBST([GNULIB_FPUTC])
   GNULIB_PUTC=0;                 AC_SUBST([GNULIB_PUTC])
@@ -105,6 +106,8 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   REPLACE_FTELLO=0;              AC_SUBST([REPLACE_FTELLO])
   REPLACE_FTELL=0;               AC_SUBST([REPLACE_FTELL])
   REPLACE_FFLUSH=0;              AC_SUBST([REPLACE_FFLUSH])
+  REPLACE_FPURGE=0;              AC_SUBST([REPLACE_FPURGE])
+  HAVE_DECL_FPURGE=1;            AC_SUBST([HAVE_DECL_FPURGE])
   REPLACE_FCLOSE=0;              AC_SUBST([REPLACE_FCLOSE])
   HAVE_DECL_GETDELIM=1;          AC_SUBST([HAVE_DECL_GETDELIM])
   HAVE_DECL_GETLINE=1;           AC_SUBST([HAVE_DECL_GETLINE])
index ff9a4ea0a59f3c43d7c06bbc973fa5918c7bf11c..96fddba7feeac507695317b4e145f50f4ee2f588 100644 (file)
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 17
+# unistd_h.m4 serial 18
 dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -73,6 +73,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_SYS_PARAM_H=0;     AC_SUBST([HAVE_SYS_PARAM_H])
   REPLACE_CHOWN=0;        AC_SUBST([REPLACE_CHOWN])
   REPLACE_CLOSE=0;        AC_SUBST([REPLACE_CLOSE])
+  REPLACE_DUP2=0;         AC_SUBST([REPLACE_DUP2])
   REPLACE_FCHDIR=0;       AC_SUBST([REPLACE_FCHDIR])
   REPLACE_GETCWD=0;       AC_SUBST([REPLACE_GETCWD])
   REPLACE_GETPAGESIZE=0;  AC_SUBST([REPLACE_GETPAGESIZE])
index 1fa6928747c2e71eb074bca14fc207e46805ec2a..8ce4bae8db6a5aee728b1689b29ebe032e7d2669 100644 (file)
@@ -1,6 +1,6 @@
 /* socket.c --- wrappers for Windows socket function
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008-2009 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
 /* 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.  */
-  SOCKET fh = WSASocket (domain, type, protocol, NULL, 0, 0);
+  fh = WSASocket (domain, type, protocol, NULL, 0, 0);
 
   if (fh == INVALID_SOCKET)
     {
index 9d5c54792888eca80025f9123d2c1db7fa4fa52b..7cb9981d120a8503f9e6dfefe53e7d6c6c091153 100644 (file)
@@ -69,23 +69,31 @@ close_fd_maybe_socket (int fd, const struct close_hook *remaining_list)
 
 static struct close_hook close_sockets_hook;
 
+static int initialized_sockets_version /* = 0 */;
+
 #endif
 
 int
 gl_sockets_startup (int version)
 {
 #if WINDOWS_SOCKETS
-  WSADATA data;
-  int err;
+  if (version > initialized_sockets_version)
+    {
+      WSADATA data;
+      int err;
 
-  err = WSAStartup (version, &data);
-  if (err != 0)
-    return 1;
+      err = WSAStartup (version, &data);
+      if (err != 0)
+       return 1;
+
+      if (data.wVersion < version)
+       return 2;
 
-  if (data.wVersion < version)
-    return 2;
+      if (initialized_sockets_version == 0)
+       register_close_hook (close_fd_maybe_socket, &close_sockets_hook);
 
-  register_close_hook (close_fd_maybe_socket, &close_sockets_hook);
+      initialized_sockets_version = version;
+    }
 #endif
 
   return 0;
@@ -97,6 +105,8 @@ gl_sockets_cleanup (void)
 #if WINDOWS_SOCKETS
   int err;
 
+  initialized_sockets_version = 0;
+
   unregister_close_hook (&close_sockets_hook);
 
   err = WSACleanup ();
index cb273d76421db32e3e17c1bda0bcfa45494da496..0445c6f10735579b038c75494f6d5853a063d03a 100644 (file)
@@ -1,6 +1,6 @@
 /* A GNU-like <stdio.h>.
 
-   Copyright (C) 2004, 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2007-2009 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -407,6 +407,24 @@ extern long rpl_ftell (FILE *fp);
     fflush (f))
 #endif
 
+#if @GNULIB_FPURGE@
+# if @REPLACE_FPURGE@
+#  define fpurge rpl_fpurge
+# endif
+# if @REPLACE_FPURGE@ || !@HAVE_DECL_FPURGE@
+  /* Discard all pending buffered I/O data on STREAM.
+     STREAM must not be wide-character oriented.
+     Return 0 if successful.  Upon error, return -1 and set errno.  */
+  extern int fpurge (FILE *gl_stream);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fpurge
+# define fpurge(f) \
+   (GL_LINK_WARNING ("fpurge is not always present - " \
+                     "use gnulib module fpurge for portability"), \
+    fpurge (f))
+#endif
+
 #if @GNULIB_FCLOSE@
 # if @REPLACE_FCLOSE@
 #  define fclose rpl_fclose
index ecb33b656ee759c6a6e6699bba67557bcd479142..0b753ae9494b0fa2be3f2b6c99d70ebd03b2dfde 100644 (file)
@@ -384,6 +384,16 @@ libtests_a_SOURCES += verify.h
 
 ## end   gnulib module verify
 
+## begin gnulib module version-etc-tests
+
+TESTS += test-version-etc.sh
+TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
+check_PROGRAMS += test-version-etc
+test_version_etc_LDADD = $(LDADD) @LIBINTL@
+EXTRA_DIST += test-version-etc.c test-version-etc.sh
+
+## end   gnulib module version-etc-tests
+
 ## begin gnulib module wchar-tests
 
 TESTS += test-wchar
index 4c9cdc02dc1af7435babcd49a8f55a9f24c92644..ec822501494036cbb4aa8712b81b3a7c6c8131f7 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of select() substitute.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008-2009 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
@@ -29,7 +29,6 @@
 #include <stdbool.h>
 #include <sys/ioctl.h>
 #include <errno.h>
-#include "sockets.h"
 
 enum { SEL_IN = 1, SEL_OUT = 2, SEL_EXC = 4 };
 
@@ -360,8 +359,6 @@ main ()
 {
   int result;
 
-  gl_sockets_startup (SOCKETS_1_1);
-
 #ifdef INTERACTIVE
   printf ("Please press Enter\n");
   test (test_tty, "TTY");
index a5efa320ba2d3391cc00e84d45597522e5449437..dcfe38dd515cf365fc8c55fbf19ed17177fa23d5 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <stdio.h> substitute.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
 #include <stdio.h>
 
+#include "verify.h"
+
 /* Check that the various SEEK_* macros are defined.  */
 int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
 
+/* Check that NULL can be passed through varargs as a pointer type,
+   per POSIX 2008.  */
+verify (sizeof NULL == sizeof (void *));
+
 int
 main ()
 {
index e103d46b2036b753de4cb03a4af6075137721238..ae46ba16625479aeb9022489162bee441a57433b 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <stdlib.h> substitute.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
 #include <stdlib.h>
 
+#include "verify.h"
+
 int exitcode;
 
+/* Check that NULL can be passed through varargs as a pointer type,
+   per POSIX 2008.  */
+verify (sizeof NULL == sizeof (void *));
+
 int
 main ()
 {
index 68014f54c8e431a7b99e8973df182121e026849a..fe53cd9b152a584e9559ff43b55a38106416dcad 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <string.h> substitute.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
 #include <string.h>
 
+#include "verify.h"
+
+/* Check that NULL can be passed through varargs as a pointer type,
+   per POSIX 2008.  */
+verify (sizeof NULL == sizeof (void *));
+
 int
 main ()
 {
index 5fed15cf9fd8fdcc50b4ad7bb63ceef4d9b94cac..129367b4d7df989e1f31d1035e9ddc444d8a3169 100644 (file)
 
 #include <unistd.h>
 
+#include "verify.h"
+
+/* Check that NULL can be passed through varargs as a pointer type,
+   per POSIX 2008.  */
+verify (sizeof NULL == sizeof (void *));
+
 /* Check that the various SEEK_* macros are defined.  */
 int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
 
diff --git a/gl/tests/test-version-etc.c b/gl/tests/test-version-etc.c
new file mode 100644 (file)
index 0000000..71cbc8b
--- /dev/null
@@ -0,0 +1,33 @@
+/* Test suite for version-etc.
+   Copyright (C) 2009 Free Software Foundation, Inc.
+   This file is part of the GNUlib Library.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "version-etc.h"
+
+#include "progname.h"
+
+#define AUTHORS "Sergey Poznyakoff", "Eric Blake"
+
+int
+main (int argc, char **argv)
+{
+  set_program_name (argv[0]);
+  version_etc (stdout, "test-version-etc", "dummy", "0", AUTHORS,
+               (const char *) NULL);
+  return 0;
+}
diff --git a/gl/tests/test-version-etc.sh b/gl/tests/test-version-etc.sh
new file mode 100755 (executable)
index 0000000..3b2fc4d
--- /dev/null
@@ -0,0 +1,40 @@
+#! /bin/sh
+# Test suite for version-etc.
+# Copyright (C) 2009 Free Software Foundation, Inc.
+# This file is part of the GNUlib Library.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+TMP=ve-expected.tmp
+LC_ALL=C
+export LC_ALL
+ERR=0
+
+cat > $TMP <<EOT
+test-version-etc (dummy) 0
+COPYRIGHT Free Software Foundation, Inc.
+License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+
+Written by Sergey Poznyakoff and Eric Blake.
+EOT
+
+./test-version-etc --version |
+ sed '2s/Copyright (C) [0-9]\{4,4\}/COPYRIGHT/' |
+ diff -c $TMP - || ERR=1
+
+rm $TMP
+
+exit $ERR
index fa8d84a3d9c1d2569e10175500489c55e0cc8f9c..09e90392dfaab631141d45f832626aa24a82ed78 100644 (file)
@@ -150,10 +150,13 @@ extern int close (int);
 
 
 #if @GNULIB_DUP2@
-# if !@HAVE_DUP2@
+# if @REPLACE_DUP2@
+#  define dup2 rpl_dup2
+# endif
+# if !@HAVE_DUP2@ || @REPLACE_DUP2@
 /* Copy the file descriptor OLDFD into file descriptor NEWFD.  Do nothing if
    NEWFD = OLDFD, otherwise close NEWFD first if it is open.
-   Return 0 if successful, otherwise -1 and errno set.
+   Return newfd if successful, otherwise -1 and errno set.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/dup2.html>.  */
 extern int dup2 (int oldfd, int newfd);
@@ -214,7 +217,11 @@ extern int fchdir (int /*fd*/);
 
 #  define dup rpl_dup
 extern int dup (int);
-#  define dup2 rpl_dup2
+
+#  if @REPLACE_DUP2@
+#   undef dup2
+#  endif
+#  define dup2 rpl_dup2_fchdir
 extern int dup2 (int, int);
 
 # endif
index c3b028926b8cd76130016bc8e217f509926e8c71..a580140c4597410706c5f6ed78bdb0ef4695c73f 100644 (file)
 
 enum { COPYRIGHT_YEAR = 2009 };
 
-/* Like version_etc, below, but with the NULL-terminated author list
-   provided via a variable of type va_list.  */
-void
-version_etc_va (FILE *stream,
-               const char *command_name, const char *package,
-               const char *version, va_list authors)
-{
-  size_t n_authors;
+/* The three functions below display the --version information the
+   standard way.
+
+   If COMMAND_NAME is NULL, the PACKAGE is assumed to be the name of
+   the program.  The formats are therefore:
+
+   PACKAGE VERSION
 
-  /* Count the number of authors.  */
-  {
-    va_list tmp_authors;
+   or
 
-    va_copy (tmp_authors, authors);
+   COMMAND_NAME (PACKAGE) VERSION.
 
-    n_authors = 0;
-    while (va_arg (tmp_authors, const char *) != NULL)
-      ++n_authors;
-  }
+   The functions differ in the way they are passed author names. */
+
+/* Display the --version information the standard way.
 
+   Author names are given in the array AUTHORS. N_AUTHORS is the
+   number of elements in the array. */
+void
+version_etc_arn (FILE *stream,
+                const char *command_name, const char *package,
+                const char *version,
+                const char * const * authors, size_t n_authors)
+{
   if (command_name)
     fprintf (stream, "%s (%s) %s\n", command_name, package, version);
   else
@@ -89,57 +93,64 @@ There is NO WARRANTY, to the extent permitted by law.\n\
       abort ();
     case 1:
       /* TRANSLATORS: %s denotes an author name.  */
-      vfprintf (stream, _("Written by %s.\n"), authors);
+      fprintf (stream, _("Written by %s.\n"), authors[0]);
       break;
     case 2:
       /* TRANSLATORS: Each %s denotes an author name.  */
-      vfprintf (stream, _("Written by %s and %s.\n"), authors);
+      fprintf (stream, _("Written by %s and %s.\n"), authors[0], authors[1]);
       break;
     case 3:
       /* TRANSLATORS: Each %s denotes an author name.  */
-      vfprintf (stream, _("Written by %s, %s, and %s.\n"), authors);
+      fprintf (stream, _("Written by %s, %s, and %s.\n"),
+              authors[0], authors[1], authors[2]);
       break;
     case 4:
       /* TRANSLATORS: Each %s denotes an author name.
         You can use line breaks, estimating that each author name occupies
         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
-      vfprintf (stream, _("Written by %s, %s, %s,\nand %s.\n"), authors);
+      fprintf (stream, _("Written by %s, %s, %s,\nand %s.\n"),
+              authors[0], authors[1], authors[2], authors[3]);
       break;
     case 5:
       /* TRANSLATORS: Each %s denotes an author name.
         You can use line breaks, estimating that each author name occupies
         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
-      vfprintf (stream, _("Written by %s, %s, %s,\n%s, and %s.\n"), authors);
+      fprintf (stream, _("Written by %s, %s, %s,\n%s, and %s.\n"),
+              authors[0], authors[1], authors[2], authors[3], authors[4]);
       break;
     case 6:
       /* TRANSLATORS: Each %s denotes an author name.
         You can use line breaks, estimating that each author name occupies
         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
-      vfprintf (stream, _("Written by %s, %s, %s,\n%s, %s, and %s.\n"),
-               authors);
+      fprintf (stream, _("Written by %s, %s, %s,\n%s, %s, and %s.\n"),
+              authors[0], authors[1], authors[2], authors[3], authors[4],
+              authors[5]);
       break;
     case 7:
       /* TRANSLATORS: Each %s denotes an author name.
         You can use line breaks, estimating that each author name occupies
         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
-      vfprintf (stream, _("Written by %s, %s, %s,\n%s, %s, %s, and %s.\n"),
-               authors);
+      fprintf (stream, _("Written by %s, %s, %s,\n%s, %s, %s, and %s.\n"),
+              authors[0], authors[1], authors[2], authors[3], authors[4],
+              authors[5], authors[6]);
       break;
     case 8:
       /* TRANSLATORS: Each %s denotes an author name.
         You can use line breaks, estimating that each author name occupies
         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
-      vfprintf (stream, _("\
+      fprintf (stream, _("\
 Written by %s, %s, %s,\n%s, %s, %s, %s,\nand %s.\n"),
-               authors);
+               authors[0], authors[1], authors[2], authors[3], authors[4],
+               authors[5], authors[6], authors[7]);
       break;
     case 9:
       /* TRANSLATORS: Each %s denotes an author name.
         You can use line breaks, estimating that each author name occupies
         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
-      vfprintf (stream, _("\
+      fprintf (stream, _("\
 Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, and %s.\n"),
-               authors);
+              authors[0], authors[1], authors[2], authors[3], authors[4],
+              authors[5], authors[6], authors[7], authors[8]);
       break;
     default:
       /* 10 or more authors.  Use an abbreviation, since the human reader
@@ -147,18 +158,55 @@ Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, and %s.\n"),
       /* TRANSLATORS: Each %s denotes an author name.
         You can use line breaks, estimating that each author name occupies
         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
-      vfprintf (stream, _("\
+      fprintf (stream, _("\
 Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, %s, and others.\n"),
-               authors);
+               authors[0], authors[1], authors[2], authors[3], authors[4],
+               authors[5], authors[6], authors[7], authors[8]);
       break;
     }
-  va_end (authors);
+}
+
+/* Display the --version information the standard way.  See the initial
+   comment to this module, for more information.
+
+   Author names are given in the NULL-terminated array AUTHORS. */
+void
+version_etc_ar (FILE *stream,
+               const char *command_name, const char *package,
+               const char *version, const char * const * authors)
+{
+  size_t n_authors;
+
+  for (n_authors = 0; authors[n_authors]; n_authors++)
+    ;
+  version_etc_arn (stream, command_name, package, version, authors, n_authors);
+}
+
+/* Display the --version information the standard way.  See the initial
+   comment to this module, for more information.
+
+   Author names are given in the NULL-terminated va_list AUTHORS. */
+void
+version_etc_va (FILE *stream,
+               const char *command_name, const char *package,
+               const char *version, va_list authors)
+{
+  size_t n_authors;
+  const char *authtab[10];
+
+  for (n_authors = 0;
+       n_authors < 10
+        && (authtab[n_authors] = va_arg (authors, const char *)) != NULL;
+       n_authors++)
+    ;
+  version_etc_arn (stream, command_name, package, version,
+                  authtab, n_authors);
 }
 
 
 /* Display the --version information the standard way.
 
-   If COMMAND_NAME is NULL, the PACKAGE is asumed to be the name of
+   If COMMAND_NAME is NULL, the PACKAGE is assumed to be the name of
    the program.  The formats are therefore:
 
    PACKAGE VERSION
@@ -167,7 +215,7 @@ Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, %s, and others.\n"),
 
    COMMAND_NAME (PACKAGE) VERSION.
 
-   The author names are passed as separate arguments, with an additional
+   The authors names are passed as separate arguments, with an additional
    NULL argument at the end.  */
 void
 version_etc (FILE *stream,
@@ -178,6 +226,7 @@ version_etc (FILE *stream,
 
   va_start (authors, version);
   version_etc_va (stream, command_name, package, version, authors);
+  va_end (authors);
 }
 
 void
@@ -195,5 +244,5 @@ emit_bug_reporting_address (void)
   printf (_("%s home page: <http://www.gnu.org/software/%s/>.\n"),
          PACKAGE_NAME, PACKAGE);
   fputs (_("General help using GNU software: <http://www.gnu.org/gethelp/>.\n"),
-         stdout);
+        stdout);
 }
index 33a8e7f14352b4eabc54d66a407458c4c0806b58..8ce02fecb89fe1fa6f1db0e3deadd43986084252 100644 (file)
 # include <stdarg.h>
 # include <stdio.h>
 
+/* The `sentinel' attribute was added in gcc 4.0.  */
+#ifndef ATTRIBUTE_SENTINEL
+# if 4 <= __GNUC__
+#  define ATTRIBUTE_SENTINEL __attribute__ ((__sentinel__))
+# else
+#  define ATTRIBUTE_SENTINEL /* empty */
+# endif
+#endif
+
 extern const char version_etc_copyright[];
 
+/* The three functions below display the --version information in the
+   standard way: command and package names, package version, followed
+   by a short GPLv3+ notice and a list of up to 10 author names.
+
+   If COMMAND_NAME is NULL, the PACKAGE is asumed to be the name of
+   the program.  The formats are therefore:
+
+   PACKAGE VERSION
+
+   or
+
+   COMMAND_NAME (PACKAGE) VERSION.
+
+   The functions differ in the way they are passed author names: */
+
+/* N_AUTHORS names are supplied in array AUTHORS.  */
+extern void version_etc_arn (FILE *stream,
+                            const char *command_name, const char *package,
+                            const char *version,
+                            const char * const * authors, size_t n_authors);
+
+/* Names are passed in the NULL-terminated array AUTHORS.  */
+extern void version_etc_ar (FILE *stream,
+                           const char *command_name, const char *package,
+                           const char *version, const char * const * authors);
+
+/* Names are passed in the NULL-terminated va_list.  */
 extern void version_etc_va (FILE *stream,
                            const char *command_name, const char *package,
                            const char *version, va_list authors);
 
+/* Names are passed as separate arguments, with an additional
+   NULL argument at the end.  */
 extern void version_etc (FILE *stream,
                         const char *command_name, const char *package,
                         const char *version,
-                        /* const char *author1, ...*/ ...);
+                        /* const char *author1, ..., NULL */ ...)
+  ATTRIBUTE_SENTINEL;
 
+/* Display the usual `Report bugs to' stanza */
 extern void emit_bug_reporting_address (void);
 
 #endif /* VERSION_ETC_H */
index 355f03686637a9f1f8a78c990d25bdb1aec83d2e..2a43c61f0826b20cb3237058339d9a62067f87f0 100644 (file)
@@ -404,6 +404,7 @@ stdio.h: stdio.in.h
              -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \
              -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \
              -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \
+             -e 's|@''GNULIB_FPURGE''@|$(GNULIB_FPURGE)|g' \
              -e 's|@''GNULIB_FCLOSE''@|$(GNULIB_FCLOSE)|g' \
              -e 's|@''GNULIB_FPUTC''@|$(GNULIB_FPUTC)|g' \
              -e 's|@''GNULIB_PUTC''@|$(GNULIB_PUTC)|g' \
@@ -441,6 +442,8 @@ stdio.h: stdio.in.h
              -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
              -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \
              -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
+             -e 's|@''REPLACE_FPURGE''@|$(REPLACE_FPURGE)|g' \
+             -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \
              -e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \
              -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \
              -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
@@ -725,6 +728,7 @@ time.h: time.in.h
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \
              -e 's|@REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \
+             -e 's|@REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \
              -e 's|@REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
              -e 's|@REPLACE_STRPTIME''@|$(REPLACE_STRPTIME)|g' \
              -e 's|@REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \
@@ -801,6 +805,7 @@ unistd.h: unistd.in.h
              -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
              -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
              -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \
+             -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \
              -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
              -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
              -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
index b2ed87c420e2a6302bca560b0f302d3534b599f1..f9550a16957c3b66cca0440f0b0cac7926ddde2c 100644 (file)
@@ -79,7 +79,7 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
       && ((fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) == 0
          || fp->__bufpos == fp->__bufread))
 #elif defined __QNX__               /* QNX */
-  if ((fp->_Mode & _MWRITE ? fp->_Next == fp->_Buf : fp->_Next == fp->_Rend)
+  if ((fp->_Mode & 0x2000 /* _MWRITE */ ? fp->_Next == fp->_Buf : fp->_Next == fp->_Rend)
       && fp->_Rback == fp->_Back + sizeof (fp->_Back)
       && fp->_Rsave == NULL)
 #elif defined __MINT__              /* Atari FreeMiNT */
index 3cc626829edffdf2c02bc5ad7517b7eb225c746a..ce21b0b878629fa1d9477d2acf7809db408c32bf 100644 (file)
@@ -1,4 +1,4 @@
-# iconv.m4 serial AM7 (gettext-0.18)
+# iconv.m4 serial AM8 (gettext-0.18)
 dnl Copyright (C) 2000-2002, 2007-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -172,8 +172,8 @@ size_t iconv();
 ], [], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"])
       am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
-    AC_MSG_RESULT([${ac_t:-
-         }$am_cv_proto_iconv])
+    AC_MSG_RESULT([
+         $am_cv_proto_iconv])
     AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
       [Define as const if the declaration of iconv() needs const.])
   fi
index 21442033c87bd65912d4337d2f3fe686da708e01..2f8b7ff38f59356b30df8a0d627ea0a809e1bdf0 100644 (file)
@@ -1,4 +1,4 @@
-# lib-link.m4 serial 19 (gettext-0.18)
+# lib-link.m4 serial 20 (gettext-0.18)
 dnl Copyright (C) 2001-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -82,7 +82,7 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
   ])
   if test "$ac_cv_lib[]Name" = yes; then
     HAVE_LIB[]NAME=yes
-    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib[]$1 library.])
+    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
     AC_MSG_CHECKING([how to link with lib[]$1])
     AC_MSG_RESULT([$LIB[]NAME])
   else
@@ -210,6 +210,9 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
   LTLIB[]NAME=
   INC[]NAME=
   LIB[]NAME[]_PREFIX=
+  dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
+  dnl computed. So it has to be reset here.
+  HAVE_LIB[]NAME=
   rpathdirs=
   ltrpathdirs=
   names_already_handled=
index 846b65d302cbe5197c136ab96f019c88f6392d00..fcbe68f6ba6af3ce982fb68c7e5ab66ae0703228 100644 (file)
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 15
+# stdio_h.m4 serial 16
 dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -65,6 +65,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   GNULIB_FTELL=0;                AC_SUBST([GNULIB_FTELL])
   GNULIB_FTELLO=0;               AC_SUBST([GNULIB_FTELLO])
   GNULIB_FFLUSH=0;               AC_SUBST([GNULIB_FFLUSH])
+  GNULIB_FPURGE=0;               AC_SUBST([GNULIB_FPURGE])
   GNULIB_FCLOSE=0;               AC_SUBST([GNULIB_FCLOSE])
   GNULIB_FPUTC=0;                AC_SUBST([GNULIB_FPUTC])
   GNULIB_PUTC=0;                 AC_SUBST([GNULIB_PUTC])
@@ -105,6 +106,8 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   REPLACE_FTELLO=0;              AC_SUBST([REPLACE_FTELLO])
   REPLACE_FTELL=0;               AC_SUBST([REPLACE_FTELL])
   REPLACE_FFLUSH=0;              AC_SUBST([REPLACE_FFLUSH])
+  REPLACE_FPURGE=0;              AC_SUBST([REPLACE_FPURGE])
+  HAVE_DECL_FPURGE=1;            AC_SUBST([HAVE_DECL_FPURGE])
   REPLACE_FCLOSE=0;              AC_SUBST([REPLACE_FCLOSE])
   HAVE_DECL_GETDELIM=1;          AC_SUBST([HAVE_DECL_GETDELIM])
   HAVE_DECL_GETLINE=1;           AC_SUBST([HAVE_DECL_GETLINE])
index d42a635ece4cdb36055b474f60c77eb8f5d9ae4d..16fefa19749450385b5b3066bb9a49160721518e 100644 (file)
@@ -1,7 +1,6 @@
 # Configure a more-standard replacement for <time.h>.
 
-# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007 Free Software
-# Foundation, Inc.
+# Copyright (C) 2000-2001, 2003-2007, 2009 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -30,6 +29,7 @@ AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
   dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK;
   dnl this lets maintainers check for portability.
   REPLACE_LOCALTIME_R=GNULIB_PORTCHECK;  AC_SUBST([REPLACE_LOCALTIME_R])
+  REPLACE_MKTIME=GNULIB_PORTCHECK;       AC_SUBST([REPLACE_MKTIME])
   REPLACE_NANOSLEEP=GNULIB_PORTCHECK;    AC_SUBST([REPLACE_NANOSLEEP])
   REPLACE_STRPTIME=GNULIB_PORTCHECK;     AC_SUBST([REPLACE_STRPTIME])
   REPLACE_TIMEGM=GNULIB_PORTCHECK;       AC_SUBST([REPLACE_TIMEGM])
index ff9a4ea0a59f3c43d7c06bbc973fa5918c7bf11c..96fddba7feeac507695317b4e145f50f4ee2f588 100644 (file)
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 17
+# unistd_h.m4 serial 18
 dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -73,6 +73,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_SYS_PARAM_H=0;     AC_SUBST([HAVE_SYS_PARAM_H])
   REPLACE_CHOWN=0;        AC_SUBST([REPLACE_CHOWN])
   REPLACE_CLOSE=0;        AC_SUBST([REPLACE_CLOSE])
+  REPLACE_DUP2=0;         AC_SUBST([REPLACE_DUP2])
   REPLACE_FCHDIR=0;       AC_SUBST([REPLACE_FCHDIR])
   REPLACE_GETCWD=0;       AC_SUBST([REPLACE_GETCWD])
   REPLACE_GETPAGESIZE=0;  AC_SUBST([REPLACE_GETPAGESIZE])
index 758bad98ae31042cace60f3bb1f05e1849cd0f49..f0bf0acfb4a61d5b1f057c3a22984a315dd04599 100644 (file)
@@ -69,23 +69,31 @@ close_fd_maybe_socket (int fd, const struct close_hook *remaining_list)
 
 static struct close_hook close_sockets_hook;
 
+static int initialized_sockets_version /* = 0 */;
+
 #endif
 
 int
 gl_sockets_startup (int version)
 {
 #if WINDOWS_SOCKETS
-  WSADATA data;
-  int err;
+  if (version > initialized_sockets_version)
+    {
+      WSADATA data;
+      int err;
 
-  err = WSAStartup (version, &data);
-  if (err != 0)
-    return 1;
+      err = WSAStartup (version, &data);
+      if (err != 0)
+       return 1;
+
+      if (data.wVersion < version)
+       return 2;
 
-  if (data.wVersion < version)
-    return 2;
+      if (initialized_sockets_version == 0)
+       register_close_hook (close_fd_maybe_socket, &close_sockets_hook);
 
-  register_close_hook (close_fd_maybe_socket, &close_sockets_hook);
+      initialized_sockets_version = version;
+    }
 #endif
 
   return 0;
@@ -97,6 +105,8 @@ gl_sockets_cleanup (void)
 #if WINDOWS_SOCKETS
   int err;
 
+  initialized_sockets_version = 0;
+
   unregister_close_hook (&close_sockets_hook);
 
   err = WSACleanup ();
index 6610fed54b82ee96034dc35250a522689b4235be..1d194fa498eff869a910c4dfecafbd8e4342e492 100644 (file)
@@ -1,6 +1,6 @@
 /* A GNU-like <stdio.h>.
 
-   Copyright (C) 2004, 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2007-2009 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -407,6 +407,24 @@ extern long rpl_ftell (FILE *fp);
     fflush (f))
 #endif
 
+#if @GNULIB_FPURGE@
+# if @REPLACE_FPURGE@
+#  define fpurge rpl_fpurge
+# endif
+# if @REPLACE_FPURGE@ || !@HAVE_DECL_FPURGE@
+  /* Discard all pending buffered I/O data on STREAM.
+     STREAM must not be wide-character oriented.
+     Return 0 if successful.  Upon error, return -1 and set errno.  */
+  extern int fpurge (FILE *gl_stream);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fpurge
+# define fpurge(f) \
+   (GL_LINK_WARNING ("fpurge is not always present - " \
+                     "use gnulib module fpurge for portability"), \
+    fpurge (f))
+#endif
+
 #if @GNULIB_FCLOSE@
 # if @REPLACE_FCLOSE@
 #  define fclose rpl_fclose
index a5efa320ba2d3391cc00e84d45597522e5449437..dcfe38dd515cf365fc8c55fbf19ed17177fa23d5 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <stdio.h> substitute.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
 #include <stdio.h>
 
+#include "verify.h"
+
 /* Check that the various SEEK_* macros are defined.  */
 int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
 
+/* Check that NULL can be passed through varargs as a pointer type,
+   per POSIX 2008.  */
+verify (sizeof NULL == sizeof (void *));
+
 int
 main ()
 {
index e103d46b2036b753de4cb03a4af6075137721238..ae46ba16625479aeb9022489162bee441a57433b 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <stdlib.h> substitute.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
 #include <stdlib.h>
 
+#include "verify.h"
+
 int exitcode;
 
+/* Check that NULL can be passed through varargs as a pointer type,
+   per POSIX 2008.  */
+verify (sizeof NULL == sizeof (void *));
+
 int
 main ()
 {
index 68014f54c8e431a7b99e8973df182121e026849a..fe53cd9b152a584e9559ff43b55a38106416dcad 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <string.h> substitute.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
 #include <string.h>
 
+#include "verify.h"
+
+/* Check that NULL can be passed through varargs as a pointer type,
+   per POSIX 2008.  */
+verify (sizeof NULL == sizeof (void *));
+
 int
 main ()
 {
index 5fed15cf9fd8fdcc50b4ad7bb63ceef4d9b94cac..129367b4d7df989e1f31d1035e9ddc444d8a3169 100644 (file)
 
 #include <unistd.h>
 
+#include "verify.h"
+
+/* Check that NULL can be passed through varargs as a pointer type,
+   per POSIX 2008.  */
+verify (sizeof NULL == sizeof (void *));
+
 /* Check that the various SEEK_* macros are defined.  */
 int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
 
index 9c0a882263489d3fbcb40c3b1933bebf23e6b431..c9fb753d2003e8f0a9be54835235b363ae35f5e8 100644 (file)
@@ -1,6 +1,6 @@
 /* A more-standard <time.h>.
 
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2009 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -66,6 +66,12 @@ struct timespec
 int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp);
 # endif
 
+/* Return the 'time_t' representation of TP and normalize TP.  */
+# if @REPLACE_MKTIME@
+#  define mktime rpl_mktime
+extern time_t mktime (struct tm *__tp);
+# endif
+
 /* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
    <http://www.opengroup.org/susv3xsh/localtime_r.html> and
    <http://www.opengroup.org/susv3xsh/gmtime_r.html>.  */
index 4c1fc3fdaace4ec6d38a2d2a16c80532ed52168a..279f3347ed80802029edfd6d0348e65e60d8a5cb 100644 (file)
@@ -150,10 +150,13 @@ extern int close (int);
 
 
 #if @GNULIB_DUP2@
-# if !@HAVE_DUP2@
+# if @REPLACE_DUP2@
+#  define dup2 rpl_dup2
+# endif
+# if !@HAVE_DUP2@ || @REPLACE_DUP2@
 /* Copy the file descriptor OLDFD into file descriptor NEWFD.  Do nothing if
    NEWFD = OLDFD, otherwise close NEWFD first if it is open.
-   Return 0 if successful, otherwise -1 and errno set.
+   Return newfd if successful, otherwise -1 and errno set.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/dup2.html>.  */
 extern int dup2 (int oldfd, int newfd);
@@ -214,7 +217,11 @@ extern int fchdir (int /*fd*/);
 
 #  define dup rpl_dup
 extern int dup (int);
-#  define dup2 rpl_dup2
+
+#  if @REPLACE_DUP2@
+#   undef dup2
+#  endif
+#  define dup2 rpl_dup2_fchdir
 extern int dup2 (int, int);
 
 # endif
index 21442033c87bd65912d4337d2f3fe686da708e01..2f8b7ff38f59356b30df8a0d627ea0a809e1bdf0 100644 (file)
@@ -1,4 +1,4 @@
-# lib-link.m4 serial 19 (gettext-0.18)
+# lib-link.m4 serial 20 (gettext-0.18)
 dnl Copyright (C) 2001-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -82,7 +82,7 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
   ])
   if test "$ac_cv_lib[]Name" = yes; then
     HAVE_LIB[]NAME=yes
-    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib[]$1 library.])
+    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
     AC_MSG_CHECKING([how to link with lib[]$1])
     AC_MSG_RESULT([$LIB[]NAME])
   else
@@ -210,6 +210,9 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
   LTLIB[]NAME=
   INC[]NAME=
   LIB[]NAME[]_PREFIX=
+  dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
+  dnl computed. So it has to be reset here.
+  HAVE_LIB[]NAME=
   rpathdirs=
   ltrpathdirs=
   names_already_handled=
index ffee3e8a46557ba617878025568b2744d7ef4264..3999b9a50cf6c96a8a59babc1c8c196bbcedcb68 100644 (file)
@@ -1,6 +1,6 @@
 /* Declaration of functions and data types used for MD5 sum computing
    library functions.
-   Copyright (C) 1995-1997,1999,2000,2001,2004,2005,2006,2008
+   Copyright (C) 1995-1997,1999,2000,2001,2004,2005,2006,2008,2009
       Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
 # define __md5_stream md5_stream
 #endif
 
+# ifdef __cplusplus
+extern "C" {
+# endif
+
 /* Structure to save state of computation between the single steps.  */
 struct md5_ctx
 {
@@ -115,4 +119,8 @@ extern int __md5_stream (FILE *stream, void *resblock) __THROW;
 extern void *__md5_buffer (const char *buffer, size_t len,
                           void *resblock) __THROW;
 
+# ifdef __cplusplus
+}
+# endif
+
 #endif /* md5.h */
index ed9c1aaf49d3f05ba217401ef175698081b8aeb9..2df7c046732bda4e7730b48e14caa4e4fb97ded3 100644 (file)
--- a/maint.mk
+++ b/maint.mk
@@ -44,7 +44,7 @@ ifeq ($(origin prev_version_file), undefined)
   prev_version_file = $(srcdir)/.prev-version
 endif
 
-PREV_VERSION := $(shell cat $(prev_version_file))
+PREV_VERSION := $(shell cat $(prev_version_file) 2>/dev/null)
 VERSION_REGEXP = $(subst .,\.,$(VERSION))
 PREV_VERSION_REGEXP = $(subst .,\.,$(PREV_VERSION))
 
@@ -70,9 +70,11 @@ export LC_ALL = C
 ## Sanity checks.  ##
 ## --------------- ##
 
+_cfg_mk := $(shell test -f $(srcdir)/cfg.mk && echo '$(srcdir)/cfg.mk')
+
 # Collect the names of rules starting with `sc_'.
 syntax-check-rules := $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' \
-                       $(srcdir)/$(ME) $(srcdir)/cfg.mk)
+                       $(srcdir)/$(ME) $(_cfg_mk))
 .PHONY: $(syntax-check-rules)
 
 local-checks-available = \
@@ -363,16 +365,19 @@ sc_program_name:
 # Require that the final line of each test-lib.sh-using test be this one:
 # Exit $fail
 # Note: this test requires GNU grep's --label= option.
+Exit_witness_file ?= tests/test-lib.sh
+Exit_base := $(notdir $(Exit_witness_file))
 sc_require_test_exit_idiom:
-       @if test -f $(srcdir)/tests/test-lib.sh; then                   \
+       @if test -f $(srcdir)/$(Exit_witness_file); then                \
          die=0;                                                        \
-         for i in $$(grep -l -F /../test-lib.sh $$($(VC_LIST) tests)); do \
-           tail -n1 $$i | grep '^Exit \$$fail$$' > /dev/null           \
+         for i in $$(grep -l -F 'srcdir/$(Exit_base)'                  \
+               $$($(VC_LIST) tests)); do                               \
+           tail -n1 $$i | grep '^Exit .' > /dev/null                   \
              && : || { die=1; echo $$i; }                              \
          done;                                                         \
          test $$die = 1 &&                                             \
            { echo 1>&2 '$(ME): the final line in each of the above is not:'; \
-             echo 1>&2 'Exit $$fail';                                  \
+             echo 1>&2 'Exit something';                               \
              exit 1; } || :;                                           \
        fi
 
@@ -487,7 +492,7 @@ sc_immutable_NEWS:
 # Update the hash stored above.  Do this after each release and
 # for any corrections to old entries.
 update-NEWS-hash: NEWS
-       perl -pi -e 's/^(old_NEWS_hash = ).*/$${1}'"$(NEWS_hash)/" \
+       perl -pi -e 's/^(old_NEWS_hash[ \t]+:?=[ \t]+).*/$${1}'"$(NEWS_hash)/" \
          $(srcdir)/cfg.mk
 
 # Ensure that we use only the standard $(VAR) notation,
@@ -537,6 +542,7 @@ sc_po_check:
          for file in $$($(VC_LIST_EXCEPT)) lib/*.[ch]; do              \
            test -r $$file || continue;                                 \
            case $$file in                                              \
+             *.m4|*.mk) continue ;;                                    \
              *.?|*.??) ;;                                              \
              *) continue;;                                             \
            esac;                                                       \
@@ -623,7 +629,7 @@ maintainer-distcheck:
 # Also, make sure the NEWS file is up-to-date.
 ALL_RECURSIVE_TARGETS += vc-dist
 vc-dist: $(local-check) cvs-check maintainer-distcheck
-       XZ_OPT=-9ev $(MAKE) dist
+       XZ_OPT=9ev $(MAKE) dist
 
 # Use this to make sure we don't run these programs when building
 # from a virgin tgz file, below.
@@ -765,3 +771,12 @@ INDENT_SOURCES ?= $(C_SOURCES)
 .PHONY: indent
 indent:
        indent $(INDENT_SOURCES)
+
+# Run this rule once per year (usually early in January)
+# to update all FSF copyright year lists in your project.
+update-copyright-exclude-regexp ?= (^|/)COPYING$$
+.PHONY: update-copyright
+update-copyright:
+       grep -l -w Copyright $$($(VC_LIST_EXCEPT))              \
+         | grep -v -E '$(update-copyright-exclude-regexp)'     \
+         | xargs $(build_aux)/$@