version 1.134, 2014/08/14 12:55:50 |
version 1.135, 2014/10/23 16:45:57 |
|
|
char *cp; |
char *cp; |
static char line[50]; |
static char line[50]; |
struct hostent *hp; |
struct hostent *hp; |
struct netent *np; |
|
static char domain[MAXHOSTNAMELEN]; |
static char domain[MAXHOSTNAMELEN]; |
static int first = 1; |
static int first = 1; |
|
|
|
|
int net = inet_netof(*inp); |
int net = inet_netof(*inp); |
int lna = inet_lnaof(*inp); |
int lna = inet_lnaof(*inp); |
|
|
if (lna == INADDR_ANY) { |
hp = gethostbyaddr((char *)inp, sizeof (*inp), AF_INET); |
np = getnetbyaddr(net, AF_INET); |
if (hp) { |
if (np) |
if ((cp = strchr(hp->h_name, '.')) && |
cp = np->n_name; |
!strcmp(cp + 1, domain)) |
} |
*cp = '\0'; |
if (cp == NULL) { |
cp = hp->h_name; |
hp = gethostbyaddr((char *)inp, sizeof (*inp), AF_INET); |
|
if (hp) { |
|
if ((cp = strchr(hp->h_name, '.')) && |
|
!strcmp(cp + 1, domain)) |
|
*cp = '\0'; |
|
cp = hp->h_name; |
|
} |
|
} |
} |
} |
} |
if (inp->s_addr == INADDR_ANY) |
if (inp->s_addr == INADDR_ANY) |