-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>
This commit is contained in:
Yoshinobu Inoue 2000-01-07 05:17:09 +00:00
parent 31f723c7bc
commit fc60ab7b0f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=55533
3 changed files with 16 additions and 9 deletions

View File

@ -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);
}
/*

View File

@ -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);
}
/*

View File

@ -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);