diff options
author | Thomas Adam <thomas@xteddy.org> | 2015-12-13 16:01:13 +0000 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2015-12-13 16:01:13 +0000 |
commit | ae5ddfdc1ae471f13c6d0e94ff4029d4fb29e1f4 (patch) | |
tree | 72ebffc1c0617c28ddc421f24045f148b7d59e36 /cmd-queue.c | |
parent | 92f187d1c2d84322860dc595da604260999a52f0 (diff) | |
parent | ff599f4004aaa6aae325ece5cbc996e2dc6f0b4f (diff) | |
download | rtmux-ae5ddfdc1ae471f13c6d0e94ff4029d4fb29e1f4.tar.gz rtmux-ae5ddfdc1ae471f13c6d0e94ff4029d4fb29e1f4.tar.bz2 rtmux-ae5ddfdc1ae471f13c6d0e94ff4029d4fb29e1f4.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-queue.c')
-rw-r--r-- | cmd-queue.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/cmd-queue.c b/cmd-queue.c index c85fb048..7b2675fa 100644 --- a/cmd-queue.c +++ b/cmd-queue.c @@ -25,7 +25,7 @@ #include "tmux.h" -enum cmd_retval cmdq_continue_one(struct cmd_q *); +static enum cmd_retval cmdq_continue_one(struct cmd_q *); /* Create new command queue. */ struct cmd_q * @@ -179,37 +179,40 @@ cmdq_append(struct cmd_q *cmdq, struct cmd_list *cmdlist, struct mouse_event *m) } /* Process one command. */ -enum cmd_retval +static enum cmd_retval cmdq_continue_one(struct cmd_q *cmdq) { struct cmd *cmd = cmdq->cmd; enum cmd_retval retval; - char *s; + char *tmp; int flags = !!(cmd->flags & CMD_CONTROL); - s = cmd_print(cmd); - log_debug("cmdq %p: %s", cmdq, s); - free(s); + tmp = cmd_print(cmd); + log_debug("cmdq %p: %s", cmdq, tmp); + free(tmp); cmdq->time = time(NULL); cmdq->number++; cmdq_guard(cmdq, "begin", flags); + if (cmd_prepare_state(cmd, cmdq) != 0) + goto error; retval = cmd->entry->exec(cmd, cmdq); - if (retval == CMD_RETURN_ERROR) - cmdq_guard(cmdq, "error", flags); - else - cmdq_guard(cmdq, "end", flags); + cmdq_guard(cmdq, "end", flags); return (retval); + +error: + cmdq_guard(cmdq, "error", flags); + return (CMD_RETURN_ERROR); } /* Continue processing command queue. Returns 1 if finishes empty. */ int cmdq_continue(struct cmd_q *cmdq) { - struct client *c = cmdq->client; + struct client *c = cmdq->client; struct cmd_q_item *next; enum cmd_retval retval; int empty; |