aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000..3f2bba6
--- /dev/null
+++ b/src/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;
+}