summaryrefslogtreecommitdiffstats
path: root/cmd-source-file.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2020-09-01 12:01:20 +0100
committerThomas Adam <thomas@xteddy.org>2020-09-01 12:01:20 +0100
commita0fee328bf7d2cefe047f3911e7e29955f14a75a (patch)
treefe18cdabbcd74bffaeadbc46dbf00e390659161b /cmd-source-file.c
parentb895ffbf37ef79c9fd8a3330dd60852626d4dd6b (diff)
parent60860aced8d424ef6c1d527b63842a0ea0f452ad (diff)
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-source-file.c')
-rw-r--r--cmd-source-file.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/cmd-source-file.c b/cmd-source-file.c
index f5a0ca4b..1da59193 100644
--- a/cmd-source-file.c
+++ b/cmd-source-file.c
@@ -35,8 +35,8 @@ const struct cmd_entry cmd_source_file_entry = {
.name = "source-file",
.alias = "source",
- .args = { "nqv", 1, -1 },
- .usage = "[-nqv] path ...",
+ .args = { "Fnqv", 1, -1 },
+ .usage = "[-Fnqv] path ...",
.flags = 0,
.exec = cmd_source_file_exec
@@ -126,7 +126,7 @@ 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;
+ char *pattern, *cwd, *expand = NULL;
const char *path, *error;
glob_t g;
int i, result;
@@ -145,7 +145,12 @@ 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++) {
- path = args->argv[i];
+ if (args_has(args, 'F')) {
+ free(expand);
+ expand = format_single_from_target(item, args->argv[i]);
+ path = expand;
+ } else
+ path = args->argv[i];
if (strcmp(path, "-") == 0) {
cmd_source_file_add(cdata, "-");
continue;
@@ -172,6 +177,7 @@ cmd_source_file_exec(struct cmd *self, struct cmdq_item *item)
free(pattern);
continue;
}
+ free(expand);
free(pattern);
for (j = 0; j < g.gl_pathc; j++)