mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-08 09:39:38 +00:00
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:
parent
d9a2713bb5
commit
34994fcd8e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=5158
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user