Ignore COLUMNS environment variable if it is empty (SUSv3)

This commit is contained in:
Tim J. Robbins 2002-06-04 10:00:08 +00:00
parent 8358edb6c7
commit 3714ae1254
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=97801

View File

@ -470,7 +470,7 @@ lputs(s)
static int termwidth = -1;
if (termwidth == -1) {
if ((p = getenv("COLUMNS")))
if ((p = getenv("COLUMNS")) && *p != '\0')
termwidth = atoi(p);
else if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &win) == 0 &&
win.ws_col > 0)