m

m4(1)

 

m4(1)

decr

Returns the value of its argument decremented by 1.

define

The second argument is installed as the value of the macro whose name is the ®rst argu-

 

ment. Each occurrence of $n in the replacement text, where n is a digit, is replaced by

 

the nth argument. Argument 0 is the name of the macro; missing arguments are

 

replaced by the null string; $# is replaced by the number of arguments; $* is replaced

 

by a list of all the arguments separated by commas; $@ is equivalent to $*, but each

 

argument is quoted (with the current quotes).

 

defn

Returns the quoted de®nition of its arguments. It is useful for renaming macros, espe-

 

cially built-ins.

 

divert

m4 maintains 10 output streams, numbered 0 to 9.

The ®nal output is the concatenation

 

of the streams in numerical order; initially, stream 0 is the current stream. The

 

divert macro changes the current output stream to its (digit-string) argument. Out-

 

put diverted to a stream other than 0 through 9 is discarded.

divnum

Returns the value of the current output stream.

 

dnl

Reads and discards characters up to and including the next newline.

dumpdef

Prints current names and de®nitions, for the named items, or for all if no arguments are

 

given.

 

errprint

Prints its argument on the diagnostic output ®le.

 

eval

Evaluates its argument as an arithmetic expression, using 32-bit arithmetic. Operators

 

include +, -, *, /, %, ** (exponentiation), bitwise &, , Ã, and Ä, relationals, and

 

parentheses. Octal and hexadecimal numbers may be speci®ed as in C. The second

 

argument speci®es the radix for the result; the default is 10. The third argument may

 

be used to specify the minimum number of digits in the result.

hpux

Is a prede®ned object with a null value.

 

ifdef

If the ®rst argument is de®ned, the value is the second argument; otherwise the third.

 

If there is no third argument, the value is null. The word unix is prede®ned on HP-UX

 

system versions of m4.

 

ifelse

Has three or more arguments. If the ®rst argument is the same string as the second,

 

then the value is the third argument. If not, and if there are more than four arguments,

 

the process is repeated with arguments 4, 5, 6 and 7. Otherwise, the value is either the

 

fourth string, or, if it is not present, null.

 

include

Returns the contents of the ®le named in the argument.

incr

Returns the value of its argument incremented by 1. The value of the argument is cal-

 

culated by interpreting an initial digit-string as a decimal number.

index

Returns the position in its ®rst argument where the second argument begins (zero ori-

 

gin), or −1 if the second argument does not occur.

 

len

Returns the number of characters in its argument.

 

m4exit

Causes immediate exit from m4. Argument 1, if given, is the exit code; the default is 0.

m4wrap

Argument 1 is pushed back at ®nal EOF; for example: m4wrap(`cleanup()')

maketemp

Fills in a string of XXXXX in its argument with the current process ID.

popdef

Removes current de®nition of its arguments, exposing the previous one, if any.

pushdef

Similar to define, but saves any previous de®nition.

shift

Returns all but its ®rst argument. The other arguments are quoted and pushed back

 

with commas in between. The quoting nulli®es the effect of the extra scan that will sub-

 

sequently be performed.

 

sinclude

Identical to include, except that it says nothing if the ®le is inaccessible.

substr

Returns a substring of its ®rst argument. The second argument is a zero-origin number

 

selecting the ®rst character; the third argument indicates the length of the substring. A

 

missing third argument is taken to be large enough to extend to the end of the ®rst

 

string.

 

Section 1486

− 2 −

HP-UX Release 11i: December 2000