From 45dfc5a074e2ceae11a6d4aeae597bee1e028503 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 20 Oct 2014 22:29:25 +0000 Subject: Instead of setting up the default keys by building the key struct directly with a helper function in the cmd_entry, include a table of bind-key commands and pass them through the command parser and a temporary cmd_q. As well as being smaller, this will allow default bindings to be command sequences which will probably be needed soon. --- cmd-detach-client.c | 1 - 1 file changed, 1 deletion(-) (limited to 'cmd-detach-client.c') diff --git a/cmd-detach-client.c b/cmd-detach-client.c index d40ef5a0..d60cf47d 100644 --- a/cmd-detach-client.c +++ b/cmd-detach-client.c @@ -33,7 +33,6 @@ const struct cmd_entry cmd_detach_client_entry = { "as:t:P", 0, 0, "[-P] [-a] [-s target-session] " CMD_TARGET_CLIENT_USAGE, CMD_READONLY, - NULL, cmd_detach_client_exec }; -- cgit From 30bacf6f3038a867b53143150944f0997558114b Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 20 Oct 2014 23:01:51 +0000 Subject: Move suspend-client code into detach-client. --- cmd-detach-client.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'cmd-detach-client.c') 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 -- cgit