! ----- GETJPI.FUN ----- ! ! ----- SUBROUTINE TO GET JOB INFO FOR THE NUSER PROGRAM ----- ! ! ---------- RETURNED: ---------- ! ! ----- PRIVILEGED = TRUE if user has SETPRV privilege ! ----- BYPASS_ON = TRUE if BYPASS privilege is turned on ! ----- SYSPRV_ON = TRUE if SYSPRV privilege is turned on ! ----- UIC = UIC of person who is running this program ! ----- THE_USERNAME = Username of person who is running program ! ----- USERNAME_LENGTH = Length of THE_USERNAME ! ! ----- Last Change 07/16/93 by Brian Lomasky ----- ! SUB GETJPI %INCLUDE "NUSER.INC" %INCLUDE "$PRVDEF" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET.TLB" ! ----- SYSTEM SERVICE ERROR CODES AND FUNCTION VALUES ----- EXTERNAL LONG CONSTANT JPI$_AUTHPRIV ! AUTHORIZED PRIVILEGES EXTERNAL LONG CONSTANT JPI$_CURPRIV ! CURRENT PRIVILEGES EXTERNAL LONG CONSTANT JPI$_UIC ! UIC FOR $GETJPIW EXTERNAL LONG CONSTANT JPI$_USERNAME ! USERNAME FOR $GETJPIW RECORD JPIBUF ! $GETJPIW RECORD WORD BUFFER_LENGTH1 WORD ITEM_CODE1 LONG BUFFER_ADDRESS1 LONG RETURN_LENGTH_ADDRESS1 WORD BUFFER_LENGTH2 WORD ITEM_CODE2 LONG BUFFER_ADDRESS2 LONG RETURN_LENGTH_ADDRESS2 WORD BUFFER_LENGTH3 WORD ITEM_CODE3 LONG BUFFER_ADDRESS3 LONG RETURN_LENGTH_ADDRESS3 WORD BUFFER_LENGTH4 WORD ITEM_CODE4 LONG BUFFER_ADDRESS4 LONG RETURN_LENGTH_ADDRESS4 LONG LIST_TERMINATOR END RECORD JPIBUF DECLARE WORD AUTHPRIV_LENGTH ! LENGTH OF AUTHPRIV() DECLARE WORD CURPRIV_LENGTH ! LENGTH OF CURPRIV() DECLARE JPIBUF JPIITEM ! EQUATE $GETJPIW RECORD DECLARE LONG LOCAL_STATUS ! LOCAL SYSTEM SERVICE EXIT STAT DECLARE WORD UIC_LENGTH ! LENGTH OF UIC ! ----- MAPPED VARIABLE FOR SYS$GETJPIW SYSTEM SERVICE ----- MAP (JPIMAP) LONG AUTHPRIV(1%), ! AUTHORIZED PRIVILEGES & LONG CURPRIV(1%) ! CURRENT PRIVILEGES EXTERNAL LONG FUNCTION & SYS$GETJPIW ! GET JOB INFORMATION AND WAIT JPIITEM::BUFFER_LENGTH1 = 4% JPIITEM::ITEM_CODE1 = JPI$_UIC JPIITEM::BUFFER_ADDRESS1 = LOC(UIC) JPIITEM::RETURN_LENGTH_ADDRESS1 = LOC(UIC_LENGTH) JPIITEM::BUFFER_LENGTH2 = 8% JPIITEM::ITEM_CODE2 = JPI$_AUTHPRIV JPIITEM::BUFFER_ADDRESS2 = LOC(AUTHPRIV(0%)) JPIITEM::RETURN_LENGTH_ADDRESS2 = LOC(AUTHPRIV_LENGTH) JPIITEM::BUFFER_LENGTH3 = 8% JPIITEM::ITEM_CODE3 = JPI$_CURPRIV JPIITEM::BUFFER_ADDRESS3 = LOC(CURPRIV(0%)) JPIITEM::RETURN_LENGTH_ADDRESS3 = LOC(CURPRIV_LENGTH) JPIITEM::BUFFER_LENGTH4 = 12% JPIITEM::ITEM_CODE4 = JPI$_USERNAME JPIITEM::BUFFER_ADDRESS4 = LOC(THE_USERNAME) JPIITEM::RETURN_LENGTH_ADDRESS4 = LOC(USERNAME_LENGTH) JPIITEM::LIST_TERMINATOR = 0% LOCAL_STATUS = SYS$GETJPIW(, , , JPIITEM, , , ) IF LOCAL_STATUS <> SS$_NORMAL THEN PRINT "Unexpected GETJPI Error" CALL LIB$STOP(LOCAL_STATUS BY VALUE) END IF ! ----- CHECK STATUS OF USER'S SETPRV PRIVILEGE ----- IF (AUTHPRIV(0%) AND PRV$M_SETPRV) > 0% THEN PRIVILEGED = TRUE ! SET SETPRV FLAG ELSE PRIVILEGED = FALSE ! CLEAR SETPRV FLAG END IF ! ----- CHECK STATUS OF USER'S BYPASS PRIVILEGE ----- IF (CURPRIV(0%) AND PRV$M_BYPASS) <> 0% THEN BYPASS_ON = TRUE ! BYPASS PRIVILEGE IS ON ELSE BYPASS_ON = FALSE ! BYPASS IS NOT ON END IF ! ----- CHECK STATUS OF USER'S SYSPRV PRIVILEGE ----- IF (CURPRIV(0%) AND PRV$M_SYSPRV) <> 0% THEN SYSPRV_ON = TRUE ! SYSPRV PRIVILEGE IS ON ELSE SYSPRV_ON = FALSE ! SYSPRV IS NOT ON END IF END SUB