BSD 4_3_Tahoe development
[unix-history] / usr / man / cat1 / unifdef.0
CommitLineData
362b077f
C
1
2
3
4UNIFDEF(1) UNIX Programmer's Manual UNIFDEF(1)
5
6
7
8N\bNA\bAM\bME\bE
9 unifdef - remove ifdef'ed lines
10
11S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
12 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 ]
13
14D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
15 _\bU_\bn_\bi_\bf_\bd_\be_\bf is useful for removing ifdef'ed lines from a file
16 while otherwise leaving the file alone. _\bU_\bn_\bi_\bf_\bd_\be_\bf is like a
17 stripped-down C preprocessor: it is smart enough to deal
18 with the nested ifdefs, comments, single and double quotes
19 of C syntax so that it can do its job, but it doesn't do any
20 including or interpretation of macros. Neither does it
21 strip out comments, though it recognizes and ignores them.
22 You specify which symbols you want defined -\b-D\bD_\bs_\by_\bm or unde-
23 fined -\b-U\bU_\bs_\by_\bm and the lines inside those ifdefs will be copied
24 to the output or removed as appropriate. The ifdef, ifndef,
25 else, and endif lines associated with _\bs_\by_\bm will also be
26 removed. Ifdefs involving symbols you don't specify are
27 untouched and copied out along with their associated ifdef,
28 else, and endif lines. If an ifdef X occurs nested inside
29 another ifdef X, then the inside ifdef is treated as if it
30 were an unrecognized symbol. If the same symbol appears in
31 more than one argument, only the first occurrence is signi-
32 ficant.
33
34 The -\b-l\bl option causes _\bu_\bn_\bi_\bf_\bd_\be_\bf to replace removed lines with
35 blank lines instead of deleting them.
36
37 If you use ifdefs to delimit non-C lines, such as comments
38 or code which is under construction, then you must tell
39 _\bu_\bn_\bi_\bf_\bd_\be_\bf which symbols are used for that purpose so that it
40 won't try to parse for quotes and comments in those ifdef'ed
41 lines. You specify that you want the lines inside certain
42 ifdefs to be ignored but copied out with -\b-i\bid\bd_\bs_\by_\bm and -\b-i\biu\bu_\bs_\by_\bm
43 similar to -\b-D\bD_\bs_\by_\bm and -\b-U\bU_\bs_\by_\bm above.
44
45 If you want to use _\bu_\bn_\bi_\bf_\bd_\be_\bf for plain text (not C code), use
46 the -\b-t\bt option. This makes _\bu_\bn_\bi_\bf_\bd_\be_\bf refrain from attempting
47 to recognize comments and single and double quotes.
48
49 _\bU_\bn_\bi_\bf_\bd_\be_\bf copies its output to _\bs_\bt_\bd_\bo_\bu_\bt and will take its input
50 from _\bs_\bt_\bd_\bi_\bn if no _\bf_\bi_\bl_\be argument is given. If the -\b-c\bc argument
51 is specified, then the operation of _\bu_\bn_\bi_\bf_\bd_\be_\bf is complemented,
52 i.e. the lines that would have been removed or blanked are
53 retained and vice versa.
54
55S\bSE\bEE\bE A\bAL\bLS\bSO\bO
56 diff(1)
57
58D\bDI\bIA\bAG\bGN\bNO\bOS\bST\bTI\bIC\bCS\bS
59 Premature EOF, inappropriate else or endif.
60
61
62
63Printed 7/9/88 April 29, 1985 1
64
65
66
67
68
69
70UNIFDEF(1) UNIX Programmer's Manual UNIFDEF(1)
71
72
73
74 Exit status is 0 if output is exact copy of input, 1 if not,
75 2 if trouble.
76
77B\bBU\bUG\bGS\bS
78 Does not know how to deal with _\bc_\bp_\bp consructs such as
79
80 #if defined(X) || defined(Y)
81
82
83A\bAU\bUT\bTH\bHO\bOR\bR
84 Dave Yost
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129Printed 7/9/88 April 29, 1985 2
130
131
132