summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000..35c2bff
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,23 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <readline/readline.h>
+#include <readline/history.h>
+#include <string.h>
+
+#include "exec.h"
+
+
+int main() {
+ char* line;
+ ShellState shstate = {.shell_vars = make_KeyValMap(1), .aliases = make_KeyValMap(1)};
+ while (1) {
+ line = readline("$ ");
+ if (line[0] == '\0') continue;
+ if (strcmp(line, "exit") == 0) exit(0);
+ add_history(line);
+ process_input_line(line, &shstate);
+ }
+ free(line);
+}
+
+