summaryrefslogtreecommitdiffstats
path: root/cmd-if-shell.c
diff options
context:
space:
mode:
authornicm <nicm>2020-04-13 10:59:58 +0000
committernicm <nicm>2020-04-13 10:59:58 +0000
commit04cdd035250b93b728678d515b69690653dced4e (patch)
tree34edc5f4affb9a640a95c7d531eb06770b6ea3c9 /cmd-if-shell.c
parentc20eb0c0ae3347c768894a6355adfd7ebae6f2f3 (diff)
Also move cmdq_item and cmdq_list into cmd-queue.c (this is to make its
use more clearly defined and preparation for some future work).
Diffstat (limited to 'cmd-if-shell.c')
-rw-r--r--cmd-if-shell.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/cmd-if-shell.c b/cmd-if-shell.c
index a678cf40..a385f9f7 100644
--- a/cmd-if-shell.c
+++ b/cmd-if-shell.c
@@ -63,20 +63,19 @@ static enum cmd_retval
cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = cmd_get_args(self);
- struct mouse_event *m = &item->shared->mouse;
+ struct cmdq_shared *shared = cmdq_get_shared(item);
+ struct cmd_find_state *target = cmdq_get_target(item);
+ struct mouse_event *m = &shared->mouse;
struct cmd_if_shell_data *cdata;
char *shellcmd, *cmd;
const char *file;
struct cmdq_item *new_item;
- struct cmd_find_state *fs = &item->target;
struct client *c = cmd_find_client(item, NULL, 1);
- struct session *s = fs->s;
- struct winlink *wl = fs->wl;
- struct window_pane *wp = fs->wp;
+ struct session *s = target->s;
struct cmd_parse_input pi;
struct cmd_parse_result *pr;
- shellcmd = format_single(item, args->argv[0], c, s, wl, wp);
+ shellcmd = format_single_from_target(item, args->argv[0], c);
if (args_has(args, 'F')) {
if (*shellcmd != '0' && *shellcmd != '\0')
cmd = args->argv[1];
@@ -92,7 +91,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item)
cmd_get_source(self, &pi.file, &pi.line);
pi.item = item;
pi.c = c;
- cmd_find_copy_state(&pi.fs, fs);
+ cmd_find_copy_state(&pi.fs, target);
pr = cmd_parse_from_string(cmd, &pi);
switch (pr->status) {
@@ -103,7 +102,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item)
free(pr->error);
return (CMD_RETURN_ERROR);
case CMD_PARSE_SUCCESS:
- new_item = cmdq_get_command(pr->cmdlist, fs, m, 0);
+ new_item = cmdq_get_command(pr->cmdlist, target, m, 0);
cmdq_insert_after(item, new_item);
cmd_list_free(pr->cmdlist);
break;
@@ -121,7 +120,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item)
memcpy(&cdata->mouse, m, sizeof cdata->mouse);
if (!args_has(args, 'b'))
- cdata->client = item->client;
+ cdata->client = cmdq_get_client(item);
else
cdata->client = c;
if (cdata->client != NULL)
@@ -139,9 +138,10 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item)
cdata->input.c = c;
if (cdata->input.c != NULL)
cdata->input.c->references++;
- cmd_find_copy_state(&cdata->input.fs, fs);
+ cmd_find_copy_state(&cdata->input.fs, target);
- if (job_run(shellcmd, s, server_client_get_cwd(item->client, s), NULL,
+ if (job_run(shellcmd, s,
+ server_client_get_cwd(cmdq_get_client(item), s), NULL,
cmd_if_shell_callback, cmd_if_shell_free, cdata, 0, -1,
-1) == NULL) {
cmdq_error(item, "failed to run command: %s", shellcmd);