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