1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

[svn] Renamed "pretty_print_address" to "print_address".

This commit is contained in:
hniksic 2005-06-30 13:03:18 -07:00
parent 5b26cb40a9
commit c1fb83c53b
7 changed files with 25 additions and 27 deletions

View File

@ -1,3 +1,8 @@
2005-06-30 Hrvoje Niksic <hniksic@xemacs.org>
* host.c (pretty_print_address): Renamed to just print_address.
Clarify documentation.
2005-06-30 Hrvoje Niksic <hniksic@xemacs.org> 2005-06-30 Hrvoje Niksic <hniksic@xemacs.org>
* http.c (gethttp): Explicitly document the different cases when * http.c (gethttp): Explicitly document the different cases when

View File

@ -263,7 +263,7 @@ connect_to_ip (const ip_address *ip, int port, const char *print)
PRINT being the host name we're connecting to. */ PRINT being the host name we're connecting to. */
if (print) if (print)
{ {
const char *txt_addr = pretty_print_address (ip); const char *txt_addr = print_address (ip);
if (print && 0 != strcmp (print, txt_addr)) if (print && 0 != strcmp (print, txt_addr))
logprintf (LOG_VERBOSE, _("Connecting to %s|%s|:%d... "), logprintf (LOG_VERBOSE, _("Connecting to %s|%s|:%d... "),
escnonprint (print), txt_addr, port); escnonprint (print), txt_addr, port);
@ -461,7 +461,7 @@ bind_local (const ip_address *bind_address, int *port)
} }
sockaddr_get_data (sa, NULL, port); sockaddr_get_data (sa, NULL, port);
DEBUGP (("binding to address %s using port %i.\n", DEBUGP (("binding to address %s using port %i.\n",
pretty_print_address (bind_address), *port)); print_address (bind_address), *port));
} }
if (listen (sock, 1) < 0) if (listen (sock, 1) < 0)
{ {
@ -540,7 +540,7 @@ socket_ip_address (int sock, ip_address *ip, int endpoint)
#ifdef HAVE_SOCKADDR_IN6_SCOPE_ID #ifdef HAVE_SOCKADDR_IN6_SCOPE_ID
ADDRESS_IPV6_SCOPE (ip) = sa6->sin6_scope_id; ADDRESS_IPV6_SCOPE (ip) = sa6->sin6_scope_id;
#endif #endif
DEBUGP (("conaddr is: %s\n", pretty_print_address (ip))); DEBUGP (("conaddr is: %s\n", print_address (ip)));
return true; return true;
} }
#endif #endif
@ -549,7 +549,7 @@ socket_ip_address (int sock, ip_address *ip, int endpoint)
struct sockaddr_in *sa = (struct sockaddr_in *)&storage; struct sockaddr_in *sa = (struct sockaddr_in *)&storage;
ip->type = IPV4_ADDRESS; ip->type = IPV4_ADDRESS;
ADDRESS_IPV4_IN_ADDR (ip) = sa->sin_addr; ADDRESS_IPV4_IN_ADDR (ip) = sa->sin_addr;
DEBUGP (("conaddr is: %s\n", pretty_print_address (ip))); DEBUGP (("conaddr is: %s\n", print_address (ip)));
return true; return true;
} }
default: default:

View File

@ -419,9 +419,6 @@ ip_address_to_eprt_repr (const ip_address *addr, int port, char *buf,
{ {
int afnum; int afnum;
assert (addr != NULL);
assert (addr->type == IPV4_ADDRESS || addr->type == IPV6_ADDRESS);
assert (buf != NULL);
/* buf must contain the argument of EPRT (of the form |af|addr|port|). /* buf must contain the argument of EPRT (of the form |af|addr|port|).
* 4 chars for the | separators, INET6_ADDRSTRLEN chars for addr * 4 chars for the | separators, INET6_ADDRSTRLEN chars for addr
* 1 char for af (1-2) and 5 chars for port (0-65535) */ * 1 char for af (1-2) and 5 chars for port (0-65535) */
@ -429,7 +426,7 @@ ip_address_to_eprt_repr (const ip_address *addr, int port, char *buf,
/* Construct the argument of EPRT (of the form |af|addr|port|). */ /* Construct the argument of EPRT (of the form |af|addr|port|). */
afnum = (addr->type == IPV4_ADDRESS ? 1 : 2); afnum = (addr->type == IPV4_ADDRESS ? 1 : 2);
snprintf (buf, buflen, "|%d|%s|%d|", afnum, pretty_print_address (addr), port); snprintf (buf, buflen, "|%d|%s|%d|", afnum, print_address (addr), port);
buf[buflen - 1] = '\0'; buf[buflen - 1] = '\0';
} }
@ -453,8 +450,6 @@ ftp_eprt (int csock, int *local_sock)
if (!socket_ip_address (csock, &addr, ENDPOINT_LOCAL)) if (!socket_ip_address (csock, &addr, ENDPOINT_LOCAL))
return FTPSYSERR; return FTPSYSERR;
assert (addr.type == IPV4_ADDRESS || addr.type == IPV6_ADDRESS);
/* Setting port to 0 lets the system choose a free port. */ /* Setting port to 0 lets the system choose a free port. */
port = 0; port = 0;
@ -698,7 +693,7 @@ ftp_lpsv (int csock, ip_address *addr, int *port)
addr->type = IPV4_ADDRESS; addr->type = IPV4_ADDRESS;
memcpy (ADDRESS_IPV4_DATA (addr), tmp, 4); memcpy (ADDRESS_IPV4_DATA (addr), tmp, 4);
*port = ((tmpprt[0] << 8) & 0xff00) + tmpprt[1]; *port = ((tmpprt[0] << 8) & 0xff00) + tmpprt[1];
DEBUGP (("lpsv addr is: %s\n", pretty_print_address(addr))); DEBUGP (("lpsv addr is: %s\n", print_address(addr)));
DEBUGP (("tmpprt[0] is: %d\n", tmpprt[0])); DEBUGP (("tmpprt[0] is: %d\n", tmpprt[0]));
DEBUGP (("tmpprt[1] is: %d\n", tmpprt[1])); DEBUGP (("tmpprt[1] is: %d\n", tmpprt[1]));
DEBUGP (("*port is: %d\n", *port)); DEBUGP (("*port is: %d\n", *port));
@ -709,7 +704,7 @@ ftp_lpsv (int csock, ip_address *addr, int *port)
addr->type = IPV6_ADDRESS; addr->type = IPV6_ADDRESS;
memcpy (ADDRESS_IPV6_DATA (addr), tmp, 16); memcpy (ADDRESS_IPV6_DATA (addr), tmp, 16);
*port = ((tmpprt[0] << 8) & 0xff00) + tmpprt[1]; *port = ((tmpprt[0] << 8) & 0xff00) + tmpprt[1];
DEBUGP (("lpsv addr is: %s\n", pretty_print_address(addr))); DEBUGP (("lpsv addr is: %s\n", print_address(addr)));
DEBUGP (("tmpprt[0] is: %d\n", tmpprt[0])); DEBUGP (("tmpprt[0] is: %d\n", tmpprt[0]));
DEBUGP (("tmpprt[1] is: %d\n", tmpprt[1])); DEBUGP (("tmpprt[1] is: %d\n", tmpprt[1]));
DEBUGP (("*port is: %d\n", *port)); DEBUGP (("*port is: %d\n", *port));

View File

@ -651,8 +651,7 @@ Error in server response, closing control connection.\n"));
if (err==FTPOK) if (err==FTPOK)
{ {
DEBUGP (("trying to connect to %s port %d\n", DEBUGP (("trying to connect to %s port %d\n",
pretty_print_address (&passive_addr), print_address (&passive_addr), passive_port));
passive_port));
dtsock = connect_to_ip (&passive_addr, passive_port, NULL); dtsock = connect_to_ip (&passive_addr, passive_port, NULL);
if (dtsock < 0) if (dtsock < 0)
{ {
@ -660,7 +659,7 @@ Error in server response, closing control connection.\n"));
fd_close (csock); fd_close (csock);
con->csock = -1; con->csock = -1;
logprintf (LOG_VERBOSE, _("couldn't connect to %s port %d: %s\n"), logprintf (LOG_VERBOSE, _("couldn't connect to %s port %d: %s\n"),
pretty_print_address (&passive_addr), passive_port, print_address (&passive_addr), passive_port,
strerror (save_errno)); strerror (save_errno));
return (retryable_socket_connect_error (save_errno) return (retryable_socket_connect_error (save_errno)
? CONERROR : CONIMPOSSIBLE); ? CONERROR : CONIMPOSSIBLE);

View File

@ -404,12 +404,12 @@ getaddrinfo_with_timeout (const char *node, const char *service,
#endif /* ENABLE_IPV6 */ #endif /* ENABLE_IPV6 */
/* Pretty-print ADDR. When compiled without IPv6, this is the same as /* Return a textual representation of ADDR, i.e. the dotted quad for
inet_ntoa. With IPv6, it either prints an IPv6 address or an IPv4 IPv4 addresses, and the colon-separated list of hex words (with all
address. */ zeros omitted, etc.) for IPv6 addresses. */
const char * const char *
pretty_print_address (const ip_address *addr) print_address (const ip_address *addr)
{ {
switch (addr->type) switch (addr->type)
{ {
@ -421,7 +421,7 @@ pretty_print_address (const ip_address *addr)
static char buf[64]; static char buf[64];
if (!inet_ntop (AF_INET6, &ADDRESS_IPV6_IN6_ADDR (addr), if (!inet_ntop (AF_INET6, &ADDRESS_IPV6_IN6_ADDR (addr),
buf, sizeof (buf))) buf, sizeof (buf)))
snprintf (buf, sizeof buf, "[error: %s]", strerror (errno)); snprintf (buf, sizeof buf, "<error: %s>", strerror (errno));
buf[sizeof (buf) - 1] = '\0'; buf[sizeof (buf) - 1] = '\0';
return buf; return buf;
} }
@ -619,7 +619,7 @@ cache_store (const char *host, struct address_list *al)
int i; int i;
debug_logprintf ("Caching %s =>", host); debug_logprintf ("Caching %s =>", host);
for (i = 0; i < al->count; i++) for (i = 0; i < al->count; i++)
debug_logprintf (" %s", pretty_print_address (al->addresses + i)); debug_logprintf (" %s", print_address (al->addresses + i));
debug_logprintf ("\n"); debug_logprintf ("\n");
} }
} }
@ -815,8 +815,7 @@ lookup_host (const char *host, int flags)
int printmax = al->count <= 3 ? al->count : 3; int printmax = al->count <= 3 ? al->count : 3;
for (i = 0; i < printmax; i++) for (i = 0; i < printmax; i++)
{ {
logprintf (LOG_VERBOSE, "%s", logputs (LOG_VERBOSE, print_address (al->addresses + i));
pretty_print_address (al->addresses + i));
if (i < printmax - 1) if (i < printmax - 1)
logputs (LOG_VERBOSE, ", "); logputs (LOG_VERBOSE, ", ");
} }

View File

@ -105,7 +105,7 @@ void address_list_set_connected (struct address_list *);
bool address_list_connected_p (const struct address_list *); bool address_list_connected_p (const struct address_list *);
void address_list_release (struct address_list *); void address_list_release (struct address_list *);
const char *pretty_print_address (const ip_address *); const char *print_address (const ip_address *);
#ifdef ENABLE_IPV6 #ifdef ENABLE_IPV6
bool is_valid_ipv6_address (const char *, const char *); bool is_valid_ipv6_address (const char *, const char *);
#endif #endif

View File

@ -851,8 +851,8 @@ windows_strerror (int err)
#ifdef ENABLE_IPV6 #ifdef ENABLE_IPV6
/* An IPv6-only inet_ntop that prints with WSAAddressToString. (Wget /* An IPv6-only inet_ntop that prints with WSAAddressToString. (Wget
uses inet_ntoa for IPv4 addresses -- see pretty_print_address.) uses inet_ntoa for IPv4 addresses -- see print_address.) Prototype
Prototype complies with POSIX 1003.1-2004. */ complies with POSIX 1003.1-2004. */
const char * const char *
inet_ntop (int af, const void *src, char *dst, socklen_t cnt) inet_ntop (int af, const void *src, char *dst, socklen_t cnt)