DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(m4.info) Divert

Info Catalog (m4.info) Diversions (m4.info) Diversions (m4.info) Undivert
 
 Diverting output
 ================
 
    Output is diverted using `divert':
 
      divert(opt NUMBER)
 
 where NUMBER is the diversion to be used.  If NUMBER is left out, it is
 assumed to be zero.
 
    The expansion of `divert' is void.
 
    When all the `m4' input will have been processed, all existing
 diversions are automatically undiverted, in numerical order.
 
      divert(1)
      This text is diverted.
      divert
      =>
      This text is not diverted.
      =>This text is not diverted.
      ^D
      =>
      =>This text is diverted.
 
    Several calls of `divert' with the same argument do not overwrite
 the previous diverted text, but append to it.
 
    If output is diverted to a non-existent diversion, it is simply
 discarded.  This can be used to suppress unwanted output.  A common
 example of unwanted output is the trailing newlines after macro
 definitions.  Here is how to avoid them.
 
      divert(-1)
      define(`foo', `Macro `foo'.')
      define(`bar', `Macro `bar'.')
      divert
      =>
 
    This is a common programming idiom in `m4'.
 
Info Catalog (m4.info) Diversions (m4.info) Diversions (m4.info) Undivert
automatically generated byinfo2html