|
|
1.1 root 1:
2: # $Id: merge.sh,v 1.3 88/11/08 12:06:42 narten Exp $
3:
4: PATH=/bin:/usr/bin
5: DIFF=/bin/diff
6: DIFF3=/bin/diff3
7: p=w
8: case $1 in
9: -p)
10: p='1,$p'
11: shift
12: esac
13:
14: case $# in
15: 0|1|2)
16: echo >&2 "merge: usage: merge [-p] file1 file2 file3"
17: exit 1
18: esac
19:
20: case $p in
21: w)
22: if test ! -w $1
23: then
24: echo >&2 "$1 not writeable"
25: exit 1
26: fi
27: esac
28:
29: trap 's=$?; rm -f /tmp/d3a$$ /tmp/d3b$$; exit $s' 0
30: trap exit 1 2 3 13 15
31: umask 077
32:
33: $DIFF $1 $3 >/tmp/d3a$$
34: case $? in
35: 0|1) ;;
36: *) exit
37: esac
38:
39: $DIFF $2 $3 >/tmp/d3b$$
40: case $? in
41: 0|1) ;;
42: *) exit
43: esac
44:
45: {
46: $DIFF3 -E /tmp/d3a$$ /tmp/d3b$$ $1 $2 $3 $4 $5
47: case $? in
48: 0) ;;
49: 1) echo >&2 merge: warning: 1 overlap during merge.;;
50: *) echo >&2 merge: warning: $? overlaps during merge.
51: esac
52: echo $p
53: } | ed - $1
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.