1UNIFDEF(1)                  General Commands Manual                 UNIFDEF(1)
2
3
4

NAME

6       unifdef - remove ifdef'ed lines
7

SYNOPSIS

9       unifdef [ -t -l -c -Dsym -Usym -idsym -iusym ] ...  [ file ]
10

DESCRIPTION

12       Unifdef  is useful for removing ifdef'ed lines from a file while other‐
13       wise leaving the file alone.  Unifdef is like a  stripped-down  C  pre‐
14       processor: it is smart enough to deal with the nested ifdefs, comments,
15       single and double quotes of C syntax so that it can do its job, but  it
16       doesn't  do any including or interpretation of macros.  Neither does it
17       strip out comments, though it recognizes and ignores them.  You specify
18       which  symbols  you want defined -Dsym or undefined -Usym and the lines
19       inside those ifdefs will be copied to the output or removed  as  appro‐
20       priate.   The  ifdef, ifndef, else, and endif lines associated with sym
21       will also be removed.  Ifdefs involving symbols you don't  specify  are
22       untouched  and  copied out along with their associated ifdef, else, and
23       endif lines.  If an ifdef X occurs nested inside another ifdef X,  then
24       the  inside  ifdef is treated as if it were an unrecognized symbol.  If
25       the same symbol appears in more  than  one  argument,  only  the  first
26       occurrence is significant.
27
28       The  -l option causes unifdef to replace removed lines with blank lines
29       instead of deleting them.
30
31       If you use ifdefs to delimit non-C lines,  such  as  comments  or  code
32       which  is  under construction, then you must tell unifdef which symbols
33       are used for that purpose so that it won't try to parse for quotes  and
34       comments  in those ifdef'ed lines.  You specify that you want the lines
35       inside certain ifdefs to be ignored but  copied  out  with  -idsym  and
36       -iusym similar to -Dsym and -Usym above.
37
38       If  you  want  to  use  unifdef for plain text (not C code), use the -t
39       option.  This makes unifdef refrain from attempting to  recognize  com‐
40       ments and single and double quotes.
41
42       Unifdef  copies its output to stdout and will take its input from stdin
43       if no file argument is given.  If the -c argument  is  specified,  then
44       the  operation  of  unifdef  is complemented, i.e. the lines that would
45       have been removed or blanked are retained and vice versa.
46

SEE ALSO

48       diff(1)
49

DIAGNOSTICS

51       Premature EOF, inappropriate else or endif.
52
53       Exit status is 0 if output is exact copy of input, 1 if not, 2 if trou‐
54       ble.
55

BUGS

57       Does not know how to deal with cpp consructs such as
58
59            #if  defined(X) || defined(Y)
60
61

AUTHOR

63       Dave Yost
64
65
66
674.3 Berkeley Distribution       April 29, 1985                      UNIFDEF(1)
Impressum