diff options
author | Lieuwe Rooijakkers <lieuwerooijakkers@gmail.com> | 2024-07-23 00:23:06 +0200 |
---|---|---|
committer | Lieuwe Rooijakkers <lieuwerooijakkers@gmail.com> | 2024-08-02 22:38:00 +0200 |
commit | c4ccd4e0798a7ed9af6f86d9819b309575d418a0 (patch) | |
tree | f76183914b89d801b2853e78d4886cc00281dad0 /src/tak.c | |
parent | 420e28845d5068d0c3b432ffc0d5fc80b7b7d7e2 (diff) |
file_to_filebuf: isdir output parameter
Diffstat (limited to 'src/tak.c')
-rw-r--r-- | src/tak.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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; } |