summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2009-08-06 16:30:15 +0200
committerSimon Josefsson <simon@josefsson.org>2009-08-06 16:30:15 +0200
commit92a5cd11f9b33f427c495dca22d9aac1cf7b1f3d (patch)
treeb3bb68a392114cd82b5f174061b0d6ab77cfa1f2
parenta532faf3bd6d95bf41ba75733a72b504090667af (diff)
downloadgnutls-92a5cd11f9b33f427c495dca22d9aac1cf7b1f3d.tar.gz
Update gnulib files.
-rwxr-xr-xbuild-aux/vc-list-files4
-rw-r--r--gl/Makefile.am4
-rw-r--r--gl/error.c16
-rw-r--r--gl/fseeko.c2
-rw-r--r--gl/m4/gnulib-comp.m42
-rw-r--r--gl/m4/lib-link.m47
-rw-r--r--gl/m4/stdio_h.m45
-rw-r--r--gl/m4/unistd_h.m43
-rw-r--r--gl/socket.c10
-rw-r--r--gl/sockets.c26
-rw-r--r--gl/stdio.in.h20
-rw-r--r--gl/tests/Makefile.am10
-rw-r--r--gl/tests/test-select.c5
-rw-r--r--gl/tests/test-stdio.c8
-rw-r--r--gl/tests/test-stdlib.c8
-rw-r--r--gl/tests/test-string.c8
-rw-r--r--gl/tests/test-unistd.c6
-rw-r--r--gl/tests/test-version-etc.c33
-rwxr-xr-xgl/tests/test-version-etc.sh40
-rw-r--r--gl/unistd.in.h13
-rw-r--r--gl/version-etc.c119
-rw-r--r--gl/version-etc.h42
-rw-r--r--lib/gl/Makefile.am5
-rw-r--r--lib/gl/fseeko.c2
-rw-r--r--lib/gl/m4/iconv.m46
-rw-r--r--lib/gl/m4/lib-link.m47
-rw-r--r--lib/gl/m4/stdio_h.m45
-rw-r--r--lib/gl/m4/time_h.m44
-rw-r--r--lib/gl/m4/unistd_h.m43
-rw-r--r--lib/gl/sockets.c26
-rw-r--r--lib/gl/stdio.in.h20
-rw-r--r--lib/gl/tests/test-stdio.c8
-rw-r--r--lib/gl/tests/test-stdlib.c8
-rw-r--r--lib/gl/tests/test-string.c8
-rw-r--r--lib/gl/tests/test-unistd.c6
-rw-r--r--lib/gl/time.in.h8
-rw-r--r--lib/gl/unistd.in.h13
-rw-r--r--libextra/gl/m4/lib-link.m47
-rw-r--r--libextra/gl/md5.h10
-rw-r--r--maint.mk31
40 files changed, 466 insertions, 102 deletions
diff --git a/build-aux/vc-list-files b/build-aux/vc-list-files
index 9376e3dc2f..cc716e9c35 100755
--- a/build-aux/vc-list-files
+++ b/build-aux/vc-list-files
@@ -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
diff --git a/gl/Makefile.am b/gl/Makefile.am
index b40d7bad8d..28f1560f39 100644
--- a/gl/Makefile.am
+++ b/gl/Makefile.am
@@ -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' \
diff --git a/gl/error.c b/gl/error.c
index 3177bd5d2c..af2287b271 100644
--- a/gl/error.c
+++ b/gl/error.c
@@ -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);
diff --git a/gl/fseeko.c b/gl/fseeko.c
index cf7c42fbfd..a7ac9fc4dc 100644
--- a/gl/fseeko.c
+++ b/gl/fseeko.c
@@ -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 */
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index 56d0e4a036..cf3336d3cc 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -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
diff --git a/gl/m4/lib-link.m4 b/gl/m4/lib-link.m4
index 21442033c8..2f8b7ff38f 100644
--- a/gl/m4/lib-link.m4
+++ b/gl/m4/lib-link.m4
@@ -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=
diff --git a/gl/m4/stdio_h.m4 b/gl/m4/stdio_h.m4
index 846b65d302..fcbe68f6ba 100644
--- a/gl/m4/stdio_h.m4
+++ b/gl/m4/stdio_h.m4
@@ -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])
diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4
index ff9a4ea0a5..96fddba7fe 100644
--- a/gl/m4/unistd_h.m4
+++ b/gl/m4/unistd_h.m4
@@ -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])
diff --git a/gl/socket.c b/gl/socket.c
index 1fa6928747..8ce4bae8db 100644
--- a/gl/socket.c
+++ b/gl/socket.c
@@ -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
@@ -26,12 +26,18 @@
/* 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)
{
diff --git a/gl/sockets.c b/gl/sockets.c
index 9d5c547928..7cb9981d12 100644
--- a/gl/sockets.c
+++ b/gl/sockets.c
@@ -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 ();
diff --git a/gl/stdio.in.h b/gl/stdio.in.h
index cb273d7642..0445c6f107 100644
--- a/gl/stdio.in.h
+++ b/gl/stdio.in.h
@@ -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
diff --git a/gl/tests/Makefile.am b/gl/tests/Makefile.am
index ecb33b656e..0b753ae949 100644
--- a/gl/tests/Makefile.am
+++ b/gl/tests/Makefile.am
@@ -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
diff --git a/gl/tests/test-select.c b/gl/tests/test-select.c
index 4c9cdc02dc..ec82250149 100644
--- a/gl/tests/test-select.c
+++ b/gl/tests/test-select.c
@@ -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");
diff --git a/gl/tests/test-stdio.c b/gl/tests/test-stdio.c
index a5efa320ba..dcfe38dd51 100644
--- a/gl/tests/test-stdio.c
+++ b/gl/tests/test-stdio.c
@@ -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
@@ -20,9 +20,15 @@
#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 ()
{
diff --git a/gl/tests/test-stdlib.c b/gl/tests/test-stdlib.c
index e103d46b20..ae46ba1662 100644
--- a/gl/tests/test-stdlib.c
+++ b/gl/tests/test-stdlib.c
@@ -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
@@ -20,8 +20,14 @@
#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 ()
{
diff --git a/gl/tests/test-string.c b/gl/tests/test-string.c
index 68014f54c8..fe53cd9b15 100644
--- a/gl/tests/test-string.c
+++ b/gl/tests/test-string.c
@@ -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
@@ -20,6 +20,12 @@
#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 ()
{
diff --git a/gl/tests/test-unistd.c b/gl/tests/test-unistd.c
index 5fed15cf9f..129367b4d7 100644
--- a/gl/tests/test-unistd.c
+++ b/gl/tests/test-unistd.c
@@ -20,6 +20,12 @@
#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
index 0000000000..71cbc8bac4
--- /dev/null
+++ b/gl/tests/test-version-etc.c
@@ -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
index 0000000000..3b2fc4db80
--- /dev/null
+++ b/gl/tests/test-version-etc.sh
@@ -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
diff --git a/gl/unistd.in.h b/gl/unistd.in.h
index fa8d84a3d9..09e90392df 100644
--- a/gl/unistd.in.h
+++ b/gl/unistd.in.h
@@ -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
diff --git a/gl/version-etc.c b/gl/version-etc.c
index c3b028926b..a580140c45 100644
--- a/gl/version-etc.c
+++ b/gl/version-etc.c
@@ -34,26 +34,30 @@
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);
}
diff --git a/gl/version-etc.h b/gl/version-etc.h
index 33a8e7f143..8ce02fecb8 100644
--- a/gl/version-etc.h
+++ b/gl/version-etc.h
@@ -22,17 +22,57 @@
# 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 */
diff --git a/lib/gl/Makefile.am b/lib/gl/Makefile.am
index 355f036866..2a43c61f08 100644
--- a/lib/gl/Makefile.am
+++ b/lib/gl/Makefile.am
@@ -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' \
diff --git a/lib/gl/fseeko.c b/lib/gl/fseeko.c
index b2ed87c420..f9550a1695 100644
--- a/lib/gl/fseeko.c
+++ b/lib/gl/fseeko.c
@@ -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 */
diff --git a/lib/gl/m4/iconv.m4 b/lib/gl/m4/iconv.m4
index 3cc626829e..ce21b0b878 100644
--- a/lib/gl/m4/iconv.m4
+++ b/lib/gl/m4/iconv.m4
@@ -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
diff --git a/lib/gl/m4/lib-link.m4 b/lib/gl/m4/lib-link.m4
index 21442033c8..2f8b7ff38f 100644
--- a/lib/gl/m4/lib-link.m4
+++ b/lib/gl/m4/lib-link.m4
@@ -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=
diff --git a/lib/gl/m4/stdio_h.m4 b/lib/gl/m4/stdio_h.m4
index 846b65d302..fcbe68f6ba 100644
--- a/lib/gl/m4/stdio_h.m4
+++ b/lib/gl/m4/stdio_h.m4
@@ -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])
diff --git a/lib/gl/m4/time_h.m4 b/lib/gl/m4/time_h.m4
index d42a635ece..16fefa1974 100644
--- a/lib/gl/m4/time_h.m4
+++ b/lib/gl/m4/time_h.m4
@@ -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])
diff --git a/lib/gl/m4/unistd_h.m4 b/lib/gl/m4/unistd_h.m4
index ff9a4ea0a5..96fddba7fe 100644
--- a/lib/gl/m4/unistd_h.m4
+++ b/lib/gl/m4/unistd_h.m4
@@ -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])
diff --git a/lib/gl/sockets.c b/lib/gl/sockets.c
index 758bad98ae..f0bf0acfb4 100644
--- a/lib/gl/sockets.c
+++ b/lib/gl/sockets.c
@@ -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 ();
diff --git a/lib/gl/stdio.in.h b/lib/gl/stdio.in.h
index 6610fed54b..1d194fa498 100644
--- a/lib/gl/stdio.in.h
+++ b/lib/gl/stdio.in.h
@@ -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
diff --git a/lib/gl/tests/test-stdio.c b/lib/gl/tests/test-stdio.c
index a5efa320ba..dcfe38dd51 100644
--- a/lib/gl/tests/test-stdio.c
+++ b/lib/gl/tests/test-stdio.c
@@ -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
@@ -20,9 +20,15 @@
#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 ()
{
diff --git a/lib/gl/tests/test-stdlib.c b/lib/gl/tests/test-stdlib.c
index e103d46b20..ae46ba1662 100644
--- a/lib/gl/tests/test-stdlib.c
+++ b/lib/gl/tests/test-stdlib.c
@@ -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
@@ -20,8 +20,14 @@
#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 ()
{
diff --git a/lib/gl/tests/test-string.c b/lib/gl/tests/test-string.c
index 68014f54c8..fe53cd9b15 100644
--- a/lib/gl/tests/test-string.c
+++ b/lib/gl/tests/test-string.c
@@ -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
@@ -20,6 +20,12 @@
#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 ()
{
diff --git a/lib/gl/tests/test-unistd.c b/lib/gl/tests/test-unistd.c
index 5fed15cf9f..129367b4d7 100644
--- a/lib/gl/tests/test-unistd.c
+++ b/lib/gl/tests/test-unistd.c
@@ -20,6 +20,12 @@
#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/lib/gl/time.in.h b/lib/gl/time.in.h
index 9c0a882263..c9fb753d20 100644
--- a/lib/gl/time.in.h
+++ b/lib/gl/time.in.h
@@ -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>. */
diff --git a/lib/gl/unistd.in.h b/lib/gl/unistd.in.h
index 4c1fc3fdaa..279f3347ed 100644
--- a/lib/gl/unistd.in.h
+++ b/lib/gl/unistd.in.h
@@ -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
diff --git a/libextra/gl/m4/lib-link.m4 b/libextra/gl/m4/lib-link.m4
index 21442033c8..2f8b7ff38f 100644
--- a/libextra/gl/m4/lib-link.m4
+++ b/libextra/gl/m4/lib-link.m4
@@ -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=
diff --git a/libextra/gl/md5.h b/libextra/gl/md5.h
index ffee3e8a46..3999b9a50c 100644
--- a/libextra/gl/md5.h
+++ b/libextra/gl/md5.h
@@ -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.
@@ -54,6 +54,10 @@
# 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 */
diff --git a/maint.mk b/maint.mk
index ed9c1aaf49..2df7c04673 100644
--- 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)/$@