From 3ee20b6b9b0dee56f4ffcb8b80c8b8390589a5f6 Mon Sep 17 00:00:00 2001 From: Ákos Kőrösi Date: Fri, 22 May 2026 11:20:01 +0200 Subject: add rc sourcing --- src/config.h | 2 +- src/main.c | 2 ++ src/stages.h | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') 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"; diff --git a/src/main.c b/src/main.c index f595c4a..9e30c27 100644 --- a/src/main.c +++ b/src/main.c @@ -4,6 +4,7 @@ #include #include +#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); -- cgit v1.2.3