]> granicus.if.org Git - file/commitdiff
Skip over null lines in magic file.
authorIan Darwin <ian@darwinsys.com>
Sun, 23 Aug 1987 20:26:47 +0000 (20:26 +0000)
committerIan Darwin <ian@darwinsys.com>
Sun, 23 Aug 1987 20:26:47 +0000 (20:26 +0000)
src/apprentice.c

index 9b5d15e26f47b4493d278adfb925b241a8d982cb..1fea372d6a089d48fafedd008d8a63ef574a48ca 100644 (file)
@@ -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);
        }