Simplify test for closing delimiter of #include argument (no functional

change).

While here: Fix invalid parameters of a commented-out debug printf() found
when testing with this code enabled.

MFC after:	3 days
This commit is contained in:
Stefan Eßer 2020-10-29 08:31:47 +00:00
parent 3fa2a149d6
commit ac04cf18bb
2 changed files with 6 additions and 19 deletions

View File

@ -207,8 +207,9 @@ event_print_all(FILE *fp)
while (walkthrough_dates(&e) != 0) {
#ifdef DEBUG
fprintf(stderr, "event_print_allmonth: %d, day: %d\n",
month, day);
if (e)
fprintf(stderr, "event_print_all month: %d, day: %d\n",
e->month, e->day);
#endif
/*

View File

@ -215,26 +215,12 @@ token(char *line, FILE *out, int *skip)
return (T_ERR);
}
a = *walk;
a = *walk == '<' ? '>' : '\"';
walk++;
c = walk[strlen(walk) - 1];
switch(c) {
case '>':
if (a != '<') {
warnx("Unterminated include expecting '\"'");
return (T_ERR);
}
break;
case '\"':
if (a != '\"') {
warnx("Unterminated include expecting '>'");
return (T_ERR);
}
break;
default:
warnx("Unterminated include expecting '%c'",
a == '<' ? '>' : '\"' );
if (a != c) {
warnx("Unterminated include expecting '%c'", a);
return (T_ERR);
}
walk[strlen(walk) - 1] = '\0';