diff options
author | shin <shin@FreeBSD.org> | 2000-01-07 05:17:09 +0000 |
---|---|---|
committer | shin <shin@FreeBSD.org> | 2000-01-07 05:17:09 +0000 |
commit | b8e88750ca8496f0291145d8c4a7b0ab0efc5e3c (patch) | |
tree | 76d0d6d3de7cfc74ca8e38c4c2fa5e5a32a54664 /usr.bin/netstat/inet.c | |
parent | b06ae99df1a54361b9f152804f4c929c3fde8f66 (diff) | |
download | FreeBSD-src-b8e88750ca8496f0291145d8c4a7b0ab0efc5e3c.zip FreeBSD-src-b8e88750ca8496f0291145d8c4a7b0ab0efc5e3c.tar.gz |
-permit protocol specific statistics at iflag,
only when either of sflag and "-f inet6" is specified.
-fix the indentation of default output
Specified by: Stephen McKay <syssgm@detir.qld.gov.au>
Reviewed and Confirmed by: Stephen McKay <syssgm@detir.qld.gov.au>
Diffstat (limited to 'usr.bin/netstat/inet.c')
-rw-r--r-- | usr.bin/netstat/inet.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 064fcbb..ac09c4b 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -219,7 +219,7 @@ protopr(proto, name, af) if (Aflag) printf("%-8.8s ", "Socket"); if (Lflag) - printf("%-14.14s %-21.21s\n", + printf("%-14.14s %-22.22s\n", "Listen", "Local Address"); else printf(Aflag ? @@ -245,15 +245,22 @@ protopr(proto, name, af) printf("%-14.14s ", buf); } else continue; - else - printf("%-3.3s%s%s %6ld %6ld ", name, - (inp->inp_vflag & INP_IPV4) ? "4" : "", + else { + const u_char *vchar; + #ifdef INET6 - (inp->inp_vflag & INP_IPV6) ? "6" : + if ((inp->inp_vflag & INP_IPV6) != 0) + vchar = ((inp->inp_vflag & INP_IPV4) != 0) + ? "46" : "6 "; + else #endif - "", + vchar = ((inp->inp_vflag & INP_IPV4) != 0) + ? "4 " : " "; + + printf("%-3.3s%-2.2s %6ld %6ld ", name, vchar, so->so_rcv.sb_cc, so->so_snd.sb_cc); + } if (nflag) { if (inp->inp_vflag & INP_IPV4) { inetprint(&inp->inp_laddr, (int)inp->inp_lport, @@ -801,7 +808,7 @@ inetprint(in, port, proto,numeric) else sprintf(cp, "%d", ntohs((u_short)port)); width = Aflag ? 18 : 22; - printf(" %-*.*s", width, width, line); + printf("%-*.*s ", width, width, line); } /* |