diff options
author | Lieuwe Rooijakkers <lieuwerooijakkers@gmail.com> | 2024-07-21 20:25:52 +0200 |
---|---|---|
committer | Lieuwe Rooijakkers <lieuwerooijakkers@gmail.com> | 2024-07-21 20:25:52 +0200 |
commit | 35b413f525146c1c2cbe509967c2595378fdc299 (patch) | |
tree | 2bbe48157a58f41e4c919735bc316c06f9066aaf /src | |
parent | 4fcd26ca7ab48a44682c952313aad56d42f8407f (diff) |
tak: verbeter fout afhandeling
Diffstat (limited to 'src')
-rw-r--r-- | src/tak.c | 22 |
1 files changed, 12 insertions, 10 deletions
@@ -4,7 +4,6 @@ #include <string.h> #include <unistd.h> -#include "util/map.h" #include "util/versie.h" #include "io/read_file.h" @@ -70,9 +69,7 @@ int entry_tak(int argc, char **argv) { if (*args == NULL) { struct filebuf *fb = stream_to_filebuf(stdin); - if (fb == NULL) { - return 1; - } + if (fb == NULL) goto err_stdin; process(fb); return 0; @@ -83,19 +80,24 @@ int entry_tak(int argc, char **argv) { if (!strcmp(*args, "-")) { fb = stream_to_filebuf(stdin); - if (fb == NULL) { - return 1; - } + if (fb == NULL) goto err_stdin; } - if (fb == NULL) { - fb = file_to_filebuf(*args); - } + if (fb == NULL) fb = file_to_filebuf(*args); + if (fb == NULL) goto err_file; process(fb); args++; } return 0; + +err_stdin: + fprintf(stderr, "staart: fout bij lezen van standaard invoer"); + return 1; + +err_file: +fprintf(stderr, "staart: fout bij lezen van bestand"); + return 1; } |