sacc

sacc (saccomys): simple gopher client.
Log | Files | Refs | LICENSE

commit 62d746cb6d34ed43068386bcd4a75f828055ee5e
parent f2b48c669ee5b69e3b46f64979739d15f41338c2
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Thu,  2 Jul 2020 23:24:53 +0200

exit with 128 + signo on receiving SIGHUP, SIGINT, SIGTERM

This also makes a better distinction between SIGHUP (=1) and die(),
which is also 1.

Diffstat:
Msacc.c | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sacc.c b/sacc.c @@ -951,6 +951,12 @@ cleanup(void) uicleanup(); } +void +sighandler(int signo) +{ + exit(128 + signo); +} + static void setup(void) { @@ -971,7 +977,7 @@ setup(void) sigemptyset(&sa.sa_mask); sa.sa_flags = SA_RESTART; - sa.sa_handler = exit; + sa.sa_handler = sighandler; sigaction(SIGINT, &sa, NULL); sigaction(SIGHUP, &sa, NULL); sigaction(SIGTERM, &sa, NULL);