diff options
author | joerg <joerg@FreeBSD.org> | 1994-12-18 19:00:01 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 1994-12-18 19:00:01 +0000 |
commit | 30a0fe9c6678c8a036489ab7a1158bc052d2cf77 (patch) | |
tree | 5bcb9eddf8843998861a58948c87e8b220373ab8 | |
parent | a08ba0961a80b5d2aaeb35e3a116d3834881a9e1 (diff) | |
download | FreeBSD-src-30a0fe9c6678c8a036489ab7a1158bc052d2cf77.zip FreeBSD-src-30a0fe9c6678c8a036489ab7a1158bc052d2cf77.tar.gz |
Make ls recognize the COLUMNS environmental variable, even
in cases where it does not run on a terminal. This is important
e.g. for commands like
env COLUMNS=132 ls -CR | lpr -Psome-wide-printer
-rw-r--r-- | bin/ls/ls.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/ls/ls.c b/bin/ls/ls.c index 560731f..d2047c9 100644 --- a/bin/ls/ls.c +++ b/bin/ls/ls.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: ls.c,v 1.3 1994/09/24 02:55:54 davidg Exp $ */ #ifndef lint @@ -114,8 +114,12 @@ main(argc, argv) else 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")) + termwidth = atoi(p); + } /* Root is -A automatically. */ if (!getuid()) |