Subject: bin/1362: netstat -i address column is too narrow
To: None <gnats-bugs@gnats.netbsd.org>
From: Kenneth Stailey <kstailey@owl.dol-esa.gov>
List: netbsd-bugs
Date: 08/16/1995 14:31:07
>Number: 1362
>Category: bin
>Synopsis: netstat -i address column is too narrow
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Aug 16 14:35:01 1995
>Last-Modified:
>Originator: Kenneth Stailey
>Organization:
DOL/ESA/DASM
>Release: August 9, 1995
>Environment:
System: NetBSD owl 1.0A NetBSD 1.0A (OWL) #1: Tue Aug 15 17:10:52 EDT 1995 kstailey@owl:/usr/obj/sys/arch/i386/compile/OWL i386
>Description:
Ethernet address in dotted notation can vary in width:
ff.ff.ff.ff.ff.ff at 16 chars wide is the largest
0.0.0.0.0.0 at 10 chars wide is the smallest
"netstat -i" column has room for 14 chars, but prints 15 and 16
char addresses in their entirety anyway. This messes up the
columns.
>How-To-Repeat:
before fix:
owl% netstat -i
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll
ep0 1500 <Link> 0.20.af.40.da.60 1204348 124 518647 2 0
ep0 1500 199 owl.dol-esa.gov 1204348 124 518647 2 0
lo0 32768 <Link> 530 0 530 0 0
lo0 32768 127 localhost 530 0 530 0 0
after fix:
owl% netstat -i
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll
ep0 1500 <Link> 0.20.af.40.da.60 1204348 124 518647 2 0
ep0 1500 199 owl.dol-esa.gov 1204348 124 518647 2 0
lo0 32768 <Link> 530 0 530 0 0
lo0 32768 127 localhost 530 0 530 0 0
>Fix:
owl% ident if.c
if.c:
$Id: if.c,v 1.11 1995/07/03 03:16:57 mycroft Exp $
--- if.c.orig Tue Aug 15 00:56:31 1995
+++ if.c Tue Aug 15 00:56:31 1995
@@ -92,7 +92,7 @@
}
if (kread(ifnetaddr, (char *)&ifnetaddr, sizeof ifnetaddr))
return;
- printf("%-5.5s %-5.5s %-11.11s %-15.15s %8.8s %5.5s %8.8s %5.5s",
+ printf("%-5.5s %-5.5s %-11.11s %-17.17s %8.8s %5.5s %8.8s %5.5s",
"Name", "Mtu", "Network", "Address", "Ipkts", "Ierrs",
"Opkts", "Oerrs");
printf(" %5s", "Coll");
@@ -155,7 +155,7 @@
netname(ifaddr.in.ia_subnet,
ifaddr.in.ia_subnetmask));
#endif
- printf("%-15.15s ",
+ printf("%-17.17s ",
routename(sin->sin_addr.s_addr));
if (aflag) {
@@ -206,7 +206,7 @@
while (--n >= 0)
m += printf("%x%c", *cp++ & 0xff,
n > 0 ? '.' : ' ');
- m = 28 - m;
+ m = 30 - m;
while (m-- > 0)
putchar(' ');
break;
>Audit-Trail:
>Unformatted: