1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
# common variables / subroutines / load-time actions
# Copyright (C) 2010-2022 Thien-Thi Nguyen
#
# This file is part of GNU RCS.
#
# GNU RCS is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GNU RCS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# (shell-script-mode)
# variables
PATH="${PATHPREFIX}:$PATH"
RCSINIT=
stem=`basename $0`
wd=${stem}.d
w=$wd/x
v=$wd/x,v
TMPDIR=$wd ; export TMPDIR
result=
if [ x"$VERBOSE" = x1 ]
then hey= ; shh=':' ; KEEPD=1
else shh= ; hey=':'
fi
# subroutines
split_std_out_err ()
{
exec 1>${wd}/out
if [ "x$1" = xno ]
then exec 2>&1
else exec 2>${wd}/err
fi
}
bundled_commav ()
{
echo $srcdir/fake/$1
}
problem ()
{
echo >&2 PROBLEM: "$@"
exit 1
}
must ()
{
eval "$@" || problem command failed: "$@"
}
say_what ()
{
problem unexpected output for: "$@"
}
noiselessness_rules ()
{
# $1 -- filename
# $2 -- shell command
test -s $1 && say_what "$2"
}
silence_means_death ()
{
# $1 -- filename
# $2 -- shell command
test -s $1 || problem "no output for: $2"
}
bad_RCSfile ()
{
# $1 -- description in the form of ADJECTIVE-PHRASE
problem "$v $1"
}
# load-time actions
rm -rf $wd && mkdir $wd || exit 1
test x"$KEEPD" = x1 \
|| trap 'result=$? ; test 0 = $result && rm -rf $wd' 0
# common ends here
|