summary refs log tree commit diff
path: root/progs/mkdir
diff options
context:
space:
mode:
authorWlodekM <[email protected]>2025-02-15 10:51:57 +0200
committerWlodekM <[email protected]>2025-02-15 10:51:57 +0200
commit545c5f85c38de8ddb8c026bf3b76658c8d8f3d6b (patch)
treea9df68df52ff273715b595efc7cd4cb20f7859a3 /progs/mkdir
parent967d5cd81a190f6aa7ac44c269d60ae3a1071464 (diff)
fix some stuff; add some coreutils
Diffstat (limited to 'progs/mkdir')
-rw-r--r--progs/mkdir/mkdir.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/progs/mkdir/mkdir.c b/progs/mkdir/mkdir.c
new file mode 100644
index 0000000..cbf5cdf
--- /dev/null
+++ b/progs/mkdir/mkdir.c
@@ -0,0 +1,17 @@
+#include <unistd.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+int main(int argc, char *argv[]) {
+    if (!argv[1]) {
+        write(1, "you IDIOT, you forgot to include the file name, MORON\n", 55);
+        exit(1);
+    }
+    struct stat st = {0};
+
+    if (stat(argv[1], &st) == -1) {
+        mkdir(argv[1], 0700);
+    }
+    exit(0);
+}
\ No newline at end of file