aboutsummaryrefslogtreecommitdiff
path: root/ja_JP.eucJP/man/man1/unifdef.1
blob: 190969a8c22e667a90191a4ef6bae439d2e78d80 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
.\" Copyright (c) 1985, 1991, 1993
.\"	The Regents of the University of California.  All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" Dave Yost.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"	This product includes software developed by the University of
.\"	California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"     @(#)unifdef.1	8.2 (Berkeley) 4/1/94
.\" %FreeBSD: src/usr.bin/unifdef/unifdef.1,v 1.4.2.4 2001/08/16 13:17:09 ru Exp %
.\"
.\" $FreeBSD: doc/ja_JP.eucJP/man/man1/unifdef.1,v 1.6 2001/07/29 05:14:53 horikawa Exp $
.\"
.Dd April 1, 1994
.Dt UNIFDEF 1
.Os
.Sh 名称
.Nm unifdef
.Nd #ifdef 行を取り除く
.Sh 書式
.Nm
.Op Fl clt
.Oo
.Fl D Ns Ar sym
.Fl U Ns Ar sym
.Fl iD Ns Ar sym
.Fl iU Ns Ar sym
.Oc
.Ar ...
.Op Ar file
.Sh 解説
.Nm
はファイルから #ifdef された行を削除する場合に用いられます。
.Nm
は #ifdef, #ifndef, #else, #endif 行を解釈します。
.Nm
にはコメント、クォート(シングルクォートとダブルクォート)で
無効になるこれらのプリプロセッサマクロを
判断するために必要な最小限の C 言語の知識しかありません。
クォートの解析は非常に単純です。クォートに遭遇すると
.Pq エスケープされたクォートを除いて
対応するクォートが
出現するまでの部分を全て無視します。途中でエスケープされていない
改行が存在しても警告はしません。
.Sh オプション
.Bl -tag -width Ds -compact
.It Fl D Ns Ar sym
.It Fl U Ns Ar sym
指定したシンボルを定義する、または未定義にすることを指定します。
シンボルを定義するように指定した場合 ifdef で囲まれたブロックは
出力され、未定義を指定した場合は削除されます。
指定されたシンボル
.Ar sym
に対応する ifdef、ifndef、else、endif 行は削除されます。
指定しなかったシンボルに関する ifdef や if 行は、対応
する ifdef、else、endif 行とともに、そのまま出力されます。
ifdef X が別の ifdef X 中に出現した場合、内側の ifdef は指定しなかった
シンボルに関する ifdef と同等に扱われます。同じシンボルを複数指定した
場合は最後の指定が有効となります。
.Pp
.It Fl c
.Nm
の効果を逆転します。すなわち、通常削除されるべき行を残し、
残されるべき行を削除します。
.Pp
.It Fl l
削除される部分を空行で置き換えます。
.It Fl t
C 言語のコメントとクォートの解釈を禁止します。通
常のテキストファイル等に
.Nm
を適用する場合に有用です。
.Pp
.It Fl iD Ns Ar sym
.It Fl iU Ns Ar sym
無視すべき ifdef を指定します。C 言語コードで、ifdef を C 言語ではない
部分やコメントや作りかけのコードを区切るために用いている場合は、その内
部のクォートやコメントを無視するように指示する必要があります。無視すべき ifdef
は
.Fl D Ns Ar sym
や
.Fl U Ns Ar sym
と同様の方法で指定します。
.El
.Pp
.Nm
は標準出力に出力を行い、ファイル名が指定されなかった場合は標準
入力を使用します。
.Pp
.Nm
は、4.1 BSD の
.Xr diff 1
の
.Fl D Ns Ar sym
オプションとともに使用することができます。
.Sh 関連項目
.Xr diff 1
.Sh 診断
.Bl -item -compact
.It
不適切な else または endif を検出します。
.It
#ifdef に対応する #endif が現れる前にファイルが終了したとき、
その #ifdef のある行番号を検出します。
.El
入力と出力が同一になる場合 0、そうでなければ 1、エラー時には 2
を終了ステータスとして返します。
.Sh バグ
unifdef が `#if' を処理できるようにするべきです。
.Pp
ヌル文字を含む入力の場合には正しく動作しません。
.Sh 歴史
.Nm
は
.Bx 4.3
から登場しました。