Hi tech --
Fix some warnings found with WARNINGS=yes. I believe setting
ev1 = NULL in io.c is a false positive by cc but I fixed it anyway.
~Brian
Index: day.c
===
RCS file: /cvs/src/usr.bin/calendar/day.c,v
retrieving revision 1.34
diff -u -p -u -p -r1.34 day.c
--- day.c 14 Sep 2016 15:09:46 - 1.34
+++ day.c 30 May 2017 01:11:39 -
@@ -77,7 +77,9 @@ static struct fixs ndays[8]; /*
static struct fixs fnmonths[13]; /* full national months names */
static struct fixs nmonths[13]; /* short national month names */
-void
+static void fill_print_date(struct match *, struct tm *);
+
+static void
fill_print_date(struct match *m, struct tm *tm)
{
if (strftime(m->print_date, sizeof(m->print_date),
@@ -616,19 +618,19 @@ getday(char *s)
int
getdayvar(char *s)
{
- int offset;
+ int d_offset;
- offset = strlen(s);
+ d_offset = strlen(s);
/* Sun+1 or Wednesday-2
*^ ^ */
- /* printf ("x: %s %s %d\n", s, s + offset - 2, offset); */
- switch(*(s + offset - 2)) {
+ /* printf ("x: %s %s %d\n", s, s + d_offset - 2, d_offset); */
+ switch(*(s + d_offset - 2)) {
case '-':
case '+':
- return(atoi(s + offset - 2));
+ return(atoi(s + d_offset - 2));
break;
}
@@ -637,15 +639,15 @@ getdayvar(char *s)
*/
/* last */
- if (offset > 4 && !strcasecmp(s + offset - 4, "last"))
+ if (d_offset > 4 && !strcasecmp(s + d_offset - 4, "last"))
return(-1);
- else if (offset > 5 && !strcasecmp(s + offset - 5, "first"))
+ else if (d_offset > 5 && !strcasecmp(s + d_offset - 5, "first"))
return(+1);
- else if (offset > 6 && !strcasecmp(s + offset - 6, "second"))
+ else if (d_offset > 6 && !strcasecmp(s + d_offset - 6, "second"))
return(+2);
- else if (offset > 5 && !strcasecmp(s + offset - 5, "third"))
+ else if (d_offset > 5 && !strcasecmp(s + d_offset - 5, "third"))
return(+3);
- else if (offset > 6 && !strcasecmp(s + offset - 6, "fourth"))
+ else if (d_offset > 6 && !strcasecmp(s + d_offset - 6, "fourth"))
return(+4);
/* no offset detected */
@@ -667,13 +669,13 @@ void
variable_weekday(int *day, int month, int year)
{
int v1, v2;
- int *cumdays;
+ int *cumuldays;
int day1;
if (isleap(year))
- cumdays = daytab[1];
+ cumuldays = daytab[1];
else
- cumdays = daytab[0];
+ cumuldays = daytab[0];
day1 = foy(year);
/* negative offset; last, -4 .. -1 */
if (*day < 0) {
@@ -681,10 +683,10 @@ variable_weekday(int *day, int month, in
*day = 10 + (*day % 10);/* day 1 ... 7 */
/* which weekday the end of the month is (1-7) */
- v2 = (cumdays[month + 1] + day1) % 7 + 1;
+ v2 = (cumuldays[month + 1] + day1) % 7 + 1;
/* and subtract enough days */
- *day = cumdays[month + 1] - cumdays[month] +
+ *day = cumuldays[month + 1] - cumuldays[month] +
(v1 + 1) * 7 - (v2 - *day + 7) % 7;
#if DEBUG
fprintf(stderr, "\nMonth %d ends on weekday %d\n", month, v2);
@@ -697,7 +699,7 @@ variable_weekday(int *day, int month, in
*day = *day % 10;
/* which weekday the first of the month is (1-7) */
- v2 = (cumdays[month] + 1 + day1) % 7 + 1;
+ v2 = (cumuldays[month] + 1 + day1) % 7 + 1;
/* and add enough days */
*day = 1 + (v1 - 1) * 7 + (*day - v2 + 7) % 7;
Index: io.c
===
RCS file: /cvs/src/usr.bin/calendar/io.c,v
retrieving revision 1.44
diff -u -p -u -p -r1.44 io.c
--- io.c31 Aug 2016 09:38:47 - 1.44
+++ io.c30 May 2017 01:11:39 -
@@ -74,6 +74,7 @@ cal(void)
events = NULL;
cur_evt = NULL;
+ ev1 = NULL;
if ((fp = opencal()) == NULL)
return;
for (printing = 0; fgets(buf, sizeof(buf), stdin) != NULL;) {