diff options
Diffstat (limited to 'exec.c')
| -rw-r--r-- | exec.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -196,3 +196,21 @@ void run_pipeline(Pipeline pl, ShellState* shstate) { while (waitpid(-pgid, NULL, 0) > 0); tcsetpgrp(STDIN_FILENO, getpgrp()); } + + +void process_input_line(char* line, ShellState* shstate) { + PreprocArena arena = { + .tokens = make_TokenVec(256), + .chunks = make_ChunkVec(256), + .regions = make_RegionVec(256), + }; + TokenPtrVec line_tok_ptrs = lex(line, &arena); + Token* line_toks = malloc(sizeof(Token) * line_tok_ptrs.count); + for (int i = 0; i < line_tok_ptrs.count; i++) { + line_toks[i] = **get_from_TokenPtrVec(&line_tok_ptrs, i); + } + Pipeline pl = parse_tokstream(line_toks); + run_pipeline(pl, shstate); + free(line_toks); +} + |
