1 .\" Copyright (c) 1985, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" This code is derived from software contributed to Berkeley by
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
15 .\" 3. All advertising materials mentioning features or use of this software
16 .\" must display the following acknowledgement:
17 .\" This product includes software developed by the University of
18 .\" California, Berkeley and its contributors.
19 .\" 4. Neither the name of the University nor the names of its contributors
20 .\" may be used to endorse or promote products derived from this software
21 .\" without specific prior written permission.
23 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 .\" @(#)unifdef.1 8.2 (Berkeley) 4/1/94
42 .Nd remove ifdef'ed lines
56 is useful for removing ifdef'ed lines
57 from a file while otherwise leaving the file alone.
60 #ifdef, #ifndef, #else, and #endif lines,
61 and it knows only enough about C
62 to know when one of these is inactive
65 or a single or double quote.
66 Parsing for quotes is very simplistic:
67 when it finds an open quote,
68 it ignores everything (except escaped quotes)
69 until it finds a close quote, and
70 it will not complain if it gets
71 to the end of a line and finds no backslash for continuation.
74 .Bl -tag -width Ds -compact
77 Specify which symbols to define or undefine.
78 and the lines inside those ifdefs will be copied to the output or removed as
80 The ifdef, ifndef, else, and endif lines associated with
83 Ifdefs involving symbols you don't specify
84 and ``#if'' control lines
85 are untouched and copied out
86 along with their associated
87 ifdef, else, and endif lines.
88 If an ifdef X occurs nested inside another ifdef X, then the
89 inside ifdef is treated as if it were an unrecognized symbol.
90 If the same symbol appears in more than one argument,
91 the last occurrence dominates.
100 i.e. the lines that would have been removed or blanked
101 are retained and vice versa.
104 Replace removed lines with blank lines
105 instead of deleting them.
107 Disables parsing for C comments and quotes, which is useful
113 If your C code uses ifdefs to delimit non-C lines,
115 or code which is under construction,
118 which symbols are used for that purpose so that it won't try to parse
119 for quotes and comments
121 One specifies ignored ifdefs with
135 and will take its input from
142 works nicely with the
146 as of the 4.1 Berkeley Software Distribution.
150 Inappropriate else or endif.
154 with line numbers of the unterminated #ifdefs.
156 Exit status is 0 if output is exact copy of input, 1 if not, 2 if trouble.
158 Should try to deal with ``#if'' lines.
160 Doesn't work correctly if input contains null characters.