summaryrefslogtreecommitdiffstats
path: root/usr.bin/netstat
diff options
context:
space:
mode:
authorshin <shin@FreeBSD.org>2000-01-07 05:17:09 +0000
committershin <shin@FreeBSD.org>2000-01-07 05:17:09 +0000
commitb8e88750ca8496f0291145d8c4a7b0ab0efc5e3c (patch)
tree76d0d6d3de7cfc74ca8e38c4c2fa5e5a32a54664 /usr.bin/netstat
parentb06ae99df1a54361b9f152804f4c929c3fde8f66 (diff)
downloadFreeBSD-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')
-rw-r--r--usr.bin/netstat/inet.c21
-rw-r--r--usr.bin/netstat/inet6.c2
-rw-r--r--usr.bin/netstat/main.c2
3 files changed, 16 insertions, 9 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);
}
/*
diff --git a/usr.bin/netstat/inet6.c b/usr.bin/netstat/inet6.c
index 02c2fbf..c1c65f2 100644
--- a/usr.bin/netstat/inet6.c
+++ b/usr.bin/netstat/inet6.c
@@ -904,7 +904,7 @@ inet6print(in6, port, proto, numeric)
else
sprintf(cp, "%d", ntohs((u_short)port));
width = lflag ? 45 : Aflag ? 18 : 22;
- printf(" %-*.*s", width, width, line);
+ printf("%-*.*s ", width, width, line);
}
/*
diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c
index c0e4381..5f01f8e 100644
--- a/usr.bin/netstat/main.c
+++ b/usr.bin/netstat/main.c
@@ -460,7 +460,7 @@ main(argc, argv)
*/
#endif
if (iflag) {
- if (af != AF_UNSPEC)
+ if (sflag && af != AF_UNSPEC)
goto protostat;
kread(0, 0, 0);
OpenPOWER on IntegriCloud