diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2011-08-16 10:00:53 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2011-08-16 10:00:53 +0000 |
commit | 7d91d2a9a173d0f842a9be82c870cd5431f233c5 (patch) | |
tree | e83ed52aa808fe23bc47019fe663b707a49f7346 /usr.bin/tmux/cmd-switch-client.c | |
parent | 012465707b15b23744f8fe4a3db4b0ed5fef0309 (diff) |
Add a -r flag to switch-client to toggle the client read-only flag. From
Johan Commelin.
Diffstat (limited to 'usr.bin/tmux/cmd-switch-client.c')
-rw-r--r-- | usr.bin/tmux/cmd-switch-client.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/usr.bin/tmux/cmd-switch-client.c b/usr.bin/tmux/cmd-switch-client.c index 1a0de247492..1ff9e643fb1 100644 --- a/usr.bin/tmux/cmd-switch-client.c +++ b/usr.bin/tmux/cmd-switch-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-switch-client.c,v 1.12 2011/04/05 19:37:01 nicm Exp $ */ +/* $OpenBSD: cmd-switch-client.c,v 1.13 2011/08/16 10:00:52 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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) { |