	.title	getjpi Job Info for quota info
	.sbttl	documentation
	.ident	/V3.05/
	.disable traceback, debug
;
;  GETJPI  -  for EYE, originally from FINGER
;
;    Inputs -
;
;	@4(ap) - Address of PID
;
;    Outputs -
;
;	@8(ap)  - Terminal name
;	@12(ap) - Terminal name length
;	@16(ap) - UIC Group
;	@20(ap) - UIC Member
;	@24(ap) - Oper priv logical
;       @28(ap) - Pid
;
	$ssdef
	$jpidef
	$prvdef
;
	.sbttl	main code
	.psect	$code, nowrt, exe, long, pic, shr
;
	.macro	movdsc src, length, buff, ?l1, ?l2
	movl	src, r1
	beql	l1
	movw	(r1), length
	beql	l1
	addl	#4, r1
	moval	@(r1), buff
	brb	l2
l1:	clrl	buff
l2:	.endm	movdsc

	.entry	getjpi, ^m<r2>
;
	cmpw	#7, (ap)		; check if correct number of args
	bleq	5$			; continue if no problem
	movl	#ss$_insfarg, r0	; load r0 w/ error message
	brw	20$			; and go back home

5$:	moval	8(ap), r0		; get address of second argument in r0
	movdsc	(r0)+, tln, tnam	; retrieve terminal name
	movl	(r0)+, tnamln		; ... length of it, if wanted
	movl	(r0)+, grp		; ... group number
	movl	(r0)+, mem		; ... member
	movl	(r0)+, r2		; ... priv mask
	movl    (r0)+, pid		; ... finally, my PID

	$getjpiw_s  pidadr=@4(ap), -	; do the lookup with the lookup PID
		    itmlst=getlst	; this is the list of items to get

	mnegl	#1, (r2)		; assume oper priv
	bbs	#prv$v_oper, priv, 20$	; keep this assumtion if currenly using
	bbs	#prv$v_oper, ppriv, 20$	; temp oper, or authorized to have it
	clrl	(r2)			; if neither of those is true, no oper

20$:	ret				; and return home!!!
;
	.sbttl	Buffers for the getjpi call
	.page
	.psect	$local, long, noexe, wrt, pic
;
getlst:
	.word	4		; Length of grp buffer
	.word	jpi$_grp	; Request code
grp:	.long	0		; Grp address
	.long	0		; length not needed
;
	.word	4		; Length of mem buffer
	.word	jpi$_mem	; Request code
mem:	.long	0		; Mem address
	.long	0		; Length not needed
;
	.word	8		; Length of priv mask
	.word	jpi$_authpriv	; Request code - authorized privs
	.address priv		; Priv mask address
	.long	0		; Length not needed
;
	.word	8		; Length of priv mask
	.word	jpi$_procpriv	; Request code - process privs
	.address ppriv		; Priv mask address
	.long	0		; Length not needed
;
tln:	.word	15		; Length of terminal name
	.word	jpi$_terminal	; Request code
tnam:	.long	0		; Terminal name address
tnamln:	.long	0		; Terminal name length
;
	.word	4		; Length of pid
	.word	jpi$_pid	; Request code
pid:	.long	0		; Pid address
	.long	0		; Length not needed
;
	.long	jpi$c_listend	; end of list
;
priv:	.quad	0		; auth priv mask location
ppriv:	.quad	0		; proc priv mask location
;
	.end
