	SUBROUTINE SETTRAP
	IMPLICIT INTEGER(A-Z)
	INTEGER*4 icode, ttchan, iosb(4)
	CHARACTER terminal*11 /'SYS$COMMAND'/

	EXTERNAL BRKCTRAP, BRKYTRAP
	INCLUDE '($IODEF)'
	INCLUDE '($SSDEF)'
C
C	Open terminal channel.
C
	icode = SYS$ASSIGN(terminal,ttchan,,)
	If (.not.icode) CALL LIB$STOP(%VAL(icode))
C
C	Set trap for CTRL-Y.
C
	Yfunc = IO$_SETMODE .or. IO$M_CTRLYAST
	icode = SYS$QIOW(%VAL(1),%VAL(ttchan),%VAL(Yfunc),IOSB,,,
     +                   brkYtrap,ttchan,,,,)
	If (.not.icode) CALL LIB$STOP(%VAL(icode))
	If (.not.iosb(1)) CALL LIB$STOP(%VAL(iosb(1)))
C
C	Set trap for CTRL-C.
C
	Cfunc = IO$_SETMODE .or. IO$M_CTRLCAST
	icode = SYS$QIOW(%VAL(1),%VAL(ttchan),%VAL(Cfunc),IOSB,,,
     +                   brkCtrap,ttchan,,,,)
	If (.not.icode) CALL LIB$STOP(%VAL(icode))
	If (.not.iosb(1)) CALL LIB$STOP(%VAL(iosb(1)))
C
	return
	end
