From 6df61b5dda6a07bb1187404e9bdf2579a8cad2ae Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Sat, 4 Aug 2018 21:23:28 -0400 Subject: Show source link on exit --- chat.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'chat.c') diff --git a/chat.c b/chat.c index cbd9790..30fe272 100644 --- a/chat.c +++ b/chat.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -27,7 +28,14 @@ #include "chat.h" -char *prompt(const char *prompt) { +static void sigint(int sig) { + (void)sig; + input(L"/quit"); + uiHide(); + exit(EX_OK); +} + +static char *prompt(const char *prompt) { char *line = NULL; size_t cap; for (;;) { @@ -67,6 +75,8 @@ int main(int argc, char *argv[]) { if (!chat.nick) chat.nick = prompt("Name: "); chat.user = strdup(chat.nick); + signal(SIGINT, sigint); + uiInit(); uiLog("Traveling..."); uiDraw(); -- cgit 1.4.1