Next: Here Documents, Previous: Numbers, Up: MFL [Contents][Index]
A literal is any sequence of characters enclosed in single or double quotes.
After tempfail
and reject
actions two special kinds of
literals are recognized: three-digit numeric values represent
RFC 2821 reply codes, and literals consisting of tree digit
groups separated by dots represent an extended reply code as per
RFC 1893/2034. For example:
510 # A reply code 5.7.1 # An extended reply code
String literals enclosed in double quotation marks (double-quoted strings) are subject to backslash interpretation, macro expansion, variable interpretation and back reference interpretation.
Backslash interpretation is performed at compilation time. It consists in replacing the following escape sequences with the corresponding single characters:
Sequence | Replaced with |
\a | Audible bell character (ASCII 7) |
\b | Backspace character (ASCII 8) |
\f | Form-feed character (ASCII 12) |
\n | Newline character (ASCII 10) |
\r | Carriage return character (ASCII 13) |
\t | Horizontal tabulation character (ASCII 9) |
\v | Vertical tabulation character (ASCII 11) |
In addition, the sequence ‘\newline’ has the same effect as ‘\n’, for example:
"a string with\ embedded newline" "a string with\n embedded newline"
Any escape sequence of the form ‘\xhh’, where h denotes any hex digit is replaced with the character whose ASCII value is hh. For example:
"\x61nother" ⇒ "another"
Similarly, an escape sequence of the form ‘\0ooo’, where o is an octal digit, is replaced with the character whose ASCII value is ooo.
Macro expansion and variable interpretation occur at run-time. During
these phases all Sendmail macros (see Sendmail Macros),
mailfromd
variables (see Variables), and constants
(see Constants) referenced in the string are replaced by their
actual values. For example, if the Sendmail macro f
has the
value ‘postmaster@gnu.org.ua’ and the variable last_ip
has the value ‘127.0.0.1’, then the
string11
"$f last connected from %last_ip;"
will be expanded to
"postmaster@gnu.org.ua last connected from 127.0.0.1;"
A back reference is a sequence ‘\d’, where d
is a decimal number. It refers to the dth parenthesized
subexpression in the last matches
statement12. Any back reference occurring within a
double-quoted string is replaced by the value of the corresponding
subexpression. See Special comparisons, for a detailed
description of this process. Back reference interpretation is
performed at run time.
Any characters enclosed in single quotation marks are read unmodified.
The following examples contain pairs of equivalent strings:
"a string" 'a string' "\\(.*\\):" '\(.*\):'
Notice the last example. Single quotes are particularly useful in writing regular expressions (see Special comparisons).
Implementation note: actually, the references are not interpreted within the string, instead, each such string is split at compilation time into a series of concatenated atoms. Thus, our sample string will actually be compiled as:
$f . " last connected from " . last_ip . ";"
See Concatenation, for a description of this construct. You can easily see how various strings are interpreted by using --dump-tree option (see --dump-tree). In this case, it will produce:
CONCAT: CONCAT: CONCAT: SYMBOL: f CONSTANT: " last connected from " VARIABLE last_ip (13) CONSTANT: ";"
The subexpressions are numbered by the positions of their opening parentheses, left to right.
Next: Here Documents, Previous: Numbers, Up: MFL [Contents][Index]