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
This commit is contained in:
joerg 1994-12-18 19:00:01 +00:00
parent a08ba0961a
commit 30a0fe9c66

View File

@ -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())