summaryrefslogtreecommitdiffstats
path: root/cmd-choose-window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-01-19 18:23:40 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-01-19 18:23:40 +0000
commit93230a64bc9369c726cc68d3f539b3bf66cff069 (patch)
tree0ad90cda9a0db39a058cbac8ceec67e6e7215354 /cmd-choose-window.c
parent5f6a351df72f76f98ee1ed3494d025fe591fdb69 (diff)
Pass return code from _exec; allow command sequences to work from the command line.
Diffstat (limited to 'cmd-choose-window.c')
-rw-r--r--cmd-choose-window.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/cmd-choose-window.c b/cmd-choose-window.c
index b7f90dc6..9820c01e 100644
--- a/cmd-choose-window.c
+++ b/cmd-choose-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-choose-window.c,v 1.6 2009-01-18 19:10:08 nicm Exp $ */
+/* $Id: cmd-choose-window.c,v 1.7 2009-01-19 18:23:40 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -24,7 +24,7 @@
* Enter choice mode to choose a window.
*/
-void cmd_choose_window_exec(struct cmd *, struct cmd_ctx *);
+int cmd_choose_window_exec(struct cmd *, struct cmd_ctx *);
void cmd_choose_window_callback(void *, int);
@@ -45,7 +45,7 @@ struct cmd_choose_window_data {
u_int session;
};
-void
+int
cmd_choose_window_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct cmd_target_data *data = self->data;
@@ -57,15 +57,15 @@ cmd_choose_window_exec(struct cmd *self, struct cmd_ctx *ctx)
if (ctx->curclient == NULL) {
ctx->error(ctx, "must be run interactively");
- return;
+ return (-1);
}
s = ctx->curclient->session;
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
- return;
+ return (-1);
if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0)
- goto out;
+ return (0);
cur = idx = 0;
RB_FOREACH(wm, winlinks, &s->windows) {
@@ -87,9 +87,7 @@ cmd_choose_window_exec(struct cmd *self, struct cmd_ctx *ctx)
window_choose_ready(
wl->window->active, cur, cmd_choose_window_callback, cdata);
-out:
- if (ctx->cmdclient != NULL)
- server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);
+ return (0);
}
void