bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sync from gnulib into coreutils


From: Paul Eggert
Subject: sync from gnulib into coreutils
Date: Mon, 03 Jul 2006 22:41:49 -0700

I installed the following to sync from gnulib into coreutils.

2006-07-03  Paul Eggert  <address@hidden>

        * lib/Makefile.am (libcoreutils_a_SOURCES): Add setenv.h, wcwidth.h,
        to accommodate sync from gnulib.

        Sync from gnulib.

        2006-06-30  Jim Hyslop <address@hidden>  (tiny change)

        * lib/getaddrinfo.c: fixed typo

        2006-06-28  Bruno Haible  <address@hidden>

        * lib/getaddrinfo.h: Fix POSIX URL.
        * lib/getaddrinfo.c (WIN32_NATIVE): New macro. Use it instead of _WIN32.
        (use_win32_p): Make static.
        (getaddrinfo): Reject service name if it is empty or does not consist
        solely of decimal digits, or if its value is > 65535.
        (getnameinfo): Remove useless casts.

        2006-06-28  Eric Blake  <address@hidden>

        * lib/mbchar.h (wcwidth): Include wcwidth.h.
        * lib/mbswidth.c (wcwidth): Move from here...
        * lib/wcwidth.h: ...to this new file.

        2006-06-28  Simon Josefsson  <address@hidden>

        * lib/getaddrinfo.c: Try to load ws2_32.dll on Windows, to find the
        functions there.  It will succeed on Windows XP, but on Windows
        2000 and (presumably) earlier, it will fail, and use the internal
        re-implementation.
        (use_win32_p): New function.
        (getaddrinfo): Use strtoul on servname, to support numeric ports.
        Support AI_NUMERICSERV to disable getservbyname.
        (getnameinfo): New function, only supports
        NI_NUMERICHOST|NI_NUMERICSERV for now.

        * lib/getaddrinfo.h: Test and check for AI_* flags separately, MinGW
        only have some of them.  Add AI_NUMERICSERV.  Add prototype for
        getnameinfo.

        2006-06-26  Paul Eggert  <address@hidden>

        * lib/base64.c (B64): Use _ as the formal parameter, not x, to avoid
        bug in IBM C V6 for AIX.  Problem reported by Larry Jones in
        <http://lists.gnu.org/archive/html/bug-gnulib/2006-06/msg00181.html>.

        2006-06-21  Simon Josefsson  <address@hidden>

        * lib/getaddrinfo.c (getaddrinfo): Set ai_family in the return
        variable.

        2006-06-19  Paul Eggert  <address@hidden>

        * lib/alloca_.h (alloca) [defined alloca]: Don't define or declare.

        2006-06-16  Eric Blake  <address@hidden>

        * lib/unsetenv.c [!defined errno]: Assume errno.h declares errno.
        * lib/unicodeio.c [!defined errno]: Likewise.
        * lib/strtol.c [!defined errno]: Likewise.
        * lib/strtod.c [!defined errno]: Likewise.

        2006-05-26  Martin Lambers  <address@hidden>

        * lib/getpass.c: Updates the test for the native W32 API, and adds
        missing includes, thus fixing compilation warnings.

        2006-05-25  Sergey Poznyakoff  <address@hidden>

        * lib/exclude.c (exclude_fnmatch): New function.
        (excluded_file_name): Call exclude_fnmatch.
        * lib/exclude.h (excluded_file_name): New prototype

        2006-05-19  Jim Meyering  <address@hidden>

        * lib/getugroups.c: Correct an outdated comment.  From Bruno Haible.

        2006-05-10  Paul Eggert  <address@hidden>

        * lib/sha1.c (rol): Cast right-shift arg to uint32_t to prevent
        unwanted sign propagation, e.g., on hosts with 64-bit int.
        There still are some problems with reeelly weird theoretical hosts
        (e.g., 33-bit int) but it's not worth worrying about now.
        (K1, K2, K3, K4): Remove unnecessary L suffix.

        2006-03-24  Simon Josefsson  <address@hidden>

        * lib/base64.c: Fix problems reported by Eric Blake <address@hidden>,
        including some doc fixes.
        (base64_encode_alloc): Fix +1 bug on allocation failures.

        2006-03-24  Ralf Wildenhues <address@hidden>

        * lib/base64.c (base64_encode): Do not read past end of array with
        unsanitized input on systems with CHAR_BIT > 8.

        2006-03-24  Eric Blake  <address@hidden>

        * lib/time_r.c (copy_string_result): Remove, as it is no longer used.

        * m4/prereq.m4 (gl_PREREQ): Require gl_FUNC_WCWIDTH, to accommodate
        changes mentioned below.
        * m4/setenv.m4 (gt_FUNC_SETENV): Undo private change that added an
        AC_LIBSOURCES line here, since Bruno didn't buy it back.  Instead,
        update ../lib/Makefile.am to mention the files explicitly.

        Sync from gnulib.

        2006-06-28  Simon Josefsson  <address@hidden>

        * m4/getaddrinfo.m4: Look for getnameinfo prototypes too.

        2006-06-28  Eric Blake  <address@hidden>

        * m4/mbswidth.m4 (gl_MBSDWIDTH): Move wcwidth from here...
        * m4/wcwidth.m4 (gl_FUNC_WCWIDTH): ...to this new file.

        2006-06-22  Simon Josefsson  <address@hidden>

        * m4/sockpfaf.m4: Include winsock2.h too, to make it work under
        MinGW.

        2006-06-21  Simon Josefsson  <address@hidden>

        * m4/getaddrinfo.m4: Don't define WINVER.  Look for gethostbyname in
        -lws2_32 too.  Fixes getaddrinfo on Windows 2000, with the price
        of using the (limited) gnulib implementation on Windows XP.

        2006-06-17  Bruno Haible  <address@hidden>

        * m4/setenv.m4 (gl_PREREQ_SETENV, gl_PREREQ_UNSETENV): Remove test
        whether errno is declared. Assume <errno.h> declares errno.

        2006-06-16  Eric Blake  <address@hidden>

        * m4/rmdir-errno.m4 (gl_FUNC_FMDIR_NOTEMPTY): Assume errno.h declares
        errno.

        2006-06-15  Eric Blake  <address@hidden>

        * m4/ssize_t.m4 (gt_TYPE_SSIZE_T): Work in spite of -Werror.

        2006-04-20  Bruno Haible  <address@hidden>

        * m4/getpass.m4 (gl_PREREQ_GETPASS):
        Don't call AC_CHECK_DECLS_ONCE with more than
        one argument, so that the code will be portable to Autoconf 2.60.
        * m4/unlocked-io.m4 (gl_FUNC_GLIBC_UNLOCKED_IO): Likewise.

        2006-03-15  Eric Blake  <address@hidden>

        * m4/dirfd.m4 (gl_FUNC_DIRFD): Use AC_REQUIRE for AC_HEADER_DIRENT.

Index: lib/Makefile.am
===================================================================
RCS file: /fetish/cu/lib/Makefile.am,v
retrieving revision 1.245
diff -p -u -r1.245 Makefile.am
--- lib/Makefile.am     2 Jul 2006 07:08:50 -0000       1.245
+++ lib/Makefile.am     4 Jul 2006 05:11:11 -0000
@@ -42,11 +42,13 @@ libcoreutils_a_SOURCES = \
   mbswidth.c mbswidth.h \
   mbuiter.h \
   readtokens0.c readtokens0.h \
+  setenv.h \
   strcase.h \
   strnlen1.c strnlen1.h \
   strstr.h \
   unicodeio.c unicodeio.h \
   verify.h \
+  wcwidth.h \
   xalloc-die.c \
   xgethostname.c xgethostname.h \
   xmemcoll.c xmemcoll.h \
Index: lib/alloca_.h
===================================================================
RCS file: /fetish/cu/lib/alloca_.h,v
retrieving revision 1.6
diff -p -u -r1.6 alloca_.h
--- lib/alloca_.h       14 May 2005 07:58:06 -0000      1.6
+++ lib/alloca_.h       4 Jul 2006 05:11:11 -0000
@@ -1,6 +1,6 @@
 /* Memory allocation on the stack.
 
-   Copyright (C) 1995, 1999, 2001, 2002, 2003, 2004 Free Software
+   Copyright (C) 1995, 1999, 2001, 2002, 2003, 2004, 2006 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
@@ -34,19 +34,21 @@
        request, the program just crashes.
  */
 
-#ifdef __GNUC__
-# define alloca __builtin_alloca
-#elif defined _AIX
-# define alloca __alloca
-#elif defined _MSC_VER
-# include <malloc.h>
-# define alloca _alloca
-#else
-# include <stddef.h>
-# ifdef  __cplusplus
+#ifndef alloca
+# ifdef __GNUC__
+#  define alloca __builtin_alloca
+# elif defined _AIX
+#  define alloca __alloca
+# elif defined _MSC_VER
+#  include <malloc.h>
+#  define alloca _alloca
+# else
+#  include <stddef.h>
+#  ifdef  __cplusplus
 extern "C"
-# endif
+#  endif
 void *alloca (size_t);
+# endif
 #endif
 
 #endif /* _GNULIB_ALLOCA_H */
Index: lib/base64.c
===================================================================
RCS file: /fetish/cu/lib/base64.c,v
retrieving revision 1.1
diff -p -u -r1.1 base64.c
--- lib/base64.c        27 Feb 2006 10:52:01 -0000      1.1
+++ lib/base64.c        4 Jul 2006 05:11:12 -0000
@@ -1,5 +1,6 @@
 /* base64.c -- Encode binary data using printable characters.
-   Copyright (C) 1999, 2000, 2001, 2004, 2005, 2006 Free Software Foundation, 
Inc.
+   Copyright (C) 1999, 2000, 2001, 2004, 2005, 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
@@ -73,7 +74,7 @@ base64_encode (const char *restrict in, 
 
   while (inlen && outlen)
     {
-      *out++ = b64str[to_uchar (in[0]) >> 2];
+      *out++ = b64str[(to_uchar (in[0]) >> 2) & 0x3f];
       if (!--outlen)
        break;
       *out++ = b64str[((to_uchar (in[0]) << 4)
@@ -108,8 +109,8 @@ base64_encode (const char *restrict in, 
    return, the OUT variable will hold a pointer to newly allocated
    memory that must be deallocated by the caller.  If output string
    length would overflow, 0 is returned and OUT is set to NULL.  If
-   memory allocation fail, OUT is set to NULL, and the return value
-   indicate length of the requested memory block, i.e.,
+   memory allocation failed, OUT is set to NULL, and the return value
+   indicates length of the requested memory block, i.e.,
    BASE64_LENGTH(inlen) + 1. */
 size_t
 base64_encode_alloc (const char *in, size_t inlen, char **out)
@@ -135,8 +136,10 @@ base64_encode_alloc (const char *in, siz
     }
 
   *out = malloc (outlen);
-  if (*out)
-    base64_encode (in, inlen, *out, outlen);
+  if (!*out)
+    return outlen;
+
+  base64_encode (in, inlen, *out, outlen);
 
   return outlen - 1;
 }
@@ -146,72 +149,75 @@ base64_encode_alloc (const char *in, siz
    Base64 alphabet (A-Za-z0-9+/) are encoded in 0..255.  POSIX
    1003.1-2001 require that char and unsigned char are 8-bit
    quantities, though, taking care of that problem.  But this may be a
-   potential problem on non-POSIX C99 platforms.  */
-#define B64(x)                                 \
-  ((x) == 'A' ? 0                              \
-   : (x) == 'B' ? 1                            \
-   : (x) == 'C' ? 2                            \
-   : (x) == 'D' ? 3                            \
-   : (x) == 'E' ? 4                            \
-   : (x) == 'F' ? 5                            \
-   : (x) == 'G' ? 6                            \
-   : (x) == 'H' ? 7                            \
-   : (x) == 'I' ? 8                            \
-   : (x) == 'J' ? 9                            \
-   : (x) == 'K' ? 10                           \
-   : (x) == 'L' ? 11                           \
-   : (x) == 'M' ? 12                           \
-   : (x) == 'N' ? 13                           \
-   : (x) == 'O' ? 14                           \
-   : (x) == 'P' ? 15                           \
-   : (x) == 'Q' ? 16                           \
-   : (x) == 'R' ? 17                           \
-   : (x) == 'S' ? 18                           \
-   : (x) == 'T' ? 19                           \
-   : (x) == 'U' ? 20                           \
-   : (x) == 'V' ? 21                           \
-   : (x) == 'W' ? 22                           \
-   : (x) == 'X' ? 23                           \
-   : (x) == 'Y' ? 24                           \
-   : (x) == 'Z' ? 25                           \
-   : (x) == 'a' ? 26                           \
-   : (x) == 'b' ? 27                           \
-   : (x) == 'c' ? 28                           \
-   : (x) == 'd' ? 29                           \
-   : (x) == 'e' ? 30                           \
-   : (x) == 'f' ? 31                           \
-   : (x) == 'g' ? 32                           \
-   : (x) == 'h' ? 33                           \
-   : (x) == 'i' ? 34                           \
-   : (x) == 'j' ? 35                           \
-   : (x) == 'k' ? 36                           \
-   : (x) == 'l' ? 37                           \
-   : (x) == 'm' ? 38                           \
-   : (x) == 'n' ? 39                           \
-   : (x) == 'o' ? 40                           \
-   : (x) == 'p' ? 41                           \
-   : (x) == 'q' ? 42                           \
-   : (x) == 'r' ? 43                           \
-   : (x) == 's' ? 44                           \
-   : (x) == 't' ? 45                           \
-   : (x) == 'u' ? 46                           \
-   : (x) == 'v' ? 47                           \
-   : (x) == 'w' ? 48                           \
-   : (x) == 'x' ? 49                           \
-   : (x) == 'y' ? 50                           \
-   : (x) == 'z' ? 51                           \
-   : (x) == '0' ? 52                           \
-   : (x) == '1' ? 53                           \
-   : (x) == '2' ? 54                           \
-   : (x) == '3' ? 55                           \
-   : (x) == '4' ? 56                           \
-   : (x) == '5' ? 57                           \
-   : (x) == '6' ? 58                           \
-   : (x) == '7' ? 59                           \
-   : (x) == '8' ? 60                           \
-   : (x) == '9' ? 61                           \
-   : (x) == '+' ? 62                           \
-   : (x) == '/' ? 63                           \
+   potential problem on non-POSIX C99 platforms.
+
+   IBM C V6 for AIX mishandles "#define B64(x) ...'x'...", so use "_"
+   as the formal parameter rather than "x".  */
+#define B64(_)                                 \
+  ((_) == 'A' ? 0                              \
+   : (_) == 'B' ? 1                            \
+   : (_) == 'C' ? 2                            \
+   : (_) == 'D' ? 3                            \
+   : (_) == 'E' ? 4                            \
+   : (_) == 'F' ? 5                            \
+   : (_) == 'G' ? 6                            \
+   : (_) == 'H' ? 7                            \
+   : (_) == 'I' ? 8                            \
+   : (_) == 'J' ? 9                            \
+   : (_) == 'K' ? 10                           \
+   : (_) == 'L' ? 11                           \
+   : (_) == 'M' ? 12                           \
+   : (_) == 'N' ? 13                           \
+   : (_) == 'O' ? 14                           \
+   : (_) == 'P' ? 15                           \
+   : (_) == 'Q' ? 16                           \
+   : (_) == 'R' ? 17                           \
+   : (_) == 'S' ? 18                           \
+   : (_) == 'T' ? 19                           \
+   : (_) == 'U' ? 20                           \
+   : (_) == 'V' ? 21                           \
+   : (_) == 'W' ? 22                           \
+   : (_) == 'X' ? 23                           \
+   : (_) == 'Y' ? 24                           \
+   : (_) == 'Z' ? 25                           \
+   : (_) == 'a' ? 26                           \
+   : (_) == 'b' ? 27                           \
+   : (_) == 'c' ? 28                           \
+   : (_) == 'd' ? 29                           \
+   : (_) == 'e' ? 30                           \
+   : (_) == 'f' ? 31                           \
+   : (_) == 'g' ? 32                           \
+   : (_) == 'h' ? 33                           \
+   : (_) == 'i' ? 34                           \
+   : (_) == 'j' ? 35                           \
+   : (_) == 'k' ? 36                           \
+   : (_) == 'l' ? 37                           \
+   : (_) == 'm' ? 38                           \
+   : (_) == 'n' ? 39                           \
+   : (_) == 'o' ? 40                           \
+   : (_) == 'p' ? 41                           \
+   : (_) == 'q' ? 42                           \
+   : (_) == 'r' ? 43                           \
+   : (_) == 's' ? 44                           \
+   : (_) == 't' ? 45                           \
+   : (_) == 'u' ? 46                           \
+   : (_) == 'v' ? 47                           \
+   : (_) == 'w' ? 48                           \
+   : (_) == 'x' ? 49                           \
+   : (_) == 'y' ? 50                           \
+   : (_) == 'z' ? 51                           \
+   : (_) == '0' ? 52                           \
+   : (_) == '1' ? 53                           \
+   : (_) == '2' ? 54                           \
+   : (_) == '3' ? 55                           \
+   : (_) == '4' ? 56                           \
+   : (_) == '5' ? 57                           \
+   : (_) == '6' ? 58                           \
+   : (_) == '7' ? 59                           \
+   : (_) == '8' ? 60                           \
+   : (_) == '9' ? 61                           \
+   : (_) == '+' ? 62                           \
+   : (_) == '/' ? 63                           \
    : -1)
 
 static const signed char b64[0x100] = {
@@ -287,6 +293,9 @@ static const signed char b64[0x100] = {
 # define uchar_in_range(c) ((c) <= 255)
 #endif
 
+/* Return true if CH is a character from the Base64 alphabet, and
+   false otherwise.  Note that '=' is padding and not considered to be
+   part of the alphabet.  */
 bool
 isbase64 (char ch)
 {
@@ -299,7 +308,9 @@ isbase64 (char ch)
    otherwise.  If *OUTLEN is too small, as many bytes as possible will
    be written to OUT.  On return, *OUTLEN holds the length of decoded
    bytes in OUT.  Note that as soon as any non-alphabet characters are
-   encountered, decoding is stopped and false is returned. */
+   encountered, decoding is stopped and false is returned.  This means
+   that, when applicable, you must remove any line terminators that is
+   part of the data stream before calling this function.  */
 bool
 base64_decode (const char *restrict in, size_t inlen,
               char *restrict out, size_t *outlen)
@@ -381,11 +392,11 @@ base64_decode (const char *restrict in, 
    size of the decoded data is stored in *OUTLEN.  OUTLEN may be NULL,
    if the caller is not interested in the decoded length.  *OUT may be
    NULL to indicate an out of memory error, in which case *OUTLEN
-   contain the size of the memory block needed.  The function return
+   contains the size of the memory block needed.  The function returns
    true on successful decoding and memory allocation errors.  (Use the
    *OUT and *OUTLEN parameters to differentiate between successful
-   decoding and memory error.)  The function return false if the input
-   was invalid, in which case *OUT is NULL and *OUTLEN is
+   decoding and memory error.)  The function returns false if the
+   input was invalid, in which case *OUT is NULL and *OUTLEN is
    undefined. */
 bool
 base64_decode_alloc (const char *in, size_t inlen, char **out,
Index: lib/exclude.c
===================================================================
RCS file: /fetish/cu/lib/exclude.c,v
retrieving revision 1.27
diff -p -u -r1.27 exclude.c
--- lib/exclude.c       2 Dec 2005 00:42:52 -0000       1.27
+++ lib/exclude.c       4 Jul 2006 05:11:12 -0000
@@ -1,7 +1,7 @@
 /* exclude.c -- exclude file names
 
    Copyright (C) 1992, 1993, 1994, 1997, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005 Free Software Foundation, Inc.
+   2004, 2005, 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
@@ -129,6 +129,24 @@ fnmatch_no_wildcards (char const *patter
     }
 }
 
+bool
+exclude_fnmatch (char const *pattern, char const *f, int options)
+{
+  int (*matcher) (char const *, char const *, int) =
+    (options & EXCLUDE_WILDCARDS
+     ? fnmatch
+     : fnmatch_no_wildcards);
+  bool matched = ((*matcher) (pattern, f, options) == 0);
+  char const *p;
+
+  if (! (options & EXCLUDE_ANCHORED))
+    for (p = f; *p && ! matched; p++)
+      if (*p == '/' && p[1] != '/')
+       matched = ((*matcher) (pattern, p + 1, options) == 0);
+
+  return matched;
+}
+
 /* Return true if EX excludes F.  */
 
 bool
@@ -154,21 +172,7 @@ excluded_file_name (struct exclude const
          char const *pattern = exclude[i].pattern;
          int options = exclude[i].options;
          if (excluded == !! (options & EXCLUDE_INCLUDE))
-           {
-             int (*matcher) (char const *, char const *, int) =
-               (options & EXCLUDE_WILDCARDS
-                ? fnmatch
-                : fnmatch_no_wildcards);
-             bool matched = ((*matcher) (pattern, f, options) == 0);
-             char const *p;
-
-             if (! (options & EXCLUDE_ANCHORED))
-               for (p = f; *p && ! matched; p++)
-                 if (*p == '/' && p[1] != '/')
-                   matched = ((*matcher) (pattern, p + 1, options) == 0);
-
-             excluded ^= matched;
-           }
+           excluded ^= exclude_fnmatch (pattern, f, options);
        }
 
       return excluded;
Index: lib/exclude.h
===================================================================
RCS file: /fetish/cu/lib/exclude.h,v
retrieving revision 1.10
diff -p -u -r1.10 exclude.h
--- lib/exclude.h       2 Jun 2005 05:02:38 -0000       1.10
+++ lib/exclude.h       4 Jul 2006 05:11:12 -0000
@@ -1,7 +1,7 @@
 /* exclude.h -- declarations for excluding file names
 
-   Copyright (C) 1992, 1993, 1994, 1997, 1999, 2001, 2002, 2003, 2005
-   Free Software Foundation, Inc.
+   Copyright (C) 1992, 1993, 1994, 1997, 1999, 2001, 2002, 2003, 2005,
+   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
@@ -41,3 +41,4 @@ void add_exclude (struct exclude *, char
 int add_exclude_file (void (*) (struct exclude *, char const *, int),
                      struct exclude *, char const *, int, char);
 bool excluded_file_name (struct exclude const *, char const *);
+bool exclude_fnmatch (char const *pattern, char const *f, int options);
Index: lib/getaddrinfo.c
===================================================================
RCS file: /fetish/cu/lib/getaddrinfo.c,v
retrieving revision 1.2
diff -p -u -r1.2 getaddrinfo.c
--- lib/getaddrinfo.c   23 Sep 2005 05:12:50 -0000      1.2
+++ lib/getaddrinfo.c   4 Jul 2006 05:11:12 -0000
@@ -1,5 +1,5 @@
 /* Get address information (partial implementation).
-   Copyright (C) 1997, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2001, 2002, 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
@@ -40,6 +40,56 @@
 
 #include "strdup.h"
 
+#if defined _WIN32 || defined __WIN32__
+# define WIN32_NATIVE
+#endif
+
+#ifdef WIN32_NATIVE
+typedef int WSAAPI (*getaddrinfo_func) (const char*, const char*,
+                                       const struct addrinfo*,
+                                       struct addrinfo**);
+typedef void WSAAPI (*freeaddrinfo_func) (struct addrinfo*);
+typedef int WSAAPI (*getnameinfo_func) (const struct sockaddr*,
+                                       socklen_t, char*, DWORD,
+                                       char*, DWORD, int);
+
+static getaddrinfo_func getaddrinfo_ptr = NULL;
+static freeaddrinfo_func freeaddrinfo_ptr = NULL;
+static getnameinfo_func getnameinfo_ptr = NULL;
+
+static int
+use_win32_p (void)
+{
+  static int done = 0;
+  HMODULE h;
+
+  if (done)
+    return getaddrinfo_ptr ? 1 : 0;
+
+  done = 1;
+
+  h = GetModuleHandle ("ws2_32.dll");
+
+  if (h)
+    {
+      getaddrinfo_ptr = GetProcAddress (h, "getaddrinfo");
+      freeaddrinfo_ptr = GetProcAddress (h, "freeaddrinfo");
+      getnameinfo_ptr = GetProcAddress (h, "getnameinfo");
+    }
+
+  /* If either is missing, something is odd. */
+  if (!getaddrinfo_ptr || !freeaddrinfo_ptr || !getnameinfo_ptr)
+    {
+      getaddrinfo_ptr = NULL;
+      freeaddrinfo_ptr = NULL;
+      getnameinfo_ptr = NULL;
+      return 0;
+    }
+
+  return 1;
+}
+#endif
+
 static inline bool
 validate_family (int family)
 {
@@ -66,7 +116,7 @@ getaddrinfo (const char *restrict nodena
             struct addrinfo **restrict res)
 {
   struct addrinfo *tmp;
-  struct servent *se = NULL;
+  int port = 0;
   struct hostent *he;
   void *storage;
   size_t size;
@@ -83,6 +133,11 @@ getaddrinfo (const char *restrict nodena
   };
 #endif
 
+#ifdef WIN32_NATIVE
+  if (use_win32_p ())
+    return getaddrinfo_ptr (nodename, servname, hints, res);
+#endif
+
   if (hints && (hints->ai_flags & ~AI_CANONNAME))
     /* FIXME: Support more flags. */
     return EAI_BADFLAGS;
@@ -101,14 +156,26 @@ getaddrinfo (const char *restrict nodena
 
   if (servname)
     {
+      struct servent *se = NULL;
       const char *proto =
        (hints && hints->ai_socktype == SOCK_DGRAM) ? "udp" : "tcp";
 
-      /* FIXME: Use getservbyname_r if available. */
-      se = getservbyname (servname, proto);
+      if (!(hints->ai_flags & AI_NUMERICSERV))
+       /* FIXME: Use getservbyname_r if available. */
+       se = getservbyname (servname, proto);
 
       if (!se)
-       return EAI_SERVICE;
+       {
+         char *c;
+         if (!(*servname >= '0' && *servname <= '9'))
+           return EAI_NONAME;
+         port = strtoul (servname, &c, 10);
+         if (*c || port > 0xffff)
+           return EAI_NONAME;
+         port = htons (port);
+       }
+      else
+       port = se->s_port;
     }
 
   /* FIXME: Use gethostbyname_r if available. */
@@ -147,8 +214,8 @@ getaddrinfo (const char *restrict nodena
        struct sockaddr_in6 *sinp = &p->sockaddr_in6;
        tmp = &p->addrinfo;
 
-       if (se)
-         sinp->sin6_port = se->s_port;
+       if (port)
+         sinp->sin6_port = port;
 
        if (he->h_length != sizeof (sinp->sin6_addr))
          {
@@ -171,8 +238,8 @@ getaddrinfo (const char *restrict nodena
        struct sockaddr_in *sinp = &p->sockaddr_in;
        tmp = &p->addrinfo;
 
-       if (se)
-         sinp->sin_port = se->s_port;
+       if (port)
+         sinp->sin_port = port;
 
        if (he->h_length != sizeof (sinp->sin_addr))
          {
@@ -212,6 +279,7 @@ getaddrinfo (const char *restrict nodena
   tmp->ai_protocol = (hints) ? hints->ai_protocol : 0;
   tmp->ai_socktype = (hints) ? hints->ai_socktype : 0;
   tmp->ai_addr->sa_family = he->h_addrtype;
+  tmp->ai_family = he->h_addrtype;
 
   /* FIXME: If more than one address, create linked list of addrinfo's. */
 
@@ -224,6 +292,11 @@ getaddrinfo (const char *restrict nodena
 void
 freeaddrinfo (struct addrinfo *ai)
 {
+#ifdef WIN32_NATIVE
+  if (use_win32_p ())
+    return freeaddrinfo_ptr (ai);
+#endif
+
   while (ai)
     {
       struct addrinfo *cur;
@@ -235,3 +308,87 @@ freeaddrinfo (struct addrinfo *ai)
       free (cur);
     }
 }
+
+int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
+               char *restrict node, socklen_t nodelen,
+               char *restrict service, socklen_t servicelen,
+               int flags)
+{
+#if WIN32_NATIVE
+  if (use_win32_p ())
+    return getnameinfo_ptr (sa, salen, node, nodelen,
+                           service, servicelen, flags);
+#endif
+
+  /* FIXME: Support other flags. */
+  if ((node && nodelen > 0 && !(flags & NI_NUMERICHOST)) ||
+      (service && servicelen > 0 && !(flags & NI_NUMERICHOST)) ||
+      (flags & ~(NI_NUMERICHOST|NI_NUMERICSERV)))
+    return EAI_BADFLAGS;
+
+  if (sa == NULL || salen < sizeof (sa->sa_family))
+    return EAI_FAMILY;
+
+  switch (sa->sa_family)
+    {
+#if HAVE_IPV4
+    case AF_INET:
+      if (salen < sizeof (struct sockaddr_in))
+       return EAI_FAMILY;
+      break;
+#endif
+#if HAVE_IPV6
+    case AF_INET6:
+      if (salen < sizeof (struct sockaddr_in6))
+       return EAI_FAMILY;
+      break;
+#endif
+    default:
+      return EAI_FAMILY;
+    }
+
+  if (node && nodelen > 0 && flags & NI_NUMERICHOST)
+    {
+      switch (sa->sa_family)
+       {
+#if HAVE_IPV4
+       case AF_INET:
+         if (!inet_ntop (AF_INET,
+                         &(((const struct sockaddr_in *) sa)->sin_addr),
+                         node, nodelen))
+           return EAI_SYSTEM;
+         break;
+#endif
+
+#if HAVE_IPV6
+       case AF_INET6:
+         if (!inet_ntop (AF_INET6,
+                         &(((const struct sockaddr_in6 *) sa)->sin6_addr),
+                         node, nodelen))
+           return EAI_SYSTEM;
+         break;
+#endif
+
+       default:
+         return EAI_FAMILY;
+       }
+    }
+
+  if (service && servicelen > 0 && flags & NI_NUMERICSERV)
+    switch (sa->sa_family)
+      {
+#if HAVE_IPV4
+      case AF_INET:
+#endif
+#if HAVE_IPV6
+      case AF_INET6:
+#endif
+       if (snprintf (service, servicelen, "%d",
+                     ntohs (((const struct sockaddr_in *) sa)->sin_port))
+           + 1 > servicelen)
+         return EAI_OVERFLOW;
+       break;
+      }
+
+  return 0;
+}
Index: lib/getaddrinfo.h
===================================================================
RCS file: /fetish/cu/lib/getaddrinfo.h,v
retrieving revision 1.6
diff -p -u -r1.6 getaddrinfo.h
--- lib/getaddrinfo.h   14 Feb 2006 23:09:00 -0000      1.6
+++ lib/getaddrinfo.h   4 Jul 2006 05:11:12 -0000
@@ -48,13 +48,26 @@ struct addrinfo
 
 /* Possible values for `ai_flags' field in `addrinfo' structure.  */
 # ifndef AI_PASSIVE
-#  define AI_PASSIVE   0x0001  /* Socket address is intended for `bind'.  */
-#  define AI_CANONNAME 0x0002  /* Request for canonical name.  */
+#  define AI_PASSIVE    0x0001 /* Socket address is intended for `bind'.  */
+# endif
+# ifndef AI_CANONNAME
+#  define AI_CANONNAME  0x0002 /* Request for canonical name.  */
+# endif
+# ifndef AI_NUMERICHOST
 #  define AI_NUMERICHOST 0x0004        /* Don't use name resolution.  */
-#  define AI_V4MAPPED  0x0008  /* IPv4 mapped addresses are acceptable.  */
-#  define AI_ALL       0x0010  /* Return IPv4 mapped and IPv6 addresses.  */
-#  define AI_ADDRCONFIG        0x0020  /* Use configuration of this host to 
choose
+# endif
+# ifndef AI_V4MAPPED
+#  define AI_V4MAPPED   0x0008 /* IPv4 mapped addresses are acceptable.  */
+# endif
+# ifndef AI_ALL
+#  define AI_ALL        0x0010 /* Return IPv4 mapped and IPv6 addresses.  */
+# endif
+# ifndef AI_ADDRCONFIG
+#  define AI_ADDRCONFIG         0x0020 /* Use configuration of this host to 
choose
                                   returned address type..  */
+#endif
+#ifndef AI_NUMERICSERV
+#  define AI_NUMERICSERV 0x0400        /* Don't use name resolution.  */
 # endif
 
 /* Error values for `getaddrinfo' function.  */
@@ -68,16 +81,17 @@ struct addrinfo
 #  define EAI_SOCKTYPE   -7    /* `ai_socktype' not supported.  */
 #  define EAI_SERVICE    -8    /* SERVICE not supported for `ai_socktype'.  */
 #  define EAI_MEMORY     -10   /* Memory allocation failure.  */
+#endif
+#ifndef EAI_OVERFLOW
+/* Not defined on mingw32. */
 #  define EAI_OVERFLOW   -12   /* Argument buffer overflow.  */
 #endif
 # ifndef EAI_ADDRFAMILY
-/* Not defined on mingw32.  XXX May be incorrect? Perhaps it is never
-   returned? */
+/* Not defined on mingw32. */
 #  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? */
+/* Not defined on mingw32. */
 #  define EAI_SYSTEM     -11   /* System error returned in `errno'.  */
 # endif
 
@@ -117,4 +131,15 @@ extern void freeaddrinfo (struct addrinf
 extern const char *gai_strerror (int ecode);
 # endif
 
+# if !HAVE_DECL_GETNAMEINFO
+/* Convert socket address to printable node and service names.
+   For more details, see the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/getnameinfo.html>.  */
+extern int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
+                      char *restrict node, socklen_t nodelen,
+                      char *restrict service, socklen_t servicelen,
+                      int flags);
+
+# endif
+
 #endif /* GETADDRINFO_H */
Index: lib/getpass.c
===================================================================
RCS file: /fetish/cu/lib/getpass.c,v
retrieving revision 1.11
diff -p -u -r1.11 getpass.c
--- lib/getpass.c       22 Sep 2005 06:44:26 -0000      1.11
+++ lib/getpass.c       4 Jul 2006 05:11:12 -0000
@@ -23,7 +23,7 @@
 
 #include <stdio.h>
 
-#if !defined _WIN32
+#if !((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__)
 
 #include <stdbool.h>
 
@@ -170,13 +170,17 @@ getpass (const char *prompt)
   return buf;
 }
 
-#else /* WIN32 */
+#else /* W32 native */
 
 /* Windows implementation by Martin Lambers <address@hidden>,
    improved by Simon Josefsson. */
 
 /* For PASS_MAX. */
 #include <limits.h>
+/* For _getch(). */
+#include <conio.h>
+/* For strdup(). */
+#include <string.h>
 
 #ifndef PASS_MAX
 # define PASS_MAX 512
Index: lib/getugroups.c
===================================================================
RCS file: /fetish/cu/lib/getugroups.c,v
retrieving revision 1.16
diff -p -u -r1.16 getugroups.c
--- lib/getugroups.c    22 Sep 2005 06:05:39 -0000      1.16
+++ lib/getugroups.c    4 Jul 2006 05:11:12 -0000
@@ -34,8 +34,7 @@
 # define EOVERFLOW EINVAL
 #endif
 
-/* setgrent, getgrent, and endgrent are not specified by POSIX.1,
-   so header files might not declare them.
+/* Some old header files might not declare setgrent, getgrent, and endgrent.
    If you don't have them at all, we can't implement this function.
    You lose!  */
 struct group *getgrent ();
Index: lib/mbchar.h
===================================================================
RCS file: /fetish/cu/lib/mbchar.h,v
retrieving revision 1.1
diff -p -u -r1.1 mbchar.h
--- lib/mbchar.h        22 Sep 2005 06:22:44 -0000      1.1
+++ lib/mbchar.h        4 Jul 2006 05:11:12 -0000
@@ -1,5 +1,5 @@
 /* Multibyte character data type.
-   Copyright (C) 2001, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2005-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
@@ -158,6 +158,8 @@
 
 #include <wctype.h>
 
+#include "wcwidth.h"
+
 #define MBCHAR_BUF_SIZE 24
 
 struct mbchar
Index: lib/mbswidth.c
===================================================================
RCS file: /fetish/cu/lib/mbswidth.c,v
retrieving revision 1.13
diff -p -u -r1.13 mbswidth.c
--- lib/mbswidth.c      14 May 2005 07:58:06 -0000      1.13
+++ lib/mbswidth.c      4 Jul 2006 05:11:12 -0000
@@ -1,5 +1,5 @@
 /* Determine the number of screen columns needed for a string.
-   Copyright (C) 2000-2005 Free Software Foundation, Inc.
+   Copyright (C) 2000-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
@@ -32,7 +32,7 @@
 /* Get isprint().  */
 #include <ctype.h>
 
-/* Get mbstate_t, mbrtowc(), mbsinit(), wcwidth().  */
+/* Get mbstate_t, mbrtowc(), mbsinit().  */
 #if HAVE_WCHAR_H
 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
    <wchar.h>.
@@ -43,13 +43,13 @@
 # include <wchar.h>
 #endif
 
-/* Get iswprint(), iswcntrl().  */
+/* Get wcwidth().  */
+#include "wcwidth.h"
+
+/* Get iswcntrl().  */
 #if HAVE_WCTYPE_H
 # include <wctype.h>
 #endif
-#if !defined iswprint && !HAVE_ISWPRINT
-# define iswprint(wc) 1
-#endif
 #if !defined iswcntrl && !HAVE_ISWCNTRL
 # define iswcntrl(wc) 0
 #endif
@@ -60,21 +60,6 @@
 # endif
 #endif
 
-#ifndef HAVE_DECL_WCWIDTH
-"this configure-time declaration test was not run"
-#endif
-#if !HAVE_DECL_WCWIDTH
-int wcwidth ();
-#endif
-
-#ifndef wcwidth
-# if !HAVE_WCWIDTH
-/* wcwidth doesn't exist, so assume all printable characters have
-   width 1.  */
-#  define wcwidth(wc) ((wc) == 0 ? 0 : iswprint (wc) ? 1 : -1)
-# endif
-#endif
-
 /* Get ISPRINT.  */
 #if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
 # define IN_CTYPE_DOMAIN(c) 1
Index: lib/sha1.c
===================================================================
RCS file: /fetish/cu/lib/sha1.c,v
retrieving revision 1.12
diff -p -u -r1.12 sha1.c
--- lib/sha1.c  11 May 2006 19:44:42 -0000      1.12
+++ lib/sha1.c  4 Jul 2006 05:11:12 -0000
@@ -270,10 +270,10 @@ sha1_process_bytes (const void *buffer, 
 /* --- Code below is the primary difference between md5.c and sha1.c --- */
 
 /* SHA1 round constants */
-#define K1 0x5a827999L
-#define K2 0x6ed9eba1L
-#define K3 0x8f1bbcdcL
-#define K4 0xca62c1d6L
+#define K1 0x5a827999
+#define K2 0x6ed9eba1
+#define K3 0x8f1bbcdc
+#define K4 0xca62c1d6
 
 /* Round functions.  Note that F2 is the same as F4.  */
 #define F1(B,C,D) ( D ^ ( B & ( C ^ D ) ) )
@@ -305,7 +305,7 @@ sha1_process_block (const void *buffer, 
   if (ctx->total[0] < len)
     ++ctx->total[1];
 
-#define rol(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
+#define rol(x, n) (((x) << (n)) | ((uint32_t) (x) >> (32 - (n))))
 
 #define M(I) ( tm =   x[I&0x0f] ^ x[(I-14)&0x0f] \
                    ^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \
Index: lib/strtod.c
===================================================================
RCS file: /fetish/cu/lib/strtod.c,v
retrieving revision 1.18
diff -p -u -r1.18 strtod.c
--- lib/strtod.c        22 Sep 2005 06:05:39 -0000      1.18
+++ lib/strtod.c        4 Jul 2006 05:11:12 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1997, 1999, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1997, 1999, 2003, 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
@@ -19,9 +19,6 @@
 #endif
 
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
 
 #include <ctype.h>
 
Index: lib/strtol.c
===================================================================
RCS file: /fetish/cu/lib/strtol.c,v
retrieving revision 1.23
diff -p -u -r1.23 strtol.c
--- lib/strtol.c        22 Sep 2005 06:05:39 -0000      1.23
+++ lib/strtol.c        4 Jul 2006 05:11:12 -0000
@@ -1,6 +1,6 @@
 /* Convert string representation of a number into an integer value.
 
-   Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2003, 2005
+   Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2003, 2005, 
2006
    Free Software Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with the GNU C
@@ -30,9 +30,6 @@
 
 #include <ctype.h>
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
 #ifndef __set_errno
 # define __set_errno(Val) errno = (Val)
 #endif
Index: lib/time_r.c
===================================================================
RCS file: /fetish/cu/lib/time_r.c,v
retrieving revision 1.4
diff -p -u -r1.4 time_r.c
--- lib/time_r.c        12 Mar 2006 08:06:00 -0000      1.4
+++ lib/time_r.c        4 Jul 2006 05:11:12 -0000
@@ -26,14 +26,6 @@
 
 #include <string.h>
 
-static char *
-copy_string_result (char *dest, char const *src)
-{
-  if (! src)
-    return 0;
-  return strcpy (dest, src);
-}
-
 static struct tm *
 copy_tm_result (struct tm *dest, struct tm const *src)
 {
Index: lib/unicodeio.c
===================================================================
RCS file: /fetish/cu/lib/unicodeio.c,v
retrieving revision 1.23
diff -p -u -r1.23 unicodeio.c
--- lib/unicodeio.c     14 May 2005 07:58:07 -0000      1.23
+++ lib/unicodeio.c     4 Jul 2006 05:11:12 -0000
@@ -1,6 +1,6 @@
 /* Unicode character output to streams with locale dependent encoding.
 
-   Copyright (C) 2000-2003, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2000-2003, 2005, 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
@@ -30,11 +30,7 @@
 
 #include <stdio.h>
 #include <string.h>
-
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
 
 #if HAVE_ICONV
 # include <iconv.h>
Index: m4/dirfd.m4
===================================================================
RCS file: /fetish/cu/m4/dirfd.m4,v
retrieving revision 1.18
diff -p -u -r1.18 dirfd.m4
--- m4/dirfd.m4 29 Jan 2005 00:16:39 -0000      1.18
+++ m4/dirfd.m4 4 Jul 2006 05:11:12 -0000
@@ -1,8 +1,9 @@
-#serial 10
+#serial 11   -*- Autoconf -*-
 
 dnl Find out how to get the file descriptor associated with an open DIR*.
 
-# Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software
+# Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -16,8 +17,8 @@ AC_DEFUN([gl_FUNC_DIRFD],
   dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
   AC_REQUIRE([AC_PROG_CPP])
   AC_REQUIRE([AC_PROG_EGREP])
+  AC_REQUIRE([AC_HEADER_DIRENT])
 
-  AC_HEADER_DIRENT
   dirfd_headers='
 #if HAVE_DIRENT_H
 # include <dirent.h>
@@ -55,7 +56,7 @@ AC_DEFUN([gl_FUNC_DIRFD],
              [how to get the file descriptor associated with an open DIR*],
                   gl_cv_sys_dir_fd_member_name,
       [
-        dirfd_save_CFLAGS=$CFLAGS
+       dirfd_save_CFLAGS=$CFLAGS
        for ac_expr in d_fd dd_fd; do
 
          CFLAGS="$CFLAGS -DDIR_FD_MEMBER_NAME=$ac_expr"
Index: m4/extensions.m4
===================================================================
RCS file: /fetish/cu/m4/extensions.m4,v
retrieving revision 1.9
diff -p -u -r1.9 extensions.m4
--- m4/extensions.m4    2 Mar 2006 03:42:49 -0000       1.9
+++ m4/extensions.m4    4 Jul 2006 05:11:12 -0000
@@ -5,6 +5,9 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# This file is only needed in autoconf <= 2.59.  Newer versions of autoconf
+# have a macro AC_USE_SYSTEM_EXTENSIONS with identical semantics.
+
 # gl_USE_SYSTEM_EXTENSIONS
 # ------------------------
 # Enable extensions on systems that normally disable them,
Index: m4/getaddrinfo.m4
===================================================================
RCS file: /fetish/cu/m4/getaddrinfo.m4,v
retrieving revision 1.12
diff -p -u -r1.12 getaddrinfo.m4
--- m4/getaddrinfo.m4   6 May 2006 14:17:21 -0000       1.12
+++ m4/getaddrinfo.m4   4 Jul 2006 05:11:12 -0000
@@ -1,4 +1,4 @@
-# getaddrinfo.m4 serial 9
+# getaddrinfo.m4 serial 10
 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,
@@ -6,7 +6,7 @@ dnl with or without modifications, as lo
 
 AC_DEFUN([gl_GETADDRINFO],
 [
-  AC_MSG_NOTICE([checking how to do getaddrinfo])
+  AC_MSG_NOTICE([checking how to do getaddrinfo, freeaddrinfo and getnameinfo])
 
   AC_SEARCH_LIBS(getaddrinfo, [nsl socket])
   AC_CHECK_FUNCS(getaddrinfo,, [
@@ -17,7 +17,6 @@ AC_DEFUN([gl_GETADDRINFO],
       LIBS="$LIBS -lws2_32"
       AC_TRY_LINK([
 #ifdef HAVE_WS2TCPIP_H
-#define WINVER 0x0501
 #include <ws2tcpip.h>
 #endif
 ], [getaddrinfo(0, 0, 0, 0);], gl_cv_w32_getaddrinfo=yes)
@@ -37,13 +36,29 @@ AC_DEFUN([gl_GETADDRINFO],
 AC_DEFUN([gl_PREREQ_GETADDRINFO], [
   AC_SEARCH_LIBS(gethostbyname, [inet nsl])
   AC_SEARCH_LIBS(getservbyname, [inet nsl socket xnet])
+  AC_CHECK_FUNCS(gethostbyname,, [
+    AC_CACHE_CHECK(for gethostbyname in winsock2.h and -lws2_32,
+                  gl_cv_w32_gethostbyname, [
+      gl_cv_w32_gethostbyname=no
+      am_save_LIBS="$LIBS"
+      LIBS="$LIBS -lws2_32"
+      AC_TRY_LINK([
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+], [gethostbyname(0);], gl_cv_w32_gethostbyname=yes)
+    LIBS="$am_save_LIBS"])
+    if test "$gl_cv_w32_gethostbyname" = "yes"; then
+      LIBS="$LIBS -lws2_32"
+    fi
+    ])
   AC_REQUIRE([gl_C_RESTRICT])
   AC_REQUIRE([gl_SOCKET_FAMILIES])
   AC_REQUIRE([gl_HEADER_SYS_SOCKET])
   AC_REQUIRE([AC_C_INLINE])
   AC_REQUIRE([AC_GNU_SOURCE])
   AC_CHECK_HEADERS_ONCE(netinet/in.h netdb.h)
-  AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror],,,[
+  AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[
   /* sys/types.h is not needed according to POSIX, but the
      sys/socket.h in i386-unknown-freebsd4.10 and
      powerpc-apple-darwin5.5 required it. */
@@ -55,7 +70,6 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
 #include <netdb.h>
 #endif
 #ifdef HAVE_WS2TCPIP_H
-#define WINVER 0x0501
 #include <ws2tcpip.h>
 #endif
 ])
@@ -68,7 +82,6 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
 #include <netdb.h>
 #endif
 #ifdef HAVE_WS2TCPIP_H
-#define WINVER 0x0501
 #include <ws2tcpip.h>
 #endif
 ])
Index: m4/getpass.m4
===================================================================
RCS file: /fetish/cu/m4/getpass.m4,v
retrieving revision 1.8
diff -p -u -r1.8 getpass.m4
--- m4/getpass.m4       22 Sep 2005 06:05:39 -0000      1.8
+++ m4/getpass.m4       4 Jul 2006 05:11:12 -0000
@@ -1,5 +1,5 @@
-# getpass.m4 serial 6
-dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc.
+# getpass.m4 serial 7
+dnl Copyright (C) 2002-2003, 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.
@@ -37,5 +37,9 @@ AC_DEFUN([gl_FUNC_GETPASS_GNU],
 AC_DEFUN([gl_PREREQ_GETPASS], [
   AC_CHECK_HEADERS_ONCE(stdio_ext.h termios.h)
   AC_CHECK_FUNCS_ONCE(__fsetlocking tcgetattr tcsetattr)
-  AC_CHECK_DECLS_ONCE([fflush_unlocked flockfile fputs_unlocked funlockfile 
putc_unlocked])
+  AC_CHECK_DECLS_ONCE([fflush_unlocked])
+  AC_CHECK_DECLS_ONCE([flockfile])
+  AC_CHECK_DECLS_ONCE([fputs_unlocked])
+  AC_CHECK_DECLS_ONCE([funlockfile])
+  AC_CHECK_DECLS_ONCE([putc_unlocked])
 ])
Index: m4/longdouble.m4
===================================================================
RCS file: /fetish/cu/m4/longdouble.m4,v
retrieving revision 1.2
diff -p -u -r1.2 longdouble.m4
--- m4/longdouble.m4    22 Jan 2005 06:25:53 -0000      1.2
+++ m4/longdouble.m4    4 Jul 2006 05:11:12 -0000
@@ -1,5 +1,5 @@
-# longdouble.m4 serial 1 (gettext-0.12)
-dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
+# longdouble.m4 serial 2 (gettext-0.15)
+dnl Copyright (C) 2002-2003, 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.
@@ -8,6 +8,9 @@ dnl From Bruno Haible.
 dnl Test whether the compiler supports the 'long double' type.
 dnl Prerequisite: AC_PROG_CC
 
+dnl This file is only needed in autoconf <= 2.59.  Newer versions of autoconf
+dnl have a macro AC_TYPE_LONG_DOUBLE with identical semantics.
+
 AC_DEFUN([gt_TYPE_LONGDOUBLE],
 [
   AC_CACHE_CHECK([for long double], gt_cv_c_long_double,
Index: m4/mbswidth.m4
===================================================================
RCS file: /fetish/cu/m4/mbswidth.m4,v
retrieving revision 1.12
diff -p -u -r1.12 mbswidth.m4
--- m4/mbswidth.m4      22 Jan 2005 06:25:53 -0000      1.12
+++ m4/mbswidth.m4      4 Jul 2006 05:11:12 -0000
@@ -1,5 +1,5 @@
-# mbswidth.m4 serial 11
-dnl Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc.
+# mbswidth.m4 serial 12
+dnl Copyright (C) 2000-2002, 2004, 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.
@@ -9,33 +9,11 @@ dnl From Bruno Haible.
 
 AC_DEFUN([gl_MBSWIDTH],
 [
-  AC_CHECK_HEADERS_ONCE(wchar.h wctype.h)
-  AC_CHECK_FUNCS_ONCE(isascii iswprint mbsinit)
-  AC_CHECK_FUNCS(iswcntrl wcwidth)
+  AC_CHECK_HEADERS_ONCE([wchar.h wctype.h])
+  AC_CHECK_FUNCS_ONCE([isascii mbsinit])
+  AC_CHECK_FUNCS([iswcntrl])
   gl_FUNC_MBRTOWC
 
-  AC_CACHE_CHECK([whether wcwidth is declared], ac_cv_have_decl_wcwidth,
-    [AC_TRY_COMPILE([
-/* AIX 3.2.5 declares wcwidth in <string.h>. */
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-#if HAVE_WCHAR_H
-# include <wchar.h>
-#endif
-], [
-#ifndef wcwidth
-  char *p = (char *) wcwidth;
-#endif
-], ac_cv_have_decl_wcwidth=yes, ac_cv_have_decl_wcwidth=no)])
-  if test $ac_cv_have_decl_wcwidth = yes; then
-    ac_val=1
-  else
-    ac_val=0
-  fi
-  AC_DEFINE_UNQUOTED(HAVE_DECL_WCWIDTH, $ac_val,
-    [Define to 1 if you have the declaration of wcwidth(), and to 0 
otherwise.])
-
   dnl UnixWare 7.1.1 <wchar.h> has a declaration of a function mbswidth()
   dnl that clashes with ours.
   AC_CACHE_CHECK([whether mbswidth is declared in <wchar.h>],
Index: m4/prereq.m4
===================================================================
RCS file: /fetish/cu/m4/prereq.m4,v
retrieving revision 1.125
diff -p -u -r1.125 prereq.m4
--- m4/prereq.m4        1 Jul 2006 00:08:05 -0000       1.125
+++ m4/prereq.m4        4 Jul 2006 05:11:12 -0000
@@ -95,6 +95,7 @@ AC_DEFUN([gl_PREREQ],
   AC_REQUIRE([gl_FUNC_TZSET_CLOBBER])
   AC_REQUIRE([gl_FUNC_VASNPRINTF])
   AC_REQUIRE([gl_FUNC_VASPRINTF])
+  AC_REQUIRE([gl_FUNC_WCWIDTH])
   AC_REQUIRE([gl_GETDATE])
   AC_REQUIRE([gl_GETHRXTIME])
   AC_REQUIRE([gl_GETNDELIM2])
Index: m4/rmdir-errno.m4
===================================================================
RCS file: /fetish/cu/m4/rmdir-errno.m4,v
retrieving revision 1.6
diff -p -u -r1.6 rmdir-errno.m4
--- m4/rmdir-errno.m4   24 Apr 2006 07:40:00 -0000      1.6
+++ m4/rmdir-errno.m4   4 Jul 2006 05:11:12 -0000
@@ -1,4 +1,4 @@
-#serial 6
+#serial 7
 
 # Copyright (C) 2000, 2001, 2005, 2006 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -21,9 +21,6 @@ AC_DEFUN([gl_FUNC_RMDIR_NOTEMPTY],
       AC_TRY_RUN([
 #include <stdio.h>
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
        int main ()
        {
          FILE *s;
Index: m4/setenv.m4
===================================================================
RCS file: /fetish/cu/m4/setenv.m4,v
retrieving revision 1.5
diff -p -u -r1.5 setenv.m4
--- m4/setenv.m4        29 Jan 2005 00:16:39 -0000      1.5
+++ m4/setenv.m4        4 Jul 2006 05:11:12 -0000
@@ -1,13 +1,11 @@
 # setenv.m4 serial 6
-dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2004, 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([gt_FUNC_SETENV],
 [
-  AC_LIBSOURCES([setenv.c, unsetenv.c, setenv.h])
-
   AC_REPLACE_FUNCS(setenv unsetenv)
   if test $ac_cv_func_setenv = no; then
     gl_PREREQ_SETENV
@@ -59,7 +57,6 @@ AC_DEFUN([gl_PREREQ_SETENV],
   AC_CHECK_HEADERS_ONCE(unistd.h)
   AC_CHECK_HEADERS(search.h)
   AC_CHECK_FUNCS(tsearch)
-  gt_CHECK_VAR_DECL([#include <errno.h>], errno)
   gt_CHECK_VAR_DECL([#include <unistd.h>], environ)
 ])
 
@@ -67,6 +64,5 @@ AC_DEFUN([gl_PREREQ_SETENV],
 AC_DEFUN([gl_PREREQ_UNSETENV],
 [
   AC_CHECK_HEADERS_ONCE(unistd.h)
-  gt_CHECK_VAR_DECL([#include <errno.h>], errno)
   gt_CHECK_VAR_DECL([#include <unistd.h>], environ)
 ])
Index: m4/sockpfaf.m4
===================================================================
RCS file: /fetish/cu/m4/sockpfaf.m4,v
retrieving revision 1.1
diff -p -u -r1.1 sockpfaf.m4
--- m4/sockpfaf.m4      22 Sep 2005 06:22:44 -0000      1.1
+++ m4/sockpfaf.m4      4 Jul 2006 05:11:12 -0000
@@ -1,5 +1,5 @@
-# sockpfaf.m4 serial 2
-dnl Copyright (C) 2004 Free Software Foundation, Inc.
+# sockpfaf.m4 serial 3
+dnl Copyright (C) 2004, 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.
@@ -13,11 +13,20 @@ dnl From Bruno Haible.
 
 AC_DEFUN([gl_SOCKET_FAMILIES],
 [
+  AC_CHECK_HEADERS_ONCE(sys/socket.h netinet/in.h winsock2.h)
+
   AC_MSG_CHECKING(for IPv4 sockets)
   AC_CACHE_VAL(gl_cv_socket_ipv4,
     [AC_TRY_COMPILE([#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
-#include <netinet/in.h>],
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif],
 [int x = AF_INET; struct in_addr y; struct sockaddr_in z;],
        gl_cv_socket_ipv4=yes, gl_cv_socket_ipv4=no)])
   AC_MSG_RESULT($gl_cv_socket_ipv4)
@@ -28,8 +37,15 @@ AC_DEFUN([gl_SOCKET_FAMILIES],
   AC_MSG_CHECKING(for IPv6 sockets)
   AC_CACHE_VAL(gl_cv_socket_ipv6,
     [AC_TRY_COMPILE([#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
-#include <netinet/in.h>],
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif],
 [int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z;],
        gl_cv_socket_ipv6=yes, gl_cv_socket_ipv6=no)])
   AC_MSG_RESULT($gl_cv_socket_ipv6)
Index: m4/ssize_t.m4
===================================================================
RCS file: /fetish/cu/m4/ssize_t.m4,v
retrieving revision 1.8
diff -p -u -r1.8 ssize_t.m4
--- m4/ssize_t.m4       22 Jan 2005 06:25:53 -0000      1.8
+++ m4/ssize_t.m4       4 Jul 2006 05:11:12 -0000
@@ -1,5 +1,5 @@
-# ssize_t.m4 serial 3 (gettext-0.13)
-dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
+# ssize_t.m4 serial 4 (gettext-0.15)
+dnl Copyright (C) 2001-2003, 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.
@@ -9,12 +9,13 @@ dnl Test whether ssize_t is defined.
 
 AC_DEFUN([gt_TYPE_SSIZE_T],
 [
-  AC_CACHE_CHECK([for ssize_t], gt_cv_ssize_t,
+  AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t],
     [AC_TRY_COMPILE([#include <sys/types.h>],
-       [int x = sizeof (ssize_t *) + sizeof (ssize_t);],
-       gt_cv_ssize_t=yes, gt_cv_ssize_t=no)])
+       [int x = sizeof (ssize_t *) + sizeof (ssize_t);
+        return !x;],
+       [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])])
   if test $gt_cv_ssize_t = no; then
-    AC_DEFINE(ssize_t, int,
+    AC_DEFINE([ssize_t], [int],
               [Define as a signed type of the same size as size_t.])
   fi
 ])
Index: m4/unlocked-io.m4
===================================================================
RCS file: /fetish/cu/m4/unlocked-io.m4,v
retrieving revision 1.6
diff -p -u -r1.6 unlocked-io.m4
--- m4/unlocked-io.m4   29 Jan 2005 00:16:39 -0000      1.6
+++ m4/unlocked-io.m4   4 Jul 2006 05:11:12 -0000
@@ -1,7 +1,7 @@
-# unlocked-io.m4 serial 12
+# unlocked-io.m4 serial 13
 
-# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
-# Foundation, Inc.
+# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+# Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -28,9 +28,17 @@ AC_DEFUN([gl_FUNC_GLIBC_UNLOCKED_IO],
   dnl fgets_unlocked(), fputs_unlocked() etc.
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
 
-  AC_CHECK_DECLS_ONCE(
-     [clearerr_unlocked feof_unlocked ferror_unlocked
-      fflush_unlocked fgets_unlocked fputc_unlocked fputs_unlocked
-      fread_unlocked fwrite_unlocked getc_unlocked
-      getchar_unlocked putc_unlocked putchar_unlocked])
+  AC_CHECK_DECLS_ONCE([clearerr_unlocked])
+  AC_CHECK_DECLS_ONCE([feof_unlocked])
+  AC_CHECK_DECLS_ONCE([ferror_unlocked])
+  AC_CHECK_DECLS_ONCE([fflush_unlocked])
+  AC_CHECK_DECLS_ONCE([fgets_unlocked])
+  AC_CHECK_DECLS_ONCE([fputc_unlocked])
+  AC_CHECK_DECLS_ONCE([fputs_unlocked])
+  AC_CHECK_DECLS_ONCE([fread_unlocked])
+  AC_CHECK_DECLS_ONCE([fwrite_unlocked])
+  AC_CHECK_DECLS_ONCE([getc_unlocked])
+  AC_CHECK_DECLS_ONCE([getchar_unlocked])
+  AC_CHECK_DECLS_ONCE([putc_unlocked])
+  AC_CHECK_DECLS_ONCE([putchar_unlocked])
 ])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]