1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-23 04:23:08 +00:00

Disable outputting colour codes if STDOUT isn't a tty.

PR:		8620
Submitted by:	Martin Blapp <mb@imp.ch>
This commit is contained in:
Chris Piazza 1999-11-21 19:57:13 +00:00
parent eb80ba9b12
commit 427f823861
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=23242

View File

@ -1,5 +1,5 @@
--- ./ls.c.org Sun Jul 19 23:29:17 1998
+++ ./ls.c Mon Aug 24 01:25:50 1998
--- ls.c.orig Sun Jul 19 23:29:17 1998
+++ ls.c Sun Nov 21 11:51:18 1999
@@ -94,6 +94,7 @@
int f_statustime; /* use time of last mode change */
int f_timesort; /* sort by time vice name */
@ -17,17 +17,18 @@
switch (ch) {
/*
* The -1, -C and -l options all override each other so shell
@@ -169,6 +170,9 @@
@@ -169,6 +170,10 @@
case 'H':
fts_options |= FTS_COMFOLLOW;
break;
+ case 'G':
+ f_color = 1;
+ if (isatty(STDOUT_FILENO))
+ f_color = 1;
+ break;
case 'L':
fts_options &= ~FTS_PHYSICAL;
fts_options |= FTS_LOGICAL;
@@ -236,18 +240,21 @@
@@ -236,18 +241,21 @@
argc -= optind;
argv += optind;