]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/unifdef/unifdef.1
This commit was generated by cvs2svn to compensate for changes in r51848,
[FreeBSD/FreeBSD.git] / usr.bin / unifdef / unifdef.1
1 .\" Copyright (c) 1985, 1991, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" This code is derived from software contributed to Berkeley by
5 .\" Dave Yost.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
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.
22 .\"
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
33 .\" SUCH DAMAGE.
34 .\"
35 .\"     @(#)unifdef.1   8.2 (Berkeley) 4/1/94
36 .\" $FreeBSD$
37 .\"
38 .Dd April 1, 1994
39 .Dt UNIFDEF 1
40 .Os BSD 4.3
41 .Sh NAME
42 .Nm unifdef
43 .Nd remove ifdef'ed lines
44 .Sh SYNOPSIS
45 .Nm unifdef
46 .Op Fl clt
47 .Oo
48 .Fl D Ns Ar sym
49 .Fl U Ns Ar sym
50 .Fl iD Ns Ar sym
51 .Fl iD Ns Ar sym
52 .Oc
53 .Ar ...
54 .Op Ar file
55 .Sh DESCRIPTION
56 .Nm Unifdef
57 is useful for removing ifdef'ed lines
58 from a file while otherwise leaving the file alone.
59 .Nm Unifdef
60 acts on
61 #ifdef, #ifndef, #else, and #endif lines,
62 and it knows only enough about C
63 to know when one of these is inactive
64 because it is inside
65 a comment,
66 or a single or double quote.
67 Parsing for quotes is very simplistic:
68 when it finds an open quote,
69 it ignores everything (except escaped quotes)
70 until it finds a close quote, and
71 it will not complain if it gets
72 to the end of a line and finds no backslash for continuation.
73 .Pp
74 Available options:
75 .Bl -tag -width Ds -compact
76 .It Fl D Ns Ar sym
77 .It Fl U Ns Ar sym
78 Specify which symbols to define or undefine.
79 and the lines inside those ifdefs will be copied to the output or removed as
80 appropriate.
81 The ifdef, ifndef, else, and endif lines associated with
82 .Ar sym
83 will also be removed.
84 Ifdefs involving symbols you don't specify
85 and ``#if'' control lines
86 are untouched and copied out
87 along with their associated
88 ifdef, else, and endif lines.
89 If an ifdef X occurs nested inside another ifdef X, then the
90 inside ifdef is treated as if it were an unrecognized symbol.
91 If the same symbol appears in more than one argument,
92 the last occurrence dominates.
93 .Pp
94 .It Fl c
95 If the
96 .Fl c
97 flag is specified,
98 then the operation of
99 .Nm
100 is complemented,
101 i.e. the lines that would have been removed or blanked
102 are retained and vice versa.
103 .Pp
104 .It Fl l
105 Replace removed lines with blank lines
106 instead of deleting them.
107 .It Fl t
108 Disables parsing for C comments and quotes, which is useful
109 for plain text.
110 .Pp
111 .It Fl iD Ns Ar sym
112 .It Fl iU Ns Ar sym
113 Ignore ifdefs.
114 If your C code uses ifdefs to delimit non-C lines,
115 such as comments
116 or code which is under construction,
117 then you must tell
118 .Nm
119 which symbols are used for that purpose so that it won't try to parse
120 for quotes and comments
121 inside those ifdefs.
122 One specifies ignored ifdefs with
123 .Fl iD Ns Ar sym
124 and
125 .Fl iU Ns Ar sym
126 similar to
127 .Fl D Ns Ar sym
128 and
129 .Fl U Ns Ar sym
130 above.
131 .El
132 .Pp
133 .Nm Unifdef
134 copies its output to
135 .Em stdout
136 and will take its input from
137 .Em stdin
138 if no
139 .Ar file
140 argument is given.
141 .Pp
142 .Nm Unifdef
143 works nicely with the
144 .Fl D Ns Ar sym
145 option added to
146 .Xr diff 1
147 as of the 4.1 Berkeley Software Distribution.
148 .Sh SEE ALSO
149 .Xr diff 1
150 .Sh DIAGNOSTICS
151 Inappropriate else or endif.
152 .br
153 Premature
154 .Tn EOF
155 with line numbers of the unterminated #ifdefs.
156 .Pp
157 Exit status is 0 if output is exact copy of input, 1 if not, 2 if trouble.
158 .Sh BUGS
159 Should try to deal with ``#if'' lines.
160 .Pp
161 Doesn't work correctly if input contains null characters.
162 .Sh HISTORY
163 The
164 .Nm
165 command appeared in
166 .Bx 4.3 .