summaryrefslogtreecommitdiffstats
path: root/cmd-respawn-pane.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-respawn-pane.c
parenta432fcd30617610b46d65f49b7513bf5da5694de (diff)
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-respawn-pane.c')
-rw-r--r--cmd-respawn-pane.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/cmd-respawn-pane.c b/cmd-respawn-pane.c
index 37c221af..cf3d9303 100644
--- a/cmd-respawn-pane.c
+++ b/cmd-respawn-pane.c
@@ -28,7 +28,7 @@
* Respawn a pane (restart the command). Kill existing if -k given.
*/
-int cmd_respawn_pane_exec(struct cmd *, struct cmd_ctx *);
+enum cmd_retval cmd_respawn_pane_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_respawn_pane_entry = {
"respawn-pane", "respawnp",
@@ -40,7 +40,7 @@ const struct cmd_entry cmd_respawn_pane_entry = {
cmd_respawn_pane_exec
};
-int
+enum cmd_retval
cmd_respawn_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct args *args = self->args;
@@ -54,7 +54,7 @@ cmd_respawn_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
u_int idx;
if ((wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp)) == NULL)
- return (-1);
+ return (CMD_RETURN_ERROR);
w = wl->window;
if (!args_has(self->args, 'k') && wp->fd != -1) {
@@ -62,7 +62,7 @@ cmd_respawn_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
fatalx("index not found");
ctx->error(ctx, "pane still active: %s:%u.%u",
s->name, wl->idx, idx);
- return (-1);
+ return (CMD_RETURN_ERROR);
}
environ_init(&env);
@@ -82,11 +82,11 @@ cmd_respawn_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
ctx->error(ctx, "respawn pane failed: %s", cause);
free(cause);
environ_free(&env);
- return (-1);
+ return (CMD_RETURN_ERROR);
}
wp->flags |= PANE_REDRAW;
server_status_window(w);
environ_free(&env);
- return (0);
+ return (CMD_RETURN_NORMAL);
}