|
|
1.1 root 1: .\" Copyright (c) 1985 The Regents of the University of California.
2: .\" 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 are permitted
8: .\" provided that the above copyright notice and this paragraph are
9: .\" duplicated in all such forms and that any documentation,
10: .\" advertising materials, and other materials related to such
11: .\" distribution and use acknowledge that the software was developed
12: .\" by the University of California, Berkeley. The name of the
13: .\" University may not be used to endorse or promote products derived
14: .\" from this software without specific prior written permission.
15: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16: .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17: .\" WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18: .\"
19: .\" @(#)unifdef.1 6.3 (Berkeley) 12/14/88
20: .\"
21: .TH UNIFDEF 1 "December 14, 1988"
22: .SH NAME
23: unifdef \- remove ifdef'ed lines
24: .SH SYNOPSIS
25: \fBunifdef\fR
26: [
27: \fB\-t\fR
28: \fB\-l\fR
29: \fB\-c\fR
30: \fB\-D\fR\fIsym\fR
31: \fB\-U\fR\fIsym\fR
32: \fB\-iD\fR\fIsym\fR
33: \fB\-iD\fR\fIsym\fR
34: ] ... [ file ]
35: .SH DESCRIPTION
36: \fIUnifdef\fR is useful for removing ifdef'ed lines
37: from a file while otherwise leaving the file alone.
38: \fIUnifdef\fR acts on
39: #ifdef, #ifndef, #else, and #endif lines,
40: and it knows only enough about C
41: to know when one of these is inactive
42: because it is inside
43: a comment,
44: or a single or double quote.
45: Parsing for quotes is very simplistic:
46: when it finds an open quote,
47: it ignores everything (except escaped quotes)
48: until it finds a close quote, and
49: it will not complain if it gets
50: to the end of a line and finds no backslash for continuation.
51: .PP
52: If you want to use \fIunifdef\fR
53: for plain text (not C code),
54: use the \fB\-t\fR option,
55: which disables this parsing for
56: C comments and quotes.
57: .PP
58: You specify which symbols you want defined
59: (\fB\-D\fR\fIsym\fR)
60: or undefined
61: (\fB\-U\fR\fIsym\fR)
62: and the lines inside those ifdefs will be copied to the output or removed as
63: appropriate.
64: The ifdef, ifndef, else, and endif lines associated with
65: \fIsym\fR will also be removed.
66: Ifdefs involving symbols you don't specify
67: and ``#if'' control lines
68: are untouched and copied out
69: along with their associated
70: ifdef, else, and endif lines.
71: If an ifdef X occurs nested inside another ifdef X, then the
72: inside ifdef is treated as if it were an unrecognized symbol.
73: If the same symbol appears in more than one argument,
74: the last occurrence dominates.
75: .PP
76: The \fB\-l\fR option causes \fIunifdef\fR
77: to replace removed lines with blank lines
78: instead of deleting them.
79: .PP
80: If your C code uses ifdefs to delimit non-C lines,
81: such as comments
82: or code which is under construction,
83: then you must tell \fIunifdef\fR
84: which symbols are used for that purpose so that it won't try to parse
85: for quotes and comments
86: inside those ifdefs.
87: You specify ignored ifdefs with
88: \fB\-iD\fR\fIsym\fR
89: and
90: \fB\-iU\fR\fIsym\fR
91: similar to
92: \fB\-D\fR\fIsym\fR
93: and
94: \fB\-U\fR\fIsym\fR
95: above.
96: .PP
97: \fIUnifdef\fR copies its output to \fIstdout\fR
98: and will take its input from \fIstdin\fR
99: if no \fIfile\fR argument is given.
100: If the \fB\-c\fR argument is specified,
101: then the operation of \fIunifdef\fR is complemented,
102: i.e. the lines that would have been removed or blanked
103: are retained and vice versa.
104: .PP
105: \fIUnifdef\fR works nicely with the \fB\-D\fR\fIsym\fR option added
106: to \fIdiff\fR(1) as of the 4.1 Berkeley Software Distribution.
107: .SH "SEE ALSO"
108: diff(1)
109: .SH DIAGNOSTICS
110: Inappropriate else or endif.
111: .br
112: Premature EOF with line numbers of the unterminated #ifdefs.
113: .PP
114: Exit status is 0 if output is exact copy of input, 1 if not, 2 if trouble.
115: .SH AUTHOR
116: Dave Yost for The Rand Corporation.
117: .br
118: Still maintained independently by Dave Yost as of 3/85
119: .SH BUGS
120: Should try to deal with ``#if'' lines.
121: .br
122: Doesn't work correctly if input contains null characters.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.