home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


sendmail

sendmailSearch this book
Previous: 32.3 Class with m4 Chapter 32
Class Macros
Next: 32.5 Alphabetized Reference
 

32.4 Pitfalls

  • Although a class macro name may be any ASCII character (any character in the range 0x0 to 0x7f), avoid using any of the nonletter characters. At the very least they create confusing reading, and at worst they may cause sendmail to completely misinterpret your intentions.

  • Although strings may traditionally be made to contain whitespace by quoting them, class macros will misinterpret those quotes. For example, " vax ds1 " wrongly parses into two class entries: " vax and ds1 ," with the quotes a part of each.

  • Duplicate strings are silently ignored. Therefore typos in a list of strings may cause an accidentally duplicated entry to be silently excluded.

  • Avoid creating a new class macro name without first checking to see whether it has already been used. That is, don't create a list of UUCP hosts within class U without first checking both for preexisting CU and FU definitions and for rule-set uses of $=U and $~U . It is perfectly legal for the $=U and $~U expressions to exist in rule sets without a corresponding CU or FU definitions. Beware, however, that such empty references still cause sendmail to search the string pool.

  • Under V8 sendmail you may watch your class macro definitions being formed by using the -d37.8 debugging switch (see Section 37.5.127, -d37.8 ). Under other versions of sendmail you may only approximate this information by using the -d36.9 debugging switch (see Section 37.5.124, -d36.9 ).

  • The class macro expansion prefixes $= and $~ are intended for use only in the LHS of rules. If you use those characters in the RHS of rules, most versions of sendmail do not print an error; instead, they silently accept those characters as is. V8 sendmail , on the other hand, prints one of the following messages as a warning and ignores the entire rule:

    Inappropriate use of $=
    Inappropriate use of $~

  • The file form's scanf (3) pattern can produce unexpected results. Remember that the pattern is applied to a line, not to a stream.

  • No error checking is performed during reads for the F form of the class configuration command. An error reading from a file silently causes the rest of that file's contents to be ignored. An unreported error from a program (one that silently returns 0 on both success and failure) is also silently ignored by sendmail .

  • Be careful in using defined macros in the C form of class macro definitions. Some versions of sendmail store the macro itself instead of the expanded value of the macro, leading to unexpected results. V8 sendmail correctly stores the expanded macro value.