Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2020-09-01 12:01:20 +01:00
4 changed files with 100 additions and 42 deletions

View File

@@ -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++)