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-switch-client.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-switch-client.c')
| -rw-r--r-- | usr.bin/tmux/cmd-switch-client.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/usr.bin/tmux/cmd-switch-client.c b/usr.bin/tmux/cmd-switch-client.c index 450c39abf80..2a1e07ba74f 100644 --- a/usr.bin/tmux/cmd-switch-client.c +++ b/usr.bin/tmux/cmd-switch-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-switch-client.c,v 1.14 2012/01/21 06:13:16 nicm Exp $ */ +/* $OpenBSD: cmd-switch-client.c,v 1.15 2012/07/11 07:10:15 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -27,8 +27,8 @@ * Switch client to a different session. */ -void cmd_switch_client_key_binding(struct cmd *, int); -int cmd_switch_client_exec(struct cmd *, struct cmd_ctx *); +void cmd_switch_client_key_binding(struct cmd *, int); +enum cmd_retval cmd_switch_client_exec(struct cmd *, struct cmd_ctx *); const struct cmd_entry cmd_switch_client_entry = { "switch-client", "switchc", @@ -57,7 +57,7 @@ cmd_switch_client_key_binding(struct cmd *self, int key) } } -int +enum cmd_retval cmd_switch_client_exec(struct cmd *self, struct cmd_ctx *ctx) { struct args *args = self->args; @@ -65,7 +65,7 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_ctx *ctx) struct session *s; if ((c = cmd_find_client(ctx, args_get(args, 'c'))) == NULL) - return (-1); + return (CMD_RETURN_ERROR); if (args_has(args, 'r')) { if (c->flags & CLIENT_READONLY) { @@ -81,24 +81,24 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_ctx *ctx) if (args_has(args, 'n')) { if ((s = session_next_session(c->session)) == NULL) { ctx->error(ctx, "can't find next session"); - return (-1); + return (CMD_RETURN_ERROR); } } else if (args_has(args, 'p')) { if ((s = session_previous_session(c->session)) == NULL) { ctx->error(ctx, "can't find previous session"); - return (-1); + return (CMD_RETURN_ERROR); } } else if (args_has(args, 'l')) { if (c->last_session != NULL && session_alive(c->last_session)) s = c->last_session; if (s == NULL) { ctx->error(ctx, "can't find last session"); - return (-1); + return (CMD_RETURN_ERROR); } } else s = cmd_find_session(ctx, args_get(args, 't'), 0); if (s == NULL) - return (-1); + return (CMD_RETURN_ERROR); if (c->session != NULL) c->last_session = c->session; @@ -110,5 +110,5 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_ctx *ctx) server_redraw_client(c); s->curw->flags &= ~WINLINK_ALERTFLAGS; - return (0); + return (CMD_RETURN_NORMAL); } |
