Add a -r flag to switch-client to toggle the client read-only flag. From

Johan Commelin.
This commit is contained in:
Nicholas Marriott
2011-08-16 10:00:52 +00:00
parent f95f792ddf
commit 88e9079870
4 changed files with 29 additions and 10 deletions

View File

@ -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) {