[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f1e0e2e6-8f59-d0ee-9b70-c8c10ee42733@gmail.com>
Date: Thu, 2 Jan 2020 11:42:26 -0700
From: David Ahern <dsahern@...il.com>
To: Peter Junos <petoju@...il.com>,
Stephen Hemminger <stephen@...workplumber.org>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH net-next] ss: use compact output for undetected screen
width
On 12/26/19 6:07 AM, Peter Junos wrote:
> This change fixes calculation of width in case user pipes the output.
>
> SS output output works correctly when stdout is a terminal. When one
> pipes the output, it tries to use 80 or 160 columns. That adds a
> line-break if user has terminal width of 100 chars and output is of
> the similar width. No width is assumed here.
>
> To reproduce the issue, call
> ss | less
> and see every other line empty if your screen is between 80 and 160
> columns wide.
>
> This second version of the patch fixes screen_width being set to arbitrary
> value.
>
> Signed-off-by: Peter Junos <petoju@...il.com>
> ---
> misc/ss.c | 19 +++++++++++++++----
> 1 file changed, 15 insertions(+), 4 deletions(-)
>
...
> @@ -1159,9 +1159,15 @@ static int render_screen_width(void)
> */
> static void render_calc_width(void)
> {
> - int screen_width = render_screen_width();
> + int screen_width, first, len = 0, linecols = 0;
> + bool compact_output = false;
> struct column *c, *eol = columns - 1;
> - int first, len = 0, linecols = 0;
moved the new bool after struct column to maintain reverse xmas tree and
applied to iproute2-next. Thanks,
Powered by blists - more mailing lists