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-move-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-move-window.c')
-rw-r--r-- | cmd-move-window.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/cmd-move-window.c b/cmd-move-window.c index 4420006f..65812b17 100644 --- a/cmd-move-window.c +++ b/cmd-move-window.c @@ -1,4 +1,4 @@ -/* $Id: cmd-move-window.c,v 1.3 2008-12-10 20:25:41 nicm Exp $ */ +/* $Id: cmd-move-window.c,v 1.4 2009-01-19 18:23:40 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -26,7 +26,7 @@ * Move a window. */ -void cmd_move_window_exec(struct cmd *, struct cmd_ctx *); +int cmd_move_window_exec(struct cmd *, struct cmd_ctx *); const struct cmd_entry cmd_move_window_entry = { "move-window", "movew", @@ -41,7 +41,7 @@ const struct cmd_entry cmd_move_window_entry = { cmd_srcdst_print }; -void +int cmd_move_window_exec(struct cmd *self, struct cmd_ctx *ctx) { struct cmd_srcdst_data *data = self->data; @@ -52,11 +52,11 @@ cmd_move_window_exec(struct cmd *self, struct cmd_ctx *ctx) int destroyed, idx; if ((wl_src = cmd_find_window(ctx, data->src, &src)) == NULL) - return; + return (-1); if (arg_parse_window(data->dst, &dst, &idx) != 0) { ctx->error(ctx, "bad window: %s", data->dst); - return; + return (-1); } if (dst == NULL) dst = ctx->cursession; @@ -64,7 +64,7 @@ cmd_move_window_exec(struct cmd *self, struct cmd_ctx *ctx) dst = cmd_current_session(ctx); if (dst == NULL) { ctx->error(ctx, "session not found: %s", data->dst); - return; + return (-1); } wl_dst = NULL; @@ -72,7 +72,7 @@ cmd_move_window_exec(struct cmd *self, struct cmd_ctx *ctx) wl_dst = winlink_find_by_index(&dst->windows, idx); if (wl_dst != NULL) { if (wl_dst->window == wl_src->window) - goto out; + return (0); if (data->flags & CMD_KFLAG) { /* @@ -94,7 +94,7 @@ cmd_move_window_exec(struct cmd *self, struct cmd_ctx *ctx) wl_dst = session_attach(dst, wl_src->window, idx); if (wl_dst == NULL) { ctx->error(ctx, "index in use: %d", idx); - return; + return (-1); } destroyed = session_detach(src, wl_src); @@ -117,7 +117,5 @@ cmd_move_window_exec(struct cmd *self, struct cmd_ctx *ctx) } recalculate_sizes(); -out: - if (ctx->cmdclient != NULL) - server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0); + return (0); } |