install correct aliases file
[unix-history] / usr / src / usr.bin / unifdef / unifdef.1
CommitLineData
6be9699a
KM
1.\" Copyright (c) 1985 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
5.\" @(#)unifdef.1 6.1 (Berkeley) %G%
6.\"
7.TH UNIFDEF 1 ""
8.UC 6
9.SH NAME
10unifdef \- remove ifdef'ed lines
11.SH SYNOPSIS
12.B unifdef
13[
14.B \-t
15.B \-l
16.B \-c
17.BI \-D sym
18.BI \-U sym
19.BI \-id sym
20.BI \-iu sym
21] ... [ file ]
22.SH DESCRIPTION
23.I Unifdef
24is useful for removing ifdef'ed lines from a file while otherwise leaving the
25file alone.
26.I Unifdef
27is like a stripped-down C preprocessor:
28it is smart enough to deal with the nested ifdefs, comments,
29single and double
30quotes of C syntax so that it can do its job, but it doesn't do any including
31or interpretation of macros.
32Neither does it strip out comments, though it recognizes and ignores them.
33You specify which symbols you want defined
34.BI \-D sym
35or undefined
36.BI \-U sym
37and the lines inside those ifdefs will be copied to the output or removed as
38appropriate.
39The ifdef, ifndef, else, and endif lines associated with
40.I sym
41will also be removed.
42Ifdefs involving symbols you don't specify are untouched and copied out
43along with their associated
44ifdef, else, and endif lines.
45If an ifdef X occurs nested inside another ifdef X, then the
46inside ifdef is treated as if it were an unrecognized symbol.
47If the same symbol appears in more than one argument, only the first
48occurrence is significant.
49.PP
50The
51.B \-l
52option causes
53.I unifdef
54to replace removed lines with blank lines
55instead of deleting them.
56.PP
57If you use ifdefs to delimit non-C lines, such as comments
58or code which is under construction,
59then you must tell
60.I unifdef
61which symbols are used for that purpose so that it won't try to parse
62for quotes and comments
63in those ifdef'ed lines.
64You specify that you want the lines inside certain ifdefs to be ignored
65but copied out with
66.BI \-id sym
67and
68.BI \-iu sym
69similar to
70.BI \-D sym
71and
72.BI \-U sym
73above.
74.PP
75If you want to use
76.I unifdef
77for plain text (not C code), use the
78.B \-t
79option.
80This makes
81.I unifdef
82refrain from attempting to recognize comments and single and double quotes.
83.PP
84.I Unifdef
85copies its output to
86.I stdout
87and will take its input from
88.I stdin
89if no
90.I file
91argument is given.
92If the
93.B \-c
94argument is specified, then the operation of
95.I unifdef
96is complemented,
97i.e. the lines that would have been removed or blanked
98are retained and vice versa.
99.SH "SEE ALSO"
100diff(1)
101.SH DIAGNOSTICS
102Premature EOF, inappropriate else or endif.
103.PP
104Exit status is 0 if output is exact copy of input, 1 if not, 2 if trouble.
105.SH BUGS
106Does not know how to deal with \fIcpp\fP consructs such as
107.br
108.sp
109.nf
110 #if defined(X) || defined(Y)
111.sp
112.fi
113.SH AUTHOR
114Dave Yost