diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-07-30 16:32:12 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-07-30 16:32:12 +0000 |
commit | 5f13bb0c3ade513ec3f88af8b6c0f575fa00cc4b (patch) | |
tree | c5951ede730fd867a6b658479574472d8eb1bcfa /client-fn.c | |
parent | 479d614884f66e9fa11f1292a2ef36991da46c1d (diff) | |
download | rtmux-5f13bb0c3ade513ec3f88af8b6c0f575fa00cc4b.tar.gz rtmux-5f13bb0c3ade513ec3f88af8b6c0f575fa00cc4b.tar.bz2 rtmux-5f13bb0c3ade513ec3f88af8b6c0f575fa00cc4b.zip |
There aren't many client message types or code to handle them so get rid of the
lookup table and use a switch, merge the tiny handler functions into it, and
move the whole lot to client.c.
Also change client_msg_dispatch to consume as many messages as possible and
move the call to it to the right place so it checks for signals afterwards.
Prompted by suggestions from eric@.
Diffstat (limited to 'client-fn.c')
-rw-r--r-- | client-fn.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/client-fn.c b/client-fn.c index 8e5e3722..129c6871 100644 --- a/client-fn.c +++ b/client-fn.c @@ -20,6 +20,7 @@ #include <stdlib.h> #include <string.h> +#include <unistd.h> #include "tmux.h" @@ -74,3 +75,23 @@ client_write_server( if (buf != NULL && len > 0) buffer_write(cctx->srv_out, buf, len); } + +void +client_suspend(void) +{ + struct sigaction act; + + memset(&act, 0, sizeof act); + sigemptyset(&act.sa_mask); + act.sa_flags = SA_RESTART; + + act.sa_handler = SIG_DFL; + if (sigaction(SIGTSTP, &act, NULL) != 0) + fatal("sigaction failed"); + + act.sa_handler = sighandler; + if (sigaction(SIGCONT, &act, NULL) != 0) + fatal("sigaction failed"); + + kill(getpid(), SIGTSTP); +} |