From c187d793c6a369172ec1f0c8e37e46aa265fc5cd Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 15 Feb 2022 17:00:00 -0800 Subject: [PATCH] global -> local --- ncal.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/ncal.c b/ncal.c index 6d394b4..0e910ef 100644 --- a/ncal.c +++ b/ncal.c @@ -164,7 +164,6 @@ static char jdaystr[] = " 1 2 3 4 5 6 7 8 9" static int flag_weeks; /* user wants number of week */ static int nswitch; /* user defined switch date */ static int nswitchb; /* switch date for backward compatibility */ -static int highlightdate; int weekstart = -1; /* day the week starts on (Sun [0] - Sat [6]) */ static char *center(char *s, char *t, int w); @@ -172,14 +171,14 @@ static wchar_t *wcenter(wchar_t *s, wchar_t *t, int w); static int firstday(int y, int m); static void highlight(char *dst, char *src, int len, int *extraletters); static void mkmonthr(int year, int month, int jd_flag, - struct monthlines * monthl); + struct monthlines * monthl, int highlightdate); static void mkmonthb(int year, int month, int jd_flag, - struct monthlines * monthl); + struct monthlines * monthl, int highlightdate); static void mkweekdays(struct weekdays * wds); static void monthranger(int year, int m, int jd_flag, - int before, int after); + int before, int after, int highlightdate); static void monthrangeb(int year, int m, int jd_flag, - int before, int after); + int before, int after, int highlightdate); static int parsemonth(const char *s, int *m, int *y); static void printcc(void); static void printeaster(int year, int julian, int orthodox); @@ -217,6 +216,7 @@ main(int argc, char *argv[]) char *flag_today = NULL; /* debug: use date as being today */ char *flag_month = NULL; /* requested month as string */ char *flag_highlightdate = NULL; /* debug: date to highlight */ + int highlightdate; int before, after; const char *locale; /* locale to get country code */ @@ -565,9 +565,9 @@ main(int argc, char *argv[]) printeaster(y, flag_julian_cal, flag_orthodox); else if (flag_backward) - monthrangeb(y, m, flag_julian_day, before, after); + monthrangeb(y, m, flag_julian_day, before, after, highlightdate); else - monthranger(y, m, flag_julian_day, before, after); + monthranger(y, m, flag_julian_day, before, after, highlightdate); return (0); } @@ -651,7 +651,7 @@ printeaster(int y, int julian, int orthodox) /* Print all months for the period in the range [ before .. y-m .. after ]. */ static void -monthrangeb(int y, int m, int jd_flag, int before, int after) +monthrangeb(int y, int m, int jd_flag, int before, int after, int highlightdate) { struct monthlines year[12]; struct weekdays wds; @@ -695,7 +695,7 @@ monthrangeb(int y, int m, int jd_flag, int before, int after) while (m <= m2) { int count = 0; for (i = 0; i != mpl && m + i <= m2; i++) { - mkmonthb(M2Y(m + i), M2M(m + i) - 1, jd_flag, year + i); + mkmonthb(M2Y(m + i), M2M(m + i) - 1, jd_flag, year + i, highlightdate); count++; } @@ -753,7 +753,7 @@ monthrangeb(int y, int m, int jd_flag, int before, int after) } static void -monthranger(int y, int m, int jd_flag, int before, int after) +monthranger(int y, int m, int jd_flag, int before, int after, int highlightdate) { struct monthlines year[12]; struct weekdays wds; @@ -794,7 +794,7 @@ monthranger(int y, int m, int jd_flag, int before, int after) while (m <= m2) { int count = 0; for (i = 0; i != mpl && m + i <= m2; i++) { - mkmonthr(M2Y(m + i), M2M(m + i) - 1, jd_flag, year + i); + mkmonthr(M2Y(m + i), M2M(m + i) - 1, jd_flag, year + i, highlightdate); count++; } @@ -846,7 +846,7 @@ monthranger(int y, int m, int jd_flag, int before, int after) } static void -mkmonthr(int y, int m, int jd_flag, struct monthlines *mlines) +mkmonthr(int y, int m, int jd_flag, struct monthlines *mlines, int highlightdate) { struct tm tm; /* for strftime printing local names of @@ -940,7 +940,7 @@ mkmonthr(int y, int m, int jd_flag, struct monthlines *mlines) } static void -mkmonthb(int y, int m, int jd_flag, struct monthlines *mlines) +mkmonthb(int y, int m, int jd_flag, struct monthlines *mlines, int highlightdate) { struct tm tm; /* for strftime printing local names of