failat 21
echo "*E[1mDoPatch 1.1"
echo "The KingFisher Release 2 Patch Kit"
echo "Copyright © 1994 Udo Schuermann"
echo "All rights reserved*E[22m"
;$VER: DoPatch 1.1 (10.08.94)
unset err
if not exists /KingFisher
   set err=1
endif
if not exists /KFServer
   set err=1
endif
if $err eq 1
   echo "*NPlease execute this script again while your current directory is"
   echo "the patch subdirectory where KingFisher Release 2 is installed."
   echo "Example:  SYS:KingFisher2/  is where KingFisher was installed,"
   echo "          then make sure the directory with the patches is named"
   echo "          SYS:KingFisher2/patch/  and this is also your default"
   echo "          directory."
   unset err
   quit
endif
if not exists spatch
   echo "*NIt seems the spatch command has not been extracted; at least it"
   echo "seems not to exist in the current directory where it is needed."
   echo "Please make sure you extract all files from the patch archive,"
   echo "and restart the command."
   quit
endif

echo "*NYour current KingFisher installation is:*E[1m"
version /KingFisher full
version /KFServer full
echo noline "*E[22m"

echo "*NThe programs listed above will be backed up to the current directory"
echo "as backup copies and given a .old extension.  The appropriate patch"
ask "will then be applied.  Are you ready to continue? (y/n)"

if WARN
else
   echo "*NThe patch operation has been terminated.  No changes performed.*N"
   quit
endif

copy /KingFisher KingFisher.old
copy /KFServer KFServer.old
if exists KingFisher
   delete KingFisher quiet
endif
if exists KFServer
   delete KFServer quiet
endif

version >t:kf-patch.tmp KingFisher.old
search t:kf-patch.tmp "REGISTERED" quiet
if WARN
   if exists E_KingFisher-21-22.pch
      echo "*N*E[1;32mHave you thought about registering your copy of KingFisher?*E[22;31m"
      echo noline "Patching EVALUATION KingFisher..."
      spatch -oKingFisher -pE_KingFisher-21-22.pch KingFisher.old
   else
      echo "*N*E[1mNo patch for KingFisher*E[22m"
   endif
else
   if exists R_KingFisher-21-22.pch
      echo noline "*NPatching REGISTERED KingFisher..."
      spatch -oKingFisher -pR_KingFisher-21-22.pch KingFisher.old
   else
      echo "*N*E[1mNo patch for KingFisher*E[22m"
   endif
endif

version >t:kf-patch.tmp KFServer.old
search t:kf-patch.tmp "REGISTERED" quiet
if WARN
   if exists E_KFServer-21-22.pch
      echo "*N*E[1;32mSupporting your software authors is an investment in your Amiga!*E[22;31m"
      echo noline "Patching EVALUATION KFServer..."
      spatch -oKFServer   -pE_KFServer-21-22.pch   KFServer.old
   else
      echo "*E[1mNo patch for KFServer*E[22m"
   endif
else
   if exists R_KFServer-21-22.pch
      echo noline "*NPatching REGISTERED KFServer..."
      spatch -oKFServer   -pR_KFServer-21-22.pch   KFServer.old
   else
      echo "*N*E[1mNo patch for KFServer*E[22m"
   endif
endif

delete t:kf-patch.tmp quiet

if exists KingFisher
   version KingFisher 2 2
   if WARN
      echo "*NIt seems the patch on KingFisher was unsuccessful?"
   else
      copy KingFisher / quiet
      echo "KingFisher updated"
   endif
endif
if exists KFServer
   version KFServer 2 2
   if WARN
      echo "*NIt seems the patch on KFServer was unsuccessful?"
   else
      copy KFServer / quiet
      echo "KFServer updated"
   endif
endif

echo "*NPatch operation completed!"
echo "*NYou may wish to cleanup the following files to save diskspace;"
echo "The cleanup operation is not being performed automatically so"
echo "as to reduce the chance of annoying accidents.  The files are"
echo "copies of your old, and duplicates of the new versions of the"
echo "KingFisher/KFServer software:"
echo "*N   *E[3mKFServer *E[23mand *E[3mKFServer.old*E[23m"
echo "   *E[3mKingFisher *E[23mand *E[3mKingFisher.old*E[23m"
echo "*NHave an excellent day and enjoy KingFisher 2.2!"
echo "*N ._.  Udo Schuermann"
echo " ( )  walrus@wam.umd.edu*N"
