xref: /csrg-svn/usr.bin/diff/diff3/diff3.sh (revision 48249)
1*48249Sbostic#!/bin/sh -
210881Sshannon#
3*48249Sbostic# Copyright (c) 1991 The Regents of the University of California.
4*48249Sbostic# All rights reserved.
510881Sshannon#
6*48249Sbostic# %sccs.include.proprietary.sh%
7*48249Sbostic#
8*48249Sbostic#	@(#)diff3.sh	4.3 (Berkeley) 04/17/91
9*48249Sbostic#
10*48249Sbostic
1110881Sshannone=
1210881Sshannoncase $1 in
1310881Sshannon-*)
1410881Sshannon	e=$1
1510881Sshannon	shift;;
1610881Sshannonesac
1710881Sshannonif test $# = 3 -a -f $1 -a -f $2 -a -f $3
1810881Sshannonthen
1910881Sshannon	:
2010881Sshannonelse
2110881Sshannon	echo usage: diff3 file1 file2 file3 1>&2
2210881Sshannon	exit
2310881Sshannonfi
2410881Sshannontrap "rm -f /tmp/d3[ab]$$" 0 1 2 13 15
2510881Sshannondiff $1 $3 >/tmp/d3a$$
2610881Sshannondiff $2 $3 >/tmp/d3b$$
2737873Sbostic/usr/libexec/diff3 $e /tmp/d3[ab]$$ $1 $2 $3
28