BSD 4_3_Net_2 development
authorCSRG <csrg@ucbvax.Berkeley.EDU>
Mon, 1 Jul 1991 08:22:44 +0000 (00:22 -0800)
committerCSRG <csrg@ucbvax.Berkeley.EDU>
Mon, 1 Jul 1991 08:22:44 +0000 (00:22 -0800)
Work on file usr/src/contrib/rcs/src/merge

Synthesized-from: CSRG/cd2/net.2

usr/src/contrib/rcs/src/merge [new file with mode: 0755]

diff --git a/usr/src/contrib/rcs/src/merge b/usr/src/contrib/rcs/src/merge
new file mode 100755 (executable)
index 0000000..cd356bc
--- /dev/null
@@ -0,0 +1,52 @@
+
+
+PATH=/bin:/usr/bin
+DIFF=/usr/bin/diff
+DIFF3=/usr/bin/diff3
+p=w
+case $1 in
+-p)
+       p='1,$p'
+       shift
+esac
+
+case $# in
+0|1|2)
+       echo >&2 "merge: usage: merge [-p] file1 file2 file3"
+       exit 1
+esac
+
+case $p in
+w)
+       if test ! -w $1
+       then
+               echo >&2 "$1 not writeable"
+               exit 1
+       fi
+esac
+
+trap 's=$?; rm -f /tmp/d3a$$ /tmp/d3b$$; exit $s' 0
+trap exit 1 2 3 13 15
+umask 077
+
+$DIFF $1 $3 >/tmp/d3a$$
+case $? in
+0|1) ;;
+*) exit
+esac
+
+$DIFF $2 $3 >/tmp/d3b$$
+case $? in
+0|1) ;;
+*) exit
+esac
+
+{
+       $DIFF3 -E /tmp/d3a$$ /tmp/d3b$$ $1 $2 $3 $4 $5
+       case $? in
+       0) ;;
+       1) echo >&2 merge: warning: 1 overlap during merge.;;
+       *) echo >&2 merge: warning: $? overlaps during merge.
+       esac
+       echo $p
+} | ed - $1