Subject: Re: colorls
To: Brad Salai <bsalai@tmonline.com>
From: Soren S. Jorvang <soren@t.dk>
List: current-users
Date: 04/29/1998 23:22:17
On Wed, 29 Apr 1998, Brad Salai wrote:

> I recently built colorls from the pkg system (what a great system) and have
> a minor quibble.
> 
> if I alias ls to /usr/pkg/bin/colorls -G  everything works as expected.
> 
> Problem is I want to do ls |more or ls -l |more ,  and more can't deal with
> the codes that change the colors.
> 
> Is there a way around this?

--- ls/ls.c	Wed Apr 29 23:02:33 1998
+++ ls.c	Wed Apr 29 23:01:18 1998
@@ -172,7 +172,8 @@
 			f_type = 1;
 			break;
 		case 'G':
-			f_color = 1;
+			if (isatty(STDOUT_FILENO))
+				f_color = 1;
 			break;
 		case 'L':
 			fts_options &= ~FTS_PHYSICAL;

I think this should be the default.


-- 
Soren