(complete 0)
(set @default-dest "SC:")


(if (= (getassign "t") "")
  (makeassign "t" "ram:")
)

(set answer1
        (askchoice
                (prompt "Choose where the 6.51 patch should be applied.")
                (choices "Hard Disk" "Floppy Disk")
                (help "Selecting Hard Disk will patch the files in SC: by reading "
                      "the original files from the master floppies, and writing "
                      "the new versions to their proper place in the SC: directory. "
                      "Selecting Floppy Disk will patch the set of 3 disks "
                      "created by the Floppy install.\n\n"
                      "Neither of these choices will modify any files on the original "
                      "disks."
                )
         (default 0)
        )
)


(makedir "t:6.51_c")
(copyfiles (source "spatch") (dest "t:6.51_c"))
(copyfiles (source "flush") (dest "t:6.51_c"))
(copyfiles (source "decompress") (dest "t:6.51_c"))
(copyfiles (source "concat") (dest "t:6.51_c"))

(if (= answer1 0)
  (

   (makedir "t:patches")
   (copyfiles (source "1") (dest "t:patches") (all))
   (copyfiles (source "Read.Me") (dest "sc:") (newname "Read.Me.6.51"))
   (copyfiles (source "Read.Me") (dest "sc:") (newname "Read.Me.6.51.info"))
   
   (askdisk (assigns) (dest "SASC_6.50_Disk_1")
            (prompt "Please Insert Disk 1 of the SAS/C Development System")
            (help "Insert Disk 1 in any drive. The files will be read from "
                  "Disk 1, and placed in SC:. Nothing on Disk 1 will be "
                  "modified." 
            )
   ) 

   (copyfiles (source "SASC_6.50_Disk_1:more") (dest "t:6.51_c"))
   
   (if (exists "sc:c/sc")
      (
         (working "Patching sc")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_1:Compiler/c_files t: sc"))
         (run ("t:6.51_c/spatch -osc:c/sc -pt:patches/sc.pch t:sc"))
         (delete "t:sc")
      )
   )
   (complete 2)
   
   (if (exists "sc:c/scsetup")
      (
         (working "Patching scsetup")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_1:Compiler/c_files t: scsetup"))
         (run ("t:6.51_c/spatch -osc:c/scsetup -pt:patches/scsetup.pch t:scsetup"))
         (delete "t:scsetup")
      )
   )
   (complete 4)

   (if (exists "sc:c/se")
      (
         (working "Patching se")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_1:Compiler/c_files t: se"))
         (run ("t:6.51_c/spatch -osc:c/se -pt:patches/se.pch t:se"))
         (delete "t:se")
      )
   )
   (complete 6)

   (if (exists "sc:c/smake")
      (
         (working "Patching smake")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_1:Compiler/c_files t: smake"))
         (run ("t:6.51_c/spatch -osc:c/smake -pt:patches/smake.pch t:smake"))
         (delete "t:smake")
      )
   )
   (if (exists "sc:c/scopts")
      (
         (working "Patching scopts")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_1:Compiler/c_files t: scopts"))
         (run ("t:6.51_c/spatch -osc:c/scopts -pt:patches/scopts.pch t:scopts"))
         (delete "t:scopts")
      )
   )
   (if (exists "sc:c/slink")
      (
         (working "Patching slink")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_1:Compiler/c_files t: slink"))
         (run ("t:6.51_c/spatch -osc:c/slink -pt:patches/slink.pch t:slink"))
         (delete "t:slink")
      )
   )
   (complete 8)

   (if (exists "sc:libs/sc1.library")
      (
         (working "Patching sc1.library")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_1:Compiler/libs_files t: sc1.library"))
         (run ("t:6.51_c/spatch -osc:libs/sc1.library -pt:patches/sc1.pch t:sc1.library"))
         (delete "t:sc1.library")
      )
   )
   (complete 10)

   (if (exists "sc:libs/sc2.library")
      (
         (working "Patching sc2.library")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_1:Compiler/libs_files t: sc2.library"))
         (run ("t:6.51_c/spatch -osc:libs/sc2.library -pt:patches/sc2.pch t:sc2.library"))
         (delete "t:sc2.library")
      )
   )
   (complete 12)

   (run "delete t:patches/#?")

; Disk 2

   (copyfiles (source "2") (dest "t:patches") (all))

   (askdisk (assigns) (dest "SASC_6.50_Disk_2")
            (prompt "Please Insert Disk 2 of the SAS/C Development System")
            (help "Insert Disk 2 in any drive. The files will be read from "
                  "Disk 2, and placed in SC:. Nothing on Disk 2 will be "
                  "modified." 
            )
   ) 
   (if (exists "sc:include/assert.h")
      (
         (working "Patching assert.h")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/include_files t: assert.h"))
         (run ("t:6.51_c/spatch -osc:include/assert.h -pt:patches/assert.pch t:assert.h"))
         (delete "t:assert.h")
      )
   )
   (if (exists "sc:include/functions.h")
      (
         (working "Patching functions.h")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/include_files t: functions.h"))
         (run ("t:6.51_c/spatch -osc:include/functions.h -pt:patches/functions.pch t:functions.h"))
         (delete "t:functions.h")
      )
   )
   (if (exists "sc:include/unistd.h")
      (
         (working "Patching unistd.h")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/include_files t: unistd.h"))
         (run ("t:6.51_c/spatch -osc:include/unistd.h -pt:patches/unistd.pch t:unistd.h"))
         (delete "t:unistd.h")
      )
   )
   (if (exists "sc:include/fcntl.h")
      (
         (working "Patching fcntl.h")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/include_files t: fcntl.h"))
         (run ("t:6.51_c/spatch -osc:include/fcntl.h -pt:patches/fcntl.pch t:fcntl.h"))
         (delete "t:fcntl.h")
      )
   )
   (if (exists "sc:include/string.h")
      (
         (working "Patching string.h")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/include_files t: string.h"))
         (run ("t:6.51_c/spatch -osc:include/string.h -pt:patches/string.pch t:string.h"))
         (delete "t:string.h")
      )
   )
   (if (exists "sc:include/math.h")
      (
         (working "Patching math.h")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/include_files t: math.h"))
         (run ("t:6.51_c/spatch -osc:include/math.h -pt:patches/math.pch t:math.h"))
         (delete "t:math.h")
      )
   )
   (complete 14)

   (if (exists "sc:include/cback.o")
      (
         (working "Patching cback.o")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/lib_files t: cback.o"))
         (run ("t:6.51_c/spatch -osc:include/cback.o -pt:patches/cback.pch t:cback.o"))
         (delete "t:cback.o")
      )
   )
   (complete 16)

   (if (exists "sc:include/sys/commwben.h")
      (
         (working "Patching sys/commwben.h")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/include/sys_files t: commwben.h"))
         (run ("t:6.51_c/spatch -osc:include/sys/commwben.h -pt:patches/commwben.pch t:commwben.h"))
         (delete "t:commwben.h")
      )
   )
   (complete 18)

   (if (exists "sc:lib/sc.lib")
      (
         (working "Patching sc.lib")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/lib/sc.lib_files t: sc.lib"))
         (run ("t:6.51_c/spatch -osc:lib/sc.lib -pt:patches/sclib.pch t:sc.lib"))
         (delete "t:sc.lib")
      )
   )
   (complete 20)

   (if (exists "sc:lib/scm.lib")
      (
         (working "Patching scm.lib")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/lib/scm.lib_files t: scm.lib"))
         (run ("t:6.51_c/spatch -osc:lib/scm.lib -pt:patches/scmlib.pch t:scm.lib"))
         (delete "t:scm.lib")
      )
   )
   (complete 22)

   (if (exists "sc:lib/scs.lib")
      (
         (working "Patching scs.lib")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/lib/scs.lib_files t: scs.lib"))
         (run ("t:6.51_c/spatch -osc:lib/scs.lib -pt:patches/scslib.pch t:scs.lib"))
         (delete "t:scs.lib")
      )
   )
   (complete 24)

   (if (exists "sc:lib/scm881.lib")
      (
         (working "Patching scm881.lib")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/lib/scm881.lib_files t: scm881.lib"))
         (run ("t:6.51_c/spatch -osc:lib/scm881.lib -pt:patches/scm881lib.pch t:scm881.lib"))
         (delete "t:scm881.lib")
      )
   )
   (complete 26)


   (if (exists "sc:lib/scmffp.lib")
      (
         (working "Patching scmffp.lib")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/lib/scmffp.lib_files t: scmffp.lib"))
         (run ("t:6.51_c/spatch -osc:lib/scmffp.lib -pt:patches/scmffplib.pch t:scmffp.lib"))
         (delete "t:scmffp.lib")
      )
   )
   (complete 28)

   (if (exists "sc:lib/scmieee.lib")
      (
         (working "Patching scmieee.lib")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/lib/scmieee.lib_files t: scmieee.lib"))
         (run ("t:6.51_c/spatch -osc:lib/scmieee.lib -pt:patches/scmieeelib.pch t:scmieee.lib"))
         (delete "t:scmieee.lib")
      )
   )
   (complete 30)

   (if (exists "sc:lib/scmnb.lib")
      (
         (working "Patching scmnb.lib")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/lib/scmnb.lib_files t: scmnb.lib"))
         (run ("t:6.51_c/spatch -osc:lib/scmnb.lib -pt:patches/scmnblib.pch t:scmnb.lib"))
         (delete "t:scmnb.lib")
      )
   )
   (complete 32)

   (if (exists "sc:lib/scmsnb.lib")
      (
         (working "Patching scmsnb.lib")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/lib/scmsnb.lib_files t: scmsnb.lib"))
         (run ("t:6.51_c/spatch -osc:lib/scmsnb.lib -pt:patches/scmsnblib.pch t:scmsnb.lib"))
         (delete "t:scmsnb.lib")
      )
   )
   (complete 34)

   (if (exists "sc:lib/scsnb.lib")
      (
         (working "Patching scsnb.lib")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/lib/scsnb.lib_files t: scsnb.lib"))
         (run ("t:6.51_c/spatch -osc:lib/scsnb.lib -pt:patches/scsnblib.pch t:scsnb.lib"))
         (delete "t:scsnb.lib")
      )
   )
   (complete 36)

   (if (exists "sc:lib/scnb.lib")
      (
         (working "Patching scnb.lib")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/lib/scnb.lib_files t: scnb.lib"))
         (run ("t:6.51_c/spatch -osc:lib/scnb.lib -pt:patches/scnblib.pch t:scnb.lib"))
         (delete "t:scnb.lib")
      )
   )
   (complete 38)

   (if (exists "sc:lib/scms.lib")
      (
         (working "Patching scms.lib")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/lib/scms.lib_files t: scms.lib"))
         (run ("t:6.51_c/spatch -osc:lib/scms.lib -pt:patches/scmslib.pch t:scms.lib"))
         (delete "t:scms.lib")
      )
   )
   (complete 40)

   (run "delete t:patches/#?")

; Disk 3

   (copyfiles (source "3") (dest "t:patches") (all))

   (askdisk (assigns) (dest "SASC_6.50_Disk_3")
            (prompt "Please Insert Disk 3 of the SAS/C Development System")
            (help "Insert Disk 3 in any drive. The files will be read from "
                  "Disk 3, and placed in SC:. Nothing on Disk 3 will be "
                  "modified." 
            )
   ) 

   (if (exists "sc:libs/scpeep.library")
      (
         (working "Patching scpeep.library")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_3:optimizers/libs_files t: scpeep.library"))
         (run ("t:6.51_c/spatch -osc:libs/scpeep.library -pt:patches/scpeep.pch t:scpeep.library"))
         (delete "t:scpeep.library")
      )
   )
   (complete 42)

   (if (exists "sc:libs/scgo.library")
      (
         (working "Patching scgo.library")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_3:optimizers/libs_files t: scgo.library"))
         (run ("t:6.51_c/spatch -osc:libs/scgo.library -pt:patches/scgo.pch t:scgo.library"))
         (delete "t:scgo.library")
      )
   )
   (complete 44)

   (if (exists "sc:c/asm")
      (
         (working "Patching asm")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_3:Assembler/c_files t: asm"))
         (run ("t:6.51_c/spatch -osc:c/asm -pt:patches/asm.pch t:asm"))
         (delete "t:asm")
      )
   )
   (complete 46)

   (if (exists "sc:libs/sccxx.library")
      (
         (working "Patching sccxx.library")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_3:C_Plus_Plus/libs_files sc:libs sccxx.library"))
         (run ("t:6.51_c/spatch -osc:libs/sccxx.library -tsc:libs/sccxx.library.new -pt:patches/sccxx.pch sc:libs/sccxx.library"))
      )
   )
   (complete 48)

   (if (and (exists "sc:libs/sccxx.library") (exists "sc:cxxinclude/iostream.h")) 
      (
         (working "Patching iostream.h")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_3:C_Plus_Plus/cxxinclude_files t: iostream.h"))
         (run ("t:6.51_c/spatch -ot:iostream.h -pt:patches/iostream.pch t:iostream.h"))
         (delete "t:iostream.h")
      )
   )
   (complete 50)

   (if (and (exists "sc:libs/sccxx.library") (exists "sc:lib/sc.lib")) 
      (
         (working "Patching sccxx.lib")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_3:C_Plus_Plus/lib/sccxx.lib_files t: sccxx.lib"))
         (run ("t:6.51_c/spatch -ot:sccxx.lib.new -pt:patches/sccxxlib.pch t:sccxx.lib"))
         (run ("t:6.51_c/concat sc:lib/sc.lib t:sccxx.lib.new"))
         (delete "t:sccxx.lib")
      )
   )
   (complete 52)

   (if (and (exists "sc:libs/sccxx.library") (exists "sc:lib/scm.lib")) 
      (
         (working "Patching sccxxm.lib")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_3:C_Plus_Plus/lib/sccxxm.lib_files t: sccxxm.lib"))
         (run ("t:6.51_c/spatch -ot:sccxxm.lib.new -pt:patches/sccxxmlib.pch t:sccxxm.lib"))
         (run ("t:6.51_c/concat sc:lib/scm.lib t:sccxxm.lib.new"))
         (delete "t:sccxxm.lib")
      )
   )
   (complete 54)

   (if (and (exists "sc:libs/sccxx.library") (exists "sc:lib/scm881.lib")) 
      (
         (working "Patching sccxxm881.lib")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_3:C_Plus_Plus/lib/sccxxm881.lib_files t: sccxxm881.lib"))
         (run ("t:6.51_c/spatch -ot:sccxxm881.lib.new -pt:patches/sccxxm881lib.pch t:sccxxm881.lib"))
         (run ("t:6.51_c/concat sc:lib/scm881.lib t:sccxxm881.lib.new"))
         (delete "t:sccxxm881.lib")
      )
   )
   (complete 56)

   (if (and (exists "sc:libs/sccxx.library") (exists "sc:lib/scmieee.lib")) 
      (
         (working "Patching sccxxmieee.lib")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_3:C_Plus_Plus/lib/sccxxmieee.lib_files t: sccxxmieee.lib"))
         (run ("t:6.51_c/spatch -ot:sccxxmieee.lib.new -pt:patches/sccxxmieeelib.pch t:sccxxmieee.lib"))
         (run ("t:6.51_c/concat sc:lib/scmieee.lib t:sccxxmieee.lib.new"))
         (delete "t:sccxxmieee.lib")
      )
   )
   (complete 58)

   (if (and (exists "sc:libs/sccxx.library") (exists "sc:lib/scmnb.lib")) 
      (
         (working "Patching sccxxmnb.lib")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_3:C_Plus_Plus/lib/sccxxmnb.lib_files t: sccxxmnb.lib"))
         (run ("t:6.51_c/spatch -ot:sccxxmnb.lib.new -pt:patches/sccxxmnblib.pch t:sccxxmnb.lib"))
         (run ("t:6.51_c/concat sc:lib/scmnb.lib t:sccxxmnb.lib.new"))
         (delete "t:sccxxmnb.lib")
      )
   )
   (complete 60)

   (if (and (exists "sc:libs/sccxx.library") (exists "sc:lib/scnb.lib")) 
      (
         (working "Patching sccxxnb.lib")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_3:C_Plus_Plus/lib/sccxxnb.lib_files t: sccxxnb.lib"))
         (run ("t:6.51_c/spatch -ot:sccxxnb.lib.new -pt:patches/sccxxnblib.pch t:sccxxnb.lib"))
         (run ("t:6.51_c/concat sc:lib/scnb.lib t:sccxxnb.lib.new"))
         (delete "t:sccxxnb.lib")
      )
   )
   (complete 62)

   (run "delete t:patches/#?")

; Disk 4
   (copyfiles (source "4") (dest "t:patches") (all))

   (askdisk (assigns) (dest "SASC_6.50_Disk_4")
            (prompt "Please Insert Disk 4 of the SAS/C Development System")
            (help "Insert Disk 4 in any drive. The files will be read from "
                  "Disk 4, and placed in SC:. Nothing on Disk 4 will be "
                  "modified." 
            )
   ) 

   (if (exists "sc:c/cpr")
      (
         (working "Patching cpr")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_4:Debugger/c_files t: cpr"))
         (run ("t:6.51_c/spatch -osc:c/cpr -pt:patches/cpr.pch t:cpr"))
         (delete "t:cpr")
      )
   )

   (if (exists "sc:libs/schi.library")
      (
         (working "Patching schi.library")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_4:Debugger/libs_files t: schi.library"))
         (run ("t:6.51_c/spatch -osc:libs/schi.library -pt:patches/schi.pch t:schi.library"))
         (delete "t:schi.library")
      )
   )
   (complete 64)

   (if (exists "sc:c/cprx")
      (
         (working "Patching cprx")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_4:Cross_Debugger/c_files t: cprx"))
         (run ("t:6.51_c/spatch -osc:c/cprx -pt:patches/cprx.pch t:cprx"))
         (delete "t:cprx")
      )
   )
   (complete 66)

   (if (exists "sc:c/cprk")
      (
         (working "Patching cprk")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_4:Cross_Debugger/c_files t: cprk"))
         (run ("t:6.51_c/spatch -osc:c/cprk -pt:patches/cprk.pch t:cprk"))
         (delete "t:cprk")
      )
   )
   (complete 68)

   (if (exists "sc:source/_main.c")
      (
         (working "Patching _main.c")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_4:Source_and_Examples/source_files t: _main.c"))
         (run ("t:6.51_c/spatch -osc:source/_main.c -pt:patches/_main.pch t:_main.c"))
         (delete "t:_main.c")
      )
   )
   (complete 70)

   (if (exists "sc:source/_main.c")
      (
         (working "Adding _iob.c")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_4:Source_and_Examples/source_files t: _main.c"))
         (run ("t:6.51_c/spatch -osc:source/_iob.c -pt:patches/_iob.pch t:_main.c"))
         (delete "t:_main.c")
      )
   )
   (complete 72)

   (if (exists "sc:source/cback.a")
      (
         (working "Patching cback.a")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_4:Source_and_Examples/source_files t: cback.a"))
         (run ("t:6.51_c/spatch -osc:source/cback.a -pt:patches/cback.pch t:cback.a"))
         (delete "t:cback.a")
      )
   )
   (complete 74)

   (if (exists "sc:source/_fpinit.c")
      (
         (working "Patching _fpinit.c")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_4:Source_and_Examples/source_files t: _fpinit.c"))
         (run ("t:6.51_c/spatch -osc:source/_fpinit.c -pt:patches/_fpinit.pch t:_fpinit.c"))
         (delete "t:_fpinit.c")
      )
   )
   (complete 76)

   (if (exists "sc:source/autoopenfail.c")
      (
         (working "Patching autoopenfail.c")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_4:Source_and_Examples/source_files t: autoopenfail.c"))
         (run ("t:6.51_c/spatch -osc:source/autoopenfail.c -pt:patches/autoopenfail.pch t:autoopenfail.c"))
         (delete "t:autoopenfail.c")
      )
   )
   (complete 78)

   (if (exists "sc:extras/mkmk/gensmake.c")
      (
         (working "Patching gensmake.c")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_4:Extras/extras/MKMK_files t: gensmake.c"))
         (run ("t:6.51_c/spatch -osc:extras/mkmk/gensmake.c -pt:patches/gensmake.pch t:gensmake.c"))
         (delete "t:gensmake.c")
      )
   )
   (complete 80)

   (if (exists "sc:extras/memlib/mwcontrol.c")
      (
         (working "Patching mwcontrol.c")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_4:Extras/extras/Memlib_files t: mwcontrol.c"))
         (run ("t:6.51_c/spatch -osc:extras/memlib/mwcontrol.c -pt:patches/mwcontrol.pch t:mwcontrol.c"))
         (delete "t:mwcontrol.c")
      )
   )

   (if (exists "sc:extras/CED/env")
      (
         (working "Installing CED version of scmsg")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_4:Extras/extras/CED/env/sc_files sc:extras/CED/env/sc"))
      )
   )

   (complete 82)

   (run "delete t:patches/#?")

; Disk 5
   (copyfiles (source "5") (dest "t:patches") (all))

   (askdisk (assigns) (dest "SASC_6.50_Disk_5")
            (prompt "Please Insert Disk 5 of the SAS/C Development System")
            (help "Insert Disk 5 in any drive. The files will be read from "
                  "Disk 5, and placed in SC:. Nothing on Disk 5 will be "
                  "modified." 
            )
   ) 

   (if (exists "sc:c/omd")
      (
         (working "Patching omd")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Extra_Utilities/c_files t: omd"))
         (run ("t:6.51_c/spatch -osc:c/omd -pt:patches/omd.pch t:omd"))
         (delete "t:omd")
      )
   )
   (if (exists "sc:c/oml")
      (
         (working "Patching oml")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Extra_Utilities/c_files t: oml"))
         (run ("t:6.51_c/spatch -osc:c/oml -pt:patches/oml.pch t:oml"))
         (delete "t:oml")
      )
   )
   (if (exists "sc:c/splat")
      (
         (working "Patching splat")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Extra_Utilities/c_files t: splat"))
         (run ("t:6.51_c/spatch -osc:c/splat -pt:patches/splat.pch t:splat"))
         (delete "t:splat")
      )
   )
   (if (exists "sc:c/grep")
      (
         (working "Patching grep")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Extra_Utilities/c_files t: grep"))
         (run ("t:6.51_c/spatch -osc:c/grep -pt:patches/grep.pch t:grep"))
         (delete "t:grep")
      )
   )
   (if (exists "sc:c/scompact")
      (
         (working "Patching scompact")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Extra_Utilities/c_files t: scompact"))
         (run ("t:6.51_c/spatch -osc:c/scompact -pt:patches/scompact.pch t:scompact"))
         (delete "t:scompact")
      )
   )
   (complete 84)

   (if (exists "sc:c/mkmk")
      (
         (working "Patching mkmk")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Extra_Utilities/c_files t: mkmk"))
         (run ("t:6.51_c/spatch -osc:c/mkmk -pt:patches/mkmk.pch t:mkmk"))
         (delete "t:mkmk")
      )
   )
   (complete 86)

   (if (exists "sc:c/sc5")
      (
         (working "Patching sc5")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Extra_Utilities/c_files t: sc5"))
         (run ("t:6.51_c/spatch -osc:c/sc5 -pt:patches/sc5.pch t:sc5"))
         (delete "t:sc5")
      )
   )
   (complete 88)

   (if (exists "sc:c/cctosc")
      (
         (working "Patching cctosc")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Extra_Utilities/c_files t: cctosc"))
         (run ("t:6.51_c/spatch -osc:c/cctosc -pt:patches/cctosc.pch t:cctosc"))
         (delete "t:cctosc")
      )
   )
   (complete 90)

   (if (exists "sc:c/lntoslink")
      (
         (working "Patching lntoslink")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Extra_Utilities/c_files t: lntoslink"))
         (run ("t:6.51_c/spatch -osc:c/lntoslink -pt:patches/lntoslink.pch t:lntoslink"))
         (delete "t:lntoslink")
      )
   )
   (complete 92)

   (if (exists "sc:c/mcc")
      (
         (working "Patching mcc")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Extra_Utilities/c_files t: mcc"))
         (run ("t:6.51_c/spatch -osc:c/mcc -pt:patches/mcc.pch t:mcc"))
         (delete "t:mcc")
      )
   )
   (complete 94)

   (if (exists "sc:c/mln")
      (
         (working "Patching mln")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Extra_Utilities/c_files t: mln"))
         (run ("t:6.51_c/spatch -osc:c/mln -pt:patches/mln.pch t:mln"))
         (delete "t:mln")
      )
   )
   (complete 96)

   (if (exists "sc:help/scmsg.guide")
      (
         (working "Patching scmsg.guide")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Online_Help/help_files t: scmsg.guide"))
         (run ("t:6.51_c/spatch -osc:help/scmsg.guide -pt:patches/scmsg.pch t:scmsg.guide"))
         (delete "t:scmsg.guide")
      )
   )
   (if (exists "sc:help/sc.guide")
      (
         (working "Patching sc.guide")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Online_Help/help_files t: sc.guide"))
         (run ("t:6.51_c/spatch -osc:help/sc.guide -pt:patches/sc.pch t:sc.guide"))
         (delete "t:sc.guide")
      )
   )
   (if (exists "sc:help/sc_lib.guide")
      (
         (working "Patching sc_lib.guide")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Online_Help/help_files sc:help sc_lib.guide"))
         (run ("t:6.51_c/spatch -osc:help/sc_lib.guide -tsc:help/sc_lib.guide.new -pt:patches/sc_lib.pch sc:help/sc_lib.guide"))
      )
   )
   (complete 98)

   (run "run t:6.51_c/more sc:Read.Me.6.51")

   (run "delete t:patches/#?")


  )  

; else do floppy install

  (
   (set @default-dest "")
   (makedir "t:patches")
   (copyfiles (source "1") (dest "t:patches") 
              (choices "sc.pch" "scsetup.pch" "se.pch"
                       "smake.pch" "scopts.pch" "slink.pch"
                       "sc1.pch" "sc2.pch" 
              )
   )
   (copyfiles (source "5") (dest "t:patches") 
              (choices "omd.pch" "oml.pch"
              )
   )

   (askdisk (assigns) (dest "SASC_6.50_Disk_5")
            (prompt "Please Insert Disk 5 of the SAS/C Development System")
            (help "Insert Disk 5 in any drive. "
            )
   ) 

   (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Extra_Utilities/c_files t:6.51_c scompact"))

   
   (askdisk (assigns) (dest "SASC_6.50_Disk_1")
            (prompt "Please Insert Disk 1 of the SAS/C Development System")
            (help "Insert Disk 1 in any drive. The files will be read from "
                  "Disk 1, and placed in SC:. Nothing on Disk 1 will be "
                  "modified." 
            )
   ) 

   (if (exists "SAS_1:sc/c/sc")
      (
         (working "Patching sc")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_1:Compiler/c_files t: sc"))
         (run ("t:6.51_c/spatch -oSAS_1:sc/c/sc -pt:patches/sc.pch t:sc"))
         (delete "t:sc")
      )
   )
   (complete 5)

   (if (exists "SAS_1:sc/c/scsetup")
      (
         (working "Patching scsetup")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_1:Compiler/c_files t: scsetup"))
         (run ("t:6.51_c/spatch -oSAS_1:sc/c/scsetup -pt:patches/scsetup.pch t:scsetup"))
         (delete "t:scsetup")
      )
   )
   (complete 10)

   (if (exists "SAS_1:sc/c/se")
      (
         (working "Patching se")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_1:Compiler/c_files t: se"))
         (run ("t:6.51_c/spatch -oSAS_1:sc/c/se -pt:patches/se.pch t:se"))
         (delete "t:se")
      )
   )
   (complete 15)

   (if (exists "SAS_1:sc/c/smake")
      (
         (working "Patching smake")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_1:Compiler/c_files t: smake"))
         (run ("t:6.51_c/spatch -oSAS_1:sc/c/smake -pt:patches/smake.pch t:smake"))
         (delete "t:smake")
      )
   )

   (if (exists "SAS_1:sc/c/scopts")
      (
         (working "Patching scopts")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_1:Compiler/c_files t: scopts"))
         (run ("t:6.51_c/spatch -oSAS_1:sc/c/scopts -pt:patches/scopts.pch t:scopts"))
         (delete "t:scopts")
      )
   )

   (if (exists "SAS_1:sc/c/slink")
      (
         (working "Patching slink")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_1:Compiler/c_files t: slink"))
         (run ("t:6.51_c/spatch -oSAS_1:sc/c/slink -pt:patches/slink.pch t:slink"))
         (delete "t:slink")
      )
   )
   (complete 20)

   (if (exists "SAS_1:sc/libs/sc1.library")
      (
         (working "Patching sc1.library")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_1:Compiler/libs_files t: sc1.library"))
         (run ("t:6.51_c/spatch -oSAS_1:sc/libs/sc1.library -pt:patches/sc1.pch t:sc1.library"))
         (delete "t:sc1.library")
      )
   )
   (complete 25)

   (if (exists "SAS_1:sc/libs/sc2.library")
      (
         (working "Patching sc2.library")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_1:Compiler/libs_files t: sc2.library"))
         (run ("t:6.51_c/spatch -oSAS_1:sc/libs/sc2.library -pt:patches/sc2.pch t:sc2.library"))
         (delete "t:sc2.library")
      )
   )
   (complete 30)

   (if (exists "SAS_1:sc/c/omd")
      (
         (working "Patching omd")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_1:floppy/c_files t: omd"))
         (run ("t:6.51_c/spatch -oSAS_1:sc/c/omd -pt:patches/omd.pch t:omd"))
         (delete "t:omd")
      )
   )

   (if (exists "SAS_1:sc/c/oml")
      (
         (working "Patching oml")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_1:floppy/c_files t: oml"))
         (run ("t:6.51_c/spatch -oSAS_1:sc/c/oml -pt:patches/oml.pch t:oml"))
         (delete "t:oml")
      )
   )


   (run "delete t:patches/#?")

; Disk 2

   (copyfiles (source "2") (dest "t:patches") 
              (choices "assert.pch" "functions.pch" "unistd.pch" "math.pch" 
                       "fcntl.pch" "string.pch" "cback.pch" "commwben.pch" 
                       "sclib.pch" "scmlib.pch"
              )
   )

   (askdisk (assigns) (dest "SASC_6.50_Disk_2")
            (prompt "Please Insert Disk 2 of the SAS/C Development System")
            (help "Insert Disk 2 in any drive. The files will be read from "
                  "Disk 2, and placed in SC:. Nothing on Disk 2 will be "
                  "modified." 
            )
   ) 
   (if (exists "SAS_2:sc/include/assert.h")
      (
         (working "Patching assert.h")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/include_files t: assert.h"))
         (run ("t:6.51_c/spatch -ot:assert.h.new -pt:patches/assert.pch t:assert.h"))
         (run ("t:6.51_c/scompact t:assert.h.new SAS_2:sc/include/assert.h"))
         (delete "t:assert.h")
         (delete "t:assert.h.new")
      )
   )
   (if (exists "SAS_2:sc/include/functions.h")
      (
         (working "Patching functions.h")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/include_files t: functions.h"))
         (run ("t:6.51_c/spatch -ot:functions.h.new -pt:patches/functions.pch t:functions.h"))
         (run ("t:6.51_c/scompact t:functions.h.new SAS_2:sc/include/functions.h"))
         (delete "t:functions.h")
         (delete "t:functions.h.new")
      )
   )
   (if (exists "SAS_2:sc/include/unistd.h")
      (
         (working "Patching unistd.h")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/include_files t: unistd.h"))
         (run ("t:6.51_c/spatch -ot:unistd.h.new -pt:patches/unistd.pch t:unistd.h"))
         (run ("t:6.51_c/scompact t:unistd.h.new SAS_2:sc/include/unistd.h"))
         (delete "t:unistd.h")
         (delete "t:unistd.h.new")
      )
   )
   (if (exists "SAS_2:sc/include/math.h")
      (
         (working "Patching math.h")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/include_files t: math.h"))
         (run ("t:6.51_c/spatch -ot:math.h.new -pt:patches/math.pch t:math.h"))
         (run ("t:6.51_c/scompact t:math.h.new SAS_2:sc/include/math.h"))
         (delete "t:math.h")
         (delete "t:math.h.new")
      )
   )
   (if (exists "SAS_2:sc/include/fcntl.h")
      (
         (working "Patching fcntl.h")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/include_files t: fcntl.h"))
         (run ("t:6.51_c/spatch -ot:fcntl.h.new -pt:patches/fcntl.pch t:fcntl.h"))
         (run ("t:6.51_c/scompact t:fcntl.h.new SAS_2:sc/include/fcntl.h"))
         (delete "t:fcntl.h")
         (delete "t:fcntl.h.new")
      )
   )
   (if (exists "SAS_2:sc/include/string.h")
      (
         (working "Patching string.h")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/include_files t: string.h"))
         (run ("t:6.51_c/spatch -ot:string.h.new -pt:patches/string.pch t:string.h"))
         (run ("t:6.51_c/scompact t:string.h.new SAS_2:sc/include/string.h"))
         (delete "t:string.h")
         (delete "t:string.h.new")
      )
   )
   (complete 35)

   (if (exists "SAS_2:sc/include/cback.o")
      (
         (working "Patching cback.o")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/lib_files t: cback.o"))
         (run ("t:6.51_c/spatch -oSAS_2:sc/include/cback.o -pt:patches/cback.pch t:cback.o"))
         (delete "t:cback.o")
      )
   )
   (complete 40)

   (if (exists "SAS_2:sc/include/sys/commwben.h")
      (
         (working "Patching sys/commwben.h")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/include/sys_files t: commwben.h"))
         (run ("t:6.51_c/spatch -ot:commwben.h.new -pt:patches/commwben.pch t:commwben.h"))
         (run ("t:6.51_c/scompact t:commwben.h.new SAS_2:sc/include/sys/commwben.h"))
         (delete "t:commwben.h")
         (delete "t:commwben.h.new")
      )
   )
   (complete 45)

   (if (exists "SAS_2:sc/lib/sc.lib")
      (
         (working "Patching sc.lib")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/lib/sc.lib_files t: sc.lib"))
         (run ("t:6.51_c/spatch -oSAS_2:sc/lib/sc.lib -pt:patches/sclib.pch t:sc.lib"))
         (delete "t:sc.lib")
      )
   )
   (complete 50)

   (if (exists "SAS_2:sc/lib/scm.lib")
      (
         (working "Patching scm.lib")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_2:compiler/lib/scm.lib_files t: scm.lib"))
         (run ("t:6.51_c/spatch -oSAS_2:sc/lib/scm.lib -pt:patches/scmlib.pch t:scm.lib"))
         (delete "t:scm.lib")
      )
   )
   (complete 55)

   (run "delete t:patches/#?")

; Disk 3

   (copyfiles (source "3") (dest "t:patches") 
              (choices "scpeep.pch" "scgo.pch")
   )

   (askdisk (assigns) (dest "SASC_6.50_Disk_3")
            (prompt "Please Insert Disk 3 of the SAS/C Development System")
            (help "Insert Disk 3 in any drive. The files will be read from "
                  "Disk 3, and placed in SC:. Nothing on Disk 3 will be "
                  "modified." 
            )
   ) 

   (if (exists "SAS_3:sc/libs/scpeep.library")
      (
         (working "Patching scpeep.library")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_3:optimizers/libs_files t: scpeep.library"))
         (run ("t:6.51_c/spatch -oSAS_3:sc/libs/scpeep.library -pt:patches/scpeep.pch t:scpeep.library"))
         (delete "t:scpeep.library")
      )
   )
   (complete 60)

   (if (exists "SAS_3:sc/libs/scgo.library")
      (
         (working "Patching scgo.library")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_3:optimizers/libs_files t: scgo.library"))
         (run ("t:6.51_c/spatch -oSAS_3:sc/libs/scgo.library -pt:patches/scgo.pch t:scgo.library"))
         (delete "t:scgo.library")
      )
   )
   (complete 65)

   (run "delete t:patches/#?")

; Disk 4
   (copyfiles (source "4") (dest "t:patches") 
              (choices "cpr.pch" "schi.pch")
   )

   (askdisk (assigns) (dest "SASC_6.50_Disk_4")
            (prompt "Please Insert Disk 4 of the SAS/C Development System")
            (help "Insert Disk 4 in any drive. The files will be read from "
                  "Disk 4, and placed in SC:. Nothing on Disk 4 will be "
                  "modified." 
            )
   ) 

   (if (exists "SAS_3:sc/c/cpr")
      (
         (working "Patching cpr")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_4:Debugger/c_files t: cpr"))
         (run ("t:6.51_c/spatch -oSAS_3:sc/c/cpr -pt:patches/cpr.pch t:cpr"))
         (delete "t:cpr")
      )
   )
   (complete 70)

   (if (exists "SAS_3:sc/libs/schi.library")
      (
         (working "Patching schi.library")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_4:Debugger/libs_files t: schi.library"))
         (run ("t:6.51_c/spatch -oSAS_3:sc/libs/schi.library -pt:patches/schi.pch t:schi.library"))
         (delete "t:schi.library")
      )
   )
   (complete 75)

   (run "delete t:patches/#?")

; Disk 5
   (copyfiles (source "5") (dest "t:patches") 
              (choices "mkmk.pch" "sc5.pch" "cctosc.pch"
                       "lntoslink.pch" "mcc.pch" "mln.pch"
                       "scompact.pch" "splat.pch"
                       "grep.pch"
                       
              )
   )

   (askdisk (assigns) (dest "SASC_6.50_Disk_5")
            (prompt "Please Insert Disk 5 of the SAS/C Development System")
            (help "Insert Disk 5 in any drive. The files will be read from "
                  "Disk 5, and placed in SC:. Nothing on Disk 5 will be "
                  "modified." 
            )
   ) 

   (if (exists "SAS_3:sc/c/mkmk")
      (
         (working "Patching mkmk")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Extra_Utilities/c_files t: mkmk"))
         (run ("t:6.51_c/spatch -oSAS_3:sc/c/mkmk -pt:patches/mkmk.pch t:mkmk"))
         (delete "t:mkmk")
      )
   )
   (complete 80)

   (if (exists "SAS_3:sc/c/sc5")
      (
         (working "Patching sc5")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Extra_Utilities/c_files t: sc5"))
         (run ("t:6.51_c/spatch -oSAS_3:sc/c/sc5 -pt:patches/sc5.pch t:sc5"))
         (delete "t:sc5")
      )
   )
   (complete 85)

   (if (exists "SAS_3:sc/c/cctosc")
      (
         (working "Patching cctosc")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Extra_Utilities/c_files t: cctosc"))
         (run ("t:6.51_c/spatch -oSAS_3:sc/c/cctosc -pt:patches/cctosc.pch t:cctosc"))
         (delete "t:cctosc")
      )
   )
   (complete 90)

   (if (exists "SAS_3:sc/c/lntoslink")
      (
         (working "Patching lntoslink")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Extra_Utilities/c_files t: lntoslink"))
         (run ("t:6.51_c/spatch -oSAS_3:sc/c/lntoslink -pt:patches/lntoslink.pch t:lntoslink"))
         (delete "t:lntoslink")
      )
   )
   (complete 90)

   (if (exists "SAS_3:sc/c/mcc")
      (
         (working "Patching mcc")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Extra_Utilities/c_files t: mcc"))
         (run ("t:6.51_c/spatch -oSAS_3:sc/c/mcc -pt:patches/mcc.pch t:mcc"))
         (delete "t:mcc")
      )
   )
   (complete 95)

   (if (exists "SAS_3:sc/c/mln")
      (
         (working "Patching mln")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Extra_Utilities/c_files t: mln"))
         (run ("t:6.51_c/spatch -oSAS_3:sc/c/mln -pt:patches/mln.pch t:mln"))
         (delete "t:mln")
      )
   )

   (if (exists "SAS_3:sc/c/splat")
      (
         (working "Patching splat")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Extra_Utilities/c_files t: splat"))
         (run ("t:6.51_c/spatch -oSAS_3:sc/c/splat -pt:patches/splat.pch t:splat"))
         (delete "t:splat")
      )
   )
   (if (exists "SAS_3:sc/c/grep")
      (
         (working "Patching grep")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Extra_Utilities/c_files t: grep"))
         (run ("t:6.51_c/spatch -oSAS_3:sc/c/grep -pt:patches/grep.pch t:grep"))
         (delete "t:grep")
      )
   )
   (if (exists "SAS_3:sc/c/scompact")
      (
         (working "Patching scompact")
         (run ("t:6.51_c/decompress SASC_6.50_Disk_5:Extra_Utilities/c_files t: scompact"))
         (run ("t:6.51_c/spatch -oSAS_3:sc/c/scompact -pt:patches/scompact.pch t:scompact"))
         (delete "t:scompact")
      )
   )



  )
)

(run "t:6.51_c/flush")
(delete "t:6.51_c/spatch")
(delete "t:6.51_c/more")
(delete "t:6.51_c/flush")
(delete "t:6.51_c/decompress")
(delete "t:6.51_c/concat")
(delete "t:6.51_c")
(run "delete t:patches all")
(complete 100)
