;======================================
; cp.s (loader for cp_main)
;======================================

program cp

include library
include prosys

data word diskutils="1:diskutils.c"
data word cpmain="1:cp_main.c"

word f

;======================================

begin

;load diskutils module, don't execute:
f=open(diskutils)
if f=0 and ioerror=4 ;file not found
  m[diskutils]='0'
  f=open(diskutils)
  if f=0 and ioerror=4 ;file not found
    abort"#cCan't find #s, aborting!",diskutils+2
load diskutils,ldnogo
if lderr <> 0
  output"#c#s:",diskutils
  abort "#cload error #i, aborting!",lderr

;load main module, unloading this one,
;and pass control to it:
f=open(cpmain)
if f=0 and ioerror=4 ;file not found
  m[cpmain]='0'
  f=open(cpmain)
  if f=0 and ioerror=4 ;file no found
    abort"#cCan't find #s, aborting!",cpmain+2
load cpmain
if lderr <> 0
  output"#c#s:",cpmain
  abort "#cload error #i, aborting!",lderr

end
