summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2016-10-16 19:04:06 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2016-10-16 19:04:06 +0000
commit3f0dad54b9b7fbe7e951cb592fa147fbdc7bdde6 (patch)
treea685fa2872c014d3bc9be168c7338d3974fcab39
parentf71299d662dee69becff6a71ecf049a77fbacd95 (diff)
Mass rename struct cmd_q to struct cmdq_item and related.
-rw-r--r--usr.bin/tmux/cfg.c32
-rw-r--r--usr.bin/tmux/cmd-attach-session.c29
-rw-r--r--usr.bin/tmux/cmd-bind-key.c28
-rw-r--r--usr.bin/tmux/cmd-break-pane.c26
-rw-r--r--usr.bin/tmux/cmd-capture-pane.c32
-rw-r--r--usr.bin/tmux/cmd-choose-buffer.c13
-rw-r--r--usr.bin/tmux/cmd-choose-client.c15
-rw-r--r--usr.bin/tmux/cmd-choose-tree.c14
-rw-r--r--usr.bin/tmux/cmd-clear-history.c11
-rw-r--r--usr.bin/tmux/cmd-command-prompt.c25
-rw-r--r--usr.bin/tmux/cmd-confirm-before.c29
-rw-r--r--usr.bin/tmux/cmd-copy-mode.c14
-rw-r--r--usr.bin/tmux/cmd-detach-client.c11
-rw-r--r--usr.bin/tmux/cmd-display-message.c21
-rw-r--r--usr.bin/tmux/cmd-display-panes.c33
-rw-r--r--usr.bin/tmux/cmd-find-window.c18
-rw-r--r--usr.bin/tmux/cmd-find.c84
-rw-r--r--usr.bin/tmux/cmd-if-shell.c68
-rw-r--r--usr.bin/tmux/cmd-join-pane.c26
-rw-r--r--usr.bin/tmux/cmd-kill-pane.c10
-rw-r--r--usr.bin/tmux/cmd-kill-server.c6
-rw-r--r--usr.bin/tmux/cmd-kill-session.c8
-rw-r--r--usr.bin/tmux/cmd-kill-window.c12
-rw-r--r--usr.bin/tmux/cmd-list-buffers.c10
-rw-r--r--usr.bin/tmux/cmd-list-clients.c12
-rw-r--r--usr.bin/tmux/cmd-list-keys.c51
-rw-r--r--usr.bin/tmux/cmd-list-panes.c38
-rw-r--r--usr.bin/tmux/cmd-list-sessions.c11
-rw-r--r--usr.bin/tmux/cmd-list-windows.c24
-rw-r--r--usr.bin/tmux/cmd-load-buffer.c30
-rw-r--r--usr.bin/tmux/cmd-lock-server.c10
-rw-r--r--usr.bin/tmux/cmd-move-window.c16
-rw-r--r--usr.bin/tmux/cmd-new-session.c44
-rw-r--r--usr.bin/tmux/cmd-new-window.c34
-rw-r--r--usr.bin/tmux/cmd-paste-buffer.c10
-rw-r--r--usr.bin/tmux/cmd-pipe-pane.c20
-rw-r--r--usr.bin/tmux/cmd-queue.c212
-rw-r--r--usr.bin/tmux/cmd-refresh-client.c16
-rw-r--r--usr.bin/tmux/cmd-rename-session.c13
-rw-r--r--usr.bin/tmux/cmd-rename-window.c9
-rw-r--r--usr.bin/tmux/cmd-resize-pane.c24
-rw-r--r--usr.bin/tmux/cmd-respawn-pane.c20
-rw-r--r--usr.bin/tmux/cmd-respawn-window.c19
-rw-r--r--usr.bin/tmux/cmd-rotate-window.c9
-rw-r--r--usr.bin/tmux/cmd-run-shell.c34
-rw-r--r--usr.bin/tmux/cmd-save-buffer.c24
-rw-r--r--usr.bin/tmux/cmd-select-layout.c11
-rw-r--r--usr.bin/tmux/cmd-select-pane.c20
-rw-r--r--usr.bin/tmux/cmd-select-window.c19
-rw-r--r--usr.bin/tmux/cmd-send-keys.c22
-rw-r--r--usr.bin/tmux/cmd-set-buffer.c16
-rw-r--r--usr.bin/tmux/cmd-set-environment.c25
-rw-r--r--usr.bin/tmux/cmd-set-hook.c24
-rw-r--r--usr.bin/tmux/cmd-set-option.c166
-rw-r--r--usr.bin/tmux/cmd-show-environment.c37
-rw-r--r--usr.bin/tmux/cmd-show-messages.c33
-rw-r--r--usr.bin/tmux/cmd-show-options.c54
-rw-r--r--usr.bin/tmux/cmd-source-file.c30
-rw-r--r--usr.bin/tmux/cmd-split-window.c35
-rw-r--r--usr.bin/tmux/cmd-swap-pane.c14
-rw-r--r--usr.bin/tmux/cmd-swap-window.c16
-rw-r--r--usr.bin/tmux/cmd-switch-client.c21
-rw-r--r--usr.bin/tmux/cmd-unbind-key.c28
-rw-r--r--usr.bin/tmux/cmd-wait-for.c58
-rw-r--r--usr.bin/tmux/cmd.c32
-rw-r--r--usr.bin/tmux/control.c26
-rw-r--r--usr.bin/tmux/format.c12
-rw-r--r--usr.bin/tmux/hooks.c42
-rw-r--r--usr.bin/tmux/key-bindings.c6
-rw-r--r--usr.bin/tmux/notify.c10
-rw-r--r--usr.bin/tmux/server-client.c10
-rw-r--r--usr.bin/tmux/tmux.h84
-rw-r--r--usr.bin/tmux/window-choose.c12
73 files changed, 1074 insertions, 1044 deletions
diff --git a/usr.bin/tmux/cfg.c b/usr.bin/tmux/cfg.c
index 8aa71d7c539..b5ad5dbbd59 100644
--- a/usr.bin/tmux/cfg.c
+++ b/usr.bin/tmux/cfg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cfg.c,v 1.49 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: cfg.c,v 1.50 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -35,7 +35,7 @@ static u_int cfg_ncauses;
struct client *cfg_client;
static enum cmd_retval
-cfg_done(__unused struct cmd_q *cmdq, __unused void *data)
+cfg_done(__unused struct cmdq_item *item, __unused void *data)
{
if (cfg_finished)
return (CMD_RETURN_NORMAL);
@@ -79,15 +79,15 @@ start_cfg(void)
}
int
-load_cfg(const char *path, struct client *c, struct cmd_q *cmdq, int quiet)
+load_cfg(const char *path, struct client *c, struct cmdq_item *item, int quiet)
{
- FILE *f;
- char delim[3] = { '\\', '\\', '\0' };
- u_int found;
- size_t line = 0;
- char *buf, *cause1, *p;
- struct cmd_list *cmdlist;
- struct cmd_q *new_cmdq;
+ FILE *f;
+ char delim[3] = { '\\', '\\', '\0' };
+ u_int found;
+ size_t line = 0;
+ char *buf, *cause1, *p;
+ struct cmd_list *cmdlist;
+ struct cmdq_item *new_item;
log_debug("loading %s", path);
if ((f = fopen(path, "rb")) == NULL) {
@@ -123,11 +123,11 @@ load_cfg(const char *path, struct client *c, struct cmd_q *cmdq, int quiet)
if (cmdlist == NULL)
continue;
- new_cmdq = cmdq_get_command(cmdlist, NULL, NULL, 0);
- if (cmdq != NULL)
- cmdq_insert_after(cmdq, new_cmdq);
+ new_item = cmdq_get_command(cmdlist, NULL, NULL, 0);
+ if (item != NULL)
+ cmdq_insert_after(item, new_item);
else
- cmdq_append(c, new_cmdq);
+ cmdq_append(c, new_item);
cmd_list_free(cmdlist);
found++;
@@ -153,12 +153,12 @@ cfg_add_cause(const char *fmt, ...)
}
void
-cfg_print_causes(struct cmd_q *cmdq)
+cfg_print_causes(struct cmdq_item *item)
{
u_int i;
for (i = 0; i < cfg_ncauses; i++) {
- cmdq_print(cmdq, "%s", cfg_causes[i]);
+ cmdq_print(item, "%s", cfg_causes[i]);
free(cfg_causes[i]);
}
diff --git a/usr.bin/tmux/cmd-attach-session.c b/usr.bin/tmux/cmd-attach-session.c
index bdf52980312..bef242dc9ef 100644
--- a/usr.bin/tmux/cmd-attach-session.c
+++ b/usr.bin/tmux/cmd-attach-session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-attach-session.c,v 1.63 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: cmd-attach-session.c,v 1.64 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -30,7 +30,8 @@
* Attach existing session to the current terminal.
*/
-static enum cmd_retval cmd_attach_session_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_attach_session_exec(struct cmd *,
+ struct cmdq_item *);
const struct cmd_entry cmd_attach_session_entry = {
.name = "attach-session",
@@ -46,26 +47,26 @@ const struct cmd_entry cmd_attach_session_entry = {
};
enum cmd_retval
-cmd_attach_session(struct cmd_q *cmdq, int dflag, int rflag, const char *cflag,
- int Eflag)
+cmd_attach_session(struct cmdq_item *item, int dflag, int rflag,
+ const char *cflag, int Eflag)
{
- struct session *s = cmdq->state.tflag.s;
- struct client *c = cmdq->client, *c_loop;
- struct winlink *wl = cmdq->state.tflag.wl;
- struct window_pane *wp = cmdq->state.tflag.wp;
+ struct session *s = item->state.tflag.s;
+ struct client *c = item->client, *c_loop;
+ struct winlink *wl = item->state.tflag.wl;
+ struct window_pane *wp = item->state.tflag.wp;
const char *update;
char *cause, *cwd;
struct format_tree *ft;
if (RB_EMPTY(&sessions)) {
- cmdq_error(cmdq, "no sessions");
+ cmdq_error(item, "no sessions");
return (CMD_RETURN_ERROR);
}
if (c == NULL)
return (CMD_RETURN_NORMAL);
if (server_client_check_nested(c)) {
- cmdq_error(cmdq, "sessions should be nested with care, "
+ cmdq_error(item, "sessions should be nested with care, "
"unset $TMUX to force");
return (CMD_RETURN_ERROR);
}
@@ -77,7 +78,7 @@ cmd_attach_session(struct cmd_q *cmdq, int dflag, int rflag, const char *cflag,
}
if (cflag != NULL) {
- ft = format_create(cmdq, 0);
+ ft = format_create(item, 0);
format_defaults(ft, c, s, wl, wp);
cwd = format_expand(ft, cflag);
format_free(ft);
@@ -111,7 +112,7 @@ cmd_attach_session(struct cmd_q *cmdq, int dflag, int rflag, const char *cflag,
s->curw->flags &= ~WINLINK_ALERTFLAGS;
} else {
if (server_client_open(c, &cause) != 0) {
- cmdq_error(cmdq, "open terminal failed: %s", cause);
+ cmdq_error(item, "open terminal failed: %s", cause);
free(cause);
return (CMD_RETURN_ERROR);
}
@@ -155,10 +156,10 @@ cmd_attach_session(struct cmd_q *cmdq, int dflag, int rflag, const char *cflag,
}
static enum cmd_retval
-cmd_attach_session_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_attach_session_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- return (cmd_attach_session(cmdq, args_has(args, 'd'),
+ return (cmd_attach_session(item, args_has(args, 'd'),
args_has(args, 'r'), args_get(args, 'c'), args_has(args, 'E')));
}
diff --git a/usr.bin/tmux/cmd-bind-key.c b/usr.bin/tmux/cmd-bind-key.c
index 001b47b3811..31ba085b483 100644
--- a/usr.bin/tmux/cmd-bind-key.c
+++ b/usr.bin/tmux/cmd-bind-key.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-bind-key.c,v 1.30 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-bind-key.c,v 1.31 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -27,10 +27,10 @@
* Bind a key to a command, this recurses through cmd_*.
*/
-static enum cmd_retval cmd_bind_key_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_bind_key_exec(struct cmd *, struct cmdq_item *);
-static enum cmd_retval cmd_bind_key_mode_table(struct cmd *, struct cmd_q *,
- key_code);
+static enum cmd_retval cmd_bind_key_mode_table(struct cmd *,
+ struct cmdq_item *, key_code);
const struct cmd_entry cmd_bind_key_entry = {
.name = "bind-key",
@@ -45,7 +45,7 @@ const struct cmd_entry cmd_bind_key_entry = {
};
static enum cmd_retval
-cmd_bind_key_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_bind_key_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
char *cause;
@@ -55,24 +55,24 @@ cmd_bind_key_exec(struct cmd *self, struct cmd_q *cmdq)
if (args_has(args, 't')) {
if (args->argc != 2 && args->argc != 3) {
- cmdq_error(cmdq, "not enough arguments");
+ cmdq_error(item, "not enough arguments");
return (CMD_RETURN_ERROR);
}
} else {
if (args->argc < 2) {
- cmdq_error(cmdq, "not enough arguments");
+ cmdq_error(item, "not enough arguments");
return (CMD_RETURN_ERROR);
}
}
key = key_string_lookup_string(args->argv[0]);
if (key == KEYC_NONE || key == KEYC_UNKNOWN) {
- cmdq_error(cmdq, "unknown key: %s", args->argv[0]);
+ cmdq_error(item, "unknown key: %s", args->argv[0]);
return (CMD_RETURN_ERROR);
}
if (args_has(args, 't'))
- return (cmd_bind_key_mode_table(self, cmdq, key));
+ return (cmd_bind_key_mode_table(self, item, key));
if (args_has(args, 'T'))
tablename = args_get(args, 'T');
@@ -84,7 +84,7 @@ cmd_bind_key_exec(struct cmd *self, struct cmd_q *cmdq)
cmdlist = cmd_list_parse(args->argc - 1, args->argv + 1, NULL, 0,
&cause);
if (cmdlist == NULL) {
- cmdq_error(cmdq, "%s", cause);
+ cmdq_error(item, "%s", cause);
free(cause);
return (CMD_RETURN_ERROR);
}
@@ -94,7 +94,7 @@ cmd_bind_key_exec(struct cmd *self, struct cmd_q *cmdq)
}
static enum cmd_retval
-cmd_bind_key_mode_table(struct cmd *self, struct cmd_q *cmdq, key_code key)
+cmd_bind_key_mode_table(struct cmd *self, struct cmdq_item *item, key_code key)
{
struct args *args = self->args;
const char *tablename;
@@ -104,18 +104,18 @@ cmd_bind_key_mode_table(struct cmd *self, struct cmd_q *cmdq, key_code key)
tablename = args_get(args, 't');
if ((mtab = mode_key_findtable(tablename)) == NULL) {
- cmdq_error(cmdq, "unknown key table: %s", tablename);
+ cmdq_error(item, "unknown key table: %s", tablename);
return (CMD_RETURN_ERROR);
}
cmd = mode_key_fromstring(mtab->cmdstr, args->argv[1]);
if (cmd == MODEKEY_NONE) {
- cmdq_error(cmdq, "unknown command: %s", args->argv[1]);
+ cmdq_error(item, "unknown command: %s", args->argv[1]);
return (CMD_RETURN_ERROR);
}
if (args->argc != 2) {
- cmdq_error(cmdq, "no argument allowed");
+ cmdq_error(item, "no argument allowed");
return (CMD_RETURN_ERROR);
}
diff --git a/usr.bin/tmux/cmd-break-pane.c b/usr.bin/tmux/cmd-break-pane.c
index efcd4c93939..bc61c4852d6 100644
--- a/usr.bin/tmux/cmd-break-pane.c
+++ b/usr.bin/tmux/cmd-break-pane.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-break-pane.c,v 1.39 2016/10/15 09:27:52 nicm Exp $ */
+/* $OpenBSD: cmd-break-pane.c,v 1.40 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -28,7 +28,7 @@
#define BREAK_PANE_TEMPLATE "#{session_name}:#{window_index}.#{pane_index}"
-static enum cmd_retval cmd_break_pane_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_break_pane_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_break_pane_entry = {
.name = "break-pane",
@@ -45,28 +45,28 @@ const struct cmd_entry cmd_break_pane_entry = {
};
static enum cmd_retval
-cmd_break_pane_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_break_pane_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct winlink *wl = cmdq->state.sflag.wl;
- struct session *src_s = cmdq->state.sflag.s;
- struct session *dst_s = cmdq->state.tflag.s;
- struct window_pane *wp = cmdq->state.sflag.wp;
+ struct winlink *wl = item->state.sflag.wl;
+ struct session *src_s = item->state.sflag.s;
+ struct session *dst_s = item->state.tflag.s;
+ struct window_pane *wp = item->state.sflag.wp;
struct window *w = wl->window;
char *name;
char *cause;
- int idx = cmdq->state.tflag.idx;
+ int idx = item->state.tflag.idx;
struct format_tree *ft;
const char *template;
char *cp;
if (idx != -1 && winlink_find_by_index(&dst_s->windows, idx) != NULL) {
- cmdq_error(cmdq, "index %d already in use", idx);
+ cmdq_error(item, "index %d already in use", idx);
return (CMD_RETURN_ERROR);
}
if (window_count_panes(w) == 1) {
- cmdq_error(cmdq, "can't break with only one pane");
+ cmdq_error(item, "can't break with only one pane");
return (CMD_RETURN_ERROR);
}
server_unzoom_window(w);
@@ -101,11 +101,11 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_q *cmdq)
if ((template = args_get(args, 'F')) == NULL)
template = BREAK_PANE_TEMPLATE;
- ft = format_create(cmdq, 0);
- format_defaults(ft, cmdq->state.c, dst_s, wl, wp);
+ ft = format_create(item, 0);
+ format_defaults(ft, item->state.c, dst_s, wl, wp);
cp = format_expand(ft, template);
- cmdq_print(cmdq, "%s", cp);
+ cmdq_print(item, "%s", cp);
free(cp);
format_free(ft);
diff --git a/usr.bin/tmux/cmd-capture-pane.c b/usr.bin/tmux/cmd-capture-pane.c
index 3daa87d2b3b..0772b7512dc 100644
--- a/usr.bin/tmux/cmd-capture-pane.c
+++ b/usr.bin/tmux/cmd-capture-pane.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-capture-pane.c,v 1.40 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-capture-pane.c,v 1.41 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Jonathan Alvarado <radobobo@users.sourceforge.net>
@@ -27,14 +27,13 @@
* Write the entire contents of a pane to a buffer or stdout.
*/
-static enum cmd_retval cmd_capture_pane_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_capture_pane_exec(struct cmd *, struct cmdq_item *);
-static char *cmd_capture_pane_append(char *, size_t *, char *,
- size_t);
-static char *cmd_capture_pane_pending(struct args *,
- struct window_pane *, size_t *);
-static char *cmd_capture_pane_history(struct args *, struct cmd_q *,
- struct window_pane *, size_t *);
+static char *cmd_capture_pane_append(char *, size_t *, char *, size_t);
+static char *cmd_capture_pane_pending(struct args *, struct window_pane *,
+ size_t *);
+static char *cmd_capture_pane_history(struct args *, struct cmdq_item *,
+ struct window_pane *, size_t *);
const struct cmd_entry cmd_capture_pane_entry = {
.name = "capture-pane",
@@ -92,7 +91,8 @@ cmd_capture_pane_pending(struct args *args, struct window_pane *wp,
}
static char *
-cmd_capture_pane_history(struct args *args, struct cmd_q *cmdq,
+
+cmd_capture_pane_history(struct args *args, struct cmdq_item *item,
struct window_pane *wp, size_t *len)
{
struct grid *gd;
@@ -109,7 +109,7 @@ cmd_capture_pane_history(struct args *args, struct cmd_q *cmdq,
gd = wp->saved_grid;
if (gd == NULL) {
if (!args_has(args, 'q')) {
- cmdq_error(cmdq, "no alternate screen");
+ cmdq_error(item, "no alternate screen");
return (NULL);
}
return (xstrdup(""));
@@ -177,11 +177,11 @@ cmd_capture_pane_history(struct args *args, struct cmd_q *cmdq,
}
static enum cmd_retval
-cmd_capture_pane_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_capture_pane_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
struct client *c;
- struct window_pane *wp = cmdq->state.tflag.wp;
+ struct window_pane *wp = item->state.tflag.wp;
char *buf, *cause;
const char *bufname;
size_t len;
@@ -190,15 +190,15 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_q *cmdq)
if (args_has(args, 'P'))
buf = cmd_capture_pane_pending(args, wp, &len);
else
- buf = cmd_capture_pane_history(args, cmdq, wp, &len);
+ buf = cmd_capture_pane_history(args, item, wp, &len);
if (buf == NULL)
return (CMD_RETURN_ERROR);
if (args_has(args, 'p')) {
- c = cmdq->client;
+ c = item->client;
if (c == NULL ||
(c->session != NULL && !(c->flags & CLIENT_CONTROL))) {
- cmdq_error(cmdq, "can't write to stdout");
+ cmdq_error(item, "can't write to stdout");
free(buf);
return (CMD_RETURN_ERROR);
}
@@ -213,7 +213,7 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_q *cmdq)
bufname = args_get(args, 'b');
if (paste_set(buf, len, bufname, &cause) != 0) {
- cmdq_error(cmdq, "%s", cause);
+ cmdq_error(item, "%s", cause);
free(cause);
free(buf);
return (CMD_RETURN_ERROR);
diff --git a/usr.bin/tmux/cmd-choose-buffer.c b/usr.bin/tmux/cmd-choose-buffer.c
index 1c663099848..d8b20eadf98 100644
--- a/usr.bin/tmux/cmd-choose-buffer.c
+++ b/usr.bin/tmux/cmd-choose-buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-choose-buffer.c,v 1.30 2016/10/10 21:51:39 nicm Exp $ */
+/* $OpenBSD: cmd-choose-buffer.c,v 1.31 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2010 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -30,7 +30,8 @@
#define CHOOSE_BUFFER_TEMPLATE \
"#{buffer_name}: #{buffer_size} bytes: #{buffer_sample}"
-static enum cmd_retval cmd_choose_buffer_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_choose_buffer_exec(struct cmd *,
+ struct cmdq_item *);
const struct cmd_entry cmd_choose_buffer_entry = {
.name = "choose-buffer",
@@ -46,11 +47,11 @@ const struct cmd_entry cmd_choose_buffer_entry = {
};
static enum cmd_retval
-cmd_choose_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_choose_buffer_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct client *c = cmdq->state.c;
- struct winlink *wl = cmdq->state.tflag.wl;
+ struct client *c = item->state.c;
+ struct winlink *wl = item->state.tflag.wl;
struct window_choose_data *cdata;
struct paste_buffer *pb;
char *action, *action_data;
@@ -58,7 +59,7 @@ cmd_choose_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
u_int idx;
if (c == NULL) {
- cmdq_error(cmdq, "no client available");
+ cmdq_error(item, "no client available");
return (CMD_RETURN_ERROR);
}
diff --git a/usr.bin/tmux/cmd-choose-client.c b/usr.bin/tmux/cmd-choose-client.c
index dc58e0cfb4b..9d045818160 100644
--- a/usr.bin/tmux/cmd-choose-client.c
+++ b/usr.bin/tmux/cmd-choose-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-choose-client.c,v 1.30 2016/10/10 21:51:39 nicm Exp $ */
+/* $OpenBSD: cmd-choose-client.c,v 1.31 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -33,7 +33,8 @@
"#{?client_utf8, (utf8),}#{?client_readonly, (ro),} " \
"(last used #{t:client_activity})"
-static enum cmd_retval cmd_choose_client_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_choose_client_exec(struct cmd *,
+ struct cmdq_item *);
static void cmd_choose_client_callback(struct window_choose_data *);
@@ -55,19 +56,19 @@ struct cmd_choose_client_data {
};
static enum cmd_retval
-cmd_choose_client_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_choose_client_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct client *c = cmdq->state.c;
+ struct client *c = item->state.c;
struct client *c1;
struct window_choose_data *cdata;
- struct winlink *wl = cmdq->state.tflag.wl;
+ struct winlink *wl = item->state.tflag.wl;
const char *template;
char *action;
u_int idx, cur;
if (c == NULL) {
- cmdq_error(cmdq, "no client available");
+ cmdq_error(item, "no client available");
return (CMD_RETURN_ERROR);
}
@@ -86,7 +87,7 @@ cmd_choose_client_exec(struct cmd *self, struct cmd_q *cmdq)
TAILQ_FOREACH(c1, &clients, entry) {
if (c1->session == NULL || c1->tty.path == NULL)
continue;
- if (c1 == cmdq->client)
+ if (c1 == item->client)
cur = idx;
cdata = window_choose_data_create(TREE_OTHER, c, c->session);
diff --git a/usr.bin/tmux/cmd-choose-tree.c b/usr.bin/tmux/cmd-choose-tree.c
index 7b9bd81841c..28c1bc6f058 100644
--- a/usr.bin/tmux/cmd-choose-tree.c
+++ b/usr.bin/tmux/cmd-choose-tree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-choose-tree.c,v 1.32 2016/10/10 21:51:39 nicm Exp $ */
+/* $OpenBSD: cmd-choose-tree.c,v 1.33 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2012 Thomas Adam <thomas@xteddy.org>
@@ -41,7 +41,7 @@
"#{window_index}: #{window_name}#{window_flags} " \
"\"#{pane_title}\""
-static enum cmd_retval cmd_choose_tree_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_choose_tree_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_choose_tree_entry = {
.name = "choose-tree",
@@ -84,12 +84,12 @@ const struct cmd_entry cmd_choose_window_entry = {
};
static enum cmd_retval
-cmd_choose_tree_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_choose_tree_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct client *c = cmdq->state.c;
- struct winlink *wl = cmdq->state.tflag.wl, *wm;
- struct session *s = cmdq->state.tflag.s, *s2;
+ struct client *c = item->state.c;
+ struct winlink *wl = item->state.tflag.wl, *wm;
+ struct session *s = item->state.tflag.s, *s2;
struct window_choose_data *wcd = NULL;
const char *ses_template, *win_template;
char *final_win_action, *cur_win_template;
@@ -103,7 +103,7 @@ cmd_choose_tree_exec(struct cmd *self, struct cmd_q *cmdq)
ses_action = win_action = NULL;
if (c == NULL) {
- cmdq_error(cmdq, "no client available");
+ cmdq_error(item, "no client available");
return (CMD_RETURN_ERROR);
}
diff --git a/usr.bin/tmux/cmd-clear-history.c b/usr.bin/tmux/cmd-clear-history.c
index 9c51b4ec5a9..23b0a9cf2f1 100644
--- a/usr.bin/tmux/cmd-clear-history.c
+++ b/usr.bin/tmux/cmd-clear-history.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-clear-history.c,v 1.20 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-clear-history.c,v 1.21 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -24,7 +24,8 @@
* Clear pane history.
*/
-static enum cmd_retval cmd_clear_history_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_clear_history_exec(struct cmd *,
+ struct cmdq_item *);
const struct cmd_entry cmd_clear_history_entry = {
.name = "clear-history",
@@ -40,12 +41,12 @@ const struct cmd_entry cmd_clear_history_entry = {
};
static enum cmd_retval
-cmd_clear_history_exec(__unused struct cmd *self, struct cmd_q *cmdq)
+cmd_clear_history_exec(__unused struct cmd *self, struct cmdq_item *item)
{
- struct window_pane *wp = cmdq->state.tflag.wp;
+ struct window_pane *wp = item->state.tflag.wp;
struct grid *gd;
- gd = cmdq->state.tflag.wp->base.grid;
+ gd = item->state.tflag.wp->base.grid;
if (wp->mode == &window_copy_mode)
window_pane_reset_mode(wp);
diff --git a/usr.bin/tmux/cmd-command-prompt.c b/usr.bin/tmux/cmd-command-prompt.c
index c0e66782bea..2de0e110fa8 100644
--- a/usr.bin/tmux/cmd-command-prompt.c
+++ b/usr.bin/tmux/cmd-command-prompt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-command-prompt.c,v 1.37 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: cmd-command-prompt.c,v 1.38 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -29,7 +29,8 @@
* Prompt for command in client.
*/
-static enum cmd_retval cmd_command_prompt_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_command_prompt_exec(struct cmd *,
+ struct cmdq_item *);
static int cmd_command_prompt_callback(void *, const char *);
static void cmd_command_prompt_free(void *);
@@ -59,12 +60,12 @@ struct cmd_command_prompt_cdata {
};
static enum cmd_retval
-cmd_command_prompt_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_command_prompt_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
const char *inputs, *prompts;
struct cmd_command_prompt_cdata *cdata;
- struct client *c = cmdq->state.c;
+ struct client *c = item->state.c;
char *prompt, *ptr, *input = NULL;
size_t n;
int flags;
@@ -122,11 +123,11 @@ cmd_command_prompt_exec(struct cmd *self, struct cmd_q *cmdq)
}
static enum cmd_retval
-cmd_command_prompt_error(struct cmd_q *cmdq, void *data)
+cmd_command_prompt_error(struct cmdq_item *item, void *data)
{
char *error = data;
- cmdq_error(cmdq, "%s", error);
+ cmdq_error(item, "%s", error);
free(error);
return (CMD_RETURN_NORMAL);
@@ -138,7 +139,7 @@ cmd_command_prompt_callback(void *data, const char *s)
struct cmd_command_prompt_cdata *cdata = data;
struct client *c = cdata->c;
struct cmd_list *cmdlist;
- struct cmd_q *new_cmdq;
+ struct cmdq_item *new_item;
char *cause, *new_template, *prompt, *ptr;
char *input = NULL;
@@ -165,17 +166,17 @@ cmd_command_prompt_callback(void *data, const char *s)
if (cmd_string_parse(new_template, &cmdlist, NULL, 0, &cause) != 0) {
if (cause != NULL) {
- new_cmdq = cmdq_get_callback(cmd_command_prompt_error,
+ new_item = cmdq_get_callback(cmd_command_prompt_error,
cause);
} else
- new_cmdq = NULL;
+ new_item = NULL;
} else {
- new_cmdq = cmdq_get_command(cmdlist, NULL, NULL, 0);
+ new_item = cmdq_get_command(cmdlist, NULL, NULL, 0);
cmd_list_free(cmdlist);
}
- if (new_cmdq != NULL)
- cmdq_append(c, new_cmdq);
+ if (new_item != NULL)
+ cmdq_append(c, new_item);
if (c->prompt_callbackfn != (void *)&cmd_command_prompt_callback)
return (1);
diff --git a/usr.bin/tmux/cmd-confirm-before.c b/usr.bin/tmux/cmd-confirm-before.c
index 5810a89a21f..e84a654cba4 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.30 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: cmd-confirm-before.c,v 1.31 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -28,10 +28,11 @@
* Asks for confirmation before executing a command.
*/
-static enum cmd_retval cmd_confirm_before_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_confirm_before_exec(struct cmd *,
+ struct cmdq_item *);
-static int cmd_confirm_before_callback(void *, const char *);
-static void cmd_confirm_before_free(void *);
+static int cmd_confirm_before_callback(void *, const char *);
+static void cmd_confirm_before_free(void *);
const struct cmd_entry cmd_confirm_before_entry = {
.name = "confirm-before",
@@ -52,11 +53,11 @@ struct cmd_confirm_before_data {
};
static enum cmd_retval
-cmd_confirm_before_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_confirm_before_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
struct cmd_confirm_before_data *cdata;
- struct client *c = cmdq->state.c;
+ struct client *c = item->state.c;
char *cmd, *copy, *new_prompt, *ptr;
const char *prompt;
@@ -84,11 +85,11 @@ cmd_confirm_before_exec(struct cmd *self, struct cmd_q *cmdq)
}
static enum cmd_retval
-cmd_confirm_before_error(struct cmd_q *cmdq, void *data)
+cmd_confirm_before_error(struct cmdq_item *item, void *data)
{
char *error = data;
- cmdq_error(cmdq, "%s", error);
+ cmdq_error(item, "%s", error);
free(error);
return (CMD_RETURN_NORMAL);
@@ -100,7 +101,7 @@ cmd_confirm_before_callback(void *data, const char *s)
struct cmd_confirm_before_data *cdata = data;
struct client *c = cdata->client;
struct cmd_list *cmdlist;
- struct cmd_q *new_cmdq;
+ struct cmdq_item *new_item;
char *cause;
if (c->flags & CLIENT_DEAD)
@@ -113,17 +114,17 @@ cmd_confirm_before_callback(void *data, const char *s)
if (cmd_string_parse(cdata->cmd, &cmdlist, NULL, 0, &cause) != 0) {
if (cause != NULL) {
- new_cmdq = cmdq_get_callback(cmd_confirm_before_error,
+ new_item = cmdq_get_callback(cmd_confirm_before_error,
cause);
} else
- new_cmdq = NULL;
+ new_item = NULL;
} else {
- new_cmdq = cmdq_get_command(cmdlist, NULL, NULL, 0);
+ new_item = cmdq_get_command(cmdlist, NULL, NULL, 0);
cmd_list_free(cmdlist);
}
- if (new_cmdq != NULL)
- cmdq_append(c, new_cmdq);
+ if (new_item != NULL)
+ cmdq_append(c, new_item);
return (0);
}
diff --git a/usr.bin/tmux/cmd-copy-mode.c b/usr.bin/tmux/cmd-copy-mode.c
index 6eb470f286d..5a85d7bb293 100644
--- a/usr.bin/tmux/cmd-copy-mode.c
+++ b/usr.bin/tmux/cmd-copy-mode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-copy-mode.c,v 1.30 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: cmd-copy-mode.c,v 1.31 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -24,7 +24,7 @@
* Enter copy or clock mode.
*/
-static enum cmd_retval cmd_copy_mode_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_copy_mode_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_copy_mode_entry = {
.name = "copy-mode",
@@ -53,15 +53,15 @@ const struct cmd_entry cmd_clock_mode_entry = {
};
static enum cmd_retval
-cmd_copy_mode_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_copy_mode_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct client *c = cmdq->client;
+ struct client *c = item->client;
struct session *s;
- struct window_pane *wp = cmdq->state.tflag.wp;
+ struct window_pane *wp = item->state.tflag.wp;
if (args_has(args, 'M')) {
- if ((wp = cmd_mouse_pane(&cmdq->mouse, &s, NULL)) == NULL)
+ if ((wp = cmd_mouse_pane(&item->mouse, &s, NULL)) == NULL)
return (CMD_RETURN_NORMAL);
if (c == NULL || c->session != s)
return (CMD_RETURN_NORMAL);
@@ -80,7 +80,7 @@ cmd_copy_mode_exec(struct cmd *self, struct cmd_q *cmdq)
if (args_has(args, 'M')) {
if (wp->mode != NULL && wp->mode != &window_copy_mode)
return (CMD_RETURN_NORMAL);
- window_copy_start_drag(c, &cmdq->mouse);
+ window_copy_start_drag(c, &item->mouse);
}
if (wp->mode == &window_copy_mode && args_has(self->args, 'u'))
window_copy_pageup(wp, 0);
diff --git a/usr.bin/tmux/cmd-detach-client.c b/usr.bin/tmux/cmd-detach-client.c
index bbbc8cb7023..b67dd3a7a8f 100644
--- a/usr.bin/tmux/cmd-detach-client.c
+++ b/usr.bin/tmux/cmd-detach-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-detach-client.c,v 1.28 2016/10/10 21:51:39 nicm Exp $ */
+/* $OpenBSD: cmd-detach-client.c,v 1.29 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -26,7 +26,8 @@
* Detach a client.
*/
-static enum cmd_retval cmd_detach_client_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_detach_client_exec(struct cmd *,
+ struct cmdq_item *);
const struct cmd_entry cmd_detach_client_entry = {
.name = "detach-client",
@@ -56,10 +57,10 @@ const struct cmd_entry cmd_suspend_client_entry = {
};
static enum cmd_retval
-cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_detach_client_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct client *c = cmdq->state.c, *cloop;
+ struct client *c = item->state.c, *cloop;
struct session *s;
enum msgtype msgtype;
@@ -76,7 +77,7 @@ cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq)
msgtype = MSG_DETACH;
if (args_has(args, 's')) {
- s = cmdq->state.sflag.s;
+ s = item->state.sflag.s;
TAILQ_FOREACH(cloop, &clients, entry) {
if (cloop->session == s)
server_client_detach(cloop, msgtype);
diff --git a/usr.bin/tmux/cmd-display-message.c b/usr.bin/tmux/cmd-display-message.c
index 9704f251130..c8b06de7c56 100644
--- a/usr.bin/tmux/cmd-display-message.c
+++ b/usr.bin/tmux/cmd-display-message.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-display-message.c,v 1.38 2016/10/13 22:48:51 nicm Exp $ */
+/* $OpenBSD: cmd-display-message.c,v 1.39 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -32,7 +32,8 @@
"#{window_name}, current pane #{pane_index} " \
"- (%H:%M %d-%b-%y)"
-static enum cmd_retval cmd_display_message_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_display_message_exec(struct cmd *,
+ struct cmdq_item *);
const struct cmd_entry cmd_display_message_entry = {
.name = "display-message",
@@ -50,19 +51,19 @@ const struct cmd_entry cmd_display_message_entry = {
};
static enum cmd_retval
-cmd_display_message_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_display_message_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct client *c = cmdq->state.c;
- struct session *s = cmdq->state.tflag.s;
- struct winlink *wl = cmdq->state.tflag.wl;
- struct window_pane *wp = cmdq->state.tflag.wp;
+ struct client *c = item->state.c;
+ struct session *s = item->state.tflag.s;
+ struct winlink *wl = item->state.tflag.wl;
+ struct window_pane *wp = item->state.tflag.wp;
const char *template;
char *msg;
struct format_tree *ft;
if (args_has(args, 'F') && args->argc != 0) {
- cmdq_error(cmdq, "only one of -F or argument must be given");
+ cmdq_error(item, "only one of -F or argument must be given");
return (CMD_RETURN_ERROR);
}
@@ -72,12 +73,12 @@ cmd_display_message_exec(struct cmd *self, struct cmd_q *cmdq)
if (template == NULL)
template = DISPLAY_MESSAGE_TEMPLATE;
- ft = format_create(cmdq, 0);
+ ft = format_create(item, 0);
format_defaults(ft, c, s, wl, wp);
msg = format_expand_time(ft, template, time(NULL));
if (args_has(self->args, 'p'))
- cmdq_print(cmdq, "%s", msg);
+ cmdq_print(item, "%s", msg);
else if (c != NULL)
status_message_set(c, "%s", msg);
free(msg);
diff --git a/usr.bin/tmux/cmd-display-panes.c b/usr.bin/tmux/cmd-display-panes.c
index 385222161ce..6ef3c8ff8d3 100644
--- a/usr.bin/tmux/cmd-display-panes.c
+++ b/usr.bin/tmux/cmd-display-panes.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-display-panes.c,v 1.15 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: cmd-display-panes.c,v 1.16 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -27,10 +27,11 @@
* Display panes on a client.
*/
-static enum cmd_retval cmd_display_panes_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_display_panes_exec(struct cmd *,
+ struct cmdq_item *);
-static void cmd_display_panes_callback(struct client *,
- struct window_pane *);
+static void cmd_display_panes_callback(struct client *,
+ struct window_pane *);
const struct cmd_entry cmd_display_panes_entry = {
.name = "display-panes",
@@ -46,10 +47,10 @@ const struct cmd_entry cmd_display_panes_entry = {
};
static enum cmd_retval
-cmd_display_panes_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_display_panes_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct client *c = cmdq->state.c;
+ struct client *c = item->state.c;
if (c->identify_callback != NULL)
return (CMD_RETURN_NORMAL);
@@ -66,11 +67,11 @@ cmd_display_panes_exec(struct cmd *self, struct cmd_q *cmdq)
}
static enum cmd_retval
-cmd_display_panes_error(struct cmd_q *cmdq, void *data)
+cmd_display_panes_error(struct cmdq_item *item, void *data)
{
char *error = data;
- cmdq_error(cmdq, "%s", error);
+ cmdq_error(item, "%s", error);
free(error);
return (CMD_RETURN_NORMAL);
@@ -79,9 +80,9 @@ cmd_display_panes_error(struct cmd_q *cmdq, void *data)
static void
cmd_display_panes_callback(struct client *c, struct window_pane *wp)
{
- struct cmd_list *cmdlist;
- struct cmd_q *new_cmdq;
- char *template, *cmd, *expanded, *cause;
+ struct cmd_list *cmdlist;
+ struct cmdq_item *new_item;
+ char *template, *cmd, *expanded, *cause;
template = c->identify_callback_data;
if (wp == NULL)
@@ -91,17 +92,17 @@ cmd_display_panes_callback(struct client *c, struct window_pane *wp)
if (cmd_string_parse(cmd, &cmdlist, NULL, 0, &cause) != 0) {
if (cause != NULL) {
- new_cmdq = cmdq_get_callback(cmd_display_panes_error,
+ new_item = cmdq_get_callback(cmd_display_panes_error,
cause);
} else
- new_cmdq = NULL;
+ new_item = NULL;
} else {
- new_cmdq = cmdq_get_command(cmdlist, NULL, NULL, 0);
+ new_item = cmdq_get_command(cmdlist, NULL, NULL, 0);
cmd_list_free(cmdlist);
}
- if (new_cmdq != NULL)
- cmdq_append(c, new_cmdq);
+ if (new_item != NULL)
+ cmdq_append(c, new_item);
free(cmd);
free(expanded);
diff --git a/usr.bin/tmux/cmd-find-window.c b/usr.bin/tmux/cmd-find-window.c
index 05cc3015d95..8be8d6a43df 100644
--- a/usr.bin/tmux/cmd-find-window.c
+++ b/usr.bin/tmux/cmd-find-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-find-window.c,v 1.38 2016/10/10 21:51:39 nicm Exp $ */
+/* $OpenBSD: cmd-find-window.c,v 1.39 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -33,9 +33,9 @@
"[#{window_width}x#{window_height}] " \
"(#{window_panes} panes) #{window_find_matches}"
-static enum cmd_retval cmd_find_window_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_find_window_exec(struct cmd *, struct cmdq_item *);
-static void cmd_find_window_callback(struct window_choose_data *);
+static void cmd_find_window_callback(struct window_choose_data *);
/* Flags for determining matching behavior. */
#define CMD_FIND_WINDOW_BY_TITLE 0x1
@@ -139,13 +139,13 @@ cmd_find_window_match(struct cmd_find_window_list *find_list,
}
static enum cmd_retval
-cmd_find_window_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_find_window_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct client *c = cmdq->state.c;
+ struct client *c = item->state.c;
struct window_choose_data *cdata;
- struct session *s = cmdq->state.tflag.s;
- struct winlink *wl = cmdq->state.tflag.wl, *wm;
+ struct session *s = item->state.tflag.s;
+ struct winlink *wl = item->state.tflag.wl, *wm;
struct cmd_find_window_list find_list;
struct cmd_find_window_data *find_data;
struct cmd_find_window_data *find_data1;
@@ -154,7 +154,7 @@ cmd_find_window_exec(struct cmd *self, struct cmd_q *cmdq)
u_int i, match_flags;
if (c == NULL) {
- cmdq_error(cmdq, "no client available");
+ cmdq_error(item, "no client available");
return (CMD_RETURN_ERROR);
}
@@ -172,7 +172,7 @@ cmd_find_window_exec(struct cmd *self, struct cmd_q *cmdq)
free(searchstr);
if (TAILQ_EMPTY(&find_list)) {
- cmdq_error(cmdq, "no windows matching: %s", str);
+ cmdq_error(item, "no windows matching: %s", str);
return (CMD_RETURN_ERROR);
}
diff --git a/usr.bin/tmux/cmd-find.c b/usr.bin/tmux/cmd-find.c
index a31193f9529..89dc15d3496 100644
--- a/usr.bin/tmux/cmd-find.c
+++ b/usr.bin/tmux/cmd-find.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-find.c,v 1.36 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: cmd-find.c,v 1.37 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -38,7 +38,7 @@ static int cmd_find_best_winlink_with_window(struct cmd_find_state *);
static int cmd_find_current_session_with_client(struct cmd_find_state *);
static int cmd_find_current_session(struct cmd_find_state *);
-static struct client *cmd_find_current_client(struct cmd_q *);
+static struct client *cmd_find_current_client(struct cmdq_item *);
static const char *cmd_find_map_table(const char *[][2], const char *);
@@ -192,8 +192,8 @@ cmd_find_best_session_with_window(struct cmd_find_state *fs)
u_int ssize;
struct session *s;
- if (fs->cmdq != NULL && fs->cmdq->client != NULL) {
- fs->s = cmd_find_try_TMUX(fs->cmdq->client, fs->w);
+ if (fs->item != NULL && fs->item->client != NULL) {
+ fs->s = cmd_find_try_TMUX(fs->item->client, fs->w);
if (fs->s != NULL)
return (cmd_find_best_winlink_with_window(fs));
}
@@ -256,9 +256,9 @@ cmd_find_current_session_with_client(struct cmd_find_state *fs)
* sessions to those containing that pane (we still use the current
* window in the best session).
*/
- if (fs->cmdq != NULL && fs->cmdq->client->tty.path != NULL) {
+ if (fs->item != NULL && fs->item->client->tty.path != NULL) {
RB_FOREACH(wp, window_pane_tree, &all_window_panes) {
- if (strcmp(wp->tty, fs->cmdq->client->tty.path) == 0)
+ if (strcmp(wp->tty, fs->item->client->tty.path) == 0)
break;
}
} else
@@ -292,8 +292,8 @@ cmd_find_current_session_with_client(struct cmd_find_state *fs)
unknown_pane:
fs->s = NULL;
- if (fs->cmdq != NULL)
- fs->s = cmd_find_try_TMUX(fs->cmdq->client, NULL);
+ if (fs->item != NULL)
+ fs->s = cmd_find_try_TMUX(fs->item->client, NULL);
if (fs->s == NULL)
fs->s = cmd_find_best_session(NULL, 0, fs->flags);
if (fs->s == NULL)
@@ -314,12 +314,12 @@ static int
cmd_find_current_session(struct cmd_find_state *fs)
{
/* If we know the current client, use it. */
- if (fs->cmdq != NULL && fs->cmdq->client != NULL) {
- log_debug("%s: have client %p%s", __func__, fs->cmdq->client,
- fs->cmdq->client->session == NULL ? "" : " (with session)");
- if (fs->cmdq->client->session == NULL)
+ if (fs->item != NULL && fs->item->client != NULL) {
+ log_debug("%s: have client %p%s", __func__, fs->item->client,
+ fs->item->client->session == NULL ? "" : " (with session)");
+ if (fs->item->client->session == NULL)
return (cmd_find_current_session_with_client(fs));
- fs->s = fs->cmdq->client->session;
+ fs->s = fs->item->client->session;
fs->wl = fs->s->curw;
fs->idx = fs->wl->idx;
fs->w = fs->wl->window;
@@ -341,7 +341,7 @@ cmd_find_current_session(struct cmd_find_state *fs)
/* Work out the best current client. */
static struct client *
-cmd_find_current_client(struct cmd_q *cmdq)
+cmd_find_current_client(struct cmdq_item *item)
{
struct cmd_find_state current;
struct session *s;
@@ -349,14 +349,14 @@ cmd_find_current_client(struct cmd_q *cmdq)
u_int csize;
/* If the queue client has a session, use it. */
- if (cmdq->client != NULL && cmdq->client->session != NULL) {
- log_debug("%s: using cmdq %p client %p", __func__, cmdq,
- cmdq->client);
- return (cmdq->client);
+ if (item->client != NULL && item->client->session != NULL) {
+ log_debug("%s: using item %p client %p", __func__, item,
+ item->client);
+ return (item->client);
}
/* Otherwise find the current session. */
- cmd_find_clear_state(&current, cmdq, 0);
+ cmd_find_clear_state(&current, item, 0);
if (cmd_find_current_session(&current) != 0)
return (NULL);
@@ -793,11 +793,12 @@ cmd_find_get_pane_with_window(struct cmd_find_state *fs, const char *pane)
/* Clear state. */
void
-cmd_find_clear_state(struct cmd_find_state *fs, struct cmd_q *cmdq, int flags)
+cmd_find_clear_state(struct cmd_find_state *fs, struct cmdq_item *item,
+ int flags)
{
memset(fs, 0, sizeof *fs);
- fs->cmdq = cmdq;
+ fs->item = item;
fs->flags = flags;
fs->idx = -1;
@@ -952,12 +953,12 @@ cmd_find_from_pane(struct cmd_find_state *fs, struct window_pane *wp)
/* Find current state. */
int
-cmd_find_current(struct cmd_find_state *fs, struct cmd_q *cmdq, int flags)
+cmd_find_current(struct cmd_find_state *fs, struct cmdq_item *item, int flags)
{
- cmd_find_clear_state(fs, cmdq, flags);
+ cmd_find_clear_state(fs, item, flags);
if (cmd_find_current_session(fs) != 0) {
if (~flags & CMD_FIND_QUIET)
- cmdq_error(cmdq, "no current session");
+ cmdq_error(item, "no current session");
return (-1);
}
return (0);
@@ -969,7 +970,8 @@ cmd_find_current(struct cmd_find_state *fs, struct cmd_q *cmdq, int flags)
*/
int
cmd_find_target(struct cmd_find_state *fs, struct cmd_find_state *current,
- struct cmd_q *cmdq, const char *target, enum cmd_find_type type, int flags)
+ struct cmdq_item *item, const char *target, enum cmd_find_type type,
+ int flags)
{
struct mouse_event *m;
char *colon, *period, *copy = NULL;
@@ -980,17 +982,17 @@ cmd_find_target(struct cmd_find_state *fs, struct cmd_find_state *current,
log_debug("%s: target none, type %d", __func__, type);
else
log_debug("%s: target %s, type %d", __func__, target, type);
- log_debug("%s: cmdq %p, flags %#x", __func__, cmdq, flags);
+ log_debug("%s: item %p, flags %#x", __func__, item, flags);
/* Clear new state. */
- cmd_find_clear_state(fs, cmdq, flags);
+ cmd_find_clear_state(fs, item, flags);
/* Find current state. */
if (server_check_marked() && (flags & CMD_FIND_DEFAULT_MARKED)) {
fs->current = &marked_pane;
log_debug(" current is marked pane");
- } else if (cmd_find_valid_state(&cmdq->current)) {
- fs->current = &cmdq->current;
+ } else if (cmd_find_valid_state(&item->current)) {
+ fs->current = &item->current;
log_debug(" current is from queue");
} else {
fs->current = current;
@@ -1006,7 +1008,7 @@ cmd_find_target(struct cmd_find_state *fs, struct cmd_find_state *current,
/* Mouse target is a plain = or {mouse}. */
if (strcmp(target, "=") == 0 || strcmp(target, "{mouse}") == 0) {
- m = &cmdq->mouse;
+ m = &item->mouse;
switch (type) {
case CMD_FIND_PANE:
fs->wp = cmd_mouse_pane(m, &fs->s, &fs->wl);
@@ -1024,7 +1026,7 @@ cmd_find_target(struct cmd_find_state *fs, struct cmd_find_state *current,
}
if (fs->wp == NULL) {
if (~flags & CMD_FIND_QUIET)
- cmdq_error(cmdq, "no mouse target");
+ cmdq_error(item, "no mouse target");
goto error;
}
goto found;
@@ -1034,7 +1036,7 @@ cmd_find_target(struct cmd_find_state *fs, struct cmd_find_state *current,
if (strcmp(target, "~") == 0 || strcmp(target, "{marked}") == 0) {
if (!server_check_marked()) {
if (~flags & CMD_FIND_QUIET)
- cmdq_error(cmdq, "no marked target");
+ cmdq_error(item, "no marked target");
goto error;
}
cmd_find_copy_state(fs, &marked_pane);
@@ -1120,7 +1122,7 @@ cmd_find_target(struct cmd_find_state *fs, struct cmd_find_state *current,
/* No pane is allowed if want an index. */
if (pane != NULL && (flags & CMD_FIND_WINDOW_INDEX)) {
if (~flags & CMD_FIND_QUIET)
- cmdq_error(cmdq, "can't specify pane here");
+ cmdq_error(item, "can't specify pane here");
goto error;
}
@@ -1219,23 +1221,23 @@ found:
no_session:
if (~flags & CMD_FIND_QUIET)
- cmdq_error(cmdq, "can't find session %s", session);
+ cmdq_error(item, "can't find session %s", session);
goto error;
no_window:
if (~flags & CMD_FIND_QUIET)
- cmdq_error(cmdq, "can't find window %s", window);
+ cmdq_error(item, "can't find window %s", window);
goto error;
no_pane:
if (~flags & CMD_FIND_QUIET)
- cmdq_error(cmdq, "can't find pane %s", pane);
+ cmdq_error(item, "can't find pane %s", pane);
goto error;
}
/* Find the target client or report an error and return NULL. */
struct client *
-cmd_find_client(struct cmd_q *cmdq, const char *target, int quiet)
+cmd_find_client(struct cmdq_item *item, const char *target, int quiet)
{
struct client *c;
char *copy;
@@ -1243,10 +1245,10 @@ cmd_find_client(struct cmd_q *cmdq, const char *target, int quiet)
const char *path;
/* A NULL argument means the current client. */
- if (cmdq != NULL && target == NULL) {
- c = cmd_find_current_client(cmdq);
+ if (item != NULL && target == NULL) {
+ c = cmd_find_current_client(item);
if (c == NULL && !quiet)
- cmdq_error(cmdq, "no current client");
+ cmdq_error(item, "no current client");
log_debug("%s: no target, return %p", __func__, c);
return (c);
}
@@ -1276,7 +1278,7 @@ cmd_find_client(struct cmd_q *cmdq, const char *target, int quiet)
/* If no client found, report an error. */
if (c == NULL && !quiet)
- cmdq_error(cmdq, "can't find client %s", copy);
+ cmdq_error(item, "can't find client %s", copy);
free(copy);
log_debug("%s: target %s, return %p", __func__, target, c);
diff --git a/usr.bin/tmux/cmd-if-shell.c b/usr.bin/tmux/cmd-if-shell.c
index 1a148f5c504..755de93d036 100644
--- a/usr.bin/tmux/cmd-if-shell.c
+++ b/usr.bin/tmux/cmd-if-shell.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-if-shell.c,v 1.47 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: cmd-if-shell.c,v 1.48 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -29,11 +29,11 @@
* Executes a tmux command if a shell command returns true or false.
*/
-static enum cmd_retval cmd_if_shell_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_if_shell_exec(struct cmd *, struct cmdq_item *);
-static enum cmd_retval cmd_if_shell_error(struct cmd_q *, void *);
-static void cmd_if_shell_callback(struct job *);
-static void cmd_if_shell_free(void *);
+static enum cmd_retval cmd_if_shell_error(struct cmdq_item *, void *);
+static void cmd_if_shell_callback(struct job *);
+static void cmd_if_shell_free(void *);
const struct cmd_entry cmd_if_shell_entry = {
.name = "if-shell",
@@ -57,33 +57,33 @@ struct cmd_if_shell_data {
char *cmd_else;
struct client *client;
- struct cmd_q *cmdq;
+ struct cmdq_item *item;
struct mouse_event mouse;
};
static enum cmd_retval
-cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
struct cmd_if_shell_data *cdata;
char *shellcmd, *cmd, *cause;
struct cmd_list *cmdlist;
- struct cmd_q *new_cmdq;
- struct session *s = cmdq->state.tflag.s;
- struct winlink *wl = cmdq->state.tflag.wl;
- struct window_pane *wp = cmdq->state.tflag.wp;
+ struct cmdq_item *new_item;
+ struct session *s = item->state.tflag.s;
+ struct winlink *wl = item->state.tflag.wl;
+ struct window_pane *wp = item->state.tflag.wp;
struct format_tree *ft;
const char *cwd;
- if (cmdq->client != NULL && cmdq->client->session == NULL)
- cwd = cmdq->client->cwd;
+ if (item->client != NULL && item->client->session == NULL)
+ cwd = item->client->cwd;
else if (s != NULL)
cwd = s->cwd;
else
cwd = NULL;
- ft = format_create(cmdq, 0);
- format_defaults(ft, cmdq->state.c, s, wl, wp);
+ ft = format_create(item, 0);
+ format_defaults(ft, item->state.c, s, wl, wp);
shellcmd = format_expand(ft, args->argv[0]);
format_free(ft);
@@ -98,13 +98,13 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq)
return (CMD_RETURN_NORMAL);
if (cmd_string_parse(cmd, &cmdlist, NULL, 0, &cause) != 0) {
if (cause != NULL) {
- cmdq_error(cmdq, "%s", cause);
+ cmdq_error(item, "%s", cause);
free(cause);
}
return (CMD_RETURN_ERROR);
}
- new_cmdq = cmdq_get_command(cmdlist, NULL, &cmdq->mouse, 0);
- cmdq_insert_after(cmdq, new_cmdq);
+ new_item = cmdq_get_command(cmdlist, NULL, &item->mouse, 0);
+ cmdq_insert_after(item, new_item);
cmd_list_free(cmdlist);
return (CMD_RETURN_NORMAL);
}
@@ -121,14 +121,14 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq)
else
cdata->cmd_else = NULL;
- cdata->client = cmdq->client;
+ cdata->client = item->client;
cdata->client->references++;
if (!args_has(args, 'b'))
- cdata->cmdq = cmdq;
+ cdata->item = item;
else
- cdata->cmdq = NULL;
- memcpy(&cdata->mouse, &cmdq->mouse, sizeof cdata->mouse);
+ cdata->item = NULL;
+ memcpy(&cdata->mouse, &item->mouse, sizeof cdata->mouse);
job_run(shellcmd, s, cwd, cmd_if_shell_callback, cmd_if_shell_free,
cdata);
@@ -140,11 +140,11 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq)
}
static enum cmd_retval
-cmd_if_shell_error(struct cmd_q *cmdq, void *data)
+cmd_if_shell_error(struct cmdq_item *item, void *data)
{
char *error = data;
- cmdq_error(cmdq, "%s", error);
+ cmdq_error(item, "%s", error);
free(error);
return (CMD_RETURN_NORMAL);
@@ -156,7 +156,7 @@ cmd_if_shell_callback(struct job *job)
struct cmd_if_shell_data *cdata = job->data;
struct client *c = cdata->client;
struct cmd_list *cmdlist;
- struct cmd_q *new_cmdq;
+ struct cmdq_item *new_item;
char *cause, *cmd, *file = cdata->file;
u_int line = cdata->line;
@@ -169,24 +169,24 @@ cmd_if_shell_callback(struct job *job)
if (cmd_string_parse(cmd, &cmdlist, file, line, &cause) != 0) {
if (cause != NULL)
- new_cmdq = cmdq_get_callback(cmd_if_shell_error, cause);
+ new_item = cmdq_get_callback(cmd_if_shell_error, cause);
else
- new_cmdq = NULL;
+ new_item = NULL;
} else {
- new_cmdq = cmdq_get_command(cmdlist, NULL, &cdata->mouse, 0);
+ new_item = cmdq_get_command(cmdlist, NULL, &cdata->mouse, 0);
cmd_list_free(cmdlist);
}
- if (new_cmdq != NULL) {
- if (cdata->cmdq == NULL)
- cmdq_append(c, new_cmdq);
+ if (new_item != NULL) {
+ if (cdata->item == NULL)
+ cmdq_append(c, new_item);
else
- cmdq_insert_after(cdata->cmdq, new_cmdq);
+ cmdq_insert_after(cdata->item, new_item);
}
out:
- if (cdata->cmdq != NULL)
- cdata->cmdq->flags &= ~CMD_Q_WAITING;
+ if (cdata->item != NULL)
+ cdata->item->flags &= ~CMDQ_WAITING;
}
static void
diff --git a/usr.bin/tmux/cmd-join-pane.c b/usr.bin/tmux/cmd-join-pane.c
index 0d3e114cfbd..3afa18e5cd2 100644
--- a/usr.bin/tmux/cmd-join-pane.c
+++ b/usr.bin/tmux/cmd-join-pane.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-join-pane.c,v 1.28 2016/10/13 22:48:51 nicm Exp $ */
+/* $OpenBSD: cmd-join-pane.c,v 1.29 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2011 George Nachman <tmux@georgester.com>
@@ -29,7 +29,7 @@
* Join or move a pane into another (like split/swap/kill).
*/
-static enum cmd_retval cmd_join_pane_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_join_pane_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_join_pane_entry = {
.name = "join-pane",
@@ -60,7 +60,7 @@ const struct cmd_entry cmd_move_pane_entry = {
};
static enum cmd_retval
-cmd_join_pane_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_join_pane_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
struct session *dst_s;
@@ -78,24 +78,24 @@ cmd_join_pane_exec(struct cmd *self, struct cmd_q *cmdq)
else
not_same_window = 0;
- dst_s = cmdq->state.tflag.s;
- dst_wl = cmdq->state.tflag.wl;
- dst_wp = cmdq->state.tflag.wp;
+ dst_s = item->state.tflag.s;
+ dst_wl = item->state.tflag.wl;
+ dst_wp = item->state.tflag.wp;
dst_w = dst_wl->window;
dst_idx = dst_wl->idx;
server_unzoom_window(dst_w);
- src_wl = cmdq->state.sflag.wl;
- src_wp = cmdq->state.sflag.wp;
+ src_wl = item->state.sflag.wl;
+ src_wp = item->state.sflag.wp;
src_w = src_wl->window;
server_unzoom_window(src_w);
if (not_same_window && src_w == dst_w) {
- cmdq_error(cmdq, "can't join a pane to its own window");
+ cmdq_error(item, "can't join a pane to its own window");
return (CMD_RETURN_ERROR);
}
if (!not_same_window && src_wp == dst_wp) {
- cmdq_error(cmdq, "source and target panes must be different");
+ cmdq_error(item, "source and target panes must be different");
return (CMD_RETURN_ERROR);
}
@@ -107,14 +107,14 @@ cmd_join_pane_exec(struct cmd *self, struct cmd_q *cmdq)
if (args_has(args, 'l')) {
size = args_strtonum(args, 'l', 0, INT_MAX, &cause);
if (cause != NULL) {
- cmdq_error(cmdq, "size %s", cause);
+ cmdq_error(item, "size %s", cause);
free(cause);
return (CMD_RETURN_ERROR);
}
} else if (args_has(args, 'p')) {
percentage = args_strtonum(args, 'p', 0, 100, &cause);
if (cause != NULL) {
- cmdq_error(cmdq, "percentage %s", cause);
+ cmdq_error(item, "percentage %s", cause);
free(cause);
return (CMD_RETURN_ERROR);
}
@@ -125,7 +125,7 @@ cmd_join_pane_exec(struct cmd *self, struct cmd_q *cmdq)
}
lc = layout_split_pane(dst_wp, type, size, args_has(args, 'b'), 0);
if (lc == NULL) {
- cmdq_error(cmdq, "create pane failed: pane too small");
+ cmdq_error(item, "create pane failed: pane too small");
return (CMD_RETURN_ERROR);
}
diff --git a/usr.bin/tmux/cmd-kill-pane.c b/usr.bin/tmux/cmd-kill-pane.c
index f1b74ef3a11..32205006ddf 100644
--- a/usr.bin/tmux/cmd-kill-pane.c
+++ b/usr.bin/tmux/cmd-kill-pane.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-kill-pane.c,v 1.21 2016/10/10 21:51:39 nicm Exp $ */
+/* $OpenBSD: cmd-kill-pane.c,v 1.22 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -26,7 +26,7 @@
* Kill pane.
*/
-static enum cmd_retval cmd_kill_pane_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_kill_pane_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_kill_pane_entry = {
.name = "kill-pane",
@@ -42,10 +42,10 @@ const struct cmd_entry cmd_kill_pane_entry = {
};
static enum cmd_retval
-cmd_kill_pane_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_kill_pane_exec(struct cmd *self, struct cmdq_item *item)
{
- struct winlink *wl = cmdq->state.tflag.wl;
- struct window_pane *loopwp, *tmpwp, *wp = cmdq->state.tflag.wp;
+ struct winlink *wl = item->state.tflag.wl;
+ struct window_pane *loopwp, *tmpwp, *wp = item->state.tflag.wp;
server_unzoom_window(wl->window);
diff --git a/usr.bin/tmux/cmd-kill-server.c b/usr.bin/tmux/cmd-kill-server.c
index 3648766d0a9..9cfd43bdba4 100644
--- a/usr.bin/tmux/cmd-kill-server.c
+++ b/usr.bin/tmux/cmd-kill-server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-kill-server.c,v 1.17 2016/10/10 21:51:39 nicm Exp $ */
+/* $OpenBSD: cmd-kill-server.c,v 1.18 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -27,7 +27,7 @@
* Kill the server and do nothing else.
*/
-static enum cmd_retval cmd_kill_server_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_kill_server_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_kill_server_entry = {
.name = "kill-server",
@@ -52,7 +52,7 @@ const struct cmd_entry cmd_start_server_entry = {
};
static enum cmd_retval
-cmd_kill_server_exec(struct cmd *self, __unused struct cmd_q *cmdq)
+cmd_kill_server_exec(struct cmd *self, __unused struct cmdq_item *item)
{
if (self->entry == &cmd_kill_server_entry)
kill(getpid(), SIGTERM);
diff --git a/usr.bin/tmux/cmd-kill-session.c b/usr.bin/tmux/cmd-kill-session.c
index e0c5415f19a..79c500a0cb6 100644
--- a/usr.bin/tmux/cmd-kill-session.c
+++ b/usr.bin/tmux/cmd-kill-session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-kill-session.c,v 1.21 2016/10/10 21:51:39 nicm Exp $ */
+/* $OpenBSD: cmd-kill-session.c,v 1.22 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -27,7 +27,7 @@
* Note this deliberately has no alias to make it hard to hit by accident.
*/
-static enum cmd_retval cmd_kill_session_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_kill_session_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_kill_session_entry = {
.name = "kill-session",
@@ -43,13 +43,13 @@ const struct cmd_entry cmd_kill_session_entry = {
};
static enum cmd_retval
-cmd_kill_session_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_kill_session_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
struct session *s, *sloop, *stmp;
struct winlink *wl;
- s = cmdq->state.tflag.s;
+ s = item->state.tflag.s;
if (args_has(args, 'C')) {
RB_FOREACH(wl, winlinks, &s->windows) {
diff --git a/usr.bin/tmux/cmd-kill-window.c b/usr.bin/tmux/cmd-kill-window.c
index 800257f3515..7a6c5b1738c 100644
--- a/usr.bin/tmux/cmd-kill-window.c
+++ b/usr.bin/tmux/cmd-kill-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-kill-window.c,v 1.22 2016/10/10 21:51:39 nicm Exp $ */
+/* $OpenBSD: cmd-kill-window.c,v 1.23 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -24,7 +24,7 @@
* Destroy window.
*/
-static enum cmd_retval cmd_kill_window_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_kill_window_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_kill_window_entry = {
.name = "kill-window",
@@ -53,16 +53,16 @@ const struct cmd_entry cmd_unlink_window_entry = {
};
static enum cmd_retval
-cmd_kill_window_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_kill_window_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct winlink *wl = cmdq->state.tflag.wl, *wl2, *wl3;
+ struct winlink *wl = item->state.tflag.wl, *wl2, *wl3;
struct window *w = wl->window;
- struct session *s = cmdq->state.tflag.s;
+ struct session *s = item->state.tflag.s;
if (self->entry == &cmd_unlink_window_entry) {
if (!args_has(self->args, 'k') && !session_is_linked(s, w)) {
- cmdq_error(cmdq, "window only linked to one session");
+ cmdq_error(item, "window only linked to one session");
return (CMD_RETURN_ERROR);
}
server_unlink_window(s, wl);
diff --git a/usr.bin/tmux/cmd-list-buffers.c b/usr.bin/tmux/cmd-list-buffers.c
index 221f799a24d..4400c3b39ed 100644
--- a/usr.bin/tmux/cmd-list-buffers.c
+++ b/usr.bin/tmux/cmd-list-buffers.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-list-buffers.c,v 1.32 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-list-buffers.c,v 1.33 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -30,7 +30,7 @@
#define LIST_BUFFERS_TEMPLATE \
"#{buffer_name}: #{buffer_size} bytes: \"#{buffer_sample}\""
-static enum cmd_retval cmd_list_buffers_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_list_buffers_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_list_buffers_entry = {
.name = "list-buffers",
@@ -44,7 +44,7 @@ const struct cmd_entry cmd_list_buffers_entry = {
};
static enum cmd_retval
-cmd_list_buffers_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_list_buffers_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
struct paste_buffer *pb;
@@ -57,11 +57,11 @@ cmd_list_buffers_exec(struct cmd *self, struct cmd_q *cmdq)
pb = NULL;
while ((pb = paste_walk(pb)) != NULL) {
- ft = format_create(cmdq, 0);
+ ft = format_create(item, 0);
format_defaults_paste_buffer(ft, pb);
line = format_expand(ft, template);
- cmdq_print(cmdq, "%s", line);
+ cmdq_print(item, "%s", line);
free(line);
format_free(ft);
diff --git a/usr.bin/tmux/cmd-list-clients.c b/usr.bin/tmux/cmd-list-clients.c
index 4a2eac34011..a2488467cce 100644
--- a/usr.bin/tmux/cmd-list-clients.c
+++ b/usr.bin/tmux/cmd-list-clients.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-list-clients.c,v 1.29 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-list-clients.c,v 1.30 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -33,7 +33,7 @@
"[#{client_width}x#{client_height} #{client_termname}]" \
"#{?client_utf8, (utf8),} #{?client_readonly, (ro),}"
-static enum cmd_retval cmd_list_clients_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_list_clients_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_list_clients_entry = {
.name = "list-clients",
@@ -49,7 +49,7 @@ const struct cmd_entry cmd_list_clients_entry = {
};
static enum cmd_retval
-cmd_list_clients_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_list_clients_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
struct client *c;
@@ -60,7 +60,7 @@ cmd_list_clients_exec(struct cmd *self, struct cmd_q *cmdq)
char *line;
if (args_has(args, 't'))
- s = cmdq->state.tflag.s;
+ s = item->state.tflag.s;
else
s = NULL;
@@ -72,12 +72,12 @@ cmd_list_clients_exec(struct cmd *self, struct cmd_q *cmdq)
if (c->session == NULL || (s != NULL && s != c->session))
continue;
- ft = format_create(cmdq, 0);
+ ft = format_create(item, 0);
format_add(ft, "line", "%u", idx);
format_defaults(ft, c, NULL, NULL, NULL);
line = format_expand(ft, template);
- cmdq_print(cmdq, "%s", line);
+ cmdq_print(item, "%s", line);
free(line);
format_free(ft);
diff --git a/usr.bin/tmux/cmd-list-keys.c b/usr.bin/tmux/cmd-list-keys.c
index d9285bc5878..9761d6041a4 100644
--- a/usr.bin/tmux/cmd-list-keys.c
+++ b/usr.bin/tmux/cmd-list-keys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-list-keys.c,v 1.39 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-list-keys.c,v 1.40 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -27,10 +27,11 @@
* List key bindings.
*/
-static enum cmd_retval cmd_list_keys_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_list_keys_exec(struct cmd *, struct cmdq_item *);
-static enum cmd_retval cmd_list_keys_table(struct cmd *, struct cmd_q *);
-static enum cmd_retval cmd_list_keys_commands(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_list_keys_table(struct cmd *, struct cmdq_item *);
+static enum cmd_retval cmd_list_keys_commands(struct cmd *,
+ struct cmdq_item *);
const struct cmd_entry cmd_list_keys_entry = {
.name = "list-keys",
@@ -55,7 +56,7 @@ const struct cmd_entry cmd_list_commands_entry = {
};
static enum cmd_retval
-cmd_list_keys_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
struct key_table *table;
@@ -65,14 +66,14 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_q *cmdq)
int repeat, width, tablewidth, keywidth;
if (self->entry == &cmd_list_commands_entry)
- return (cmd_list_keys_commands(self, cmdq));
+ return (cmd_list_keys_commands(self, item));
if (args_has(args, 't'))
- return (cmd_list_keys_table(self, cmdq));
+ return (cmd_list_keys_table(self, item));
tablename = args_get(args, 'T');
if (tablename != NULL && key_bindings_get_table(tablename, 0) == NULL) {
- cmdq_error(cmdq, "table %s doesn't exist", tablename);
+ cmdq_error(item, "table %s doesn't exist", tablename);
return (CMD_RETURN_ERROR);
}
@@ -124,7 +125,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_q *cmdq)
strlcat(tmp, cp, sizeof tmp);
free(cp);
- cmdq_print(cmdq, "bind-key %s", tmp);
+ cmdq_print(item, "bind-key %s", tmp);
}
}
@@ -132,7 +133,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_q *cmdq)
}
static enum cmd_retval
-cmd_list_keys_table(struct cmd *self, struct cmd_q *cmdq)
+cmd_list_keys_table(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
const char *tablename, *cmdstr;
@@ -142,7 +143,7 @@ cmd_list_keys_table(struct cmd *self, struct cmd_q *cmdq)
tablename = args_get(args, 't');
if ((mtab = mode_key_findtable(tablename)) == NULL) {
- cmdq_error(cmdq, "unknown key table: %s", tablename);
+ cmdq_error(item, "unknown key table: %s", tablename);
return (CMD_RETURN_ERROR);
}
@@ -156,7 +157,7 @@ cmd_list_keys_table(struct cmd *self, struct cmd_q *cmdq)
RB_FOREACH(mbind, mode_key_tree, mtab->tree) {
cmdstr = mode_key_tostring(mtab->cmdstr, mbind->cmd);
if (cmdstr != NULL) {
- cmdq_print(cmdq, "bind-key -t %s %*s %s",
+ cmdq_print(item, "bind-key -t %s %*s %s",
mtab->name, (int)keywidth,
key_string_lookup_key(mbind->key), cmdstr);
}
@@ -166,13 +167,13 @@ cmd_list_keys_table(struct cmd *self, struct cmd_q *cmdq)
}
static enum cmd_retval
-cmd_list_keys_commands(struct cmd *self, struct cmd_q *cmdq)
+cmd_list_keys_commands(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
const struct cmd_entry **entryp;
const struct cmd_entry *entry;
struct format_tree *ft;
- const char *template;
+ const char *template, *s;
char *line;
if ((template = args_get(args, 'F')) == NULL) {
@@ -181,25 +182,27 @@ cmd_list_keys_commands(struct cmd *self, struct cmd_q *cmdq)
"#{command_list_usage}";
}
- ft = format_create(cmdq, 0);
+ ft = format_create(item, 0);
format_defaults(ft, NULL, NULL, NULL, NULL);
for (entryp = cmd_table; *entryp != NULL; entryp++) {
entry = *entryp;
format_add(ft, "command_list_name", "%s", entry->name);
- if (entry->alias != NULL) {
- format_add(ft, "command_list_alias", "%s",
- entry->alias);
- }
- if (entry->alias != NULL) {
- format_add(ft, "command_list_usage", "%s",
- entry->usage);
- }
+ if (entry->alias != NULL)
+ s = entry->alias;
+ else
+ s = "";
+ format_add(ft, "command_list_alias", "%s", s);
+ if (entry->usage != NULL)
+ s = entry->usage;
+ else
+ s = "";
+ format_add(ft, "command_list_usage", "%s", s);
line = format_expand(ft, template);
if (*line != '\0')
- cmdq_print(cmdq, "%s", line);
+ cmdq_print(item, "%s", line);
free(line);
}
diff --git a/usr.bin/tmux/cmd-list-panes.c b/usr.bin/tmux/cmd-list-panes.c
index 577c526c673..04947718b07 100644
--- a/usr.bin/tmux/cmd-list-panes.c
+++ b/usr.bin/tmux/cmd-list-panes.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-list-panes.c,v 1.29 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-list-panes.c,v 1.30 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -26,13 +26,13 @@
* List panes on given window.
*/
-static enum cmd_retval cmd_list_panes_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_list_panes_exec(struct cmd *, struct cmdq_item *);
-static void cmd_list_panes_server(struct cmd *, struct cmd_q *);
+static void cmd_list_panes_server(struct cmd *, struct cmdq_item *);
static void cmd_list_panes_session(struct cmd *, struct session *,
- struct cmd_q *, int);
+ struct cmdq_item *, int);
static void cmd_list_panes_window(struct cmd *, struct session *,
- struct winlink *, struct cmd_q *, int);
+ struct winlink *, struct cmdq_item *, int);
const struct cmd_entry cmd_list_panes_entry = {
.name = "list-panes",
@@ -48,44 +48,44 @@ const struct cmd_entry cmd_list_panes_entry = {
};
static enum cmd_retval
-cmd_list_panes_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_list_panes_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct session *s = cmdq->state.tflag.s;
- struct winlink *wl = cmdq->state.tflag.wl;
+ struct session *s = item->state.tflag.s;
+ struct winlink *wl = item->state.tflag.wl;
if (args_has(args, 'a'))
- cmd_list_panes_server(self, cmdq);
+ cmd_list_panes_server(self, item);
else if (args_has(args, 's'))
- cmd_list_panes_session(self, s, cmdq, 1);
+ cmd_list_panes_session(self, s, item, 1);
else
- cmd_list_panes_window(self, s, wl, cmdq, 0);
+ cmd_list_panes_window(self, s, wl, item, 0);
return (CMD_RETURN_NORMAL);
}
static void
-cmd_list_panes_server(struct cmd *self, struct cmd_q *cmdq)
+cmd_list_panes_server(struct cmd *self, struct cmdq_item *item)
{
struct session *s;
RB_FOREACH(s, sessions, &sessions)
- cmd_list_panes_session(self, s, cmdq, 2);
+ cmd_list_panes_session(self, s, item, 2);
}
static void
-cmd_list_panes_session(struct cmd *self, struct session *s, struct cmd_q *cmdq,
- int type)
+cmd_list_panes_session(struct cmd *self, struct session *s,
+ struct cmdq_item *item, int type)
{
struct winlink *wl;
RB_FOREACH(wl, winlinks, &s->windows)
- cmd_list_panes_window(self, s, wl, cmdq, type);
+ cmd_list_panes_window(self, s, wl, item, type);
}
static void
cmd_list_panes_window(struct cmd *self, struct session *s, struct winlink *wl,
- struct cmd_q *cmdq, int type)
+ struct cmdq_item *item, int type)
{
struct args *args = self->args;
struct window_pane *wp;
@@ -123,12 +123,12 @@ cmd_list_panes_window(struct cmd *self, struct session *s, struct winlink *wl,
n = 0;
TAILQ_FOREACH(wp, &wl->window->panes, entry) {
- ft = format_create(cmdq, 0);
+ ft = format_create(item, 0);
format_add(ft, "line", "%u", n);
format_defaults(ft, NULL, s, wl, wp);
line = format_expand(ft, template);
- cmdq_print(cmdq, "%s", line);
+ cmdq_print(item, "%s", line);
free(line);
format_free(ft);
diff --git a/usr.bin/tmux/cmd-list-sessions.c b/usr.bin/tmux/cmd-list-sessions.c
index d87df0ed5ed..8ea5559cf3e 100644
--- a/usr.bin/tmux/cmd-list-sessions.c
+++ b/usr.bin/tmux/cmd-list-sessions.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-list-sessions.c,v 1.26 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-list-sessions.c,v 1.27 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -36,7 +36,8 @@
"#{session_group}#{?session_grouped,),}" \
"#{?session_attached, (attached),}"
-static enum cmd_retval cmd_list_sessions_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_list_sessions_exec(struct cmd *,
+ struct cmdq_item *);
const struct cmd_entry cmd_list_sessions_entry = {
.name = "list-sessions",
@@ -50,7 +51,7 @@ const struct cmd_entry cmd_list_sessions_entry = {
};
static enum cmd_retval
-cmd_list_sessions_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_list_sessions_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
struct session *s;
@@ -64,12 +65,12 @@ cmd_list_sessions_exec(struct cmd *self, struct cmd_q *cmdq)
n = 0;
RB_FOREACH(s, sessions, &sessions) {
- ft = format_create(cmdq, 0);
+ ft = format_create(item, 0);
format_add(ft, "line", "%u", n);
format_defaults(ft, NULL, s, NULL, NULL);
line = format_expand(ft, template);
- cmdq_print(cmdq, "%s", line);
+ cmdq_print(item, "%s", line);
free(line);
format_free(ft);
diff --git a/usr.bin/tmux/cmd-list-windows.c b/usr.bin/tmux/cmd-list-windows.c
index adac28041ec..f6701bcdc46 100644
--- a/usr.bin/tmux/cmd-list-windows.c
+++ b/usr.bin/tmux/cmd-list-windows.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-list-windows.c,v 1.39 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-list-windows.c,v 1.40 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -39,11 +39,11 @@
"(#{window_panes} panes) " \
"[#{window_width}x#{window_height}] "
-static enum cmd_retval cmd_list_windows_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_list_windows_exec(struct cmd *, struct cmdq_item *);
-static void cmd_list_windows_server(struct cmd *, struct cmd_q *);
+static void cmd_list_windows_server(struct cmd *, struct cmdq_item *);
static void cmd_list_windows_session(struct cmd *, struct session *,
- struct cmd_q *, int);
+ struct cmdq_item *, int);
const struct cmd_entry cmd_list_windows_entry = {
.name = "list-windows",
@@ -59,30 +59,30 @@ const struct cmd_entry cmd_list_windows_entry = {
};
static enum cmd_retval
-cmd_list_windows_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_list_windows_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
if (args_has(args, 'a'))
- cmd_list_windows_server(self, cmdq);
+ cmd_list_windows_server(self, item);
else
- cmd_list_windows_session(self, cmdq->state.tflag.s, cmdq, 0);
+ cmd_list_windows_session(self, item->state.tflag.s, item, 0);
return (CMD_RETURN_NORMAL);
}
static void
-cmd_list_windows_server(struct cmd *self, struct cmd_q *cmdq)
+cmd_list_windows_server(struct cmd *self, struct cmdq_item *item)
{
struct session *s;
RB_FOREACH(s, sessions, &sessions)
- cmd_list_windows_session(self, s, cmdq, 1);
+ cmd_list_windows_session(self, s, item, 1);
}
static void
cmd_list_windows_session(struct cmd *self, struct session *s,
- struct cmd_q *cmdq, int type)
+ struct cmdq_item *item, int type)
{
struct args *args = self->args;
struct winlink *wl;
@@ -105,12 +105,12 @@ cmd_list_windows_session(struct cmd *self, struct session *s,
n = 0;
RB_FOREACH(wl, winlinks, &s->windows) {
- ft = format_create(cmdq, 0);
+ ft = format_create(item, 0);
format_add(ft, "line", "%u", n);
format_defaults(ft, NULL, s, wl, NULL);
line = format_expand(ft, template);
- cmdq_print(cmdq, "%s", line);
+ cmdq_print(item, "%s", line);
free(line);
format_free(ft);
diff --git a/usr.bin/tmux/cmd-load-buffer.c b/usr.bin/tmux/cmd-load-buffer.c
index cac5835dd2b..ab9fd22aa1e 100644
--- a/usr.bin/tmux/cmd-load-buffer.c
+++ b/usr.bin/tmux/cmd-load-buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-load-buffer.c,v 1.45 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: cmd-load-buffer.c,v 1.46 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -31,9 +31,9 @@
* Loads a paste buffer from a file.
*/
-static enum cmd_retval cmd_load_buffer_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_load_buffer_exec(struct cmd *, struct cmdq_item *);
-static void cmd_load_buffer_callback(struct client *, int, void *);
+static void cmd_load_buffer_callback(struct client *, int, void *);
const struct cmd_entry cmd_load_buffer_entry = {
.name = "load-buffer",
@@ -47,16 +47,16 @@ const struct cmd_entry cmd_load_buffer_entry = {
};
struct cmd_load_buffer_data {
- struct cmd_q *cmdq;
- char *bufname;
+ struct cmdq_item *item;
+ char *bufname;
};
static enum cmd_retval
-cmd_load_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_load_buffer_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
struct cmd_load_buffer_data *cdata;
- struct client *c = cmdq->client;
+ struct client *c = item->client;
struct session *s;
FILE *f;
const char *path, *bufname, *cwd;
@@ -72,13 +72,13 @@ cmd_load_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
path = args->argv[0];
if (strcmp(path, "-") == 0) {
cdata = xcalloc(1, sizeof *cdata);
- cdata->cmdq = cmdq;
+ cdata->item = item;
cdata->bufname = xstrdup(bufname);
error = server_set_stdin_callback(c, cmd_load_buffer_callback,
cdata, &cause);
if (error != 0) {
- cmdq_error(cmdq, "%s: %s", path, cause);
+ cmdq_error(item, "%s: %s", path, cause);
free(cause);
return (CMD_RETURN_ERROR);
}
@@ -98,13 +98,13 @@ cmd_load_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
xasprintf(&file, "%s/%s", cwd, path);
if (realpath(file, resolved) == NULL &&
strlcpy(resolved, file, sizeof resolved) >= sizeof resolved) {
- cmdq_error(cmdq, "%s: %s", file, strerror(ENAMETOOLONG));
+ cmdq_error(item, "%s: %s", file, strerror(ENAMETOOLONG));
return (CMD_RETURN_ERROR);
}
f = fopen(resolved, "rb");
free(file);
if (f == NULL) {
- cmdq_error(cmdq, "%s: %s", resolved, strerror(errno));
+ cmdq_error(item, "%s: %s", resolved, strerror(errno));
return (CMD_RETURN_ERROR);
}
@@ -113,14 +113,14 @@ cmd_load_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
while ((ch = getc(f)) != EOF) {
/* Do not let the server die due to memory exhaustion. */
if ((new_pdata = realloc(pdata, psize + 2)) == NULL) {
- cmdq_error(cmdq, "realloc error: %s", strerror(errno));
+ cmdq_error(item, "realloc error: %s", strerror(errno));
goto error;
}
pdata = new_pdata;
pdata[psize++] = ch;
}
if (ferror(f)) {
- cmdq_error(cmdq, "%s: read error", resolved);
+ cmdq_error(item, "%s: read error", resolved);
goto error;
}
if (pdata != NULL)
@@ -129,7 +129,7 @@ cmd_load_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
fclose(f);
if (paste_set(pdata, psize, bufname, &cause) != 0) {
- cmdq_error(cmdq, "%s", cause);
+ cmdq_error(item, "%s", cause);
free(pdata);
free(cause);
return (CMD_RETURN_ERROR);
@@ -180,7 +180,7 @@ cmd_load_buffer_callback(struct client *c, int closed, void *data)
free(cause);
}
out:
- cdata->cmdq->flags &= ~CMD_Q_WAITING;
+ cdata->item->flags &= ~CMDQ_WAITING;
free(cdata->bufname);
free(cdata);
diff --git a/usr.bin/tmux/cmd-lock-server.c b/usr.bin/tmux/cmd-lock-server.c
index b4328778bab..30969584bc5 100644
--- a/usr.bin/tmux/cmd-lock-server.c
+++ b/usr.bin/tmux/cmd-lock-server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-lock-server.c,v 1.24 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-lock-server.c,v 1.25 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -24,7 +24,7 @@
* Lock commands.
*/
-static enum cmd_retval cmd_lock_server_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_lock_server_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_lock_server_entry = {
.name = "lock-server",
@@ -64,14 +64,14 @@ const struct cmd_entry cmd_lock_client_entry = {
};
static enum cmd_retval
-cmd_lock_server_exec(struct cmd *self, __unused struct cmd_q *cmdq)
+cmd_lock_server_exec(struct cmd *self, __unused struct cmdq_item *item)
{
if (self->entry == &cmd_lock_server_entry)
server_lock();
else if (self->entry == &cmd_lock_session_entry)
- server_lock_session(cmdq->state.tflag.s);
+ server_lock_session(item->state.tflag.s);
else
- server_lock_client(cmdq->state.c);
+ server_lock_client(item->state.c);
recalculate_sizes();
diff --git a/usr.bin/tmux/cmd-move-window.c b/usr.bin/tmux/cmd-move-window.c
index 1a50b4c81c8..e21020d511e 100644
--- a/usr.bin/tmux/cmd-move-window.c
+++ b/usr.bin/tmux/cmd-move-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-move-window.c,v 1.27 2016/10/10 21:51:39 nicm Exp $ */
+/* $OpenBSD: cmd-move-window.c,v 1.28 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -26,7 +26,7 @@
* Move a window.
*/
-static enum cmd_retval cmd_move_window_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_move_window_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_move_window_entry = {
.name = "move-window",
@@ -57,14 +57,14 @@ const struct cmd_entry cmd_link_window_entry = {
};
static enum cmd_retval
-cmd_move_window_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_move_window_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct session *src = cmdq->state.sflag.s;
- struct session *dst = cmdq->state.tflag.s;
- struct winlink *wl = cmdq->state.sflag.wl;
+ struct session *src = item->state.sflag.s;
+ struct session *dst = item->state.tflag.s;
+ struct winlink *wl = item->state.sflag.wl;
char *cause;
- int idx = cmdq->state.tflag.idx, kflag, dflag, sflag;
+ int idx = item->state.tflag.idx, kflag, dflag, sflag;
if (args_has(args, 'r')) {
session_renumber_windows(dst);
@@ -84,7 +84,7 @@ cmd_move_window_exec(struct cmd *self, struct cmd_q *cmdq)
if (server_link_window(src, wl, dst, idx, kflag, !dflag,
&cause) != 0) {
- cmdq_error(cmdq, "can't link window: %s", cause);
+ cmdq_error(item, "can't link window: %s", cause);
free(cause);
return (CMD_RETURN_ERROR);
}
diff --git a/usr.bin/tmux/cmd-new-session.c b/usr.bin/tmux/cmd-new-session.c
index 30c89cdec3c..86d13ef4b2f 100644
--- a/usr.bin/tmux/cmd-new-session.c
+++ b/usr.bin/tmux/cmd-new-session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-new-session.c,v 1.91 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: cmd-new-session.c,v 1.92 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -33,7 +33,7 @@
#define NEW_SESSION_TEMPLATE "#{session_name}:"
-static enum cmd_retval cmd_new_session_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_new_session_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_new_session_entry = {
.name = "new-session",
@@ -64,12 +64,12 @@ const struct cmd_entry cmd_has_session_entry = {
};
static enum cmd_retval
-cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct client *c = cmdq->client;
+ struct client *c = item->client;
struct session *s, *as;
- struct session *groupwith = cmdq->state.tflag.s;
+ struct session *groupwith = item->state.tflag.s;
struct window *w;
struct environ *env;
struct termios tio, *tiop;
@@ -91,37 +91,37 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
}
if (args_has(args, 't') && (args->argc != 0 || args_has(args, 'n'))) {
- cmdq_error(cmdq, "command or window name given with target");
+ cmdq_error(item, "command or window name given with target");
return (CMD_RETURN_ERROR);
}
newname = args_get(args, 's');
if (newname != NULL) {
if (!session_check_name(newname)) {
- cmdq_error(cmdq, "bad session name: %s", newname);
+ cmdq_error(item, "bad session name: %s", newname);
return (CMD_RETURN_ERROR);
}
if ((as = session_find(newname)) != NULL) {
if (args_has(args, 'A')) {
/*
- * This cmdq is now destined for
+ * This item is now destined for
* attach-session. Because attach-session
* will have already been prepared, copy this
* session into its tflag so it can be used.
*/
- cmd_find_from_session(&cmdq->state.tflag, as);
- return (cmd_attach_session(cmdq,
+ cmd_find_from_session(&item->state.tflag, as);
+ return (cmd_attach_session(item,
args_has(args, 'D'), 0, NULL,
args_has(args, 'E')));
}
- cmdq_error(cmdq, "duplicate session: %s", newname);
+ cmdq_error(item, "duplicate session: %s", newname);
return (CMD_RETURN_ERROR);
}
}
if ((target = args_get(args, 't')) != NULL) {
if (groupwith == NULL) {
- cmdq_error(cmdq, "no such session: %s", target);
+ cmdq_error(item, "no such session: %s", target);
goto error;
}
} else
@@ -139,7 +139,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
/* Get the new session working directory. */
if (args_has(args, 'c')) {
- ft = format_create(cmdq, 0);
+ ft = format_create(item, 0);
format_defaults(ft, c, NULL, NULL, NULL);
to_free = cwd = format_expand(ft, args_get(args, 'c'));
format_free(ft);
@@ -158,8 +158,8 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
* over.
*/
if (!detached && !already_attached && c->tty.fd != -1) {
- if (server_client_check_nested(cmdq->client)) {
- cmdq_error(cmdq, "sessions should be nested with care, "
+ if (server_client_check_nested(item->client)) {
+ cmdq_error(item, "sessions should be nested with care, "
"unset $TMUX to force");
return (CMD_RETURN_ERROR);
}
@@ -172,7 +172,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
/* Open the terminal if necessary. */
if (!detached && !already_attached) {
if (server_client_open(c, &cause) != 0) {
- cmdq_error(cmdq, "open terminal failed: %s", cause);
+ cmdq_error(item, "open terminal failed: %s", cause);
free(cause);
goto error;
}
@@ -189,14 +189,14 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
if (detached && args_has(args, 'x')) {
sx = strtonum(args_get(args, 'x'), 1, USHRT_MAX, &errstr);
if (errstr != NULL) {
- cmdq_error(cmdq, "width %s", errstr);
+ cmdq_error(item, "width %s", errstr);
goto error;
}
}
if (detached && args_has(args, 'y')) {
sy = strtonum(args_get(args, 'y'), 1, USHRT_MAX, &errstr);
if (errstr != NULL) {
- cmdq_error(cmdq, "height %s", errstr);
+ cmdq_error(item, "height %s", errstr);
goto error;
}
}
@@ -246,7 +246,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
sy, &cause);
environ_free(env);
if (s == NULL) {
- cmdq_error(cmdq, "create session failed: %s", cause);
+ cmdq_error(item, "create session failed: %s", cause);
free(cause);
goto error;
}
@@ -301,11 +301,11 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
if ((template = args_get(args, 'F')) == NULL)
template = NEW_SESSION_TEMPLATE;
- ft = format_create(cmdq, 0);
+ ft = format_create(item, 0);
format_defaults(ft, c, s, NULL, NULL);
cp = format_expand(ft, template);
- cmdq_print(cmdq, "%s", cp);
+ cmdq_print(item, "%s", cp);
free(cp);
format_free(ft);
@@ -318,7 +318,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
free((void *)to_free);
cmd_find_from_session(&fs, s);
- hooks_insert(s->hooks, cmdq, &fs, "after-new-session");
+ hooks_insert(s->hooks, item, &fs, "after-new-session");
return (CMD_RETURN_NORMAL);
diff --git a/usr.bin/tmux/cmd-new-window.c b/usr.bin/tmux/cmd-new-window.c
index 5ee6f9c13fe..24601167882 100644
--- a/usr.bin/tmux/cmd-new-window.c
+++ b/usr.bin/tmux/cmd-new-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-new-window.c,v 1.63 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: cmd-new-window.c,v 1.64 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -32,7 +32,7 @@
#define NEW_WINDOW_TEMPLATE "#{session_name}:#{window_index}.#{pane_index}"
-static enum cmd_retval cmd_new_window_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_new_window_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_new_window_entry = {
.name = "new-window",
@@ -49,13 +49,13 @@ const struct cmd_entry cmd_new_window_entry = {
};
static enum cmd_retval
-cmd_new_window_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_new_window_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct session *s = cmdq->state.tflag.s;
- struct winlink *wl = cmdq->state.tflag.wl;
- struct client *c = cmdq->state.c;
- int idx = cmdq->state.tflag.idx;
+ struct session *s = item->state.tflag.s;
+ struct winlink *wl = item->state.tflag.wl;
+ struct client *c = item->state.c;
+ int idx = item->state.tflag.idx;
const char *cmd, *path, *template, *cwd, *to_free;
char **argv, *cause, *cp;
int argc, detached;
@@ -65,7 +65,7 @@ cmd_new_window_exec(struct cmd *self, struct cmd_q *cmdq)
if (args_has(args, 'a')) {
if ((idx = winlink_shuffle_up(s, wl)) == -1) {
- cmdq_error(cmdq, "no free window indexes");
+ cmdq_error(item, "no free window indexes");
return (CMD_RETURN_ERROR);
}
}
@@ -86,8 +86,8 @@ cmd_new_window_exec(struct cmd *self, struct cmd_q *cmdq)
}
path = NULL;
- if (cmdq->client != NULL && cmdq->client->session == NULL)
- envent = environ_find(cmdq->client->environ, "PATH");
+ if (item->client != NULL && item->client->session == NULL)
+ envent = environ_find(item->client->environ, "PATH");
else
envent = environ_find(s->environ, "PATH");
if (envent != NULL)
@@ -95,12 +95,12 @@ cmd_new_window_exec(struct cmd *self, struct cmd_q *cmdq)
to_free = NULL;
if (args_has(args, 'c')) {
- ft = format_create(cmdq, 0);
+ ft = format_create(item, 0);
format_defaults(ft, c, s, NULL, NULL);
cwd = to_free = format_expand(ft, args_get(args, 'c'));
format_free(ft);
- } else if (cmdq->client != NULL && cmdq->client->session == NULL)
- cwd = cmdq->client->cwd;
+ } else if (item->client != NULL && item->client->session == NULL)
+ cwd = item->client->cwd;
else
cwd = s->cwd;
@@ -129,7 +129,7 @@ cmd_new_window_exec(struct cmd *self, struct cmd_q *cmdq)
wl = session_new(s, args_get(args, 'n'), argc, argv, path, cwd, idx,
&cause);
if (wl == NULL) {
- cmdq_error(cmdq, "create window failed: %s", cause);
+ cmdq_error(item, "create window failed: %s", cause);
free(cause);
goto error;
}
@@ -143,11 +143,11 @@ cmd_new_window_exec(struct cmd *self, struct cmd_q *cmdq)
if ((template = args_get(args, 'F')) == NULL)
template = NEW_WINDOW_TEMPLATE;
- ft = format_create(cmdq, 0);
+ ft = format_create(item, 0);
format_defaults(ft, c, s, wl, NULL);
cp = format_expand(ft, template);
- cmdq_print(cmdq, "%s", cp);
+ cmdq_print(item, "%s", cp);
free(cp);
format_free(ft);
@@ -157,7 +157,7 @@ cmd_new_window_exec(struct cmd *self, struct cmd_q *cmdq)
free((void *)to_free);
cmd_find_from_winlink(&fs, s, wl);
- hooks_insert(s->hooks, cmdq, &fs, "after-new-window");
+ hooks_insert(s->hooks, item, &fs, "after-new-window");
return (CMD_RETURN_NORMAL);
diff --git a/usr.bin/tmux/cmd-paste-buffer.c b/usr.bin/tmux/cmd-paste-buffer.c
index 1529eea89ed..0e256108eca 100644
--- a/usr.bin/tmux/cmd-paste-buffer.c
+++ b/usr.bin/tmux/cmd-paste-buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-paste-buffer.c,v 1.36 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-paste-buffer.c,v 1.37 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -28,7 +28,7 @@
* Paste paste buffer if present.
*/
-static enum cmd_retval cmd_paste_buffer_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_paste_buffer_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_paste_buffer_entry = {
.name = "paste-buffer",
@@ -45,10 +45,10 @@ const struct cmd_entry cmd_paste_buffer_entry = {
};
static enum cmd_retval
-cmd_paste_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_paste_buffer_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct window_pane *wp = cmdq->state.tflag.wp;
+ struct window_pane *wp = item->state.tflag.wp;
struct paste_buffer *pb;
const char *sepstr, *bufname, *bufdata, *bufend, *line;
size_t seplen, bufsize;
@@ -63,7 +63,7 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
else {
pb = paste_get_name(bufname);
if (pb == NULL) {
- cmdq_error(cmdq, "no buffer %s", bufname);
+ cmdq_error(item, "no buffer %s", bufname);
return (CMD_RETURN_ERROR);
}
}
diff --git a/usr.bin/tmux/cmd-pipe-pane.c b/usr.bin/tmux/cmd-pipe-pane.c
index 505a9bec97e..761a931558c 100644
--- a/usr.bin/tmux/cmd-pipe-pane.c
+++ b/usr.bin/tmux/cmd-pipe-pane.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-pipe-pane.c,v 1.38 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-pipe-pane.c,v 1.39 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -33,7 +33,7 @@
* Open pipe to redirect pane output. If already open, close first.
*/
-static enum cmd_retval cmd_pipe_pane_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_pipe_pane_exec(struct cmd *, struct cmdq_item *);
static void cmd_pipe_pane_error_callback(struct bufferevent *, short, void *);
@@ -51,13 +51,13 @@ const struct cmd_entry cmd_pipe_pane_entry = {
};
static enum cmd_retval
-cmd_pipe_pane_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct client *c = cmdq->state.c;
- struct window_pane *wp = cmdq->state.tflag.wp;
- struct session *s = cmdq->state.tflag.s;
- struct winlink *wl = cmdq->state.tflag.wl;
+ struct client *c = item->state.c;
+ struct window_pane *wp = item->state.tflag.wp;
+ struct session *s = item->state.tflag.s;
+ struct winlink *wl = item->state.tflag.wl;
char *cmd;
int old_fd, pipe_fd[2], null_fd;
struct format_tree *ft;
@@ -85,12 +85,12 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmd_q *cmdq)
/* Open the new pipe. */
if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pipe_fd) != 0) {
- cmdq_error(cmdq, "socketpair error: %s", strerror(errno));
+ cmdq_error(item, "socketpair error: %s", strerror(errno));
return (CMD_RETURN_ERROR);
}
/* Expand the command. */
- ft = format_create(cmdq, 0);
+ ft = format_create(item, 0);
format_defaults(ft, c, s, wl, wp);
cmd = format_expand_time(ft, args->argv[0], time(NULL));
format_free(ft);
@@ -98,7 +98,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmd_q *cmdq)
/* Fork the child. */
switch (fork()) {
case -1:
- cmdq_error(cmdq, "fork error: %s", strerror(errno));
+ cmdq_error(item, "fork error: %s", strerror(errno));
free(cmd);
return (CMD_RETURN_ERROR);
diff --git a/usr.bin/tmux/cmd-queue.c b/usr.bin/tmux/cmd-queue.c
index 23211d53ef7..377f06da83f 100644
--- a/usr.bin/tmux/cmd-queue.c
+++ b/usr.bin/tmux/cmd-queue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-queue.c,v 1.43 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: cmd-queue.c,v 1.44 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2013 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -26,7 +26,7 @@
#include "tmux.h"
/* Global command queue. */
-static struct cmd_q_list global_queue = TAILQ_HEAD_INITIALIZER(global_queue);
+static struct cmdq_list global_queue = TAILQ_HEAD_INITIALIZER(global_queue);
/* Get command queue name. */
static const char *
@@ -41,7 +41,7 @@ cmdq_name(struct client *c)
}
/* Get command queue from client. */
-static struct cmd_q_list *
+static struct cmdq_list *
cmdq_get(struct client *c)
{
if (c == NULL)
@@ -51,67 +51,67 @@ cmdq_get(struct client *c)
/* Append an item. */
void
-cmdq_append(struct client *c, struct cmd_q *cmdq)
+cmdq_append(struct client *c, struct cmdq_item *item)
{
- struct cmd_q_list *queue = cmdq_get(c);
- struct cmd_q *next;
+ struct cmdq_list *queue = cmdq_get(c);
+ struct cmdq_item *next;
do {
- next = cmdq->next;
- cmdq->next = NULL;
+ next = item->next;
+ item->next = NULL;
if (c != NULL)
c->references++;
- cmdq->client = c;
+ item->client = c;
- cmdq->queue = queue;
- TAILQ_INSERT_TAIL(queue, cmdq, entry);
+ item->queue = queue;
+ TAILQ_INSERT_TAIL(queue, item, entry);
- cmdq = next;
- } while (cmdq != NULL);
+ item = next;
+ } while (item != NULL);
}
/* Insert an item. */
void
-cmdq_insert_after(struct cmd_q *after, struct cmd_q *cmdq)
+cmdq_insert_after(struct cmdq_item *after, struct cmdq_item *item)
{
struct client *c = after->client;
- struct cmd_q_list *queue = after->queue;
- struct cmd_q *next;
+ struct cmdq_list *queue = after->queue;
+ struct cmdq_item *next;
do {
- next = cmdq->next;
- cmdq->next = NULL;
+ next = item->next;
+ item->next = NULL;
if (c != NULL)
c->references++;
- cmdq->client = c;
+ item->client = c;
- cmdq->queue = queue;
+ item->queue = queue;
if (after->next != NULL)
- TAILQ_INSERT_AFTER(queue, after->next, cmdq, entry);
+ TAILQ_INSERT_AFTER(queue, after->next, item, entry);
else
- TAILQ_INSERT_AFTER(queue, after, cmdq, entry);
- after->next = cmdq;
+ TAILQ_INSERT_AFTER(queue, after, item, entry);
+ after->next = item;
- cmdq = next;
- } while (cmdq != NULL);
+ item = next;
+ } while (item != NULL);
}
/* Remove an item. */
static void
-cmdq_remove(struct cmd_q *cmdq)
+cmdq_remove(struct cmdq_item *item)
{
- free((void *)cmdq->hook);
+ free((void *)item->hook);
- if (cmdq->client != NULL)
- server_client_unref(cmdq->client);
+ if (item->client != NULL)
+ server_client_unref(item->client);
- if (cmdq->type == CMD_Q_COMMAND)
- cmd_list_free(cmdq->cmdlist);
+ if (item->type == CMDQ_COMMAND)
+ cmd_list_free(item->cmdlist);
- TAILQ_REMOVE(cmdq->queue, cmdq, entry);
- free(cmdq);
+ TAILQ_REMOVE(item->queue, item, entry);
+ free(item);
}
/* Set command group. */
@@ -125,129 +125,129 @@ cmdq_next_group(void)
/* Remove all subsequent items that match this item's group. */
static void
-cmdq_remove_group(struct cmd_q *cmdq)
+cmdq_remove_group(struct cmdq_item *item)
{
- struct cmd_q *this, *next;
+ struct cmdq_item *this, *next;
- this = TAILQ_NEXT(cmdq, entry);
+ this = TAILQ_NEXT(item, entry);
while (this != NULL) {
next = TAILQ_NEXT(this, entry);
- if (this->group == cmdq->group)
+ if (this->group == item->group)
cmdq_remove(this);
this = next;
}
}
/* Get a command for the command queue. */
-struct cmd_q *
+struct cmdq_item *
cmdq_get_command(struct cmd_list *cmdlist, struct cmd_find_state *current,
struct mouse_event *m, int flags)
{
- struct cmd_q *cmdq, *first = NULL, *last = NULL;
- struct cmd *cmd;
- u_int group = cmdq_next_group();
+ struct cmdq_item *item, *first = NULL, *last = NULL;
+ struct cmd *cmd;
+ u_int group = cmdq_next_group();
TAILQ_FOREACH(cmd, &cmdlist->list, qentry) {
- cmdq = xcalloc(1, sizeof *cmdq);
- cmdq->type = CMD_Q_COMMAND;
- cmdq->group = group;
- cmdq->flags = flags;
+ item = xcalloc(1, sizeof *item);
+ item->type = CMDQ_COMMAND;
+ item->group = group;
+ item->flags = flags;
- cmdq->cmdlist = cmdlist;
- cmdq->cmd = cmd;
+ item->cmdlist = cmdlist;
+ item->cmd = cmd;
if (current != NULL)
- cmd_find_copy_state(&cmdq->current, current);
+ cmd_find_copy_state(&item->current, current);
if (m != NULL)
- memcpy(&cmdq->mouse, m, sizeof cmdq->mouse);
+ memcpy(&item->mouse, m, sizeof item->mouse);
cmdlist->references++;
if (first == NULL)
- first = cmdq;
+ first = item;
if (last != NULL)
- last->next = cmdq;
- last = cmdq;
+ last->next = item;
+ last = item;
}
return (first);
}
/* Fire command on command queue. */
static enum cmd_retval
-cmdq_fire_command(struct cmd_q *cmdq)
+cmdq_fire_command(struct cmdq_item *item)
{
- struct client *c = cmdq->client;
- struct cmd *cmd = cmdq->cmd;
+ struct client *c = item->client;
+ struct cmd *cmd = item->cmd;
enum cmd_retval retval;
const char *name;
struct cmd_find_state *fsp, fs;
int flags;
flags = !!(cmd->flags & CMD_CONTROL);
- cmdq_guard(cmdq, "begin", flags);
+ cmdq_guard(item, "begin", flags);
- if (cmd_prepare_state(cmd, cmdq) != 0) {
+ if (cmd_prepare_state(cmd, item) != 0) {
retval = CMD_RETURN_ERROR;
goto out;
}
- if (cmdq->client == NULL)
- cmdq->client = cmd_find_client(cmdq, NULL, CMD_FIND_QUIET);
+ if (item->client == NULL)
+ item->client = cmd_find_client(item, NULL, CMD_FIND_QUIET);
- retval = cmd->entry->exec(cmd, cmdq);
+ retval = cmd->entry->exec(cmd, item);
if (retval == CMD_RETURN_ERROR)
goto out;
if (cmd->entry->flags & CMD_AFTERHOOK) {
name = cmd->entry->name;
- if (cmd_find_valid_state(&cmdq->state.tflag))
- fsp = &cmdq->state.tflag;
+ if (cmd_find_valid_state(&item->state.tflag))
+ fsp = &item->state.tflag;
else {
- if (cmd_find_current(&fs, cmdq, CMD_FIND_QUIET) != 0)
+ if (cmd_find_current(&fs, item, CMD_FIND_QUIET) != 0)
goto out;
fsp = &fs;
}
- hooks_insert(fsp->s->hooks, cmdq, fsp, "after-%s", name);
+ hooks_insert(fsp->s->hooks, item, fsp, "after-%s", name);
}
out:
- cmdq->client = c;
+ item->client = c;
if (retval == CMD_RETURN_ERROR)
- cmdq_guard(cmdq, "error", flags);
+ cmdq_guard(item, "error", flags);
else
- cmdq_guard(cmdq, "end", flags);
+ cmdq_guard(item, "end", flags);
return (retval);
}
/* Get a callback for the command queue. */
-struct cmd_q *
-cmdq_get_callback(cmd_q_cb cb, void *data)
+struct cmdq_item *
+cmdq_get_callback(cmdq_cb cb, void *data)
{
- struct cmd_q *cmdq;
+ struct cmdq_item *item;
- cmdq = xcalloc(1, sizeof *cmdq);
- cmdq->type = CMD_Q_CALLBACK;
- cmdq->group = 0;
- cmdq->flags = 0;
+ item = xcalloc(1, sizeof *item);
+ item->type = CMDQ_CALLBACK;
+ item->group = 0;
+ item->flags = 0;
- cmdq->cb = cb;
- cmdq->data = data;
+ item->cb = cb;
+ item->data = data;
- return (cmdq);
+ return (item);
}
/* Fire callback on callback queue. */
static enum cmd_retval
-cmdq_fire_callback(struct cmd_q *cmdq)
+cmdq_fire_callback(struct cmdq_item *item)
{
- return (cmdq->cb(cmdq, cmdq->data));
+ return (item->cb(item, item->data));
}
/* Process next item on command queue. */
u_int
cmdq_next(struct client *c)
{
- struct cmd_q_list *queue = cmdq_get(c);
+ struct cmdq_list *queue = cmdq_get(c);
const char *name = cmdq_name(c);
- struct cmd_q *cmdq;
+ struct cmdq_item *item;
enum cmd_retval retval;
u_int items = 0;
static u_int number;
@@ -256,63 +256,63 @@ cmdq_next(struct client *c)
log_debug("%s %s: empty", __func__, name);
return (0);
}
- if (TAILQ_FIRST(queue)->flags & CMD_Q_WAITING) {
+ if (TAILQ_FIRST(queue)->flags & CMDQ_WAITING) {
log_debug("%s %s: waiting", __func__, name);
return (0);
}
log_debug("%s %s: enter", __func__, name);
for (;;) {
- cmdq = TAILQ_FIRST(queue);
- if (cmdq == NULL)
+ item = TAILQ_FIRST(queue);
+ if (item == NULL)
break;
log_debug("%s %s: type %d, flags %x", __func__, name,
- cmdq->type, cmdq->flags);
+ item->type, item->flags);
/*
* Any item with the waiting flag set waits until an external
* event clears the flag (for example, a job - look at
* run-shell).
*/
- if (cmdq->flags & CMD_Q_WAITING)
+ if (item->flags & CMDQ_WAITING)
goto waiting;
/*
* Items are only fired once, once the fired flag is set, a
* waiting flag can only be cleared by an external event.
*/
- if (~cmdq->flags & CMD_Q_FIRED) {
- cmdq->time = time(NULL);
- cmdq->number = ++number;
+ if (~item->flags & CMDQ_FIRED) {
+ item->time = time(NULL);
+ item->number = ++number;
- switch (cmdq->type)
+ switch (item->type)
{
- case CMD_Q_COMMAND:
- retval = cmdq_fire_command(cmdq);
+ case CMDQ_COMMAND:
+ retval = cmdq_fire_command(item);
/*
* If a command returns an error, remove any
* subsequent commands in the same group.
*/
if (retval == CMD_RETURN_ERROR)
- cmdq_remove_group(cmdq);
+ cmdq_remove_group(item);
break;
- case CMD_Q_CALLBACK:
- retval = cmdq_fire_callback(cmdq);
+ case CMDQ_CALLBACK:
+ retval = cmdq_fire_callback(item);
break;
default:
retval = CMD_RETURN_ERROR;
break;
}
- cmdq->flags |= CMD_Q_FIRED;
+ item->flags |= CMDQ_FIRED;
if (retval == CMD_RETURN_WAIT) {
- cmdq->flags |= CMD_Q_WAITING;
+ item->flags |= CMDQ_WAITING;
goto waiting;
}
items++;
}
- cmdq_remove(cmdq);
+ cmdq_remove(item);
}
log_debug("%s %s: exit (empty)", __func__, name);
@@ -325,23 +325,23 @@ waiting:
/* Print a guard line. */
void
-cmdq_guard(struct cmd_q *cmdq, const char *guard, int flags)
+cmdq_guard(struct cmdq_item *item, const char *guard, int flags)
{
- struct client *c = cmdq->client;
+ struct client *c = item->client;
if (c == NULL || !(c->flags & CLIENT_CONTROL))
return;
evbuffer_add_printf(c->stdout_data, "%%%s %ld %u %d\n", guard,
- (long)cmdq->time, cmdq->number, flags);
+ (long)item->time, item->number, flags);
server_client_push_stdout(c);
}
/* Show message from command. */
void
-cmdq_print(struct cmd_q *cmdq, const char *fmt, ...)
+cmdq_print(struct cmdq_item *item, const char *fmt, ...)
{
- struct client *c = cmdq->client;
+ struct client *c = item->client;
struct window *w;
va_list ap;
char *tmp, *msg;
@@ -376,10 +376,10 @@ cmdq_print(struct cmd_q *cmdq, const char *fmt, ...)
/* Show error from command. */
void
-cmdq_error(struct cmd_q *cmdq, const char *fmt, ...)
+cmdq_error(struct cmdq_item *item, const char *fmt, ...)
{
- struct client *c = cmdq->client;
- struct cmd *cmd = cmdq->cmd;
+ struct client *c = item->client;
+ struct cmd *cmd = item->cmd;
va_list ap;
char *msg;
size_t msglen;
diff --git a/usr.bin/tmux/cmd-refresh-client.c b/usr.bin/tmux/cmd-refresh-client.c
index 5364dedbe3a..bdb8e9f2978 100644
--- a/usr.bin/tmux/cmd-refresh-client.c
+++ b/usr.bin/tmux/cmd-refresh-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-refresh-client.c,v 1.21 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-refresh-client.c,v 1.22 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -24,7 +24,7 @@
* Refresh client.
*/
-static enum cmd_retval cmd_refresh_client_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_refresh_client_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_refresh_client_entry = {
.name = "refresh-client",
@@ -40,29 +40,29 @@ const struct cmd_entry cmd_refresh_client_entry = {
};
static enum cmd_retval
-cmd_refresh_client_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_refresh_client_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct client *c = cmdq->state.c;
+ struct client *c = item->state.c;
const char *size;
u_int w, h;
if (args_has(args, 'C')) {
if ((size = args_get(args, 'C')) == NULL) {
- cmdq_error(cmdq, "missing size");
+ cmdq_error(item, "missing size");
return (CMD_RETURN_ERROR);
}
if (sscanf(size, "%u,%u", &w, &h) != 2) {
- cmdq_error(cmdq, "bad size argument");
+ cmdq_error(item, "bad size argument");
return (CMD_RETURN_ERROR);
}
if (w < PANE_MINIMUM || w > 5000 ||
h < PANE_MINIMUM || h > 5000) {
- cmdq_error(cmdq, "size too small or too big");
+ cmdq_error(item, "size too small or too big");
return (CMD_RETURN_ERROR);
}
if (!(c->flags & CLIENT_CONTROL)) {
- cmdq_error(cmdq, "not a control client");
+ cmdq_error(item, "not a control client");
return (CMD_RETURN_ERROR);
}
if (tty_set_size(&c->tty, w, h))
diff --git a/usr.bin/tmux/cmd-rename-session.c b/usr.bin/tmux/cmd-rename-session.c
index 78fe21d1b0b..e1de056bd40 100644
--- a/usr.bin/tmux/cmd-rename-session.c
+++ b/usr.bin/tmux/cmd-rename-session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-rename-session.c,v 1.22 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-rename-session.c,v 1.23 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -26,7 +26,8 @@
* Change session name.
*/
-static enum cmd_retval cmd_rename_session_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_rename_session_exec(struct cmd *,
+ struct cmdq_item *);
const struct cmd_entry cmd_rename_session_entry = {
.name = "rename-session",
@@ -42,19 +43,19 @@ const struct cmd_entry cmd_rename_session_entry = {
};
static enum cmd_retval
-cmd_rename_session_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_rename_session_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct session *s = cmdq->state.tflag.s;
+ struct session *s = item->state.tflag.s;
const char *newname;
newname = args->argv[0];
if (!session_check_name(newname)) {
- cmdq_error(cmdq, "bad session name: %s", newname);
+ cmdq_error(item, "bad session name: %s", newname);
return (CMD_RETURN_ERROR);
}
if (session_find(newname) != NULL) {
- cmdq_error(cmdq, "duplicate session: %s", newname);
+ cmdq_error(item, "duplicate session: %s", newname);
return (CMD_RETURN_ERROR);
}
diff --git a/usr.bin/tmux/cmd-rename-window.c b/usr.bin/tmux/cmd-rename-window.c
index fd0e56608f4..6291564cd8c 100644
--- a/usr.bin/tmux/cmd-rename-window.c
+++ b/usr.bin/tmux/cmd-rename-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-rename-window.c,v 1.18 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-rename-window.c,v 1.19 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -26,7 +26,8 @@
* Rename a window.
*/
-static enum cmd_retval cmd_rename_window_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_rename_window_exec(struct cmd *,
+ struct cmdq_item *);
const struct cmd_entry cmd_rename_window_entry = {
.name = "rename-window",
@@ -42,10 +43,10 @@ const struct cmd_entry cmd_rename_window_entry = {
};
static enum cmd_retval
-cmd_rename_window_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_rename_window_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct winlink *wl = cmdq->state.tflag.wl;
+ struct winlink *wl = item->state.tflag.wl;
window_set_name(wl->window, args->argv[0]);
options_set_number(wl->window->options, "automatic-rename", 0);
diff --git a/usr.bin/tmux/cmd-resize-pane.c b/usr.bin/tmux/cmd-resize-pane.c
index e6295c74a35..c3cabafa0e0 100644
--- a/usr.bin/tmux/cmd-resize-pane.c
+++ b/usr.bin/tmux/cmd-resize-pane.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-resize-pane.c,v 1.27 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: cmd-resize-pane.c,v 1.28 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -26,7 +26,7 @@
* Increase or decrease pane size.
*/
-static enum cmd_retval cmd_resize_pane_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_resize_pane_exec(struct cmd *, struct cmdq_item *);
static void cmd_resize_pane_mouse_update(struct client *,
struct mouse_event *);
@@ -46,26 +46,26 @@ const struct cmd_entry cmd_resize_pane_entry = {
};
static enum cmd_retval
-cmd_resize_pane_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_resize_pane_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct window_pane *wp = cmdq->state.tflag.wp;
- struct winlink *wl = cmdq->state.tflag.wl;
+ struct window_pane *wp = item->state.tflag.wp;
+ struct winlink *wl = item->state.tflag.wl;
struct window *w = wl->window;
- struct client *c = cmdq->client;
- struct session *s = cmdq->state.tflag.s;
+ struct client *c = item->client;
+ struct session *s = item->state.tflag.s;
const char *errstr;
char *cause;
u_int adjust;
int x, y;
if (args_has(args, 'M')) {
- if (cmd_mouse_window(&cmdq->mouse, &s) == NULL)
+ if (cmd_mouse_window(&item->mouse, &s) == NULL)
return (CMD_RETURN_NORMAL);
if (c == NULL || c->session != s)
return (CMD_RETURN_NORMAL);
c->tty.mouse_drag_update = cmd_resize_pane_mouse_update;
- cmd_resize_pane_mouse_update(c, &cmdq->mouse);
+ cmd_resize_pane_mouse_update(c, &item->mouse);
return (CMD_RETURN_NORMAL);
}
@@ -85,7 +85,7 @@ cmd_resize_pane_exec(struct cmd *self, struct cmd_q *cmdq)
else {
adjust = strtonum(args->argv[0], 1, INT_MAX, &errstr);
if (errstr != NULL) {
- cmdq_error(cmdq, "adjustment %s", errstr);
+ cmdq_error(item, "adjustment %s", errstr);
return (CMD_RETURN_ERROR);
}
}
@@ -94,7 +94,7 @@ cmd_resize_pane_exec(struct cmd *self, struct cmd_q *cmdq)
x = args_strtonum(self->args, 'x', PANE_MINIMUM, INT_MAX,
&cause);
if (cause != NULL) {
- cmdq_error(cmdq, "width %s", cause);
+ cmdq_error(item, "width %s", cause);
free(cause);
return (CMD_RETURN_ERROR);
}
@@ -104,7 +104,7 @@ cmd_resize_pane_exec(struct cmd *self, struct cmd_q *cmdq)
y = args_strtonum(self->args, 'y', PANE_MINIMUM, INT_MAX,
&cause);
if (cause != NULL) {
- cmdq_error(cmdq, "height %s", cause);
+ cmdq_error(item, "height %s", cause);
free(cause);
return (CMD_RETURN_ERROR);
}
diff --git a/usr.bin/tmux/cmd-respawn-pane.c b/usr.bin/tmux/cmd-respawn-pane.c
index 58ad36611fe..4c31d003f8d 100644
--- a/usr.bin/tmux/cmd-respawn-pane.c
+++ b/usr.bin/tmux/cmd-respawn-pane.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-respawn-pane.c,v 1.21 2016/10/10 21:51:39 nicm Exp $ */
+/* $OpenBSD: cmd-respawn-pane.c,v 1.22 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -28,7 +28,7 @@
* Respawn a pane (restart the command). Kill existing if -k given.
*/
-static enum cmd_retval cmd_respawn_pane_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_respawn_pane_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_respawn_pane_entry = {
.name = "respawn-pane",
@@ -44,13 +44,13 @@ const struct cmd_entry cmd_respawn_pane_entry = {
};
static enum cmd_retval
-cmd_respawn_pane_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_respawn_pane_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct winlink *wl = cmdq->state.tflag.wl;
+ struct winlink *wl = item->state.tflag.wl;
struct window *w = wl->window;
- struct window_pane *wp = cmdq->state.tflag.wp;
- struct session *s = cmdq->state.tflag.s;
+ struct window_pane *wp = item->state.tflag.wp;
+ struct session *s = item->state.tflag.s;
struct environ *env;
const char *path;
char *cause;
@@ -60,7 +60,7 @@ cmd_respawn_pane_exec(struct cmd *self, struct cmd_q *cmdq)
if (!args_has(self->args, 'k') && wp->fd != -1) {
if (window_pane_index(wp, &idx) != 0)
fatalx("index not found");
- cmdq_error(cmdq, "pane still active: %s:%d.%u",
+ cmdq_error(item, "pane still active: %s:%d.%u",
s->name, wl->idx, idx);
return (CMD_RETURN_ERROR);
}
@@ -75,8 +75,8 @@ cmd_respawn_pane_exec(struct cmd *self, struct cmd_q *cmdq)
input_init(wp);
path = NULL;
- if (cmdq->client != NULL && cmdq->client->session == NULL)
- envent = environ_find(cmdq->client->environ, "PATH");
+ if (item->client != NULL && item->client->session == NULL)
+ envent = environ_find(item->client->environ, "PATH");
else
envent = environ_find(s->environ, "PATH");
if (envent != NULL)
@@ -84,7 +84,7 @@ cmd_respawn_pane_exec(struct cmd *self, struct cmd_q *cmdq)
if (window_pane_spawn(wp, args->argc, args->argv, path, NULL, NULL, env,
s->tio, &cause) != 0) {
- cmdq_error(cmdq, "respawn pane failed: %s", cause);
+ cmdq_error(item, "respawn pane failed: %s", cause);
free(cause);
environ_free(env);
return (CMD_RETURN_ERROR);
diff --git a/usr.bin/tmux/cmd-respawn-window.c b/usr.bin/tmux/cmd-respawn-window.c
index 85260a8a77f..f398ee47da8 100644
--- a/usr.bin/tmux/cmd-respawn-window.c
+++ b/usr.bin/tmux/cmd-respawn-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-respawn-window.c,v 1.31 2016/10/10 21:51:39 nicm Exp $ */
+/* $OpenBSD: cmd-respawn-window.c,v 1.32 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -27,7 +27,8 @@
* Respawn a window (restart the command). Kill existing if -k given.
*/
-static enum cmd_retval cmd_respawn_window_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_respawn_window_exec(struct cmd *,
+ struct cmdq_item *);
const struct cmd_entry cmd_respawn_window_entry = {
.name = "respawn-window",
@@ -43,11 +44,11 @@ const struct cmd_entry cmd_respawn_window_entry = {
};
static enum cmd_retval
-cmd_respawn_window_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_respawn_window_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct session *s = cmdq->state.tflag.s;
- struct winlink *wl = cmdq->state.tflag.wl;
+ struct session *s = item->state.tflag.s;
+ struct winlink *wl = item->state.tflag.wl;
struct window *w = wl->window;
struct window_pane *wp;
struct environ *env;
@@ -59,7 +60,7 @@ cmd_respawn_window_exec(struct cmd *self, struct cmd_q *cmdq)
TAILQ_FOREACH(wp, &w->panes, entry) {
if (wp->fd == -1)
continue;
- cmdq_error(cmdq, "window still active: %s:%d", s->name,
+ cmdq_error(item, "window still active: %s:%d", s->name,
wl->idx);
return (CMD_RETURN_ERROR);
}
@@ -78,8 +79,8 @@ cmd_respawn_window_exec(struct cmd *self, struct cmd_q *cmdq)
window_pane_resize(wp, w->sx, w->sy);
path = NULL;
- if (cmdq->client != NULL && cmdq->client->session == NULL)
- envent = environ_find(cmdq->client->environ, "PATH");
+ if (item->client != NULL && item->client->session == NULL)
+ envent = environ_find(item->client->environ, "PATH");
else
envent = environ_find(s->environ, "PATH");
if (envent != NULL)
@@ -87,7 +88,7 @@ cmd_respawn_window_exec(struct cmd *self, struct cmd_q *cmdq)
if (window_pane_spawn(wp, args->argc, args->argv, path, NULL, NULL, env,
s->tio, &cause) != 0) {
- cmdq_error(cmdq, "respawn window failed: %s", cause);
+ cmdq_error(item, "respawn window failed: %s", cause);
free(cause);
environ_free(env);
server_destroy_pane(wp, 0);
diff --git a/usr.bin/tmux/cmd-rotate-window.c b/usr.bin/tmux/cmd-rotate-window.c
index 810df7b59ec..2327f65d75b 100644
--- a/usr.bin/tmux/cmd-rotate-window.c
+++ b/usr.bin/tmux/cmd-rotate-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-rotate-window.c,v 1.20 2016/10/10 21:51:39 nicm Exp $ */
+/* $OpenBSD: cmd-rotate-window.c,v 1.21 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -24,7 +24,8 @@
* Rotate the panes in a window.
*/
-static enum cmd_retval cmd_rotate_window_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_rotate_window_exec(struct cmd *,
+ struct cmdq_item *);
const struct cmd_entry cmd_rotate_window_entry = {
.name = "rotate-window",
@@ -40,9 +41,9 @@ const struct cmd_entry cmd_rotate_window_entry = {
};
static enum cmd_retval
-cmd_rotate_window_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_rotate_window_exec(struct cmd *self, struct cmdq_item *item)
{
- struct winlink *wl = cmdq->state.tflag.wl;
+ struct winlink *wl = item->state.tflag.wl;
struct window *w = wl->window;
struct window_pane *wp, *wp2;
struct layout_cell *lc;
diff --git a/usr.bin/tmux/cmd-run-shell.c b/usr.bin/tmux/cmd-run-shell.c
index 2afe8e13589..b32ce777888 100644
--- a/usr.bin/tmux/cmd-run-shell.c
+++ b/usr.bin/tmux/cmd-run-shell.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-run-shell.c,v 1.40 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: cmd-run-shell.c,v 1.41 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -29,7 +29,7 @@
* Runs a command without a window.
*/
-static enum cmd_retval cmd_run_shell_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_run_shell_exec(struct cmd *, struct cmdq_item *);
static void cmd_run_shell_callback(struct job *);
static void cmd_run_shell_free(void *);
@@ -49,9 +49,9 @@ const struct cmd_entry cmd_run_shell_entry = {
};
struct cmd_run_shell_data {
- char *cmd;
- struct cmd_q *cmdq;
- int wp_id;
+ char *cmd;
+ struct cmdq_item *item;
+ int wp_id;
};
static void
@@ -63,7 +63,7 @@ cmd_run_shell_print(struct job *job, const char *msg)
if (cdata->wp_id != -1)
wp = window_pane_find_by_id(cdata->wp_id);
if (wp == NULL) {
- cmdq_print(cdata->cmdq, "%s", msg);
+ cmdq_print(cdata->item, "%s", msg);
return;
}
@@ -74,26 +74,26 @@ cmd_run_shell_print(struct job *job, const char *msg)
}
static enum cmd_retval
-cmd_run_shell_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_run_shell_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
struct cmd_run_shell_data *cdata;
char *shellcmd;
- struct session *s = cmdq->state.tflag.s;
- struct winlink *wl = cmdq->state.tflag.wl;
- struct window_pane *wp = cmdq->state.tflag.wp;
+ struct session *s = item->state.tflag.s;
+ struct winlink *wl = item->state.tflag.wl;
+ struct window_pane *wp = item->state.tflag.wp;
struct format_tree *ft;
const char *cwd;
- if (cmdq->client != NULL && cmdq->client->session == NULL)
- cwd = cmdq->client->cwd;
+ if (item->client != NULL && item->client->session == NULL)
+ cwd = item->client->cwd;
else if (s != NULL)
cwd = s->cwd;
else
cwd = NULL;
- ft = format_create(cmdq, 0);
- format_defaults(ft, cmdq->state.c, s, wl, wp);
+ ft = format_create(item, 0);
+ format_defaults(ft, item->state.c, s, wl, wp);
shellcmd = format_expand(ft, args->argv[0]);
format_free(ft);
@@ -111,7 +111,7 @@ cmd_run_shell_exec(struct cmd *self, struct cmd_q *cmdq)
cdata->wp_id = -1;
if (!args_has(args, 'b'))
- cdata->cmdq = cmdq;
+ cdata->item = item;
job_run(shellcmd, s, cwd, cmd_run_shell_callback, cmd_run_shell_free,
cdata);
@@ -163,8 +163,8 @@ cmd_run_shell_callback(struct job *job)
cmd_run_shell_print(job, msg);
free(msg);
- if (cdata->cmdq != NULL)
- cdata->cmdq->flags &= ~CMD_Q_WAITING;
+ if (cdata->item != NULL)
+ cdata->item->flags &= ~CMDQ_WAITING;
}
static void
diff --git a/usr.bin/tmux/cmd-save-buffer.c b/usr.bin/tmux/cmd-save-buffer.c
index 9742cfc2d4c..13928c969c9 100644
--- a/usr.bin/tmux/cmd-save-buffer.c
+++ b/usr.bin/tmux/cmd-save-buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-save-buffer.c,v 1.39 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-save-buffer.c,v 1.40 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -32,7 +32,7 @@
* Saves a paste buffer to a file.
*/
-static enum cmd_retval cmd_save_buffer_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_save_buffer_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_save_buffer_entry = {
.name = "save-buffer",
@@ -57,10 +57,10 @@ const struct cmd_entry cmd_show_buffer_entry = {
};
static enum cmd_retval
-cmd_save_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_save_buffer_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct client *c = cmdq->client;
+ struct client *c = item->client;
struct session *s;
struct paste_buffer *pb;
const char *path, *bufname, *bufdata, *start, *end, *cwd;
@@ -71,14 +71,14 @@ cmd_save_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
if (!args_has(args, 'b')) {
if ((pb = paste_get_top(NULL)) == NULL) {
- cmdq_error(cmdq, "no buffers");
+ cmdq_error(item, "no buffers");
return (CMD_RETURN_ERROR);
}
} else {
bufname = args_get(args, 'b');
pb = paste_get_name(bufname);
if (pb == NULL) {
- cmdq_error(cmdq, "no buffer %s", bufname);
+ cmdq_error(item, "no buffer %s", bufname);
return (CMD_RETURN_ERROR);
}
}
@@ -90,7 +90,7 @@ cmd_save_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
path = args->argv[0];
if (strcmp(path, "-") == 0) {
if (c == NULL) {
- cmdq_error(cmdq, "can't write to stdout");
+ cmdq_error(item, "can't write to stdout");
return (CMD_RETURN_ERROR);
}
if (c->session == NULL || (c->flags & CLIENT_CONTROL))
@@ -115,18 +115,18 @@ cmd_save_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
xasprintf(&file, "%s/%s", cwd, path);
if (realpath(file, resolved) == NULL &&
strlcpy(resolved, file, sizeof resolved) >= sizeof resolved) {
- cmdq_error(cmdq, "%s: %s", file, strerror(ENAMETOOLONG));
+ cmdq_error(item, "%s: %s", file, strerror(ENAMETOOLONG));
return (CMD_RETURN_ERROR);
}
f = fopen(resolved, flags);
free(file);
if (f == NULL) {
- cmdq_error(cmdq, "%s: %s", resolved, strerror(errno));
+ cmdq_error(item, "%s: %s", resolved, strerror(errno));
return (CMD_RETURN_ERROR);
}
if (fwrite(bufdata, 1, bufsize, f) != bufsize) {
- cmdq_error(cmdq, "%s: write error", resolved);
+ cmdq_error(item, "%s: write error", resolved);
fclose(f);
return (CMD_RETURN_ERROR);
}
@@ -141,7 +141,7 @@ do_stdout:
do_print:
if (bufsize > (INT_MAX / 4) - 1) {
- cmdq_error(cmdq, "buffer too big");
+ cmdq_error(item, "buffer too big");
return (CMD_RETURN_ERROR);
}
msg = NULL;
@@ -159,7 +159,7 @@ do_print:
msg = xrealloc(msg, msglen);
strvisx(msg, start, size, VIS_OCTAL|VIS_TAB);
- cmdq_print(cmdq, "%s", msg);
+ cmdq_print(item, "%s", msg);
used += size + (end != NULL);
}
diff --git a/usr.bin/tmux/cmd-select-layout.c b/usr.bin/tmux/cmd-select-layout.c
index c7ee98a6a38..711fa5e9331 100644
--- a/usr.bin/tmux/cmd-select-layout.c
+++ b/usr.bin/tmux/cmd-select-layout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-select-layout.c,v 1.31 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-select-layout.c,v 1.32 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -26,7 +26,8 @@
* Switch window to selected layout.
*/
-static enum cmd_retval cmd_select_layout_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_select_layout_exec(struct cmd *,
+ struct cmdq_item *);
const struct cmd_entry cmd_select_layout_entry = {
.name = "select-layout",
@@ -68,10 +69,10 @@ const struct cmd_entry cmd_previous_layout_entry = {
};
static enum cmd_retval
-cmd_select_layout_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_select_layout_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct winlink *wl = cmdq->state.tflag.wl;
+ struct winlink *wl = item->state.tflag.wl;
struct window *w;
const char *layoutname;
char *oldlayout;
@@ -118,7 +119,7 @@ cmd_select_layout_exec(struct cmd *self, struct cmd_q *cmdq)
if (layoutname != NULL) {
if (layout_parse(w, layoutname) == -1) {
- cmdq_error(cmdq, "can't set layout: %s", layoutname);
+ cmdq_error(item, "can't set layout: %s", layoutname);
goto error;
}
goto changed;
diff --git a/usr.bin/tmux/cmd-select-pane.c b/usr.bin/tmux/cmd-select-pane.c
index 0d23e09f46c..a126be48a46 100644
--- a/usr.bin/tmux/cmd-select-pane.c
+++ b/usr.bin/tmux/cmd-select-pane.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-select-pane.c,v 1.33 2016/10/10 21:51:39 nicm Exp $ */
+/* $OpenBSD: cmd-select-pane.c,v 1.34 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -24,7 +24,7 @@
* Select pane.
*/
-static enum cmd_retval cmd_select_pane_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_select_pane_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_select_pane_entry = {
.name = "select-pane",
@@ -53,19 +53,19 @@ const struct cmd_entry cmd_last_pane_entry = {
};
static enum cmd_retval
-cmd_select_pane_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct winlink *wl = cmdq->state.tflag.wl;
+ struct winlink *wl = item->state.tflag.wl;
struct window *w = wl->window;
- struct session *s = cmdq->state.tflag.s;
- struct window_pane *wp = cmdq->state.tflag.wp, *lastwp, *markedwp;
+ struct session *s = item->state.tflag.s;
+ struct window_pane *wp = item->state.tflag.wp, *lastwp, *markedwp;
const char *style;
if (self->entry == &cmd_last_pane_entry || args_has(args, 'l')) {
if (wl->window->last == NULL) {
- cmdq_error(cmdq, "no last pane");
+ cmdq_error(item, "no last pane");
return (CMD_RETURN_ERROR);
}
@@ -112,13 +112,13 @@ cmd_select_pane_exec(struct cmd *self, struct cmd_q *cmdq)
style = args_get(args, 'P');
if (style_parse(&grid_default_cell, &wp->colgc,
style) == -1) {
- cmdq_error(cmdq, "bad style: %s", style);
+ cmdq_error(item, "bad style: %s", style);
return (CMD_RETURN_ERROR);
}
wp->flags |= PANE_REDRAW;
}
if (args_has(self->args, 'g'))
- cmdq_print(cmdq, "%s", style_tostring(&wp->colgc));
+ cmdq_print(item, "%s", style_tostring(&wp->colgc));
return (CMD_RETURN_NORMAL);
}
@@ -151,7 +151,7 @@ cmd_select_pane_exec(struct cmd *self, struct cmd_q *cmdq)
return (CMD_RETURN_NORMAL);
server_unzoom_window(wp->window);
if (!window_pane_visible(wp)) {
- cmdq_error(cmdq, "pane not visible");
+ cmdq_error(item, "pane not visible");
return (CMD_RETURN_ERROR);
}
window_redraw_active_switch(w, wp);
diff --git a/usr.bin/tmux/cmd-select-window.c b/usr.bin/tmux/cmd-select-window.c
index be85201f12e..44b2f76bbb1 100644
--- a/usr.bin/tmux/cmd-select-window.c
+++ b/usr.bin/tmux/cmd-select-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-select-window.c,v 1.17 2016/10/10 21:51:39 nicm Exp $ */
+/* $OpenBSD: cmd-select-window.c,v 1.18 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -26,7 +26,8 @@
* Select window by index.
*/
-static enum cmd_retval cmd_select_window_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_select_window_exec(struct cmd *,
+ struct cmdq_item *);
const struct cmd_entry cmd_select_window_entry = {
.name = "select-window",
@@ -81,10 +82,10 @@ const struct cmd_entry cmd_last_window_entry = {
};
static enum cmd_retval
-cmd_select_window_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_select_window_exec(struct cmd *self, struct cmdq_item *item)
{
- struct winlink *wl = cmdq->state.tflag.wl;
- struct session *s = cmdq->state.tflag.s;
+ struct winlink *wl = item->state.tflag.wl;
+ struct session *s = item->state.tflag.s;
int next, previous, last, activity;
next = self->entry == &cmd_next_window_entry;
@@ -101,17 +102,17 @@ cmd_select_window_exec(struct cmd *self, struct cmd_q *cmdq)
activity = args_has(self->args, 'a');
if (next) {
if (session_next(s, activity) != 0) {
- cmdq_error(cmdq, "no next window");
+ cmdq_error(item, "no next window");
return (CMD_RETURN_ERROR);
}
} else if (previous) {
if (session_previous(s, activity) != 0) {
- cmdq_error(cmdq, "no previous window");
+ cmdq_error(item, "no previous window");
return (CMD_RETURN_ERROR);
}
} else {
if (session_last(s) != 0) {
- cmdq_error(cmdq, "no last window");
+ cmdq_error(item, "no last window");
return (CMD_RETURN_ERROR);
}
}
@@ -124,7 +125,7 @@ cmd_select_window_exec(struct cmd *self, struct cmd_q *cmdq)
*/
if (args_has(self->args, 'T') && wl == s->curw) {
if (session_last(s) != 0) {
- cmdq_error(cmdq, "no last window");
+ cmdq_error(item, "no last window");
return (-1);
}
server_redraw_session(s);
diff --git a/usr.bin/tmux/cmd-send-keys.c b/usr.bin/tmux/cmd-send-keys.c
index 001f8b5afbd..eeeb5f437f6 100644
--- a/usr.bin/tmux/cmd-send-keys.c
+++ b/usr.bin/tmux/cmd-send-keys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-send-keys.c,v 1.32 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: cmd-send-keys.c,v 1.33 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -27,7 +27,7 @@
* Send keys to client.
*/
-static enum cmd_retval cmd_send_keys_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_send_keys_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_send_keys_entry = {
.name = "send-keys",
@@ -56,13 +56,13 @@ const struct cmd_entry cmd_send_prefix_entry = {
};
static enum cmd_retval
-cmd_send_keys_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_send_keys_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct client *c = cmdq->state.c;
- struct window_pane *wp = cmdq->state.tflag.wp;
- struct session *s = cmdq->state.tflag.s;
- struct mouse_event *m = &cmdq->mouse;
+ struct client *c = item->state.c;
+ struct window_pane *wp = item->state.tflag.wp;
+ struct session *s = item->state.tflag.s;
+ struct mouse_event *m = &item->mouse;
const u_char *keystr;
int i, literal;
key_code key;
@@ -71,12 +71,12 @@ cmd_send_keys_exec(struct cmd *self, struct cmd_q *cmdq)
if (args_has(args, 'N')) {
if (wp->mode == NULL || wp->mode->command == NULL) {
- cmdq_error(cmdq, "not in a mode");
+ cmdq_error(item, "not in a mode");
return (CMD_RETURN_ERROR);
}
np = args_strtonum(args, 'N', 1, UINT_MAX, &cause);
if (cause != NULL) {
- cmdq_error(cmdq, "prefix %s", cause);
+ cmdq_error(item, "prefix %s", cause);
free(cause);
return (CMD_RETURN_ERROR);
}
@@ -85,7 +85,7 @@ cmd_send_keys_exec(struct cmd *self, struct cmd_q *cmdq)
if (args_has(args, 'X')) {
if (wp->mode == NULL || wp->mode->command == NULL) {
- cmdq_error(cmdq, "not in a mode");
+ cmdq_error(item, "not in a mode");
return (CMD_RETURN_ERROR);
}
if (!m->valid)
@@ -101,7 +101,7 @@ cmd_send_keys_exec(struct cmd *self, struct cmd_q *cmdq)
if (args_has(args, 'M')) {
wp = cmd_mouse_pane(m, &s, NULL);
if (wp == NULL) {
- cmdq_error(cmdq, "no mouse target");
+ cmdq_error(item, "no mouse target");
return (CMD_RETURN_ERROR);
}
window_pane_key(wp, NULL, s, m->key, m);
diff --git a/usr.bin/tmux/cmd-set-buffer.c b/usr.bin/tmux/cmd-set-buffer.c
index 5c7c713606c..efac23ac849 100644
--- a/usr.bin/tmux/cmd-set-buffer.c
+++ b/usr.bin/tmux/cmd-set-buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-set-buffer.c,v 1.27 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-set-buffer.c,v 1.28 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -27,7 +27,7 @@
* Add, set, append to or delete a paste buffer.
*/
-static enum cmd_retval cmd_set_buffer_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_set_buffer_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_set_buffer_entry = {
.name = "set-buffer",
@@ -52,7 +52,7 @@ const struct cmd_entry cmd_delete_buffer_entry = {
};
static enum cmd_retval
-cmd_set_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_set_buffer_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
struct paste_buffer *pb;
@@ -70,7 +70,7 @@ cmd_set_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
if (pb == NULL)
pb = paste_get_top(&bufname);
if (pb == NULL) {
- cmdq_error(cmdq, "no buffer");
+ cmdq_error(item, "no buffer");
return (CMD_RETURN_ERROR);
}
paste_free(pb);
@@ -81,11 +81,11 @@ cmd_set_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
if (pb == NULL)
pb = paste_get_top(&bufname);
if (pb == NULL) {
- cmdq_error(cmdq, "no buffer");
+ cmdq_error(item, "no buffer");
return (CMD_RETURN_ERROR);
}
if (paste_rename(bufname, args_get(args, 'n'), &cause) != 0) {
- cmdq_error(cmdq, "%s", cause);
+ cmdq_error(item, "%s", cause);
free(cause);
return (CMD_RETURN_ERROR);
}
@@ -93,7 +93,7 @@ cmd_set_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
}
if (args->argc != 1) {
- cmdq_error(cmdq, "no data specified");
+ cmdq_error(item, "no data specified");
return (CMD_RETURN_ERROR);
}
if ((newsize = strlen(args->argv[0])) == 0)
@@ -113,7 +113,7 @@ cmd_set_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
bufsize += newsize;
if (paste_set(bufdata, bufsize, bufname, &cause) != 0) {
- cmdq_error(cmdq, "%s", cause);
+ cmdq_error(item, "%s", cause);
free(bufdata);
free(cause);
return (CMD_RETURN_ERROR);
diff --git a/usr.bin/tmux/cmd-set-environment.c b/usr.bin/tmux/cmd-set-environment.c
index 9d3cf2ade1c..0690384b8ba 100644
--- a/usr.bin/tmux/cmd-set-environment.c
+++ b/usr.bin/tmux/cmd-set-environment.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-set-environment.c,v 1.20 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-set-environment.c,v 1.21 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -27,7 +27,8 @@
* Set an environment variable.
*/
-static enum cmd_retval cmd_set_environment_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_set_environment_exec(struct cmd *,
+ struct cmdq_item *);
const struct cmd_entry cmd_set_environment_entry = {
.name = "set-environment",
@@ -43,7 +44,7 @@ const struct cmd_entry cmd_set_environment_entry = {
};
static enum cmd_retval
-cmd_set_environment_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_set_environment_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
struct environ *env;
@@ -51,11 +52,11 @@ cmd_set_environment_exec(struct cmd *self, struct cmd_q *cmdq)
name = args->argv[0];
if (*name == '\0') {
- cmdq_error(cmdq, "empty variable name");
+ cmdq_error(item, "empty variable name");
return (CMD_RETURN_ERROR);
}
if (strchr(name, '=') != NULL) {
- cmdq_error(cmdq, "variable name contains =");
+ cmdq_error(item, "variable name contains =");
return (CMD_RETURN_ERROR);
}
@@ -67,32 +68,32 @@ cmd_set_environment_exec(struct cmd *self, struct cmd_q *cmdq)
if (args_has(self->args, 'g'))
env = global_environ;
else {
- if (cmdq->state.tflag.s == NULL) {
+ if (item->state.tflag.s == NULL) {
target = args_get(args, 't');
if (target != NULL)
- cmdq_error(cmdq, "no such session: %s", target);
+ cmdq_error(item, "no such session: %s", target);
else
- cmdq_error(cmdq, "no current session");
+ cmdq_error(item, "no current session");
return (CMD_RETURN_ERROR);
}
- env = cmdq->state.tflag.s->environ;
+ env = item->state.tflag.s->environ;
}
if (args_has(self->args, 'u')) {
if (value != NULL) {
- cmdq_error(cmdq, "can't specify a value with -u");
+ cmdq_error(item, "can't specify a value with -u");
return (CMD_RETURN_ERROR);
}
environ_unset(env, name);
} else if (args_has(self->args, 'r')) {
if (value != NULL) {
- cmdq_error(cmdq, "can't specify a value with -r");
+ cmdq_error(item, "can't specify a value with -r");
return (CMD_RETURN_ERROR);
}
environ_clear(env, name);
} else {
if (value == NULL) {
- cmdq_error(cmdq, "no value specified");
+ cmdq_error(item, "no value specified");
return (CMD_RETURN_ERROR);
}
environ_set(env, name, "%s", value);
diff --git a/usr.bin/tmux/cmd-set-hook.c b/usr.bin/tmux/cmd-set-hook.c
index 5cd7c004ac0..f8a9f1d7442 100644
--- a/usr.bin/tmux/cmd-set-hook.c
+++ b/usr.bin/tmux/cmd-set-hook.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-set-hook.c,v 1.8 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-set-hook.c,v 1.9 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2012 Thomas Adam <thomas@xteddy.org>
@@ -27,7 +27,7 @@
* Set or show global or session hooks.
*/
-static enum cmd_retval cmd_set_hook_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_set_hook_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_set_hook_entry = {
.name = "set-hook",
@@ -56,7 +56,7 @@ const struct cmd_entry cmd_show_hooks_entry = {
};
static enum cmd_retval
-cmd_set_hook_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_set_hook_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
struct cmd_list *cmdlist;
@@ -68,22 +68,22 @@ cmd_set_hook_exec(struct cmd *self, struct cmd_q *cmdq)
if (args_has(args, 'g'))
hooks = global_hooks;
else {
- if (cmdq->state.tflag.s == NULL) {
+ if (item->state.tflag.s == NULL) {
target = args_get(args, 't');
if (target != NULL)
- cmdq_error(cmdq, "no such session: %s", target);
+ cmdq_error(item, "no such session: %s", target);
else
- cmdq_error(cmdq, "no current session");
+ cmdq_error(item, "no current session");
return (CMD_RETURN_ERROR);
}
- hooks = cmdq->state.tflag.s->hooks;
+ hooks = item->state.tflag.s->hooks;
}
if (self->entry == &cmd_show_hooks_entry) {
hook = hooks_first(hooks);
while (hook != NULL) {
tmp = cmd_list_print(hook->cmdlist);
- cmdq_print(cmdq, "%s -> %s", hook->name, tmp);
+ cmdq_print(item, "%s -> %s", hook->name, tmp);
free(tmp);
hook = hooks_next(hook);
@@ -93,7 +93,7 @@ cmd_set_hook_exec(struct cmd *self, struct cmd_q *cmdq)
name = args->argv[0];
if (*name == '\0') {
- cmdq_error(cmdq, "invalid hook name");
+ cmdq_error(item, "invalid hook name");
return (CMD_RETURN_ERROR);
}
if (args->argc < 2)
@@ -103,7 +103,7 @@ cmd_set_hook_exec(struct cmd *self, struct cmd_q *cmdq)
if (args_has(args, 'u')) {
if (cmd != NULL) {
- cmdq_error(cmdq, "command passed to unset hook: %s",
+ cmdq_error(item, "command passed to unset hook: %s",
name);
return (CMD_RETURN_ERROR);
}
@@ -112,12 +112,12 @@ cmd_set_hook_exec(struct cmd *self, struct cmd_q *cmdq)
}
if (cmd == NULL) {
- cmdq_error(cmdq, "no command to set hook: %s", name);
+ cmdq_error(item, "no command to set hook: %s", name);
return (CMD_RETURN_ERROR);
}
if (cmd_string_parse(cmd, &cmdlist, NULL, 0, &cause) != 0) {
if (cause != NULL) {
- cmdq_error(cmdq, "%s", cause);
+ cmdq_error(item, "%s", cause);
free(cause);
}
return (CMD_RETURN_ERROR);
diff --git a/usr.bin/tmux/cmd-set-option.c b/usr.bin/tmux/cmd-set-option.c
index 8ff43ce5f39..b7f3b8d86e9 100644
--- a/usr.bin/tmux/cmd-set-option.c
+++ b/usr.bin/tmux/cmd-set-option.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-set-option.c,v 1.100 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-set-option.c,v 1.101 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -27,42 +27,42 @@
* Set an option.
*/
-static enum cmd_retval cmd_set_option_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_set_option_exec(struct cmd *, struct cmdq_item *);
-static enum cmd_retval cmd_set_option_user(struct cmd *, struct cmd_q *,
- const char *, const char *);
+static enum cmd_retval cmd_set_option_user(struct cmd *, struct cmdq_item *,
+ const char *, const char *);
-static int cmd_set_option_unset(struct cmd *, struct cmd_q *,
+static int cmd_set_option_unset(struct cmd *, struct cmdq_item *,
const struct options_table_entry *, struct options *,
const char *);
-static int cmd_set_option_set(struct cmd *, struct cmd_q *,
+static int cmd_set_option_set(struct cmd *, struct cmdq_item *,
const struct options_table_entry *, struct options *,
const char *);
-static struct options_entry *cmd_set_option_string(struct cmd *, struct cmd_q *,
- const struct options_table_entry *, struct options *,
- const char *);
-static struct options_entry *cmd_set_option_number(struct cmd *, struct cmd_q *,
- const struct options_table_entry *, struct options *,
- const char *);
-static struct options_entry *cmd_set_option_key(struct cmd *, struct cmd_q *,
- const struct options_table_entry *, struct options *,
- const char *);
-static struct options_entry *cmd_set_option_colour(struct cmd *, struct cmd_q *,
- const struct options_table_entry *, struct options *,
- const char *);
+static struct options_entry *cmd_set_option_string(struct cmd *,
+ struct cmdq_item *, const struct options_table_entry *,
+ struct options *, const char *);
+static struct options_entry *cmd_set_option_number(struct cmd *,
+ struct cmdq_item *, const struct options_table_entry *,
+ struct options *, const char *);
+static struct options_entry *cmd_set_option_key(struct cmd *,
+ struct cmdq_item *, const struct options_table_entry *,
+ struct options *, const char *);
+static struct options_entry *cmd_set_option_colour(struct cmd *,
+ struct cmdq_item *, const struct options_table_entry *,
+ struct options *, const char *);
static struct options_entry *cmd_set_option_attributes(struct cmd *,
- struct cmd_q *, const struct options_table_entry *,
+ struct cmdq_item *, const struct options_table_entry *,
+ struct options *, const char *);
+static struct options_entry *cmd_set_option_flag(struct cmd *,
+ struct cmdq_item *, const struct options_table_entry *,
+ struct options *, const char *);
+static struct options_entry *cmd_set_option_choice(struct cmd *,
+ struct cmdq_item *, const struct options_table_entry *,
+ struct options *, const char *);
+static struct options_entry *cmd_set_option_style(struct cmd *,
+ struct cmdq_item *, const struct options_table_entry *,
struct options *, const char *);
-static struct options_entry *cmd_set_option_flag(struct cmd *, struct cmd_q *,
- const struct options_table_entry *, struct options *,
- const char *);
-static struct options_entry *cmd_set_option_choice(struct cmd *, struct cmd_q *,
- const struct options_table_entry *, struct options *,
- const char *);
-static struct options_entry *cmd_set_option_style(struct cmd *, struct cmd_q *,
- const struct options_table_entry *, struct options *,
- const char *);
const struct cmd_entry cmd_set_option_entry = {
.name = "set-option",
@@ -91,11 +91,11 @@ const struct cmd_entry cmd_set_window_option_entry = {
};
static enum cmd_retval
-cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_set_option_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct session *s = cmdq->state.tflag.s;
- struct winlink *wl = cmdq->state.tflag.wl;
+ struct session *s = item->state.tflag.s;
+ struct winlink *wl = item->state.tflag.wl;
struct window *w;
struct client *c;
const struct options_table_entry *oe;
@@ -105,7 +105,7 @@ cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq)
/* Get the option name and value. */
optstr = args->argv[0];
if (*optstr == '\0') {
- cmdq_error(cmdq, "invalid option");
+ cmdq_error(item, "invalid option");
return (CMD_RETURN_ERROR);
}
if (args->argc < 2)
@@ -115,20 +115,20 @@ cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq)
/* Is this a user option? */
if (*optstr == '@')
- return (cmd_set_option_user(self, cmdq, optstr, valstr));
+ return (cmd_set_option_user(self, item, optstr, valstr));
/* Find the option entry, try each table. */
oe = NULL;
if (options_table_find(optstr, &oe) != 0) {
if (!args_has(args, 'q')) {
- cmdq_error(cmdq, "ambiguous option: %s", optstr);
+ cmdq_error(item, "ambiguous option: %s", optstr);
return (CMD_RETURN_ERROR);
}
return (CMD_RETURN_NORMAL);
}
if (oe == NULL) {
if (!args_has(args, 'q')) {
- cmdq_error(cmdq, "unknown option: %s", optstr);
+ cmdq_error(item, "unknown option: %s", optstr);
return (CMD_RETURN_ERROR);
}
return (CMD_RETURN_NORMAL);
@@ -143,10 +143,10 @@ cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq)
else if (wl == NULL) {
target = args_get(args, 't');
if (target != NULL) {
- cmdq_error(cmdq, "no such window: %s",
+ cmdq_error(item, "no such window: %s",
target);
} else
- cmdq_error(cmdq, "no current window");
+ cmdq_error(item, "no current window");
return (CMD_RETURN_ERROR);
} else
oo = wl->window->options;
@@ -156,31 +156,31 @@ cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq)
else if (s == NULL) {
target = args_get(args, 't');
if (target != NULL) {
- cmdq_error(cmdq, "no such session: %s",
+ cmdq_error(item, "no such session: %s",
target);
} else
- cmdq_error(cmdq, "no current session");
+ cmdq_error(item, "no current session");
return (CMD_RETURN_ERROR);
} else
oo = s->options;
} else {
- cmdq_error(cmdq, "unknown table");
+ cmdq_error(item, "unknown table");
return (CMD_RETURN_ERROR);
}
/* Unset or set the option. */
if (args_has(args, 'u')) {
- if (cmd_set_option_unset(self, cmdq, oe, oo, valstr) != 0)
+ if (cmd_set_option_unset(self, item, oe, oo, valstr) != 0)
return (CMD_RETURN_ERROR);
} else {
if (args_has(args, 'o') && options_find1(oo, optstr) != NULL) {
if (!args_has(args, 'q')) {
- cmdq_error(cmdq, "already set: %s", optstr);
+ cmdq_error(item, "already set: %s", optstr);
return (CMD_RETURN_ERROR);
}
return (CMD_RETURN_NORMAL);
}
- if (cmd_set_option_set(self, cmdq, oe, oo, valstr) != 0)
+ if (cmd_set_option_set(self, item, oe, oo, valstr) != 0)
return (CMD_RETURN_ERROR);
}
@@ -224,12 +224,12 @@ cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq)
/* Set user option. */
static enum cmd_retval
-cmd_set_option_user(struct cmd *self, struct cmd_q *cmdq, const char *optstr,
- const char *valstr)
+cmd_set_option_user(struct cmd *self, struct cmdq_item *item,
+ const char *optstr, const char *valstr)
{
struct args *args = self->args;
- struct session *s = cmdq->state.tflag.s;
- struct winlink *wl = cmdq->state.tflag.wl;
+ struct session *s = item->state.tflag.s;
+ struct winlink *wl = item->state.tflag.wl;
struct options *oo;
struct options_entry *o;
const char *target;
@@ -243,10 +243,10 @@ cmd_set_option_user(struct cmd *self, struct cmd_q *cmdq, const char *optstr,
else if (wl == NULL) {
target = args_get(args, 't');
if (target != NULL) {
- cmdq_error(cmdq, "no such window: %s",
+ cmdq_error(item, "no such window: %s",
target);
} else
- cmdq_error(cmdq, "no current window");
+ cmdq_error(item, "no current window");
return (CMD_RETURN_ERROR);
} else
oo = wl->window->options;
@@ -256,10 +256,10 @@ cmd_set_option_user(struct cmd *self, struct cmd_q *cmdq, const char *optstr,
else if (s == NULL) {
target = args_get(args, 't');
if (target != NULL) {
- cmdq_error(cmdq, "no such session: %s",
+ cmdq_error(item, "no such session: %s",
target);
} else
- cmdq_error(cmdq, "no current session");
+ cmdq_error(item, "no current session");
return (CMD_RETURN_ERROR);
} else
oo = s->options;
@@ -268,13 +268,13 @@ cmd_set_option_user(struct cmd *self, struct cmd_q *cmdq, const char *optstr,
if (args_has(args, 'u')) {
if (options_find1(oo, optstr) == NULL) {
if (!args_has(args, 'q')) {
- cmdq_error(cmdq, "unknown option: %s", optstr);
+ cmdq_error(item, "unknown option: %s", optstr);
return (CMD_RETURN_ERROR);
}
return (CMD_RETURN_NORMAL);
}
if (valstr != NULL) {
- cmdq_error(cmdq, "value passed to unset option: %s",
+ cmdq_error(item, "value passed to unset option: %s",
optstr);
return (CMD_RETURN_ERROR);
}
@@ -283,13 +283,13 @@ cmd_set_option_user(struct cmd *self, struct cmd_q *cmdq, const char *optstr,
o = options_find1(oo, optstr);
if (args_has(args, 'o') && o != NULL) {
if (!args_has(args, 'q')) {
- cmdq_error(cmdq, "already set: %s", optstr);
+ cmdq_error(item, "already set: %s", optstr);
return (CMD_RETURN_ERROR);
}
return (CMD_RETURN_NORMAL);
}
if (valstr == NULL) {
- cmdq_error(cmdq, "empty value");
+ cmdq_error(item, "empty value");
return (CMD_RETURN_ERROR);
}
if (o != NULL && args_has(args, 'a'))
@@ -302,14 +302,14 @@ cmd_set_option_user(struct cmd *self, struct cmd_q *cmdq, const char *optstr,
/* Unset an option. */
static int
-cmd_set_option_unset(struct cmd *self, struct cmd_q *cmdq,
+cmd_set_option_unset(struct cmd *self, struct cmdq_item *item,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{
struct args *args = self->args;
if (value != NULL) {
- cmdq_error(cmdq, "value passed to unset option: %s", oe->name);
+ cmdq_error(item, "value passed to unset option: %s", oe->name);
return (-1);
}
@@ -332,7 +332,7 @@ cmd_set_option_unset(struct cmd *self, struct cmd_q *cmdq,
/* Set an option. */
static int
-cmd_set_option_set(struct cmd *self, struct cmd_q *cmdq,
+cmd_set_option_set(struct cmd *self, struct cmdq_item *item,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{
@@ -344,7 +344,7 @@ cmd_set_option_set(struct cmd *self, struct cmd_q *cmdq,
break;
default:
if (value == NULL) {
- cmdq_error(cmdq, "empty value");
+ cmdq_error(item, "empty value");
return (-1);
}
}
@@ -352,32 +352,32 @@ cmd_set_option_set(struct cmd *self, struct cmd_q *cmdq,
o = NULL;
switch (oe->type) {
case OPTIONS_TABLE_STRING:
- o = cmd_set_option_string(self, cmdq, oe, oo, value);
+ o = cmd_set_option_string(self, item, oe, oo, value);
break;
case OPTIONS_TABLE_NUMBER:
- o = cmd_set_option_number(self, cmdq, oe, oo, value);
+ o = cmd_set_option_number(self, item, oe, oo, value);
break;
case OPTIONS_TABLE_KEY:
- o = cmd_set_option_key(self, cmdq, oe, oo, value);
+ o = cmd_set_option_key(self, item, oe, oo, value);
break;
case OPTIONS_TABLE_COLOUR:
- o = cmd_set_option_colour(self, cmdq, oe, oo, value);
+ o = cmd_set_option_colour(self, item, oe, oo, value);
if (o != NULL)
style_update_new(oo, o->name, oe->style);
break;
case OPTIONS_TABLE_ATTRIBUTES:
- o = cmd_set_option_attributes(self, cmdq, oe, oo, value);
+ o = cmd_set_option_attributes(self, item, oe, oo, value);
if (o != NULL)
style_update_new(oo, o->name, oe->style);
break;
case OPTIONS_TABLE_FLAG:
- o = cmd_set_option_flag(self, cmdq, oe, oo, value);
+ o = cmd_set_option_flag(self, item, oe, oo, value);
break;
case OPTIONS_TABLE_CHOICE:
- o = cmd_set_option_choice(self, cmdq, oe, oo, value);
+ o = cmd_set_option_choice(self, item, oe, oo, value);
break;
case OPTIONS_TABLE_STYLE:
- o = cmd_set_option_style(self, cmdq, oe, oo, value);
+ o = cmd_set_option_style(self, item, oe, oo, value);
break;
}
if (o == NULL)
@@ -387,7 +387,7 @@ cmd_set_option_set(struct cmd *self, struct cmd_q *cmdq,
/* Set a string option. */
static struct options_entry *
-cmd_set_option_string(struct cmd *self, __unused struct cmd_q *cmdq,
+cmd_set_option_string(struct cmd *self, __unused struct cmdq_item *item,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{
@@ -409,7 +409,7 @@ cmd_set_option_string(struct cmd *self, __unused struct cmd_q *cmdq,
/* Set a number option. */
static struct options_entry *
-cmd_set_option_number(__unused struct cmd *self, struct cmd_q *cmdq,
+cmd_set_option_number(__unused struct cmd *self, struct cmdq_item *item,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{
@@ -418,7 +418,7 @@ cmd_set_option_number(__unused struct cmd *self, struct cmd_q *cmdq,
ll = strtonum(value, oe->minimum, oe->maximum, &errstr);
if (errstr != NULL) {
- cmdq_error(cmdq, "value is %s: %s", errstr, value);
+ cmdq_error(item, "value is %s: %s", errstr, value);
return (NULL);
}
@@ -427,7 +427,7 @@ cmd_set_option_number(__unused struct cmd *self, struct cmd_q *cmdq,
/* Set a key option. */
static struct options_entry *
-cmd_set_option_key(__unused struct cmd *self, struct cmd_q *cmdq,
+cmd_set_option_key(__unused struct cmd *self, struct cmdq_item *item,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{
@@ -435,7 +435,7 @@ cmd_set_option_key(__unused struct cmd *self, struct cmd_q *cmdq,
key = key_string_lookup_string(value);
if (key == KEYC_UNKNOWN) {
- cmdq_error(cmdq, "bad key: %s", value);
+ cmdq_error(item, "bad key: %s", value);
return (NULL);
}
@@ -444,14 +444,14 @@ cmd_set_option_key(__unused struct cmd *self, struct cmd_q *cmdq,
/* Set a colour option. */
static struct options_entry *
-cmd_set_option_colour(__unused struct cmd *self, struct cmd_q *cmdq,
+cmd_set_option_colour(__unused struct cmd *self, struct cmdq_item *item,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{
int colour;
if ((colour = colour_fromstring(value)) == -1) {
- cmdq_error(cmdq, "bad colour: %s", value);
+ cmdq_error(item, "bad colour: %s", value);
return (NULL);
}
@@ -460,14 +460,14 @@ cmd_set_option_colour(__unused struct cmd *self, struct cmd_q *cmdq,
/* Set an attributes option. */
static struct options_entry *
-cmd_set_option_attributes(__unused struct cmd *self, struct cmd_q *cmdq,
+cmd_set_option_attributes(__unused struct cmd *self, struct cmdq_item *item,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{
int attr;
if ((attr = attributes_fromstring(value)) == -1) {
- cmdq_error(cmdq, "bad attributes: %s", value);
+ cmdq_error(item, "bad attributes: %s", value);
return (NULL);
}
@@ -476,7 +476,7 @@ cmd_set_option_attributes(__unused struct cmd *self, struct cmd_q *cmdq,
/* Set a flag option. */
static struct options_entry *
-cmd_set_option_flag(__unused struct cmd *self, struct cmd_q *cmdq,
+cmd_set_option_flag(__unused struct cmd *self, struct cmdq_item *item,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{
@@ -494,7 +494,7 @@ cmd_set_option_flag(__unused struct cmd *self, struct cmd_q *cmdq,
strcasecmp(value, "no") == 0)
flag = 0;
else {
- cmdq_error(cmdq, "bad value: %s", value);
+ cmdq_error(item, "bad value: %s", value);
return (NULL);
}
}
@@ -504,7 +504,7 @@ cmd_set_option_flag(__unused struct cmd *self, struct cmd_q *cmdq,
/* Set a choice option. */
static struct options_entry *
-cmd_set_option_choice(__unused struct cmd *self, struct cmd_q *cmdq,
+cmd_set_option_choice(__unused struct cmd *self, struct cmdq_item *item,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{
@@ -523,13 +523,13 @@ cmd_set_option_choice(__unused struct cmd *self, struct cmd_q *cmdq,
continue;
if (choice != -1) {
- cmdq_error(cmdq, "ambiguous value: %s", value);
+ cmdq_error(item, "ambiguous value: %s", value);
return (NULL);
}
choice = n - 1;
}
if (choice == -1) {
- cmdq_error(cmdq, "unknown value: %s", value);
+ cmdq_error(item, "unknown value: %s", value);
return (NULL);
}
}
@@ -539,7 +539,7 @@ cmd_set_option_choice(__unused struct cmd *self, struct cmd_q *cmdq,
/* Set a style option. */
static struct options_entry *
-cmd_set_option_style(struct cmd *self, struct cmd_q *cmdq,
+cmd_set_option_style(struct cmd *self, struct cmdq_item *item,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{
@@ -549,7 +549,7 @@ cmd_set_option_style(struct cmd *self, struct cmd_q *cmdq,
append = args_has(args, 'a');
if ((o = options_set_style(oo, oe->name, value, append)) == NULL) {
- cmdq_error(cmdq, "bad style: %s", value);
+ cmdq_error(item, "bad style: %s", value);
return (NULL);
}
diff --git a/usr.bin/tmux/cmd-show-environment.c b/usr.bin/tmux/cmd-show-environment.c
index 8df9aec62b6..3429f7a3f86 100644
--- a/usr.bin/tmux/cmd-show-environment.c
+++ b/usr.bin/tmux/cmd-show-environment.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-show-environment.c,v 1.21 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-show-environment.c,v 1.22 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -27,10 +27,11 @@
* Show environment.
*/
-static enum cmd_retval cmd_show_environment_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_show_environment_exec(struct cmd *,
+ struct cmdq_item *);
static char *cmd_show_environment_escape(struct environ_entry *);
-static void cmd_show_environment_print(struct cmd *, struct cmd_q *,
+static void cmd_show_environment_print(struct cmd *, struct cmdq_item *,
struct environ_entry *);
const struct cmd_entry cmd_show_environment_entry = {
@@ -65,30 +66,30 @@ cmd_show_environment_escape(struct environ_entry *envent)
}
static void
-cmd_show_environment_print(struct cmd *self, struct cmd_q *cmdq,
+cmd_show_environment_print(struct cmd *self, struct cmdq_item *item,
struct environ_entry *envent)
{
char *escaped;
if (!args_has(self->args, 's')) {
if (envent->value != NULL)
- cmdq_print(cmdq, "%s=%s", envent->name, envent->value);
+ cmdq_print(item, "%s=%s", envent->name, envent->value);
else
- cmdq_print(cmdq, "-%s", envent->name);
+ cmdq_print(item, "-%s", envent->name);
return;
}
if (envent->value != NULL) {
escaped = cmd_show_environment_escape(envent);
- cmdq_print(cmdq, "%s=\"%s\"; export %s;", envent->name, escaped,
+ cmdq_print(item, "%s=\"%s\"; export %s;", envent->name, escaped,
envent->name);
free(escaped);
} else
- cmdq_print(cmdq, "unset %s;", envent->name);
+ cmdq_print(item, "unset %s;", envent->name);
}
static enum cmd_retval
-cmd_show_environment_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_show_environment_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
struct environ *env;
@@ -96,8 +97,8 @@ cmd_show_environment_exec(struct cmd *self, struct cmd_q *cmdq)
const char *target;
if ((target = args_get(args, 't')) != NULL) {
- if (cmdq->state.tflag.s == NULL) {
- cmdq_error(cmdq, "no such session: %s", target);
+ if (item->state.tflag.s == NULL) {
+ cmdq_error(item, "no such session: %s", target);
return (CMD_RETURN_ERROR);
}
}
@@ -105,30 +106,30 @@ cmd_show_environment_exec(struct cmd *self, struct cmd_q *cmdq)
if (args_has(self->args, 'g'))
env = global_environ;
else {
- if (cmdq->state.tflag.s == NULL) {
+ if (item->state.tflag.s == NULL) {
target = args_get(args, 't');
if (target != NULL)
- cmdq_error(cmdq, "no such session: %s", target);
+ cmdq_error(item, "no such session: %s", target);
else
- cmdq_error(cmdq, "no current session");
+ cmdq_error(item, "no current session");
return (CMD_RETURN_ERROR);
}
- env = cmdq->state.tflag.s->environ;
+ env = item->state.tflag.s->environ;
}
if (args->argc != 0) {
envent = environ_find(env, args->argv[0]);
if (envent == NULL) {
- cmdq_error(cmdq, "unknown variable: %s", args->argv[0]);
+ cmdq_error(item, "unknown variable: %s", args->argv[0]);
return (CMD_RETURN_ERROR);
}
- cmd_show_environment_print(self, cmdq, envent);
+ cmd_show_environment_print(self, item, envent);
return (CMD_RETURN_NORMAL);
}
envent = environ_first(env);
while (envent != NULL) {
- cmd_show_environment_print(self, cmdq, envent);
+ cmd_show_environment_print(self, item, envent);
envent = environ_next(envent);
}
return (CMD_RETURN_NORMAL);
diff --git a/usr.bin/tmux/cmd-show-messages.c b/usr.bin/tmux/cmd-show-messages.c
index 586ca265a84..be066f0dd05 100644
--- a/usr.bin/tmux/cmd-show-messages.c
+++ b/usr.bin/tmux/cmd-show-messages.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-show-messages.c,v 1.22 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-show-messages.c,v 1.23 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -29,7 +29,8 @@
* Show client message log.
*/
-static enum cmd_retval cmd_show_messages_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_show_messages_exec(struct cmd *,
+ struct cmdq_item *);
const struct cmd_entry cmd_show_messages_entry = {
.name = "show-messages",
@@ -55,11 +56,11 @@ const struct cmd_entry cmd_server_info_entry = {
.exec = cmd_show_messages_exec
};
-static int cmd_show_messages_terminals(struct cmd_q *, int);
-static int cmd_show_messages_jobs(struct cmd_q *, int);
+static int cmd_show_messages_terminals(struct cmdq_item *, int);
+static int cmd_show_messages_jobs(struct cmdq_item *, int);
static int
-cmd_show_messages_terminals(struct cmd_q *cmdq, int blank)
+cmd_show_messages_terminals(struct cmdq_item *item, int blank)
{
struct tty_term *term;
u_int i, n;
@@ -67,20 +68,20 @@ cmd_show_messages_terminals(struct cmd_q *cmdq, int blank)
n = 0;
LIST_FOREACH(term, &tty_terms, entry) {
if (blank) {
- cmdq_print(cmdq, "%s", "");
+ cmdq_print(item, "%s", "");
blank = 0;
}
- cmdq_print(cmdq, "Terminal %u: %s [references=%u, flags=0x%x]:",
+ cmdq_print(item, "Terminal %u: %s [references=%u, flags=0x%x]:",
n, term->name, term->references, term->flags);
n++;
for (i = 0; i < tty_term_ncodes(); i++)
- cmdq_print(cmdq, "%s", tty_term_describe(term, i));
+ cmdq_print(item, "%s", tty_term_describe(term, i));
}
return (n != 0);
}
static int
-cmd_show_messages_jobs(struct cmd_q *cmdq, int blank)
+cmd_show_messages_jobs(struct cmdq_item *item, int blank)
{
struct job *job;
u_int n;
@@ -88,10 +89,10 @@ cmd_show_messages_jobs(struct cmd_q *cmdq, int blank)
n = 0;
LIST_FOREACH(job, &all_jobs, lentry) {
if (blank) {
- cmdq_print(cmdq, "%s", "");
+ cmdq_print(item, "%s", "");
blank = 0;
}
- cmdq_print(cmdq, "Job %u: %s [fd=%d, pid=%d, status=%d]",
+ cmdq_print(item, "Job %u: %s [fd=%d, pid=%d, status=%d]",
n, job->cmd, job->fd, job->pid, job->status);
n++;
}
@@ -99,21 +100,21 @@ cmd_show_messages_jobs(struct cmd_q *cmdq, int blank)
}
static enum cmd_retval
-cmd_show_messages_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_show_messages_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct client *c = cmdq->state.c;
+ struct client *c = item->state.c;
struct message_entry *msg;
char *tim;
int done, blank;
done = blank = 0;
if (args_has(args, 'T') || self->entry == &cmd_server_info_entry) {
- blank = cmd_show_messages_terminals(cmdq, blank);
+ blank = cmd_show_messages_terminals(item, blank);
done = 1;
}
if (args_has(args, 'J') || self->entry == &cmd_server_info_entry) {
- cmd_show_messages_jobs(cmdq, blank);
+ cmd_show_messages_jobs(item, blank);
done = 1;
}
if (done)
@@ -123,7 +124,7 @@ cmd_show_messages_exec(struct cmd *self, struct cmd_q *cmdq)
tim = ctime(&msg->msg_time);
*strchr(tim, '\n') = '\0';
- cmdq_print(cmdq, "%s %s", tim, msg->msg);
+ cmdq_print(item, "%s %s", tim, msg->msg);
}
return (CMD_RETURN_NORMAL);
diff --git a/usr.bin/tmux/cmd-show-options.c b/usr.bin/tmux/cmd-show-options.c
index cfb33c70dc7..3483b81b43e 100644
--- a/usr.bin/tmux/cmd-show-options.c
+++ b/usr.bin/tmux/cmd-show-options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-show-options.c,v 1.33 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-show-options.c,v 1.34 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -27,11 +27,11 @@
* Show options.
*/
-static enum cmd_retval cmd_show_options_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_show_options_exec(struct cmd *, struct cmdq_item *);
-static enum cmd_retval cmd_show_options_one(struct cmd *, struct cmd_q *,
+static enum cmd_retval cmd_show_options_one(struct cmd *, struct cmdq_item *,
struct options *, int);
-static enum cmd_retval cmd_show_options_all(struct cmd *, struct cmd_q *,
+static enum cmd_retval cmd_show_options_all(struct cmd *, struct cmdq_item *,
struct options *, enum options_table_scope);
const struct cmd_entry cmd_show_options_entry = {
@@ -61,11 +61,11 @@ const struct cmd_entry cmd_show_window_options_entry = {
};
static enum cmd_retval
-cmd_show_options_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_show_options_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct session *s = cmdq->state.tflag.s;
- struct winlink *wl = cmdq->state.tflag.wl;
+ struct session *s = item->state.tflag.s;
+ struct winlink *wl = item->state.tflag.wl;
struct options *oo;
enum options_table_scope scope;
int quiet;
@@ -82,9 +82,9 @@ cmd_show_options_exec(struct cmd *self, struct cmd_q *cmdq)
else if (wl == NULL) {
target = args_get(args, 't');
if (target != NULL) {
- cmdq_error(cmdq, "no such window: %s", target);
+ cmdq_error(item, "no such window: %s", target);
} else
- cmdq_error(cmdq, "no current window");
+ cmdq_error(item, "no current window");
return (CMD_RETURN_ERROR);
} else
oo = wl->window->options;
@@ -95,9 +95,9 @@ cmd_show_options_exec(struct cmd *self, struct cmd_q *cmdq)
else if (s == NULL) {
target = args_get(args, 't');
if (target != NULL) {
- cmdq_error(cmdq, "no such session: %s", target);
+ cmdq_error(item, "no such session: %s", target);
} else
- cmdq_error(cmdq, "no current session");
+ cmdq_error(item, "no current session");
return (CMD_RETURN_ERROR);
} else
oo = s->options;
@@ -105,13 +105,13 @@ cmd_show_options_exec(struct cmd *self, struct cmd_q *cmdq)
quiet = args_has(self->args, 'q');
if (args->argc == 0)
- return (cmd_show_options_all(self, cmdq, oo, scope));
+ return (cmd_show_options_all(self, item, oo, scope));
else
- return (cmd_show_options_one(self, cmdq, oo, quiet));
+ return (cmd_show_options_one(self, item, oo, quiet));
}
static enum cmd_retval
-cmd_show_options_one(struct cmd *self, struct cmd_q *cmdq,
+cmd_show_options_one(struct cmd *self, struct cmdq_item *item,
struct options *oo, int quiet)
{
struct args *args = self->args;
@@ -125,25 +125,25 @@ retry:
if ((o = options_find1(oo, name)) == NULL) {
if (quiet)
return (CMD_RETURN_NORMAL);
- cmdq_error(cmdq, "unknown option: %s", name);
+ cmdq_error(item, "unknown option: %s", name);
return (CMD_RETURN_ERROR);
}
if (args_has(self->args, 'v'))
- cmdq_print(cmdq, "%s", o->str);
+ cmdq_print(item, "%s", o->str);
else
- cmdq_print(cmdq, "%s \"%s\"", o->name, o->str);
+ cmdq_print(item, "%s \"%s\"", o->name, o->str);
return (CMD_RETURN_NORMAL);
}
oe = NULL;
if (options_table_find(name, &oe) != 0) {
- cmdq_error(cmdq, "ambiguous option: %s", name);
+ cmdq_error(item, "ambiguous option: %s", name);
return (CMD_RETURN_ERROR);
}
if (oe == NULL) {
if (quiet)
return (CMD_RETURN_NORMAL);
- cmdq_error(cmdq, "unknown option: %s", name);
+ cmdq_error(item, "unknown option: %s", name);
return (CMD_RETURN_ERROR);
}
if (oe->style != NULL) {
@@ -154,15 +154,15 @@ retry:
return (CMD_RETURN_NORMAL);
optval = options_table_print_entry(oe, o, args_has(self->args, 'v'));
if (args_has(self->args, 'v'))
- cmdq_print(cmdq, "%s", optval);
+ cmdq_print(item, "%s", optval);
else
- cmdq_print(cmdq, "%s %s", oe->name, optval);
+ cmdq_print(item, "%s %s", oe->name, optval);
return (CMD_RETURN_NORMAL);
}
static enum cmd_retval
-cmd_show_options_all(struct cmd *self, struct cmd_q *cmdq, struct options *oo,
- enum options_table_scope scope)
+cmd_show_options_all(struct cmd *self, struct cmdq_item *item,
+ struct options *oo, enum options_table_scope scope)
{
const struct options_table_entry *oe;
struct options_entry *o;
@@ -173,9 +173,9 @@ cmd_show_options_all(struct cmd *self, struct cmd_q *cmdq, struct options *oo,
while (o != NULL) {
if (*o->name == '@') {
if (args_has(self->args, 'v'))
- cmdq_print(cmdq, "%s", o->str);
+ cmdq_print(item, "%s", o->str);
else
- cmdq_print(cmdq, "%s \"%s\"", o->name, o->str);
+ cmdq_print(item, "%s \"%s\"", o->name, o->str);
}
o = options_next(o);
}
@@ -188,9 +188,9 @@ cmd_show_options_all(struct cmd *self, struct cmd_q *cmdq, struct options *oo,
continue;
optval = options_table_print_entry(oe, o, vflag);
if (vflag)
- cmdq_print(cmdq, "%s", optval);
+ cmdq_print(item, "%s", optval);
else
- cmdq_print(cmdq, "%s %s", oe->name, optval);
+ cmdq_print(item, "%s %s", oe->name, optval);
}
return (CMD_RETURN_NORMAL);
diff --git a/usr.bin/tmux/cmd-source-file.c b/usr.bin/tmux/cmd-source-file.c
index e48befd4028..33213880275 100644
--- a/usr.bin/tmux/cmd-source-file.c
+++ b/usr.bin/tmux/cmd-source-file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-source-file.c,v 1.29 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: cmd-source-file.c,v 1.30 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2008 Tiago Cunha <me@tiagocunha.org>
@@ -26,9 +26,9 @@
* Sources a configuration file.
*/
-static enum cmd_retval cmd_source_file_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_source_file_exec(struct cmd *, struct cmdq_item *);
-static enum cmd_retval cmd_source_file_done(struct cmd_q *, void *);
+static enum cmd_retval cmd_source_file_done(struct cmdq_item *, void *);
const struct cmd_entry cmd_source_file_entry = {
.name = "source-file",
@@ -42,34 +42,34 @@ const struct cmd_entry cmd_source_file_entry = {
};
static enum cmd_retval
-cmd_source_file_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_source_file_exec(struct cmd *self, struct cmdq_item *item)
{
- struct args *args = self->args;
- struct client *c = cmdq->client;
- int quiet;
- struct cmd_q *new_cmdq;
+ struct args *args = self->args;
+ struct client *c = item->client;
+ int quiet;
+ struct cmdq_item *new_item;
quiet = args_has(args, 'q');
- switch (load_cfg(args->argv[0], c, cmdq, quiet)) {
+ switch (load_cfg(args->argv[0], c, item, quiet)) {
case -1:
if (cfg_finished)
- cfg_print_causes(cmdq);
+ cfg_print_causes(item);
return (CMD_RETURN_ERROR);
case 0:
if (cfg_finished)
- cfg_print_causes(cmdq);
+ cfg_print_causes(item);
return (CMD_RETURN_NORMAL);
}
if (cfg_finished) {
- new_cmdq = cmdq_get_callback(cmd_source_file_done, NULL);
- cmdq_insert_after(cmdq, new_cmdq);
+ new_item = cmdq_get_callback(cmd_source_file_done, NULL);
+ cmdq_insert_after(item, new_item);
}
return (CMD_RETURN_NORMAL);
}
static enum cmd_retval
-cmd_source_file_done(struct cmd_q *cmdq, __unused void *data)
+cmd_source_file_done(struct cmdq_item *item, __unused void *data)
{
- cfg_print_causes(cmdq);
+ cfg_print_causes(item);
return (CMD_RETURN_NORMAL);
}
diff --git a/usr.bin/tmux/cmd-split-window.c b/usr.bin/tmux/cmd-split-window.c
index db453271150..8994ff94fd9 100644
--- a/usr.bin/tmux/cmd-split-window.c
+++ b/usr.bin/tmux/cmd-split-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-split-window.c,v 1.74 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: cmd-split-window.c,v 1.75 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -33,7 +33,8 @@
#define SPLIT_WINDOW_TEMPLATE "#{session_name}:#{window_index}.#{pane_index}"
-static enum cmd_retval cmd_split_window_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_split_window_exec(struct cmd *,
+ struct cmdq_item *);
const struct cmd_entry cmd_split_window_entry = {
.name = "split-window",
@@ -50,13 +51,13 @@ const struct cmd_entry cmd_split_window_entry = {
};
static enum cmd_retval
-cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct session *s = cmdq->state.tflag.s;
- struct winlink *wl = cmdq->state.tflag.wl;
+ struct session *s = item->state.tflag.s;
+ struct winlink *wl = item->state.tflag.wl;
struct window *w = wl->window;
- struct window_pane *wp = cmdq->state.tflag.wp, *new_wp = NULL;
+ struct window_pane *wp = item->state.tflag.wp, *new_wp = NULL;
struct environ *env;
const char *cmd, *path, *shell, *template, *cwd, *to_free;
char **argv, *cause, *new_cause, *cp;
@@ -91,12 +92,12 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
to_free = NULL;
if (args_has(args, 'c')) {
- ft = format_create(cmdq, 0);
- format_defaults(ft, cmdq->state.c, s, NULL, NULL);
+ ft = format_create(item, 0);
+ format_defaults(ft, item->state.c, s, NULL, NULL);
to_free = cwd = format_expand(ft, args_get(args, 'c'));
format_free(ft);
- } else if (cmdq->client != NULL && cmdq->client->session == NULL)
- cwd = cmdq->client->cwd;
+ } else if (item->client != NULL && item->client->session == NULL)
+ cwd = item->client->cwd;
else
cwd = s->cwd;
@@ -142,8 +143,8 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
layout_assign_pane(lc, new_wp);
path = NULL;
- if (cmdq->client != NULL && cmdq->client->session == NULL)
- envent = environ_find(cmdq->client->environ, "PATH");
+ if (item->client != NULL && item->client->session == NULL)
+ envent = environ_find(item->client->environ, "PATH");
else
envent = environ_find(s->environ, "PATH");
if (envent != NULL)
@@ -168,11 +169,11 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
if ((template = args_get(args, 'F')) == NULL)
template = SPLIT_WINDOW_TEMPLATE;
- ft = format_create(cmdq, 0);
- format_defaults(ft, cmdq->state.c, s, wl, new_wp);
+ ft = format_create(item, 0);
+ format_defaults(ft, item->state.c, s, wl, new_wp);
cp = format_expand(ft, template);
- cmdq_print(cmdq, "%s", cp);
+ cmdq_print(item, "%s", cp);
free(cp);
format_free(ft);
@@ -188,7 +189,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
fs.w = w;
fs.wp = new_wp;
cmd_find_log_state(__func__, &fs);
- hooks_insert(s->hooks, cmdq, &fs, "after-split-window");
+ hooks_insert(s->hooks, item, &fs, "after-split-window");
return (CMD_RETURN_NORMAL);
@@ -198,7 +199,7 @@ error:
layout_close_pane(new_wp);
window_remove_pane(w, new_wp);
}
- cmdq_error(cmdq, "create pane failed: %s", cause);
+ cmdq_error(item, "create pane failed: %s", cause);
free(cause);
if (to_free != NULL)
diff --git a/usr.bin/tmux/cmd-swap-pane.c b/usr.bin/tmux/cmd-swap-pane.c
index 4702d7312b9..805d306a643 100644
--- a/usr.bin/tmux/cmd-swap-pane.c
+++ b/usr.bin/tmux/cmd-swap-pane.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-swap-pane.c,v 1.29 2016/10/13 22:48:51 nicm Exp $ */
+/* $OpenBSD: cmd-swap-pane.c,v 1.30 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -26,7 +26,7 @@
* Swap two panes.
*/
-static enum cmd_retval cmd_swap_pane_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_swap_pane_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_swap_pane_entry = {
.name = "swap-pane",
@@ -43,17 +43,17 @@ const struct cmd_entry cmd_swap_pane_entry = {
};
static enum cmd_retval
-cmd_swap_pane_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_swap_pane_exec(struct cmd *self, struct cmdq_item *item)
{
struct window *src_w, *dst_w;
struct window_pane *tmp_wp, *src_wp, *dst_wp;
struct layout_cell *src_lc, *dst_lc;
u_int sx, sy, xoff, yoff;
- dst_w = cmdq->state.tflag.wl->window;
- dst_wp = cmdq->state.tflag.wp;
- src_w = cmdq->state.sflag.wl->window;
- src_wp = cmdq->state.sflag.wp;
+ dst_w = item->state.tflag.wl->window;
+ dst_wp = item->state.tflag.wp;
+ src_w = item->state.sflag.wl->window;
+ src_wp = item->state.sflag.wp;
server_unzoom_window(dst_w);
if (args_has(self->args, 'D')) {
diff --git a/usr.bin/tmux/cmd-swap-window.c b/usr.bin/tmux/cmd-swap-window.c
index adc94b07aa9..cf6ee4ca3a4 100644
--- a/usr.bin/tmux/cmd-swap-window.c
+++ b/usr.bin/tmux/cmd-swap-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-swap-window.c,v 1.19 2016/10/13 22:48:51 nicm Exp $ */
+/* $OpenBSD: cmd-swap-window.c,v 1.20 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -26,7 +26,7 @@
* Swap one window with another.
*/
-static enum cmd_retval cmd_swap_window_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_swap_window_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_swap_window_entry = {
.name = "swap-window",
@@ -43,24 +43,24 @@ const struct cmd_entry cmd_swap_window_entry = {
};
static enum cmd_retval
-cmd_swap_window_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_swap_window_exec(struct cmd *self, struct cmdq_item *item)
{
struct session *src, *dst;
struct session_group *sg_src, *sg_dst;
struct winlink *wl_src, *wl_dst;
struct window *w;
- wl_src = cmdq->state.sflag.wl;
- src = cmdq->state.sflag.s;
+ wl_src = item->state.sflag.wl;
+ src = item->state.sflag.s;
sg_src = session_group_find(src);
- wl_dst = cmdq->state.tflag.wl;
- dst = cmdq->state.tflag.s;
+ wl_dst = item->state.tflag.wl;
+ dst = item->state.tflag.s;
sg_dst = session_group_find(dst);
if (src != dst && sg_src != NULL && sg_dst != NULL &&
sg_src == sg_dst) {
- cmdq_error(cmdq, "can't move window, sessions are grouped");
+ cmdq_error(item, "can't move window, sessions are grouped");
return (CMD_RETURN_ERROR);
}
diff --git a/usr.bin/tmux/cmd-switch-client.c b/usr.bin/tmux/cmd-switch-client.c
index 9aa0a313c42..2b8f3549453 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.43 2016/10/10 21:51:39 nicm Exp $ */
+/* $OpenBSD: cmd-switch-client.c,v 1.44 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -27,7 +27,8 @@
* Switch client to a different session.
*/
-static enum cmd_retval cmd_switch_client_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_switch_client_exec(struct cmd *,
+ struct cmdq_item *);
const struct cmd_entry cmd_switch_client_entry = {
.name = "switch-client",
@@ -45,12 +46,12 @@ const struct cmd_entry cmd_switch_client_entry = {
};
static enum cmd_retval
-cmd_switch_client_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_switch_client_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- struct cmd_state *state = &cmdq->state;
+ struct cmd_state *state = &item->state;
struct client *c = state->c;
- struct session *s = cmdq->state.tflag.s;
+ struct session *s = item->state.tflag.s;
struct window_pane *wp;
const char *tablename, *update;
struct key_table *table;
@@ -62,7 +63,7 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_q *cmdq)
if (tablename != NULL) {
table = key_bindings_get_table(tablename, 0);
if (table == NULL) {
- cmdq_error(cmdq, "table %s doesn't exist", tablename);
+ cmdq_error(item, "table %s doesn't exist", tablename);
return (CMD_RETURN_ERROR);
}
table->references++;
@@ -73,12 +74,12 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_q *cmdq)
if (args_has(args, 'n')) {
if ((s = session_next_session(c->session)) == NULL) {
- cmdq_error(cmdq, "can't find next session");
+ cmdq_error(item, "can't find next session");
return (CMD_RETURN_ERROR);
}
} else if (args_has(args, 'p')) {
if ((s = session_previous_session(c->session)) == NULL) {
- cmdq_error(cmdq, "can't find previous session");
+ cmdq_error(item, "can't find previous session");
return (CMD_RETURN_ERROR);
}
} else if (args_has(args, 'l')) {
@@ -87,11 +88,11 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_q *cmdq)
else
s = NULL;
if (s == NULL) {
- cmdq_error(cmdq, "can't find last session");
+ cmdq_error(item, "can't find last session");
return (CMD_RETURN_ERROR);
}
} else {
- if (cmdq->client == NULL)
+ if (item->client == NULL)
return (CMD_RETURN_NORMAL);
if (state->tflag.wl != NULL) {
wp = state->tflag.wp;
diff --git a/usr.bin/tmux/cmd-unbind-key.c b/usr.bin/tmux/cmd-unbind-key.c
index f7f35dfc67b..45c4bb299be 100644
--- a/usr.bin/tmux/cmd-unbind-key.c
+++ b/usr.bin/tmux/cmd-unbind-key.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-unbind-key.c,v 1.28 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-unbind-key.c,v 1.29 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -26,9 +26,10 @@
* Unbind key from command.
*/
-static enum cmd_retval cmd_unbind_key_exec(struct cmd *, struct cmd_q *);
-static enum cmd_retval cmd_unbind_key_mode_table(struct cmd *, struct cmd_q *,
- key_code);
+static enum cmd_retval cmd_unbind_key_exec(struct cmd *, struct cmdq_item *);
+
+static enum cmd_retval cmd_unbind_key_mode_table(struct cmd *,
+ struct cmdq_item *, key_code);
const struct cmd_entry cmd_unbind_key_entry = {
.name = "unbind-key",
@@ -42,7 +43,7 @@ const struct cmd_entry cmd_unbind_key_entry = {
};
static enum cmd_retval
-cmd_unbind_key_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_unbind_key_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
key_code key;
@@ -50,24 +51,24 @@ cmd_unbind_key_exec(struct cmd *self, struct cmd_q *cmdq)
if (!args_has(args, 'a')) {
if (args->argc != 1) {
- cmdq_error(cmdq, "missing key");
+ cmdq_error(item, "missing key");
return (CMD_RETURN_ERROR);
}
key = key_string_lookup_string(args->argv[0]);
if (key == KEYC_NONE || key == KEYC_UNKNOWN) {
- cmdq_error(cmdq, "unknown key: %s", args->argv[0]);
+ cmdq_error(item, "unknown key: %s", args->argv[0]);
return (CMD_RETURN_ERROR);
}
} else {
if (args->argc != 0) {
- cmdq_error(cmdq, "key given with -a");
+ cmdq_error(item, "key given with -a");
return (CMD_RETURN_ERROR);
}
key = KEYC_UNKNOWN;
}
if (args_has(args, 't'))
- return (cmd_unbind_key_mode_table(self, cmdq, key));
+ return (cmd_unbind_key_mode_table(self, item, key));
if (key == KEYC_UNKNOWN) {
tablename = args_get(args, 'T');
@@ -77,7 +78,7 @@ cmd_unbind_key_exec(struct cmd *self, struct cmd_q *cmdq)
return (CMD_RETURN_NORMAL);
}
if (key_bindings_get_table(tablename, 0) == NULL) {
- cmdq_error(cmdq, "table %s doesn't exist", tablename);
+ cmdq_error(item, "table %s doesn't exist", tablename);
return (CMD_RETURN_ERROR);
}
key_bindings_remove_table(tablename);
@@ -87,7 +88,7 @@ cmd_unbind_key_exec(struct cmd *self, struct cmd_q *cmdq)
if (args_has(args, 'T')) {
tablename = args_get(args, 'T');
if (key_bindings_get_table(tablename, 0) == NULL) {
- cmdq_error(cmdq, "table %s doesn't exist", tablename);
+ cmdq_error(item, "table %s doesn't exist", tablename);
return (CMD_RETURN_ERROR);
}
} else if (args_has(args, 'n'))
@@ -99,7 +100,8 @@ cmd_unbind_key_exec(struct cmd *self, struct cmd_q *cmdq)
}
static enum cmd_retval
-cmd_unbind_key_mode_table(struct cmd *self, struct cmd_q *cmdq, key_code key)
+cmd_unbind_key_mode_table(struct cmd *self, struct cmdq_item *item,
+ key_code key)
{
struct args *args = self->args;
const char *tablename;
@@ -108,7 +110,7 @@ cmd_unbind_key_mode_table(struct cmd *self, struct cmd_q *cmdq, key_code key)
tablename = args_get(args, 't');
if ((mtab = mode_key_findtable(tablename)) == NULL) {
- cmdq_error(cmdq, "unknown key table: %s", tablename);
+ cmdq_error(item, "unknown key table: %s", tablename);
return (CMD_RETURN_ERROR);
}
diff --git a/usr.bin/tmux/cmd-wait-for.c b/usr.bin/tmux/cmd-wait-for.c
index f9b4f8694c0..ba869388a69 100644
--- a/usr.bin/tmux/cmd-wait-for.c
+++ b/usr.bin/tmux/cmd-wait-for.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-wait-for.c,v 1.15 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: cmd-wait-for.c,v 1.16 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2013 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -28,7 +28,7 @@
* Block or wake a client on a named wait channel.
*/
-static enum cmd_retval cmd_wait_for_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_wait_for_exec(struct cmd *, struct cmdq_item *);
const struct cmd_entry cmd_wait_for_entry = {
.name = "wait-for",
@@ -42,7 +42,7 @@ const struct cmd_entry cmd_wait_for_entry = {
};
struct wait_item {
- struct cmd_q *cmdq;
+ struct cmdq_item *item;
TAILQ_ENTRY(wait_item) entry;
};
@@ -68,17 +68,17 @@ wait_channel_cmp(struct wait_channel *wc1, struct wait_channel *wc2)
return (strcmp(wc1->name, wc2->name));
}
-static enum cmd_retval cmd_wait_for_signal(struct cmd_q *, const char *,
+static enum cmd_retval cmd_wait_for_signal(struct cmdq_item *, const char *,
struct wait_channel *);
-static enum cmd_retval cmd_wait_for_wait(struct cmd_q *, const char *,
+static enum cmd_retval cmd_wait_for_wait(struct cmdq_item *, const char *,
struct wait_channel *);
-static enum cmd_retval cmd_wait_for_lock(struct cmd_q *, const char *,
+static enum cmd_retval cmd_wait_for_lock(struct cmdq_item *, const char *,
struct wait_channel *);
-static enum cmd_retval cmd_wait_for_unlock(struct cmd_q *, const char *,
+static enum cmd_retval cmd_wait_for_unlock(struct cmdq_item *, const char *,
struct wait_channel *);
static struct wait_channel *cmd_wait_for_add(const char *);
-static void cmd_wait_for_remove(struct wait_channel *wc);
+static void cmd_wait_for_remove(struct wait_channel *);
static struct wait_channel *
cmd_wait_for_add(const char *name)
@@ -118,7 +118,7 @@ cmd_wait_for_remove(struct wait_channel *wc)
}
static enum cmd_retval
-cmd_wait_for_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_wait_for_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
const char *name = args->argv[0];
@@ -128,16 +128,16 @@ cmd_wait_for_exec(struct cmd *self, struct cmd_q *cmdq)
wc = RB_FIND(wait_channels, &wait_channels, &wc0);
if (args_has(args, 'S'))
- return (cmd_wait_for_signal(cmdq, name, wc));
+ return (cmd_wait_for_signal(item, name, wc));
if (args_has(args, 'L'))
- return (cmd_wait_for_lock(cmdq, name, wc));
+ return (cmd_wait_for_lock(item, name, wc));
if (args_has(args, 'U'))
- return (cmd_wait_for_unlock(cmdq, name, wc));
- return (cmd_wait_for_wait(cmdq, name, wc));
+ return (cmd_wait_for_unlock(item, name, wc));
+ return (cmd_wait_for_wait(item, name, wc));
}
static enum cmd_retval
-cmd_wait_for_signal(__unused struct cmd_q *cmdq, const char *name,
+cmd_wait_for_signal(__unused struct cmdq_item *item, const char *name,
struct wait_channel *wc)
{
struct wait_item *wi, *wi1;
@@ -153,7 +153,7 @@ cmd_wait_for_signal(__unused struct cmd_q *cmdq, const char *name,
log_debug("signal wait channel %s, with waiters", wc->name);
TAILQ_FOREACH_SAFE(wi, &wc->waiters, entry, wi1) {
- wi->cmdq->flags &= ~CMD_Q_WAITING;
+ wi->item->flags &= ~CMDQ_WAITING;
TAILQ_REMOVE(&wc->waiters, wi, entry);
free(wi);
@@ -164,13 +164,14 @@ cmd_wait_for_signal(__unused struct cmd_q *cmdq, const char *name,
}
static enum cmd_retval
-cmd_wait_for_wait(struct cmd_q *cmdq, const char *name, struct wait_channel *wc)
+cmd_wait_for_wait(struct cmdq_item *item, const char *name,
+ struct wait_channel *wc)
{
- struct client *c = cmdq->client;
+ struct client *c = item->client;
struct wait_item *wi;
if (c == NULL || c->session != NULL) {
- cmdq_error(cmdq, "not able to wait");
+ cmdq_error(item, "not able to wait");
return (CMD_RETURN_ERROR);
}
@@ -185,19 +186,20 @@ cmd_wait_for_wait(struct cmd_q *cmdq, const char *name, struct wait_channel *wc)
log_debug("wait channel %s not woken (%p)", wc->name, c);
wi = xcalloc(1, sizeof *wi);
- wi->cmdq = cmdq;
+ wi->item = item;
TAILQ_INSERT_TAIL(&wc->waiters, wi, entry);
return (CMD_RETURN_WAIT);
}
static enum cmd_retval
-cmd_wait_for_lock(struct cmd_q *cmdq, const char *name, struct wait_channel *wc)
+cmd_wait_for_lock(struct cmdq_item *item, const char *name,
+ struct wait_channel *wc)
{
struct wait_item *wi;
- if (cmdq->client == NULL || cmdq->client->session != NULL) {
- cmdq_error(cmdq, "not able to lock");
+ if (item->client == NULL || item->client->session != NULL) {
+ cmdq_error(item, "not able to lock");
return (CMD_RETURN_ERROR);
}
@@ -206,7 +208,7 @@ cmd_wait_for_lock(struct cmd_q *cmdq, const char *name, struct wait_channel *wc)
if (wc->locked) {
wi = xcalloc(1, sizeof *wi);
- wi->cmdq = cmdq;
+ wi->item = item;
TAILQ_INSERT_TAIL(&wc->lockers, wi, entry);
return (CMD_RETURN_WAIT);
}
@@ -216,18 +218,18 @@ cmd_wait_for_lock(struct cmd_q *cmdq, const char *name, struct wait_channel *wc)
}
static enum cmd_retval
-cmd_wait_for_unlock(struct cmd_q *cmdq, const char *name,
+cmd_wait_for_unlock(struct cmdq_item *item, const char *name,
struct wait_channel *wc)
{
struct wait_item *wi;
if (wc == NULL || !wc->locked) {
- cmdq_error(cmdq, "channel %s not locked", name);
+ cmdq_error(item, "channel %s not locked", name);
return (CMD_RETURN_ERROR);
}
if ((wi = TAILQ_FIRST(&wc->lockers)) != NULL) {
- wi->cmdq->flags &= ~CMD_Q_WAITING;
+ wi->item->flags &= ~CMDQ_WAITING;
TAILQ_REMOVE(&wc->lockers, wi, entry);
free(wi);
} else {
@@ -246,13 +248,13 @@ cmd_wait_for_flush(void)
RB_FOREACH_SAFE(wc, wait_channels, &wait_channels, wc1) {
TAILQ_FOREACH_SAFE(wi, &wc->waiters, entry, wi1) {
- wi->cmdq->flags &= ~CMD_Q_WAITING;
+ wi->item->flags &= ~CMDQ_WAITING;
TAILQ_REMOVE(&wc->waiters, wi, entry);
free(wi);
}
wc->woken = 1;
TAILQ_FOREACH_SAFE(wi, &wc->lockers, entry, wi1) {
- wi->cmdq->flags &= ~CMD_Q_WAITING;
+ wi->item->flags &= ~CMDQ_WAITING;
TAILQ_REMOVE(&wc->lockers, wi, entry);
free(wi);
}
diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c
index 18ab02b5d6e..c2d50f8ed77 100644
--- a/usr.bin/tmux/cmd.c
+++ b/usr.bin/tmux/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.125 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: cmd.c,v 1.126 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -390,7 +390,7 @@ usage:
static int
cmd_prepare_state_flag(char c, const char *target, enum cmd_entry_flag flag,
- struct cmd_q *cmdq)
+ struct cmdq_item *item)
{
int targetflags, error;
struct cmd_find_state *fs = NULL;
@@ -402,9 +402,9 @@ cmd_prepare_state_flag(char c, const char *target, enum cmd_entry_flag flag,
return (0);
if (c == 't')
- fs = &cmdq->state.tflag;
+ fs = &item->state.tflag;
else if (c == 's')
- fs = &cmdq->state.sflag;
+ fs = &item->state.sflag;
if (flag == CMD_SESSION_WITHPANE) {
if (target != NULL && target[strcspn(target, ":.")] != '\0')
@@ -450,7 +450,7 @@ cmd_prepare_state_flag(char c, const char *target, enum cmd_entry_flag flag,
}
log_debug("%s: flag %c %d %#x", __func__, c, flag, targetflags);
- error = cmd_find_current(&current, cmdq, targetflags);
+ error = cmd_find_current(&current, item, targetflags);
if (error != 0 && ~targetflags & CMD_FIND_QUIET)
return (-1);
if (!cmd_find_empty_state(&current) && !cmd_find_valid_state(&current))
@@ -465,13 +465,13 @@ cmd_prepare_state_flag(char c, const char *target, enum cmd_entry_flag flag,
case CMD_SESSION_CANFAIL:
case CMD_SESSION_PREFERUNATTACHED:
case CMD_SESSION_WITHPANE:
- error = cmd_find_target(fs, &current, cmdq, target,
+ error = cmd_find_target(fs, &current, item, target,
CMD_FIND_SESSION, targetflags);
if (error != 0 && ~targetflags & CMD_FIND_QUIET)
return (-1);
break;
case CMD_MOVEW_R:
- error = cmd_find_target(fs, &current, cmdq, target,
+ error = cmd_find_target(fs, &current, item, target,
CMD_FIND_SESSION, CMD_FIND_QUIET);
if (error == 0)
break;
@@ -480,7 +480,7 @@ cmd_prepare_state_flag(char c, const char *target, enum cmd_entry_flag flag,
case CMD_WINDOW_CANFAIL:
case CMD_WINDOW_MARKED:
case CMD_WINDOW_INDEX:
- error = cmd_find_target(fs, &current, cmdq, target,
+ error = cmd_find_target(fs, &current, item, target,
CMD_FIND_WINDOW, targetflags);
if (error != 0 && ~targetflags & CMD_FIND_QUIET)
return (-1);
@@ -488,7 +488,7 @@ cmd_prepare_state_flag(char c, const char *target, enum cmd_entry_flag flag,
case CMD_PANE:
case CMD_PANE_CANFAIL:
case CMD_PANE_MARKED:
- error = cmd_find_target(fs, &current, cmdq, target,
+ error = cmd_find_target(fs, &current, item, target,
CMD_FIND_PANE, targetflags);
if (error != 0 && ~targetflags & CMD_FIND_QUIET)
return (-1);
@@ -500,17 +500,17 @@ cmd_prepare_state_flag(char c, const char *target, enum cmd_entry_flag flag,
}
int
-cmd_prepare_state(struct cmd *cmd, struct cmd_q *cmdq)
+cmd_prepare_state(struct cmd *cmd, struct cmdq_item *item)
{
const struct cmd_entry *entry = cmd->entry;
- struct cmd_state *state = &cmdq->state;
+ struct cmd_state *state = &item->state;
char *tmp;
enum cmd_entry_flag flag;
const char *s;
int error;
tmp = cmd_print(cmd);
- log_debug("preparing state for %s (client %p)", tmp, cmdq->client);
+ log_debug("preparing state for %s (client %p)", tmp, item->client);
free(tmp);
state->c = NULL;
@@ -528,12 +528,12 @@ cmd_prepare_state(struct cmd *cmd, struct cmd_q *cmdq)
s = args_get(cmd->args, 'c');
switch (flag) {
case CMD_CLIENT:
- state->c = cmd_find_client(cmdq, s, 0);
+ state->c = cmd_find_client(item, s, 0);
if (state->c == NULL)
return (-1);
break;
default:
- state->c = cmd_find_client(cmdq, s, 1);
+ state->c = cmd_find_client(item, s, 1);
break;
}
log_debug("using client %p", state->c);
@@ -541,14 +541,14 @@ cmd_prepare_state(struct cmd *cmd, struct cmd_q *cmdq)
s = args_get(cmd->args, 't');
log_debug("preparing -t state: target %s", s == NULL ? "none" : s);
- error = cmd_prepare_state_flag('t', s, entry->tflag, cmdq);
+ error = cmd_prepare_state_flag('t', s, entry->tflag, item);
if (error != 0)
return (error);
s = args_get(cmd->args, 's');
log_debug("preparing -s state: target %s", s == NULL ? "none" : s);
- error = cmd_prepare_state_flag('s', s, entry->sflag, cmdq);
+ error = cmd_prepare_state_flag('s', s, entry->sflag, item);
if (error != 0)
return (error);
diff --git a/usr.bin/tmux/control.c b/usr.bin/tmux/control.c
index 53979b0f09f..707172f20f8 100644
--- a/usr.bin/tmux/control.c
+++ b/usr.bin/tmux/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.18 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: control.c,v 1.19 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2012 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -51,14 +51,14 @@ control_write_buffer(struct client *c, struct evbuffer *buffer)
/* Control error callback. */
static enum cmd_retval
-control_error(struct cmd_q *cmdq, void *data)
+control_error(struct cmdq_item *item, void *data)
{
- struct client *c = cmdq->client;
+ struct client *c = item->client;
char *error = data;
- cmdq_guard(cmdq, "begin", 1);
+ cmdq_guard(item, "begin", 1);
control_write(c, "parse error: %s", error);
- cmdq_guard(cmdq, "error", 1);
+ cmdq_guard(item, "error", 1);
free(error);
return (CMD_RETURN_NORMAL);
@@ -68,10 +68,10 @@ control_error(struct cmd_q *cmdq, void *data)
void
control_callback(struct client *c, int closed, __unused void *data)
{
- char *line, *cause;
- struct cmd_list *cmdlist;
- struct cmd *cmd;
- struct cmd_q *cmdq;
+ char *line, *cause;
+ struct cmd_list *cmdlist;
+ struct cmd *cmd;
+ struct cmdq_item *item;
if (closed)
c->flags |= CLIENT_EXIT;
@@ -86,13 +86,13 @@ control_callback(struct client *c, int closed, __unused void *data)
}
if (cmd_string_parse(line, &cmdlist, NULL, 0, &cause) != 0) {
- cmdq = cmdq_get_callback(control_error, cause);
- cmdq_append(c, cmdq);
+ item = cmdq_get_callback(control_error, cause);
+ cmdq_append(c, item);
} else {
TAILQ_FOREACH(cmd, &cmdlist->list, qentry)
cmd->flags |= CMD_CONTROL;
- cmdq = cmdq_get_command(cmdlist, NULL, NULL, 0);
- cmdq_append(c, cmdq);
+ item = cmdq_get_command(cmdlist, NULL, NULL, 0);
+ cmdq_append(c, item);
cmd_list_free(cmdlist);
}
diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c
index 7953e4618a9..b1c7751ee10 100644
--- a/usr.bin/tmux/format.c
+++ b/usr.bin/tmux/format.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: format.c,v 1.110 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: format.c,v 1.111 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -470,7 +470,7 @@ format_cb_pane_tabs(struct format_tree *ft, struct format_entry *fe)
/* Create a new tree. */
struct format_tree *
-format_create(struct cmd_q *cmdq, int flags)
+format_create(struct cmdq_item *item, int flags)
{
struct format_tree *ft;
@@ -489,10 +489,10 @@ format_create(struct cmd_q *cmdq, int flags)
format_add(ft, "socket_path", "%s", socket_path);
format_add_tv(ft, "start_time", &start_time);
- if (cmdq != NULL && cmdq->cmd != NULL)
- format_add(ft, "command", "%s", cmdq->cmd->entry->name);
- if (cmdq != NULL && cmdq->hook != NULL)
- format_add(ft, "hook", "%s", cmdq->hook);
+ if (item != NULL && item->cmd != NULL)
+ format_add(ft, "command", "%s", item->cmd->entry->name);
+ if (item != NULL && item->hook != NULL)
+ format_add(ft, "hook", "%s", item->hook);
return (ft);
}
diff --git a/usr.bin/tmux/hooks.c b/usr.bin/tmux/hooks.c
index 5547753df21..862a40f2608 100644
--- a/usr.bin/tmux/hooks.c
+++ b/usr.bin/tmux/hooks.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hooks.c,v 1.7 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: hooks.c,v 1.8 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2012 Thomas Adam <thomas@xteddy.org>
@@ -143,10 +143,10 @@ void
hooks_run(struct hooks *hooks, struct client *c, struct cmd_find_state *fs,
const char *fmt, ...)
{
- struct hook *hook;
- va_list ap;
- char *name;
- struct cmd_q *new_cmdq, *loop;
+ struct hook *hook;
+ va_list ap;
+ char *name;
+ struct cmdq_item *new_item, *loop;
va_start(ap, fmt);
xvasprintf(&name, fmt, ap);
@@ -159,25 +159,25 @@ hooks_run(struct hooks *hooks, struct client *c, struct cmd_find_state *fs,
}
log_debug("running hook %s", name);
- new_cmdq = cmdq_get_command(hook->cmdlist, fs, NULL, CMD_Q_NOHOOKS);
+ new_item = cmdq_get_command(hook->cmdlist, fs, NULL, CMDQ_NOHOOKS);
- for (loop = new_cmdq; loop != NULL; loop = loop->next)
+ for (loop = new_item; loop != NULL; loop = loop->next)
loop->hook = xstrdup(name);
free(name);
- cmdq_append(c, new_cmdq);
+ cmdq_append(c, new_item);
}
void
-hooks_insert(struct hooks *hooks, struct cmd_q *cmdq, struct cmd_find_state *fs,
- const char *fmt, ...)
+hooks_insert(struct hooks *hooks, struct cmdq_item *item,
+ struct cmd_find_state *fs, const char *fmt, ...)
{
- struct hook *hook;
- va_list ap;
- char *name;
- struct cmd_q *new_cmdq, *loop;
+ struct hook *hook;
+ va_list ap;
+ char *name;
+ struct cmdq_item *new_item, *loop;
- if (cmdq->flags & CMD_Q_NOHOOKS)
+ if (item->flags & CMDQ_NOHOOKS)
return;
va_start(ap, fmt);
@@ -189,16 +189,16 @@ hooks_insert(struct hooks *hooks, struct cmd_q *cmdq, struct cmd_find_state *fs,
free(name);
return;
}
- log_debug("running hook %s (parent %p)", name, cmdq);
+ log_debug("running hook %s (parent %p)", name, item);
- new_cmdq = cmdq_get_command(hook->cmdlist, fs, NULL, CMD_Q_NOHOOKS);
+ new_item = cmdq_get_command(hook->cmdlist, fs, NULL, CMDQ_NOHOOKS);
- for (loop = new_cmdq; loop != NULL; loop = loop->next)
+ for (loop = new_item; loop != NULL; loop = loop->next)
loop->hook = xstrdup(name);
free(name);
- if (cmdq != NULL)
- cmdq_insert_after(cmdq, new_cmdq);
+ if (item != NULL)
+ cmdq_insert_after(item, new_item);
else
- cmdq_append(NULL, new_cmdq);
+ cmdq_append(NULL, new_item);
}
diff --git a/usr.bin/tmux/key-bindings.c b/usr.bin/tmux/key-bindings.c
index 0b675a7d4cd..cb993397a8f 100644
--- a/usr.bin/tmux/key-bindings.c
+++ b/usr.bin/tmux/key-bindings.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: key-bindings.c,v 1.61 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: key-bindings.c,v 1.62 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -389,9 +389,9 @@ key_bindings_init(void)
}
static enum cmd_retval
-key_bindings_read_only(struct cmd_q *cmdq, __unused void *data)
+key_bindings_read_only(struct cmdq_item *item, __unused void *data)
{
- cmdq_error(cmdq, "client is read-only");
+ cmdq_error(item, "client is read-only");
return (CMD_RETURN_ERROR);
}
diff --git a/usr.bin/tmux/notify.c b/usr.bin/tmux/notify.c
index 502f6e549ba..d8e06224945 100644
--- a/usr.bin/tmux/notify.c
+++ b/usr.bin/tmux/notify.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: notify.c,v 1.13 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: notify.c,v 1.14 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2012 George Nachman <tmux@georgester.com>
@@ -66,7 +66,7 @@ notify_hook(struct notify_entry *ne)
const char *name;
struct cmd_find_state fs;
struct hook *hook;
- struct cmd_q *new_cmdq, *loop;
+ struct cmdq_item *new_item, *loop;
name = notify_hooks[ne->type];
if (name == NULL)
@@ -87,12 +87,12 @@ notify_hook(struct notify_entry *ne)
return;
log_debug("notify hook %s", name);
- new_cmdq = cmdq_get_command(hook->cmdlist, &fs, NULL, CMD_Q_NOHOOKS);
+ new_item = cmdq_get_command(hook->cmdlist, &fs, NULL, CMDQ_NOHOOKS);
- for (loop = new_cmdq; loop != NULL; loop = loop->next)
+ for (loop = new_item; loop != NULL; loop = loop->next)
loop->hook = xstrdup(name);
- cmdq_append(NULL, new_cmdq);
+ cmdq_append(NULL, new_item);
}
static void
diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c
index 243e8233ea4..d9da28fae69 100644
--- a/usr.bin/tmux/server-client.c
+++ b/usr.bin/tmux/server-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-client.c,v 1.194 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.195 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1254,9 +1254,9 @@ server_client_dispatch(struct imsg *imsg, void *arg)
/* Callback when command is done. */
static enum cmd_retval
-server_client_command_done(struct cmd_q *cmdq, __unused void *data)
+server_client_command_done(struct cmdq_item *item, __unused void *data)
{
- struct client *c = cmdq->client;
+ struct client *c = item->client;
if (~c->flags & CLIENT_ATTACHED)
c->flags |= CLIENT_EXIT;
@@ -1265,11 +1265,11 @@ server_client_command_done(struct cmd_q *cmdq, __unused void *data)
/* Show an error message. */
static enum cmd_retval
-server_client_command_error(struct cmd_q *cmdq, void *data)
+server_client_command_error(struct cmdq_item *item, void *data)
{
char *error = data;
- cmdq_error(cmdq, "%s", error);
+ cmdq_error(item, "%s", error);
free(error);
return (CMD_RETURN_NORMAL);
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index ad36ba4f150..5346c48c86f 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.667 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.668 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -40,8 +40,8 @@ extern char **environ;
struct args;
struct client;
-struct cmd_q;
-struct cmd_q_list;
+struct cmdq_item;
+struct cmdq_list;
struct environ;
struct input_ctx;
struct mode_key_cmdstr;
@@ -1177,7 +1177,7 @@ enum cmd_find_type {
CMD_FIND_SESSION,
};
struct cmd_find_state {
- struct cmd_q *cmdq;
+ struct cmdq_item *item;
int flags;
struct cmd_find_state *current;
@@ -1231,20 +1231,20 @@ enum cmd_retval {
};
/* Command queue item type. */
-enum cmd_q_type {
- CMD_Q_COMMAND,
- CMD_Q_CALLBACK,
+enum cmdq_type {
+ CMDQ_COMMAND,
+ CMDQ_CALLBACK,
};
/* Command queue item. */
-typedef enum cmd_retval (*cmd_q_cb) (struct cmd_q *, void *);
-struct cmd_q {
- struct cmd_q_list *queue;
- struct cmd_q *next;
+typedef enum cmd_retval (*cmdq_cb) (struct cmdq_item *, void *);
+struct cmdq_item {
+ struct cmdq_list *queue;
+ struct cmdq_item *next;
struct client *client;
- enum cmd_q_type type;
+ enum cmdq_type type;
u_int group;
u_int number;
@@ -1252,14 +1252,14 @@ struct cmd_q {
const char *hook;
int flags;
-#define CMD_Q_FIRED 0x1
-#define CMD_Q_WAITING 0x2
-#define CMD_Q_NOHOOKS 0x4
+#define CMDQ_FIRED 0x1
+#define CMDQ_WAITING 0x2
+#define CMDQ_NOHOOKS 0x4
struct cmd_list *cmdlist;
struct cmd *cmd;
- cmd_q_cb cb;
+ cmdq_cb cb;
void *data;
struct cmd_find_state current;
@@ -1267,9 +1267,9 @@ struct cmd_q {
struct mouse_event mouse;
- TAILQ_ENTRY(cmd_q) entry;
+ TAILQ_ENTRY(cmdq_item) entry;
};
-TAILQ_HEAD(cmd_q_list, cmd_q);
+TAILQ_HEAD(cmdq_list, cmdq_item);
/* Command -c, -t or -s flags. */
enum cmd_entry_flag {
@@ -1316,13 +1316,13 @@ struct cmd_entry {
#define CMD_AFTERHOOK 0x4
int flags;
- enum cmd_retval (*exec)(struct cmd *, struct cmd_q *);
+ enum cmd_retval (*exec)(struct cmd *, struct cmdq_item *);
};
/* Client connection. */
struct client {
struct tmuxpeer *peer;
- struct cmd_q_list queue;
+ struct cmdq_list queue;
pid_t pid;
int fd;
@@ -1510,12 +1510,12 @@ void proc_kill_peer(struct tmuxpeer *);
/* cfg.c */
extern int cfg_finished;
extern struct client *cfg_client;
-void start_cfg(void);
-int load_cfg(const char *, struct client *, struct cmd_q *, int);
-void set_cfg_file(const char *);
+void start_cfg(void);
+int load_cfg(const char *, struct client *, struct cmdq_item *, int);
+void set_cfg_file(const char *);
void printflike(1, 2) cfg_add_cause(const char *, ...);
-void cfg_print_causes(struct cmd_q *);
-void cfg_show_causes(struct session *);
+void cfg_print_causes(struct cmdq_item *);
+void cfg_show_causes(struct session *);
/* paste.c */
struct paste_buffer;
@@ -1536,7 +1536,7 @@ char *paste_make_sample(struct paste_buffer *);
#define FORMAT_STATUS 0x1
#define FORMAT_FORCE 0x2
struct format_tree;
-struct format_tree *format_create(struct cmd_q *, int);
+struct format_tree *format_create(struct cmdq_item *, int);
void format_free(struct format_tree *);
void printflike(3, 4) format_add(struct format_tree *, const char *,
const char *, ...);
@@ -1563,7 +1563,7 @@ void hooks_remove(struct hooks *, const char *);
struct hook *hooks_find(struct hooks *, const char *);
void printflike(4, 5) hooks_run(struct hooks *, struct client *,
struct cmd_find_state *, const char *, ...);
-void printflike(4, 5) hooks_insert(struct hooks *, struct cmd_q *,
+void printflike(4, 5) hooks_insert(struct hooks *, struct cmdq_item *,
struct cmd_find_state *, const char *, ...);
/* mode-key.c */
@@ -1729,14 +1729,14 @@ long long args_strtonum(struct args *, u_char, long long, long long,
char **);
/* cmd-find.c */
-int cmd_find_current(struct cmd_find_state *, struct cmd_q *,
+int cmd_find_current(struct cmd_find_state *, struct cmdq_item *,
int);
int cmd_find_target(struct cmd_find_state *,
- struct cmd_find_state *, struct cmd_q *, const char *,
+ struct cmd_find_state *, struct cmdq_item *, const char *,
enum cmd_find_type, int);
-struct client *cmd_find_client(struct cmd_q *, const char *, int);
-void cmd_find_clear_state(struct cmd_find_state *, struct cmd_q *,
- int);
+struct client *cmd_find_client(struct cmdq_item *, const char *, int);
+void cmd_find_clear_state(struct cmd_find_state *,
+ struct cmdq_item *, int);
int cmd_find_empty_state(struct cmd_find_state *);
int cmd_find_valid_state(struct cmd_find_state *);
void cmd_find_copy_state(struct cmd_find_state *,
@@ -1759,7 +1759,7 @@ char **cmd_copy_argv(int, char **);
void cmd_free_argv(int, char **);
char *cmd_stringify_argv(int, char **);
struct cmd *cmd_parse(int, char **, const char *, u_int, char **);
-int cmd_prepare_state(struct cmd *, struct cmd_q *);
+int cmd_prepare_state(struct cmd *, struct cmdq_item *);
char *cmd_print(struct cmd *);
int cmd_mouse_at(struct window_pane *, struct mouse_event *,
u_int *, u_int *, int);
@@ -1770,8 +1770,8 @@ char *cmd_template_replace(const char *, const char *, int);
extern const struct cmd_entry *cmd_table[];
/* cmd-attach-session.c */
-enum cmd_retval cmd_attach_session(struct cmd_q *, int, int, const char *,
- int);
+enum cmd_retval cmd_attach_session(struct cmdq_item *, int, int, const char *,
+ int);
/* cmd-list.c */
struct cmd_list *cmd_list_parse(int, char **, const char *, u_int, char **);
@@ -1779,15 +1779,15 @@ void cmd_list_free(struct cmd_list *);
char *cmd_list_print(struct cmd_list *);
/* cmd-queue.c */
-struct cmd_q *cmdq_get_command(struct cmd_list *, struct cmd_find_state *,
+struct cmdq_item *cmdq_get_command(struct cmd_list *, struct cmd_find_state *,
struct mouse_event *, int);
-struct cmd_q *cmdq_get_callback(cmd_q_cb, void *);
-void cmdq_insert_after(struct cmd_q *, struct cmd_q *);
-void cmdq_append(struct client *, struct cmd_q *);
+struct cmdq_item *cmdq_get_callback(cmdq_cb, void *);
+void cmdq_insert_after(struct cmdq_item *, struct cmdq_item *);
+void cmdq_append(struct client *, struct cmdq_item *);
u_int cmdq_next(struct client *);
-void cmdq_guard(struct cmd_q *, const char *, int);
-void printflike(2, 3) cmdq_print(struct cmd_q *, const char *, ...);
-void printflike(2, 3) cmdq_error(struct cmd_q *, const char *, ...);
+void cmdq_guard(struct cmdq_item *, const char *, int);
+void printflike(2, 3) cmdq_print(struct cmdq_item *, const char *, ...);
+void printflike(2, 3) cmdq_error(struct cmdq_item *, const char *, ...);
/* cmd-string.c */
int cmd_string_parse(const char *, struct cmd_list **, const char *,
diff --git a/usr.bin/tmux/window-choose.c b/usr.bin/tmux/window-choose.c
index 236fbeb5cdf..1d7c15bfd3f 100644
--- a/usr.bin/tmux/window-choose.c
+++ b/usr.bin/tmux/window-choose.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-choose.c,v 1.81 2016/10/16 17:55:14 nicm Exp $ */
+/* $OpenBSD: window-choose.c,v 1.82 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -244,9 +244,9 @@ window_choose_data_free(struct window_choose_data *wcd)
void
window_choose_data_run(struct window_choose_data *cdata)
{
- struct cmd_list *cmdlist;
- char *cause;
- struct cmd_q *cmdq;
+ struct cmd_list *cmdlist;
+ char *cause;
+ struct cmdq_item *item;
/*
* The command template will have already been replaced. But if it's
@@ -264,8 +264,8 @@ window_choose_data_run(struct window_choose_data *cdata)
return;
}
- cmdq = cmdq_get_command(cmdlist, NULL, NULL, 0);
- cmdq_append(cdata->start_client, cmdq);
+ item = cmdq_get_command(cmdlist, NULL, NULL, 0);
+ cmdq_append(cdata->start_client, item);
cmd_list_free(cmdlist);
}