summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/main.c b/main.c
index 70382c4..e2414d5 100644
--- a/main.c
+++ b/main.c
@@ -5,10 +5,11 @@
#include "lex.h"
#include "parse.h"
+#include "exec.h"
void uglyprint_pl(Pipeline pl) {
for (int i = 0; i < pl.count; i++) {
- printf("%d\n");
+ printf("%d\n", i);
TokenVec toks = (*get_from_Pipeline(&pl, i)).cmd.args;
for (int j = 0; j < toks.count; j++) {
Token tok = *get_from_TokenVec(&toks, j);
@@ -30,13 +31,14 @@ void uglyprint_pl(Pipeline pl) {
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);
LexResult res = lex(line);
Pipeline pl = parse_tokstream(res.top_tokens);
- uglyprint_pl(pl);
+ run_pipeline(pl, &shstate);
}
free(line);
}