head     1.4;
access   dvolodin avg;
symbols  :1.3 SM4:1.2;
locks    ;
comment  @# @;


1.4
date     88.11.18.21.55.57;  author dvolodin;  state Exp;
branches ;
next     1.3;

1.3
date     86.02.24.17.01.40;  author avg;  state Exp;
branches ;
next     1.2;

1.2
date     85.12.26.21.55.46;  author fox;  state Rel;
branches ;
next     1.1;

1.1
date     85.12.26.21.45.37;  author fox;  state Exp;
branches ;
next     ;


desc
@  
@


1.4
log
@  rdiff3.
@
text
@
#! /bin/sh
# $Header: merge,v 1.3 86/02/24 17:01:40 avg Exp $
#
#   .
#
# : merge [-p] 1 2 3 [mark1 mark3]
#
# :  ,    2  3,
#   1.    -p,  
#     (1  ).
#
#     :
#
#                <<<<<<< file1
#                 1
#                =======
#                 3
#                >>>>>>> file3
#
#    mark1  mark3,  
#  - <<<<..  >>>>...   1  3.
#   ,   .

PATH=/bin:/usr/bin:.
DIFF3=/usr/lib/rcs/rdiff3
p=0
case $1 in
-p)
	p=$1
	shift;;
esac


if test $# -ge 3
then
	if test -f $1 -a -f $2 -a -f $3
	then
		trap "rm -f /tmp/d3[abc]$$" 0 1 2 13 15
		diff $1 $3 >/tmp/d3a$$
		diff $2 $3 >/tmp/d3b$$
		$DIFF3 -E /tmp/d3[ab]$$ $1 $2 $3 $4 $5 > /tmp/d3c$$
		r=$?
		if test $r != 0
		then
			case ${MSG=e} in
			r) echo : $r   . 1>&2 ;;
			*) echo Warning: $r overlaps during merge. 1>&2 ;;
			esac
		fi
		if test $p != 0
		then
			(cat /tmp/d3c$$; echo '1,$p') | ed - $1
		else
			(cat /tmp/d3c$$; echo w) | ed - $1
		fi
		exit 0
	else
		case ${MSG=e} in
		r) echo "   $1, $2  $3" 1>&2 ;;
		*) echo "Cannot open $1, $2, or $3" 1>&2 ;;
		esac
	fi
fi
case ${MSG=e} in
r) echo ": merge [-p] 1 2 3" 1>&2 ;;
*) echo "Usage: merge [-p] file1 file2 file3" 1>&2 ;;
esac
exit 1
@


1.3
log
@  .
@
text
@d3 1
a3 1
# $Header: merge,v 1.1 85/12/26 21:45:37 fox Exp $
d26 1
a26 1
DIFF3=/usr/rcs/lib/rdiff3
@


1.2
log
@   
@
text
@d26 1
a26 1
DIFF3=/usr/new/rcs/lib/rdiff3
d30 1
a30 1
        p=$1
d37 32
a68 23
        if test -f $1 -a -f $2 -a -f $3
        then
                trap "rm -f /tmp/d3[abc]$$" 0 1 2 13 15
                diff $1 $3 >/tmp/d3a$$
                diff $2 $3 >/tmp/d3b$$
                $DIFF3 -E /tmp/d3[ab]$$ $1 $2 $3 $4 $5 > /tmp/d3c$$
                r=$?
                if test $r != 0
                then
                        echo Warning: $r overlaps during merge. 1>&2
                fi
                if test $p != 0
                then
                        (cat /tmp/d3c$$; echo '1,$p') | ed - $1
                else
                        (cat /tmp/d3c$$; echo w) | ed - $1
                fi
                exit 0
        else
                echo "Cannot open $1, $2, or $3" 1>&2
        fi
fi
echo "usage: merge [-p] file1 file2 file3" 1>&2
@


1.1
log
@Initial revision
@
text
@@
