commit 9077404b75bc80a529814dd23c2be6f84d4c8f65 parent 5450b0c6022c8ea96b0fe0a4f4542cf4c6e0a297 Author: qorg11 <qorg@vxempire.xyz> Date: Mon, 1 Jun 2020 22:41:59 +0200 Rewritten rmdir Diffstat:
M | src/rmdir.c | | | 14 | ++++++++++---- |
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/rmdir.c b/src/rmdir.c @@ -1,9 +1,15 @@ #include <unistd.h> +#include <stdio.h> int main(int argc, char *argv[]) { - while(*argv) { - rmdir(*argv); - *argv++; - } + for(int i = 1; i<argc;i++) + { + int fd = rmdir(argv[i]); /* Is it actually a file descriptor? */ + if(fd == -1) + { + fprintf(stderr,"Error removing dir %s\n",argv[i]); + } + } + return 0; }