summaryrefslogtreecommitdiffstats
path: root/cmd-source-file.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2019-05-20 15:02:40 +0100
committerThomas Adam <thomas@xteddy.org>2019-05-20 15:02:40 +0100
commit98ee93bde39b608fbcdca3b246b7d2088740f7cb (patch)
tree8772ddfccea6237ae2b6635ef192ef39fe2b82e7 /cmd-source-file.c
parent3a7e15511ba3353588cdf61c0d195699bcb0dcbc (diff)
parent87d82170a615007bbd2f880765f222dd5c263000 (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 aeb11c42..5a3be6f9 100644
--- a/cmd-source-file.c
+++ b/cmd-source-file.c
@@ -48,15 +48,18 @@ static enum cmd_retval
cmd_source_file_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
- int quiet = args_has(args, 'q');
+ int flags = 0;
struct client *c = item->client;
- struct cmdq_item *new_item;
+ struct cmdq_item *new_item, *after;
enum cmd_retval retval;
char *pattern, *tmp;
const char *path = args->argv[0];
glob_t g;
u_int i;
+ if (args_has(args, 'q'))
+ flags |= CFG_QUIET;
+
if (*path == '/')
pattern = xstrdup(path);
else {
@@ -68,7 +71,7 @@ cmd_source_file_exec(struct cmd *self, struct cmdq_item *item)
retval = CMD_RETURN_NORMAL;
if (glob(pattern, 0, NULL, &g) != 0) {
- if (!quiet || errno != ENOENT) {
+ if (errno != ENOENT || (~flags & CFG_QUIET)) {
cmdq_error(item, "%s: %s", path, strerror(errno));
retval = CMD_RETURN_ERROR;
}
@@ -77,9 +80,12 @@ cmd_source_file_exec(struct cmd *self, struct cmdq_item *item)
}
free(pattern);
+ after = item;
for (i = 0; i < (u_int)g.gl_pathc; i++) {
- if (load_cfg(g.gl_pathv[i], c, item, quiet) < 0)
+ if (load_cfg(g.gl_pathv[i], c, after, flags, &new_item) < 0)
retval = CMD_RETURN_ERROR;
+ else if (new_item != NULL)
+ after = new_item;
}
if (cfg_finished) {
new_item = cmdq_get_callback(cmd_source_file_done, NULL);