svn commit: r223931 - head/usr.bin/ncal

Edwin Groothuis edwin at FreeBSD.org
Mon Jul 11 10:41:09 UTC 2011


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


More information about the svn-src-all mailing list