Name
sequence
Synopsis
The
sequence
type allows you to declare a single name
that will be used to search a series of databases. It is declared
like this:
Kname sequence map1 map2 ...
Here, a key (in a later rule set) will be looked up first in the
database map named map1
, and if not found
there, it will be looked up in the database map named
map2
. The type of each of the listed
database maps should logically relate but need not be the same.
Consider, for example, a rule’s RHS, where a lookup
will match if the workspace contains either a user’s
login name or the name of a host, with the hostname taking
precedence:
Khosts host -a<+> /etc/hosts Kpasswd user -a<-> /etc/passwd Kboth sequence hosts passwd R$- $: $(both $1 $)
Here, we say that the database map named both
is
of type sequence
. Any single token in the LHS will
be looked up first in the database map named
hosts
, and if it is found there the hostname will
be returned with a <+>
appended. If it is
not found in the hosts
database map, it will be
next looked up in the passwd
database map. If it
is found there, the original workspace will be returned with a
<->
appended. If the workspace is not found
in either database map, the lookup fails and the workspace remains
unchanged.
If any database map in the series of database maps declared with the
K
command does not exist, as for example:
Kboth sequence hosts passwd badname
the following error is logged and printed, and that database map is ignored:
Sequence map both: unknown member map ...
Get Sendmail, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.