From 34312fd6ee8992ce8d13ec63b074466d5f624acc Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 9 Sep 2021 13:38:32 +0000 Subject: [PATCH] Expand argument to run-shell again. --- arguments.c | 5 +++-- cmd-confirm-before.c | 2 +- cmd-if-shell.c | 8 ++++---- cmd-run-shell.c | 2 +- tmux.h | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/arguments.c b/arguments.c index 20d5e7ba..1555c2f0 100644 --- a/arguments.c +++ b/arguments.c @@ -651,13 +651,14 @@ args_string(struct args *args, u_int idx) /* Make a command now. */ struct cmd_list * -args_make_commands_now(struct cmd *self, struct cmdq_item *item, u_int idx) +args_make_commands_now(struct cmd *self, struct cmdq_item *item, u_int idx, + int expand) { struct args_command_state *state; char *error; struct cmd_list *cmdlist; - state = args_make_commands_prepare(self, item, idx, NULL, 0, 0); + state = args_make_commands_prepare(self, item, idx, NULL, 0, expand); cmdlist = args_make_commands(state, 0, NULL, &error); if (cmdlist == NULL) { cmdq_error(item, "%s", error); diff --git a/cmd-confirm-before.c b/cmd-confirm-before.c index 8f50ba2d..95841962 100644 --- a/cmd-confirm-before.c +++ b/cmd-confirm-before.c @@ -72,7 +72,7 @@ cmd_confirm_before_exec(struct cmd *self, struct cmdq_item *item) int wait = !args_has(args, 'b'); cdata = xcalloc(1, sizeof *cdata); - cdata->cmdlist = args_make_commands_now(self, item, 0); + cdata->cmdlist = args_make_commands_now(self, item, 0, 0); if (cdata->cmdlist == NULL) return (CMD_RETURN_ERROR); diff --git a/cmd-if-shell.c b/cmd-if-shell.c index 907a96e1..9cdcfc51 100644 --- a/cmd-if-shell.c +++ b/cmd-if-shell.c @@ -84,9 +84,9 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) shellcmd = format_single_from_target(item, args_string(args, 0)); if (args_has(args, 'F')) { if (*shellcmd != '0' && *shellcmd != '\0') - cmdlist = args_make_commands_now(self, item, 1); + cmdlist = args_make_commands_now(self, item, 1, 0); else if (count == 3) - cmdlist = args_make_commands_now(self, item, 2); + cmdlist = args_make_commands_now(self, item, 2, 0); else { free(shellcmd); return (CMD_RETURN_NORMAL); @@ -101,11 +101,11 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) cdata = xcalloc(1, sizeof *cdata); - cdata->cmd_if = args_make_commands_now(self, item, 1); + cdata->cmd_if = args_make_commands_now(self, item, 1, 0); if (cdata->cmd_if == NULL) return (CMD_RETURN_ERROR); if (count == 3) { - cdata->cmd_else = args_make_commands_now(self, item, 2); + cdata->cmd_else = args_make_commands_now(self, item, 2, 0); if (cdata->cmd_else == NULL) return (CMD_RETURN_ERROR); } diff --git a/cmd-run-shell.c b/cmd-run-shell.c index 662312fb..7d672f85 100644 --- a/cmd-run-shell.c +++ b/cmd-run-shell.c @@ -132,7 +132,7 @@ cmd_run_shell_exec(struct cmd *self, struct cmdq_item *item) if (cmd != NULL) cdata->cmd = format_single_from_target(item, cmd); } else { - cdata->cmdlist = args_make_commands_now(self, item, 0); + cdata->cmdlist = args_make_commands_now(self, item, 0, 1); if (cdata->cmdlist == NULL) return (CMD_RETURN_ERROR); } diff --git a/tmux.h b/tmux.h index ca67fd03..7a77cdae 100644 --- a/tmux.h +++ b/tmux.h @@ -2234,7 +2234,7 @@ struct args_value *args_values(struct args *); struct args_value *args_value(struct args *, u_int); const char *args_string(struct args *, u_int); struct cmd_list *args_make_commands_now(struct cmd *, struct cmdq_item *, - u_int); + u_int, int); struct args_command_state *args_make_commands_prepare(struct cmd *, struct cmdq_item *, u_int, const char *, int, int); struct cmd_list *args_make_commands(struct args_command_state *, int, char **,