]> git.eli173.com Git - klapaucius/commitdiff
swapped linenoise for editline
authorElijah Cohen <eli@eli173.com>
Wed, 14 Aug 2024 05:16:30 +0000 (00:16 -0500)
committerElijah Cohen <eli@eli173.com>
Wed, 14 Aug 2024 05:16:30 +0000 (00:16 -0500)
src/repl.c

index eec6619ef45cab8b3718c13a42ea320d07cae24e..a7f907e822fe8bbf5f282ba5a3cf4453c15107bf 100644 (file)
@@ -1,9 +1,10 @@
 
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <histedit.h>
 
-#include "linenoise.h"
+#include <editline/readline.h>
 
 #include "types.h"
 #include "eval.h"
@@ -14,6 +15,7 @@
 
 
 
+
 int main(int argc, char** argv) {
 
        Sexpr* env = init_dict();
@@ -21,10 +23,10 @@ int main(int argc, char** argv) {
        // now do the loop, right?
        char* input = NULL;
        while(1) {
-               input = linenoise("> ");
+               input = readline("> ");
                if(input == NULL)
                        return 0;
-               linenoiseHistoryAdd(input);
+               add_history(input);
                Sexpr* in = parse(input);
                if(in == NULL) {
                        printf("bad input\n");
@@ -34,7 +36,7 @@ int main(int argc, char** argv) {
                        Sexpr* out = eval(car(in), env);
                        printf(" - %s\n", sprint_sexpr(out));
                }
-               linenoiseFree(input);
+               free(input);
        }
        return 0;
 }