From 1579f7c0df91df4581c1096448dde8cf9afddb49 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Tue, 12 Jan 2016 15:24:24 +0100 Subject: added history support: it is saved in .applause_history of the current working directory --- applause.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/applause.c b/applause.c index 99b5453..8f3323a 100644 --- a/applause.c +++ b/applause.c @@ -31,10 +31,11 @@ #include #include -#define LUA_MODULE "applause.lua" +#define LUA_MODULE "applause.lua" +#define APPLAUSE_HISTORY ".applause_history" -#define CMD_SERVER_IP "127.0.0.1" -#define CMD_SERVER_PORT 10000 +#define CMD_SERVER_IP "127.0.0.1" +#define CMD_SERVER_PORT 10000 #define MAX(X,Y) ((X) > (Y) ? (X) : (Y)) @@ -878,6 +879,12 @@ main(int argc, char **argv) signal_action.sa_handler = SIG_IGN; sigaction(SIGPIPE, &signal_action, NULL); + /* + * Load the libhistory file. + */ + using_history(); + read_history(APPLAUSE_HISTORY); + L = luaL_newstate(); if (!L) { fprintf(stderr, "Error creating Lua state.\n"); @@ -960,5 +967,12 @@ main(int argc, char **argv) svsem_free(buffer_sem); lua_close(L); + + /* + * Write libhistory file + */ + if (write_history(APPLAUSE_HISTORY)) + perror("write_history"); + return 0; } -- cgit v1.2.3