iproute2: add json and color support
Subsystems (2)
RFC 1/1 iproute2: add json and color support
This patch makes ip route command have json and color output in a similar fashion of ip link and address.
The printing is split into functions and duplicate code removed.
Probably incomplete, and has formatting glitches.
--- include/utils.h | 4 + ip/iproute.c | 764 ++++++++++++++++++++++++++++++++++---------------------- 2 files changed, 469 insertions(+), 299 deletions(-)
include/utils.h +4 -0
@@ -155,6 +155,10 @@ int af_byte_len(int af);const char *format_host_r (int af,int len,const void *addr,char *buf,int buflen); +#define format_host_rta_r (af, rta, buf, buflen) \ + format_host_r(af, RTA_PAYLOAD(rta), RTA_DATA(rta), \ + buf, buflen) +const char *format_host (int af,int lne,const void *addr);#define format_host_rta (af, rta) \ format_host(af, RTA_PAYLOAD(rta), RTA_DATA(rta))
ip/iproute.c +465 -299
888 lines not on this page · raw message
Signature · 1 line
2.15.1
Quoted 6 lines · Stephen Hemminger
This patch makes ip route command have json and color output in a similar fashion of ip link and address.
The printing is split into functions and duplicate code removed.
Quoted 6 lines
Probably incomplete, and has formatting glitches.
--- include/utils.h | 4 + ip/iproute.c | 764 ++++++++++++++++++++++++++++++++++---------------------- 2 files changed, 469 insertions(+), 299 deletions(-)
good idea. 469 insert, 299 delete makes this really complicated. Splitting this into smaller patches will be helpful.