mc (for macro configuration). The m4 process reads that file and gathers definitions
of macros, then replaces those macros with their values and outputs a sendmail
configuration file.
With m4, macros are defined (given values) like this:
define(macro, value)
Here, the macro is a symbolic name that you will use later. Legal names must begin
withan underscore or letter and can contain letters, digits, and underscores. The
value can be any arbitrary text. A comma separates the two, and that comma can be
followed by optional whitespace.
There must be no space between the define and the left parenthesis. The definition
ends with the right parenthesis.
To illustrate, consider this one-line m4 source file named /tmp/x:
input text to be converted
?†“
define(A,B)A
?†‘
the m4 definition
This is the Title of the Book, eMatter Edition
Copyright ?© 2007 O??™Reilly & Associates, Inc. All rights reserved.
17.1 The m4 Preprocessor | 585
When m4 is run to process this file, the output produced shows that A (the input) is
redefined to become B:
% m4 /tmp/x
B
17.1.1 m4 Is Greedy
The m4 program is greedy. That is, if a macro is already defined, its value will replace
its name in the second declaration. Consider this input file:
define(A,B)
define(A,C)
A B
Here, the first line assigns the value B to the macro named A. The second line notices
that A is a defined macro, so m4 replaces that A with B and then defines B as having
the value C.
Pages:
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031