	SUBROUTINE FINI
C************************************************************
C
C  THIS SUBROUTINE IS USED IN THE EVENT OF AN
C  ERROR TERMINATION, DURING THE EXECUTION OF
C  "GIDUS" & "DISLIB". THIS ROUTINE PRINTS A
C  FINAL ERROR MESSAGE, AND CLOSES THE LOG FILE.
C
C  POSSIBLE ERRORS:
C	NONE
C
C  WARNING:
C	THIS ROUTINE STOPS THE PROGRAM. IF THIS IS
C	NOT DESIRED THE USER SHOULD CALL THE ROUTINE
C	"LOGOFF". NOTE THAT DISLIB WILL CALL THIS
C	SUBROUTINE IF IT DETERMINES THAT THE GT40 IS
C	HUNG
C
C  ROUTINES CALLED:
C	CLRTTY - COMPLEMENT OF ROUTINE SETTTY
C	SNDCHR - SENDS AN IMAGE BYTE TO THE GT40
C	LOGOFF - CLOSES THE LOG FILE
C
C************************************************************
	IMPLICIT INTEGER (A - Z)
	LOGICAL LOG
	COMMON /LOGBLK/ LOG, GTLOG, FATAL, WARN
	DATA GT40 /5/

1	FORMAT(' ? ',I4,' ERRORS,',I3,' FATAL, AND',I3,' WARNINGS.')
2	FORMAT(I4,' ERRORS,',I3,' FATAL, AND',I3,' WARNINGS.')

	CALL CLRTTY
	ERRORS = FATAL + WARN
	IF(ERRORS .EQ. 0) GO TO 100
	CALL SNDCHR(7)
	WRITE(GT40, 1) ERRORS, FATAL, WARN
100	IF(.NOT. LOG) STOP
	WRITE(GTLOG,2) ERRORS, FATAL, WARN
	IF(LOG) CALL LOGOFF
	STOP
	END
