summaryrefslogtreecommitdiffstats
path: root/cmd-confirm-before.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-confirm-before.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-confirm-before.c')
-rw-r--r--cmd-confirm-before.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/cmd-confirm-before.c b/cmd-confirm-before.c
index ea7eab4f..329027cc 100644
--- a/cmd-confirm-before.c
+++ b/cmd-confirm-before.c
@@ -26,11 +26,11 @@
* Asks for confirmation before executing a command.
*/
-void cmd_confirm_before_key_binding(struct cmd *, int);
-int cmd_confirm_before_exec(struct cmd *, struct cmd_ctx *);
+void cmd_confirm_before_key_binding(struct cmd *, int);
+enum cmd_retval cmd_confirm_before_exec(struct cmd *, struct cmd_ctx *);
-int cmd_confirm_before_callback(void *, const char *);
-void cmd_confirm_before_free(void *);
+int cmd_confirm_before_callback(void *, const char *);
+void cmd_confirm_before_free(void *);
const struct cmd_entry cmd_confirm_before_entry = {
"confirm-before", "confirm",
@@ -65,7 +65,7 @@ cmd_confirm_before_key_binding(struct cmd *self, int key)
}
}
-int
+enum cmd_retval
cmd_confirm_before_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct args *args = self->args;
@@ -76,11 +76,11 @@ cmd_confirm_before_exec(struct cmd *self, struct cmd_ctx *ctx)
if (ctx->curclient == NULL) {
ctx->error(ctx, "must be run interactively");
- return (-1);
+ return (CMD_RETURN_ERROR);
}
if ((c = cmd_find_client(ctx, args_get(args, 't'))) == NULL)
- return (-1);
+ return (CMD_RETURN_ERROR);
if ((prompt = args_get(args, 'p')) != NULL)
xasprintf(&new_prompt, "%s ", prompt);
@@ -99,7 +99,7 @@ cmd_confirm_before_exec(struct cmd *self, struct cmd_ctx *ctx)
PROMPT_SINGLE);
free(new_prompt);
- return (1);
+ return (CMD_RETURN_YIELD);
}
int