[PATCH] lib: fwts_args: determine tty width from stdin

Colin Ian King colin.king at canonical.com
Wed Feb 12 09:02:00 UTC 2014


On 12/02/14 04:52, Keng-Yu Lin wrote:
> Newer version of Automake redirects the stderr. So the tty winsize
> can't be determined as istty() failes.
> 
> As we do not use fwts like `fwts < inputfile`, so it is safe to use
> the stdin for determining the tty winsize.
> 
> Signed-off-by: Keng-Yu Lin <kengyu at canonical.com>
> ---
>  src/lib/src/fwts_args.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/lib/src/fwts_args.c b/src/lib/src/fwts_args.c
> index 631ba5f..19c7488 100644
> --- a/src/lib/src/fwts_args.c
> +++ b/src/lib/src/fwts_args.c
> @@ -264,7 +264,7 @@ void fwts_args_show_options(void)
>  
>  	fwts_list_init(&sorted_options);
>  
> -	width = fwts_tty_width(fileno(stderr), FWTS_MIN_TTY_WIDTH);
> +	width = fwts_tty_width(fileno(stdin), FWTS_MIN_TTY_WIDTH);
>  	if ((width - (FWTS_ARGS_WIDTH + 1)) < 0)
>  		width = FWTS_MIN_TTY_WIDTH;
>  
> 
Very reasonable.

Acked-by: Colin Ian King <colin.king at canonical.com>



More information about the fwts-devel mailing list