The output of this file, after processing with m4, will be:
C C
To prevent this kind of greedy behavior (and to prevent the confusion it can create),
you can quote an item to prevent m4 from interpreting it. You quote with m4 by surrounding
each item with left and right single quotes:
define(A,B)
define(`A??,C)
A B
Here, the first line defines A as B like before. But the second line no longer sees A as a
macro. Instead, the single quotes allow A to be redefined as C. So, the output is now:
C B
Although it is not strictly necessary, we recommend that all macro and value pairs be
quoted. The preceding line should generally be expressed like this:
define(`A??,`B??)
define(`A??,`C??)
A B
This is the form we use when illustrating m4 throughout this book, including in the
previous two chapters.
17.1.2 m4 and dnl
Another problem with m4 is that it replaces its commands with empty lines. The earlier
define commands, for example, will actually print like this:
?†? a blank line
?†? a blank line
C B
This is the Title of the Book, eMatter Edition
Copyright ?© 2007 O??™Reilly & Associates, Inc. All rights reserved.
586 | Chapter 17: Configure sendmail.cf with m4
To suppress this insertion of blank lines, you can use the special m4 command dnl
(for Delete through New Line). That command looks like this:
define(`A??,`B??)dnl
define(`A??,`C??)dnl
A B
You can use dnl to remove blank lines where they might prove inconvenient or
unsightly in a configuration file.
Pages:
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032