'\" te
.\"  Copyright 1989 AT&T  Copyright (c) 2005, Sun Microsystems, Inc.  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH DIFF3 1 "Nov 7, 2005"
.SH NAME
diff3 \- 3-way differential file comparison
.SH SYNOPSIS
.LP
.nf
\fBdiff3\fR [\fB-exEX3\fR] \fIfilename1\fR \fIfilename2\fR \fIfilename3\fR
.fi

.SH DESCRIPTION
.sp
.LP
\fBdiff3\fR compares three versions of a file. It publishes disagreeing ranges
of text flagged with the following codes:
.sp
.ne 2
.na
\fB\fB====\fR\fR
.ad
.RS 9n
all three files differ
.RE

.sp
.ne 2
.na
\fB\fB====1\fR\fR
.ad
.RS 9n
\fIfilename1\fRis different
.RE

.sp
.ne 2
.na
\fB\fB====2\fR\fR
.ad
.RS 9n
\fIfilename2\fRis different
.RE

.sp
.ne 2
.na
\fB\fB====3\fR\fR
.ad
.RS 9n
\fIfilename3\fRis different
.RE

.sp
.LP
The type of change suffered in converting a given range of a given file to some
other is indicated in one of the following ways:
.sp
.ne 2
.na
\fB\fIf\fR\fB : \fR\fIn1\fR\fB a\fR\fR
.ad
.RS 17n
Text is to be appended after line number \fIn1\fR in file \fIf\fR, where
\fIf\fR = 1, 2, or 3.
.RE

.sp
.ne 2
.na
\fB\fIf\fR\fB : \fR\fIn1\fR\fB , \fR\fIn2\fR\fB c\fR\fR
.ad
.RS 17n
Text is to be changed in the range line \fIn1\fR to line \fIn2\fR. If \fIn1\fR
= \fIn\fR2, the range can be abbreviated to \fIn1\fR.
.RE

.sp
.LP
The original contents of the range follows immediately after a \fBc\fR
indication. When the contents of two files are identical, the contents of the
lower-numbered file is suppressed.
.sp
.LP
The following command applies the resulting script to \fIfilename1\fR.
.sp
.in +2
.nf
\fB(cat script; echo a\'1,$pa\') | ed \(mi \fR\fIfilename1\fR
.fi
.in -2
.sp

.SH OPTIONS
.sp
.LP
The following options are supported:
.sp
.ne 2
.na
\fB\fB-e\fR \fR
.ad
.RS 7n
Produce a script for the \fBed\fR(1) editor that incorporates into
\fIfilename1\fR all changes between \fIfilename2\fR and \fIfilename3\fR (that
is, the changes that normally would be flagged \fB====\fR and \fB====3\fR).
.sp
Text lines that consist of a single dot (\fB\&.\fR defeat the \fB-e\fR option.
.RE

.sp
.ne 2
.na
\fB\fB-E\fR \fR
.ad
.RS 7n
Produce a script that incorporates all changes between \fIfilename2\fR and
\fIfilename3\fR, but treat overlapping changes (that is, changes that would be
flagged with \fB====\fR in the normal listing) differently. The overlapping
lines from both files are inserted by the edit script, bracketed by
\fB<<<<<<\fR and \fB>>>>>>\fR lines.
.RE

.sp
.ne 2
.na
\fB\fB-x\fR \fR
.ad
.RS 7n
Produce a script to incorporate only changes flagged \fB====\fR.
.RE

.sp
.ne 2
.na
\fB\fB-X\fR \fR
.ad
.RS 7n
Produce a script that incorporates only changes flagged \fB====\fR, but treat
these changes in the manner of the \fB-E\fR option.
.RE

.sp
.ne 2
.na
\fB\fB-3\fR \fR
.ad
.RS 7n
Produce a script to incorporate only changes flagged \fB====3\fR.
.RE

.SH USAGE
.sp
.LP
See \fBlargefile\fR(5) for the description of the behavior of \fBdiff3\fR when
encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
.SH FILES
.sp
.ne 2
.na
\fB\fB/tmp/d3*\fR \fR
.ad
.RS 23n

.RE

.sp
.ne 2
.na
\fB\fB/usr/lib/diff3prog\fR \fR
.ad
.RS 23n

.RE

.SH EXIT STATUS
.sp
.LP
The following exit values are returned:
.sp
.ne 2
.na
\fB\fB0\fR \fR
.ad
.RS 6n
Successful completion.
.RE

.sp
.ne 2
.na
\fB\fB1\fR\fR
.ad
.RS 6n
An error occurred. A difference was found or there was a fatal error.
.RE

.sp
.ne 2
.na
\fB\fB>1\fR\fR
.ad
.RS 6n
A fatal error occurred.
.RE

.sp
.LP
Return values do not work the same as \fBdiff\fR(1) or other vendor's versions
of \fBdiff3\fR.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
CSI	Enabled
.TE

.SH SEE ALSO
.sp
.LP
\fBdiff\fR(1), \fBattributes\fR(5), \fBlargefile\fR(5)
.SH NOTES
.sp
.LP
Files longer than 64 Kbytes do not work.