summary refs log tree commit diff
path: root/progs/touch
diff options
context:
space:
mode:
authorWlodekM <[email protected]>2025-02-14 19:12:47 +0200
committerWlodekM <[email protected]>2025-02-14 19:12:47 +0200
commit3bd3984e92fdfb529c37b31c6f0570abab1ed54e (patch)
tree5462664b63182c895cb70e98a79672d2c3d8a392 /progs/touch
initial commit; beginning work on smolsh
Diffstat (limited to 'progs/touch')
-rw-r--r--progs/touch/touch.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/progs/touch/touch.c b/progs/touch/touch.c
new file mode 100644
index 0000000..815dae3
--- /dev/null
+++ b/progs/touch/touch.c
@@ -0,0 +1,13 @@
+#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);
+    }
+    int fd2 = open(argv[1], O_RDWR | O_CREAT, S_IRUSR | S_IRGRP | S_IROTH);
+    exit(0);
+}
\ No newline at end of file