From 932a4576ce371ae9bdf290f24e76240ec71fb482 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Wed, 3 Oct 2007 11:49:08 +0000 Subject: Respect COLUMNS --- src/libeinfo.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/libeinfo.c b/src/libeinfo.c index f7b62b5c..f157423f 100644 --- a/src/libeinfo.c +++ b/src/libeinfo.c @@ -176,6 +176,15 @@ static bool colour_terminal (void) static int get_term_columns (FILE *stream) { struct winsize ws; + char *env = getenv ("COLUMNS"); + char *p; + int i; + + if (env) { + i = strtol (env, &p, 10); + if (! *p) + return (i); + } if (ioctl (fileno (stream), TIOCGWINSZ, &ws) == 0) return (ws.ws_col); -- cgit v1.2.3