summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjoe <joe@FreeBSD.org>2000-08-13 12:17:03 +0000
committerjoe <joe@FreeBSD.org>2000-08-13 12:17:03 +0000
commit618f3c73bcd046609a46f358c78c2c358729c66b (patch)
tree37a989ebf8eaad0f5fd115aad5c1ed9c2568e386 /bin
parenta6430b961c695c800f6e708c4b9f774b4e92978f (diff)
downloadFreeBSD-src-618f3c73bcd046609a46f358c78c2c358729c66b.zip
FreeBSD-src-618f3c73bcd046609a46f358c78c2c358729c66b.tar.gz
Un-deprecate the -G flag at obrien's request. Colour sequences are still
dependent upon the output being directed to a terminal however. (Use the CLICOLOR_FORCE variable to force output).
Diffstat (limited to 'bin')
-rw-r--r--bin/ls/ls.120
-rw-r--r--bin/ls/ls.c11
2 files changed, 20 insertions, 11 deletions
diff --git a/bin/ls/ls.1 b/bin/ls/ls.1
index 7f48f12..29a303f 100644
--- a/bin/ls/ls.1
+++ b/bin/ls/ls.1
@@ -43,7 +43,7 @@
.Nd list directory contents
.Sh SYNOPSIS
.Nm ls
-.Op Fl ABCFHLPRTWabcdfgiklnoqrstu1
+.Op Fl ABCFGHLPRTWabcdfgiklnoqrstu1
.Op Ar file ...
.Sh DESCRIPTION
For each operand that names a
@@ -91,8 +91,9 @@ a percent sign (%) after each whiteout,
and a vertical bar (|) after each that is a
.Tn FIFO .
.It Fl G
-This flag has been deprecated. Please use the
-.Ev CLICOLOR environment variable instead.
+Enable colorized output. This option is equivalent to defining
+.Ev CLICOLOR
+in the environment. (See below).
.It Fl H
Symbolic links on the command line are followed. This option is assumed if
none of the
@@ -395,10 +396,19 @@ you need to set your
.Ev TERM
variable to
.Dq xterm-color .
-Other terminal types may require similar adjustments.
+Other terminal types may require similar adjustments. Colorization
+is silently disabled if the output isn't directed to a terminal
+unless the
+.Ev CLICOLOR_FORCE
+variable is defined.
.It Ev CLICOLOR_FORCE
Color sequences are normally disabled if the output isn't directed to
-a color capable terminal. This can be overridden by setting this flag.
+a terminal. This can be overridden by setting this flag.
+The
+.Ev TERM
+variable still needs to reference a color capable terminal however
+otherwise it is not possible to determine which color sequences to
+use.
.It Ev COLUMNS
If this variable contains a string representing a
decimal integer, it is used as the
diff --git a/bin/ls/ls.c b/bin/ls/ls.c
index afed064..9070205 100644
--- a/bin/ls/ls.c
+++ b/bin/ls/ls.c
@@ -202,12 +202,7 @@ main(argc, argv)
fts_options |= FTS_COMFOLLOW;
break;
case 'G':
-#ifdef COLORLS
- (void)fprintf(stderr, "The -G flag is deprecated, please define CLICOLOR instead.\n");
setenv("CLICOLOR", "", 1);
-#else
- (void)fprintf(stderr, "Color support not compiled in.\n");
-#endif
break;
case 'L':
fts_options &= ~FTS_PHYSICAL;
@@ -282,10 +277,10 @@ main(argc, argv)
argc -= optind;
argv += optind;
-#ifdef COLORLS
/* Enabling of colours is conditional on the environment. */
if (getenv("CLICOLOR") &&
(isatty(STDOUT_FILENO) || getenv("CLICOLOR_FORCE")))
+#ifdef COLORLS
if (tgetent(termcapbuf, getenv("TERM")) == 1) {
ansi_fgcol = tgetstr("AF", &bp);
ansi_bgcol = tgetstr("AB", &bp);
@@ -299,7 +294,11 @@ main(argc, argv)
if (ansi_fgcol && ansi_bgcol && ansi_coloff)
f_color = 1;
}
+#else
+ (void)fprintf(stderr, "Color support not compiled in.\n");
+#endif /*COLORLS*/
+#ifdef COLORLS
if (f_color) {
/*
* We can't put tabs and color sequences together:
OpenPOWER on IntegriCloud