Consider, for example, the following rule:
R $+ < @ $- . $* > $: $1
Here, there are three wildcard operators in the LHS. The first (the $+) corresponds to the $1
on the RHS. The object of this rule is to match a focused address and rewrite it as the username.
For example, gw@wash.dc.gov will be rewritten to be gw.
The $digit operator can be used only on the RHS of rules. See ?§18.7.1 on page 661 for a
full description of this $digit operator.
18.9.12 $=
Match any token in a class LHS operator
When trying to match tokens in the workspace to members of a class, you can use the $=
operator. For example, consider the following rule:
R $+ < @ $={InternalHosts} > $: $1 < @ mailhub >
Here, the workspace is expected to hold a focused address (such as gw<@wash.dc.gov>).
The $={InternalHosts} expression causes sendmail to look up the host part of the address
(the wash.dc.gov) in the class {InternalHosts}. If that host is found in that class, a match is
made and the workspace is rewritten by the RHS to become gw<@mailhub>.
Class macros in general are described in Chapter 22 on page 854, and the $= operator in
particular is described in full in ?§22.2.1 on page 863.
Note that the $= operator can be used only on the LHS of rules, and that the $= operator
can be referenced by an RHS $digit operator.
18.9.13 $>
Rewrite through another rule set RHS operator
It is often valuable to group rule sets by function and call them as subroutines from a rule.
Pages:
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191