home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rxhll.zip / SYSTEM.REX < prev    next >
OS/2 REXX Batch file  |  1994-01-21  |  1KB  |  59 lines

  1.  
  2. /* #include <system.rex> */
  3.  
  4. /**
  5. *** ┌───────────────────────────────────────────────────────────────────────┐
  6. *** │ Misc system functions                                                 │
  7. *** └───────────────────────────────────────────────────────────────────────┘
  8. **/
  9.  
  10. ThisDirectory: procedure
  11.    /**
  12.    ***  This will return the directory from which this exec was run
  13.    **/
  14.  
  15.    parse source . . ThisFile
  16.    LastSlash = lastpos('\', ThisFile)
  17.    ThisDir = left(ThisFile, (LastSlash-1))
  18.    return ThisDir
  19.  
  20.  
  21. SystemDirectory: procedure
  22.    /**
  23.    ***  This will try to determine where the OS/2 system is located by
  24.    ***  looking for a key DLL
  25.    **/
  26.  
  27.    dir = "C:\OS2"
  28.  
  29.    code = RxQueue('Create','SysDir')
  30.    que  = RxQueue('Set'   ,'SysDir')
  31.    '@pstat /L | rxqueue SysDir'
  32.  
  33.    do while queued() > 0
  34.       pull line
  35.       if pos('DOSCALL1.DLL', line) > 0 then
  36.          do
  37.          line = word(line, words(line))
  38.          parse var line dir '\DLL\DOSCALL1.DLL'
  39.          do queued();pull .;end
  40.          end
  41.    end
  42.  
  43.    code = RxQueue('Delete','SysDir')
  44.    que  = RxQueue('Set'   ,que)
  45.    return strip(dir)
  46.  
  47.  
  48. SystemDrive: procedure
  49.    /**
  50.    ***  This will return the single drive letter for the system
  51.    **/
  52.    path = translate(value("PATH",,"OS2ENVIRONMENT"))
  53.    psn = pos(":\OS2",path)
  54.    if psn < 1 then
  55.       BootDrive = 'C'
  56.    else
  57.       BootDrive = substr(path,(psn-1),1)
  58.    return BootDrive
  59.