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

[svn] Don't clutter the host list with duplicate hosts.

Published in <sxsitpt56eh.fsf@florida.arsdigita.de>.
This commit is contained in:
hniksic 2000-11-12 16:46:13 -08:00
parent e1f1c1ff40
commit 6a70f04a5c
2 changed files with 16 additions and 9 deletions

View File

@ -1,3 +1,9 @@
2000-11-12 Hrvoje Niksic <hniksic@arsdigita.com>
* host.c (realhost): Add HOST to the list with quality==0 only if
it wasn't already there.
Based on analysis by Lu Guohan <feng@public.bjnet.edu.cn>.
2000-11-10 Hrvoje Niksic <hniksic@arsdigita.com> 2000-11-10 Hrvoje Niksic <hniksic@arsdigita.com>
* init.c (run_wgetrc): Don't bother killing off '\r' since * init.c (run_wgetrc): Don't bother killing off '\r' since

View File

@ -245,7 +245,7 @@ add_hlist (struct host *l, const char *nhost, const char *nreal, int quality)
char * char *
realhost (const char *host) realhost (const char *host)
{ {
struct host *l; struct host *l, *l_real;
struct in_addr in; struct in_addr in;
struct hostent *hptr; struct hostent *hptr;
char *inet_s; char *inet_s;
@ -294,12 +294,13 @@ realhost (const char *host)
/* Now we certainly have the INET address. The following loop is /* Now we certainly have the INET address. The following loop is
guaranteed to pick either an entry with quality (because it is guaranteed to pick either an entry with quality (because it is
the first one), or none at all. */ the first one), or none at all. */
l = search_address (hlist, inet_s); l_real = search_address (hlist, inet_s);
if (l) /* Found in the list, as realname. */ if (l_real) /* Found in the list, as realname. */
{ {
if (!l)
/* Set the default, 0 quality. */ /* Set the default, 0 quality. */
hlist = add_hlist (hlist, host, inet_s, 0); hlist = add_hlist (hlist, host, inet_s, 0);
return xstrdup (l->hostname); return xstrdup (l_real->hostname);
} }
/* Since this is really the first time this host is encountered, /* Since this is really the first time this host is encountered,
set quality to 1. */ set quality to 1. */