aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-11-27 16:47:21 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-11-27 16:47:21 +0100
commitce66ec2833143cc14eb6cffc6f16b736df9d1f31 (patch)
treef48ef5c733fbe0dfbdc10f41267e22990dce858f /vis.c
parent81e20069163d7c0780d759d904149e247f97db86 (diff)
downloadvis-ce66ec2833143cc14eb6cffc6f16b736df9d1f31.tar.gz
vis-ce66ec2833143cc14eb6cffc6f16b736df9d1f31.tar.xz
vis: cleanup signal handling code
Move all signal handling code out of "library" code into user application.
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/vis.c b/vis.c
index b7619fe..c8a102b 100644
--- a/vis.c
+++ b/vis.c
@@ -994,6 +994,14 @@ bool vis_signal_handler(Vis *vis, int signum, const siginfo_t *siginfo, const vo
case SIGINT:
vis->cancel_filter = true;
return true;
+ case SIGCONT:
+ case SIGWINCH:
+ vis->need_resize = true;
+ return true;
+ case SIGTERM:
+ case SIGHUP:
+ vis->terminate = true;
+ return true;
}
return false;
}
@@ -1037,6 +1045,14 @@ int vis_run(Vis *vis, int argc, char *argv[]) {
free(name);
}
+ if (vis->terminate)
+ vis_die(vis, "Killed by SIGTERM\n");
+
+ if (vis->need_resize) {
+ vis->ui->resize(vis->ui);
+ vis->need_resize = false;
+ }
+
vis_update(vis);
idle.tv_sec = vis->mode->idle_timeout;
int r = pselect(1, &fds, NULL, NULL, timeout, &emptyset);