netstat -iW strip interface name to 7 symbols

Mykola Dzham freebsd at levsha.org.ua
Wed Dec 12 16:35:10 PST 2007


I use ifconfig vlanXXX name ... for setting interfaces names that make
sense for me (for example name of parity on remote side on this link).
But when i run netstat -iW interface names striped to 7 symbols, though
"If -W is also present, print interface names using a wider field size".
I think that 7 symbols is not enough wide: ifconfig ... name allow up
to 16 symbols. Attached trivial patch expand interface name field to 16
chars, but my question is "is 7 symbol length is set specially?"

-- 
Mykola Dzham, LEFT-(UANIC|RIPE)
JID: levsha at jabber.net.ua
-------------- next part --------------
--- usr.bin/netstat/if.c.orig	2007-12-12 23:55:55.000000000 +0200
+++ usr.bin/netstat/if.c	2007-12-12 23:57:07.000000000 +0200
@@ -222,7 +222,7 @@
 
 	if (!pfunc) {
 		if (Wflag)
-			printf("%-7.7s", "Name");
+			printf("%-16.16s", "Name");
 		else
 			printf("%-5.5s", "Name");
 		printf(" %5.5s %-13.13s %-17.17s %8.8s %5.5s",
@@ -291,7 +291,7 @@
 
 		if (ifaddraddr == 0) {
 			if (Wflag)
-				printf("%-7.7s", name);
+				printf("%-16.16s", name);
 			else
 				printf("%-5.5s", name);
 			printf(" %5lu ", ifnet.if_mtu);
@@ -312,7 +312,7 @@
 				continue;
 			}
 			if (Wflag)
-				printf("%-7.7s", name);
+				printf("%-16.16s", name);
 			else
 				printf("%-5.5s", name);
 			printf(" %5lu ", ifnet.if_mtu);


More information about the freebsd-net mailing list