summaryrefslogtreecommitdiff
path: root/src/tak.c
diff options
context:
space:
mode:
authorLieuwe Rooijakkers <lieuwerooijakkers@gmail.com>2024-07-23 00:23:06 +0200
committerLieuwe Rooijakkers <lieuwerooijakkers@gmail.com>2024-08-02 22:38:00 +0200
commitc4ccd4e0798a7ed9af6f86d9819b309575d418a0 (patch)
treef76183914b89d801b2853e78d4886cc00281dad0 /src/tak.c
parent420e28845d5068d0c3b432ffc0d5fc80b7b7d7e2 (diff)
file_to_filebuf: isdir output parameter
Diffstat (limited to 'src/tak.c')
-rw-r--r--src/tak.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/tak.c b/src/tak.c
index 8ae6ca5..e0c501f 100644
--- a/src/tak.c
+++ b/src/tak.c
@@ -82,11 +82,13 @@ int entry_tak(int argc, char **argv) {
if (!strcmp(*args, "-")) {
fb = stream_to_filebuf(stdin, 0);
if (fb == NULL) goto err_stdin;
+ } else {
+ bool isdir = false;
+ fb = file_to_filebuf(*args, 0, &isdir);
+ if (isdir) goto err_isdir;
+ else if (fb == NULL) goto err_file;
}
- if (fb == NULL) fb = file_to_filebuf(*args, 0);
-
- if (fb == NULL) goto err_file;
process(fb);
args++;
@@ -101,4 +103,8 @@ err_stdin:
err_file:
fprintf(stderr, "tak: fout bij lezen van bestand\n");
return 1;
+
+err_isdir:
+ fprintf(stderr, "tak: bestand '%s' is een mapje\n", *args);
+ return 1;
}