summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--chat.c12
-rw-r--r--chat.h2
-rw-r--r--ui.c4
3 files changed, 17 insertions, 1 deletions
diff --git a/chat.c b/chat.c
index cbd9790..30fe272 100644
--- a/chat.c
+++ b/chat.c
@@ -19,6 +19,7 @@
 #include <err.h>
 #include <errno.h>
 #include <poll.h>
+#include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -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();
diff --git a/chat.h b/chat.h
index e63e0cf..2c9239c 100644
--- a/chat.h
+++ b/chat.h
@@ -14,6 +14,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#define SOURCE_URL "https://code.causal.agency/june/chat"
+
 #include <stdbool.h>
 #include <stdlib.h>
 #include <wchar.h>
diff --git a/ui.c b/ui.c
index 0e24510..8938c20 100644
--- a/ui.c
+++ b/ui.c
@@ -100,6 +100,10 @@ static void uiResize(void) {
 
 void uiHide(void) {
 	endwin();
+	printf(
+		"This program is AGPLv3 free software!\n"
+		"The source is available at <" SOURCE_URL ">\n"
+	);
 }
 
 void uiDraw(void) {