/**/
call rxfuncadd sysloadfuncs,rexxutil,sysloadfuncs
call sysloadfuncs

version = "0.1.11"
gsincluded = 'gs703os2.zip'
gslocationzip = 'gs7.03'

say 'PMPDF Poor Mans PDF, a Acrobat substitue'
say 'version :' version 'Instalation utility'
say 'homepage: http://pmpdf.netlabs.org'
say 'help    : pmpdf@yahoogroups.com'
say

say 'checking packages.....'
pdr = checkfile('pdfwrite.pdr')
gs = checkfile(gsincluded)
ps = checkfile('pscript\*')
parse upper arg gslocation

say "Where do you want to store your PDF's ?"
pull pdflocation
say "Where is GhostScript Installed ??"
pull gslocation
call sysfiletree gslocation'\bin\gsos2.exe','gsfile', 'FSO'
do while gsfile.0 = 0
 /* checking for ghostscript*/

 if gsfile.0 = 0 then do
  if gs=0 then do
   say 'GhostScript NOT found !'
   say "Where is GhostScript Installed ??"
   pull gslocation
   call sysfiletree gslocation'\bin\gsos2.exe','gsfile', 'FSO'
  end
  else
  do
  say 'Install Ghostscript in: 'gslocation' ?'
  parse upper pull installgs
  if installgs='Y' then do
   '@unzip -d' gslocation gsincluded
   gslocation = gslocation'\'gslocationzip
  end
  else
   exit
  end
  leave
 end
 else
  leave
end

call sysini 'SYSTEM','PM_PDF','INITIALIZATION',gslocation';'pdflocation||x2c('0')


"@rinstprn.exe /R:"getrspname()

exit

getrspname:

      rc = sysini('BOTH','FolderWorkareaRunningObjects','ALL:','Objects')
      bootdrive=left(Objects.1,1)
      Say 'Looking for postscript driver in: 'bootdrive':\OS2'
      call sysfiletree bootdrive':\OS2\pscript.drv','file', 'FSO'
      if file.0 = 0 then do
        rspname = nops.rsp
        Say "PSCRIPT.DRV not found installing now"
        end
      else do
        rspname = withps.rsp
        Say "PSCRIPT.DRV found using installed version"
        end
      return rspname

checkfile:
     arg filetocheck
     call sysfiletree filetocheck,'file', 'FSO'
      if file.0 = 0 then do
        rspname = 0
        Say filetocheck' ... Not Found !!'
        end
      else do
        rspname = 1
        Say filetocheck' ... Found'
        end
      return rspname


