summary refs log tree commit diff
path: root/sbin/fdmaker
diff options
context:
space:
mode:
authorWlodekM <[email protected]>2025-02-14 20:04:17 +0200
committerWlodekM <[email protected]>2025-02-14 20:04:17 +0200
commitfa71d9ab15c046f2e0b886bc365310f2ccf79800 (patch)
treed5b4f02e9bc732d9aab4b96482e343af479f38b7 /sbin/fdmaker
parent50dd5f54d89c0902fdb8143c4ed91ea613f34b18 (diff)
fdmaker
Diffstat (limited to 'sbin/fdmaker')
-rw-r--r--sbin/fdmaker/fdmaker.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/sbin/fdmaker/fdmaker.c b/sbin/fdmaker/fdmaker.c
new file mode 100644
index 0000000..6dcc299
--- /dev/null
+++ b/sbin/fdmaker/fdmaker.c
@@ -0,0 +1,32 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/sysmacros.h>
+
+int main() {
+    // make process be sigma (why did i think of this)
+    if (setsid() < 0) {
+        perror("setsid");
+        exit(1);
+    }
+
+    // >open /dev/tty1
+    // >look inside
+    // >bits
+    int fd = open("/dev/tty1", O_RDWR);
+    if (fd == -1) {
+        write(2, "Failed to open /dev/tty1\n", 26);
+        exit(1);
+    }
+    // make tty1 be the displayed tty
+    if (ioctl(fd, TIOCSCTTY, 0) < 0) {
+        write(2, "ioctl TIOCSCTTY", 16);
+        exit(1);
+    }
+    write(fd, "\e[2J\e[0;0Hwelcome to nyaOS - a distro made by an idiot with no C experience that still somehow works\n\n", 103);
+    execve("/bin/shel", 0, 0);
+}
\ No newline at end of file