summaryrefslogtreecommitdiffstats
path: root/cmd-detach-client.c
diff options
context:
space:
mode:
authornicm <nicm>2014-10-20 23:01:51 +0000
committernicm <nicm>2014-10-20 23:01:51 +0000
commit30bacf6f3038a867b53143150944f0997558114b (patch)
tree21845a8d16ab2f89e4e1c72064396f3dbc2aeeb1 /cmd-detach-client.c
parent8a5ceac3a9a21ec70c480d284dc1fc6907af2ce0 (diff)
Move suspend-client code into detach-client.
Diffstat (limited to 'cmd-detach-client.c')
-rw-r--r--cmd-detach-client.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/cmd-detach-client.c b/cmd-detach-client.c
index d60cf47d..600554a4 100644
--- a/cmd-detach-client.c
+++ b/cmd-detach-client.c
@@ -36,6 +36,14 @@ const struct cmd_entry cmd_detach_client_entry = {
cmd_detach_client_exec
};
+const struct cmd_entry cmd_suspend_client_entry = {
+ "suspend-client", "suspendc",
+ "t:", 0, 0,
+ CMD_TARGET_CLIENT_USAGE,
+ 0,
+ cmd_detach_client_exec
+};
+
enum cmd_retval
cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq)
{
@@ -45,6 +53,15 @@ cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq)
enum msgtype msgtype;
u_int i;
+ if (self->entry == &cmd_suspend_client_entry) {
+ if ((c = cmd_find_client(cmdq, args_get(args, 't'), 0)) == NULL)
+ return (CMD_RETURN_ERROR);
+ tty_stop_tty(&c->tty);
+ c->flags |= CLIENT_SUSPENDED;
+ server_write_client(c, MSG_SUSPEND, NULL, 0);
+ return (CMD_RETURN_NORMAL);
+ }
+
if (args_has(args, 'P'))
msgtype = MSG_DETACHKILL;
else