diff options
author | Tiago Cunha <tcunha@gmx.com> | 2009-07-30 20:57:39 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2009-07-30 20:57:39 +0000 |
commit | 67266dc25c4973be37ff11d277aa598456a0f38d (patch) | |
tree | ac5f5c3bc537dddf7ca535259aac4ac55f3933c2 /client-fn.c | |
parent | 817e93ac947226f83d7b2b8927fbec4cf6293d44 (diff) | |
download | rtmux-67266dc25c4973be37ff11d277aa598456a0f38d.tar.gz rtmux-67266dc25c4973be37ff11d277aa598456a0f38d.tar.bz2 rtmux-67266dc25c4973be37ff11d277aa598456a0f38d.zip |
Sync OpenBSD patchset 202:
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 | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/client-fn.c b/client-fn.c index 81fac53f..f74564d1 100644 --- a/client-fn.c +++ b/client-fn.c @@ -1,4 +1,4 @@ -/* $Id: client-fn.c,v 1.8 2009-07-30 20:21:55 tcunha Exp $ */ +/* $Id: client-fn.c,v 1.9 2009-07-30 20:57:39 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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); +} |