Mass rename struct cmd_q to struct cmdq_item and related.

This commit is contained in:
nicm
2016-10-16 19:04:05 +00:00
parent ddc4512d2e
commit b342bd0b46
73 changed files with 1002 additions and 972 deletions

View File

@ -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);