diff options
author | 2012-07-11 07:10:15 +0000 | |
---|---|---|
committer | 2012-07-11 07:10:15 +0000 | |
commit | a224d0d3ac3348ad8dc1a5ad50b3236b714355cb (patch) | |
tree | df2f2d708c70b79c7062f0952940023e476a9709 /usr.bin/tmux/cmd-confirm-before.c | |
parent | Separate total block counter (reported to user) from 8-bit block counter (diff) | |
download | wireguard-openbsd-a224d0d3ac3348ad8dc1a5ad50b3236b714355cb.tar.xz wireguard-openbsd-a224d0d3ac3348ad8dc1a5ad50b3236b714355cb.zip |
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 'usr.bin/tmux/cmd-confirm-before.c')
-rw-r--r-- | usr.bin/tmux/cmd-confirm-before.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/usr.bin/tmux/cmd-confirm-before.c b/usr.bin/tmux/cmd-confirm-before.c index 3438ddf8052..66340eaeee3 100644 --- a/usr.bin/tmux/cmd-confirm-before.c +++ b/usr.bin/tmux/cmd-confirm-before.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-confirm-before.c,v 1.13 2012/07/10 11:53:01 nicm Exp $ */ +/* $OpenBSD: cmd-confirm-before.c,v 1.14 2012/07/11 07:10:15 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -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 |