diff options
author | Todd T. Fries <todd@cvs.openbsd.org> | 2009-05-06 18:47:33 +0000 |
---|---|---|
committer | Todd T. Fries <todd@cvs.openbsd.org> | 2009-05-06 18:47:33 +0000 |
commit | 5678797431d2a9c8ef9967d5562a3c721bde6eb9 (patch) | |
tree | 90698ab06c18ba41c2957c4cdf37fb6a58f18e74 /bin | |
parent | 40f9a81b0ef6aa49565537dfd35f447c3095f1cb (diff) |
do not ignore COLUMNS in -C mode, even if !isatty(STDOUT_FILENO)
from FreeBSD
ok millert@, posix checked by jmc@
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ls/ls.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/bin/ls/ls.c b/bin/ls/ls.c index 136cb073df8..eb3a1d0e430 100644 --- a/bin/ls/ls.c +++ b/bin/ls/ls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ls.c,v 1.33 2008/12/30 15:37:30 otto Exp $ */ +/* $OpenBSD: ls.c,v 1.34 2009/05/06 18:47:32 todd Exp $ */ /* $NetBSD: ls.c,v 1.18 1996/07/09 09:16:29 mycroft Exp $ */ /* @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94"; #else -static char rcsid[] = "$OpenBSD: ls.c,v 1.33 2008/12/30 15:37:30 otto Exp $"; +static char rcsid[] = "$OpenBSD: ls.c,v 1.34 2009/05/06 18:47:32 todd Exp $"; #endif #endif /* not lint */ @@ -124,8 +124,12 @@ ls_main(int argc, char *argv[]) win.ws_col > 0) termwidth = win.ws_col; f_column = f_nonprint = 1; - } else + } else { f_singlecol = 1; + /* retrieve environment variable, in case of explicit -C */ + if ((p = getenv("COLUMNS")) != NULL) + termwidth = atoi(p); + } /* Root is -A automatically. */ if (!getuid()) |