xref: /386bsd/usr/share/man/cat1/unifdef.0 (revision a2142627)
1UNIFDEF(1)                  386BSD Reference Manual                 UNIFDEF(1)
2
3NNAAMMEE
4     uunniiffddeeff - remove ifdef'ed lines
5
6SSYYNNOOPPSSIISS
7     uunniiffddeeff [--tt --ll --cc --DD_s_y_m --UU_s_y_m --iiDD_s_y_m --iiDD_s_y_m] ... [_f_i_l_e]
8
9DDEESSCCRRIIPPTTIIOONN
10     UUnniiffddeeff is useful for removing ifdef'ed lines from a file while otherwise
11     leaving the file alone.  UUnniiffddeeff acts on #ifdef, #ifndef, #else, and
12     #endif lines, and it knows only enough about C to know when one of these
13     is inactive because it is inside a comment, or a single or double quote.
14     Parsing for quotes is very simplistic: when it finds an open quote, it
15     ignores everything (except escaped quotes) until it finds a close quote,
16     and it will not complain if it gets to the end of a line and finds no
17     backslash for continuation.
18
19     Available options:
20     --DD_s_y_m
21     --UU_s_y_m   Specify which symbols to define or undefine.  and the lines
22             inside those ifdefs will be copied to the output or removed as
23             appropriate.  The ifdef, ifndef, else, and endif lines associated
24             with _s_y_m will also be removed.  Ifdefs involving symbols you
25             don't specify and ``#if'' control lines are untouched and copied
26             out along with their associated ifdef, else, and endif lines.  If
27             an ifdef X occurs nested inside another ifdef X, then the inside
28             ifdef is treated as if it were an unrecognized symbol.  If the
29             same symbol appears in more than one argument, the last
30             occurrence dominates.
31
32     --cc      If the --cc flag is specified, then the operation of uunniiffddeeff is
33             complemented, i.e. the lines that would have been removed or
34             blanked are retained and vice versa.
35
36     --ll      Replace removed lines with blank lines instead of deleting them.
37     --tt      Disables parsing for C comments and quotes useful for plain text
38             (not C code).
39
40     --iiDD_s_y_m
41     --iiUU_s_y_m  Ignore ifdefs.  If your C code uses ifdefs to delimit non-C
42             lines, such as comments or code which is under construction, then
43             you must tell uunniiffddeeff which symbols are used for that purpose so
44             that it won't try to parse for quotes and comments inside those
45             ifdefs.  One specifies ignored ifdefs with --iiDD_s_y_m and --iiUU_s_y_m
46             similar to --DD_s_y_m and --UU_s_y_m above.
47
48     UUnniiffddeeff copies its output to _s_t_d_o_u_t and will take its input from _s_t_d_i_n if
49     no _f_i_l_e argument is given.
50
51     UUnniiffddeeff works nicely with the --DD_s_y_m option added to diff(1) as of the 4.1
52     Berkeley Software Distribution.
53
54SSEEEE AALLSSOO
55     diff(1)
56
57DDIIAAGGNNOOSSTTIICCSS
58     Inappropriate else or endif.
59     Premature EOF with line numbers of the unterminated #ifdefs.
60
61     Exit status is 0 if output is exact copy of input, 1 if not, 2 if
62     trouble.
63
64BBUUGGSS
65     Should try to deal with ``#if'' lines.
66
67     Doesn't work correctly if input contains null characters.
68
69HHIISSTTOORRYY
70     The uunniiffddeeff command appeared in 4.3BSD.
71
724.3 Berkeley Distribution       April 23, 1991                               2
73
74
75
76
77
78
79
80
81
82
83
84
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
129
130
131
132
133