readability</title>
<screen>
set my_cfgdir = $HOME/mutt/config
-source $my_cfgdir/hooks
-source $my_cfgdir/macros
+source $my_cfgdir/hooks $my_cfgdir/macros
<emphasis role="comment"># more source commands...</emphasis>
</screen>
</example>
<para>Usage:</para>
<cmdsynopsis>
<command>source</command>
- <arg choice="plain">
- <replaceable class="parameter">filename</replaceable>
+ <arg choice="plain" rep="repeat">
+ <replaceable class="parameter">file</replaceable>
</arg>
</cmdsynopsis>
<para>This command allows the inclusion of initialization commands from
#undef MAXERRS
-static int parse_source(struct Buffer *tmp, struct Buffer *s,
+static int parse_source(struct Buffer *tmp, struct Buffer *token,
unsigned long data, struct Buffer *err)
{
char path[_POSIX_PATH_MAX];
- if (mutt_extract_token(tmp, s, 0) != 0)
- {
- snprintf(err->data, err->dsize, _("source: error at %s"), s->dptr);
- return -1;
- }
- if (MoreArgs(s))
+ do
{
- strfcpy(err->data, _("source: too many arguments"), err->dsize);
- return -1;
- }
- strfcpy(path, tmp->data, sizeof(path));
- mutt_expand_path(path, sizeof(path));
- return source_rc(path, err);
+ if (mutt_extract_token(tmp, token, 0) != 0)
+ {
+ snprintf(err->data, err->dsize, _("source: error at %s"), token->dptr);
+ return -1;
+ }
+ strfcpy(path, tmp->data, sizeof(path));
+ mutt_expand_path(path, sizeof(path));
+
+ if (source_rc(path, err) < 0)
+ {
+ snprintf(err->data, err->dsize,
+ _("source: file %s could not be sourced."), path);
+ return -1;
+ }
+
+ } while (MoreArgs(token));
+
+ return 0;
}
/* line command to execute
unsigned long data, struct Buffer *err);
static int parse_unignore(struct Buffer *buf, struct Buffer *s,
unsigned long data, struct Buffer *err);
-static int parse_source(struct Buffer *buf, struct Buffer *s,
+static int parse_source(struct Buffer *buf, struct Buffer *token,
unsigned long data, struct Buffer *err);
static int parse_set(struct Buffer *buf, struct Buffer *s, unsigned long data,
struct Buffer *err);