In yet others, macros are neither recognized nor expanded.
To illustrate, macros used in header commands are not expanded until the headers
of a mail message are processed:
H?x?Full-Name: $x
Here, $x (?§21.9.103 on page 851) can change as sendmail is running. It contains as its
value the full name of the sender. Clearly, this macro should not be expanded until
that full name is known.
This is the Title of the Book, eMatter Edition
Copyright ?© 2007 O??™Reilly & Associates, Inc. All rights reserved.
21.5 Macro Expansion: $ and $& | 793
On the other hand, macros in rules are always expanded when the configuration file is
read. Therefore, macros such as $x should never be used in rules because the configuration
file is read long before mail is processed:
R$x ($x)
Rules suchas this won??™t work because $x lacks a value when the configuration file is
read. This rule will be expanded to become meaningless:
R ( )
Note that the $digit positional operator (?§18.7.1 on page 661) in the RHS cannot be
used to reference defined macros in the LHS. Consider this example, in which {HOST}
has the value myhost:
R${HOST} <$1>
The ${HOST} is expanded when the configuration file is read and is transformed into:
Rmyhost <$1> ?†? error
Here, the $1 has no wildcard operator in the LHS to reference and so will produce
this error:
configfile: line num: replacement $1 out of bounds
21.
Pages:
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393