Sync from gnulib.
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 14 Feb 2006 23:08:59 +0000 (23:08 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 14 Feb 2006 23:08:59 +0000 (23:08 +0000)
build-aux/ChangeLog
build-aux/install-sh
lib/ChangeLog
lib/gai_strerror.c
lib/getaddrinfo.h
lib/vasnprintf.c
m4/ChangeLog
m4/getaddrinfo.m4
m4/ls-mntd-fs.m4
m4/socklen.m4

index 302d7ae..774b278 100644 (file)
@@ -1,3 +1,7 @@
+2006-02-14  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * install-sh: Update from gnulib.
+
 2006-01-31  Jim Meyering  <jim@meyering.net>
 
        * config.guess, missing, texinfo.tex: Update from gnulib.
index 0ae12c0..fd2e75a 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2005-11-07.23
+scriptversion=2006-01-12.21
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -233,11 +233,23 @@ do
             X"$dst" : 'X\(/\)' \| \
             .       : '\(.\)' 2>/dev/null ||
        echo X"$dst" |
-           sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-                 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-                 /^X\(\/\/\)$/{ s//\1/; q; }
-                 /^X\(\/\).*/{ s//\1/; q; }
-                 s/.*/./; q'
+           sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+                  s//\1/
+                  q
+                }
+                /^X\(\/\/\)[^/].*/{
+                  s//\1/
+                  q
+                }
+                /^X\(\/\/\)$/{
+                  s//\1/
+                  q
+                }
+                /^X\(\/\).*/{
+                  s//\1/
+                  q
+                }
+                s/.*/./; q'
       `
 
       test -d "$dstdir"
index b91cba3..47481dd 100644 (file)
@@ -1,3 +1,26 @@
+2006-02-14  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * vasnprintf.c (VASNPRINTF): Rewrite the computation so that we
+       need not use xsum.
+
+2006-02-14  Bruno Haible  <bruno@clisp.org>
+
+       Sync from gnulib.
+
+       * vasnprintf.c (VASNPRINTF): In the computation of the size of the
+       temporary buffer for sprintf, take into account the precision also
+       for 'd', 'i', 'u', 'o', 'x', 'X'.
+
+2006-02-14  Simon Josefsson  <jas@extundo.com>
+
+       Sync from gnulib.
+
+       * getaddrinfo.h: Define EAI_ADDRFAMILY and EAI_SYSTEM if not set,
+       for mingw32.
+
+       * gai_strerror.c, getaddrinfo.h: Protect netdb.h #include (for
+       mingw32).
+
 2006-02-07  Paul Eggert  <eggert@cs.ucla.edu>
 
        * closeout.c (close_stdout): Don't assume 'bool' converts nonzero
index f289870..d97b858 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.
 
@@ -25,7 +25,9 @@
 #endif
 
 #include <stdio.h>
-#include <netdb.h>
+#ifdef HAVE_NETDB_H
+# include <netdb.h>
+#endif
 
 #ifdef _LIBC
 # include <libintl.h>
index 65f52cd..7722c14 100644 (file)
@@ -1,5 +1,5 @@
 /* Get address information.
-   Copyright (C) 1996-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1996-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
    Contributed by Simon Josefsson <simon@josefsson.org>.
 
    This program is free software; you can redistribute it and/or modify
@@ -26,7 +26,9 @@
 # include <sys/types.h>
 /* Get all getaddrinfo related declarations, if available.  */
 # include <sys/socket.h>
+#ifdef HAVE_NETDB_H
 # include <netdb.h>
+#endif
 
 # ifndef HAVE_STRUCT_ADDRINFO
 
@@ -65,10 +67,18 @@ struct addrinfo
 #  define EAI_FAMILY     -6    /* `ai_family' not supported.  */
 #  define EAI_SOCKTYPE   -7    /* `ai_socktype' not supported.  */
 #  define EAI_SERVICE    -8    /* SERVICE not supported for `ai_socktype'.  */
-#  define EAI_ADDRFAMILY  -9   /* Address family for NAME not supported.  */
 #  define EAI_MEMORY     -10   /* Memory allocation failure.  */
-#  define EAI_SYSTEM     -11   /* System error returned in `errno'.  */
 #  define EAI_OVERFLOW   -12   /* Argument buffer overflow.  */
+#endif
+# ifndef EAI_ADDRFAMILY
+/* Not defined on mingw32.  XXX May be incorrect? Perhaps it is never
+   returned? */
+#  define EAI_ADDRFAMILY  -9   /* Address family for NAME not supported.  */
+# endif
+# ifndef EAI_SYSTEM
+/* Not defined on mingw32.  XXX May be incorrect? Perhaps it is never
+   returned? */
+#  define EAI_SYSTEM     -11   /* System error returned in `errno'.  */
 # endif
 
 # ifdef __USE_GNU
index 16d6fbd..6a63543 100644 (file)
@@ -1,5 +1,5 @@
 /* vsprintf with automatic memory allocation.
-   Copyright (C) 1999, 2002-2005 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2006 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
@@ -344,28 +344,29 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
                        tmp_length =
                          (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
                                          * 0.30103 /* binary -> decimal */
-                                         * 2 /* estimate for FLAG_GROUP */
                                         )
-                         + 1 /* turn floor into ceil */
-                         + 1; /* account for leading sign */
+                         + 1; /* turn floor into ceil */
                      else
 # endif
                      if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
                        tmp_length =
                          (unsigned int) (sizeof (unsigned long) * CHAR_BIT
                                          * 0.30103 /* binary -> decimal */
-                                         * 2 /* estimate for FLAG_GROUP */
                                         )
-                         + 1 /* turn floor into ceil */
-                         + 1; /* account for leading sign */
+                         + 1; /* turn floor into ceil */
                      else
                        tmp_length =
                          (unsigned int) (sizeof (unsigned int) * CHAR_BIT
                                          * 0.30103 /* binary -> decimal */
-                                         * 2 /* estimate for FLAG_GROUP */
                                         )
-                         + 1 /* turn floor into ceil */
-                         + 1; /* account for leading sign */
+                         + 1; /* turn floor into ceil */
+                     if (tmp_length < precision)
+                       tmp_length = precision;
+                     /* Multiply by 2, as an estimate for FLAG_GROUP.  */
+                     /* Add 1, to account for a leading sign.  */
+                     tmp_length = (tmp_length < SIZE_MAX / 2
+                                   ? 2 * tmp_length + 1
+                                   : SIZE_MAX);
                      break;
 
                    case 'o':
@@ -375,8 +376,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
                          (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
                                          * 0.333334 /* binary -> octal */
                                         )
-                         + 1 /* turn floor into ceil */
-                         + 1; /* account for leading sign */
+                         + 1; /* turn floor into ceil */
                      else
 # endif
                      if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
@@ -384,15 +384,17 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
                          (unsigned int) (sizeof (unsigned long) * CHAR_BIT
                                          * 0.333334 /* binary -> octal */
                                         )
-                         + 1 /* turn floor into ceil */
-                         + 1; /* account for leading sign */
+                         + 1; /* turn floor into ceil */
                      else
                        tmp_length =
                          (unsigned int) (sizeof (unsigned int) * CHAR_BIT
                                          * 0.333334 /* binary -> octal */
                                         )
-                         + 1 /* turn floor into ceil */
-                         + 1; /* account for leading sign */
+                         + 1; /* turn floor into ceil */
+                     if (tmp_length < precision)
+                       tmp_length = precision;
+                     /* Add 1, to account for a leading sign.  */
+                     tmp_length += (tmp_length < SIZE_MAX);
                      break;
 
                    case 'x': case 'X':
@@ -402,8 +404,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
                          (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
                                          * 0.25 /* binary -> hexadecimal */
                                         )
-                         + 1 /* turn floor into ceil */
-                         + 2; /* account for leading sign or alternate form */
+                         + 1; /* turn floor into ceil */
                      else
 # endif
                      if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
@@ -411,15 +412,18 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
                          (unsigned int) (sizeof (unsigned long) * CHAR_BIT
                                          * 0.25 /* binary -> hexadecimal */
                                         )
-                         + 1 /* turn floor into ceil */
-                         + 2; /* account for leading sign or alternate form */
+                         + 1; /* turn floor into ceil */
                      else
                        tmp_length =
                          (unsigned int) (sizeof (unsigned int) * CHAR_BIT
                                          * 0.25 /* binary -> hexadecimal */
                                         )
-                         + 1 /* turn floor into ceil */
-                         + 2; /* account for leading sign or alternate form */
+                         + 1; /* turn floor into ceil */
+                     if (tmp_length < precision)
+                       tmp_length = precision;
+                     /* Add 2, to account for a leading sign or alternate form.  */
+                     if (tmp_length <= SIZE_MAX / 2)
+                       tmp_length *= 2;
                      break;
 
                    case 'f': case 'F':
index dd75ca4..699fe70 100644 (file)
@@ -1,3 +1,11 @@
+2006-02-14  Simon Josefsson  <jas@extundo.com>
+
+       Sync from gnulib.
+       * getaddrinfo.m4: Look for getaddrinfo inside ws2tcip.h and
+       -lws2_32.  Protect sys/socket.h and netdb.h #include's.  Include
+       ws2tcpip.h with WINVER=0x0501.  All for mingw32.
+       * socklen.m4: Look in ws2tcpip.h too, for mingw32.
+
 2006-02-05  Paul Eggert  <eggert@cs.ucla.edu>
 
        * extensions.m4 (gl_USE_SYSTEM_EXTENSIONS): Don't #define
index b3b7b07..006cdab 100644 (file)
@@ -1,36 +1,72 @@
 # getaddrinfo.m4 serial 7
-dnl Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+dnl Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
 AC_DEFUN([gl_GETADDRINFO],
 [
+  AC_MSG_NOTICE([checking how to do getaddrinfo])
+
   AC_SEARCH_LIBS(getaddrinfo, [nsl socket])
-  AC_SEARCH_LIBS(gethostbyname, [inet nsl])
-  AC_SEARCH_LIBS(getservbyname, [inet nsl socket xnet])
-  AC_REPLACE_FUNCS(getaddrinfo gai_strerror)
+  AC_CHECK_FUNCS(getaddrinfo,, [
+    AC_CACHE_CHECK(for getaddrinfo in ws2tcpip.h and -lws2_32,
+                   gl_cv_w32_getaddrinfo, [
+      gl_cv_w32_getaddrinfo=no
+      am_save_LIBS="$LIBS"
+      LIBS="$LIBS -lws2_32"
+      AC_TRY_LINK([
+#define WINVER 0x0501
+#include <ws2tcpip.h>
+], [getaddrinfo(0, 0, 0, 0);], gl_cv_w32_getaddrinfo=yes)
+      LIBS="$am_save_LIBS"
+      if test "$gl_cv_w32_getaddrinfo" = "yes"; then
+        LIBS="$LIBS -lws2_32"
+      else
+        AC_LIBOBJ(getaddrinfo)
+      fi
+    ])])
+
+  AC_REPLACE_FUNCS(gai_strerror)
   gl_PREREQ_GETADDRINFO
 ])
 
 # Prerequisites of lib/getaddrinfo.h and lib/getaddrinfo.c.
 AC_DEFUN([gl_PREREQ_GETADDRINFO], [
+  AC_SEARCH_LIBS(gethostbyname, [inet nsl])
+  AC_SEARCH_LIBS(getservbyname, [inet nsl socket xnet])
   AC_REQUIRE([gl_C_RESTRICT])
   AC_REQUIRE([gl_SOCKET_FAMILIES])
   AC_REQUIRE([AC_C_INLINE])
   AC_REQUIRE([AC_GNU_SOURCE])
-  AC_CHECK_HEADERS_ONCE(netinet/in.h)
+  AC_CHECK_HEADERS_ONCE(netinet/in.h sys/socket.h netdb.h ws2tcpip.h)
   AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror],,,[
   /* sys/types.h is not needed according to POSIX, but the
      sys/socket.h in i386-unknown-freebsd4.10 and
      powerpc-apple-darwin5.5 required it. */
 #include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
 #include <netdb.h>
+#endif
+#ifdef HAVE_WS2TCPIP_H
+#define WINVER 0x0501
+#include <ws2tcpip.h>
+#endif
 ])
   AC_CHECK_TYPES([struct addrinfo],,,[
 #include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
 #include <netdb.h>
+#endif
+#ifdef HAVE_WS2TCPIP_H
+#define WINVER 0x0501
+#include <ws2tcpip.h>
+#endif
 ])
 ])
index af3eaa8..a4c8089 100644 (file)
@@ -1,4 +1,4 @@
-#serial 20
+#serial 21
 # How to list mounted file systems.
 
 # Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006 Free Software
index 7db6ba3..01da2b5 100644 (file)
@@ -1,17 +1,22 @@
-# socklen.m4 serial 2
-dnl Copyright (C) 2005 Free Software Foundation, Inc.
+# socklen.m4 serial 3
+dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
-dnl From Albert Chin.
+dnl From Albert Chin, Windows fixes from Simon Josefsson.
 
 dnl Check for socklen_t: historically on BSD it is an int, and in
 dnl POSIX 1g it is a type of its own, but some platforms use different
 dnl types for the argument to getsockopt, getpeername, etc.  So we
 dnl have to test to find something that will work.
+
+dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find
+dnl it there first.  That file is included by gnulib's socket_.h, which
+dnl all users of this module should include.
 AC_DEFUN([gl_TYPE_SOCKLEN_T],
-  [AC_CHECK_TYPE([socklen_t], ,
+  [AC_CHECK_HEADERS_ONCE([sys/socket.h ws2tcpip.h])
+   AC_CHECK_TYPE([socklen_t], ,
      [AC_MSG_CHECKING([for socklen_t equivalent])
       AC_CACHE_VAL([gl_cv_gl_cv_socklen_t_equiv],
         [# Systems have either "struct sockaddr *" or
@@ -21,7 +26,7 @@ AC_DEFUN([gl_TYPE_SOCKLEN_T],
           for t in int size_t "unsigned int" "long int" "unsigned long int"; do
             AC_TRY_COMPILE(
               [#include <sys/types.h>
-               #include <sys/socket.h>
+                #include <sys/socket.h>
 
                int getpeername (int, $arg2 *, $t *);],
                [$t len;
@@ -39,4 +44,9 @@ AC_DEFUN([gl_TYPE_SOCKLEN_T],
       AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv],
         [type to use in place of socklen_t if not defined])],
      [#include <sys/types.h>
-      #include <sys/socket.h>])])
+      #if HAVE_SYS_SOCKET_H
+      # include <sys/socket.h>
+      #endif
+      #if HAVE_WS2TCPIP_H
+      # include <ws2tcpip.h>
+      #endif])])