]> git.proxmox.com Git - mirror_iproute2.git/commit
ss: Implement automatic column width calculation
authorStefano Brivio <sbrivio@redhat.com>
Tue, 12 Dec 2017 00:46:33 +0000 (01:46 +0100)
committerStephen Hemminger <stephen@networkplumber.org>
Tue, 12 Dec 2017 20:11:37 +0000 (12:11 -0800)
commit87b1a7aec762503c7befd2fd041f7c84ca4d3fe0
tree42ebfd1c2cfd79b7fc818301c0364b371337bfac
parent691bd854bf4abcd4ef7ddeeae56450ec81d32872
ss: Implement automatic column width calculation

Group fitting fields into lines and space them equally using the
remaining screen width for each line. If columns don't fit on
one line, break them into the least possible amount of lines and
keep them aligned across lines.

This is done by:
 - recording the length of the longest item in each column during
   formatting and buffering (which was added in the previous patch)
 - fitting as many fields as possible on each line of output
 - distributing the remaining padding space equally between the
   columns

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
misc/ss.c