Return a Selection: $#
The $#
operator in
the RHS is copied as is into the workspace and
functions as a flag advising
sendmail that an action has
been selected. The $#
must be the first token copied into
the rewritten workspace for it to have this special
meaning. If it occupies any other position in the
workspace, it loses its special meaning:
$# local ← selects delivery agent in the parse rule set 0 $# OK ← accepts a message in the Local_check_mail rule set xxx $# local ← no special meaning
When it is used in the parse
rule set 0 (The parse Rule Set 0 on page 696) and
localaddr
rule
set 5 (The localaddr Rule Set 5 on
page 700) (and occupies the first position in the
rewritten workspace), the $#
operator tells
sendmail that the second
token in the workspace is the name of a delivery
agent (here, local
). When used in the check_
rule sets (Check Headers with Rule Sets on page
265 and The Local_check_ Rule Sets on page 252) subsequent tokens in the workspace
(here, OK
) say
how a message should be handled.
Note that the $#
operator can be prefixed with a $@
or a $
: without losing its
special meaning because those prefix operators are
not copied to the workspace:
$@ $# local rewritten as → $# local
However, those prefix operators are not necessary
because the $#
acts just like a $@
prefix. It prevents the LHS from
attempting to match again after the RHS rewrite, and
it causes any following rules (in that rule set) to
be skipped. When used in non-prefix roles in the
parse
rule set 0 and ...
Get sendmail, 4th 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.