From f12d8bea7f81abd9e136405c6fc30a33a1aadfdc Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Tue, 29 Mar 2022 16:06:52 -0400 Subject: [PATCH] Start reading from HOME/.pebblisp.pbl for config. --- src/pebblisp.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/pebblisp.c b/src/pebblisp.c index 8eae15f..890eda3 100644 --- a/src/pebblisp.c +++ b/src/pebblisp.c @@ -11,14 +11,14 @@ #include #include -#include -#include - #include "tokens.h" #include "plfunc.h" #ifdef STANDALONE +#include +#include + #include "web.h" #endif @@ -600,7 +600,6 @@ void repl(struct Environment* env) { char* buf; using_history(); - parseEval("(def prompt \"pebblisp::> \")", env); while ((buf = readline(readFromEnvironment("prompt", env).string)) != NULL) { if (strcmp("q", buf) == 0) { free(buf); @@ -682,6 +681,13 @@ int main(int argc, const char* argv[]) sigaction(SIGSEGV, &action, NULL); readFile(SCRIPTDIR "/lib.pbl", &env); + + parseEval("(def prompt \"pebblisp::> \")", &env); + + char config[strlen(getenv("HOME")) + 15]; + sprintf(config, "%s/.pebblisp.pbl", getenv("HOME")); + readFile(config, &env); + if (argc >= 2) { FILE* file = fopen(argv[1], "r"); if (file) {