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
|
#!/bin/sh
##
#
# (C) Roger Gammans 2001 (rgammans@computer-surgery.co.uk).
#
# Please distribute under the GPL.
#
# It's probably better to rely on the $PATH
# to find the various external bits as they more likey
# to be in it somewhere than one particluar location
# over many unices.
#
FNAME=`tempfile` || { echo "$0: Cannot create temporary file" >&2; exit 1; }
trap " [ -f \"$FNAME\" ] && /bin/rm -f -- \"$FNAME\"" 0 1 2 3 13 15
ORIG=$1
PATCH=$2
shift 2
if [ -z "$ORIG" ] || [ ! -e "$ORIG" ] ; then
echo "$0: original file '$ORIG' does not exist"
fi
if [ -z "$PATCH" ] || [ ! -e "$PATCH" ] ; then
echo "$0: original file '$ORIG' does not exist"
fi
cp $ORIG $FNAME;
if patch $* $FNAME < $PATCH; then mgdiff $ORIG $FNAME; fi
exit 0
|