aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/netstat
diff options
context:
space:
mode:
authorYoshinobu Inoue <shin@FreeBSD.org>2000-01-07 05:17:09 +0000
committerYoshinobu Inoue <shin@FreeBSD.org>2000-01-07 05:17:09 +0000
commitfc60ab7b0fc5f47d1ee1452b8b7c1764b2fb9ec0 (patch)
treec0fc8e26d30ee5b296cf37c23cde6bf6b8edeb26 /usr.bin/netstat
parent31f723c7bc092ea04541365a0e262ed9676521a0 (diff)
Notes
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 064fcbbfb404..ac09c4b66a37 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 02c2fbf9a58e..c1c65f289b1f 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 c0e4381c3dea..5f01f8eccc94 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);