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 CALL WRITE_USER('*** Don''t forget to HANGUP the modem. ***' 1 //BELL//SS) ENDIF ENDIF C C Remind user to deallocate the remote port if allocated. C IF (NEED_TO_DEAL) THEN CALL WRITE_USER ('*** Don''t forget to DEALLOCATE '// 1 '"'//REMOTE_DEVICE(1:REMOTE_SIZE)//'" ***'//SS) 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 CALL WRITE_USER ('*** Reformatting log file "'// 1 LOG_FILE(1:LOGFILE_SIZE)//'", please be patient. ***'//SS) CALL LIB$DO_COMMAND ('$ REF '//LOG_FILE(1:LOGFILE_SIZE)) ENDIF ENDIF C C Tell the user we're exiting. C CALL WRITE_USER ('*** Bye-bye ***'//SS) 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. NEED_TO_DEAS) RETURN ! Don't have a remote port. C CALL SETUP_REMOTE(.TRUE.) ! Establish remote status. IF (MODEM) THEN MODEM_ONLINE = .FALSE. ! Show modem is offline. REMOTE = .FALSE. ! Show 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 modem is not a RIXON, and we're not exiting, wait for DTR C to return so autodial will work properly (for REDIAL command). C IF (AUTODIAL) THEN C C In VMS V3.2, if we don't wait for DTR to return, the terminal C driver returns the error "dataset hang-up" on the next read. C C IF (AUTODIAL_TYPE .NE. RIXON) THEN C IF (.NOT. EXITING) THEN CALL WAITABIT('05.0') ! Wait for DTR to return. C ENDIF C ENDIF ENDIF C C If using an autodial modem, reset the modem for the next time. C IF (AUTODIAL) THEN IF (AUTODIAL_TYPE .EQ. DF03) THEN CALL WRITE_BYTE(SOH,1) ! CTRL/A to abort ACU. ELSEIF (AUTODIAL_TYPE .EQ. RIXON) THEN CALL SIGNOFF_RIXON() ! Signoff the RIXON. ENDIF ENDIF RETURN END