annotate lib-src/vcdiff @ 5781:0853e1ec8529

Use alloca_{rawbytes,ibytes} in #'copy-file, #'insert-file-contents-internal src/ChangeLog addition: 2014-01-20 Aidan Kehoe <kehoea@parhasard.net> * fileio.c (Fcopy_file, Finsert_file_contents_internal): Use alloca_{rawbytes,ibytes} here instead of the implicit alloca on the stack; doesn't change where the buffers are allocated for these two functions, but does mean that decisions about alloca vs. malloc based on buffer size are made in the same place (ultimately, the ALLOCA() macro).
author Aidan Kehoe <kehoea@parhasard.net>
date Mon, 20 Jan 2014 17:53:07 +0000
parents 06dd936cde16
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5491
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
1 #! /bin/sh
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
2
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 # Enhanced sccs diff utility for use with vc mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 # This version is more compatible with rcsdiff(1).
5491
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
5
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
6 # Copyright (C) 1992, 1993, 1995, 1997, 2001, 2002, 2003, 2004, 2005,
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
7 # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
8
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
9 # Author: Paul Eggert
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
10 # (according to authors.el)
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
11
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
12 # This file is part of XEmacs.
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
13
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
14 # XEmacs is free software: you can redistribute it and/or modify
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
15 # it under the terms of the GNU General Public License as published by
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
16 # the Free Software Foundation, either version 3 of the License, or
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
17 # (at your option) any later version.
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
18
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
19 # XEmacs is distributed in the hope that it will be useful,
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
22 # GNU General Public License for more details.
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
23
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
24 # You should have received a copy of the GNU General Public License
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
25 # along with XEmacs. If not, see <http://www.gnu.org/licenses/>.
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
26
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 # Modified by: vladimir@Eng.Sun.COM on 95-06-07
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 # * Made sure that file arguments are specifed as s.<filename>.
5491
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
29
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
30 # Synced up with: GNU 23.1.92.
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
31 # Synced by: Ben Wing, 2-17-10.
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
32
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 DIFF="diff"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 usage="$0: Usage: vcdiff [--brief] [-q] [-r<sid1>] [-r<sid2>] [diffopts] sccsfile..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
5491
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
37 # Now that we use `sccs get' rather than just `get', we don't need this.
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
38 # PATH=$PATH:/usr/ccs/bin:/usr/sccs:/usr/xpg4/bin # common SCCS hangouts
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39
5491
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
40 echo="echo"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 sid1= sid2=
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 for f
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 case $f in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 -*)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 case $f in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 --brief)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 DIFF=cmp;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 -q)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 echo=:;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 -r?*)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 case $sid1 in
5491
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
54 '')
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
55 sid1=$f
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 *)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 case $sid2 in
5491
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
59 ?*) echo "$usage" >&2; exit 2 ;;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 esac
5491
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
61 sid2=$f
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 esac
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 *)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 options="$options $f"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 esac
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 shift
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 *)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 break
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 esac
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 done
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 case $# in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 echo "$usage" >&2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 exit 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 esac
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 rev1= rev2= status=0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 trap 'status=2; exit' 1 2 13 15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 trap 'rm -f $rev1 $rev2 || status=2; exit $status' 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 for f
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 do
5491
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
90 s=2
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
91
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
92 # For files under SCCS control, fixup the file name to be the
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
93 # s. filename
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
94 if [ -d SCCS ]; then
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
95 if [ $f = `echo $f | sed -e 's|SCCS/s.||'` ]; then
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
96 f="SCCS/s.$f"
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
97 fi
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
98 fi
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 case $f in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 s.* | */s.*)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 if
5491
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
103 rev1=`mktemp /tmp/geta.XXXXXXXX`
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
104 sccs get -s -p -k $sid1 "$f" > $rev1 &&
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 case $sid2 in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 '')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 workfile=`expr " /$f" : '.*/s.\(.*\)'`
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 *)
5491
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
110 rev2=`mktemp /tmp/getb.XXXXXXXX`
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
111 sccs get -s -p -k $sid2 "$f" > $rev2
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 workfile=$rev2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 esac
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 then
5491
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
115 $echo $DIFF $options $rev1 $workfile >&2
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 $DIFF $options $rev1 $workfile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 s=$?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 fi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 *)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 echo "$0: $f is not an SCCS file" >&2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 esac
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 if test $status -lt $s
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 then status=$s
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 fi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 done
5491
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
128
06dd936cde16 Merge some stuff in lib-src
Ben Wing <ben@xemacs.org>
parents: 0
diff changeset
129 # arch-tag: 4344ba3a-bcbe-4f77-971c-f43c1606953a