From 657f6b7fcd165570b0303362ce9e16a788c97477 Mon Sep 17 00:00:00 2001 From: rdivacky Date: Tue, 21 Apr 2009 17:44:46 +0000 Subject: 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) --- usr.bin/ncal/ncal.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'usr.bin/ncal/ncal.c') diff --git a/usr.bin/ncal/ncal.c b/usr.bin/ncal/ncal.c index 49d78c4..d5e0f1a 100644 --- a/usr.bin/ncal/ncal.c +++ b/usr.bin/ncal/ncal.c @@ -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(); -- cgit v1.1