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

  1. /* -------------------------------------------------- */
  2. /* Title:               Invapic.cmd                   */
  3. /*                                                    */
  4. /* Author:              J.Cobb                        */
  5. /*                                                    */
  6. /* Change History:      29/1/1998 - Created JAC       */
  7. /*                                                    */
  8. /* Function:            Looks throuh the config.sys   */
  9. /*                      file and removes psns from the*/
  10. /*                      dpath line.                   */
  11. /* -------------------------------------------------- */
  12.  
  13.  
  14. Parse Upper Arg bootdrv target_path
  15. target_path=translate(strip(target_path))
  16.  
  17. /* Query the system functions */
  18. if RxFuncQuery(SysTempFileName) <> 0 then
  19.    if RxFuncAdd(SysTempFileName,Rexxutil,SysTempFileName) <> 0 then Exit
  20.  
  21. if RxFuncQuery(SysFileDelete) <> 0 then
  22.    if RxFuncAdd(SysFileDelete,Rexxutil,SysFileDelete) <> 0 then Exit
  23.  
  24. Call Modify_Config
  25.  
  26. Exit
  27.  
  28. Modify_Config:Procedure expose bootdrv target_path
  29.  
  30.    in_file = bootdrv'\config.sys'
  31.  
  32.    temp_file = systempfilename(bootdrv'\pssconf.???')
  33.    dp = ''
  34.    rest='initial value'
  35.    do i=1 by 1 while lines(in_file) > 0
  36.       raw_line = linein(in_file)
  37.       parse var raw_line first '=' rest
  38.       if strip(translate(first)) = 'SET DPATH' then do 
  39.          do until rest = ''
  40.             parse var rest path ';' rest
  41.             if translate(strip(path)) = target_path then NOP
  42.             else dp = dp || path || ';'
  43.          end /* do */
  44.          raw_line = 'SET DPATH=' || dp
  45.       end
  46.       call lineout temp_file, raw_line
  47.    end
  48.  
  49.    call lineout in_file /* Close file */
  50.  
  51.  
  52.    /* Close our temporary copy of CONFIG.SYS. */
  53.    call lineout temp_file
  54.  
  55.    /* Copy temp_file to give new config.sys. */
  56.    action = 'COPY' temp_file in_file
  57.    action
  58.  
  59.    call sysfiledelete temp_file
  60.  
  61. return
  62.  
  63.