aboutsummaryrefslogtreecommitdiff
path: root/cmd-resize-pane-down.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-resize-pane-down.c
parent5f6a351df72f76f98ee1ed3494d025fe591fdb69 (diff)
downloadrtmux-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-resize-pane-down.c')
-rw-r--r--cmd-resize-pane-down.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/cmd-resize-pane-down.c b/cmd-resize-pane-down.c
index 6ec2b5b9..d6839ea3 100644
--- a/cmd-resize-pane-down.c
+++ b/cmd-resize-pane-down.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-resize-pane-down.c,v 1.5 2009-01-14 22:16:57 nicm Exp $ */
+/* $Id: cmd-resize-pane-down.c,v 1.6 2009-01-19 18:23:40 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -27,7 +27,7 @@
*/
void cmd_resize_pane_down_init(struct cmd *, int);
-void cmd_resize_pane_down_exec(struct cmd *, struct cmd_ctx *);
+int cmd_resize_pane_down_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_resize_pane_down_entry = {
"resize-pane-down", "resizep-down",
@@ -54,7 +54,7 @@ cmd_resize_pane_down_init(struct cmd *self, int key)
data->arg = xstrdup("5");
}
-void
+int
cmd_resize_pane_down_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct cmd_pane_data *data = self->data;
@@ -64,14 +64,14 @@ cmd_resize_pane_down_exec(struct cmd *self, struct cmd_ctx *ctx)
u_int adjust;
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
- return;
+ return (-1);
if (data->pane == -1)
wp = wl->window->active;
else {
wp = window_pane_at_index(wl->window, data->pane);
if (wp == NULL) {
ctx->error(ctx, "no pane: %d", data->pane);
- return;
+ return (-1);
}
}
@@ -81,7 +81,7 @@ cmd_resize_pane_down_exec(struct cmd *self, struct cmd_ctx *ctx)
adjust = strtonum(data->arg, 1, INT_MAX, &errstr);
if (errstr != NULL) {
ctx->error(ctx, "adjustment %s: %s", errstr, data->arg);
- return;
+ return (-1);
}
}
@@ -93,7 +93,7 @@ cmd_resize_pane_down_exec(struct cmd *self, struct cmd_ctx *ctx)
if (TAILQ_NEXT(wp, entry) == NULL) {
if (wp == TAILQ_FIRST(&wl->window->panes)) {
/* Only one pane. */
- goto out;
+ return (0);
}
wp = TAILQ_PREV(wp, window_panes, entry);
}
@@ -114,7 +114,5 @@ cmd_resize_pane_down_exec(struct cmd *self, struct cmd_ctx *ctx)
server_redraw_window(wl->window);
-out:
- if (ctx->cmdclient != NULL)
- server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);
+ return (0);
}