[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Cvs-cvs] ccvs/lib ChangeLog Makefile.am Makefile.gnulib ...
From: |
Derek Robert Price |
Subject: |
[Cvs-cvs] ccvs/lib ChangeLog Makefile.am Makefile.gnulib ... |
Date: |
Thu, 29 Jun 2006 12:13:26 +0000 |
CVSROOT: /cvsroot/cvs
Module name: ccvs
Changes by: Derek Robert Price <dprice> 06/06/29 12:13:26
Modified files:
lib : ChangeLog Makefile.am Makefile.gnulib
Makefile.in getaddrinfo.c getaddrinfo.h
mbchar.h
Added files:
lib : inet_ntop.c inet_ntop.h wcwidth.h
Log message:
* inet_ntop.c, inet_ntop.h, wcwidth.h: New files from GNULIB.
* getaddrinfo.c, getaddrinfo.h, mbchar.h, Makefile.gnulib: Update from
GNULIB.
* Makefile.am: Update to match Makefile.gnulib.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/ChangeLog?cvsroot=cvs&r1=1.522&r2=1.523
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/Makefile.am?cvsroot=cvs&r1=1.113&r2=1.114
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/Makefile.gnulib?cvsroot=cvs&r1=1.76&r2=1.77
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/Makefile.in?cvsroot=cvs&r1=1.213&r2=1.214
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/getaddrinfo.c?cvsroot=cvs&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/getaddrinfo.h?cvsroot=cvs&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/mbchar.h?cvsroot=cvs&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/inet_ntop.c?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/inet_ntop.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/wcwidth.h?cvsroot=cvs&rev=1.1
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/ChangeLog,v
retrieving revision 1.522
retrieving revision 1.523
diff -u -b -r1.522 -r1.523
--- ChangeLog 27 Jun 2006 16:38:04 -0000 1.522
+++ ChangeLog 29 Jun 2006 12:13:26 -0000 1.523
@@ -1,3 +1,10 @@
+2006-06-29 Derek Price <address@hidden>
+
+ * inet_ntop.c, inet_ntop.h, wcwidth.h: New files from GNULIB.
+ * getaddrinfo.c, getaddrinfo.h, mbchar.h, Makefile.gnulib: Update from
+ GNULIB.
+ * Makefile.am: Update to match Makefile.gnulib.
+
2006-06-27 Mark D. Baushke <address@hidden>
* stdint_.h: Update from gnulib.
Index: Makefile.am
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/Makefile.am,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -b -r1.113 -r1.114
--- Makefile.am 26 Jun 2006 22:58:31 -0000 1.113
+++ Makefile.am 29 Jun 2006 12:13:26 -0000 1.114
@@ -223,6 +223,12 @@
## end gnulib module glob
+## begin gnulib module inet_ntop
+
+libcvs_a_SOURCES += inet_ntop.h
+
+## end gnulib module inet_ntop
+
## begin gnulib module intprops
EXTRA_DIST += intprops.h
@@ -436,6 +442,12 @@
## end gnulib module verify
+## begin gnulib module wcwidth
+
+libcvs_a_SOURCES += wcwidth.h
+
+## end gnulib module wcwidth
+
## begin gnulib module xalloc-die
libcvs_a_SOURCES += xalloc-die.c
Index: Makefile.gnulib
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/Makefile.gnulib,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -b -r1.76 -r1.77
--- Makefile.gnulib 26 Jun 2006 22:58:31 -0000 1.76
+++ Makefile.gnulib 29 Jun 2006 12:13:26 -0000 1.77
@@ -166,6 +166,12 @@
## end gnulib module glob
+## begin gnulib module inet_ntop
+
+libgnu_a_SOURCES += inet_ntop.h
+
+## end gnulib module inet_ntop
+
## begin gnulib module intprops
EXTRA_DIST += intprops.h
@@ -378,6 +384,12 @@
## end gnulib module verify
+## begin gnulib module wcwidth
+
+libgnu_a_SOURCES += wcwidth.h
+
+## end gnulib module wcwidth
+
## begin gnulib module xalloc-die
libgnu_a_SOURCES += xalloc-die.c
Index: Makefile.in
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/Makefile.in,v
retrieving revision 1.213
retrieving revision 1.214
diff -u -b -r1.213 -r1.214
--- Makefile.in 28 Jun 2006 20:50:54 -0000 1.213
+++ Makefile.in 29 Jun 2006 12:13:26 -0000 1.214
@@ -67,21 +67,22 @@
gethostname.c getline.c getline.h getlogin_r.c getlogin_r.h \
getndelim2.c getopt.c getopt1.c getpagesize.h getpass.c \
getpass.h gettime.c gettimeofday.c glob-libc.h glob.c glob_.h \
- intprops.h inttypes.h lstat.c lstat.h malloc.c mbchar.c md5.c \
- md5.h memchr.c memmove.c mempcpy.c mempcpy.h memrchr.c \
- memrchr.h mkdir.c mkdirat.c mkstemp.c mktime.c nanosleep.c \
- open-safer.c openat-die.c openat-priv.h openat.c openat.h \
- pagealign_alloc.c pagealign_alloc.h pathmax.h pipe-safer.c \
- printf-args.c printf-parse.c quotearg.c quotearg.h readlink.c \
- realloc.c regcomp.c regex.c regex.h regex_internal.c \
- regex_internal.h regexec.c rename.c rpmatch.c save-cwd.c \
- save-cwd.h setenv.c stat-macros.h strcasecmp.c strdup.c \
- strdup.h strerror.c strftime.c strftime.h strncasecmp.c \
- strstr.c strtoimax.c strtol.c strtoll.c strtoul.c strtoull.c \
- strtoumax.c sunos57-select.c tempname.c time_r.c time_r.h \
- timespec.h unistd--.h unistd-safer.h unlocked-io.h unsetenv.c \
- vasnprintf.c vasprintf.c waitpid.c xalloc.h xgetcwd.c \
- xgetcwd.h xmalloc.c xreadlink.c xreadlink.h yesno.c yesno.h
+ inet_ntop.c intprops.h inttypes.h lstat.c lstat.h malloc.c \
+ mbchar.c md5.c md5.h memchr.c memmove.c mempcpy.c mempcpy.h \
+ memrchr.c memrchr.h mkdir.c mkdirat.c mkstemp.c mktime.c \
+ nanosleep.c open-safer.c openat-die.c openat-priv.h openat.c \
+ openat.h pagealign_alloc.c pagealign_alloc.h pathmax.h \
+ pipe-safer.c printf-args.c printf-parse.c quotearg.c \
+ quotearg.h readlink.c realloc.c regcomp.c regex.c regex.h \
+ regex_internal.c regex_internal.h regexec.c rename.c rpmatch.c \
+ save-cwd.c save-cwd.h setenv.c stat-macros.h strcasecmp.c \
+ strdup.c strdup.h strerror.c strftime.c strftime.h \
+ strncasecmp.c strstr.c strtoimax.c strtol.c strtoll.c \
+ strtoul.c strtoull.c strtoumax.c sunos57-select.c tempname.c \
+ time_r.c time_r.h timespec.h unistd--.h unistd-safer.h \
+ unlocked-io.h unsetenv.c vasnprintf.c vasprintf.c waitpid.c \
+ xalloc.h xgetcwd.c xgetcwd.h xmalloc.c xreadlink.c xreadlink.h \
+ yesno.c yesno.h
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/_inttypes_h.m4 \
$(top_srcdir)/m4/acx_extract_cpp_defn.m4 \
@@ -114,20 +115,21 @@
$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gettime.m4 \
$(top_srcdir)/m4/gettimeofday.m4 $(top_srcdir)/m4/glob.m4 \
$(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/iconv.m4 \
- $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/intmax_t.m4 \
- $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lib-ld.m4 \
- $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
- $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \
- $(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/mbchar.m4 \
- $(top_srcdir)/m4/mbiter.m4 $(top_srcdir)/m4/mbrtowc.m4 \
- $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/md5.m4 \
- $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/memmove.m4 \
- $(top_srcdir)/m4/mempcpy.m4 $(top_srcdir)/m4/memrchr.m4 \
- $(top_srcdir)/m4/minmax.m4 $(top_srcdir)/m4/mkdir-slash.m4 \
- $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/mktime.m4 \
- $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/nanosleep.m4 \
- $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/onceonly_2_57.m4 \
- $(top_srcdir)/m4/openat.m4 $(top_srcdir)/m4/pagealign_alloc.m4 \
+ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inet_ntop.m4 \
+ $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes_h.m4 \
+ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/longdouble.m4 \
+ $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/lstat.m4 \
+ $(top_srcdir)/m4/mbchar.m4 $(top_srcdir)/m4/mbiter.m4 \
+ $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \
+ $(top_srcdir)/m4/md5.m4 $(top_srcdir)/m4/memchr.m4 \
+ $(top_srcdir)/m4/memmove.m4 $(top_srcdir)/m4/mempcpy.m4 \
+ $(top_srcdir)/m4/memrchr.m4 $(top_srcdir)/m4/minmax.m4 \
+ $(top_srcdir)/m4/mkdir-slash.m4 $(top_srcdir)/m4/mkstemp.m4 \
+ $(top_srcdir)/m4/mktime.m4 $(top_srcdir)/m4/mmap-anon.m4 \
+ $(top_srcdir)/m4/nanosleep.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/onceonly_2_57.m4 $(top_srcdir)/m4/openat.m4 \
+ $(top_srcdir)/m4/pagealign_alloc.m4 \
$(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/po.m4 \
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/quotearg.m4 \
$(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/regex.m4 \
@@ -151,10 +153,11 @@
$(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/m4/unistd-safer.m4 \
$(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \
$(top_srcdir)/m4/vasnprintf.m4 $(top_srcdir)/m4/vasprintf.m4 \
- $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \
- $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xgetcwd.m4 \
- $(top_srcdir)/m4/xreadlink.m4 $(top_srcdir)/m4/xsize.m4 \
- $(top_srcdir)/m4/yesno.m4 $(top_srcdir)/configure.in
+ $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wcwidth.m4 \
+ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xalloc.m4 \
+ $(top_srcdir)/m4/xgetcwd.m4 $(top_srcdir)/m4/xreadlink.m4 \
+ $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/m4/yesno.m4 \
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -433,11 +436,11 @@
libcvs_a_SOURCES = sighandle.c system.h wait.h xselect.h xtime.h \
allocsa.h allocsa.c base64.h base64.c cycle-check.c \
cycle-check.h dev-ino.h basename.c stripslash.c error.h exit.h \
- getaddrinfo.h getnline.h getnline.c gettext.h mbchar.h \
- mbuiter.h minmax.h setenv.h size_max.h strcase.h strnlen1.h \
- strnlen1.c strstr.h printf-args.h printf-parse.h vasnprintf.h \
- vasprintf.h verify.h xalloc-die.c xgethostname.h \
- xgethostname.c xsize.h
+ getaddrinfo.h getnline.h getnline.c gettext.h inet_ntop.h \
+ mbchar.h mbuiter.h minmax.h setenv.h size_max.h strcase.h \
+ strnlen1.h strnlen1.c strstr.h printf-args.h printf-parse.h \
+ vasnprintf.h vasprintf.h verify.h wcwidth.h xalloc-die.c \
+ xgethostname.h xgethostname.c xsize.h
libcvs_a_LIBADD = @LIBOBJS@ @ALLOCA@
BUILT_SOURCES = $(ALLOCA_H) $(FNMATCH_H) getdate.c $(GETOPT_H) \
$(GLOB_H) $(STDBOOL_H) $(STDINT_H) $(SYS_SOCKET_H) $(UNISTD_H)
@@ -562,6 +565,7 @@
@AMDEP_TRUE@@am__include@ @address@hidden(DEPDIR)/address@hidden@
@AMDEP_TRUE@@am__include@ @address@hidden(DEPDIR)/address@hidden@
@AMDEP_TRUE@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
@AMDEP_TRUE@@am__include@ @address@hidden(DEPDIR)/address@hidden@
@AMDEP_TRUE@@am__include@ @address@hidden(DEPDIR)/address@hidden@
@AMDEP_TRUE@@am__include@ @address@hidden(DEPDIR)/address@hidden@
Index: getaddrinfo.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/getaddrinfo.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- getaddrinfo.c 22 Jun 2006 19:04:35 -0000 1.6
+++ getaddrinfo.c 29 Jun 2006 12:13:26 -0000 1.7
@@ -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,51 @@
#include "strdup.h"
+#ifdef _WIN32
+typedef void WSAAPI (*freeaddrinfo_func) (struct addrinfo*);
+typedef int WSAAPI (*getaddrinfo_func) (const char*, const char*,
+ const struct addrinfo*,
+ 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;
+
+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 +111,7 @@
struct addrinfo **restrict res)
{
struct addrinfo *tmp;
- struct servent *se = NULL;
+ int port = 0;
struct hostent *he;
void *storage;
size_t size;
@@ -83,6 +128,11 @@
};
#endif
+#ifdef _WIN32
+ 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 +151,24 @@
if (servname)
{
+ struct servent *se = NULL;
const char *proto =
(hints && hints->ai_socktype == SOCK_DGRAM) ? "udp" : "tcp";
+ if (!(hints->ai_flags & AI_NUMERICSERV))
/* FIXME: Use getservbyname_r if available. */
se = getservbyname (servname, proto);
if (!se)
- return EAI_SERVICE;
+ {
+ char *c;
+ port = strtoul (servname, &c, 10);
+ if (*c)
+ return EAI_NONAME;
+ port = htons (port);
+ }
+ else
+ port = se->s_port;
}
/* FIXME: Use gethostbyname_r if available. */
@@ -147,8 +207,8 @@
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 +231,8 @@
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))
{
@@ -225,6 +285,11 @@
void
freeaddrinfo (struct addrinfo *ai)
{
+#ifdef _WIN32
+ if (use_win32_p ())
+ return freeaddrinfo_ptr (ai);
+#endif
+
while (ai)
{
struct addrinfo *cur;
@@ -236,3 +301,89 @@
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
+ 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 void *)
+ &(((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 void *)
+ &(((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: getaddrinfo.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/getaddrinfo.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- getaddrinfo.h 20 Mar 2006 02:21:56 -0000 1.7
+++ getaddrinfo.h 29 Jun 2006 12:13:26 -0000 1.8
@@ -49,12 +49,25 @@
/* Possible values for `ai_flags' field in `addrinfo' structure. */
# ifndef AI_PASSIVE
# 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. */
+# 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 @@
# 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 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/gai_strerror.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: mbchar.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/mbchar.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- mbchar.h 4 Sep 2005 05:58:56 -0000 1.1
+++ mbchar.h 29 Jun 2006 12:13:26 -0000 1.2
@@ -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: inet_ntop.c
===================================================================
RCS file: inet_ntop.c
diff -N inet_ntop.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ inet_ntop.c 29 Jun 2006 12:13:26 -0000 1.1
@@ -0,0 +1,239 @@
+/* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form
+ Copyright (c) 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
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ 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,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/*
+ * Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* Specification. */
+#include "inet_ntop.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+#ifndef EAFNOSUPPORT
+# define EAFNOSUPPORT EINVAL
+#endif
+
+#define NS_IN6ADDRSZ 16
+#define NS_INT16SZ 2
+
+/*
+ * WARNING: Don't even consider trying to compile this on a system where
+ * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
+ */
+typedef int verify_int_size[2 * sizeof (int) - 7];
+
+static const char *inet_ntop4 (const unsigned char *src, char *dst, socklen_t
size);
+#if HAVE_IPV6
+static const char *inet_ntop6 (const unsigned char *src, char *dst, socklen_t
size);
+#endif
+
+
+/* char *
+ * inet_ntop(af, src, dst, size)
+ * convert a network format address to presentation format.
+ * return:
+ * pointer to presentation format address (`dst'), or NULL (see errno).
+ * author:
+ * Paul Vixie, 1996.
+ */
+const char *
+inet_ntop (int af, const void *restrict src,
+ char *restrict dst, socklen_t cnt)
+{
+ switch (af)
+ {
+#if HAVE_IPV4
+ case AF_INET:
+ return (inet_ntop4 (src, dst, cnt));
+#endif
+
+#if HAVE_IPV6
+ case AF_INET6:
+ return (inet_ntop6 (src, dst, cnt));
+#endif
+
+ default:
+ errno = EAFNOSUPPORT;
+ return (NULL);
+ }
+ /* NOTREACHED */
+}
+
+/* const char *
+ * inet_ntop4(src, dst, size)
+ * format an IPv4 address
+ * return:
+ * `dst' (as a const)
+ * notes:
+ * (1) uses no statics
+ * (2) takes a u_char* not an in_addr as input
+ * author:
+ * Paul Vixie, 1996.
+ */
+static const char *
+inet_ntop4 (const unsigned char *src, char *dst, socklen_t size)
+{
+ char tmp[sizeof "255.255.255.255"];
+ int len;
+
+ len = sprintf (tmp, "%u.%u.%u.%u", src[0], src[1], src[2], src[3]);
+ if (len < 0)
+ return NULL;
+
+ if (len > size)
+ {
+ errno = ENOSPC;
+ return NULL;
+ }
+
+ return strcpy (dst, tmp);
+}
+
+#if HAVE_IPV6
+
+/* const char *
+ * inet_ntop6(src, dst, size)
+ * convert IPv6 binary address into presentation (printable) format
+ * author:
+ * Paul Vixie, 1996.
+ */
+static const char *
+inet_ntop6 (const unsigned char *src, char *dst, socklen_t size)
+{
+ /*
+ * Note that int32_t and int16_t need only be "at least" large enough
+ * to contain a value of the specified size. On some systems, like
+ * Crays, there is no such thing as an integer variable with 16 bits.
+ * Keep this in mind if you think this function should have been coded
+ * to use pointer overlays. All the world's not a VAX.
+ */
+ char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
+ struct
+ {
+ int base, len;
+ } best, cur;
+ unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ];
+ int i;
+
+ /*
+ * Preprocess:
+ * Copy the input (bytewise) array into a wordwise array.
+ * Find the longest run of 0x00's in src[] for :: shorthanding.
+ */
+ memset (words, '\0', sizeof words);
+ for (i = 0; i < NS_IN6ADDRSZ; i += 2)
+ words[i / 2] = (src[i] << 8) | src[i + 1];
+ best.base = -1;
+ cur.base = -1;
+ for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
+ {
+ if (words[i] == 0)
+ {
+ if (cur.base == -1)
+ cur.base = i, cur.len = 1;
+ else
+ cur.len++;
+ }
+ else
+ {
+ if (cur.base != -1)
+ {
+ if (best.base == -1 || cur.len > best.len)
+ best = cur;
+ cur.base = -1;
+ }
+ }
+ }
+ if (cur.base != -1)
+ {
+ if (best.base == -1 || cur.len > best.len)
+ best = cur;
+ }
+ if (best.base != -1 && best.len < 2)
+ best.base = -1;
+
+ /*
+ * Format the result.
+ */
+ tp = tmp;
+ for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
+ {
+ /* Are we inside the best run of 0x00's? */
+ if (best.base != -1 && i >= best.base && i < (best.base + best.len))
+ {
+ if (i == best.base)
+ *tp++ = ':';
+ continue;
+ }
+ /* Are we following an initial run of 0x00s or any real hex? */
+ if (i != 0)
+ *tp++ = ':';
+ /* Is this address an encapsulated IPv4? */
+ if (i == 6 && best.base == 0 &&
+ (best.len == 6 || (best.len == 5 && words[5] == 0xffff)))
+ {
+ if (!inet_ntop4 (src + 12, tp, sizeof tmp - (tp - tmp)))
+ return (NULL);
+ tp += strlen (tp);
+ break;
+ }
+ {
+ int len = sprintf (tp, "%x", words[i]);
+ if (len < 0)
+ return NULL;
+ tp += len;
+ }
+ }
+ /* Was it a trailing run of 0x00's? */
+ if (best.base != -1 && (best.base + best.len) ==
+ (NS_IN6ADDRSZ / NS_INT16SZ))
+ *tp++ = ':';
+ *tp++ = '\0';
+
+ /*
+ * Check for overflow, copy, and we're done.
+ */
+ if ((socklen_t) (tp - tmp) > size)
+ {
+ errno = ENOSPC;
+ return NULL;
+ }
+
+ return strcpy (dst, tmp);
+}
+
+#endif
Index: inet_ntop.h
===================================================================
RCS file: inet_ntop.h
diff -N inet_ntop.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ inet_ntop.h 29 Jun 2006 12:13:26 -0000 1.1
@@ -0,0 +1,43 @@
+/* Convert internet address from internal to printable, presentable format.
+ Copyright (C) 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
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ 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,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#ifdef HAVE_ARPA_INET_H
+# include <arpa/inet.h>
+#endif
+
+/* Converts an internet address from internal format to a printable,
+ presentable format.
+ AF is an internet address family, such as AF_INET or AF_INET6.
+ SRC points to a 'struct in_addr' (for AF_INET) or 'struct in6_addr'
+ (for AF_INET6).
+ DST points to a buffer having room for CNT bytes.
+ The printable representation of the address (in numeric form, not
+ surrounded by [...], no reverse DNS is done) is placed in DST, and
+ DST is returned. If an error occurs, the return value is NULL and
+ errno is set. If CNT bytes are not sufficient to hold the result,
+ the return value is NULL and errno is set to ENOSPC. A good value
+ for CNT is 46.
+
+ For more details, see the POSIX:2001 specification
+ <http://www.opengroup.org/susv3xsh/inet_ntop.html>. */
+
+#if !HAVE_DECL_INET_NTOP
+extern const char *inet_ntop (int af, const void *restrict src,
+ char *restrict dst, socklen_t cnt);
+#endif
Index: wcwidth.h
===================================================================
RCS file: wcwidth.h
diff -N wcwidth.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ wcwidth.h 29 Jun 2006 12:13:26 -0000 1.1
@@ -0,0 +1,70 @@
+/* Determine the number of screen columns needed for a character.
+ Copyright (C) 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
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ 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,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifndef _gl_WCWIDTH_H
+#define _gl_WCWIDTH_H
+
+#if HAVE_WCHAR_T
+
+/* Get wcwidth if available, along with wchar_t. */
+# if HAVE_WCHAR_H
+/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
+ <wchar.h>.
+ BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before
+ <wchar.h>. */
+# include <stdio.h>
+# include <time.h>
+# include <wchar.h>
+# endif
+
+/* Get iswprint. */
+# if HAVE_WCTYPE_H
+# include <wctype.h>
+# endif
+# if !defined iswprint && !HAVE_ISWPRINT
+# define iswprint(wc) 1
+# endif
+
+# ifndef HAVE_DECL_WCWIDTH
+"this configure-time declaration test was not run"
+# endif
+# ifndef wcwidth
+# if !HAVE_WCWIDTH
+
+/* wcwidth doesn't exist, so assume all printable characters have
+ width 1. */
+static inline int
+wcwidth (wchar_t wc)
+{
+ return wc == 0 ? 0 : iswprint (wc) ? 1 : -1;
+}
+
+# elif !HAVE_DECL_WCWIDTH
+
+/* wcwidth exists but is not declared. */
+extern
+# ifdef __cplusplus
+"C"
+# endif
+int wcwidth (int /* actually wchar_t */);
+
+# endif
+# endif
+
+#endif /* HAVE_WCHAR_H */
+
+#endif /* _gl_WCWIDTH_H */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Cvs-cvs] ccvs/lib ChangeLog Makefile.am Makefile.gnulib ...,
Derek Robert Price <=