question about m4 - macro preprocessor

Eric S. Raymond eric at snark.thyrsus.com
Mon Nov 26 03:39:44 AEST 1990


In <3201 at mrsvr.UUCP> Carl Crawford wrote:
> i am using the macro preprocessor m4 with files that are
> subsequently passed to troff. m4 replaces lines that 
> contain m4 commands with blank lines. the blank lines
> disrupt the text that is passed to troff. does anyone know 
> how to run m4 so that the blank lines can be eliminated?

No sweat. Just append the special token `dnl' to the lines containing your
macro calls. This mutually annihilates the newline immediately following. So,
instead of

================
mytext
mymacro(baz, qux)
more_mytext
================

write

================
mytext
mymacro(baz, qux)dnl
more_mytext
================

Happy hacking!
-- 
      Eric S. Raymond = eric at snark.thyrsus.com  (mad mastermind of TMN-Netnews)



More information about the Comp.unix.questions mailing list