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
The options are as follows:
.Bl -tag -width indent
.It Fl h
Turns off highlighting of today.
.It Fl J
Display Julian Calendar, if combined with the
.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"
" 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 nswitch; /* user defined switch date */
static int nswitchb; /* switch date for backward compatibility */
@ -221,7 +220,6 @@ main(int argc, char *argv[])
int before, after;
const char *locale; /* locale to get country code */
flag_nohighlight = 0;
flag_weeks = 0;
/*
@ -311,13 +309,6 @@ main(int argc, char *argv[])
no_backward = 1;
flag_highlightdate = optarg;
break;
case 'h':
if (flag_backward)
usage();
else
no_backward = 1;
flag_nohighlight = 1;
break;
case 'e':
if (flag_backward)
usage();
@ -922,7 +913,7 @@ mkmonthr(int y, int m, int jd_flag, struct monthlines *mlines)
dt.d = j - jan1 + 1;
else
sdater(j, &dt);
if (j == highlightdate && !flag_nohighlight
if (j == highlightdate
&& isatty(STDOUT_FILENO))
highlight(mlines->lines[i] + k,
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;
else
sdateb(j, &dt);
if (j == highlightdate && !flag_nohighlight)
if (j == highlightdate)
highlight(mlines->lines[i] + k + l,
ds + dt.d * dw, dw, &l);
else
@ -1239,15 +1230,6 @@ highlight(char *dst, char *src, int len, int *extralen)
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.
*/