From 995e8da6536dc25a9ad37e8ef11e9b2f92b48e91 Mon Sep 17 00:00:00 2001 From: BanceDev Date: Wed, 4 Sep 2024 12:20:50 -0400 Subject: history saving implemented --- src/lush.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/lush.c') diff --git a/src/lush.c b/src/lush.c index facdff2..81f9e64 100644 --- a/src/lush.c +++ b/src/lush.c @@ -17,6 +17,7 @@ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. #include "lush.h" #include "help.h" +#include "history.h" #include "lauxlib.h" #include "lua.h" #include "lua_api.h" @@ -517,6 +518,7 @@ int main() { // Print the prompt printf("[%s@%s:%s] ", username, device_name, prompt_cwd); char *line = lush_read_line(); + lush_push_history(line); printf("\n"); if (line == NULL || strlen(line) == 0) { free(line); @@ -533,6 +535,7 @@ int main() { for (int i = 0; args[i]; i++) { free(args[i]); } + // add last line to history free(cwd); free(args); free(commands); -- cgit v1.2.3-59-g8ed1b