Open Computing ``Hands-On'' Tutorial: January 1994: Listings
Listing 1. A minimal Sendmail configuration file is required to
test rules.
A. Here's x.cf
, a minimal,
do-nothing configuration file:
Mlocal, A=X, P=X
Mprog, A=X, P=X
Do.:%@!^=/[]
B. Run version 8 Sendmail in rule-testing mode:
% /usr/lib/sendmail -oQ/tmp -Cx.cf -bt
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> 0 bob@here
rewrite: ruleset 0 input: "bob" "@" "here"
rewrite: ruleset 0 returns: "bob" "@" "here"
> [Control-D]
% []
Listing 2. This example creates a ``demo'' rule
set that illustrates a few introductory concepts about rules.
A. Your first ``demo'' rule:
Mlocal, A=X, P=X
Mprog, A=X, P=X
Do.:%@!^=/[]
S0
Rleft.side new.stuff this is a comment
B. Run version 8 Sendmail in rule-testing
mode and enter an address.
% /usr/lib/sendmail -oQ/tmp -Cx.cf -bt
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> 0 bob@here
rewrite: ruleset 0 input: "bob" "@" "here"
rewrite: ruleset 0 returns: "bob" "@" "here"
> []
C. Workspace does match the left-hand side:
> 0 left.side
rewrite: ruleset 0 input: left . side
rewrite: ruleset 0 returns: new . stuff
> []
Listing 3. Three new ``demo'' rules.
S0
Rx y
Ry z
Rz a
Listing 4. Four new ``demo'' rules.
Mlocal, A=X, P=X
Mprog, A=X, P=X
Do.:%@!^=/[]
S0
R@ $@one
R@$+ $@two
R$+@$+ $@three
R$+ $@four
Copyright © 1995 The McGraw-Hill Companies, Inc. All Rights Reserved.
Edited by Becca Thomas / Online Editor / UnixWorld Online /
beccat@wcmh.com
Last Modified: Thursday, 30-Nov-95 16:53:23 PST