Commit | Line | Data |
---|---|---|
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 | |
10 | unifdef \- 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 | |
24 | is useful for removing ifdef'ed lines from a file while otherwise leaving the | |
25 | file alone. | |
26 | .I Unifdef | |
27 | is like a stripped-down C preprocessor: | |
28 | it is smart enough to deal with the nested ifdefs, comments, | |
29 | single and double | |
30 | quotes of C syntax so that it can do its job, but it doesn't do any including | |
31 | or interpretation of macros. | |
32 | Neither does it strip out comments, though it recognizes and ignores them. | |
33 | You specify which symbols you want defined | |
34 | .BI \-D sym | |
35 | or undefined | |
36 | .BI \-U sym | |
37 | and the lines inside those ifdefs will be copied to the output or removed as | |
38 | appropriate. | |
39 | The ifdef, ifndef, else, and endif lines associated with | |
40 | .I sym | |
41 | will also be removed. | |
42 | Ifdefs involving symbols you don't specify are untouched and copied out | |
43 | along with their associated | |
44 | ifdef, else, and endif lines. | |
45 | If an ifdef X occurs nested inside another ifdef X, then the | |
46 | inside ifdef is treated as if it were an unrecognized symbol. | |
47 | If the same symbol appears in more than one argument, only the first | |
48 | occurrence is significant. | |
49 | .PP | |
50 | The | |
51 | .B \-l | |
52 | option causes | |
53 | .I unifdef | |
54 | to replace removed lines with blank lines | |
55 | instead of deleting them. | |
56 | .PP | |
57 | If you use ifdefs to delimit non-C lines, such as comments | |
58 | or code which is under construction, | |
59 | then you must tell | |
60 | .I unifdef | |
61 | which symbols are used for that purpose so that it won't try to parse | |
62 | for quotes and comments | |
63 | in those ifdef'ed lines. | |
64 | You specify that you want the lines inside certain ifdefs to be ignored | |
65 | but copied out with | |
66 | .BI \-id sym | |
67 | and | |
68 | .BI \-iu sym | |
69 | similar to | |
70 | .BI \-D sym | |
71 | and | |
72 | .BI \-U sym | |
73 | above. | |
74 | .PP | |
75 | If you want to use | |
76 | .I unifdef | |
77 | for plain text (not C code), use the | |
78 | .B \-t | |
79 | option. | |
80 | This makes | |
81 | .I unifdef | |
82 | refrain from attempting to recognize comments and single and double quotes. | |
83 | .PP | |
84 | .I Unifdef | |
85 | copies its output to | |
86 | .I stdout | |
87 | and will take its input from | |
88 | .I stdin | |
89 | if no | |
90 | .I file | |
91 | argument is given. | |
92 | If the | |
93 | .B \-c | |
94 | argument is specified, then the operation of | |
95 | .I unifdef | |
96 | is complemented, | |
97 | i.e. the lines that would have been removed or blanked | |
98 | are retained and vice versa. | |
99 | .SH "SEE ALSO" | |
100 | diff(1) | |
101 | .SH DIAGNOSTICS | |
102 | Premature EOF, inappropriate else or endif. | |
103 | .PP | |
104 | Exit status is 0 if output is exact copy of input, 1 if not, 2 if trouble. | |
105 | .SH BUGS | |
106 | Does 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 | |
114 | Dave Yost |