summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 6653fdd..f595c4a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -9,6 +9,13 @@
#include "utils.h"
+void execute_line(char *line, ShellState *shstate) {
+ Ast ast = lex(line);
+ PipelineTree pltree = process_ast(ast, shstate);
+ execute_pipeline_tree(pltree, shstate);
+}
+
+
int main() {
ShellState shstate = {.shell_vars = make_KeyValMap(256), .aliases = make_KeyValMap(256)};
char* line;
@@ -16,9 +23,7 @@ int main() {
line = readline("$ ");
if (line[0] == '\0') continue;
add_history(line);
- Ast ast = lex(line);
- PipelineTree pltree = process_ast(ast, &shstate);
- execute_pipeline_tree(pltree, &shstate);
+ execute_line(line, &shstate);
}
free(line);
}