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

Keng-Yu Lin kengyu at canonical.com
Wed Feb 12 04:52:38 UTC 2014


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;
 
-- 
1.8.1.2




More information about the fwts-devel mailing list