Date: Mon, 11 Jul 2011 10:41:09 +0000 (UTC) From: Edwin Groothuis <edwin@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r223931 - head/usr.bin/ncal Message-ID: <201107111041.p6BAf9Vp086657@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: edwin Date: Mon Jul 11 10:41:08 2011 New Revision: 223931 URL: http://svn.freebsd.org/changeset/base/223931 Log: 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 Modified: head/usr.bin/ncal/ncal.1 head/usr.bin/ncal/ncal.c Modified: head/usr.bin/ncal/ncal.1 ============================================================================== --- head/usr.bin/ncal/ncal.1 Mon Jul 11 10:02:27 2011 (r223930) +++ head/usr.bin/ncal/ncal.1 Mon Jul 11 10:41:08 2011 (r223931) @@ -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 Modified: head/usr.bin/ncal/ncal.c ============================================================================== --- head/usr.bin/ncal/ncal.c Mon Jul 11 10:02:27 2011 (r223930) +++ head/usr.bin/ncal/ncal.c Mon Jul 11 10:41:08 2011 (r223931) @@ -822,7 +822,8 @@ mkmonthr(int y, int m, int jd_flag, stru 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107111041.p6BAf9Vp086657>