diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2009-04-21 17:44:46 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2009-04-21 17:44:46 +0000 |
commit | 657f6b7fcd165570b0303362ce9e16a788c97477 (patch) | |
tree | 78a77414a835d53f2edf0495eeb7542122710c42 | |
parent | 39269483ab3dc0bd700944c0ffea95263811f574 (diff) | |
download | FreeBSD-src-657f6b7fcd165570b0303362ce9e16a788c97477.zip FreeBSD-src-657f6b7fcd165570b0303362ce9e16a788c97477.tar.gz |
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)
-rw-r--r-- | usr.bin/ncal/ncal.c | 11 |
1 files changed, 7 insertions, 4 deletions
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(); |