varstrlst mailParseAliases(varchar aliases, varchar what
[, varchar flags])
varcharfield indicating what to return:
aliases" - List of entries' aliases (left side)
targets" - List of entries' targets (right side)
types" - List of entries' types: "
flags- An optional CSV list of flags:
includes" - Parse include files (default)
noincludes" - Do not parse include files
varstrlstlist of aliases, targets or types
mailParseAliases function returns a list of aliases, their
targets, or their types, as requested, from an
/etc/aliases-style string buffer. The lists are parallel; thus
a multi-target alias will be "denormalized" and cause that alias to
be returned multiple times, once per target (see alias "
in the example).
By default (or if the "
includes" flag is given),
:include: targets will be read and processed as such. If the
noincludes" flag is given, includes will not be processed
and will be returned as type "
# This is a comment.
"foo": bar, email@example.com, 'joe blow'
nobody: :fail:No such user
<$aliasBuf = $ret>
<$aliases = (mailParseAliases($aliasBuf, "aliases" ))>
<$types = (mailParseAliases($aliasBuf, "types" ))>
<$targets = (mailParseAliases($aliasBuf, "targets" ))>
<loop $aliases $types $targets>
Entry $aliases: Type $types, target is $targets
The output would be:
Entry postmaster: Type address, target is root
Entry foo: Type address, target is bar
Entry foo: Type address, target is firstname.lastname@example.org
Entry foo: Type address, target is joe blow
Entry nobody: Type fail, target is No such user
Entry spam: Type file, target is /dev/null
Entry orders: Type pipe, target is /some/program