SUBROUTINE FINISH C C This routine is called to exit from VAXNET. It hangs up the modem, C displays several informational messages, closes and reformats the C log file (if any), and then exits. C INCLUDE 'COM.INC/NOLIST' C C If we're using a modem, and hangup is true, hangup the modem. C EXITING = .TRUE. ! Show we're exiting ... IF (MODEM) THEN IF (HANGUP) THEN CALL HANGUP_MODEM() ! Go hangup the modem. ELSE IF (.NOT. UNIX_MODE) THEN CALL WRITE_USER('*** Don''t forget to HANGUP the modem. ***' 1 //BELL//SS) ENDIF ENDIF ENDIF C C Remind user to deallocate the remote port if allocated. C IF (NEED_TO_DEAL) THEN IF (.NOT. UNIX_MODE) THEN CALL WRITE_USER ('*** Don''t forget to DEALLOCATE '// 1 '"'//REMOTE_DEVICE(1:REMOTE_SIZE)//'" ***'//SS) ENDIF ENDIF C C Close and reformat the log file (if any). C C LIB$DO_COMMAND is used here instead of call routine REF_LOGFILE C because: C 1.) LIB$SPAWN doesn't work from BATCH. C 2.) If at a terminal, it's faster since symbols aren't copied. C IF (LOGFILE) THEN CALL FLUSH_LOGFILE() ! Empty the logfile buffer. CLOSE (UNIT=LOG_UNIT) ! Close the log file. IF (AUTO_REF) THEN IF (.NOT. UNIX_MODE) THEN CALL WRITE_USER ('*** Reformatting log file "'// 1 LOG_FILE(1:LOGFILE_SIZE)//'", please be patient. ***'//SS) ENDIF CALL LIB$DO_COMMAND ('$ REF '//LOG_FILE(1:LOGFILE_SIZE)) ENDIF ENDIF C C Tell the user we're exiting. C IF (.NOT. UNIX_MODE) THEN CALL WRITE_USER ('*** Exiting ***'//SS) ENDIF CALL SYS$EXIT (%VAL(EXIT_STATUS)) ! Exit with the status. END SUBROUTINE HANGUP_MODEM C C This routine is called to hangup the modem. C INCLUDE 'COM.INC/NOLIST' IF (.NOT. REMOTE_ASSIGNED) RETURN ! Don't have a remote port. C CALL SETUP_REMOTE(.TRUE.) ! Establish the remote status. IF (MODEM) THEN MODEM_ONLINE = .FALSE. ! Show the modem is offline. REMOTE = .FALSE. ! Show the modem is hungup. REMOTE_STATUS = SYS$QIOW(%VAL(REFN_IN),%VAL(RCHAN_IN), 1 %VAL(IO$_SETMODE + IO$M_HANGUP), 1 RIOSB,,,,,,,,) CALL CHECK_STATUS ('HANGUP_MODEM', REMOTE_STATUS) ELSE RETURN ! Not a modem. ENDIF C C If we're not exiting, wait for DTR to return so autodial will C work properly. If we don't wait for DTR to return, the terminal C driver returns the error "dataset hang-up" on the next read. C IF (AUTODIAL) THEN IF (EXITING) THEN IF ( (AUTODIAL_TYPE .EQ. RIXON) .OR. 1 (AUTODIAL_TYPE .EQ. R212A) ) THEN CALL WAITABIT ('04.0') ! Must wait for signoff. ENDIF ELSE CALL WAITABIT ('04.0') ! Wait for DTR to return. ENDIF C C If using an autodial modem, reset the modem for the next time. C IF ( (AUTODIAL_TYPE .EQ. RIXON) .OR. 1 (AUTODIAL_TYPE .EQ. R212A) ) THEN CALL SIGNOFF_RIXON() ! Signoff the RIXON modem. ELSEIF (AUTODIAL_TYPE .EQ. VENTEL) THEN CALL SIGNOFF_VENTEL() ! Signoff the VENTEL modem. ENDIF ENDIF RETURN END