summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-list.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2012-06-18 13:16:42 +0000
committernicm <nicm@openbsd.org>2012-06-18 13:16:42 +0000
commit90896992596b3ed328f806012b5b6bcedafb12da (patch)
tree710be24359a9443ba43594518b4a849b071c6c44 /usr.bin/tmux/cmd-list.c
parentClarify description of -W. Noted by Steve.McClellan at radisys com, ok jmc (diff)
downloadwireguard-openbsd-90896992596b3ed328f806012b5b6bcedafb12da.tar.xz
wireguard-openbsd-90896992596b3ed328f806012b5b6bcedafb12da.zip
Add a skeleton mode to tmux (called "control mode") that let's tmux
commands be sent and output received on stdout. This can be used to integrate with other terminal emulators and should allow some other things to be made simpler later. More to come so doesn't do much yet and deliberately not documented.
Diffstat (limited to 'usr.bin/tmux/cmd-list.c')
-rw-r--r--usr.bin/tmux/cmd-list.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd-list.c b/usr.bin/tmux/cmd-list.c
index 674b5c0998e..82188532644 100644
--- a/usr.bin/tmux/cmd-list.c
+++ b/usr.bin/tmux/cmd-list.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-list.c,v 1.6 2010/10/29 20:11:57 nicm Exp $ */
+/* $OpenBSD: cmd-list.c,v 1.7 2012/06/18 13:16:42 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -81,12 +81,24 @@ bad:
int
cmd_list_exec(struct cmd_list *cmdlist, struct cmd_ctx *ctx)
{
+ struct client *c = ctx->curclient;
struct cmd *cmd;
- int n, retval;
+ int n, retval, guards;
+
+ guards = 0;
+ if (c != NULL && c->session != NULL)
+ guards = c->flags & CLIENT_CONTROL;
retval = 0;
TAILQ_FOREACH(cmd, &cmdlist->list, qentry) {
- if ((n = cmd_exec(cmd, ctx)) == -1)
+ if (guards)
+ ctx->print(ctx, "%%begin");
+ n = cmd_exec(cmd, ctx);
+ if (guards)
+ ctx->print(ctx, "%%end");
+
+ /* Return of -1 is an error. */
+ if (n == -1)
return (-1);
/*