Полезная информация

sendmail

sendmailSearch this book
Previous: 31.3 Configuration File DefinitionsChapter 31
Defined Macros
Next: 31.5 Macro Expansion: $ and $&
 

31.4 Macro Names

Prior to V8.7 sendmail, macros could only have single characters as names. Beginning with V8.7, macros may be single- or multicharacter.

31.4.1 Single-Character Names

Prior to V8.7 sendmail the name of a macro was required to be a single character. Beginning with V8.7, the name of a macro may optionally be a single character. Any character may be used. However, sendmail uses many characters internally and requires that they serve specific purposes. In general, only uppercase letters should be employed as user-defined macro names. Arbitrary use of other characters can lead to unexpected results.

The character that is the macro's name must be a single-byte character. Multibyte international characters have only the first byte (or last, depending on the machine architecture) used for the macro's name, and what remains is joined to the text.

The high (most significant) bit of the character is always cleared (set to zero) by sendmail.

31.4.2 Multicharacter Names

Beginning with V8.7, macro names may be multicharacter. A multicharacter macro name must always appear inside a curly brace pair. [7] .SP_reset For example,

[7] As an artifact of this scheme, a single character surrounded in curly braces is treated as if the curly braces were absent:

DXtext            <- a single character name
D{X}text          <- the same beginning with V8.7

D{name}text

Here, name is one or more characters that form the macro name. If there are no characters between the curly braces, sendmail prints the following error and names the macro "{}":

Name required for macro/class

A multicharacter macro name may contain only letters, digits, and the underscore character. Each bad character between the curly braces (including spaces) will produce the following error and cause that character to be ignored:

Invalid macro/class character

In general, your macro names should always begin with an uppercase character. Macro names that begin with lowercase characters are reserved for the internal use of sendmail.

If the left curly brace is missing but the right is present, the macro name becomes the first letter following the D and the rest becomes the text:

Dname}text       -> becomes ->  n  ame}text

If the right curly brace is missing but the left is present, the following error is printed, and the macro is not defined

Unbalanced { on nametext

The maximum length of a macro name is hard-coded at 20 characters and cannot be changed with compile-time definitions. If you declare a macro name that (not counting the curly braces) is longer than 20 characters, the following error will be printed and the excess characters will become the value of an undefined name.

Macro/class name ({VeryLongMacroNameHere}) too long (20 chars max)

Because of the way multicharacter names are encoded into a single byte, there is a fixed limit on the number of multicharacter macro names that you may declare. That limit includes those multicharacter names internally defined by sendmail, [8] and those declared for class macros. There may be at most 96 multicharacter macro names. If you try to declare a 97th name, the following error will print and that definition will be ignored:

[8] One for V8.7 and many for V8.8.

Macro/class {name}: too many long names


Previous: 31.3 Configuration File DefinitionssendmailNext: 31.5 Macro Expansion: $ and $&
31.3 Configuration File DefinitionsBook Index31.5 Macro Expansion: $ and $&