From 444a708d79b1bb79c0c5ab41f2ca82ccc1b2b5fc Mon Sep 17 00:00:00 2001 From: Sam Leffler Date: Fri, 8 Oct 1982 02:14:28 -0800 Subject: [PATCH] use routines now in libc.a SCCS-vsn: usr.bin/netstat/inet.c 4.4 SCCS-vsn: usr.bin/netstat/route.c 4.4 --- usr/src/usr.bin/netstat/inet.c | 50 ++++----------------------------- usr/src/usr.bin/netstat/route.c | 6 ++-- 2 files changed, 8 insertions(+), 48 deletions(-) diff --git a/usr/src/usr.bin/netstat/inet.c b/usr/src/usr.bin/netstat/inet.c index 5ba88f18c3..a79f725175 100644 --- a/usr/src/usr.bin/netstat/inet.c +++ b/usr/src/usr.bin/netstat/inet.c @@ -1,5 +1,5 @@ #ifndef lint -static char sccsid[] = "@(#)inet.c 4.3 82/10/06"; +static char sccsid[] = "@(#)inet.c 4.4 82/10/07"; #endif #include @@ -70,7 +70,7 @@ protopr(off, name) break; } if (!aflag && - in_lnaof(inpcb.inp_laddr.s_addr) == INADDR_ANY) { + inet_lnaof(inpcb.inp_laddr.s_addr) == INADDR_ANY) { prev = next; continue; } @@ -123,47 +123,6 @@ inetprint(in, port, proto) printf(" %-18.18s", line); } -/* - * Return the network number from an internet - * address; handles class a/b/c network #'s. - */ -in_netof(in) - struct in_addr in; -{ -#if vax || pdp11 - register u_long net; - - if ((in.s_addr&IN_CLASSA) == 0) - return (in.s_addr & IN_CLASSA_NET); - if ((in.s_addr&IN_CLASSB) == 0) - return ((int)htons((u_short)(in.s_addr & IN_CLASSB_NET))); - net = htonl((u_long)(in.s_addr & IN_CLASSC_NET)); - net >>= 8; - return ((int)net); -#else - return (IN_NETOF(in)); -#endif -} - -/* - * Return the local network address portion of an - * internet address; handles class a/b/c network - * number formats. - */ -in_lnaof(in) - struct in_addr in; -{ -#if vax || pdp11 -#define IN_LNAOF(in) \ - (((in).s_addr&IN_CLASSA) == 0 ? (in).s_addr&IN_CLASSA_LNA : \ - ((in).s_addr&IN_CLASSB) == 0 ? (in).s_addr&IN_CLASSB_LNA : \ - (in).s_addr&IN_CLASSC_LNA) - return ((int)htonl((u_long)IN_LNAOF(in))); -#else - return (IN_LNAOF(in)); -#endif -} - /* * Construct an Internet address representation. * If the nflag has been supplied, give @@ -177,9 +136,10 @@ inetname(in) static char line[50]; if (!nflag) { - if (in_lnaof(in) == INADDR_ANY) { - struct netent *np = getnetbyaddr(in_netof(in), AF_INET); + if (inet_lnaof(in) == INADDR_ANY) { + struct netent *np; + np = getnetbyaddr(inet_netof(in), AF_INET); if (np) cp = np->n_name; } else { diff --git a/usr/src/usr.bin/netstat/route.c b/usr/src/usr.bin/netstat/route.c index 1cc721c24a..abef0c5331 100644 --- a/usr/src/usr.bin/netstat/route.c +++ b/usr/src/usr.bin/netstat/route.c @@ -1,5 +1,5 @@ #ifndef lint -static char sccsid[] = "@(#)route.c 4.3 82/10/06"; +static char sccsid[] = "@(#)route.c 4.4 82/10/07"; #endif #include @@ -109,8 +109,8 @@ routename(in) static char line[50]; int lna, net; - net = in_netof(in); - lna = in_lnaof(in); + net = inet_netof(in); + lna = inet_lnaof(in); if (!nflag) { if (lna == INADDR_ANY) { struct netent *np = getnetbyaddr(net, AF_INET); -- 2.20.1