    Dim Version$/"*** Winchester Formatter V1.1a ***"/

! Miscellaneous Variables
    Dim Answer$(3)

! error codes
    dim errargcount/27/
    dim errdevicetimedout/:412/
    dim errdiskwrtprot/:418/

Subroutine Getparams
    print 'Formatting a disk will destroy all data on that disk.'
    input 'Are you sure you want to format a disk? ' Answer$
    if find(lowercase$(Answer$),'yes')<>1 then exit
    exit subroutine
end

Subroutine printerror
    if err=errargcount then print 'Wrong number of arguments to sub/fcn';
    elseif err=errdevicetimedout then print 'Device timed out';
    elseif err=errdiskwrtprot then print 'Disk format protect error';
    else print 'Error number';err;
    print ' occured while attempting to format the winchester'
    exit subroutine
end

Subroutine formatwinchester external

    print version$
    Getparams
    print 'Formatting winchester disk'
    if error when formatwinchester
    then call printerror

end
