From: Ian Darwin Date: Sun, 23 Aug 1987 20:26:47 +0000 (+0000) Subject: Skip over null lines in magic file. X-Git-Tag: FILE3_27~437 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=af458892d3383612e12cf30c5ccffe529856307e;p=file Skip over null lines in magic file. --- diff --git a/src/apprentice.c b/src/apprentice.c index 9b5d15e2..1fea372d 100644 --- a/src/apprentice.c +++ b/src/apprentice.c @@ -34,9 +34,11 @@ char *fn; if (check) /* print silly verbose header for USG compat. */ (void) printf("cont\toffset\ttype\topcode\tvalue\tdesc\n"); while (fgets(line, MAXSTR, f) != NULL) { - if (line[0]=='#') + if (line[0]=='#') /* comment, do not parse */ continue; - line[strlen(line)-1] = '\0'; /* nuke newline */ + if (strlen(line) <= 1) /* null line, garbage, etc */ + continue; + line[strlen(line)-1] = '\0'; /* delete newline */ (void) parse(line, &nmagic); }