[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CVS shishi/gl
From: |
shishi-commit |
Subject: |
CVS shishi/gl |
Date: |
Mon, 30 Jan 2006 11:48:17 +0100 |
Update of /home/cvs/shishi/gl
In directory dopio:/tmp/cvs-serv1749/gl
Modified Files:
gai_strerror.c getaddrinfo.h getopt.c socket_.h stdbool_.h
strndup.c strnlen.c vasnprintf.c
Log Message:
Update.
--- /home/cvs/shishi/gl/gai_strerror.c 2006/01/19 10:36:09 1.5
+++ /home/cvs/shishi/gl/gai_strerror.c 2006/01/30 10:48:17 1.6
@@ -44,9 +44,7 @@
}
values[] =
{
-#ifdef EAI_ADDRFAMILY
{ EAI_ADDRFAMILY, N_("Address family for hostname not supported") },
-#endif
{ EAI_AGAIN, N_("Temporary failure in name resolution") },
{ EAI_BADFLAGS, N_("Bad value for ai_flags") },
{ EAI_FAIL, N_("Non-recoverable failure in name resolution") },
@@ -56,9 +54,7 @@
{ EAI_NONAME, N_("Name or service not known") },
{ EAI_SERVICE, N_("Servname not supported for ai_socktype") },
{ EAI_SOCKTYPE, N_("ai_socktype not supported") },
-#ifdef EAI_ADDRFAMILY
{ EAI_SYSTEM, N_("System error") },
-#endif
#ifdef __USE_GNU
{ EAI_INPROGRESS, N_("Processing request in progress") },
{ EAI_CANCELED, N_("Request canceled") },
--- /home/cvs/shishi/gl/getaddrinfo.h 2006/01/19 10:36:09 1.7
+++ /home/cvs/shishi/gl/getaddrinfo.h 2006/01/30 10:48:17 1.8
@@ -26,9 +26,9 @@
# include <sys/types.h>
/* Get all getaddrinfo related declarations, if available. */
# include <sys/socket.h>
-# ifdef HAVE_NETDB_H
-# include <netdb.h>
-# endif
+#ifdef HAVE_NETDB_H
+# include <netdb.h>
+#endif
# ifndef HAVE_STRUCT_ADDRINFO
@@ -67,10 +67,18 @@
# define EAI_FAMILY -6 /* `ai_family' not supported. */
# define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */
# define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */
-# define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
# define EAI_MEMORY -10 /* Memory allocation failure. */
-# define EAI_SYSTEM -11 /* System error returned in `errno'. */
# define EAI_OVERFLOW -12 /* Argument buffer overflow. */
+#endif
+# ifndef EAI_ADDRFAMILY
+/* Not defined on mingw32. XXX May be incorrect? Perhaps it is never
+ returned? */
+# define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
+# endif
+# ifndef EAI_SYSTEM
+/* Not defined on mingw32. XXX May be incorrect? Perhaps it is never
+ returned? */
+# define EAI_SYSTEM -11 /* System error returned in `errno'. */
# endif
# ifdef __USE_GNU
--- /home/cvs/shishi/gl/getopt.c 2005/05/26 15:07:53 1.8
+++ /home/cvs/shishi/gl/getopt.c 2006/01/30 10:48:17 1.9
@@ -2,7 +2,7 @@
NOTE: getopt is now part of the C library, so if you don't know what
"Keep this file name-space clean" means, talk to address@hidden
before changing it!
- Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004
+ Copyright (C)
1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004,2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -20,28 +20,16 @@
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
- Ditto for AIX 3.2 and <stdlib.h>. */
-#ifndef _NO_PROTO
-# define _NO_PROTO
-#endif
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#include <stdio.h>
-
-/* This needs to come after some library #include
- to get __GNU_LIBRARY__ defined. */
-#ifdef __GNU_LIBRARY__
-/* Don't include stdlib.h for non-GNU C libraries because some of them
- contain conflicting prototypes for getopt. */
-# include <stdlib.h>
-# include <unistd.h>
-#endif /* GNU C library. */
+#include "getopt.h"
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#ifdef VMS
# include <unixlib.h>
@@ -76,7 +64,6 @@
GNU application programs can use a third alternative mode in which
they can distinguish the relative order of options and other arguments. */
-#include "getopt.h"
#include "getopt_int.h"
/* For communication from `getopt' to the caller.
@@ -118,16 +105,9 @@
static struct _getopt_data getopt_data;
-#ifndef __GNU_LIBRARY__
-
-/* Avoid depending on library functions or files
- whose names are inconsistent. */
-
-#ifndef getenv
+#if defined HAVE_DECL_GETENV && !HAVE_DECL_GETENV
extern char *getenv ();
#endif
-
-#endif /* not __GNU_LIBRARY__ */
#ifdef _LIBC
/* Stored original parameters.
@@ -556,10 +536,7 @@
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -634,10 +611,7 @@
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -674,10 +648,7 @@
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -751,10 +722,7 @@
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -817,10 +785,7 @@
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -868,10 +833,7 @@
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -940,10 +902,7 @@
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -985,10 +944,7 @@
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -1027,10 +983,7 @@
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -1101,10 +1054,7 @@
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
--- /home/cvs/shishi/gl/socket_.h 2006/01/19 10:36:09 1.1
+++ /home/cvs/shishi/gl/socket_.h 2006/01/30 10:48:17 1.2
@@ -28,6 +28,22 @@
we need. */
#if HAVE_WINSOCK2_H
+/* The following define makes sure we get all the prototypes from the
+ header files. getaddrinfo is only available if _WIN32_WINNT >=
+ 0x0501 (that symbol is set indiriectly through WINVER). This has
+ the following two (potential) problems:
+
+ 1) winsock2.h must not have been included before this symbol
+ is set (I think).
+
+ 2) There may be some _reason_ for all prototypes not being
+ available with the default settings. Such as if some APIs are
+ not available on older Windows hosts. However, getaddrinfo
+ (which need >= 0x0501) should be available on Windows 95 and
+ later, according to:
+
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/getaddrinfo_2.asp
+*/
+#define WINVER 0x0501
# include <winsock2.h>
#endif
#if HAVE_WS2TCPIP_H
@@ -35,14 +51,14 @@
#endif
/* For shutdown(). */
-#ifndef SHUT_RD
-# define SHUT_RD 0
+#if !defined SHUT_RD && defined SD_RECEIVE
+# define SHUT_RD SD_RECEIVE
#endif
-#ifndef SHUT_WR
-# define SHUT_WR 1
+#if !defined SHUT_WR && defined SD_SEND
+# define SHUT_WR SD_SEND
#endif
-#ifndef SHUT_RDWR
-# define SHUT_RDWR 2
+#if !defined SHUT_RDWR && defined SD_BOTH
+# define SHUT_RDWR SD_BOTH
#endif
#endif /* _SYS_SOCKET_H */
--- /home/cvs/shishi/gl/stdbool_.h 2005/05/26 15:07:54 1.3
+++ /home/cvs/shishi/gl/stdbool_.h 2006/01/30 10:48:17 1.4
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
Written by Bruno Haible <address@hidden>, 2001.
This program is free software; you can redistribute it and/or modify
@@ -70,18 +70,40 @@
(see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
(see ISO C 99 6.3.1.1.(2)). So we add a negative value to the
enum; this ensures that '_Bool' promotes to 'int'. */
-#if !(defined __cplusplus || defined __BEOS__)
+#if defined __cplusplus || defined __BEOS__
+ /* A compiler known to have 'bool'. */
+ /* If the compiler already has both 'bool' and '_Bool', we can assume they
+ are the same types. */
# if address@hidden@
-# if defined __SUNPRO_C && (__SUNPRO_C < 0x550 || __STDC__ == 1)
- /* Avoid stupid "warning: _Bool is a keyword in ISO C99". */
-# define _Bool signed char
+typedef bool _Bool;
+# endif
+#else
+# if !defined __GNUC__
+ /* If @HAVE__BOOL@:
+ Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when
+ the built-in _Bool type is used. See
+ http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+ http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+ http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
+ Similar bugs are likely with other compilers as well; this file
+ wouldn't be used if <stdbool.h> was working.
+ So we override the _Bool type.
+ If address@hidden@:
+ Need to define _Bool ourselves. As 'signed char' or as an enum type?
+ Use of a typedef, with SunPRO C, leads to a stupid
+ "warning: _Bool is a keyword in ISO C99".
+ Use of an enum type, with IRIX cc, leads to a stupid
+ "warning(1185): enumerated type mixed with another type".
+ The only benefit of the enum type, debuggability, is not important
+ with these compilers. So use 'signed char' and no typedef. */
+# define _Bool signed char
enum { false = 0, true = 1 };
-# else
+# else
+ /* With this compiler, trust the _Bool type if the compiler has it. */
+# if address@hidden@
typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
# endif
# endif
-#else
-typedef bool _Bool;
#endif
#define bool _Bool
--- /home/cvs/shishi/gl/strndup.c 2005/09/20 09:20:12 1.5
+++ /home/cvs/shishi/gl/strndup.c 2006/01/30 10:48:17 1.6
@@ -1,4 +1,5 @@
-/* Copyright (C) 1996, 1997, 1998, 2000, 2003, 2005 Free Software Foundation,
Inc.
+/* Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2005, 2006 Free
+ Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C
Library.
Bugs can be reported to address@hidden
@@ -20,12 +21,19 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+#if !_LIBC
+# include "strndup.h"
+#endif
#include <stdlib.h>
#include <string.h>
-/* Get strnlen. */
-#include "strnlen.h"
+#if !_LIBC
+# include "strnlen.h"
+# ifndef __strnlen
+# define __strnlen strnlen
+# endif
+#endif
#undef __strndup
#undef strndup
@@ -35,9 +43,11 @@
#endif
char *
-__strndup (const char *s, size_t n)
+__strndup (s, n)
+ const char *s;
+ size_t n;
{
- size_t len = strnlen (s, n);
+ size_t len = __strnlen (s, n);
char *new = malloc (len + 1);
if (new == NULL)
@@ -46,6 +56,9 @@
new[len] = '\0';
return memcpy (new, s, len);
}
+#ifdef libc_hidden_def
+libc_hidden_def (__strndup)
+#endif
#ifdef weak_alias
weak_alias (__strndup, strndup)
#endif
--- /home/cvs/shishi/gl/strnlen.c 2005/09/20 09:20:12 1.4
+++ /home/cvs/shishi/gl/strnlen.c 2006/01/30 10:48:17 1.5
@@ -1,6 +1,6 @@
/* Find the length of STRING, but scan at most MAXLEN characters.
- Copyright (C) 1996, 1997, 1998, 2000-2003 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+ Written by Simon Josefsson.
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
@@ -12,37 +12,22 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation,
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#undef strnlen
-#include <string.h>
-
-#undef __strnlen
-#undef strnlen
-
-#ifndef _LIBC
-# define strnlen rpl_strnlen
-#endif
-
-#ifndef weak_alias
-# define __strnlen strnlen
-#endif
+#include "strnlen.h"
/* Find the length of STRING, but scan at most MAXLEN characters.
If no '\0' terminator is found in that many characters, return MAXLEN. */
size_t
-__strnlen (const char *string, size_t maxlen)
+strnlen (const char *string, size_t maxlen)
{
const char *end = memchr (string, '\0', maxlen);
return end ? (size_t) (end - string) : maxlen;
}
-#ifdef weak_alias
-weak_alias (__strnlen, strnlen)
-#endif
--- /home/cvs/shishi/gl/vasnprintf.c 2005/05/26 15:07:54 1.10
+++ /home/cvs/shishi/gl/vasnprintf.c 2006/01/30 10:48:17 1.11
@@ -1,5 +1,5 @@
/* vsprintf with automatic memory allocation.
- Copyright (C) 1999, 2002-2005 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002-2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -334,28 +334,28 @@
tmp_length =
(unsigned int) (sizeof (unsigned long long) * CHAR_BIT
* 0.30103 /* binary -> decimal */
- * 2 /* estimate for FLAG_GROUP */
)
- + 1 /* turn floor into ceil */
- + 1; /* account for leading sign */
+ + 1; /* turn floor into ceil */
else
# endif
if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
tmp_length =
(unsigned int) (sizeof (unsigned long) * CHAR_BIT
* 0.30103 /* binary -> decimal */
- * 2 /* estimate for FLAG_GROUP */
)
- + 1 /* turn floor into ceil */
- + 1; /* account for leading sign */
+ + 1; /* turn floor into ceil */
else
tmp_length =
(unsigned int) (sizeof (unsigned int) * CHAR_BIT
* 0.30103 /* binary -> decimal */
- * 2 /* estimate for FLAG_GROUP */
)
- + 1 /* turn floor into ceil */
- + 1; /* account for leading sign */
+ + 1; /* turn floor into ceil */
+ if (tmp_length < precision)
+ tmp_length = precision;
+ /* Multiply by 2, as an estimate for FLAG_GROUP. */
+ tmp_length = xsum (tmp_length, tmp_length);
+ /* Add 1, to account for a leading sign. */
+ tmp_length = xsum (tmp_length, 1);
break;
case 'o':
@@ -365,8 +365,7 @@
(unsigned int) (sizeof (unsigned long long) * CHAR_BIT
* 0.333334 /* binary -> octal */
)
- + 1 /* turn floor into ceil */
- + 1; /* account for leading sign */
+ + 1; /* turn floor into ceil */
else
# endif
if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
@@ -374,15 +373,17 @@
(unsigned int) (sizeof (unsigned long) * CHAR_BIT
* 0.333334 /* binary -> octal */
)
- + 1 /* turn floor into ceil */
- + 1; /* account for leading sign */
+ + 1; /* turn floor into ceil */
else
tmp_length =
(unsigned int) (sizeof (unsigned int) * CHAR_BIT
* 0.333334 /* binary -> octal */
)
- + 1 /* turn floor into ceil */
- + 1; /* account for leading sign */
+ + 1; /* turn floor into ceil */
+ if (tmp_length < precision)
+ tmp_length = precision;
+ /* Add 1, to account for a leading sign. */
+ tmp_length = xsum (tmp_length, 1);
break;
case 'x': case 'X':
@@ -392,8 +393,7 @@
(unsigned int) (sizeof (unsigned long long) * CHAR_BIT
* 0.25 /* binary -> hexadecimal */
)
- + 1 /* turn floor into ceil */
- + 2; /* account for leading sign or alternate form */
+ + 1; /* turn floor into ceil */
else
# endif
if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
@@ -401,15 +401,17 @@
(unsigned int) (sizeof (unsigned long) * CHAR_BIT
* 0.25 /* binary -> hexadecimal */
)
- + 1 /* turn floor into ceil */
- + 2; /* account for leading sign or alternate form */
+ + 1; /* turn floor into ceil */
else
tmp_length =
(unsigned int) (sizeof (unsigned int) * CHAR_BIT
* 0.25 /* binary -> hexadecimal */
)
- + 1 /* turn floor into ceil */
- + 2; /* account for leading sign or alternate form */
+ + 1; /* turn floor into ceil */
+ if (tmp_length < precision)
+ tmp_length = precision;
+ /* Add 2, to account for a leading sign or alternate
form. */
+ tmp_length = xsum (tmp_length, 2);
break;
case 'f': case 'F':