ncal(1) highlights the current date (or a date provided via parameter)

even if stdout is not a tty. If stdout is not a tty the data is
normally processed by other tools and no control sequences are
expected.

PR:		bin/158580
MFC after:	1 week
This commit is contained in:
Edwin Groothuis 2011-07-11 10:41:08 +00:00
parent 0857ee8cb8
commit f379d691e5
2 changed files with 4 additions and 1 deletions

View File

@ -171,6 +171,8 @@ that, two after that and the whole year.
will warn about these combinations.
.Pp
A year starts on January 1.
.P
Highlighting of dates is disabled if stdout is not a tty.
.Sh SEE ALSO
.Xr calendar 3 ,
.Xr strftime 3

View File

@ -822,7 +822,8 @@ mkmonthr(int y, int m, int jd_flag, struct monthlines *mlines)
dt.d = j - jan1 + 1;
else
sdater(j, &dt);
if (j == highlightdate && !flag_nohighlight)
if (j == highlightdate && !flag_nohighlight
&& isatty(STDOUT_FILENO))
highlight(mlines->lines[i] + k,
ds + dt.d * dw, dw, &l);
else