|
|
1.1 root 1: PATH=/bin:/usr/bin:.
2: DIFF3=/usr/local/lib/rdiff3
3: p=0
4: case $1 in
5: -p)
6: p=$1
7: shift;;
8: esac
9:
10:
11: if test $# -ge 3
12: then
13: if test -f $1 -a -f $2 -a -f $3
14: then
15: trap "rm -f /tmp/d3[abc]$$; exit 1" 1 2 3 13 15
16: trap "rm -f /tmp/d3[abc]$$; exit 0" 0
17: diff $1 $3 >/tmp/d3a$$
18: diff $2 $3 >/tmp/d3b$$
19: $DIFF3 -E /tmp/d3[ab]$$ $1 $2 $3 $4 $5 > /tmp/d3c$$
20: r=$?
21: if test $r != 0
22: then
23: echo Warning: $r overlaps during merge. 1>&2
24: fi
25: if test $p != 0
26: then
27: (cat /tmp/d3c$$; echo '1,$p') | ed - $1
28: exit 0
29: else
30: if test -w $1
31: then
32: (cat /tmp/d3c$$; echo w) | ed - $1
33: exit 0
34: else
35: echo "$1 not writeable" 1>&2
36: exit 1
37: fi
38: fi
39: else
40: echo "Cannot open $1, $2, or $3" 1>&2
41: fi
42: fi
43: echo "usage: merge [-p] file1 file2 file3" 1>&2
44: exit 1
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.