aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/netstat/if.c
diff options
context:
space:
mode:
authorHajimu UMEMOTO <ume@FreeBSD.org>2015-11-04 16:59:12 +0000
committerHajimu UMEMOTO <ume@FreeBSD.org>2015-11-04 16:59:12 +0000
commit86a598950f360ee0b65775882c2d66b4cf3ee58b (patch)
treeec8fb6068fc64291ea033c08b3ce7ef04cad98f0 /usr.bin/netstat/if.c
parent36fb9d5fc8d5e848c190f7f32e639c12c4057478 (diff)
downloadsrc-86a598950f360ee0b65775882c2d66b4cf3ee58b.tar.gz
src-86a598950f360ee0b65775882c2d66b4cf3ee58b.zip
Notes
Diffstat (limited to 'usr.bin/netstat/if.c')
-rw-r--r--usr.bin/netstat/if.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c
index 0ae8645a9595..11bde27042f8 100644
--- a/usr.bin/netstat/if.c
+++ b/usr.bin/netstat/if.c
@@ -272,7 +272,6 @@ intpr(void (*pfunc)(char *), int af)
struct ifaddrs *ifap, *ifa;
struct ifmaddrs *ifmap, *ifma;
u_int ifn_len_max = 5, ifn_len;
- char ifn_hdr_fmt[14], ifn_bdy_fmt[41];
if (interval)
return sidewaysintpr();
@@ -295,15 +294,10 @@ intpr(void (*pfunc)(char *), int af)
ifn_len_max = MAX(ifn_len_max, ifn_len);
}
}
- snprintf(ifn_hdr_fmt, sizeof(ifn_hdr_fmt), "{T:/%%-%d.%ds}",
- ifn_len_max, ifn_len_max);
- snprintf(ifn_bdy_fmt, sizeof(ifn_bdy_fmt),
- "{etk:name/%%s}{e:flags/0x%%x}{d:/%%-%d.%ds}", ifn_len_max,
- ifn_len_max);
xo_open_list("interface");
if (!pfunc) {
- xo_emit(ifn_hdr_fmt, "Name");
+ xo_emit("{T:/%-*.*s}", ifn_len_max, ifn_len_max, "Name");
xo_emit(" {T:/%5.5s} {T:/%-13.13s} {T:/%-17.17s} {T:/%8.8s} "
"{T:/%5.5s} {T:/%5.5s}",
"Mtu", "Network", "Address", "Ipkts", "Ierrs", "Idrop");
@@ -354,7 +348,8 @@ intpr(void (*pfunc)(char *), int af)
} else
xname = name;
- xo_emit(ifn_bdy_fmt, name, ifa->ifa_flags, xname);
+ xo_emit("{etk:name/%s}{e:flags/0x%x}{d:/%-*.*s}",
+ name, ifa->ifa_flags, ifn_len_max, ifn_len_max, xname);
#define IFA_MTU(ifa) (((struct if_data *)(ifa)->ifa_data)->ifi_mtu)
show_stat("lu", 6, "mtu", IFA_MTU(ifa), IFA_MTU(ifa), 0);