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

Roman Divacky rdivacky at FreeBSD.org
Tue Apr 21 17:44:47 UTC 2009


Author: rdivacky
Date: Tue Apr 21 17:44:46 2009
New Revision: 191364
URL: http://svn.freebsd.org/changeset/base/191364

Log:
  Couple of changes based on feedback
  
  	o	Change mr/me to so/se [1].
  	o	Introduce a -h option to disable highlighting. [2]
  	o	Spell STDOUT_FILENO as such and pass NULL to tgetent()
  		to handle the case of unset TERM. [3]
  
  Suggested by:	naddy mips.inka.de (Christian Weisgerber) [1]
  Requested by:	danfe, deischen	[2]
  Suggested by:	jmallett	[3]
  Approved by:	ed (mentor)

Modified:
  head/usr.bin/ncal/ncal.c

Modified: head/usr.bin/ncal/ncal.c
==============================================================================
--- head/usr.bin/ncal/ncal.c	Tue Apr 21 17:08:02 2009	(r191363)
+++ head/usr.bin/ncal/ncal.c	Tue Apr 21 17:44:46 2009	(r191364)
@@ -209,12 +209,12 @@ main(int argc, char *argv[])
 
 	term_e = term_r = NULL;
 	today = 0;
-	if (isatty(1) && tgetent(tbuf, getenv("TERM")) == 1) {
+	if (isatty(STDOUT_FILENO) && tgetent(tbuf, NULL) == 1) {
 		date	dt;		/* handy date */
 
 		b = cbuf;
-		term_r = tgetstr("mr", &b);
-		term_e = tgetstr("me", &b);
+		term_r = tgetstr("so", &b);
+		term_e = tgetstr("se", &b);
 		t = time(NULL);
 		tm1 = localtime(&t);
 		dt.y = tm1->tm_year + 1900;
@@ -263,7 +263,7 @@ main(int argc, char *argv[])
 	if (flag_backward)
 		nswitchb = ndaysj(&ukswitch);
 
-	while ((ch = getopt(argc, argv, "Jejm:ops:wy")) != -1)
+	while ((ch = getopt(argc, argv, "Jehjm:ops:wy")) != -1)
 		switch (ch) {
 		case 'J':
 			if (flag_backward)
@@ -271,6 +271,9 @@ main(int argc, char *argv[])
 			nswitch = ndaysj(&never);
 			flag_julian_cal = 1;
 			break;
+		case 'h':
+			term_r = term_e = NULL;
+			break;
 		case 'e':
 			if (flag_backward)
 				usage();


More information about the svn-src-head mailing list