From bba588752f8085da13edcacd71101055bd617303 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 21 Apr 2017 14:01:19 +0000 Subject: Store state shared between multiple commands in the queue in a shared structure. --- cmd-if-shell.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'cmd-if-shell.c') diff --git a/cmd-if-shell.c b/cmd-if-shell.c index 0b1fe7f5..fafb8cee 100644 --- a/cmd-if-shell.c +++ b/cmd-if-shell.c @@ -65,6 +65,7 @@ static enum cmd_retval cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) { struct args *args = self->args; + struct cmdq_shared *shared = item->shared; struct cmd_if_shell_data *cdata; char *shellcmd, *cmd, *cause; struct cmd_list *cmdlist; @@ -100,7 +101,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) } return (CMD_RETURN_ERROR); } - new_item = cmdq_get_command(cmdlist, NULL, &item->mouse, 0); + new_item = cmdq_get_command(cmdlist, NULL, &shared->mouse, 0); cmdq_insert_after(item, new_item); cmd_list_free(cmdlist); return (CMD_RETURN_NORMAL); @@ -125,7 +126,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) cdata->item = item; else cdata->item = NULL; - memcpy(&cdata->mouse, &item->mouse, sizeof cdata->mouse); + memcpy(&cdata->mouse, &shared->mouse, sizeof cdata->mouse); job_run(shellcmd, s, cwd, NULL, cmd_if_shell_callback, cmd_if_shell_free, cdata); -- cgit