Skip to content

Commit b342bd0

Browse files
author
nicm
committed
Mass rename struct cmd_q to struct cmdq_item and related.
1 parent ddc4512 commit b342bd0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1001
-971
lines changed

cfg.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static u_int cfg_ncauses;
3535
struct client *cfg_client;
3636

3737
static enum cmd_retval
38-
cfg_done(__unused struct cmd_q *cmdq, __unused void *data)
38+
cfg_done(__unused struct cmdq_item *item, __unused void *data)
3939
{
4040
if (cfg_finished)
4141
return (CMD_RETURN_NORMAL);
@@ -79,15 +79,15 @@ start_cfg(void)
7979
}
8080

8181
int
82-
load_cfg(const char *path, struct client *c, struct cmd_q *cmdq, int quiet)
82+
load_cfg(const char *path, struct client *c, struct cmdq_item *item, int quiet)
8383
{
84-
FILE *f;
85-
char delim[3] = { '\\', '\\', '\0' };
86-
u_int found;
87-
size_t line = 0;
88-
char *buf, *cause1, *p;
89-
struct cmd_list *cmdlist;
90-
struct cmd_q *new_cmdq;
84+
FILE *f;
85+
char delim[3] = { '\\', '\\', '\0' };
86+
u_int found;
87+
size_t line = 0;
88+
char *buf, *cause1, *p;
89+
struct cmd_list *cmdlist;
90+
struct cmdq_item *new_item;
9191

9292
log_debug("loading %s", path);
9393
if ((f = fopen(path, "rb")) == NULL) {
@@ -123,11 +123,11 @@ load_cfg(const char *path, struct client *c, struct cmd_q *cmdq, int quiet)
123123

124124
if (cmdlist == NULL)
125125
continue;
126-
new_cmdq = cmdq_get_command(cmdlist, NULL, NULL, 0);
127-
if (cmdq != NULL)
128-
cmdq_insert_after(cmdq, new_cmdq);
126+
new_item = cmdq_get_command(cmdlist, NULL, NULL, 0);
127+
if (item != NULL)
128+
cmdq_insert_after(item, new_item);
129129
else
130-
cmdq_append(c, new_cmdq);
130+
cmdq_append(c, new_item);
131131
cmd_list_free(cmdlist);
132132

133133
found++;
@@ -153,12 +153,12 @@ cfg_add_cause(const char *fmt, ...)
153153
}
154154

155155
void
156-
cfg_print_causes(struct cmd_q *cmdq)
156+
cfg_print_causes(struct cmdq_item *item)
157157
{
158158
u_int i;
159159

160160
for (i = 0; i < cfg_ncauses; i++) {
161-
cmdq_print(cmdq, "%s", cfg_causes[i]);
161+
cmdq_print(item, "%s", cfg_causes[i]);
162162
free(cfg_causes[i]);
163163
}
164164

cmd-attach-session.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
* Attach existing session to the current terminal.
3131
*/
3232

33-
static enum cmd_retval cmd_attach_session_exec(struct cmd *, struct cmd_q *);
33+
static enum cmd_retval cmd_attach_session_exec(struct cmd *,
34+
struct cmdq_item *);
3435

3536
const struct cmd_entry cmd_attach_session_entry = {
3637
.name = "attach-session",
@@ -46,26 +47,26 @@ const struct cmd_entry cmd_attach_session_entry = {
4647
};
4748

4849
enum cmd_retval
49-
cmd_attach_session(struct cmd_q *cmdq, int dflag, int rflag, const char *cflag,
50-
int Eflag)
50+
cmd_attach_session(struct cmdq_item *item, int dflag, int rflag,
51+
const char *cflag, int Eflag)
5152
{
52-
struct session *s = cmdq->state.tflag.s;
53-
struct client *c = cmdq->client, *c_loop;
54-
struct winlink *wl = cmdq->state.tflag.wl;
55-
struct window_pane *wp = cmdq->state.tflag.wp;
53+
struct session *s = item->state.tflag.s;
54+
struct client *c = item->client, *c_loop;
55+
struct winlink *wl = item->state.tflag.wl;
56+
struct window_pane *wp = item->state.tflag.wp;
5657
const char *update;
5758
char *cause, *cwd;
5859
struct format_tree *ft;
5960

6061
if (RB_EMPTY(&sessions)) {
61-
cmdq_error(cmdq, "no sessions");
62+
cmdq_error(item, "no sessions");
6263
return (CMD_RETURN_ERROR);
6364
}
6465

6566
if (c == NULL)
6667
return (CMD_RETURN_NORMAL);
6768
if (server_client_check_nested(c)) {
68-
cmdq_error(cmdq, "sessions should be nested with care, "
69+
cmdq_error(item, "sessions should be nested with care, "
6970
"unset $TMUX to force");
7071
return (CMD_RETURN_ERROR);
7172
}
@@ -77,7 +78,7 @@ cmd_attach_session(struct cmd_q *cmdq, int dflag, int rflag, const char *cflag,
7778
}
7879

7980
if (cflag != NULL) {
80-
ft = format_create(cmdq, 0);
81+
ft = format_create(item, 0);
8182
format_defaults(ft, c, s, wl, wp);
8283
cwd = format_expand(ft, cflag);
8384
format_free(ft);
@@ -111,7 +112,7 @@ cmd_attach_session(struct cmd_q *cmdq, int dflag, int rflag, const char *cflag,
111112
s->curw->flags &= ~WINLINK_ALERTFLAGS;
112113
} else {
113114
if (server_client_open(c, &cause) != 0) {
114-
cmdq_error(cmdq, "open terminal failed: %s", cause);
115+
cmdq_error(item, "open terminal failed: %s", cause);
115116
free(cause);
116117
return (CMD_RETURN_ERROR);
117118
}
@@ -155,10 +156,10 @@ cmd_attach_session(struct cmd_q *cmdq, int dflag, int rflag, const char *cflag,
155156
}
156157

157158
static enum cmd_retval
158-
cmd_attach_session_exec(struct cmd *self, struct cmd_q *cmdq)
159+
cmd_attach_session_exec(struct cmd *self, struct cmdq_item *item)
159160
{
160161
struct args *args = self->args;
161162

162-
return (cmd_attach_session(cmdq, args_has(args, 'd'),
163+
return (cmd_attach_session(item, args_has(args, 'd'),
163164
args_has(args, 'r'), args_get(args, 'c'), args_has(args, 'E')));
164165
}

cmd-bind-key.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
* Bind a key to a command, this recurses through cmd_*.
2828
*/
2929

30-
static enum cmd_retval cmd_bind_key_exec(struct cmd *, struct cmd_q *);
30+
static enum cmd_retval cmd_bind_key_exec(struct cmd *, struct cmdq_item *);
3131

32-
static enum cmd_retval cmd_bind_key_mode_table(struct cmd *, struct cmd_q *,
33-
key_code);
32+
static enum cmd_retval cmd_bind_key_mode_table(struct cmd *,
33+
struct cmdq_item *, key_code);
3434

3535
const struct cmd_entry cmd_bind_key_entry = {
3636
.name = "bind-key",
@@ -45,7 +45,7 @@ const struct cmd_entry cmd_bind_key_entry = {
4545
};
4646

4747
static enum cmd_retval
48-
cmd_bind_key_exec(struct cmd *self, struct cmd_q *cmdq)
48+
cmd_bind_key_exec(struct cmd *self, struct cmdq_item *item)
4949
{
5050
struct args *args = self->args;
5151
char *cause;
@@ -55,24 +55,24 @@ cmd_bind_key_exec(struct cmd *self, struct cmd_q *cmdq)
5555

5656
if (args_has(args, 't')) {
5757
if (args->argc != 2 && args->argc != 3) {
58-
cmdq_error(cmdq, "not enough arguments");
58+
cmdq_error(item, "not enough arguments");
5959
return (CMD_RETURN_ERROR);
6060
}
6161
} else {
6262
if (args->argc < 2) {
63-
cmdq_error(cmdq, "not enough arguments");
63+
cmdq_error(item, "not enough arguments");
6464
return (CMD_RETURN_ERROR);
6565
}
6666
}
6767

6868
key = key_string_lookup_string(args->argv[0]);
6969
if (key == KEYC_NONE || key == KEYC_UNKNOWN) {
70-
cmdq_error(cmdq, "unknown key: %s", args->argv[0]);
70+
cmdq_error(item, "unknown key: %s", args->argv[0]);
7171
return (CMD_RETURN_ERROR);
7272
}
7373

7474
if (args_has(args, 't'))
75-
return (cmd_bind_key_mode_table(self, cmdq, key));
75+
return (cmd_bind_key_mode_table(self, item, key));
7676

7777
if (args_has(args, 'T'))
7878
tablename = args_get(args, 'T');
@@ -84,7 +84,7 @@ cmd_bind_key_exec(struct cmd *self, struct cmd_q *cmdq)
8484
cmdlist = cmd_list_parse(args->argc - 1, args->argv + 1, NULL, 0,
8585
&cause);
8686
if (cmdlist == NULL) {
87-
cmdq_error(cmdq, "%s", cause);
87+
cmdq_error(item, "%s", cause);
8888
free(cause);
8989
return (CMD_RETURN_ERROR);
9090
}
@@ -94,7 +94,7 @@ cmd_bind_key_exec(struct cmd *self, struct cmd_q *cmdq)
9494
}
9595

9696
static enum cmd_retval
97-
cmd_bind_key_mode_table(struct cmd *self, struct cmd_q *cmdq, key_code key)
97+
cmd_bind_key_mode_table(struct cmd *self, struct cmdq_item *item, key_code key)
9898
{
9999
struct args *args = self->args;
100100
const char *tablename;
@@ -104,18 +104,18 @@ cmd_bind_key_mode_table(struct cmd *self, struct cmd_q *cmdq, key_code key)
104104

105105
tablename = args_get(args, 't');
106106
if ((mtab = mode_key_findtable(tablename)) == NULL) {
107-
cmdq_error(cmdq, "unknown key table: %s", tablename);
107+
cmdq_error(item, "unknown key table: %s", tablename);
108108
return (CMD_RETURN_ERROR);
109109
}
110110

111111
cmd = mode_key_fromstring(mtab->cmdstr, args->argv[1]);
112112
if (cmd == MODEKEY_NONE) {
113-
cmdq_error(cmdq, "unknown command: %s", args->argv[1]);
113+
cmdq_error(item, "unknown command: %s", args->argv[1]);
114114
return (CMD_RETURN_ERROR);
115115
}
116116

117117
if (args->argc != 2) {
118-
cmdq_error(cmdq, "no argument allowed");
118+
cmdq_error(item, "no argument allowed");
119119
return (CMD_RETURN_ERROR);
120120
}
121121

cmd-break-pane.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
#define BREAK_PANE_TEMPLATE "#{session_name}:#{window_index}.#{pane_index}"
3030

31-
static enum cmd_retval cmd_break_pane_exec(struct cmd *, struct cmd_q *);
31+
static enum cmd_retval cmd_break_pane_exec(struct cmd *, struct cmdq_item *);
3232

3333
const struct cmd_entry cmd_break_pane_entry = {
3434
.name = "break-pane",
@@ -45,28 +45,28 @@ const struct cmd_entry cmd_break_pane_entry = {
4545
};
4646

4747
static enum cmd_retval
48-
cmd_break_pane_exec(struct cmd *self, struct cmd_q *cmdq)
48+
cmd_break_pane_exec(struct cmd *self, struct cmdq_item *item)
4949
{
5050
struct args *args = self->args;
51-
struct winlink *wl = cmdq->state.sflag.wl;
52-
struct session *src_s = cmdq->state.sflag.s;
53-
struct session *dst_s = cmdq->state.tflag.s;
54-
struct window_pane *wp = cmdq->state.sflag.wp;
51+
struct winlink *wl = item->state.sflag.wl;
52+
struct session *src_s = item->state.sflag.s;
53+
struct session *dst_s = item->state.tflag.s;
54+
struct window_pane *wp = item->state.sflag.wp;
5555
struct window *w = wl->window;
5656
char *name;
5757
char *cause;
58-
int idx = cmdq->state.tflag.idx;
58+
int idx = item->state.tflag.idx;
5959
struct format_tree *ft;
6060
const char *template;
6161
char *cp;
6262

6363
if (idx != -1 && winlink_find_by_index(&dst_s->windows, idx) != NULL) {
64-
cmdq_error(cmdq, "index %d already in use", idx);
64+
cmdq_error(item, "index %d already in use", idx);
6565
return (CMD_RETURN_ERROR);
6666
}
6767

6868
if (window_count_panes(w) == 1) {
69-
cmdq_error(cmdq, "can't break with only one pane");
69+
cmdq_error(item, "can't break with only one pane");
7070
return (CMD_RETURN_ERROR);
7171
}
7272
server_unzoom_window(w);
@@ -101,11 +101,11 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_q *cmdq)
101101
if ((template = args_get(args, 'F')) == NULL)
102102
template = BREAK_PANE_TEMPLATE;
103103

104-
ft = format_create(cmdq, 0);
105-
format_defaults(ft, cmdq->state.c, dst_s, wl, wp);
104+
ft = format_create(item, 0);
105+
format_defaults(ft, item->state.c, dst_s, wl, wp);
106106

107107
cp = format_expand(ft, template);
108-
cmdq_print(cmdq, "%s", cp);
108+
cmdq_print(item, "%s", cp);
109109
free(cp);
110110

111111
format_free(ft);

cmd-capture-pane.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,13 @@
2727
* Write the entire contents of a pane to a buffer or stdout.
2828
*/
2929

30-
static enum cmd_retval cmd_capture_pane_exec(struct cmd *, struct cmd_q *);
30+
static enum cmd_retval cmd_capture_pane_exec(struct cmd *, struct cmdq_item *);
3131

32-
static char *cmd_capture_pane_append(char *, size_t *, char *,
33-
size_t);
34-
static char *cmd_capture_pane_pending(struct args *,
35-
struct window_pane *, size_t *);
36-
static char *cmd_capture_pane_history(struct args *, struct cmd_q *,
37-
struct window_pane *, size_t *);
32+
static char *cmd_capture_pane_append(char *, size_t *, char *, size_t);
33+
static char *cmd_capture_pane_pending(struct args *, struct window_pane *,
34+
size_t *);
35+
static char *cmd_capture_pane_history(struct args *, struct cmdq_item *,
36+
struct window_pane *, size_t *);
3837

3938
const struct cmd_entry cmd_capture_pane_entry = {
4039
.name = "capture-pane",
@@ -92,7 +91,8 @@ cmd_capture_pane_pending(struct args *args, struct window_pane *wp,
9291
}
9392

9493
static char *
95-
cmd_capture_pane_history(struct args *args, struct cmd_q *cmdq,
94+
95+
cmd_capture_pane_history(struct args *args, struct cmdq_item *item,
9696
struct window_pane *wp, size_t *len)
9797
{
9898
struct grid *gd;
@@ -109,7 +109,7 @@ cmd_capture_pane_history(struct args *args, struct cmd_q *cmdq,
109109
gd = wp->saved_grid;
110110
if (gd == NULL) {
111111
if (!args_has(args, 'q')) {
112-
cmdq_error(cmdq, "no alternate screen");
112+
cmdq_error(item, "no alternate screen");
113113
return (NULL);
114114
}
115115
return (xstrdup(""));
@@ -177,11 +177,11 @@ cmd_capture_pane_history(struct args *args, struct cmd_q *cmdq,
177177
}
178178

179179
static enum cmd_retval
180-
cmd_capture_pane_exec(struct cmd *self, struct cmd_q *cmdq)
180+
cmd_capture_pane_exec(struct cmd *self, struct cmdq_item *item)
181181
{
182182
struct args *args = self->args;
183183
struct client *c;
184-
struct window_pane *wp = cmdq->state.tflag.wp;
184+
struct window_pane *wp = item->state.tflag.wp;
185185
char *buf, *cause;
186186
const char *bufname;
187187
size_t len;
@@ -190,15 +190,15 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_q *cmdq)
190190
if (args_has(args, 'P'))
191191
buf = cmd_capture_pane_pending(args, wp, &len);
192192
else
193-
buf = cmd_capture_pane_history(args, cmdq, wp, &len);
193+
buf = cmd_capture_pane_history(args, item, wp, &len);
194194
if (buf == NULL)
195195
return (CMD_RETURN_ERROR);
196196

197197
if (args_has(args, 'p')) {
198-
c = cmdq->client;
198+
c = item->client;
199199
if (c == NULL ||
200200
(c->session != NULL && !(c->flags & CLIENT_CONTROL))) {
201-
cmdq_error(cmdq, "can't write to stdout");
201+
cmdq_error(item, "can't write to stdout");
202202
free(buf);
203203
return (CMD_RETURN_ERROR);
204204
}
@@ -213,7 +213,7 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_q *cmdq)
213213
bufname = args_get(args, 'b');
214214

215215
if (paste_set(buf, len, bufname, &cause) != 0) {
216-
cmdq_error(cmdq, "%s", cause);
216+
cmdq_error(item, "%s", cause);
217217
free(cause);
218218
free(buf);
219219
return (CMD_RETURN_ERROR);

0 commit comments

Comments
 (0)