commit 7eb8a64aa5e4a9badacef1c7beb4d52111d1577d
parent 60fd0d751d602a1e6359b4cb2a15e0729c8ef7cb
Author: Antoni Sawicki <as@tenoware.com>
Date: Tue, 23 Oct 2018 00:50:43 -0700
better handling of sigint
Diffstat:
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git a/ttyplot.c b/ttyplot.c
@@ -103,6 +103,14 @@ void resize(int sig) {
refresh();
}
+void finish(int sig) {
+ curs_set(FALSE);
+ echo();
+ refresh();
+ endwin();
+ exit(0);
+}
+
int main(int argc, char *argv[]) {
double values1[1024]={0};
double values2[1024]={0};
@@ -161,6 +169,7 @@ int main(int argc, char *argv[]) {
noecho();
curs_set(FALSE);
signal(SIGWINCH, (void*)resize);
+ signal(SIGINT, (void*)finish);
while(1) {
if(two)