comparison lib-src/vcdiff @ 5406:061f4f90f874

Convert lib-src/ to GPLv3.
author Mike Sperber <sperber@deinprogramm.de>
date Mon, 18 Oct 2010 14:02:19 +0200
parents 376386a54a3c
children
comparison
equal deleted inserted replaced
5405:2aa9cd456ae7 5406:061f4f90f874
1 #!/bin/sh 1 #! /bin/sh
2 # 2
3 # Enhanced sccs diff utility for use with vc mode. 3 # Enhanced sccs diff utility for use with vc mode.
4 # This version is more compatible with rcsdiff(1). 4 # This version is more compatible with rcsdiff(1).
5 # 5
6 # !Id: vcdiff,v 1.4 1993/12/03 09:29:18 eggert Exp ! 6 # Copyright (C) 1992, 1993, 1995, 1997, 2001, 2002, 2003, 2004, 2005,
7 # 7 # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
8 # Modified by: vladimir@Eng.Sun.COM on 95-06-07 8
9 # * Made sure that file arguments are specifed as s.<filename>. 9 # Author: Paul Eggert
10 # * Switched the assignments to $f inside the 3rd and 4th case statements of 10 # (according to authors.el)
11 # the first for-loop 11
12 # * Removed the incorrect initialization of sid1 before the first for-loop. 12 # This file is part of XEmacs.
13 # 13
14 # XEmacs is free software: you can redistribute it and/or modify
15 # it under the terms of the GNU General Public License as published by
16 # the Free Software Foundation, either version 3 of the License, or
17 # (at your option) any later version.
18
19 # XEmacs is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
23
24 # You should have received a copy of the GNU General Public License
25 # along with XEmacs. If not, see <http://www.gnu.org/licenses/>.
26
14 27
15 DIFF="diff" 28 DIFF="diff"
16 usage="$0: Usage: vcdiff [--brief] [-q] [-r<sid1>] [-r<sid2>] [diffopts] sccsfile..." 29 usage="$0: Usage: vcdiff [--brief] [-q] [-r<sid1>] [-r<sid2>] [diffopts] sccsfile..."
17 30
18 PATH=$PATH:/usr/ccs/bin:/usr/sccs # common SCCS hangouts 31 # Now that we use `sccs get' rather than just `get', we don't need this.
32 # PATH=$PATH:/usr/ccs/bin:/usr/sccs:/usr/xpg4/bin # common SCCS hangouts
19 33
20 echo= 34 echo="echo"
21 sid1= sid2= 35 sid1= sid2=
22 36
23 for f 37 for f
24 do 38 do
25 case $f in 39 case $f in
29 DIFF=cmp;; 43 DIFF=cmp;;
30 -q) 44 -q)
31 echo=:;; 45 echo=:;;
32 -r?*) 46 -r?*)
33 case $sid1 in 47 case $sid1 in
34 -r*) 48 '')
49 sid1=$f
50 ;;
51 *)
52 case $sid2 in
53 ?*) echo "$usage" >&2; exit 2 ;;
54 esac
35 sid2=$f 55 sid2=$f
36 ;;
37 *)
38 case $sid2 in
39 ?*) echo "$usage" >&2; exit 2 ;;
40 esac
41 sid1=$f
42 ;; 56 ;;
43 esac 57 esac
44 ;; 58 ;;
45 *) 59 *)
46 options="$options $f" 60 options="$options $f"
65 trap 'status=2; exit' 1 2 13 15 79 trap 'status=2; exit' 1 2 13 15
66 trap 'rm -f $rev1 $rev2 || status=2; exit $status' 0 80 trap 'rm -f $rev1 $rev2 || status=2; exit $status' 0
67 81
68 for f 82 for f
69 do 83 do
70 s=2 84 s=2
71
72 # For files under SCCS control, fixup the file name to be the s. filename
73 if [ -d SCCS ]; then
74 if [ $f = `echo $f | sed -e 's|SCCS/s.||'` ]; then
75 f="SCCS/s.$f"
76 fi
77 fi
78 85
79 case $f in 86 case $f in
80 s.* | */s.*) 87 s.* | */s.*)
81 if 88 if
82 rev1=/tmp/geta$$ 89 rev1=`mktemp /tmp/geta.XXXXXXXX`
83 get -s -p -k $sid1 "$f" > $rev1 && 90 sccs get -s -p -k $sid1 "$f" > $rev1 &&
84 case $sid2 in 91 case $sid2 in
85 '') 92 '')
86 workfile=`expr " /$f" : '.*/s.\(.*\)'` 93 workfile=`expr " /$f" : '.*/s.\(.*\)'`
87 ;; 94 ;;
88 *) 95 *)
89 rev2=/tmp/getb$$ 96 rev2=`mktemp /tmp/getb.XXXXXXXX`
90 get -s -p -k $sid2 "$f" > $rev2 97 sccs get -s -p -k $sid2 "$f" > $rev2
91 workfile=$rev2 98 workfile=$rev2
92 esac 99 esac
93 then 100 then
94 $echo $DIFF $options $sid1 $sid2 $workfile >&2 101 $echo $DIFF $options $rev1 $workfile >&2
95 $DIFF $options $rev1 $workfile 102 $DIFF $options $rev1 $workfile
96 s=$? 103 s=$?
97 fi 104 fi
98 ;; 105 ;;
99 *) 106 *)
102 109
103 if test $status -lt $s 110 if test $status -lt $s
104 then status=$s 111 then status=$s
105 fi 112 fi
106 done 113 done
114