home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / CHKCNF.ZIP / CHKCONF.CMD
OS/2 REXX Batch file  |  1993-03-17  |  23KB  |  813 lines

  1. /**
  2. *** ┌────────────────────────────────────────────────────────────────────────┐
  3. *** │                                                                        │
  4. *** │ CHKCONF v1.01                                                          │
  5. *** │                                                                        │
  6. *** │ This code will look through the CONFIG.SYS file and verify that file   │
  7. *** │ is OK to the best of its ability.                                      │
  8. *** │                                                                        │
  9. *** │════════════════════════════════════════════════════════════════════════│
  10. *** │                                                                        │
  11. *** │ This is FREEWARE.  You may upload to any public forum.  You are free   │
  12. *** │ to make changes, but if you do, I request that you do NOT upload any   │
  13. *** │ modified versions.                                                     │
  14. *** │                                                                        │
  15. *** │ Report any questions, comments or code defects to:                     │
  16. *** │                                                                        │
  17. *** │    CompuServe:  73457,365                                              │
  18. *** │    Prodigy:     VWSD07A                                                │
  19. *** │    Hilbert BBS: 913-829-2450 (Sysop)                                   │
  20. *** │                                                                        │
  21. *** └────────────────────────────────────────────────────────────────────────┘
  22. **/
  23.  
  24. parse arg Config
  25.  
  26. /* Set up some global variables */
  27.  
  28. Parse.       = ''
  29. Parse.Line   = 0
  30. Parse.SysDir = SystemDirectory()
  31.  
  32. say copies('─', 79)
  33.  
  34. if Config = '' then
  35.    do
  36.    Config = left(Parse.SysDir,2)"\CONFIG.SYS"
  37.    call Warning  "No CONFIG.SYS file specified on the command line."
  38.    call Warning "      (cont'd)  Verifying" Config
  39.    end
  40.  
  41. Parse.Config = Config
  42.  
  43. /* Load the REXX DLL entry points */
  44.  
  45. call LoadFunctions
  46.  
  47. /* Open the REXX source file. If not found, try appending a CMD on the end */
  48.  
  49. if (\Exists(Config)) then
  50.    do
  51.    say 'Error: Configuration file "'Config'" doesn''t exist.'
  52.    exit
  53.    end
  54.  
  55. Config = Open(Config 'READ')
  56.  
  57. do while(lines(Config) > 0)
  58.    Statement = linein(Config)
  59.    Parse.Line = Parse.Line + 1
  60.    call ParseStatement Statement
  61. end /* while */
  62.  
  63. Config = Close(Config)
  64. say copies('─', 79)
  65. say "Verification of" Config "complete."
  66. return
  67.  
  68. /**
  69. *** ┌───────────────────────────────────────────────────────────────────────┐
  70. *** │                   Application-specific Subroutines                    │
  71. *** └───────────────────────────────────────────────────────────────────────┘
  72. **/
  73.  
  74. ParseStatement: procedure expose Parse.
  75.    /**
  76.    ***  This will determine what kind of statement this is.
  77.    **/
  78.  
  79.    parse arg Statement
  80.    Statement = strip(Statement)
  81.  
  82.    if strip(Statement) = '' then
  83.       nop
  84.    else
  85.    if (UpperCase(word(Statement,1))) = 'REM' then
  86.       nop
  87.    else
  88.    if (UpperCase(word(Statement,1))) = 'SET' then
  89.       call ParseSet Statement
  90.    else
  91.       call ParseCommand Statement
  92.    return
  93.  
  94. /**
  95. *** ┌───────────────────────────────────────────────────────────────────────┐
  96. *** │                 Environment variable parsing routines                 │
  97. *** └───────────────────────────────────────────────────────────────────────┘
  98. **/
  99.  
  100. ParseSet: procedure expose Parse.
  101.    /**
  102.    ***  This will parse SET statements in the CONFIG.SYS
  103.    ***/
  104.  
  105.    parse arg . EnvVar '=' EnvValue
  106.    EnvVar = UpperCase(EnvVar)
  107.  
  108.    select
  109.       when EnvVar = "PROMPT"        then nop
  110.       when EnvVar = "PATH"          then call VerifyPathList "PATH"       EnvValue
  111.       when EnvVar = "DPATH"         then call VerifyPathList "DPATH"      EnvValue
  112.       when EnvVar = "GLOSSARY"      then call VerifyPathList "GLOSSARY"   EnvValue
  113.       when EnvVar = "HELP"          then call VerifyPathList "HELP"       EnvValue
  114.       when EnvVar = "KEDPATH"       then call VerifyPathList "KEDPATH"    EnvValue
  115.       when EnvVar = "BOOKSHELF"     then call VerifyPathList "BOOKSHELF"  EnvValue
  116.       when EnvVar = "BOOKMGR"       then call VerifyPathList "BOOKMGR"    EnvValue
  117.       when EnvVar = "READIBM"       then call VerifyPathList "READIBM"    EnvValue
  118.       when EnvVar = "INCLUDE"       then call VerifyPathList "INCLUDE"    EnvValue
  119.       when EnvVar = "LIB"           then call VerifyPathList "LIB"        EnvValue
  120.       when EnvVar = "EPMPATH"       then call VerifyPathList "EPMPATH"    EnvValue
  121.       when EnvVar = "IPFC"          then call VerifyPathList "IPFC"       EnvValue
  122.       when EnvVar = "ETC"           then call VerifyPath     "ETC"        EnvValue
  123.       when EnvVar = "VINESDIR"      then call VerifyPath     "VINESDIR"   EnvValue
  124.       when EnvVar = "XFILES"        then call VerifyPath     "XFILES"     EnvValue
  125.       when EnvVar = "USER_INI"      then call VerifyFile     "USER_INI"   EnvValue
  126.       when EnvVar = "SYSTEM_INI"    then call VerifyFile     "SYSTEM_INI" EnvValue
  127.       when EnvVar = "OS2_SHELL"     then call VerifyFile     "OS2_SHELL"  EnvValue
  128.       when EnvVar = "COMSPEC"       then call VerifyFile     "COMSPEC"    EnvValue
  129.       when EnvVar = "KEYS"          then call ParseSetKEYS                EnvValue
  130. /*    when EnvVar = "AUTOSTART"     then call ParseSetAUTOSTART
  131.       when EnvVar = "RUNWORKPLACE"  then call ParseSetRUNWORKPLACE
  132.       when EnvVar = "PROGREF20"     then call ParseSetPROGREF20
  133.       when EnvVar = "PMREF"         then call ParseSetPMREF
  134.       when EnvVar = "HELPNDX"       then call ParseSetHELPNDX
  135.       when EnvVar = "VIDEO_DEVICES" then call ParseSetVIDEO_DEVICES
  136.       when EnvVar = "VIO_XGA"       then call ParseSetVIO_XGA
  137. */    otherwise
  138.          nop
  139.    end /* select */
  140.    return
  141.  
  142.  
  143. VerifyPathList: procedure expose Parse.
  144.    /**
  145.    ***  This will take a list of semicolon-delimited paths and verify that
  146.    ***  they exist.
  147.    **/
  148.  
  149.    parse arg EnvVar PathList
  150.  
  151.    call PathSplit PathList        /* Set DirList. */
  152.    do i = 1 to DirList.0
  153.       call VerifyPath EnvVar DirList.i
  154.    end
  155.    return
  156.  
  157.  
  158. VerifyPath: procedure expose Parse.
  159.    /**
  160.    ***  This will verify that a single path exists
  161.    **/
  162.  
  163.    parse arg EnvVar Path
  164.    Path = strip(Path,'Trailing', ';')
  165.  
  166.    /* Get a list of the remote drives and skip them.  (Circumvent a bug in */
  167.    /* either REXX or NFS).                                                 */
  168.  
  169.    RemoteDriveMap = SysDriveMap('C', 'REMOTE')
  170.  
  171.    /* See if this is a remote drive */
  172.  
  173.    parse var Path  Drive ":" .
  174.    if Pos(Drive, RemoteDriveMap) = 0 then
  175.       do
  176.       code = SysFileTree(Path,'Found','D')
  177.       if Found.0 = 0 then
  178.          call Warning "Directory" Path "in" EnvVar "was not found."
  179.       end
  180.    else
  181.       call Warning "Skipping verification for remote path" Path "in" EnvVar"."
  182.    return
  183.  
  184.  
  185. VerifyFile: procedure expose Parse.
  186.    /**
  187.    ***  This will verify that a file exists
  188.    **/
  189.  
  190.    arg EnvVar FileName .
  191.    FileName = strip(FileName, "Trailing", ";")
  192.  
  193.    if Exists(FileName) then
  194.       return
  195.  
  196.    call Warning "File specified in" EnvVar "doesn't exist."
  197.    return
  198.  
  199.  
  200. ParseSetKEYS: procedure expose Parse.
  201.    /**
  202.    ***  This will parse the SET KEYS=... command.
  203.    **/
  204.  
  205.    arg EnvValue .
  206.  
  207.    if \OnOff(EnvValue) then
  208.       call Warning "The KEYS variable must be either 'ON' or 'OFF'."
  209.    return
  210.  
  211. /**
  212. *** ┌───────────────────────────────────────────────────────────────────────┐
  213. *** │                       Command parsing routines                        │
  214. *** └───────────────────────────────────────────────────────────────────────┘
  215. **/
  216.  
  217. ParseCommand: procedure expose Parse.
  218.    /**
  219.    ***  This will parse the commands that are not SET or REM statements.
  220.    **/
  221.  
  222.    parse arg Verb '=' VerbValue
  223.    Verb = UpperCase(Verb)
  224.  
  225.    select
  226.       when Verb = "IOPL"             then nop
  227.       when Verb = "MEMMAN"           then nop
  228.       when Verb = "BREAK"            then call ParseCommandBREAK              VerbValue
  229.       when Verb = "BUFFERS"          then call ParseCommandBUFFERS            VerbValue
  230.       when Verb = "CODEPAGE"         then call ParseCommandCODEPAGE           VerbValue
  231.       when Verb = "COUNTRY"          then call ParseCommandCOUNTRY            VerbValue
  232.       when Verb = "DEVICE"           then call ParseCommandDEVICE             VerbValue
  233.       when Verb = "DEVINFO"          then call ParseCommandDEVINFO            VerbValue
  234.       when Verb = "DISKCACHE"        then call ParseCommandDISKCACHE          VerbValue
  235.       when Verb = "DOS"              then call ParseCommandDOS                VerbValue
  236.       when Verb = "FCBS"             then call ParseCommandFCBS               VerbValue
  237.       when Verb = "FILES"            then call ParseCommandFILES              VerbValue
  238.       when Verb = "IFS"              then call ParseCommandIFS                VerbValue
  239.       when Verb = "MAXWAIT"          then call ParseCommandMAXWAIT            VerbValue
  240.       when Verb = "PRINTMONBUFSIZE"  then call ParseCommandPRINTMONBUFSIZE    VerbValue
  241.       when Verb = "PRIORITY_DISK_IO" then call ParseCommandPRIORITY_DISK_IO   VerbValue
  242.       when Verb = "PROTECTONLY"      then call ParseCommandPROTECTONLY        VerbValue
  243.       when Verb = "RMSIZE"           then call ParseCommandRMSIZE             VerbValue
  244.       when Verb = "SWAPPATH"         then call ParseCommandSWAPPATH           VerbValue
  245.       when Verb = "THREADS"          then call ParseCommandTHREADS            VerbValue
  246.       when Verb = "PROTSHELL"        then call VerifyFile        "PROTSHELL"  VerbValue
  247.       when Verb = "CALL"             then call VerifyFileWordOne "CALL"       VerbValue
  248.       when Verb = "RUN"              then call VerifyFileWordOne "RUN"        VerbValue
  249.       when Verb = "SHELL"            then call VerifyFileWordOne "SHELL"      VerbValue
  250.       when Verb = "LIBPATH"          then call VerifyPathList    "LIBPATH"    VerbValue
  251.       when Verb = "BASEDEV"          then call VerifySystemFile  "BASEDEV"    VerbValue
  252.    otherwise
  253.       call Warning "Unrecognized verb" Verb"."
  254.    end /* select */
  255.    return
  256.  
  257.  
  258. VerifySystemFile: procedure expose Parse.
  259.    /**
  260.    ***  This will verify that a file exists in the system directory
  261.    **/
  262.  
  263.    arg Verb FileName .
  264.    FileName = strip(FileName, "Trailing", ";")
  265.  
  266.    if Exists(Parse.SysDir"\"FileName) then
  267.       return
  268.  
  269.    call Warning "System file in" Verb "statement doesn't exist."
  270.    return
  271.  
  272.  
  273. VerifyFileWordOne: procedure expose Parse.
  274.    /**
  275.    ***  This will verify that a file exists in the system directory
  276.    **/
  277.  
  278.    arg Verb FileName .
  279.    call VerifyFile Verb FileName
  280.    return
  281.  
  282.  
  283. ParseCommandBREAK: procedure expose Parse.
  284.    /**
  285.    ***  Parse the BREAK statement
  286.    **/
  287.  
  288.    arg StmtValue
  289.  
  290.    if \OnOff(StmtValue) then
  291.       call Warning "BREAK must be ON or OFF."
  292.    return
  293.  
  294.  
  295. ParseCommandPROTECTONLY: procedure expose Parse.
  296.    /**
  297.    ***  Parse the PROTECTONLY statement
  298.    **/
  299.  
  300.    arg StmtValue
  301.  
  302.    if \YesNo(StmtValue) then
  303.       call Warning "PROTECTONLY must be NO or YES."
  304.    return
  305.  
  306.  
  307. ParseCommandPRIORITY_DISK_IO: procedure expose Parse.
  308.    /**
  309.    ***  Parse the PRIORITY_DISK_IO statement
  310.    **/
  311.  
  312.    arg StmtValue
  313.  
  314.    if \YesNo(StmtValue) then
  315.       call Warning "PRIORITY_DISK_IO must be NO or YES."
  316.    return
  317.  
  318.  
  319. ParseCommandBUFFERS: procedure expose Parse.
  320.    /**
  321.    ***  Parse the BUFFERS statement
  322.    **/
  323.  
  324.    arg StmtValue
  325.  
  326.    if \DataType(StmtValue, 'Whole Number') then
  327.       call Warning "BUFFERS must be an integer value."
  328.    else
  329.    if StmtValue < 0 then
  330.       call Warning "BUFFERS must be greater than zero."
  331.    else
  332.    if StmtValue > 512 then
  333.       call Warning "BUFFERS may be excessive."
  334.    return
  335.  
  336.  
  337. ParseCommandRMSIZE: procedure expose Parse.
  338.    /**
  339.    ***  Parse the RMSIZE statement
  340.    **/
  341.  
  342.    arg StmtValue
  343.  
  344.    if \DataType(StmtValue, 'Whole Number') then
  345.       call Warning "RMSIZE must be an integer value."
  346.    else
  347.    if (StmtValue < 0) | (StmtValue > 640) then
  348.       call Warning "RMSIZE must be between 0 and 640."
  349.  
  350.    if StmtValue < 256 then
  351.       call Warning "RMSIZE may be not be large enough for most DOS programs."
  352.    return
  353.  
  354.  
  355. ParseCommandMAXWAIT: procedure expose Parse.
  356.    /**
  357.    ***  Parse the MAXWAIT statement
  358.    **/
  359.  
  360.    arg StmtValue
  361.  
  362.    if \DataType(StmtValue, 'Whole Number') then
  363.       call Warning "MAXWAIT must be an integer value."
  364.    else
  365.    if (StmtValue < 1) | (StmtValue > 255) then
  366.       call Warning "MAXWAIT must be between 1 and 255."
  367.    return
  368.  
  369.  
  370. ParseCommandTHREADS: procedure expose Parse.
  371.    /**
  372.    ***  Parse the THREADS statement
  373.    **/
  374.  
  375.    arg StmtValue
  376.  
  377.    if \DataType(StmtValue, 'Whole Number') then
  378.       call Warning "THREADS must be an integer value."
  379.    else
  380.    if (StmtValue < 64) | (StmtValue > 4095) then
  381.       call Warning "THREADS must be between 64 and 4095."
  382.    return
  383.  
  384.  
  385. ParseCommandFILES: procedure expose Parse.
  386.    /**
  387.    ***  Parse the FILES statement
  388.    **/
  389.  
  390.    arg StmtValue
  391.  
  392.    if \DataType(StmtValue, 'Whole Number') then
  393.       call Warning "FILES must be an integer value."
  394.    else
  395.    if StmtValue < 0 then
  396.       call Warning "FILES must be greater than zero."
  397.    else
  398.    if StmtValue > 64 then
  399.       call Warning "FILES may be excessive."
  400.    return
  401.  
  402.  
  403. ParseCommandFCBS: procedure expose Parse.
  404.    /**
  405.    ***  Parse the FCBS statement
  406.    **/
  407.  
  408.    arg m ',' n
  409.  
  410.    if \DataType(m, 'Whole Number') then
  411.       do
  412.       call Warning "FCBS must be an integer value."
  413.       return
  414.       end
  415.    if \DataType(n, 'Whole Number') then
  416.       do
  417.       call Warning "FCBS must be an integer value."
  418.       return
  419.       end
  420.  
  421.    if ((m < 1) | (m > 255)) then
  422.       call Warning "FCBS first parm must be between 1 and 255."
  423.    if ((n < 0) | (n > 255)) then
  424.       call Warning "FCBS second parm must be between 0 and 255."
  425.    if n > m then
  426.       call Warning "FCBS second parm must greater than first parm."
  427.    return
  428.  
  429.  
  430. ParseCommandCODEPAGE: procedure expose Parse.
  431.    /**
  432.    ***  Parse the CODEPAGE statement
  433.    **/
  434.  
  435.    arg StmtValue1 ',' StmtValue2
  436.  
  437.    if \DataType(StmtValue1, 'Whole Number') then
  438.       call Warning "CODEPAGE must be an integer value."
  439.  
  440.    if StmtValue2 = '' then
  441.       return
  442.    else
  443.    if \DataType(StmtValue2, 'Whole Number') then
  444.       call Warning "CODEPAGE must be an integer value."
  445.    return
  446.  
  447.  
  448. ParseCommandCOUNTRY: procedure expose Parse.
  449.    /**
  450.    ***  Parse the COUNTRY statement
  451.    **/
  452.  
  453.    arg StmtValue1 ',' StmtValue2
  454.  
  455.    if \DataType(StmtValue1, 'Whole Number') then
  456.       call Warning "COUNTRY must be an integer value."
  457.  
  458.    if \Exists(StmtValue2) then
  459.       call Warning "File specified for COUNTRY doesn't exist."
  460.    return
  461.  
  462.  
  463. ParseCommandIFS: procedure expose Parse.
  464.    /**
  465.    ***  Parse the IFS statement
  466.    **/
  467.  
  468.    arg IFS parms
  469.  
  470.    if \Exists(IFS) then
  471.       call Warning "File specified for IFS doesn't exist."
  472.  
  473.    if pos('HPFS.IFS', IFS) > 0 then
  474.       call ParseCommandIFSHPFS parms
  475.    return
  476.  
  477.  
  478. ParseCommandIFSHPFS: procedure expose Parse.
  479.    /**
  480.    ***  Parse the IFS statement for HPFS
  481.    **/
  482.  
  483.    arg parms
  484.  
  485.    do i = 1 to words(parms)
  486.       parm = UpperCase(word(parms, i))
  487.       select
  488.          when left(parm, 3) = '/C:' then nop
  489.          when left(parm, 3) = '-C:' then nop
  490.          when left(parm, 7) = '-CRECL:' then nop
  491.          when left(parm, 7) = '/CRECL:' then nop
  492.          when left(parm, 7) = '-CACHE:' then nop
  493.          when left(parm, 7) = '/CACHE:' then nop
  494.          when left(parm, 11) = '/AUTOCHECK:' then
  495.             call ParseAutoCheck substr(parm, 12)
  496.          when left(parm, 11) = '-AUTOCHECK:' then
  497.             call ParseAutoCheck substr(parm, 12)
  498.          otherwise
  499.             say "Warning: Unrecognized parm" parm "on IFS for HPFS."
  500.       end /* select */
  501.    end
  502.    return
  503.  
  504.  
  505. ParseAutoCheck: procedure expose Parse.
  506.    /**
  507.    ***  This will parse the drives specified on the AUTOCHECK parameter
  508.    ***  for the IFS statement for HPFS
  509.    **/
  510.  
  511.    arg autocheck .
  512.  
  513.    DriveMap = SysDriveMap('C', 'LOCAL')
  514.  
  515.    do i = 1 to length(autocheck)
  516.       drive = substr(autocheck, i, 1)':'
  517.  
  518.       select
  519.          when drive = 'A:' then
  520.             call Warning "You can't AUTOCHECK a floppy drive."
  521.          when drive = 'B:' then
  522.             call Warning "You can't AUTOCHECK a floppy drive."
  523.          otherwise
  524.             do
  525.             psn = wordpos(drive, DriveMap)
  526.             if psn = 0 then
  527.                call Warning "Drive" drive "in the AUTOCHECK list that isn't present."
  528.             else
  529.                DriveMap = delword(DriveMap, psn, 1)
  530.             end /* otherwise */
  531.       end /* select */
  532.    end /* do */
  533.  
  534.    if strip(DriveMap) <> '' then
  535.       call Warning "Drive(s)" DriveMap "are not in the AUTOCHECK list."
  536.       call Warning "      (cont'd)  This is OK if they are VDISK."
  537.    return
  538.  
  539.  
  540.  
  541. ParseCommandDEVICE: procedure expose Parse.
  542.    /**
  543.    ***  Parse the DEVICE statement.
  544.    ***
  545.    ***  NOTE:  Some future version will parse this for the devices listed in
  546.    ***         the online command reference for the common devices (e.g. ANSI)
  547.    ***
  548.    **/
  549.  
  550.    arg StmtValue .
  551.  
  552.    if \Exists(StmtValue) then
  553.       call Warning "File specified for DEVICE doesn't exist."
  554.    return
  555.  
  556.  
  557.  
  558. ParseCommandSWAPPATH: procedure expose Parse.
  559.    /**
  560.    ***  Parse the SWAPPATH statement.
  561.    **/
  562.  
  563.    arg swapper .
  564.  
  565.    call VerifyPath "SWAPPATH" swapper
  566.    return
  567.  
  568.  
  569. ParseCommandDEVINFO: procedure expose Parse.
  570.    /**
  571.    ***  Parse the DEVINFO statement.
  572.    **/
  573.  
  574.    arg  Arguments ',' . ',' DevFile
  575.  
  576.    if \Exists(DevFile) then
  577.       call Warning "File specified for DEVINFO doesn't exist."
  578.  
  579.    select
  580.       when left(Arguments, 3) = "KBD" then nop
  581.       when left(Arguments, 3) = "SCR" then nop
  582.       when left(Arguments, 3) = "LPT" then nop
  583.       otherwise
  584.          call Warning "Argument to DEVINFO statement is invalid."
  585.    end /* select */
  586.    return
  587.  
  588.  
  589. ParseCommandDISKCACHE: procedure expose Parse.
  590.    /**
  591.    ***  Parse the DISKCACHE statement.
  592.    **/
  593.  
  594.    Parm. = ''
  595.    arg Blocks ',' Parm.1 ',' Parm.2 ',' Parm.3
  596.  
  597.    if \DataType(Blocks, 'Whole Number') then
  598.       call Warning "DISKCACHE must be in 1024-byte blocks."
  599.  
  600.    i = 1
  601.    do while(Parm.i <> '')
  602.       select
  603.          when Parm.i = 'T'  then nop
  604.          when Parm.i = 'LW' then nop
  605.          when Left(Parm.i,3) = 'AC:' then nop
  606.          otherwise
  607.             call Warning "Unrecognized argument on DISKCACHE statement"
  608.       end /* select */
  609.       i = i + 1
  610.    end /* while */
  611.    return
  612.  
  613.  
  614. ParseCommandPRINTMONBUFSIZE: procedure expose Parse.
  615.    /**
  616.    ***  Parse the PRINTMONBUFSIZE statement.
  617.    **/
  618.  
  619.    Parm. = ''
  620.    arg  Parm.1 ',' Parm.2 ',' Parm.3
  621.  
  622.    i = 1
  623.    do while(Parm.i <> '')
  624.       if \DataType(Parm.i, 'Whole Number') then
  625.          call Warning "PRINTMONBUFSIZE must be a whole number."
  626.       i = i + 1
  627.    end /* while */
  628.    return
  629.  
  630.  
  631. ParseCommandDOS: procedure expose Parse.
  632.    /**
  633.    ***  Parse the DOS statement.
  634.    **/
  635.  
  636.    Parm. = ''
  637.    arg HiLo ',' UMB
  638.  
  639.    select
  640.       when HiLo = 'HIGH'  then nop
  641.       when HiLo = 'LOW'   then nop
  642.       otherwise
  643.          call Warning "Unrecognized argument on DOS statement:" HiLo"."
  644.    end /* select */
  645.    select
  646.       when UMB = 'UMB'   then nop
  647.       when UMB = 'NOUMB' then nop
  648.       otherwise
  649.          call Warning "Unrecognized argument on DOS statement:" UMB"."
  650.    end /* select */
  651.    return
  652.  
  653. /**
  654. *** ┌───────────────────────────────────────────────────────────────────────┐
  655. *** │                          Generic Subroutines                          │
  656. *** └───────────────────────────────────────────────────────────────────────┘
  657. **/
  658.  
  659.  
  660. Warning: procedure expose Parse.
  661.    /**
  662.    ***  This will display the warning message
  663.    **/
  664.  
  665.    parse arg message
  666.  
  667.    say "Warning Line" right(Parse.Line,3)":" message
  668.    return
  669.  
  670.  
  671. PathSplit: procedure expose DirList.
  672.    /**
  673.    ***  This will create a stem variable out of the semicolon-delimited
  674.    ***  variable.
  675.    **/
  676.  
  677.    arg PathString .
  678.  
  679.    DirList = ''
  680.    j = 1
  681.    parse var PathString DirList.j ';' PathString
  682.    do while DirList.j \= ''
  683.       j = j + 1
  684.       parse var PathString DirList.j ';' PathString
  685.    end /* while */
  686.    DirList.0 = j - 1
  687.    return DirList.0
  688.  
  689.  
  690. Open: procedure
  691.  
  692.    arg file rw
  693.  
  694.    file_ = stream(file,c,'QUERY EXIST')
  695.  
  696.    /* If the file is opened for WRITE access, delete it first */
  697.  
  698.    if (file_ \= '') then
  699.       do
  700.       if (rw = 'WRITE') then
  701.          '@erase' file
  702.       file = file_
  703.       end
  704.  
  705.    message = stream(file,c,'OPEN' rw)
  706.    if (message \= 'READY:') then
  707.       do
  708.       say 'Error: Open failure on' file'.' message
  709.       exit
  710.       end
  711.    return file
  712.  
  713.  
  714. Close: procedure
  715.  
  716.    arg file
  717.    message = stream(file,c,'CLOSE')
  718.    if (message \= 'READY:') & (message \= '') then
  719.       do
  720.       say 'Error: Close failure on' file'.' message
  721.       exit
  722.       end
  723.    return file
  724.  
  725.  
  726. Exists: procedure
  727.  
  728.    arg file
  729.  
  730.    file = stream(file,c,'QUERY EXIST')
  731.    if (file = '') then
  732.       return 0
  733.    else
  734.       return 1
  735.  
  736. UpperCase: procedure
  737.    /**
  738.    ***  This will return the string passed after converting it to uppercase
  739.    **/
  740.  
  741.    parse upper arg String
  742.    return String
  743.  
  744.  
  745. LoadFunctions: procedure
  746.    /**
  747.    ***   This will load the DLL for the Rexx system functions supplied
  748.    ***   with OS/2 v2.0
  749.    **/
  750.    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  751.    call SysLoadFuncs
  752.    return
  753.  
  754.  
  755. SystemDirectory: procedure
  756.    /**
  757.    ***  This will try to determine where the OS/2 system is located by
  758.    ***  looking for a key DLL
  759.    **/
  760.  
  761.    say 'Determining system directory. This may take about 10 seconds...'
  762.    dir = "C:\OS2"
  763.    '@pstat /L | rxqueue'
  764.    do while queued() > 0
  765.       pull line
  766.       if pos('DOSCALL1.DLL', line) > 0 then
  767.          do
  768.          line = word(line, words(line))
  769.          parse var line dir '\DLL\DOSCALL1.DLL'
  770.          do queued();pull .;end
  771.          end
  772.    end
  773.    say 'System directory is' strip(dir)'.'
  774.    return strip(dir)
  775.  
  776.  
  777. OnOff: procedure
  778.    /**
  779.    ***  This returns a 1 if the string passed is 'ON' or 'OFF'
  780.    ***
  781.    **/
  782.  
  783.    arg val
  784.  
  785.    select
  786.       when val = 'ON'  then
  787.          return 1
  788.       when val = 'OFF' then
  789.          return 1
  790.       otherwise
  791.          return 0
  792.    end
  793.    return 0
  794.  
  795.  
  796. YesNo: procedure
  797.    /**
  798.    ***  This returns a 1 if the string passed is 'NO' or 'YES'
  799.    ***
  800.    **/
  801.  
  802.    arg val
  803.  
  804.    select
  805.       when val = 'NO'  then
  806.          return 1
  807.       when val = 'YES' then
  808.          return 1
  809.       otherwise
  810.          return 0
  811.    end
  812.    return 0
  813.