- Commit
- 84bad7440033ced38f8dfba1f839a6966fc88a5e
- Parent
- fa54bd814328faaf8116ec244c52c4eac0d512c0
- Author
- John MacFarlane <jgm@berkeley.edu>
- Date
main.c: Fixed reading of files specified on command line.
My personal build of CMark ✏️
main.c: Fixed reading of files specified on command line.
1 file changed, 4 insertions, 7 deletions
Status | File Name | N° Changes | Insertions | Deletions |
Modified | src/main.c | 11 | 4 | 7 |
diff --git a/src/main.c b/src/main.c @@ -67,16 +67,13 @@ int main(int argc, char *argv[]) { exit(1); } - struct bStream *stream = bsopen((bNread)fread, fp); - if (stream == NULL) { - printf("Error opening stream\n"); - } - while (bsreadln(s, stream, '\n') != BSTR_ERR) { + while ((s = bgets((bNgetc) fgetc, fp, '\n'))) { check(incorporate_line(s, linenum, &cur) == 0, - "error incorporating line %d of %s", linenum, argv[files[g]]); + "error incorporating line %d", linenum); + bdestroy(s); linenum++; } - bsclose(stream); + fclose(fp); } }