diff options
author | Stefan Eßer <se@FreeBSD.org> | 2020-10-29 08:31:47 +0000 |
---|---|---|
committer | Stefan Eßer <se@FreeBSD.org> | 2020-10-29 08:31:47 +0000 |
commit | ac04cf18bba3613e3a36722112fb646861c961e6 (patch) | |
tree | a7b351a74f5ee0974346ec9abb95c88583fc9ead /usr.bin | |
parent | 3fa2a149d68d22fa32ba7b6c09773388ac490fd1 (diff) | |
download | src-test-ac04cf18bba3613e3a36722112fb646861c961e6.tar.gz src-test-ac04cf18bba3613e3a36722112fb646861c961e6.zip |
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
Notes
Notes:
svn path=/head/; revision=367127
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/calendar/events.c | 5 | ||||
-rw-r--r-- | usr.bin/calendar/io.c | 20 |
2 files changed, 6 insertions, 19 deletions
diff --git a/usr.bin/calendar/events.c b/usr.bin/calendar/events.c index 84f8f2b41a8bc..39ede509e4dbe 100644 --- a/usr.bin/calendar/events.c +++ b/usr.bin/calendar/events.c @@ -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 /* diff --git a/usr.bin/calendar/io.c b/usr.bin/calendar/io.c index 6efbc5ca72a59..f0abd363db35d 100644 --- a/usr.bin/calendar/io.c +++ b/usr.bin/calendar/io.c @@ -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'; |