 	PROGRAM setterm
C Program to setup a terminal using the PS shared routines for CRT support
C    LOGICAL UNIT ASSIGNMENTS:
C	1	LO	TERMINAL OUTPUT
C	2	LI	TERMINAL INPUT
	include 'setterm.common/list'
        INTEGER  DEVCLASS, LIB$GETDVI,status
	EXTERNAL SS$_NORMAL,DC$_TERM,DVI$_DEVCLASS,DSC$K_DTYPE_F
	character*50 string
	integer len
	OPEN(unit=lo,file='sys$output',status='new')
	OPEN(unit=li,file='sys$input',status='new')
C Check if we are running from a terminal?
	PROMPT = .FALSE.
	STATUS = LIB$GETDVI(%LOC(DVI$_DEVCLASS),,
	1	'SYS$INPUT',DEVCLASS,string,len)
	IF (STATUS .EQ. %LOC(SS$_NORMAL) .and. DEVCLASS .eq. %LOC(DC$_TERM)) 
	1	PROMPT = .TRUE.
C if this is a terminal, prompt for graphics type
	ICRT = 0
	IF (PROMPT) CALL SETCRT(ICRT,lo,li,ANSI)
	end
