From owner-freebsd-current Thu Jan 6 4: 2:25 2000 Delivered-To: freebsd-current@freebsd.org Received: from fgwmail7.fujitsu.co.jp (fgwmail7.fujitsu.co.jp [192.51.44.37]) by hub.freebsd.org (Postfix) with ESMTP id EA78014F87 for ; Thu, 6 Jan 2000 04:02:21 -0800 (PST) (envelope-from shin@nd.net.fujitsu.co.jp) Received: from m2.gw.fujitsu.co.jp by fgwmail7.fujitsu.co.jp (8.9.3/3.7W-MX9912-Fujitsu Gateway) id VAA27046; Thu, 6 Jan 2000 21:02:20 +0900 (JST) (envelope-from shin@nd.net.fujitsu.co.jp) Received: from chisato.nd.net.fujitsu.co.jp by m2.gw.fujitsu.co.jp (8.9.3/3.7W-9912-Fujitsu Domain Master) id VAA05191; Thu, 6 Jan 2000 21:02:19 +0900 (JST) Received: from localhost (dhcp7194.nd.net.fujitsu.co.jp [10.18.7.194]) by chisato.nd.net.fujitsu.co.jp (8.8.5+2.7Wbeta5/3.3W8chisato-970826) with ESMTP id VAA12430; Thu, 6 Jan 2000 21:02:19 +0900 (JST) To: syssgm@detir.qld.gov.au Cc: freebsd-current@FreeBSD.ORG Subject: Re: Small fix to netstat argument processing In-Reply-To: <200001061006.UAA21698@nymph.detir.qld.gov.au> References: <200001061006.UAA21698@nymph.detir.qld.gov.au> X-Mailer: Mew version 1.94 on Emacs 20.4 / Mule 4.0 (HANANOEN) X-Prom-Mew: Prom-Mew 1.93.4 (procmail reader for Mew) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20000106210255C.shin@nd.net.fujitsu.co.jp> Date: Thu, 06 Jan 2000 21:02:55 +0900 From: Yoshinobu Inoue X-Dispatcher: imput version 990905(IM130) Lines: 101 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > Hmm, I've just noticed some small misalignment of column headings in the > default output. I'll fix that too. > > Stephen. I also noticed that my another IPv6 related change is one of main cause of the misalignment. So I also tried to make patches for it, including "netstat -f inet -i" issue. Does these patches fix your problem, or should another better fix is desired? Please give me any opinions. Yoshinobu Inoue Index: inet.c =================================================================== RCS file: /home/ncvs/src/usr.bin/netstat/inet.c,v retrieving revision 1.36 diff -u -r1.36 inet.c --- inet.c 1999/12/13 20:08:43 1.36 +++ inet.c 2000/01/06 11:57:57 @@ -219,7 +219,7 @@ 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 @@ 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 @@ else sprintf(cp, "%d", ntohs((u_short)port)); width = Aflag ? 18 : 22; - printf(" %-*.*s", width, width, line); + printf("%-*.*s ", width, width, line); } /* Index: inet6.c =================================================================== RCS file: /home/ncvs/src/usr.bin/netstat/inet6.c,v retrieving revision 1.2 diff -u -r1.2 inet6.c --- inet6.c 1999/12/28 02:37:01 1.2 +++ inet6.c 2000/01/06 11:57:57 @@ -904,7 +904,7 @@ else sprintf(cp, "%d", ntohs((u_short)port)); width = lflag ? 45 : Aflag ? 18 : 22; - printf(" %-*.*s", width, width, line); + printf("%-*.*s ", width, width, line); } /* Index: main.c =================================================================== RCS file: /home/ncvs/src/usr.bin/netstat/main.c,v retrieving revision 1.31 diff -u -r1.31 main.c --- main.c 1999/12/28 02:37:01 1.31 +++ main.c 2000/01/06 11:57:57 @@ -460,7 +460,7 @@ */ #endif if (iflag) { - if (af != AF_UNSPEC) + if (sflag && af != AF_UNSPEC) goto protostat; kread(0, 0, 0); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message