diff options
author | Tiago Cunha <tcunha@gmx.com> | 2011-08-21 12:38:55 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2011-08-21 12:38:55 +0000 |
commit | 87a2a13f6841236b4e52313488062fcd50e03352 (patch) | |
tree | d5e1e588400ebfbe68a39c620b08e8dc2ec9c4f6 /cmd-switch-client.c | |
parent | 5775074f730a41da252db78d0a2f997a5015ac5d (diff) | |
download | rtmux-87a2a13f6841236b4e52313488062fcd50e03352.tar.gz rtmux-87a2a13f6841236b4e52313488062fcd50e03352.tar.bz2 rtmux-87a2a13f6841236b4e52313488062fcd50e03352.zip |
Sync OpenBSD patchset 946:
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.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/cmd-switch-client.c b/cmd-switch-client.c index 3eca3fff..5565e094 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) { |