(find-backup-file-name) [ms-dos]: If support for long
[emacs.git] / lib-src / vcdiff
blobe2023809e014a5ebcc6bde5319c8cdb5ea363f86
1 #! /bin/sh
3 # Enhanced sccs diff utility for use with vc mode.
4 # This version is more compatible with rcsdiff(1).
6 # $Id: vcdiff,v 1.5 1995/07/07 22:47:57 eggert Exp $
9 DIFF="diff"
10 usage="$0: Usage: vcdiff [--brief] [-q] [-r<sid1>] [-r<sid2>] [diffopts] sccsfile..."
12 PATH=$PATH:/usr/ccs/bin:/usr/sccs:/usr/xpg4/bin # common SCCS hangouts
14 echo=
15 sid1= sid2=
17 for f
19 case $f in
20 -*)
21 case $f in
22 --brief)
23 DIFF=cmp;;
24 -q)
25 echo=:;;
26 -r?*)
27 case $sid1 in
28 '')
29 sid1=$f
32 case $sid2 in
33 ?*) echo "$usage" >&2; exit 2 ;;
34 esac
35 sid2=$f
37 esac
40 options="$options $f"
42 esac
43 shift
46 break
48 esac
49 done
51 case $# in
53 echo "$usage" >&2
54 exit 2
55 esac
58 rev1= rev2= status=0
59 trap 'status=2; exit' 1 2 13 15
60 trap 'rm -f $rev1 $rev2 || status=2; exit $status' 0
62 for f
64 s=2
66 case $f in
67 s.* | */s.*)
69 rev1=/tmp/geta$$
70 get -s -p -k $sid1 "$f" > $rev1 &&
71 case $sid2 in
72 '')
73 workfile=`expr " /$f" : '.*/s.\(.*\)'`
76 rev2=/tmp/getb$$
77 get -s -p -k $sid2 "$f" > $rev2
78 workfile=$rev2
79 esac
80 then
81 $echo $DIFF $options $sid1 $sid2 $workfile >&2
82 $DIFF $options $rev1 $workfile
83 s=$?
87 echo "$0: $f is not an SCCS file" >&2
88 esac
90 if test $status -lt $s
91 then status=$s
93 done