commit 928df968ad1b4edd1e9111a04827e1c0a614711a from: Sven M. Hallberg date: Thu Sep 08 12:05:46 2022 UTC fix line count in the face of empty lines and comments commit - e7247ac567a0c5cabba9ecadbabc0c717d9d6a78 commit + 928df968ad1b4edd1e9111a04827e1c0a614711a blob - 08ef258c91d82947fc16c1d2ee180be7db6d8dcd blob + a1ff8b7dca34a8fa4039aa9d9b1841a3a92866f3 --- rom.c +++ rom.c @@ -61,14 +61,12 @@ main(int argc, char **argv) /* detect and handle the end of the line */ if (c == '\n') { - if (n == 0) /* empty line */ - continue; - - if (n != 16) /* wrong number of digits */ + if (n != 16 && n != 0) /* wrong number of digits */ break; - if (fwrite(&x, sizeof x, 1, fout) == 0) - err(1, "%s: write error", argv[1]); + if (n != 0) /* ignore empty lines */ + if (fwrite(&x, sizeof x, 1, fout) == 0) + err(1, "%s: write error", argv[1]); line++; /* process next line... */ n = 0;