X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=src%2Fparser.c;h=e59f1be9489355a547ea6280787158a05e7eb9c0;hb=b1e0c986d6e531f71d0a3ecc01551ab2d9cd8929;hp=7a5498654a6d65a5385033171effad0c07fd8cd3;hpb=be20bc40619598a5c9af8234ae81ce0a6899651f;p=smdp.git diff --git a/src/parser.c b/src/parser.c index 7a54986..e59f1be 100644 --- a/src/parser.c +++ b/src/parser.c @@ -22,8 +22,10 @@ */ #include +#include #include #include +#include #include "parser.h" @@ -48,6 +50,11 @@ deck_t *markdown_load(FILE *input) { sc++; while ((c = fgetc(input)) != EOF) { + if (ferror(input)) { + fprintf(stderr, "markdown_load() failed to read input: %s\n", strerror(errno)); + exit(EXIT_FAILURE); + } + if(c == '\n') { // markdown analyse