global -> local

This commit is contained in:
Kartik K. Agaram 2022-02-15 17:00:00 -08:00
parent 2ad490cbb4
commit c187d793c6
1 changed files with 13 additions and 13 deletions

26
ncal.c
View File

@ -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 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 */
static int highlightdate;
int weekstart = -1; /* day the week starts on (Sun [0] - Sat [6]) */ int weekstart = -1; /* day the week starts on (Sun [0] - Sat [6]) */
static char *center(char *s, char *t, int w); 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 int firstday(int y, int m);
static void highlight(char *dst, char *src, int len, int *extraletters); static void highlight(char *dst, char *src, int len, int *extraletters);
static void mkmonthr(int year, int month, int jd_flag, 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, 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 mkweekdays(struct weekdays * wds);
static void monthranger(int year, int m, int jd_flag, 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, 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 int parsemonth(const char *s, int *m, int *y);
static void printcc(void); static void printcc(void);
static void printeaster(int year, int julian, int orthodox); 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_today = NULL; /* debug: use date as being today */
char *flag_month = NULL; /* requested month as string */ char *flag_month = NULL; /* requested month as string */
char *flag_highlightdate = NULL; /* debug: date to highlight */ char *flag_highlightdate = NULL; /* debug: date to highlight */
int highlightdate;
int before, after; int before, after;
const char *locale; /* locale to get country code */ const char *locale; /* locale to get country code */
@ -565,9 +565,9 @@ main(int argc, char *argv[])
printeaster(y, flag_julian_cal, flag_orthodox); printeaster(y, flag_julian_cal, flag_orthodox);
else else
if (flag_backward) if (flag_backward)
monthrangeb(y, m, flag_julian_day, before, after); monthrangeb(y, m, flag_julian_day, before, after, highlightdate);
else else
monthranger(y, m, flag_julian_day, before, after); monthranger(y, m, flag_julian_day, before, after, highlightdate);
return (0); 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 ]. */ /* Print all months for the period in the range [ before .. y-m .. after ]. */
static void 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 monthlines year[12];
struct weekdays wds; struct weekdays wds;
@ -695,7 +695,7 @@ monthrangeb(int y, int m, int jd_flag, int before, int after)
while (m <= m2) { while (m <= m2) {
int count = 0; int count = 0;
for (i = 0; i != mpl && m + i <= m2; i++) { 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++; count++;
} }
@ -753,7 +753,7 @@ monthrangeb(int y, int m, int jd_flag, int before, int after)
} }
static void 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 monthlines year[12];
struct weekdays wds; struct weekdays wds;
@ -794,7 +794,7 @@ monthranger(int y, int m, int jd_flag, int before, int after)
while (m <= m2) { while (m <= m2) {
int count = 0; int count = 0;
for (i = 0; i != mpl && m + i <= m2; i++) { 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++; count++;
} }
@ -846,7 +846,7 @@ monthranger(int y, int m, int jd_flag, int before, int after)
} }
static void 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 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 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 struct tm tm; /* for strftime printing local names of