disable -h

A date picker doesn't make sense without a highlighted date.
This commit is contained in:
Kartik K. Agaram 2022-02-15 16:34:23 -08:00
parent 5963b62aee
commit 2ad490cbb4
2 changed files with 2 additions and 22 deletions

2
ncal.1
View File

@ -96,8 +96,6 @@ the current month is displayed.
.Pp .Pp
The options are as follows: The options are as follows:
.Bl -tag -width indent .Bl -tag -width indent
.It Fl h
Turns off highlighting of today.
.It Fl J .It Fl J
Display Julian Calendar, if combined with the Display Julian Calendar, if combined with the
.Fl o .Fl o

22
ncal.c
View File

@ -161,7 +161,6 @@ static char jdaystr[] = " 1 2 3 4 5 6 7 8 9"
" 350 351 352 353 354 355 356 357 358 359" " 350 351 352 353 354 355 356 357 358 359"
" 360 361 362 363 364 365 366"; " 360 361 362 363 364 365 366";
static int flag_nohighlight; /* user doesn't want a highlighted today */
static int flag_weeks; /* user wants number of week */ static int flag_weeks; /* user wants number of week */
static int nswitch; /* user defined switch date */ static int nswitch; /* user defined switch date */
static int nswitchb; /* switch date for backward compatibility */ static int nswitchb; /* switch date for backward compatibility */
@ -221,7 +220,6 @@ main(int argc, char *argv[])
int before, after; int before, after;
const char *locale; /* locale to get country code */ const char *locale; /* locale to get country code */
flag_nohighlight = 0;
flag_weeks = 0; flag_weeks = 0;
/* /*
@ -311,13 +309,6 @@ main(int argc, char *argv[])
no_backward = 1; no_backward = 1;
flag_highlightdate = optarg; flag_highlightdate = optarg;
break; break;
case 'h':
if (flag_backward)
usage();
else
no_backward = 1;
flag_nohighlight = 1;
break;
case 'e': case 'e':
if (flag_backward) if (flag_backward)
usage(); usage();
@ -922,7 +913,7 @@ mkmonthr(int y, int m, int jd_flag, struct monthlines *mlines)
dt.d = j - jan1 + 1; dt.d = j - jan1 + 1;
else else
sdater(j, &dt); sdater(j, &dt);
if (j == highlightdate && !flag_nohighlight if (j == highlightdate
&& isatty(STDOUT_FILENO)) && isatty(STDOUT_FILENO))
highlight(mlines->lines[i] + k, highlight(mlines->lines[i] + k,
ds + dt.d * dw, dw, &l); ds + dt.d * dw, dw, &l);
@ -1033,7 +1024,7 @@ mkmonthb(int y, int m, int jd_flag, struct monthlines *mlines)
dt.d = j - jan1 + 1; dt.d = j - jan1 + 1;
else else
sdateb(j, &dt); sdateb(j, &dt);
if (j == highlightdate && !flag_nohighlight) if (j == highlightdate)
highlight(mlines->lines[i] + k + l, highlight(mlines->lines[i] + k + l,
ds + dt.d * dw, dw, &l); ds + dt.d * dw, dw, &l);
else else
@ -1239,15 +1230,6 @@ highlight(char *dst, char *src, int len, int *extralen)
first = 0; first = 0;
} }
/*
* This check is not necessary, should have been handled before calling
* this function.
*/
if (flag_nohighlight) {
memcpy(dst, src, len);
return;
}
/* /*
* If it is a real terminal, use the data from the termcap database. * If it is a real terminal, use the data from the termcap database.
*/ */