opnsense-src/usr.bin/netstat
Mike Karels 372e3d561d netstat -i: compute most field widths dynamically
The network and address fields were sometimes truncated for netstat -i
without -W, and often much too wide for netstat -i with the -W option.
Fields such as normal packet counts often overflowed.  As a result,
columns didn't line up, and large white spaces made it harder to
follow a line across the display.  Change the code to compute the
required field sizes for network, address, and various packet counts.
Hoist the code to format network and address into a subroutine that
can be called twice, once to measure the required field widths,
and once to emit the values.  Use separate field widths for input
and output packets, byte counts, and error and drop counters.
These are left at defaults (the preceding values) with the -h
option, in which case the fields have a limited total width.
An extra space is included between the Network and Address, which
otherwise seemed too close.

Change the mention of -W with -i in the man page to say that most
field widths are computed dynamically in this case.

MFC after:	1 week
Reviewed by:	sjg, glebius
Differential Revision:	https://reviews.freebsd.org/D41160
2023-07-26 10:56:52 -05:00
..
bpf.c spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
common.c usr.bin/netstat: use roundup2 when rounding up to power of 2. 2021-05-02 09:30:22 -07:00
common.h netstat: export weight for single-path routes. 2023-01-29 16:27:31 +00:00
if.c netstat -i: compute most field widths dynamically 2023-07-26 10:56:52 -05:00
inet.c netstat: display c and C flags properly 2023-06-09 23:58:00 +02:00
inet6.c netinet6: Fix mbuf leak in NDP 2022-05-31 21:06:14 +00:00
ipsec.c ipsec(4): Fix a few typos in error messages 2022-02-06 13:43:42 +01:00
main.c Mark usage function as __dead2 in programs where it does not return 2023-07-07 10:45:18 -06:00
Makefile netlink: add NETLINK/NETLINK_SUPPORT userland options. 2023-03-26 08:59:58 +00:00
Makefile.depend Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
Makefile.depend.options Add Makefile.depend.options 2019-12-11 17:37:37 +00:00
mbuf.c spdx: initial adoption of licensing ID tags. 2017-11-18 14:26:50 +00:00
mroute.c netstat: Use valid prototypes for function declarations with no arguments. 2023-04-24 08:53:50 -07:00
mroute6.c netstat: Use valid prototypes for function declarations with no arguments. 2023-04-24 08:53:50 -07:00
netgraph.c Hide struct socket and struct unpcb from the userland. 2017-10-02 23:29:56 +00:00
netisr.c spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
netstat.1 netstat -i: compute most field widths dynamically 2023-07-26 10:56:52 -05:00
netstat.h divert(4): provide statistics 2022-08-30 15:09:21 -07:00
nhgrp.c spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
nhops.c netstat: fix nhop prepend printing. 2021-12-26 15:05:10 +00:00
nlist_symbols netstat: cleanup 2023-04-20 23:52:19 +02:00
pfkey.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
route.c netlink: add NETLINK/NETLINK_SUPPORT userland options. 2023-03-26 08:59:58 +00:00
route_netlink.c netlink: use newly-added snl(3) array parsing for handling multipath 2023-05-27 11:13:14 +00:00
sctp.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
unix.c Use uintptr_t alone when assigning to kvaddr_t variables. 2018-07-10 13:03:06 +00:00