From 497a52dd8244e431bdf5e796a041067db25e09a7 Mon Sep 17 00:00:00 2001 From: apio Date: Mon, 31 Oct 2022 09:53:52 +0100 Subject: [PATCH] apps: add a little mkdir utility --- apps/Makefile | 2 +- apps/src/mkdir.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 apps/src/mkdir.c diff --git a/apps/Makefile b/apps/Makefile index 95b4d700..4e704baa 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -1,4 +1,4 @@ -APPS := init sh uname uptime hello ps ls args cat stat su session date +APPS := init sh uname uptime hello ps ls args cat stat su session date mkdir APPS_DIR := $(LUNA_ROOT)/apps APPS_SRC := $(APPS_DIR)/src diff --git a/apps/src/mkdir.c b/apps/src/mkdir.c new file mode 100644 index 00000000..9287b846 --- /dev/null +++ b/apps/src/mkdir.c @@ -0,0 +1,17 @@ +#include +#include + +int main(int argc, char** argv) +{ + if (argc == 1) + { + fprintf(stderr, "Usage: %s [directory]", argv[0]); + return 1; + } + + if (mkdir(argv[1], 0755) < 0) + { + perror("mkdir"); + return 1; + } +} \ No newline at end of file