diff options
| author | Ákos Kőrösi <korakos99@gmail.com> | 2026-05-22 11:20:01 +0200 |
|---|---|---|
| committer | Ákos Kőrösi <korakos99@gmail.com> | 2026-05-22 11:20:01 +0200 |
| commit | 3ee20b6b9b0dee56f4ffcb8b80c8b8390589a5f6 (patch) | |
| tree | f1389dfaa7420a264acf274b90b77f32f406922d | |
| parent | 75c3a166b98aa5c89fa3a8c82c70ef9f9fb54416 (diff) | |
add rc sourcing
| -rw-r--r-- | src/config.h | 2 | ||||
| -rw-r--r-- | src/main.c | 2 | ||||
| -rw-r--r-- | src/stages.h | 2 |
3 files changed, 4 insertions, 2 deletions
diff --git a/src/config.h b/src/config.h index 31e8fa1..c1c8de2 100644 --- a/src/config.h +++ b/src/config.h @@ -1,3 +1,3 @@ #pragma once -static const char* rcfile = "scratch/.yrc"; +static const char* RCFILENAME= "scratch/.yrc"; @@ -4,6 +4,7 @@ #include <readline/history.h> #include <string.h> +#include "config.h" #include "syntax.h" #include "stages.h" #include "utils.h" @@ -18,6 +19,7 @@ void execute_line(char *line, ShellState *shstate) { int main() { ShellState shstate = {.shell_vars = make_KeyValMap(256), .aliases = make_KeyValMap(256)}; + source_script(RCFILENAME, &shstate); char* line; while (1) { line = readline("$ "); diff --git a/src/stages.h b/src/stages.h index 2f90a26..e731533 100644 --- a/src/stages.h +++ b/src/stages.h @@ -6,5 +6,5 @@ Ast lex(char* input); PipelineTree process_ast(Ast ast, ShellState* shstate); void execute_pipeline_tree(PipelineTree pltree, ShellState* shstate); -//void source_script(char* fname, ShellState* shstate); +void source_script(char* fname, ShellState* shstate); void execute_line(char* line, ShellState* shstate); |
