aboutsummaryrefslogtreecommitdiff
path: root/cmd-new-window.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2012-07-11 19:37:32 +0000
committerTiago Cunha <tcunha@gmx.com>2012-07-11 19:37:32 +0000
commit1f5e6e35d5046693f0ef5ec76535f517757b7122 (patch)
treee53808c90f3a53279554f8580d2b96df606baec3 /cmd-new-window.c
parenta432fcd30617610b46d65f49b7513bf5da5694de (diff)
downloadrtmux-1f5e6e35d5046693f0ef5ec76535f517757b7122.tar.gz
rtmux-1f5e6e35d5046693f0ef5ec76535f517757b7122.tar.bz2
rtmux-1f5e6e35d5046693f0ef5ec76535f517757b7122.zip
Sync OpenBSD patchset 1151:
Make command exec functions return an enum rather than -1/0/1 values and add a new value to mean "leave client running but don't attach" to fix problems with using some commands in a command sequence. Most of the work by Thomas Adam, problem reported by "jspenguin" on SF bug 3535531.
Diffstat (limited to 'cmd-new-window.c')
-rw-r--r--cmd-new-window.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/cmd-new-window.c b/cmd-new-window.c
index af5ac544..95ad5988 100644
--- a/cmd-new-window.c
+++ b/cmd-new-window.c
@@ -39,7 +39,7 @@ const struct cmd_entry cmd_new_window_entry = {
cmd_new_window_exec
};
-int
+enum cmd_retval
cmd_new_window_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct args *args = self->args;
@@ -56,7 +56,7 @@ cmd_new_window_exec(struct cmd *self, struct cmd_ctx *ctx)
if (args_has(args, 'a')) {
wl = cmd_find_window(ctx, args_get(args, 't'), &s);
if (wl == NULL)
- return (-1);
+ return (CMD_RETURN_ERROR);
idx = wl->idx + 1;
/* Find the next free index. */
@@ -66,7 +66,7 @@ cmd_new_window_exec(struct cmd *self, struct cmd_ctx *ctx)
}
if (last == INT_MAX) {
ctx->error(ctx, "no free window indexes");
- return (-1);
+ return (CMD_RETURN_ERROR);
}
/* Move everything from last - 1 to idx up a bit. */
@@ -77,7 +77,7 @@ cmd_new_window_exec(struct cmd *self, struct cmd_ctx *ctx)
}
} else {
if ((idx = cmd_find_index(ctx, args_get(args, 't'), &s)) == -2)
- return (-1);
+ return (CMD_RETURN_ERROR);
}
detached = args_has(args, 'd');
@@ -113,7 +113,7 @@ cmd_new_window_exec(struct cmd *self, struct cmd_ctx *ctx)
if (wl == NULL) {
ctx->error(ctx, "create window failed: %s", cause);
free(cause);
- return (-1);
+ return (CMD_RETURN_ERROR);
}
if (!detached) {
session_select(s, wl->idx);
@@ -139,5 +139,5 @@ cmd_new_window_exec(struct cmd *self, struct cmd_ctx *ctx)
format_free(ft);
}
- return (0);
+ return (CMD_RETURN_NORMAL);
}