diff options
author | Edwin Groothuis <edwin@FreeBSD.org> | 2011-07-11 10:41:08 +0000 |
---|---|---|
committer | Edwin Groothuis <edwin@FreeBSD.org> | 2011-07-11 10:41:08 +0000 |
commit | f379d691e54dd2e103f8a36d063999bcdb8b2729 (patch) | |
tree | 7c6b534702a37555c1c8c3da757992f3a53f2b76 /usr.bin/ncal | |
parent | 0857ee8cb8701b33d5364e8a32273288a7cca874 (diff) | |
download | src-f379d691e54dd2e103f8a36d063999bcdb8b2729.tar.gz src-f379d691e54dd2e103f8a36d063999bcdb8b2729.zip |
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
Notes
Notes:
svn path=/head/; revision=223931
Diffstat (limited to 'usr.bin/ncal')
-rw-r--r-- | usr.bin/ncal/ncal.1 | 2 | ||||
-rw-r--r-- | usr.bin/ncal/ncal.c | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/ncal/ncal.1 b/usr.bin/ncal/ncal.1 index 8429906395ca..bd3b71c25e86 100644 --- a/usr.bin/ncal/ncal.1 +++ b/usr.bin/ncal/ncal.1 @@ -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 diff --git a/usr.bin/ncal/ncal.c b/usr.bin/ncal/ncal.c index 44e31fec1db6..2ca770a2b781 100644 --- a/usr.bin/ncal/ncal.c +++ b/usr.bin/ncal/ncal.c @@ -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 |