summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-attach-session.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2010-02-06 22:55:31 +0000
committernicm <nicm@openbsd.org>2010-02-06 22:55:31 +0000
commit52d748f81070ff7acf1200fe49e4853f221f7edb (patch)
treebabf8f305a6dc6f91fb36bf816be81b14c0d78f0 /usr.bin/tmux/cmd-attach-session.c
parentno bsd.bin here as well (diff)
downloadwireguard-openbsd-52d748f81070ff7acf1200fe49e4853f221f7edb.tar.xz
wireguard-openbsd-52d748f81070ff7acf1200fe49e4853f221f7edb.zip
Support attaching a client read-only with a new -r flag to the attach-session
command.
Diffstat (limited to 'usr.bin/tmux/cmd-attach-session.c')
-rw-r--r--usr.bin/tmux/cmd-attach-session.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd-attach-session.c b/usr.bin/tmux/cmd-attach-session.c
index f49b865c7b3..8421e50e85c 100644
--- a/usr.bin/tmux/cmd-attach-session.c
+++ b/usr.bin/tmux/cmd-attach-session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-attach-session.c,v 1.11 2009/12/03 22:50:09 nicm Exp $ */
+/* $OpenBSD: cmd-attach-session.c,v 1.12 2010/02/06 22:55:31 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -28,8 +28,8 @@ int cmd_attach_session_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_attach_session_entry = {
"attach-session", "attach",
- "[-d] " CMD_TARGET_SESSION_USAGE,
- CMD_CANTNEST|CMD_STARTSERVER|CMD_SENDENVIRON, "d",
+ "[-dr] " CMD_TARGET_SESSION_USAGE,
+ CMD_CANTNEST|CMD_STARTSERVER|CMD_SENDENVIRON, "dr",
cmd_target_init,
cmd_target_parse,
cmd_attach_session_exec,
@@ -89,6 +89,9 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx)
return (-1);
}
+ if (cmd_check_flag(data->chflags, 'r'))
+ ctx->cmdclient->flags |= CLIENT_READONLY;
+
if (cmd_check_flag(data->chflags, 'd'))
server_write_session(s, MSG_DETACH, NULL, 0);