diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-11-27 16:47:21 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-11-27 16:47:21 +0100 |
| commit | ce66ec2833143cc14eb6cffc6f16b736df9d1f31 (patch) | |
| tree | f48ef5c733fbe0dfbdc10f41267e22990dce858f /vis.c | |
| parent | 81e20069163d7c0780d759d904149e247f97db86 (diff) | |
| download | vis-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.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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); |
