diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libeinfo.c | 9 |
1 files changed, 9 insertions, 0 deletions
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); |