summaryrefslogtreecommitdiffstats
path: root/cmd-source-file.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2021-08-20 22:01:46 +0100
committerThomas Adam <thomas@xteddy.org>2021-08-20 22:01:46 +0100
commitb0da0cee4d54aa64db0f49eee509a76fd89d6f68 (patch)
tree1e54ddb0b113708c46e80d342d10be74cdf7b176 /cmd-source-file.c
parent944fde7c57c4f3caebb04cfc3943a81ee9729de8 (diff)
parentd589be6c65c7295880bb84cd875baab2f77d5067 (diff)
Merge branch 'obsd-master' into master
Diffstat (limited to 'cmd-source-file.c')
-rw-r--r--cmd-source-file.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/cmd-source-file.c b/cmd-source-file.c
index c1eeba58..54daa4a3 100644
--- a/cmd-source-file.c
+++ b/cmd-source-file.c
@@ -128,11 +128,11 @@ cmd_source_file_exec(struct cmd *self, struct cmdq_item *item)
struct cmd_source_file_data *cdata;
struct client *c = cmdq_get_client(item);
enum cmd_retval retval = CMD_RETURN_NORMAL;
- char *pattern, *cwd, *expand = NULL;
+ char *pattern, *cwd, *expanded = NULL;
const char *path, *error;
glob_t g;
- int i, result;
- u_int j;
+ int result;
+ u_int i, j;
cdata = xcalloc(1, sizeof *cdata);
cdata->item = item;
@@ -146,13 +146,13 @@ cmd_source_file_exec(struct cmd *self, struct cmdq_item *item)
utf8_stravis(&cwd, server_client_get_cwd(c, NULL), VIS_GLOB);
- for (i = 0; i < args->argc; i++) {
+ for (i = 0; i < args_count(args); i++) {
+ path = args_string(args, i);
if (args_has(args, 'F')) {
- free(expand);
- expand = format_single_from_target(item, args->argv[i]);
- path = expand;
- } else
- path = args->argv[i];
+ free(expanded);
+ expanded = format_single_from_target(item, path);
+ path = expanded;
+ }
if (strcmp(path, "-") == 0) {
cmd_source_file_add(cdata, "-");
continue;
@@ -179,7 +179,7 @@ cmd_source_file_exec(struct cmd *self, struct cmdq_item *item)
free(pattern);
continue;
}
- free(expand);
+ free(expanded);
free(pattern);
for (j = 0; j < g.gl_pathc; j++)