1*d407ca27Smillert.\" $OpenBSD: diff3.1,v 1.1 2003/07/10 16:06:07 millert Exp $ 2*d407ca27Smillert.\" 3*d407ca27Smillert.\" Copyright (c) 1990, 1993, 1994 4*d407ca27Smillert.\" The Regents of the University of California. All rights reserved. 5*d407ca27Smillert.\" 6*d407ca27Smillert.\" Redistribution and use in source and binary forms, with or without 7*d407ca27Smillert.\" modification, are permitted provided that the following conditions 8*d407ca27Smillert.\" are met: 9*d407ca27Smillert.\" 1. Redistributions of source code must retain the above copyright 10*d407ca27Smillert.\" notice, this list of conditions and the following disclaimer. 11*d407ca27Smillert.\" 2. Redistributions in binary form must reproduce the above copyright 12*d407ca27Smillert.\" notice, this list of conditions and the following disclaimer in the 13*d407ca27Smillert.\" documentation and/or other materials provided with the distribution. 14*d407ca27Smillert.\" 3. Neither the name of the University nor the names of its contributors 15*d407ca27Smillert.\" may be used to endorse or promote products derived from this software 16*d407ca27Smillert.\" without specific prior written permission. 17*d407ca27Smillert.\" 18*d407ca27Smillert.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19*d407ca27Smillert.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20*d407ca27Smillert.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21*d407ca27Smillert.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22*d407ca27Smillert.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23*d407ca27Smillert.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24*d407ca27Smillert.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25*d407ca27Smillert.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26*d407ca27Smillert.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27*d407ca27Smillert.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28*d407ca27Smillert.\" SUCH DAMAGE. 29*d407ca27Smillert.\" 30*d407ca27Smillert.\" @(#)diff3.1 8.2 (Berkeley) 4/18/94 31*d407ca27Smillert.\" 32*d407ca27Smillert.Dd April 18, 1994 33*d407ca27Smillert.Dt DIFF3 1 34*d407ca27Smillert.Os 35*d407ca27Smillert.Sh NAME 36*d407ca27Smillert.Nm diff3 37*d407ca27Smillert.Nd 3-way differential file comparison 38*d407ca27Smillert.Sh SYNOPSIS 39*d407ca27Smillert.Nm diff3 40*d407ca27Smillert.Op Fl aexEX3 41*d407ca27Smillert.Ar file1 file2 file3 42*d407ca27Smillert.Sh DESCRIPTION 43*d407ca27SmillertThe 44*d407ca27Smillert.Nm 45*d407ca27Smillertutility compares the contents of three different versions of a file, 46*d407ca27Smillert.Ar file1 , 47*d407ca27Smillert.Ar file2 48*d407ca27Smillertand 49*d407ca27Smillert.Ar file3 , 50*d407ca27Smillertwriting the result to the standard output. 51*d407ca27SmillertThe options describe different methods of merging and 52*d407ca27Smillertpurging 53*d407ca27Smillertthe separate versions into a new file. 54*d407ca27Smillert.Nm 55*d407ca27Smillertis used by 56*d407ca27Smillert.Xr RCS 1 57*d407ca27Smillertto merge specific versions or create 58*d407ca27Smillertnew versions. 59*d407ca27Smillert.Pp 60*d407ca27SmillertThe options are as follows: 61*d407ca27Smillert.Bl -tag -width "-E, -X" 62*d407ca27Smillert.It Fl a 63*d407ca27SmillertTreat all files as ASCII. 64*d407ca27Smillert.It Fl e 65*d407ca27SmillertProduces output in a form suitable as an input script for the 66*d407ca27Smillert.Xr ed 1 67*d407ca27Smillertutility. 68*d407ca27SmillertThe script may then be used to merge differences common between all 69*d407ca27Smillertthree files and differences specific to 70*d407ca27Smillert.Ar file1 71*d407ca27Smillertand 72*d407ca27Smillert.Ar file3 . 73*d407ca27SmillertIn other words, the 74*d407ca27Smillert.Fl e 75*d407ca27Smillertoption ignores differences specific to 76*d407ca27Smillert.Ar file1 77*d407ca27Smillertand 78*d407ca27Smillert.Ar file2 , 79*d407ca27Smillertand those specific to 80*d407ca27Smillert.Ar file2 81*d407ca27Smillertand 82*d407ca27Smillert.Ar file3 . 83*d407ca27SmillertIt is useful for backing out changes specific to 84*d407ca27Smillert.Ar file2 85*d407ca27Smillertonly. 86*d407ca27Smillert.It Fl x 87*d407ca27SmillertProduces an output script suitable for 88*d407ca27Smillert.Xr ed 1 89*d407ca27Smillertwith changes 90*d407ca27Smillertspecific only to all three versions. 91*d407ca27Smillert.It Fl 3 92*d407ca27SmillertProduces an output script suitable for 93*d407ca27Smillert.Xr ed 1 94*d407ca27Smillertwith changes 95*d407ca27Smillertspecific only to 96*d407ca27Smillert.Ar file3 . 97*d407ca27Smillert.It Fl E , X 98*d407ca27SmillertSimilar to 99*d407ca27Smillert.Fl e 100*d407ca27Smillertand 101*d407ca27Smillert.Fl x , 102*d407ca27Smillertrespectively, but treat overlapping changes (i.e., changes that would 103*d407ca27Smillertbe noted with ==== in the normal listing) differently. 104*d407ca27SmillertThe overlapping lines from both files will be inserted by the edit script, 105*d407ca27Smillertbracketed by "<<<<<<" and ">>>>>>" lines. 106*d407ca27Smillert.El 107*d407ca27Smillert.Pp 108*d407ca27SmillertThe 109*d407ca27Smillert.Fl E 110*d407ca27Smillertoption is used by 111*d407ca27Smillert.Tn RCS 112*d407ca27Smillert.Xr merge 1 113*d407ca27Smillertto ensure that overlapping changes in the merged files are preserved 114*d407ca27Smillertand brought to someone's attention. 115*d407ca27Smillert.Pp 116*d407ca27SmillertFor example, suppose lines 7-8 are changed in both 117*d407ca27Smillert.Ar file1 118*d407ca27Smillertand 119*d407ca27Smillert.Ar file2 . 120*d407ca27SmillertApplying the edit script generated by the command 121*d407ca27Smillert.Pp 122*d407ca27Smillert.Dl diff3 -E file1 file2 file3 123*d407ca27Smillert.Pp 124*d407ca27Smillertto 125*d407ca27Smillert.Ar file1 126*d407ca27Smillertresults in the file: 127*d407ca27Smillert.Pp 128*d407ca27Smillert.Bd -literal -offset indent -compact 129*d407ca27Smillertlines 1-6 130*d407ca27Smillertof file1 131*d407ca27Smillert<<<<<<< file1 132*d407ca27Smillertlines 7-8 133*d407ca27Smillertof file1 134*d407ca27Smillert======= 135*d407ca27Smillertlines 7-8 136*d407ca27Smillertof file3 137*d407ca27Smillert>>>>>>> file3 138*d407ca27Smillertrest of file1 139*d407ca27Smillert.Ed 140*d407ca27Smillert.Pp 141*d407ca27SmillertThe default output of 142*d407ca27Smillert.Nm 143*d407ca27Smillertmakes notation of the differences between all files, and those 144*d407ca27Smillertdifferences specific to each pair of files. 145*d407ca27SmillertThe changes are described by the commands necessary for 146*d407ca27Smillert.Xr ed 1 147*d407ca27Smillertto create the desired target from the different versions. 148*d407ca27SmillertSee 149*d407ca27Smillert.Xr diff 1 150*d407ca27Smillertfor a description of the commands. 151*d407ca27Smillert.Bl -tag -width "=====" 152*d407ca27Smillert.It Li \&==== 153*d407ca27SmillertThe lines beneath this notation are ranges of lines which are different 154*d407ca27Smillertbetween all files. 155*d407ca27Smillert.It \&==== Ns Va n 156*d407ca27SmillertThe lines beneath this notation are ranges of lines which are exclusively 157*d407ca27Smillertdifferent in file 158*d407ca27Smillert.Va n . 159*d407ca27Smillert.El 160*d407ca27Smillert.Sh ENVIRONMENT 161*d407ca27Smillert.Bl -tag -width TMPDIR 162*d407ca27Smillert.It Ev TMPDIR 163*d407ca27SmillertIf the environment variable 164*d407ca27Smillert.Ev TMPDIR 165*d407ca27Smillertexists, 166*d407ca27Smillert.Nm 167*d407ca27Smillertwill use the directory specified by 168*d407ca27Smillert.Ev TMPDIR 169*d407ca27Smillertas the temporary directory. 170*d407ca27Smillert.El 171*d407ca27Smillert.Sh FILES 172*d407ca27Smillert.Bl -tag -width /usr/libexec/diff3prog -compact 173*d407ca27Smillert.It Pa /tmp/d3a.XXXXXXXXXX 174*d407ca27Smillerttemporary file 175*d407ca27Smillert.It Pa /tmp/d3b.XXXXXXXXXX 176*d407ca27Smillerttemporary file 177*d407ca27Smillert.It Pa /usr/libexec/diff3 178*d407ca27Smillertthe actual executable 179*d407ca27Smillert.El 180*d407ca27Smillert.Sh SEE ALSO 181*d407ca27Smillert.Xr diff 1 , 182*d407ca27Smillert.Xr ed 1 , 183*d407ca27Smillert.Xr merge 1 184*d407ca27Smillert.Xr rcs 1 185*d407ca27Smillert.Sh BUGS 186*d407ca27SmillertThe 187*d407ca27Smillert.Fl e 188*d407ca27Smillertoption cannot catch and change lines which have 189*d407ca27Smillert.Ql \&. 190*d407ca27Smillertas the first and only character on the line. 191*d407ca27SmillertThe resulting script will fail on that line 192*d407ca27Smillertas 193*d407ca27Smillert.Ql \&. 194*d407ca27Smillertis an 195*d407ca27Smillert.Xr ed 1 196*d407ca27Smillertediting command. 197*d407ca27Smillert.Sh HISTORY 198*d407ca27SmillertA 199*d407ca27Smillert.Nm 200*d407ca27Smillertcommand appeared in 201*d407ca27Smillert.At v7 . 202