summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLieuwe Rooijakkers <lieuwerooijakkers@gmail.com>2024-07-21 20:25:52 +0200
committerLieuwe Rooijakkers <lieuwerooijakkers@gmail.com>2024-07-21 20:25:52 +0200
commit35b413f525146c1c2cbe509967c2595378fdc299 (patch)
tree2bbe48157a58f41e4c919735bc316c06f9066aaf /src
parent4fcd26ca7ab48a44682c952313aad56d42f8407f (diff)
tak: verbeter fout afhandeling
Diffstat (limited to 'src')
-rw-r--r--src/tak.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/tak.c b/src/tak.c
index e8fb817..1fc8ff5 100644
--- a/src/tak.c
+++ b/src/tak.c
@@ -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;
}