BSD 4_3_Tahoe development
[unix-history] / usr / man / cat1 / unifdef.0
UNIFDEF(1) UNIX Programmer's Manual UNIFDEF(1)
N\bNA\bAM\bME\bE
unifdef - remove ifdef'ed lines
S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
u\bun\bni\bif\bfd\bde\bef\bf [ -\b-t\bt -\b-l\bl -\b-c\bc -\b-D\bD_\bs_\by_\bm -\b-U\bU_\bs_\by_\bm -\b-i\bid\bd_\bs_\by_\bm -\b-i\biu\bu_\bs_\by_\bm ] ... [ file ]
D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
_\bU_\bn_\bi_\bf_\bd_\be_\bf is useful for removing ifdef'ed lines from a file
while otherwise leaving the file alone. _\bU_\bn_\bi_\bf_\bd_\be_\bf is like a
stripped-down C preprocessor: it is smart enough to deal
with the nested ifdefs, comments, single and double quotes
of C syntax so that it can do its job, but it doesn't do any
including or interpretation of macros. Neither does it
strip out comments, though it recognizes and ignores them.
You specify which symbols you want defined -\b-D\bD_\bs_\by_\bm or unde-
fined -\b-U\bU_\bs_\by_\bm and the lines inside those ifdefs will be copied
to the output or removed as appropriate. The ifdef, ifndef,
else, and endif lines associated with _\bs_\by_\bm will also be
removed. Ifdefs involving symbols you don't specify are
untouched and copied out along with their associated ifdef,
else, and endif lines. If an ifdef X occurs nested inside
another ifdef X, then the inside ifdef is treated as if it
were an unrecognized symbol. If the same symbol appears in
more than one argument, only the first occurrence is signi-
ficant.
The -\b-l\bl option causes _\bu_\bn_\bi_\bf_\bd_\be_\bf to replace removed lines with
blank lines instead of deleting them.
If you use ifdefs to delimit non-C lines, such as comments
or code which is under construction, then you must tell
_\bu_\bn_\bi_\bf_\bd_\be_\bf which symbols are used for that purpose so that it
won't try to parse for quotes and comments in those ifdef'ed
lines. You specify that you want the lines inside certain
ifdefs to be ignored but copied out with -\b-i\bid\bd_\bs_\by_\bm and -\b-i\biu\bu_\bs_\by_\bm
similar to -\b-D\bD_\bs_\by_\bm and -\b-U\bU_\bs_\by_\bm above.
If you want to use _\bu_\bn_\bi_\bf_\bd_\be_\bf for plain text (not C code), use
the -\b-t\bt option. This makes _\bu_\bn_\bi_\bf_\bd_\be_\bf refrain from attempting
to recognize comments and single and double quotes.
_\bU_\bn_\bi_\bf_\bd_\be_\bf copies its output to _\bs_\bt_\bd_\bo_\bu_\bt and will take its input
from _\bs_\bt_\bd_\bi_\bn if no _\bf_\bi_\bl_\be argument is given. If the -\b-c\bc argument
is specified, then the operation of _\bu_\bn_\bi_\bf_\bd_\be_\bf is complemented,
i.e. the lines that would have been removed or blanked are
retained and vice versa.
S\bSE\bEE\bE A\bAL\bLS\bSO\bO
diff(1)
D\bDI\bIA\bAG\bGN\bNO\bOS\bST\bTI\bIC\bCS\bS
Premature EOF, inappropriate else or endif.
Printed 7/9/88 April 29, 1985 1
UNIFDEF(1) UNIX Programmer's Manual UNIFDEF(1)
Exit status is 0 if output is exact copy of input, 1 if not,
2 if trouble.
B\bBU\bUG\bGS\bS
Does not know how to deal with _\bc_\bp_\bp consructs such as
#if defined(X) || defined(Y)
A\bAU\bUT\bTH\bHO\bOR\bR
Dave Yost
Printed 7/9/88 April 29, 1985 2