summaryrefslogtreecommitdiffstats
path: root/cmd-run-shell.c
diff options
context:
space:
mode:
authornicm <nicm>2021-08-20 19:50:16 +0000
committernicm <nicm>2021-08-20 19:50:16 +0000
commit5f32b7d9613e9ef3f8198302379a42630323da6a (patch)
tree0a0b488496625e9da5cbc02c5a1271634568ecc3 /cmd-run-shell.c
parentde94a344f61b0e4ef6459c11621be3c3d1683c9e (diff)
Hide struct args behind a couple of accessor functions.
Diffstat (limited to 'cmd-run-shell.c')
-rw-r--r--cmd-run-shell.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/cmd-run-shell.c b/cmd-run-shell.c
index 7bc1d7cc..a0115f0a 100644
--- a/cmd-run-shell.c
+++ b/cmd-run-shell.c
@@ -104,6 +104,7 @@ cmd_run_shell_exec(struct cmd *self, struct cmdq_item *item)
double d;
struct timeval tv;
char *end;
+ const char *cmd = args_string(args, 0);
int wait = !args_has(args, 'b');
if ((delay = args_get(args, 'd')) != NULL) {
@@ -112,12 +113,12 @@ cmd_run_shell_exec(struct cmd *self, struct cmdq_item *item)
cmdq_error(item, "invalid delay time: %s", delay);
return (CMD_RETURN_ERROR);
}
- } else if (args->argc == 0)
+ } else if (args_count(args) == 0)
return (CMD_RETURN_NORMAL);
cdata = xcalloc(1, sizeof *cdata);
- if (args->argc != 0)
- cdata->cmd = format_single_from_target(item, args->argv[0]);
+ if (cmd != NULL)
+ cdata->cmd = format_single_from_target(item, cmd);
cdata->shell = !args_has(args, 'C');
if (!cdata->shell) {