diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-01-19 18:23:40 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-01-19 18:23:40 +0000 |
commit | 93230a64bc9369c726cc68d3f539b3bf66cff069 (patch) | |
tree | 0ad90cda9a0db39a058cbac8ceec67e6e7215354 /cmd-find-window.c | |
parent | 5f6a351df72f76f98ee1ed3494d025fe591fdb69 (diff) | |
download | rtmux-93230a64bc9369c726cc68d3f539b3bf66cff069.tar.gz rtmux-93230a64bc9369c726cc68d3f539b3bf66cff069.tar.bz2 rtmux-93230a64bc9369c726cc68d3f539b3bf66cff069.zip |
Pass return code from _exec; allow command sequences to work from the command line.
Diffstat (limited to 'cmd-find-window.c')
-rw-r--r-- | cmd-find-window.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/cmd-find-window.c b/cmd-find-window.c index b46884e0..cae763fe 100644 --- a/cmd-find-window.c +++ b/cmd-find-window.c @@ -1,4 +1,4 @@ -/* $Id: cmd-find-window.c,v 1.2 2009-01-18 19:10:08 nicm Exp $ */ +/* $Id: cmd-find-window.c,v 1.3 2009-01-19 18:23:40 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -26,7 +26,7 @@ * Find window containing text. */ -void cmd_find_window_exec(struct cmd *, struct cmd_ctx *); +int cmd_find_window_exec(struct cmd *, struct cmd_ctx *); void cmd_find_window_callback(void *, int); char *cmd_find_window_search(struct window_pane *, const char *); @@ -48,7 +48,7 @@ struct cmd_find_window_data { u_int session; }; -void +int cmd_find_window_exec(struct cmd *self, struct cmd_ctx *ctx) { struct cmd_target_data *data = self->data; @@ -64,12 +64,12 @@ cmd_find_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); ARRAY_INIT(&list_idx); ARRAY_INIT(&list_ctx); @@ -106,7 +106,7 @@ cmd_find_window_exec(struct cmd *self, struct cmd_ctx *ctx) ctx->error(ctx, "no windows matching: %s", data->arg); ARRAY_FREE(&list_idx); ARRAY_FREE(&list_ctx); - return; + return (-1); } if (ARRAY_LENGTH(&list_idx) == 1) { @@ -142,8 +142,7 @@ out: ARRAY_FREE(&list_idx); ARRAY_FREE(&list_ctx); - if (ctx->cmdclient != NULL) - server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0); + return (0); } void |