summaryrefslogtreecommitdiffstats
path: root/cmd-switch-client.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2011-08-16 10:00:52 +0000
committerNicholas Marriott <nicm@openbsd.org>2011-08-16 10:00:52 +0000
commit88e9079870a770c39dd8f96302602a792db9a90a (patch)
tree548482bcc5dfa5f3f3825759445a78056427f4a5 /cmd-switch-client.c
parentf95f792ddf208e24e1f979b1bf5d373a8052af68 (diff)
Add a -r flag to switch-client to toggle the client read-only flag. From
Johan Commelin.
Diffstat (limited to 'cmd-switch-client.c')
-rw-r--r--cmd-switch-client.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/cmd-switch-client.c b/cmd-switch-client.c
index 25a57965..ab940dc4 100644
--- a/cmd-switch-client.c
+++ b/cmd-switch-client.c
@@ -32,9 +32,9 @@ int cmd_switch_client_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_switch_client_entry = {
"switch-client", "switchc",
- "lc:npt:", 0, 0,
- "[-lnp] [-c target-client] [-t target-session]",
- 0,
+ "lc:npt:r", 0, 0,
+ "[-lnpr] [-c target-client] [-t target-session]",
+ CMD_READONLY,
cmd_switch_client_key_binding,
NULL,
cmd_switch_client_exec
@@ -67,6 +67,16 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_ctx *ctx)
if ((c = cmd_find_client(ctx, args_get(args, 'c'))) == NULL)
return (-1);
+ if (args_has(args, 'r')) {
+ if (c->flags & CLIENT_READONLY) {
+ c->flags &= ~CLIENT_READONLY;
+ ctx->info(ctx, "made client writable");
+ } else {
+ c->flags |= CLIENT_READONLY;
+ ctx->info(ctx, "made client read-only");
+ }
+ }
+
s = NULL;
if (args_has(args, 'n')) {
if ((s = session_next_session(c->session)) == NULL) {