      REM PLIP-CLEANUP
*PIC-LAN
*
*ALL
*PC
*N
*
*
*
*
******************************************************************************
******************************************************************************
***                                                                        ***
*** (C) Copyright 1990-2005 Doug Dumitru, All Rights Reserved.             ***
***                                                                        ***
*** This program is licensed under the terms of the GNU General Public     ***
*** License, version 2.0 with attached notices.                            ***
***                                                                        ***
*** The full text can be found in the LICENSE.TXT file in the              ***
*** PLIP.BP database file (the /usr/qmweb/PLIP.BP/PLIP.BP directory).      ***
***                                                                        ***
******************************************************************************
******************************************************************************
*
      INCLUDE SYS.TYPE.INCLUDE
*
      INCLUDE PL.COMMON
      INCLUDE PL.COMMON.DEFS
      INCLUDE PL.DEFS
      INCLUDE PLIP.COMMON
      INCLUDE PLW.COMMON
      INCLUDE PL.INIT.INCLUDE
*
      RELEASE
*
      CALL PLIP.INIT.SUB
*
      OPEN 'WWW.CTRL,LOCK' TO PL$LOCK.FD ELSE CALL PLXX.STOP(201,'WWW.CTRL,LOCK')
*
      READVU DUMMY FROM PL$LOCK.FD , 'SUPERVISOR-PROCESS' , 1 LOCKED
         PRINT
         PRINT '*** WARNING ***'
         PRINT
         PRINT 'A PicLan-IP supervisor process is already running.'
         PRINT
         PRINT 'You should not execute the PLIP-CLEANUP command'
         PRINT 'with an active supervisor running.'
         PRINT
         PRINT 'Do you wish to continue anyway (not recommended) Y/N ' :
         INPUT ANS
         ANS = OCONV(ANS,'MCU')
         IF ANS <> 'Y' THEN STOP
      END ELSE
         NULL
      END
*
      CLEAR.LIST = ''
      CLEAR.LIST<-1> = 'WWW.CTRL,CONN'
      CLEAR.LIST<-1> = 'WWW.CTRL,APP.STATES'
      CLEAR.LIST<-1> = 'WWW.CTRL,PROCESSES'
      CLEAR.LIST<-1> = 'WWW.CTRL,STATES'
      CLEAR.LIST<-1> = 'WWW.CTRL,WORK'
*
      PRINT 'Clearing work files ...'
      FOR I = 1 TO DCOUNT(CLEAR.LIST,AM)
         PRINT '  ' : CLEAR.LIST<I> : ' ... ' :
         EXECUTE 'CLEAR-FILE DATA ' : CLEAR.LIST<I> CAPTURING DUMMY
         PRINT
      NEXT I
*
      PRINT
      PRINT 'Cleaning up network connection handles ...'
*
      FOR P.NO = 0 TO 999
         PL_DEALLOC.PLCB p.no ELSE NULL
         *$*call plip.dealloc.plcb(p.no)
         PRINT P.NO : CR :
      NEXT P.NO
      PRINT '      ' : CR :
*
      PRINT
      PRINT ' ... done.'
   END
