[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sync from gnulib for install-sh, vasnprintf.c, getaddrinfo, socklen
From: |
Paul Eggert |
Subject: |
sync from gnulib for install-sh, vasnprintf.c, getaddrinfo, socklen |
Date: |
Tue, 14 Feb 2006 15:14:00 -0800 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
I installed this patch to sync from gnulib.
2006-02-14 Paul Eggert <address@hidden>
* build-aux/install-sh: Update from gnulib.
* lib/vasnprintf.c (VASNPRINTF): Rewrite the computation so that we
need not use xsum.
2006-02-14 Bruno Haible <address@hidden>
Sync from gnulib.
* lib/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 <address@hidden>
Sync from gnulib.
* lib/getaddrinfo.h: Define EAI_ADDRFAMILY and EAI_SYSTEM if not set,
for mingw32.
* lib/gai_strerror.c, getaddrinfo.h: Protect netdb.h #include (for
mingw32).
* m4/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.
* m4/socklen.m4: Look in ws2tcpip.h too, for mingw32.
Index: build-aux/install-sh
===================================================================
RCS file: /fetish/cu/build-aux/install-sh,v
retrieving revision 1.5
diff -p -u -r1.5 install-sh
--- build-aux/install-sh 12 Nov 2005 19:11:22 -0000 1.5
+++ build-aux/install-sh 14 Feb 2006 23:03:34 -0000
@@ -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: lib/gai_strerror.c
===================================================================
RCS file: /fetish/cu/lib/gai_strerror.c,v
retrieving revision 1.1
diff -p -u -r1.1 gai_strerror.c
--- lib/gai_strerror.c 22 Sep 2005 06:22:44 -0000 1.1
+++ lib/gai_strerror.c 14 Feb 2006 23:03:34 -0000
@@ -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 <address@hidden>, 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: lib/getaddrinfo.h
===================================================================
RCS file: /fetish/cu/lib/getaddrinfo.h,v
retrieving revision 1.5
diff -p -u -r1.5 getaddrinfo.h
--- lib/getaddrinfo.h 14 Nov 2005 14:51:24 -0000 1.5
+++ lib/getaddrinfo.h 14 Feb 2006 23:03:34 -0000
@@ -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 <address@hidden>.
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: lib/vasnprintf.c
===================================================================
RCS file: /fetish/cu/lib/vasnprintf.c,v
retrieving revision 1.9
diff -p -u -r1.9 vasnprintf.c
--- lib/vasnprintf.c 14 May 2005 07:58:07 -0000 1.9
+++ lib/vasnprintf.c 14 Feb 2006 23:03:34 -0000
@@ -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 *l
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 *l
(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 *l
(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 *l
(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 *l
(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: m4/getaddrinfo.m4
===================================================================
RCS file: /fetish/cu/m4/getaddrinfo.m4,v
retrieving revision 1.9
diff -p -u -r1.9 getaddrinfo.m4
--- m4/getaddrinfo.m4 10 Jan 2006 17:47:57 -0000 1.9
+++ m4/getaddrinfo.m4 14 Feb 2006 23:03:34 -0000
@@ -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: m4/ls-mntd-fs.m4
===================================================================
RCS file: /fetish/cu/m4/ls-mntd-fs.m4,v
retrieving revision 1.33
diff -p -u -r1.33 ls-mntd-fs.m4
--- m4/ls-mntd-fs.m4 13 Jan 2006 13:35:26 -0000 1.33
+++ m4/ls-mntd-fs.m4 14 Feb 2006 23:03:34 -0000
@@ -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: m4/socklen.m4
===================================================================
RCS file: /fetish/cu/m4/socklen.m4,v
retrieving revision 1.2
diff -p -u -r1.2 socklen.m4
--- m4/socklen.m4 2 Dec 2005 18:22:10 -0000 1.2
+++ m4/socklen.m4 14 Feb 2006 23:03:34 -0000
@@ -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])])
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- sync from gnulib for install-sh, vasnprintf.c, getaddrinfo, socklen,
Paul Eggert <=