www.delorie.com/gnu/docs/m4/m4_67.html   search  
Buy GNU books!

GNU macro processor

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

13.1 Printing error messages

You can print error messages using errprint:

errprint(message, ...)
which simply prints message and the rest of the arguments on the standard error output.

The expansion of errprint is void.

errprint(`Illegal arguments to forloop
error-->Illegal arguments to forloop

A trailing newline is not printed automatically, so it must be supplied as part of the argument, as in the example. (BSD flavored m4's do append a trailing newline on each errprint call).

To make it possible to specify the location of the error, two utility builtins exist:

which expands to the quoted name of the current input file, and the current input line number in that file.

errprint(`m4:'__file__:__line__: `Input error
error-->m4:56.errprint:2: Input error

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003