aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2021-09-02 08:44:13 +0300
committerSyndamia <kamen.d.mladenov@protonmail.com>2021-09-02 08:44:13 +0300
commit740efa6658c17158058f161b0230b7718b6bd051 (patch)
treebab8e9c1e8e65dad2428e51a5fa3a410daba1acf /main.c
parentf5e2da80d26c7ed8381cb31c2fde5aae67269952 (diff)
downloadyou86-740efa6658c17158058f161b0230b7718b6bd051.tar
you86-740efa6658c17158058f161b0230b7718b6bd051.tar.gz
you86-740efa6658c17158058f161b0230b7718b6bd051.zip
(1) Added current implementations: shell input handling
Diffstat (limited to 'main.c')
-rw-r--r--main.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..3f2bba6
--- /dev/null
+++ b/main.c
@@ -0,0 +1,35 @@
+#include <bits/posix2_lim.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <string.h>
+
+#define SHELL_STRING "> "
+
+extern void registerDefaultHandlers();
+void printDefault();
+extern bool route(char *command);
+
+int main() {
+ char buffer[LINE_MAX];
+ buffer[0] = 0;
+
+ registerDefaultHandlers();
+
+ printf("Welcome!\n\n");
+ do {
+ // Removes the Line Feed character at the "end", if it exists
+ char *toChange = strchr(buffer, 0x0A);
+ if (toChange != NULL)
+ toChange[0] = 0;
+
+ if (buffer[0] > 0)
+ if (route(buffer))
+ printf("\n");
+
+ printf(SHELL_STRING);
+ } while (fgets(buffer, LINE_MAX, stdin));
+
+ return 0;
+}