aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2016-01-12 15:24:24 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2016-01-12 15:24:24 +0100
commit1579f7c0df91df4581c1096448dde8cf9afddb49 (patch)
tree0a730fe3f624b1f74c1e9ea0edad3d785b5e8617
parent95f096e7fefd9ddb5130c1faf7314cb19922e3ad (diff)
downloadapplause2-1579f7c0df91df4581c1096448dde8cf9afddb49.tar.gz
added history support: it is saved in .applause_history of the current working directory
-rw-r--r--applause.c20
1 files 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 <jack/midiport.h>
#include <jack/ringbuffer.h>
-#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;
}