summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.bin/netstat/if.c20
-rw-r--r--usr.bin/netstat/netstat.18
-rw-r--r--usr.bin/netstat/route.c4
3 files changed, 25 insertions, 7 deletions
diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c
index b2527cd..49a08c7 100644
--- a/usr.bin/netstat/if.c
+++ b/usr.bin/netstat/if.c
@@ -188,8 +188,12 @@ intpr(int _interval, u_long ifnetaddr, void (*pfunc)(char *))
return;
if (!pfunc) {
- printf("%-5.5s %5.5s %-13.13s %-17.17s %8.8s %5.5s",
- "Name", "Mtu", "Network", "Address", "Ipkts", "Ierrs");
+ if (Wflag)
+ printf("%-7.7s", "Name");
+ else
+ printf("%-5.5s", "Name");
+ printf(" %5.5s %-13.13s %-17.17s %8.8s %5.5s",
+ "Mtu", "Network", "Address", "Ipkts", "Ierrs");
if (bflag)
printf(" %10.10s","Ibytes");
printf(" %8.8s %5.5s", "Opkts", "Oerrs");
@@ -251,7 +255,11 @@ intpr(int _interval, u_long ifnetaddr, void (*pfunc)(char *))
drops = ifnet.if_snd.ifq_drops;
if (ifaddraddr == 0) {
- printf("%-5.5s %5lu ", name, ifnet.if_mtu);
+ if (Wflag)
+ printf("%-7.7s", name);
+ else
+ printf("%-5.5s", name);
+ printf(" %5lu ", ifnet.if_mtu);
printf("%-13.13s ", "none");
printf("%-17.17s ", "none");
} else {
@@ -268,7 +276,11 @@ intpr(int _interval, u_long ifnetaddr, void (*pfunc)(char *))
(u_long)TAILQ_NEXT(&ifaddr.ifa, ifa_link);
continue;
}
- printf("%-5.5s %5lu ", name, ifnet.if_mtu);
+ if (Wflag)
+ printf("%-7.7s", name);
+ else
+ printf("%-5.5s", name);
+ printf(" %5lu ", ifnet.if_mtu);
switch (sa->sa_family) {
case AF_UNSPEC:
printf("%-13.13s ", "none");
diff --git a/usr.bin/netstat/netstat.1 b/usr.bin/netstat/netstat.1
index f8e2788..3071ad4 100644
--- a/usr.bin/netstat/netstat.1
+++ b/usr.bin/netstat/netstat.1
@@ -119,6 +119,9 @@ is also present, show the number of dropped packets.
If
.Fl t
is also present, show the contents of watchdog timers.
+If
+.Fl W
+is also present, print interface names using a wider field size.
.It Xo
.Bk -words
.Nm
@@ -215,7 +218,10 @@ When
.Fl W
is also present,
show the path MTU
-for each route.
+for each route,
+and print interface
+names with a wider
+field size.
.It Xo
.Bk -words
.Nm
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c
index 3dcd910..d1d8bae 100644
--- a/usr.bin/netstat/route.c
+++ b/usr.bin/netstat/route.c
@@ -225,13 +225,13 @@ pr_family(int af1)
#ifndef INET6
#define WID_DST_DEFAULT(af) 18 /* width of destination column */
#define WID_GW_DEFAULT(af) 18 /* width of gateway column */
-#define WID_IF_DEFAULT(af) 6 /* width of netif column */
+#define WID_IF_DEFAULT(af) (Wflag ? 8 : 6) /* width of netif column */
#else
#define WID_DST_DEFAULT(af) \
((af) == AF_INET6 ? (numeric_addr ? 33: 18) : 18)
#define WID_GW_DEFAULT(af) \
((af) == AF_INET6 ? (numeric_addr ? 29 : 18) : 18)
-#define WID_IF_DEFAULT(af) ((af) == AF_INET6 ? 8 : 6)
+#define WID_IF_DEFAULT(af) ((af) == AF_INET6 ? 8 : (Wflag ? 8 : 6))
#endif /*INET6*/
static int wid_dst;
OpenPOWER on IntegriCloud