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