/* -------------------------------------------------- */
/* Title:               Invbasec.cmd                  */
/*                                                    */
/* Author:              J.Cobb                        */
/*                                                    */
/* Change History:      30/1/1998 - Created JAC       */
/*                                                    */
/* Function:            Looks throuh the config.sys   */
/*                      file and removes the psnssboot*/
/*                      line.                         */
/*                      Also deletes dirves.pss and   */
/*                      psns.log                      */
/* -------------------------------------------------- */


Parse Upper Arg bootdrv target_path

/* Query the system functions */
if RxFuncQuery(SysTempFileName) <> 0 then
   if RxFuncAdd(SysTempFileName,Rexxutil,SysTempFileName) <> 0 then Exit

if RxFuncQuery(SysFileDelete) <> 0 then
   if RxFuncAdd(SysFileDelete,Rexxutil,SysFileDelete) <> 0 then Exit

Call Modify_Config
Call Delete_Files

Exit

Delete_Files:procedure expose target_path

   command = 'DEL' target_path || '\drives.pss'
   command

   command = 'DEL' target_path || '\psns.log'
   command
Return

Modify_Config:Procedure expose bootdrv _prodsdid _prodtape target_path

   in_file = bootdrv'\config.sys'

   temp_file = systempfilename(bootdrv'\pssconf.???')

   do i=1 by 1 while lines(in_file) > 0
      raw_line = linein(in_file)
      traw_line = translate(strip(raw_line))
      Select  
         when traw_line = 'CALL='target_path || '\PSNSBOOT.EXE' then NOP
         otherwise call lineout temp_file, raw_line
      end  /* select */
   end

   call lineout in_file /* Close file */


   /* Close our temporary copy of CONFIG.SYS. */
   call lineout temp_file

   /* Copy temp_file to give new config.sys. */
   action = 'COPY' temp_file in_file
   action

   call sysfiledelete temp_file

return

