1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-29 08:08:37 +00:00

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)
This commit is contained in:
Roman Divacky 2009-04-21 17:44:46 +00:00
parent d5b3a507de
commit 0cd51de155
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=191364

View File

@ -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();