ifconfig(8): Add '-f' option to print in more formats
authorAaron LI <aly@aaronly.me>
Fri, 26 Jun 2020 06:02:58 +0000 (14:02 +0800)
committerAaron LI <aly@aaronly.me>
Fri, 26 Jun 2020 14:53:00 +0000 (22:53 +0800)
commit51a3d09e9966badabd8cb22a3721055a7ff47e20
tree4f87662447f821e71588e378e5a03ac9083849c6
parent2ecde6140905fddab3e25c30b54bfe405886f488
ifconfig(8): Add '-f' option to print in more formats

* Add the '-f' option to control the output formats of addresses,
  inet (IPv4) subnet masks, inet6 (IPv6) prefix length, Ethernet (MAC)
  address.  The following output formats are supported:

  - address: numeric (default), host, FQDN
  - inet (IPv4) subnet masks: CIDR, dotted-quad, and traditional hex
    output (default)
  - inet6 (IPv6) prefix length: CIDR, traditional integer format
    (default)
  - ether (MAC address): colon-separated (default), dash-separated

* The 'IFCONFIG_FORMAT' environment variable has the same usage as the
  '-f' option and can be overrided by the latter.

* Some minor cleanups.

Obtained from FreeBSD (revisions 301059 and 301185; review D2856), but
with my own minor modifications.
sbin/ifconfig/af_inet.c
sbin/ifconfig/af_inet6.c
sbin/ifconfig/af_link.c
sbin/ifconfig/ifconfig.8
sbin/ifconfig/ifconfig.c
sbin/ifconfig/ifconfig.h