mirror of
https://github.com/mirror/wget.git
synced 2025-03-29 13:30:30 +08:00
[svn] Implement inet_ntop on Windows.
This commit is contained in:
parent
26630942cb
commit
e38c88e458
@ -1,3 +1,13 @@
|
|||||||
|
2005-06-30 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
|
* host.c (pretty_print_address): Handle error result from
|
||||||
|
inet_ntop.
|
||||||
|
|
||||||
|
2005-06-30 Gisle Vanem <giva@bgnett.no>
|
||||||
|
|
||||||
|
* mswindows.c (inet_ntop): New function. Print IPv6 addresses
|
||||||
|
using WSAAddressToString.
|
||||||
|
|
||||||
2005-06-27 Hrvoje Niksic <hniksic@xemacs.org>
|
2005-06-27 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
* progress.c (dot_update): Remove unused variable row_qty.
|
* progress.c (dot_update): Remove unused variable row_qty.
|
||||||
|
16
src/host.c
16
src/host.c
@ -418,18 +418,10 @@ pretty_print_address (const ip_address *addr)
|
|||||||
#ifdef ENABLE_IPV6
|
#ifdef ENABLE_IPV6
|
||||||
case IPV6_ADDRESS:
|
case IPV6_ADDRESS:
|
||||||
{
|
{
|
||||||
static char buf[128];
|
static char buf[64];
|
||||||
inet_ntop (AF_INET6, &ADDRESS_IPV6_IN6_ADDR (addr), buf, sizeof (buf));
|
if (!inet_ntop (AF_INET6, &ADDRESS_IPV6_IN6_ADDR (addr),
|
||||||
#if 0
|
buf, sizeof (buf)))
|
||||||
#ifdef HAVE_SOCKADDR_IN6_SCOPE_ID
|
snprintf (buf, sizeof buf, "[error: %s]", strerror (errno));
|
||||||
{
|
|
||||||
/* append "%SCOPE_ID" for all ?non-global? addresses */
|
|
||||||
char *p = buf + strlen (buf);
|
|
||||||
*p++ = '%';
|
|
||||||
number_to_string (p, ADDRESS_IPV6_SCOPE (addr));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
buf[sizeof (buf) - 1] = '\0';
|
buf[sizeof (buf) - 1] = '\0';
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
@ -848,3 +848,28 @@ windows_strerror (int err)
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_IPV6
|
||||||
|
/* An IPv6-only inet_ntop that prints with WSAAddressToString. (Wget
|
||||||
|
uses inet_ntoa for IPv4 addresses -- see pretty_print_address.)
|
||||||
|
Prototype complies with POSIX 1003.1-2004. */
|
||||||
|
|
||||||
|
const char *
|
||||||
|
inet_ntop (int af, const void *src, char *dst, socklen_t cnt)
|
||||||
|
{
|
||||||
|
struct sockaddr_in6 sin6;
|
||||||
|
DWORD dstlen = cnt;
|
||||||
|
|
||||||
|
assert (af == AF_INET6);
|
||||||
|
xzero (sin6);
|
||||||
|
sin6.sin6_family = AF_INET6;
|
||||||
|
sin6.sin6_addr = *(struct in6_addr *) src;
|
||||||
|
if (WSAAddressToString ((struct sockaddr *) &sin6, sizeof (sin6),
|
||||||
|
NULL, dst, &dstlen) != 0)
|
||||||
|
{
|
||||||
|
errno = WSAGetLastError();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return (const char *) dst;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@ -134,8 +134,7 @@ __int64 str_to_int64 (const char *, char **, int);
|
|||||||
|
|
||||||
/* Additional declarations needed for IPv6: */
|
/* Additional declarations needed for IPv6: */
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef ENABLE_IPV6
|
||||||
/* Missing declaration? */
|
const char *inet_ntop (int, const void *, char *, socklen_t);
|
||||||
extern const char *inet_ntop (int, const void *, char *, size_t);
|
|
||||||
/* MinGW 3.7 (or older) prototypes gai_strerror(), but is missing
|
/* MinGW 3.7 (or older) prototypes gai_strerror(), but is missing
|
||||||
from all import libraries. */
|
from all import libraries. */
|
||||||
# ifdef __MINGW32__
|
# ifdef __MINGW32__
|
||||||
|
Loading…
Reference in New Issue
Block a user