1#!/bin/sh
| 1#! /bin/sh
|
2 3# Test RCS's functions. 4# The RCS commands are searched for in the PATH as usual; 5# to test the working directory's commands, prepend . to your PATH. 6 7# Test RCS by creating files RCS/a.* and RCS/a.c. 8# If all goes well, output nothing, and remove the temporary files. 9# Otherwise, send a message to standard output. 10# Exit status is 0 if OK, 1 if an RCS bug is found, and 2 if scaffolding fails. 11# With the -v option, output more debugging info. 12 13# If diff outputs `No differences encountered' when comparing identical files, 14# then rcstest may also output these noise lines; ignore them. 15 16# The current directory and ./RCS must be readable, writable, and searchable. 17
| 2 3# Test RCS's functions. 4# The RCS commands are searched for in the PATH as usual; 5# to test the working directory's commands, prepend . to your PATH. 6 7# Test RCS by creating files RCS/a.* and RCS/a.c. 8# If all goes well, output nothing, and remove the temporary files. 9# Otherwise, send a message to standard output. 10# Exit status is 0 if OK, 1 if an RCS bug is found, and 2 if scaffolding fails. 11# With the -v option, output more debugging info. 12 13# If diff outputs `No differences encountered' when comparing identical files, 14# then rcstest may also output these noise lines; ignore them. 15 16# The current directory and ./RCS must be readable, writable, and searchable. 17
|
18# $Id: rcstest,v 5.8 1991/11/20 17:58:10 eggert Exp $
| 18# $Id: rcstest,v 5.14 1995/06/16 06:19:24 eggert Exp $
|
19 20
| 19 20
|
21# Copyright 1990, 1991 by Paul Eggert
| 21# Copyright 1990, 1991, 1992, 1993, 1994, 1995 Paul Eggert
|
22# Distributed under license by the Free Software Foundation, Inc. 23# 24# This file is part of RCS. 25# 26# RCS is free software; you can redistribute it and/or modify 27# it under the terms of the GNU General Public License as published by 28# the Free Software Foundation; either version 2, or (at your option) 29# any later version. 30# 31# RCS is distributed in the hope that it will be useful, 32# but WITHOUT ANY WARRANTY; without even the implied warranty of 33# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 34# GNU General Public License for more details. 35# 36# You should have received a copy of the GNU General Public License
| 22# Distributed under license by the Free Software Foundation, Inc. 23# 24# This file is part of RCS. 25# 26# RCS is free software; you can redistribute it and/or modify 27# it under the terms of the GNU General Public License as published by 28# the Free Software Foundation; either version 2, or (at your option) 29# any later version. 30# 31# RCS is distributed in the hope that it will be useful, 32# but WITHOUT ANY WARRANTY; without even the implied warranty of 33# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 34# GNU General Public License for more details. 35# 36# You should have received a copy of the GNU General Public License
|
37# along with RCS; see the file COPYING. If not, write to 38# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
| 37# along with RCS; see the file COPYING. 38# If not, write to the Free Software Foundation, 39# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
39# 40# Report problems and direct all questions to: 41# 42# rcs-bugs@cs.purdue.edu 43
| 40# 41# Report problems and direct all questions to: 42# 43# rcs-bugs@cs.purdue.edu 44
|
| 45# The Makefile overrides the following defaults. 46: ${ALL_CFLAGS=-Dhas_conf_h} 47: ${CC=cc} 48: ${DIFF=diff} 49# : ${LDFLAGS=} ${LIBS=} tickles old shell bug 50 51CL="$CC $ALL_CFLAGS $LDFLAGS -o a.out" 52L=$LIBS 53
|
44RCSINIT=-x 45export RCSINIT 46 47SLASH=/ 48RCSfile=RCS${SLASH}a.c 49RCS_alt=RCS${SLASH}a.d 50lockfile=RCS${SLASH}a._ 51 52case $1 in 53-v) q=; set -x;; 54'') q=-q;; 55*) echo >&2 "$0: usage: $0 [-v]"; exit 2 56esac 57
| 54RCSINIT=-x 55export RCSINIT 56 57SLASH=/ 58RCSfile=RCS${SLASH}a.c 59RCS_alt=RCS${SLASH}a.d 60lockfile=RCS${SLASH}a._ 61 62case $1 in 63-v) q=; set -x;; 64'') q=-q;; 65*) echo >&2 "$0: usage: $0 [-v]"; exit 2 66esac 67
|
58test -d RCS || { 59 echo >&2 "$0: RCS: not a directory; please \`mkdir RCS' first." 60 exit 1 61}
| 68if test -d RCS 69then rmdir=: 70else rmdir=rmdir; mkdir RCS || exit 71fi
|
62 63rm -f a.* $RCSfile $RCS_alt $lockfile && 64echo 1.1 >a.11 && 65echo 1.1.1.1 >a.3x1 && 66echo 1.2 >a.12 || { echo "#initialization failed"; exit 2; } 67
| 72 73rm -f a.* $RCSfile $RCS_alt $lockfile && 74echo 1.1 >a.11 && 75echo 1.1.1.1 >a.3x1 && 76echo 1.2 >a.12 || { echo "#initialization failed"; exit 2; } 77
|
68case `diff -c a.11 a.3x1` in 69*'! 1.1.1.1') 70 diff='diff -c';;
| 78case "`$DIFF -c a.11 a.3x1`" in 79*!\ 1.1.1.1) 80 diff="$DIFF -c";;
|
71*)
| 81*)
|
72 echo "#warning: diff -c does not work, so diagnostics may be cryptic" 73 diff=diff
| 82 echo "#warning: $DIFF -c does not work, so diagnostics may be cryptic" 83 diff=$DIFF
|
74esac 75 76rcs -i -L -ta.11 $q a.c &&
| 84esac 85 86rcs -i -L -ta.11 $q a.c &&
|
77<$RCSfile || {
| 87test -r $RCSfile || {
|
78 echo "#rcs -i -L failed; perhaps RCS is not properly installed." 79 exit 1 80} 81 82rlog a.c >/dev/null || { echo "#rlog failed on empty RCS file"; exit 1; } 83rm -f $RCSfile || exit 2 84 85cp a.11 a.c && 86ci -ta.11 -mm $q a.c &&
| 88 echo "#rcs -i -L failed; perhaps RCS is not properly installed." 89 exit 1 90} 91 92rlog a.c >/dev/null || { echo "#rlog failed on empty RCS file"; exit 1; } 93rm -f $RCSfile || exit 2 94 95cp a.11 a.c && 96ci -ta.11 -mm $q a.c &&
|
87<$RCSfile &&
| 97test -r $RCSfile &&
|
88rcs -L $q a.c || { echo "#ci+rcs -L failed"; exit 1; } 89test ! -f a.c || { echo "#ci did not remove working file"; exit 1; } 90for l in '' '-l' 91do 92 co $l $q a.c && 93 test -f a.c || { echo '#co' $l did not create working file; exit 1; } 94 $diff a.11 a.c || { echo '#ci' followed by co $l is not a no-op; exit 1; } 95done 96 97cp a.12 a.c && 98ci -mm $q a.c && 99co $q a.c && 100$diff a.12 a.c || { echo "#ci+co failed"; exit 1; } 101
| 98rcs -L $q a.c || { echo "#ci+rcs -L failed"; exit 1; } 99test ! -f a.c || { echo "#ci did not remove working file"; exit 1; } 100for l in '' '-l' 101do 102 co $l $q a.c && 103 test -f a.c || { echo '#co' $l did not create working file; exit 1; } 104 $diff a.11 a.c || { echo '#ci' followed by co $l is not a no-op; exit 1; } 105done 106 107cp a.12 a.c && 108ci -mm $q a.c && 109co $q a.c && 110$diff a.12 a.c || { echo "#ci+co failed"; exit 1; } 111
|
| 112rm -f a.c &&
|
102co -r1.1 $q a.c && 103$diff a.11 a.c || { echo "#can't retrieve first revision"; exit 1; } 104 105rm -f a.c && 106cp a.3x1 a.c && 107ci -r1.1.1 -mm $q a.c && 108co -r1.1.1.1 $q a.c && 109$diff a.3x1 a.c || { echo "#branches failed"; exit 1; } 110
| 113co -r1.1 $q a.c && 114$diff a.11 a.c || { echo "#can't retrieve first revision"; exit 1; } 115 116rm -f a.c && 117cp a.3x1 a.c && 118ci -r1.1.1 -mm $q a.c && 119co -r1.1.1.1 $q a.c && 120$diff a.3x1 a.c || { echo "#branches failed"; exit 1; } 121
|
| 122rm -f a.c &&
|
111co -l $q a.c && 112ci -f -mm $q a.c && 113co -r1.3 $q a.c && 114$diff a.12 a.c || { echo "#(co -l; ci -f) failed"; exit 1; } 115
| 123co -l $q a.c && 124ci -f -mm $q a.c && 125co -r1.3 $q a.c && 126$diff a.12 a.c || { echo "#(co -l; ci -f) failed"; exit 1; } 127
|
| 128rm -f a.c &&
|
116co -l $q a.c && 117echo 1.4 >a.c && 118ci -l -mm $q a.c && 119echo error >a.c && 120ci -mm $q a.c || { echo "#ci -l failed"; exit 1; } 121
| 129co -l $q a.c && 130echo 1.4 >a.c && 131ci -l -mm $q a.c && 132echo error >a.c && 133ci -mm $q a.c || { echo "#ci -l failed"; exit 1; } 134
|
| 135rm -f a.c &&
|
122co -l $q a.c && 123echo 1.5 >a.c && 124ci -u -mm $q a.c &&
| 136co -l $q a.c && 137echo 1.5 >a.c && 138ci -u -mm $q a.c &&
|
125<a.c || { echo "#ci -u didn't create a working file"; exit 1; }
| 139test -r a.c || { echo "#ci -u didn't create a working file"; exit 1; }
|
126rm -f a.c && 127echo error >a.c || exit 2 128ci -mm $q a.c 2>/dev/null && { echo "#ci -u didn't unlock the file"; exit 1; } 129 130rm -f a.c && 131rcs -l $q a.c && 132co -u $q a.c || { echo "#rcs -l + co -u failed"; exit 1; } 133rm -f a.c && 134echo error >a.c || exit 2 135ci -mm $q a.c 2>/dev/null && { echo "#co -u didn't unlock the file"; exit 1; } 136 137rm -f a.c && 138cp a.11 a.c && 139co -f $q a.c || { echo "#co -f failed"; exit 1; } 140$diff a.11 a.c >/dev/null && { echo "#co -f had no effect"; exit 1; } 141 142co -p1.1 $q a.c >a.t && 143$diff a.11 a.t || { echo "#co -p failed"; exit 1; } 144 145for n in n N 146do 147 rm -f a.c && 148 co -l $q a.c && 149 echo $n >a.$n && 150 cp a.$n a.c && 151 ci -${n}n -mm $q a.c && 152 co -rn $q a.c && 153 $diff a.$n a.c || { echo "#ci -$n failed"; exit 1; } 154done 155 156case $LOGNAME in 157?*) me=$LOGNAME;; 158*) 159 case $USER in 160 ?*) me=$USER;; 161 *) 162 me=`who am i` || exit 2 163 me=`echo "$me" | sed -e 's/ .*//' -e 's/.*!//'` 164 case $me in 165 '') echo >&2 "$0: cannot deduce user name"; exit 2 166 esac 167 esac 168esac
| 140rm -f a.c && 141echo error >a.c || exit 2 142ci -mm $q a.c 2>/dev/null && { echo "#ci -u didn't unlock the file"; exit 1; } 143 144rm -f a.c && 145rcs -l $q a.c && 146co -u $q a.c || { echo "#rcs -l + co -u failed"; exit 1; } 147rm -f a.c && 148echo error >a.c || exit 2 149ci -mm $q a.c 2>/dev/null && { echo "#co -u didn't unlock the file"; exit 1; } 150 151rm -f a.c && 152cp a.11 a.c && 153co -f $q a.c || { echo "#co -f failed"; exit 1; } 154$diff a.11 a.c >/dev/null && { echo "#co -f had no effect"; exit 1; } 155 156co -p1.1 $q a.c >a.t && 157$diff a.11 a.t || { echo "#co -p failed"; exit 1; } 158 159for n in n N 160do 161 rm -f a.c && 162 co -l $q a.c && 163 echo $n >a.$n && 164 cp a.$n a.c && 165 ci -${n}n -mm $q a.c && 166 co -rn $q a.c && 167 $diff a.$n a.c || { echo "#ci -$n failed"; exit 1; } 168done 169 170case $LOGNAME in 171?*) me=$LOGNAME;; 172*) 173 case $USER in 174 ?*) me=$USER;; 175 *) 176 me=`who am i` || exit 2 177 me=`echo "$me" | sed -e 's/ .*//' -e 's/.*!//'` 178 case $me in 179 '') echo >&2 "$0: cannot deduce user name"; exit 2 180 esac 181 esac 182esac
|
169date=`date -u 2>/dev/null` || 170date=`TZ=GMT0 date 2>/dev/null` || 171date=`TZ= date` || exit 2 172set $date 173case $2 in 174Jan) m=01;; Feb) m=02;; Mar) m=03;; Apr) m=04;; May) m=05;; Jun) m=06;; 175Jul) m=07;; Aug) m=08;; Sep) m=09;; Oct) m=10;; Nov) m=11;; Dec) m=12;; 176*) echo >&2 "$0: $2: unknown month name"; exit 2
| 183 184 185# Get the date of the previous revision in UTC. 186date=`rlog -r a.c | sed -n '/^date: /{ s///; s/;.*//; p; q; }'` || exit 187case $date in 188[0-9][0-9][0-9]*[0-9]/[0-1][0-9]/[0-3][0-9]\ [0-2][0-9]:[0-5][0-9]:[0-6][0-9]);; 189*) echo >&2 "$0: $date: bad rlog date output"; exit 1
|
177esac
| 190esac
|
178case $3 in 179?) d=0$3;; 180*) d=$3 181esac 182case $6 in 183[0-9][0-9][0-9][0-9]*) D=$6/$m/$d;; 184*) 185 case $5 in 186 [0-9][0-9][0-9][0-9]*) D=$5/$m/$d;; 187 *) echo >&2 "$0: bad date format: $date"; exit 2 188 esac 189esac 190T=$4 191case $PWD in 192'') PWD=`pwd` 193esac &&
| 191PWD=`pwd` && export PWD && 192rm -f a.c &&
|
194co -l $q a.c && 195sed 's/@/$/g' >a.kv <<EOF 196@Author: w @
| 193co -l $q a.c && 194sed 's/@/$/g' >a.kv <<EOF 195@Author: w @
|
197@Date: $D $T @ 198@Header: $PWD$SLASH$RCSfile 2.1 $D $T w s @ 199@Id: a.c 2.1 $D $T w s @
| 196@Date: $date @ 197@Header: $PWD$SLASH$RCSfile 2.1 $date w s @ 198@Id: a.c 2.1 $date w s @
|
200@Locker: @
| 199@Locker: @
|
201@Log: a.c @ 202 * Revision 2.1 $D $T w
| 200 * @Log: a.c @ 201 * Revision 2.1 $date w
|
203 * m 204 *
| 202 * m 203 *
|
| 204@Name: Oz @
|
205@RCSfile: a.c @ 206@Revision: 2.1 @ 207@Source: $PWD$SLASH$RCSfile @ 208@State: s @ 209EOF 210test $? = 0 && 211sed 's/:.*\$/$/' a.kv >a.k && 212sed -e 's/w s [$]/w s '"$me"' $/' -e 's/[$]Locker: /&'"$me/" a.kv >a.kvl &&
| 205@RCSfile: a.c @ 206@Revision: 2.1 @ 207@Source: $PWD$SLASH$RCSfile @ 208@State: s @ 209EOF 210test $? = 0 && 211sed 's/:.*\$/$/' a.kv >a.k && 212sed -e 's/w s [$]/w s '"$me"' $/' -e 's/[$]Locker: /&'"$me/" a.kv >a.kvl &&
|
213sed -e '/^\$/!d' -e 's/\$$/: old $/' a.k >a.o &&
| 213sed s/Oz//g a.kv >a.e && 214sed s/Oz/N/g a.kv >a.N && 215sed -e '/\$/!d' -e 's/\$$/: old $/' a.k >a.o &&
|
214sed -e 's/\$[^ ]*: //' -e 's/ \$//' a.kv >a.v && 215cp a.o a.c &&
| 216sed -e 's/\$[^ ]*: //' -e 's/ \$//' a.kv >a.v && 217cp a.o a.c &&
|
216ci -d"$date" -ss -ww -u2.1 -mm $q a.c &&
| 218ci -d"$date" -nOz -ss -ww -u2.1 -mm $q a.c &&
|
217$diff a.kv a.c || { echo "#keyword expansion failed"; exit 1; }
| 219$diff a.kv a.c || { echo "#keyword expansion failed"; exit 1; }
|
218co -p -ko $q a.c >a.oo &&
| 220co -pOz -ko $q a.c >a.oo &&
|
219$diff a.o a.oo || { echo "#co -p -ko failed"; exit 1; }
| 221$diff a.o a.oo || { echo "#co -p -ko failed"; exit 1; }
|
220cp a.kv a.o || exit 2 221rcs -o2.1 $q a.c &&
| 222cp a.kv a.o && cp a.o a.b || exit 2 223rcs -oOz $q a.c &&
|
222rcs -l $q a.c && 223ci -k -u $q a.c && 224$diff a.kv a.c || { echo "#ci -k failed"; exit 1; }
| 224rcs -l $q a.c && 225ci -k -u $q a.c && 226$diff a.kv a.c || { echo "#ci -k failed"; exit 1; }
|
225sed '/^[^$]/d' a.kv >a.i &&
| 227sed -n 's/^[^$]*\$/$/p' a.kv >a.i &&
|
226ident a.c >a.i1 && 227sed -e 1d -e 's/^[ ]*//' a.i1 >a.i2 && 228$diff a.i a.i2 || { echo "#ident failed"; exit 1; } 229 230rcs -i $q a.c 2>/dev/null && { echo "#rcs -i permitted existing file"; exit 1; } 231
| 228ident a.c >a.i1 && 229sed -e 1d -e 's/^[ ]*//' a.i1 >a.i2 && 230$diff a.i a.i2 || { echo "#ident failed"; exit 1; } 231 232rcs -i $q a.c 2>/dev/null && { echo "#rcs -i permitted existing file"; exit 1; } 233
|
| 234rm -f a.c &&
|
232co -l $q a.c && 233echo 2.2 >a.c && 234ci -mm $q a.c && 235echo 1.1.1.2 >a.c && 236rcs -l1.1.1 $q a.c && 237ci -r1.1.1.2 -mm $q a.c && 238rcs -b1.1.1 $q a.c && 239test " `co -p $q a.c`" = ' 1.1.1.2' || { echo "#rcs -b1.1.1 failed"; exit 1; } 240rcs -b $q a.c && 241test " `co -p $q a.c`" = ' 2.2' || { echo "#rcs -b failed"; exit 1; } 242 243echo 2.3 >a.c || exit 2 244rcs -U $q a.c || { echo "#rcs -U failed"; exit 1; } 245ci -mm $q a.c || { echo "#rcs -U didn't unset strict locking"; exit 1; } 246rcs -L $q a.c || { echo "#rcs -L failed"; exit 1; } 247echo error >a.c || exit 2 248ci -mm $q a.c 2>/dev/null && { echo "#ci retest failed"; exit 1; } 249 250rm -f a.c && 251log0=`rlog -h a.c` && 252co -l $q a.c && 253ci -mm $q a.c && 254log1=`rlog -h a.c` && 255test " $log0" = " $log1" || { echo "#unchanged ci didn't revert"; exit 1; } 256 257rm -f a.c && 258rcs -nN:1.1 $q a.c && 259co -rN $q a.c && 260$diff a.11 a.c || { echo "#rcs -n failed"; exit 1; } 261
| 235co -l $q a.c && 236echo 2.2 >a.c && 237ci -mm $q a.c && 238echo 1.1.1.2 >a.c && 239rcs -l1.1.1 $q a.c && 240ci -r1.1.1.2 -mm $q a.c && 241rcs -b1.1.1 $q a.c && 242test " `co -p $q a.c`" = ' 1.1.1.2' || { echo "#rcs -b1.1.1 failed"; exit 1; } 243rcs -b $q a.c && 244test " `co -p $q a.c`" = ' 2.2' || { echo "#rcs -b failed"; exit 1; } 245 246echo 2.3 >a.c || exit 2 247rcs -U $q a.c || { echo "#rcs -U failed"; exit 1; } 248ci -mm $q a.c || { echo "#rcs -U didn't unset strict locking"; exit 1; } 249rcs -L $q a.c || { echo "#rcs -L failed"; exit 1; } 250echo error >a.c || exit 2 251ci -mm $q a.c 2>/dev/null && { echo "#ci retest failed"; exit 1; } 252 253rm -f a.c && 254log0=`rlog -h a.c` && 255co -l $q a.c && 256ci -mm $q a.c && 257log1=`rlog -h a.c` && 258test " $log0" = " $log1" || { echo "#unchanged ci didn't revert"; exit 1; } 259 260rm -f a.c && 261rcs -nN:1.1 $q a.c && 262co -rN $q a.c && 263$diff a.11 a.c || { echo "#rcs -n failed"; exit 1; } 264
|
| 265rm -f a.c &&
|
262rcs -NN:2.1 $q a.c && 263co -rN $q a.c &&
| 266rcs -NN:2.1 $q a.c && 267co -rN $q a.c &&
|
264$diff a.kv a.c || { echo "#rcs -N failed"; exit 1; }
| 268$diff a.N a.c || { echo "#rcs -N failed"; exit 1; }
|
265
| 269
|
| 270rm -f a.c &&
|
266co -l $q a.c &&
| 271co -l $q a.c &&
|
267rcs -c':::' $q a.c && 268echo '$''Log$' >a.c &&
| 272echo ':::$''Log$' >a.c &&
|
269ci -u -mm $q a.c &&
| 273ci -u -mm $q a.c &&
|
270test " `sed '$!d' a.c`" = ' :::' || { echo "#rcs -c failed"; exit 1; }
| 274test " `sed '$!d' a.c`" = ' :::' || { echo "#comment leader failed"; exit 1; }
|
271
| 275
|
| 276rm -f a.c &&
|
272rcs -o2.2: $q a.c && 273co $q a.c &&
| 277rcs -o2.2: $q a.c && 278co $q a.c &&
|
274$diff a.kv a.c || { echo "#rcs -o failed"; exit 1; }
| 279$diff a.e a.c || { echo "#rcs -o failed"; exit 1; }
|
275
| 280
|
276rcsdiff -r1.1 -r2.1 $q a.c >a.0
| 281rcsdiff -r1.1 -rOz $q a.c >a.0
|
277case $? in 2781) ;; 279*) echo "#rcsdiff bad status"; exit 1 280esac
| 282case $? in 2831) ;; 284*) echo "#rcsdiff bad status"; exit 1 285esac
|
281diff a.11 a.kv >a.1
| 286$DIFF a.11 a.kv >a.1
|
282$diff a.0 a.1 || { echo "#rcsdiff failed"; exit 1; } 283 284rcs -l2.1 $q a.c || { echo "#rcs -l2.1 failed"; exit 1; }
| 287$diff a.0 a.1 || { echo "#rcsdiff failed"; exit 1; } 288 289rcs -l2.1 $q a.c || { echo "#rcs -l2.1 failed"; exit 1; }
|
285for i in k kv kvl o v
| 290for i in b k kv kvl o v
|
286do 287 rm -f a.c && 288 cp a.$i a.c &&
| 291do 292 rm -f a.c && 293 cp a.$i a.c &&
|
289 rcsdiff -k$i $q a.c || { echo "#rcsdiff -k$i failed"; exit 1; }
| 294 rcsdiff -k$i -rOz $q a.c || { echo "#rcsdiff -k$i failed"; exit 1; }
|
290done 291co -p1.1 -ko $q a.c >a.t && 292$diff a.11 a.t || { echo "#co -p1.1 -ko failed"; exit 1; } 293rcs -u2.1 $q a.c || { echo "#rcs -u2.1 failed"; exit 1; } 294 295rm -f a.c &&
| 295done 296co -p1.1 -ko $q a.c >a.t && 297$diff a.11 a.t || { echo "#co -p1.1 -ko failed"; exit 1; } 298rcs -u2.1 $q a.c || { echo "#rcs -u2.1 failed"; exit 1; } 299 300rm -f a.c &&
|
| 301rcsclean $q a.c && 302rcsclean -u $q a.c || { echo "#rcsclean botched a nonexistent file"; exit 1; } 303 304rm -f a.c && 305co $q a.c && 306rcsclean -n $q a.c && 307rcsclean -n -u $q a.c && 308test -f a.c || { echo "#rcsclean -n removed a file"; exit 1; } 309 310rm -f a.c && 311co $q a.c && 312rcsclean $q a.c && 313test ! -f a.c || { echo "#rcsclean missed an unlocked file"; exit 1; } 314 315rm -f a.c &&
|
296co -l $q a.c &&
| 316co -l $q a.c &&
|
| 317rcsclean $q a.c && 318test -f a.c || { echo "#rcsclean removed a locked file"; exit 1; } 319rcsclean -u $q a.c && 320test ! -f a.c || { 321 echo "#rcsclean -u missed an unchanged locked file"; exit 1; 322} 323 324rm -f a.c && 325co -l $q a.c && 326echo change >>a.c && 327rcsclean $q a.c && 328rcsclean $q -u a.c && 329test -f a.c || { echo "#rcsclean removed a changed file"; exit 1; } 330 331rm -f a.c && 332co -l $q a.c &&
|
297cat >a.c <<'EOF' 2982.2 299a 300b 301c 302d 303EOF 304test $? = 0 && 305ci -l -mm $q a.c && 306co -p2.2 $q a.c | sed -e s/2.2/2.3/ -e s/b/b1/ >a.c && 307ci -l -mm $q a.c && 308co -p2.2 $q a.c | sed -e s/2.2/new/ -e s/d/d1/ >a.c || exit 2 309cat >a.0 <<'EOF' 3102.3 311a 312b1 313c 314d1 315EOF 316cat >a.1 <<'EOF' 317<<<<<<< a.c 318new 319======= 3202.3 321>>>>>>> 2.3 322a 323b1 324c 325d1 326EOF
| 333cat >a.c <<'EOF' 3342.2 335a 336b 337c 338d 339EOF 340test $? = 0 && 341ci -l -mm $q a.c && 342co -p2.2 $q a.c | sed -e s/2.2/2.3/ -e s/b/b1/ >a.c && 343ci -l -mm $q a.c && 344co -p2.2 $q a.c | sed -e s/2.2/new/ -e s/d/d1/ >a.c || exit 2 345cat >a.0 <<'EOF' 3462.3 347a 348b1 349c 350d1 351EOF 352cat >a.1 <<'EOF' 353<<<<<<< a.c 354new 355======= 3562.3 357>>>>>>> 2.3 358a 359b1 360c 361d1 362EOF
|
327rcsmerge -r2.2 -r2.3 $q a.c
| 363rcsmerge -E -r2.2 -r2.3 $q a.c
|
328case $? in 3290) 330 if $diff a.0 a.c >/dev/null 331 then echo "#warning: diff3 -E does not work, " \ 332 "so merge and rcsmerge ignore overlaps and suppress overlap lines." 333 else 334 $diff a.1 a.c || { echo "#rcsmerge failed (status 0)"; exit 1; } 335 echo "#warning: The diff3 lib program exit status ignores overlaps," \ 336 "so rcsmerge does not warn about overlap lines that it generates." 337 fi 338 ;; 3391) 340 $diff a.1 a.c || { echo "#rcsmerge failed (status 1)"; exit 1; } 341 ;; 342*) 343 echo "#rcsmerge bad status"; exit 1 344esac 345
| 364case $? in 3650) 366 if $diff a.0 a.c >/dev/null 367 then echo "#warning: diff3 -E does not work, " \ 368 "so merge and rcsmerge ignore overlaps and suppress overlap lines." 369 else 370 $diff a.1 a.c || { echo "#rcsmerge failed (status 0)"; exit 1; } 371 echo "#warning: The diff3 lib program exit status ignores overlaps," \ 372 "so rcsmerge does not warn about overlap lines that it generates." 373 fi 374 ;; 3751) 376 $diff a.1 a.c || { echo "#rcsmerge failed (status 1)"; exit 1; } 377 ;; 378*) 379 echo "#rcsmerge bad status"; exit 1 380esac 381
|
346nl=' 347'
| 382# Avoid `tr' if possible; it's not portable, and it can't handle null bytes. 383# Our substitute exclusive-ORs with '\n'; 384# this ensures null bytes on output, which is even better than `tr', 385# since some diffs think a file is binary only if it contains null bytes. 386cat >a.c <<'EOF' 387#include <stdio.h> 388int main() { 389 int c; 390 while ((c=getchar()) != EOF) 391 putchar(c ^ '\n'); 392 return 0; 393} 394EOF 395tr=tr 396if (rm -f a.exe a.out && $CL a.c $L >&2) >/dev/null 2>&1 397then 398 if test -s a.out 399 then tr=./a.out 400 elif test -s a.exe 401 then tr=./a.exe 402 fi 403fi
|
348{
| 404{
|
349 co -p $q a.c | tr "$nl" '\200' >a.24 &&
| 405 co -p $q a.c | $tr '\012' '\200' >a.24 &&
|
350 cp a.24 a.c && 351 ciOut=`(ci -l -mm $q a.c 2>&1)` && 352 case $ciOut in 353 ?*) echo >&2 "$ciOut" 354 esac &&
| 406 cp a.24 a.c && 407 ciOut=`(ci -l -mm $q a.c 2>&1)` && 408 case $ciOut in 409 ?*) echo >&2 "$ciOut" 410 esac &&
|
355 co -p $q a.c | tr '\200' "$nl" >a.c &&
| 411 co -p $q a.c | $tr '\200' '\012' >a.c &&
|
356 rcsdiff -r2.3 $q a.c >/dev/null && 357 358 echo 2.5 >a.c && 359 ci -l -mm $q a.c && 360 cp a.24 a.c && 361 rcsdiff -r2.4 $q a.c >/dev/null 362} || echo "#warning: Traditional diff is used, so RCS is limited to text files." 363 364rcs -u -o2.4: $q a.c || { echo "#rcs -u -o failed"; exit 1; } 365 366rcs -i -Aa.c -t- $q a.d || { echo "#rcs -i -A failed"; exit 1; } 367 368rlog -r2.1 a.c >a.t && 369grep '^checked in with -k' a.t >/dev/null && 370sed '/^checked in with -k/d' a.t >a.u && 371$diff - a.u <<EOF 372 373RCS file: $RCSfile 374Working file: a.c 375head: 2.3 376branch: 377locks: strict 378access list: 379symbolic names: 380 N: 2.1
| 412 rcsdiff -r2.3 $q a.c >/dev/null && 413 414 echo 2.5 >a.c && 415 ci -l -mm $q a.c && 416 cp a.24 a.c && 417 rcsdiff -r2.4 $q a.c >/dev/null 418} || echo "#warning: Traditional diff is used, so RCS is limited to text files." 419 420rcs -u -o2.4: $q a.c || { echo "#rcs -u -o failed"; exit 1; } 421 422rcs -i -Aa.c -t- $q a.d || { echo "#rcs -i -A failed"; exit 1; } 423 424rlog -r2.1 a.c >a.t && 425grep '^checked in with -k' a.t >/dev/null && 426sed '/^checked in with -k/d' a.t >a.u && 427$diff - a.u <<EOF 428 429RCS file: $RCSfile 430Working file: a.c 431head: 2.3 432branch: 433locks: strict 434access list: 435symbolic names: 436 N: 2.1
|
| 437 Oz: 2.1
|
381 n: 1.8
| 438 n: 1.8
|
382comment leader: ":::"
| |
383keyword substitution: kv 384total revisions: 13; selected revisions: 1 385description: 3861.1 387---------------------------- 388revision 2.1
| 439keyword substitution: kv 440total revisions: 13; selected revisions: 1 441description: 4421.1 443---------------------------- 444revision 2.1
|
389date: $D $T; author: w; state: s; lines: +13 -1
| 445date: $date; author: w; state: s; lines: +14 -1
|
390============================================================================= 391EOF 392test $? = 0 || { echo "#rlog failed"; exit 1; } 393 394 395test ! -f $lockfile || { echo "#lock file not removed"; exit 1; } 396
| 446============================================================================= 447EOF 448test $? = 0 || { echo "#rlog failed"; exit 1; } 449 450 451test ! -f $lockfile || { echo "#lock file not removed"; exit 1; } 452
|
397exec rm -f a.* $RCSfile $RCS_alt
| 453rm -f a.* $RCSfile $RCS_alt 454$rmdir RCS
|
| |