home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Backup / Backup.zip / psnsg601.zip / tapec2.cmd < prev    next >
OS/2 REXX Batch file  |  1999-10-05  |  2KB  |  66 lines

  1. /* -------------------------------------------------- */
  2. /* Title:               tapec.cmd                     */
  3. /*                                                    */
  4. /* Author:              J.Cobb                        */
  5. /*                                                    */
  6. /* Change History:      11/11/1997 - Created JAC      */
  7. /*                                                    */
  8. /* Function:            Looks throuh the config.sys   */
  9. /*                      file for and adds tape support*/
  10. /* -------------------------------------------------- */
  11.  
  12.  
  13. Parse Arg featurehandle featureid bootdrv
  14.  
  15. _proddmd  = 'BASEDEV=?OS2SCSI.DMD'     /* SCSI Device Manager we need */
  16.  
  17. /* Query the system functions */
  18. if RxFuncQuery(RexxInstDeselect) <> 0 then
  19.    if RxFuncAdd(RexxInstDeselect,WPINSTAL,RexxInstDeselect) <> 0 then Exit
  20.  
  21. if RxFuncQuery(RexxInstSelect) <> 0 then
  22.    if RxFuncAdd(RexxInstSelect,WPINSTAL,RexxInstSelect) <> 0 then Exit
  23. Call Search_Config
  24.  
  25. Exit
  26.  
  27. Search_Config:Procedure expose bootdrv _proddmd featurehandle featureid 
  28.  
  29.    in_file = bootdrv'\config.sys'
  30.    found_dmd = 0
  31.    do i=1 by 1 while lines(in_file) > 0
  32.       raw_line = linein(in_file)
  33.       if IsTypeDMD(raw_line) then found_dmd = 1 /* found OS2SCSI.DMD */
  34.    end
  35.    call lineout in_file /* Close file */
  36.    if found_dmd =1 then rc=RexxInstSelect(featurehandle,featureid)
  37.    else rc=RexxInstDeselect(featurehandle,featureid) 
  38. return
  39.  
  40. IsTypeDMD: procedure expose _proddmd
  41. /* Local subroutine to detect corequisite OS2SCSI.DMD statement. */
  42.    parse upper arg string
  43.    return Match_HeadTail(string, _proddmd)
  44.  
  45. Match_HeadTail: procedure
  46. /* Search "string" to see if "head" is the leading substring and */
  47. /* "tail" is the ending substring.  Case insensitive, ignores */
  48. /* comment lines.  Returns 0 or 1. */
  49.    parse upper arg string, head '?' tail
  50.    parse var string token .
  51.    if token = 'REM' then               /* Comment line? */
  52.       return 0
  53.    string = space(string, 0)           /* Remove all blanks. */
  54.    n=length(head)
  55.    if n > length(string) then          /* More "head" than "string"? */
  56.       return 0
  57.    if left(string, n) \= head then
  58.       return 0
  59.    n=length(tail)
  60.    if n > length(string) then          /* More "tail" than "string"? */
  61.       return 0
  62.    if right(string, n) \= tail then
  63.       return 0
  64.    return 1
  65.  
  66.