From:	SMTP%"MACRO32%WKUVX1.BITNET@uu7.psi.com"  7-MAY-1993 09:33:21.56
To:	EVERHART
CC:	
Subj:	OPCOM stuff:  ENABLE_USING_NEW_OPCOM.FOR (New OPCOM interface.)

Message-Id: <9305070415.AA11214@uu7.psi.com>
X-Listname: "VMS Internals, MACRO, & BLISS Discussions" <MACRO32@WKUVX1.BITNET>
Warnings-To: <>
Errors-To: MacroMan%WKUVX1.BITNET@uu7.psi.com
Sender: MacroMan%WKUVX1.BITNET@uu7.psi.com
Date: Thu,  6 May 93 09:28 PST
From: "Derek S. Haining, Univ. of Washington, (206) 543-5579"
      <DEREK%MAX.BITNET@uu7.psi.com>
Reply-To: MACRO32%WKUVX1.BITNET@uu7.psi.com
Subject: OPCOM stuff:  ENABLE_USING_NEW_OPCOM.FOR (New OPCOM interface.)
To: MACRO32@WKUVX1.BITNET
Original_To:  JNET%WKUVX1::MACRO32


        PROGRAM ENABLE TEMPORARY TAPE OPERATOR !TERMINAL

        INCLUDE '($DVIDEF)      /NOLIST'
        INCLUDE '($OPCDEF)      /NOLIST'

! Structures for $GETJPI
        CHARACTER  *  12        the_user

        INTEGER    *   4        jpilist ( 4 ), SYS$GETJPI, pid
        INTEGER    *   2        jpiword ( 8 )

        EQUIVALENCE             ( jpilist, jpiword )
        EXTERNAL                JPI$_USERNAME

! *NEW* Structures for $SNDOPR
        STRUCTURE       /MESSAGE/
           UNION
              MAP
                BYTE            rqstcode, scope
                INTEGER   *  4  options
                INTEGER   *  4  rq_options
                INTEGER   *  4  attmask_1
                INTEGER   *  4  attmask_2       ! *unused* as of V5.4-1.
                INTEGER   *  4  rqstid
                INTEGER   *  4  uic
                CHARACTER * 16  terminal
              END MAP
              MAP
                CHARACTER * 42  string
              END MAP
           END UNION
        END STRUCTURE

        RECORD  /MESSAGE/       msgbuf

        INTEGER * 4     terminal_length
        INTEGER * 4     status
        INTEGER * 4     LIB$GETDVI
        INTEGER * 4     SYS$SNDOPR

C  -------------------------------------------------------

        JPIWORD ( 1 )  =  LEN  ( the_user )
        JPIWORD ( 2 )  =  %LOC ( JPI$_USERNAME )
        JPILIST ( 2 )  =  %LOC ( the_user )
        JPILIST ( 3 )  =  0
        JPILIST ( 4 )  =  0


        status = SYS$GETJPI ( ,,,JPILIST,,, )
        IF (.NOT. status) CALL SYS$EXIT (%VAL (status))

        IF ((the_user .NE. 'PREVIEW     ') .AND.
     >      (the_user .NE. 'DEREK       ')) CALL EXIT

!  Format the operator request.
        msgbuf.rqstcode   = 10
        msgbuf.scope      = 1   ! System
        msgbuf.options    = 0
        msgbuf.rq_options = 0   ! 0 = Enable temporary operator
                                ! 1 = Disable operator
                                ! 2 = Enable permanent operator
                                ! 4 = "no remind"
        msgbuf.attmask_1  = OPC$M_NM_TAPES
        msgbuf.attmask_2  = 0
        msgbuf.rqstid     = 0
        msgbuf.uic        = 0

        status = LIB$GETDVI (DVI$_FULLDEVNAM,, 'SYS$OUTPUT',,
     >                       msgbuf.terminal, terminal_length)
        IF (.NOT. status) CALL LIB$SIGNAL (%VAL (status))

!  Shift the device name right one byte to create a counted string.
        msgbuf.terminal (2:)  = msgbuf.terminal (1:terminal_length)
        msgbuf.terminal (1:1) = CHAR (terminal_length)

!  Enable the terminal
        status = SYS$SNDOPR (msgbuf.string,)
        CALL SYS$EXIT (%VAL (status))

        END
