Start reading from HOME/.pebblisp.pbl for config.

This commit is contained in:
Sage Vaillancourt 2022-03-29 16:06:52 -04:00 committed by Sage Vaillancourt
parent 2b09187a94
commit f12d8bea7f
1 changed files with 10 additions and 4 deletions

View File

@ -11,14 +11,14 @@
#include <stdlib.h>
#include <string.h>
#include <readline/readline.h>
#include <readline/history.h>
#include "tokens.h"
#include "plfunc.h"
#ifdef STANDALONE
#include <readline/readline.h>
#include <readline/history.h>
#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) {