;======================================
; drives.s (enumerate disk drives)
;======================================

program drives

include library
include prosys

data word diskutils="1:diskutils.c"
data word drivesmain="1:drives_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(drivesmain)
if f=0 and ioerror=4 ;file not found
  m[drivesmain]='0'
  f=open(drivesmain)
  if f=0 and ioerror=4 ;file not found
    abort"#cCan't find #s, aborting!",drivesmain+2
load drivesmain
if lderr <> 0
  output"#c#s:",drivesmain
  abort "#cLoad error #i, aborting!",lderr

end
