bore

basic core utilities (PD)
git clone git://bvnf.space/bore.git
Log | Files | Refs | README

commit 7ced46775c172ef29a9b91c4ab189838a01c02e5
parent 610d2d3b6bbe72ab893265a0f27e7695a8dc228c
Author: phoebos <ben@bvnf.space>
Date:   Fri, 28 Jan 2022 02:00:42 +0000

rmdir: add

Diffstat:
MMakefile | 1+
MTODO.posix | 2+-
Armdir.c | 21+++++++++++++++++++++
3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile @@ -10,6 +10,7 @@ BINS = \ ls \ mkdir \ pwd \ + rmdir \ sort \ tee \ true \ diff --git a/TODO.posix b/TODO.posix @@ -86,7 +86,7 @@ [x] pwd [ ] renice [ ] rm -[ ] rmdir +[.] rmdir [ ] sed [ ] sh [ ] sleep diff --git a/rmdir.c b/rmdir.c @@ -0,0 +1,21 @@ +#define _XOPEN_SOURCE 700 +#include <errno.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> + +int +main(int argc, char **argv) { + if (argc == 1) { + fprintf(stderr, "usage: %s dir...\n", *argv); + return 1; + } + + while (*++argv != NULL) { + if (rmdir(*argv) != 0) { + fprintf(stderr, "rmdir: %s: %s\n", *argv, strerror(errno)); + return 1; + } + } + return 0; +}