aboutsummaryrefslogtreecommitdiff
path: root/ja_JP.eucJP/man/man1/cmp.1
blob: a9252dc7b183db6194e960e67f5aa63554b17032 (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
.\" Copyright (c) 1987, 1990, 1993
.\"	The Regents of the University of California.  All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" the Institute of Electrical and Electronics Engineers, Inc.
.\"
.\" 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.
.\"
.\"     @(#)cmp.1	8.1 (Berkeley) 6/6/93
.\" %FreeBSD: src/usr.bin/cmp/cmp.1,v 1.7.2.2 2000/07/17 23:07:13 brian Exp %
.\" jpman %Id: cmp.1,v 1.2 1997/03/26 15:40:44 horikawa Stab %
.\"
.Dd June 6, 1993
.Dt CMP 1
.Os
.Sh 名称
.Nm cmp
.Nd 2 つのファイルを比較する
.Sh 書式
.Nm cmp
.Op Fl l | Fl s | Fl x
.Op Fl z
.Ar file1 file2
.Op Ar skip1 Op Ar skip2
.Sh 解説
.Nm cmp
ユーティリティは、2つのファイル内容を比較して、その結果を標準出力に出力します。
ファイル内容が一致していれば、デフォルトでは
.Nm cmp
は何も表示しません。ファイル内容に違いがあった場合は、最初に
違いが見つかった場所の、
バイト位置と行番号を出力します。
.Pp
バイト位置と行番号は、1 から数え始めます。
.Pp
オプションは以下のものがあります:
.Bl -tag -width Ds
.It Fl l
全ての違いに対し、
違いのあった場所のファイル先頭からのバイト位置 (10 進数表現) と、
各々のファイル中の値 (8 進数表現) を表示します。
.It Fl s
何も表示しないようにします。結果は終了コードにのみ反映されます。
.It Fl x
.Fl l
と似ていますが、16 進数で表示し、
ファイルの最初のバイトに対して 0 をインデックスとして使用します。
.It Fl z
通常ファイルに対しては、ファイルの大きさをまず比較し、
異なる場合には比較を失敗させます。
.El
.Pp
.Ar file1
と
.Ar file2 ,
の開始バイト位置を
.Ar skip1
と
.Ar skip2
を使って、各々指定して比較することができます。
この値は 10 進数表記がデフォルトで、先頭に ``0x'' か ``0'' があると、
16 進数や 8 進数表現と解釈されます。
.Pp
.Nm cmp
は、戻り値として以下の値のうちの一つをとります:
.Bl -tag -width 4n
.It 0
ファイル内容が一致した。
.It 1
ファイル内容に違いがあったか、どちらかのファイルが先に
ファイルエンドに達した。
後者の場合、
.Fl s
オプションが指定されていない場合には、
.Nm cmp
は、短い方のファイルで (違いが見付かる前に)
EOF に到達したことを標準エラー出力に出力します。
.It >1
エラーが起きた。
.El
.Sh 関連項目
.Xr diff 1 ,
.Xr diff3 1
.Sh 規格
.Nm cmp
は
.St -p1003.2
準拠です。
.Sh 歴史
.Nm cmp
コマンドは
.At v1
から登場しました。