*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> unifdef (1)              
Title
Content
Arch
Section
 

Contents


UNIFDEF(1)							    UNIFDEF(1)


NAME    [Toc]    [Back]

     unifdef - strip or	reduce ifdefs in C code

SYNOPSIS    [Toc]    [Back]

     unifdef [-Dname] [-Dname=string] [-Uname] [-ooutput] [-z] [input...]

DESCRIPTION    [Toc]    [Back]

     Unifdef reads C source files and prints all input lines except those
     excluded by #ifdef	constructs that	refer to specified identifiers.

     The -D option defines name	as a macro with	the value 1, causing unifdef
     to	simplify

	  #ifdef name
	  Included text
	  #else
	  Excluded text
	  #endif


     to	just

	  Included text


     and contrariwise for #ifndef.

     The -U option works like -D except	that name is undefined,	so the #ifdef
     above would simplify to

	  Excluded text


     -Dname=string causes unifdef to replace occurrences of name with string
     when evaluating #if and #elif expressions.	 For example, unifdef -DBSD=43
     would rewrite

	  #if BSD == 43
	  4.3BSD code
	  #elif	BSD == 42
	  4.2BSD code
	  #endif


     as

	  4.3BSD code


     All #ifdef	constructs that	refer to names not defined with	-D or
     undefined with -U are passed unchanged to output.	Unifdef	simplifies #if
     expressions that mix defined or undefined names with unknown names	to



									Page 1






UNIFDEF(1)							    UNIFDEF(1)



     express operations	on just	the unknown names.  Thus unifdef -Dsgi would
     rewrite

	  #if defined sgi && !defined KERNEL


     as

	  #ifndef KERNEL


     and would preserve	associated #else and #endif sections.  Unifdef
     simplifies	#elif chains as	if they	consisted of #if constructs nested
     within #else sections.  For example, unifdef -DBSD=43 would rewrite

	  #if SYSV
	  System V code
	  #elif	BSD == 42
	  4.2BSD code
	  #elif	BSD == 43
	  4.3BSD code
	  #elif	XENIX
	  Xenix	code
	  #endif


     as

	  #if SYSV
	  System V code
	  #else
	  4.3BSD code
	  #if XENIX
	  Xenix	code
	  #endif
	  #endif


     Unifdef rewrites #else and	#endif lines to	conform	to ANSI	C, by
     enclosing any tokens after	these keywords with comment delimiters.	 For
     example,

	  #ifdef DEBUG
	  Debugging code
	  #endif DEBUG


     would be transcribed as

	  #ifdef DEBUG
	  Debugging code
	  #endif /* DEBUG */



									Page 2






UNIFDEF(1)							    UNIFDEF(1)



     Unifdef writes to standard	output by default.  The	-o option may be used
     in	lieu of	shell redirection to specify an	output file.  More important,
     the file specified	by output may be identical to one of the input files,
     or	to standard input if there are no arguments.  In this case, unifdef
     will safely overwrite the input file.

     The -z option causes unifdef to simplify or eliminate sections controlled
     by	#if constructs that test constant integer expressions.	By default,
     constructs	such as

	  #if 0
	  Excluded text
	  #endif


     are left intact.

AUTHOR    [Toc]    [Back]

     Brendan Eich, 03/16/89

SEE ALSO    [Toc]    [Back]

      
      
     cc(1), cpp(1).


									PPPPaaaaggggeeee 3333
[ Back ]
 Similar pages
Name OS Title
endqstrip IRIX delimit the vertices of a quadrilateral strip
TIFFstrip IRIX strip-related utility routines
basename Linux strip directory and suffix from filenames
dirname Linux strip non-directory suffix from file name
bgnqstrip IRIX delimit the vertices of a quadrilateral strip
stripchart Linux 2D strip chart for plotting x and y coordinate data.
TIFFWriteRawStrip IRIX write a strip of raw data to an open TIFF file
strip HP-UX strip symbol and line number information from an object file
TIFFWriteEncodedStrip IRIX compress and write a strip of data to an open TIFF file
TIFFReadEncodedStrip IRIX read and decode a strip of data from an open TIFF file
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service