summary |
tags |
clone url |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
637d7ba)
SCCS-vsn: usr.bin/netstat/inet.c 4.17
-static char sccsid[] = "@(#)inet.c 4.16 (Berkeley) 84/05/17";
+static char sccsid[] = "@(#)inet.c 4.17 (Berkeley) 84/07/04";
#endif
#include <sys/types.h>
#endif
#include <sys/types.h>
struct hostent *hp;
struct netent *np;
struct hostent *hp;
struct netent *np;
+ if (!nflag && in.s_addr != INADDR_ANY) {
int net = inet_netof(in), subnet = inet_subnetof(in);
int lna = inet_lnaof(in);
int net = inet_netof(in), subnet = inet_subnetof(in);
int lna = inet_lnaof(in);
if (lna == INADDR_ANY) {
np = getnetbyaddr(net, AF_INET);
if (np)
cp = np->n_name;
if (lna == INADDR_ANY) {
np = getnetbyaddr(net, AF_INET);
if (np)
cp = np->n_name;
- } else if ((subnet != net) && ((lna & 0xff) == 0) &&
+ } else if (subnet != net && (lna & 0xff) == 0 &&
(np = getnetbyaddr(subnet, AF_INET))) {
struct in_addr subnaddr, inet_makeaddr();
(np = getnetbyaddr(subnet, AF_INET))) {
struct in_addr subnaddr, inet_makeaddr();
subnaddr = inet_makeaddr(subnet, INADDR_ANY);
subnaddr = inet_makeaddr(subnet, INADDR_ANY);
- if (bcmp(&in, &subnaddr, sizeof(in)) == 0)
+ if (bcmp(&in, &subnaddr, sizeof (in)) == 0)
cp = np->n_name;
else
goto host;
} else {
host:
cp = np->n_name;
else
goto host;
} else {
host:
- hp = gethostbyaddr(&in, sizeof (struct in_addr),
- AF_INET);
+ hp = gethostbyaddr(&in, sizeof (in), AF_INET);
if (hp)
cp = hp->h_name;
}
if (hp)
cp = hp->h_name;
}
strcpy(line, cp);
else {
u_char *ucp = (u_char *)∈
strcpy(line, cp);
else {
u_char *ucp = (u_char *)∈
sprintf(line, "%u.%u.%u.%u", ucp[0], ucp[1], ucp[2], ucp[3]);
}
return (line);
sprintf(line, "%u.%u.%u.%u", ucp[0], ucp[1], ucp[2], ucp[3]);
}
return (line);