summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2006-07-04 05:39:07 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2006-07-04 05:39:07 +0000
commit6a9740567292a983b05533901dc7a687ec2fb68c (patch)
tree942771c90c0eff8fc776a1b631e9032e60641ea7
parent8e19f6282b0621f63b47716bd2eadfb9d466c758 (diff)
downloadcoreutils-6a9740567292a983b05533901dc7a687ec2fb68c.tar.xz
Sync from gnulib.
-rw-r--r--lib/ChangeLog102
-rw-r--r--lib/alloca_.h26
-rw-r--r--lib/base64.c163
-rw-r--r--lib/exclude.c36
-rw-r--r--lib/exclude.h5
-rw-r--r--lib/getaddrinfo.c175
-rw-r--r--lib/getaddrinfo.h43
-rw-r--r--lib/getpass.c8
-rw-r--r--lib/getugroups.c3
-rw-r--r--lib/mbchar.h4
-rw-r--r--lib/mbswidth.c27
-rw-r--r--lib/sha1.c10
-rw-r--r--lib/strtod.c5
-rw-r--r--lib/strtol.c5
-rw-r--r--lib/time_r.c8
-rw-r--r--lib/unicodeio.c6
-rw-r--r--m4/ChangeLog55
-rw-r--r--m4/dirfd.m49
-rw-r--r--m4/extensions.m43
-rw-r--r--m4/getaddrinfo.m425
-rw-r--r--m4/getpass.m410
-rw-r--r--m4/longdouble.m47
-rw-r--r--m4/mbswidth.m432
-rw-r--r--m4/rmdir-errno.m45
-rw-r--r--m4/sockpfaf.m424
-rw-r--r--m4/ssize_t.m413
-rw-r--r--m4/unlocked-io.m424
27 files changed, 593 insertions, 240 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 6256a606c..c7a74e269 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,5 +1,107 @@
2006-07-03 Paul Eggert <eggert@cs.ucla.edu>
+ * Makefile.am (libcoreutils_a_SOURCES): Add setenv.h, wcwidth.h,
+ to accommodate sync from gnulib.
+
+ Sync from gnulib.
+
+ 2006-06-30 Jim Hyslop <jhyslop@dreampossible.ca> (tiny change)
+
+ * getaddrinfo.c: fixed typo
+
+ 2006-06-28 Bruno Haible <bruno@clisp.org>
+
+ * getaddrinfo.h: Fix POSIX URL.
+ * 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 <ebb9@byu.net>
+
+ * mbchar.h (wcwidth): Include wcwidth.h.
+ * mbswidth.c (wcwidth): Move from here...
+ * wcwidth.h: ...to this new file.
+
+ 2006-06-28 Simon Josefsson <jas@extundo.com>
+
+ * 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.
+
+ * 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 <eggert@cs.ucla.edu>
+
+ * 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 <jas@extundo.com>
+
+ * getaddrinfo.c (getaddrinfo): Set ai_family in the return
+ variable.
+
+ 2006-06-19 Paul Eggert <eggert@cs.ucla.edu>
+
+ * alloca_.h (alloca) [defined alloca]: Don't define or declare.
+
+ 2006-06-16 Eric Blake <ebb9@byu.net>
+
+ * unsetenv.c [!defined errno]: Assume errno.h declares errno.
+ * unicodeio.c [!defined errno]: Likewise.
+ * strtol.c [!defined errno]: Likewise.
+ * strtod.c [!defined errno]: Likewise.
+
+ 2006-05-26 Martin Lambers <marlam@marlam.de>
+
+ * getpass.c: Updates the test for the native W32 API, and adds
+ missing includes, thus fixing compilation warnings.
+
+ 2006-05-25 Sergey Poznyakoff <gray@gnu.org.ua>
+
+ * exclude.c (exclude_fnmatch): New function.
+ (excluded_file_name): Call exclude_fnmatch.
+ * exclude.h (excluded_file_name): New prototype
+
+ 2006-05-19 Jim Meyering <jim@meyering.net>
+
+ * getugroups.c: Correct an outdated comment. From Bruno Haible.
+
+ 2006-05-10 Paul Eggert <eggert@cs.ucla.edu>
+
+ * 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 <jas@extundo.com>
+
+ * base64.c: Fix problems reported by Eric Blake <ebb9@byu.net>,
+ including some doc fixes.
+ (base64_encode_alloc): Fix +1 bug on allocation failures.
+
+ 2006-03-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * 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 <ebb9@byu.net>
+
+ * time_r.c (copy_string_result): Remove, as it is no longer used.
+
+2006-07-03 Paul Eggert <eggert@cs.ucla.edu>
+
* stdint_.h: Include <sys/types.h> after @FULL_PATH_STDINT_H@, for
MacOS X 10.4.6. Don't mention <sys/int_types.h>. Problems
reported by Mark D. Baushke, one in
diff --git a/lib/alloca_.h b/lib/alloca_.h
index 3e3fdf43f..dd0b3e98f 100644
--- a/lib/alloca_.h
+++ b/lib/alloca_.h
@@ -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 */
diff --git a/lib/base64.c b/lib/base64.c
index 2a68952d7..3316d1c12 100644
--- a/lib/base64.c
+++ b/lib/base64.c
@@ -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, size_t inlen,
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, size_t inlen,
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, size_t inlen, char **out)
}
*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, size_t inlen, char **out)
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_t inlen,
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,
diff --git a/lib/exclude.c b/lib/exclude.c
index 6a0c14974..6bd7339f4 100644
--- a/lib/exclude.c
+++ b/lib/exclude.c
@@ -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 *pattern, char const *f, int options)
}
}
+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 *ex, char const *f)
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;
diff --git a/lib/exclude.h b/lib/exclude.h
index 6923efa5f..203e38485 100644
--- a/lib/exclude.h
+++ b/lib/exclude.h
@@ -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 const *, int);
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);
diff --git a/lib/getaddrinfo.c b/lib/getaddrinfo.c
index 7ea696778..2cba44387 100644
--- a/lib/getaddrinfo.c
+++ b/lib/getaddrinfo.c
@@ -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 <simon@josefsson.org>.
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 nodename,
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 nodename,
};
#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 nodename,
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 nodename,
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 nodename,
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 nodename,
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 nodename,
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;
+}
diff --git a/lib/getaddrinfo.h b/lib/getaddrinfo.h
index 7722c14ba..bbf71f22e 100644
--- a/lib/getaddrinfo.h
+++ b/lib/getaddrinfo.h
@@ -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 addrinfo *ai);
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 */
diff --git a/lib/getpass.c b/lib/getpass.c
index f0b3184ee..4e3339659 100644
--- a/lib/getpass.c
+++ b/lib/getpass.c
@@ -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 <marlam@marlam.de>,
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
diff --git a/lib/getugroups.c b/lib/getugroups.c
index 7aa540db7..dfcffd75f 100644
--- a/lib/getugroups.c
+++ b/lib/getugroups.c
@@ -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 ();
diff --git a/lib/mbchar.h b/lib/mbchar.h
index 4472aa020..738efd948 100644
--- a/lib/mbchar.h
+++ b/lib/mbchar.h
@@ -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
diff --git a/lib/mbswidth.c b/lib/mbswidth.c
index c9e78d650..ef8398a78 100644
--- a/lib/mbswidth.c
+++ b/lib/mbswidth.c
@@ -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
diff --git a/lib/sha1.c b/lib/sha1.c
index 509911d87..dadf97361 100644
--- a/lib/sha1.c
+++ b/lib/sha1.c
@@ -270,10 +270,10 @@ sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx)
/* --- 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, size_t len, struct sha1_ctx *ctx)
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] \
diff --git a/lib/strtod.c b/lib/strtod.c
index 7b48754e4..b8aab679e 100644
--- a/lib/strtod.c
+++ b/lib/strtod.c
@@ -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>
diff --git a/lib/strtol.c b/lib/strtol.c
index 9bfbe3c1a..eda2d2699 100644
--- a/lib/strtol.c
+++ b/lib/strtol.c
@@ -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
diff --git a/lib/time_r.c b/lib/time_r.c
index af845b499..412006372 100644
--- a/lib/time_r.c
+++ b/lib/time_r.c
@@ -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)
{
diff --git a/lib/unicodeio.c b/lib/unicodeio.c
index 83ed6d02f..f8fedb66c 100644
--- a/lib/unicodeio.c
+++ b/lib/unicodeio.c
@@ -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>
diff --git a/m4/ChangeLog b/m4/ChangeLog
index 17aa7dc72..3442635ce 100644
--- a/m4/ChangeLog
+++ b/m4/ChangeLog
@@ -1,3 +1,58 @@
+2006-07-03 Paul Eggert <eggert@cs.ucla.edu>
+
+ * prereq.m4 (gl_PREREQ): Require gl_FUNC_WCWIDTH, to accommodate
+ changes mentioned below.
+ * 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 <jas@extundo.com>
+
+ * getaddrinfo.m4: Look for getnameinfo prototypes too.
+
+ 2006-06-28 Eric Blake <ebb9@byu.net>
+
+ * mbswidth.m4 (gl_MBSDWIDTH): Move wcwidth from here...
+ * wcwidth.m4 (gl_FUNC_WCWIDTH): ...to this new file.
+
+ 2006-06-22 Simon Josefsson <jas@extundo.com>
+
+ * sockpfaf.m4: Include winsock2.h too, to make it work under
+ MinGW.
+
+ 2006-06-21 Simon Josefsson <jas@extundo.com>
+
+ * 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 <bruno@clisp.org>
+
+ * setenv.m4 (gl_PREREQ_SETENV, gl_PREREQ_UNSETENV): Remove test
+ whether errno is declared. Assume <errno.h> declares errno.
+
+ 2006-06-16 Eric Blake <ebb9@byu.net>
+
+ * rmdir-errno.m4 (gl_FUNC_FMDIR_NOTEMPTY): Assume errno.h declares
+ errno.
+
+ 2006-06-15 Eric Blake <ebb9@byu.net>
+
+ * ssize_t.m4 (gt_TYPE_SSIZE_T): Work in spite of -Werror.
+
+ 2006-04-20 Bruno Haible <bruno@clisp.org>
+
+ * 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.
+ * unlocked-io.m4 (gl_FUNC_GLIBC_UNLOCKED_IO): Likewise.
+
+ 2006-03-15 Eric Blake <ebb9@byu.net>
+
+ * dirfd.m4 (gl_FUNC_DIRFD): Use AC_REQUIRE for AC_HEADER_DIRENT.
+
2006-07-03 Jim Meyering <jim@meyering.net>
* ftruncate.m4 (gl_FUNC_FTRUNCATE): Adjust diagnostic to recommend
diff --git a/m4/dirfd.m4 b/m4/dirfd.m4
index db2a9a0ed..7c5cf9608 100644
--- a/m4/dirfd.m4
+++ b/m4/dirfd.m4
@@ -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"
diff --git a/m4/extensions.m4 b/m4/extensions.m4
index 51394b5c8..497607918 100644
--- a/m4/extensions.m4
+++ b/m4/extensions.m4
@@ -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,
diff --git a/m4/getaddrinfo.m4 b/m4/getaddrinfo.m4
index c36719078..8d57bb327 100644
--- a/m4/getaddrinfo.m4
+++ b/m4/getaddrinfo.m4
@@ -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 long as this notice is preserved.
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
])
diff --git a/m4/getpass.m4 b/m4/getpass.m4
index 3d7d33bbb..ba6815f61 100644
--- a/m4/getpass.m4
+++ b/m4/getpass.m4
@@ -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])
])
diff --git a/m4/longdouble.m4 b/m4/longdouble.m4
index 40cd7ce02..25590f470 100644
--- a/m4/longdouble.m4
+++ b/m4/longdouble.m4
@@ -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,
diff --git a/m4/mbswidth.m4 b/m4/mbswidth.m4
index 878e5311d..3cb200039 100644
--- a/m4/mbswidth.m4
+++ b/m4/mbswidth.m4
@@ -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>],
diff --git a/m4/rmdir-errno.m4 b/m4/rmdir-errno.m4
index c6b582947..2907e7b34 100644
--- a/m4/rmdir-errno.m4
+++ b/m4/rmdir-errno.m4
@@ -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;
diff --git a/m4/sockpfaf.m4 b/m4/sockpfaf.m4
index b224faec5..9e396ebaf 100644
--- a/m4/sockpfaf.m4
+++ b/m4/sockpfaf.m4
@@ -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)
diff --git a/m4/ssize_t.m4 b/m4/ssize_t.m4
index 19b379fee..4eaef93ce 100644
--- a/m4/ssize_t.m4
+++ b/m4/ssize_t.m4
@@ -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
])
diff --git a/m4/unlocked-io.m4 b/m4/unlocked-io.m4
index 6cbacb003..f58e96015 100644
--- a/m4/unlocked-io.m4
+++ b/m4/unlocked-io.m4
@@ -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])
])