Trailing-Edge
-
PDP-10 Archives
-
bb-x130a-sb
-
whousr.mac
There are no other files named whousr.mac in the archive.
TITLE USRSCN - USER mode scan defaulting for WHO
SEARCH WHOMAC
$SETUP (USRSCN)
Comment |
This module provides the USER mode specific scan defaulting code. Its
only entry point is USRSCN.
|
; TABLE OF CONTENTS FOR USRSCN
;
;
; SECTION PAGE
; 1. USRSCN - Apply user mode specific scan input defaults..... 3
; 2. STORAGE................................................... 4
SUBTTL USRSCN - Apply user mode specific scan input defaults
USRSCN::
;
;Here to fix up name and extension (can be PPN, or name)
;
SKIPE T1,.FXEXT(I) ;SEE IF EXTENSION GIVEN
JRST [CAIN T1,-1 ;YES--INSURE JUST EXTENSION
SKIPE .FXNAM(I) ;AND NO NAME
JRST E$$EIC ;BECAUSE THATS BAD
MOVE T1,MYPPN## ;GET USERS PPN
CHKSWT (PPN) ;SEE IF GIVEN
JRST .+1] ;AND CONTINUE
SKIPN T1,.FXNAM(I) ;SEE IF NAME
JRST USRS.2 ;NO
SKIPE .FXEXT(I) ;YES--INSURE NO EXTENSION
$FATAL (EIC,<Extension illegal in this context>) ;NO--DIE
CHKSWT (NAME)
SETZM .FZNAM##+1(I) ;INDICATE ONLY 6 CHARS
;
;Here to fix up PPN specification
;
USRS.2: MOVX T1,FX.DIR ;GET DIRECTORY BIT
TDNN T1,.FXMOD(I) ;SEE IF GIVEN
JRST USRS.6 ;NO
MOVE T1,.FXDIR(I) ;GET PPN
TLNN T1,-1 ;SEE IF PROJ
HRROS .FXDIM(I) ;NO--CLEAR WILDCARDS
TLNN T1,-1 ;CHECK AGAIN
HLL T1,.MYPPN## ;NO--USE MINE
TRNN T1,-1 ;SEE IF PROG
HLLOS .FXDIM(I) ;NO--CLEAR WILDCARDS
TRNN T1,-1 ;CHECK AGAIN
HRR T1,.MYPPN## ;NO--USE MINE
CHKSWT (PPN)
MOVE T1,.FXDIM(I) ;GET MASK
MOVEM T1,.FZPPM##(I) ;STORE MASK
;Make mask out of /NAME:NAME switch
USRS.6: MOVE T3,.FZNAM##(I) ;GET NAME
CAMN T3,[SIXBIT/*/] ;FULL WILD?
MOVEI T3,0 ;YES--INDICATE THAT
PUSHJ P,.MKMSK## ;MAKE MASK
MOVEM T1,.FZNMM##(I) ;STORE
MOVE T3,.FZNAM##+1(I) ;..
PUSHJ P,.MKMSK## ;..
MOVEM T1,.FZNMM##+1(I) ;..
POPJ P, ;AND RETURN
SUBTTL STORAGE
$LOW
PRGEND
TITLE USRGET - Get user information
SEARCH WHOMAC,ACTSYM
$SETUP (USRGET)
IFN FTIPC,<SEARCH TSGSYM>
;Define the ACCT.SYS fields we use
DEFINE ACTFLD,<
XX PPN
XX NM1
XX NM2
XX LIT
XX PSW
XX PRV
XX CIP
XX PRO
XX PGM
XX DEV
XX DIR
XX ESE
XX CNO
IFN FTIPC,<
XX CST
>
>
; TABLE OF CONTENTS FOR USRGET
;
;
; SECTION PAGE
; 1. Main USR routines
; 1.1 USRNXT - Get the next user........................ 3
; 1.2 USRSET - Setup for a new user..................... 4
; 1.3 USRINC - Handle incremental statistics............ 5
; 1.4 USRSRT - Handle user sorting...................... 6
; 1.5 GETUSR - Read SYS:ACCT.SYS........................ 7
; 2. Subroutines
; 2.1 OPNACT - Open STD:ACCT.SYS........................ 8
; 2.2 REDACT - Read a word from STD:ACCT.SYS............ 9
; 2.3 CORACT - Get core for tables...................... 10
; 3. USR tables
; 3.1 Define all user subfields......................... 11
; 3.2 Routines to fetch all subfields................... 12
; 4. DATA STORAGE.............................................. 13
SUBTTL Main USR routines -- USRNXT - Get the next user
USRNXT::JUMPL O,USRN.1 ;JUMP IF THE FIRST TIME
SKIPL S.SORT## ;SEE IF /SORT
JRST SRTNXT ;YES--GET NEXT USR
ADDI O,1 ;NO--BUMP TO NEXT
CAMLE O,MAXUSR ;SEE IF PAST END
POPJ P, ;YES--RETURN
JRST USRN.2 ;NO--SETUP FOR THIS USR
USRN.1: SKIPN T1,MAXUSR ;SEE IF KNOWN
PUSHJ P,GETUSR ;NO--READ THE FILE IN
MOVEM T1,MAXUSR ;SAVE
MOVEI T1,^D10 ;SET A HASH TABLE LENGTH
MOVEI T2,^D2 ;AND SIZE OF ENTRY
PUSHJ P,.HASHI## ;INIT IT
MOVEI O,1 ;START WITH USR 1
SKIPL T1,S.SORT## ;GET /SORT
JRST USRSRT ;GO PROCESS IF GIVEN
USRN.2: PUSHJ P,USRSET ;SETUP FOR THIS USR
JRST USRNXT ;NOT ASSIGNED
JRST .POPJ1## ;AND RETURN
SUBTTL Main USR routines -- USRSET - Setup for a new user
USRSET::SKIPE JP,USRCOR ;SEE IF CORE ALLOCATED YET
JRST USRS.C ;YES
MOVEI T1,.UBLEN ;NO--GET SIZE
PUSHJ P,M$ALLOC## ;GET CORE
MOVEM T1,USRCOR ;SAVE STARTING ADDRESS
MOVEI JP,(T1) ;AND INTO JP
USRS.C: HRLI T1,(JP) ;GET STARTING ADDRESS
HRRI T1,1(JP) ;ENDING ADDRESS
SETOM (JP) ;SET FIRST WORD TO -1
BLT T1,.UBLEN-1(JP) ;AND SET THEM ALL TO -1
JRST .POPJ1## ;AND RETURN
SUBTTL Main USR routines -- USRINC - Handle incremental statistics
USRINC::
USRINJ: POPJ P, ;NONE FOR NOW
SUBTTL Main USR routines -- USRSRT - Handle user sorting
USRSRT: PUSHJ P,.SAVE1## ;SAVE P1
MOVEI P1,(T1) ;SAVE SORT INDEX
MOVE T1,MAXUSR ;GET MAX USRS
IMULI T1,2 ;2 WORD TABLE
MOVN T2,T1 ;NEGATE INTO T2
HRLZM T2,SRTTAB ;SAVE -N,,0
PUSHJ P,I$ALLOC## ;GET THE CORE
HRRM T1,SRTTAB ;SAVE START
SRTJ.1: PUSHJ P,USRSET ;SETUP FOR THIS USR
JRST SRTJ.2 ;NOT ASSIGNED
PUSHJ P,@SUMLOD##(P1) ;GET SORT KEY
MOVEI T2,-1(O) ;GET USR
IMULI T2,2 ;DOUBLE
ADD T2,SRTTAB ;PLUS START OF TABLE
MOVEM T1,(T2) ;SAVE SORT KEY FIELD
MOVEM O,1(T2) ;SAVE USR NUMBER
SRTJ.2: ADDI O,1 ;BUMP TO NEXT USR
CAMG O,MAXUSR ;ALL DONE?
JRST SRTJ.1 ;NO--ADVANCE TO NEXT
MOVE T1,SRTTAB ;GET AOBJN WORD
MOVE T2,[400000,,2] ;UNSIGNED AND STRAIGHT SORT
SKIPLE S.SORT##+1 ;SEE IF DESCENDING
TLO T2,200000 ;YES-SET FLAG
PUSHJ P,.SORT2## ;SORT THE LIST
MOVE T1,SRTTAB ;GET AOBJN
MOVEM T1,SRTPTR ;SAVE
SETZM SRTCNT ;NO USRS YET
JRST USRNXT ;AND BACK TO THE TOP
SRTNXT: SKIPL T1,SRTPTR ;GET POINTER
POPJ P, ;ALL DONE
SKIPN O,1(T1) ;GET USR NUMBER
JRST SRTN.1 ;NONE
PUSHJ P,USRSET ;SETUP FOR THIS USR
JRST SRTN.1 ;NOT ASSIGNED NOW?
AOS T1,SRTCNT ;COUNT THE USRS
CAMLE T1,S.SORT##+2 ;IN RANGE?
POPJ P, ;NO--STOP NOW
MOVE T1,[2,,2] ;ADVANCE POINTER
ADDM T1,SRTPTR ;TO NEXT PAIR
JRST .POPJ1## ;AND USE THAT J
SRTN.1: MOVE T1,[2,,2] ;ADVANCE POINTER
ADDM T1,SRTPTR ;TO NEXT PAIR
JRST SRTNXT ;AND GET NEXT
SUBTTL Main USR routines -- GETUSR - Read SYS:ACCT.SYS
DEFINE XX(ARG),<
CAIN P2,.AC'ARG ;;AT ARG?
MOVEM T1,@ARG'TAB ;;YES--SAVE
>;END DEFINE XX
GETUSR: PUSHJ P,.SAVE3## ;SAVE P1-P3
PUSHJ P,OPNACT ;Open the file
PUSHJ P,REDACT ;Read a word
JRST E$$UER ;Unexpected EOF
LOAD T2,T1,AC.VRS ;GET VERSION
CAXE T2,.ACCVN ;WHAT WE EXPECT?
$FATAL (UVN,<Unexpected ACCT.SYS version number >,E.UVN) ;NO
LOAD P3,T1,AC.LEN ;GET ENTRY LENGTH
MOVEI T1,(P3) ;GET ENTRY SIZE
PUSHJ P,CORACT ;BUILD CORE FOR TABLES
PUSH P,T1 ;SAVE ENTRY COUNT
MOVN O,T1 ;GET -N
HRLZS O ;GET -N,,0
ADDI O,1 ;START WITH 1..N
GETU.O: MOVN P1,P3 ;GET -N
HRLZS P1 ;MAKE -N,,0
MOVEI P2,0 ;CLEAR COUNTER
GETU.L: PUSHJ P,REDACT ;READ A WORD
$FATAL (UER,<Unexpected end-of-file reading STD:ACCT.SYS>)
ACTFLD ;EXPAND ALL THE FIELDS NEEDED
ADDI P2,1 ;COUNT
AOBJN P1,GETU.L ;LOOP FOR THIS ENTRY
AOBJN O,GETU.O ;LOOP FOR ALL ENTRIES
POP P,T1 ;RESTORE COUNT
POPJ P, ;AND RETURN
E.UVN: MOVE T1,T2 ;COPY BAD VERSION
PUSHJ P,.TOCTW## ;TYPE
MOVEI T1,[ASCIZ/; expected /] ;TEXT
PUSHJ P,.TSTRG## ;TYPE
MOVX T1,.ACCVN ;GET WHAT WE WANTED
PJRST .TOCTW## ;TYPE AND RETURN
SUBTTL Subroutines -- OPNACT - Open STD:ACCT.SYS
OPNACT: MOVX T1,FO.PRV!FO.ASC!.FORED ;READ WITH PRIVS, EXTENDED CHANNEL
MOVEM T1,A.FILOP+.FOFNC ;STORE
MOVX T1,.IOIMG!UU.PHS ;IMAGE/PHYSICAL
MOVEM T1,A.FILOP+.FOIOS ;STORE MODE
MOVSI T1,'STD' ;DEVICE
MOVEM T1,A.FILOP+.FODEV ;STORE
MOVEI T1,A.BUF ;POINT TO BUFFERS
MOVEM T1,A.FILOP+.FOBRH ;STORE
MOVEI T1,-1 ;STANDARD BUFFERS
MOVEM T1,A.FILOP+.FONBF ;STORE
MOVEI T1,A.LOOK ;LOOKUP BLOCK
MOVEM T1,A.FILOP+.FOLEB ;SAVE
MOVEI T1,LN$LEN-1 ;GET LOOKUP LENGTH
MOVEM T1,A.LOOK+.RBCNT ;SAVE
MOVE T1,[SIXBIT/ACCT/] ;FILE
MOVEM T1,A.LOOK+.RBNAM ;SAVE
MOVSI T1,'SYS' ;EXTENSION
MOVEM T1,A.LOOK+.RBEXT ;SAVE
SETZM A.LOOK+.RBPPN ;NO PPN
MOVEI T1,A.FILOP+.FOIOS ;POINT TO "OPEN" BLOCK
DEVSIZ T1, ;FIND DEVICE SIZE
MOVE T1,[2,,203] ;ASSUME 2 DISK BUFFERS
HLRZ T2,T1 ;GET NUMBER OF BUFFERS
TLZ T1,-1 ;CLEAR COUNT
IMULI T1,(T2) ;COMPUTE SIZE
PUSHJ P,C$ALLOC## ;ALLOCATE CORE
PUSH P,.JBFF ;SAVE .JBFF
MOVEM T1,.JBFF ;FAKE FILOP.
MOVE T1,[.FOLEB+1,,A.FILOP] ;GET ARG BLOCK
FILOP. T1, ;OPEN THE FILE
JRST OPNA.E ;ERROR
POP P,.JBFF ;RESTORE .JBFF
POPJ P, ;AND RETURN
OPNA.E: HRRM T1,A.LOOK+.RBEXT ;STORE ERROR CODE
MOVEI T1,A.FILOP ;POINT TO FILOP.
$FATAL (CRF,<>,.TERRF##) ;AND DIE
SUBTTL Subroutines -- REDACT - Read a word from STD:ACCT.SYS
REDACT: SOSGE A.BUF+.BFCNT ;SEE IF A WORD
JRST REDA.B ;NO--GET BUFFER
ILDB T1,A.BUF+.BFPTR ;YES--GET WORD
JRST .POPJ1## ;AND SKIP RETURN
REDA.B: MOVEI T2,.FOINP ;INPUT FUNCTION
STORE T2,A.FILOP+.FOFNC,FO.FNC;STORE
MOVE T2,[1,,A.FILOP] ;SINGLE ARG
FILOP. T2, ;DO THE READ
CAIA ;FAILED
JRST REDACT ;AND CONTINUE
TXNN T2,IO.ERR ;ANY ERRORS?
POPJ P, ;NO--EOF
MOVEI T1,A.FILOP ;YES--GET FILOP. BLOCK
$FATAL (ARE,<>,.TIERR##_) ;AND DIE
SUBTTL Subroutines -- CORACT - Get core for tables
DEFINE XX(ARG),<
MOVE T1,(P) ;;COPY CORE
PUSHJ P,M$ALLOC## ;;GET IT
HRLI T1,O ;;O FOR INDEXING
SUBI T1,1 ;;OFFSET (1..N)
MOVEM T1,ARG'TAB ;;SAVE FOR ARG
>;END DEFINE X
CORACT: MOVE T2,A.LOOK+.RBSIZ ;GET FILE SIZE
SUBI T2,2 ;MINUS HEADER AND ZERO ENTRY AT END
IDIV T2,T1 ;COMPUTE NUMBER OF ENTRIES
PUSH P,T2 ;SAVE
ACTFLD ;BUILD ALL TABLES
POP P,T1 ;RESTORE NUMBER OF ENTRIES
POPJ P, ;AND RETURN
SUBTTL USR tables -- Define all user subfields
;This macro fetches a sub-field about the user. If the field has been
;gotten before, it simply returns the known field. If the field has
;not been gotten before, it it derived/computed, stored for later
;use, and returned.
;
;In all cases, the field will be returned in T1, and set in table
;.UBxxx (flag UB%xxx indicates if the field has been gotten)
DEFINE UB$(X,N<1>),<
XLIST
UB%'X==.UBLEN ;;FLAG WORD
.UB'X==.UBLEN+1 ;;DATA WORD
.UBLEN==.UBLEN+2
IFG N-1,.UBLEN==.UBLEN+N
UB$'X:: AOSN UB%'X(JP) ;;DO WE HAVE THE INFO?
JRST UB1'X ;;NO--GO GET IT
MOVE T1,.UB'X(JP) ;;YES--JUST GET IT NOW
POPJ P, ;;AND RETURN
UB1'X: ;;(HERE TO GET INFO)
DEFINE END$,<
XLIST
MOVEM T1,.UB'X(JP) ;STORE
POPJ P, ;AND RETURN
LIST
>
LIST
>;END DEFINE
.UBLEN==0
SUBTTL USR tables -- Routines to fetch all subfields
UB$(NAM,2) ;USER NAME
MOVE T1,@NM1TAB ;GET FIRST PART
MOVEM T1,.UBNAM+1(JP) ;SAVE
MOVE T1,@NM2TAB ;GET SECOND PART
MOVEM T1,.UBNAM+2(JP) ;SAVE
MOVEI T1,.UBNAM+1(JP) ;POINT TO IT
END$
UB$(NM1) ;USER NAME (FIRST HALF)
PUSHJ P,UB$NAM ;GET FULL NAME
MOVE T1,(T1) ;GET FIRST PART
END$
UB$(PPN) ;PPN
MOVE T1,@PPNTAB ;GET PPN
END$
UB$(PPJ) ;PROJECT NUMBER
PUSHJ P,UB$PPN ;GET PPN
HLRZS T1 ;GET PROJECT
END$
UB$(PPG) ;PROGRAMMER NUMBER
PUSHJ P,UB$PPN ;GET PPN
HRRZS T1 ;GET PROGRAMMER
END$
UB$(NPP) ;NUMBER OF PHYSICAL PAGES
LOAD T1,@CIPTAB,AC.NPP ;GET NUMBER OF PHYSICAL PAGES
END$
UB$(NVP) ;NUMBER OF VIRTUAL PAGES
LOAD T1,@CIPTAB,AC.NVP ;GET NUMBER OF VIRTUAL PAGES
END$
UB$(SND) ;IPCF SEND QUOTA
LOAD T1,@CIPTAB,AC.SND ;GET SEND QUOTA
END$
UB$(RCV) ;IPCF RECEIVE QUOTA
LOAD T1,@CIPTAB,AC.RCV ;GET RECEIVE QUOTA
END$
UB$(WDH) ;LOGIN WEEKDAY HOURS
LOAD T1,@LITTAB,AC.WDH ;GET WEEKDAY HOURS
LSH T1,<1+<ALIGN.(AC.WDH)>+<POS(AC.WDH)>-<WID(AC.WDH)>>
END$
UB$(WEH) ;LOGIN WEEKEND HOURS
LOAD T1,@LITTAB,AC.WEH ;GET WEEKEND HOURS
LSH T1,<1+<ALIGN.(AC.WEH)>+<POS(AC.WEH)>-<WID(AC.WEH)>>
END$
UB$(PRV) ;PRIVS
MOVE T1,@PRVTAB ;GET PRIV WORD
END$
UB$(PSW) ;PASSWORD
MOVE T1,@PSWTAB ;GET PASSWORD
END$
UB$(WCH) ;WATCH
MOVEI T1,0 ;ASSUME /WATCH:NONE
MOVE T2,@PROTAB ;GET PROFILE BITS
LOAD T3,T2,AC.WDT ;DAYTIME
STORE T3,T1,JW.WDY
LOAD T3,T2,AC.WRT ;RUNTIME
STORE T3,T1,JW.WRN
LOAD T3,T2,AC.WWA ;WAIT
STORE T3,T1,JW.WWT
LOAD T3,T2,AC.RED ;DISK READS
STORE T3,T1,JW.WDR
LOAD T3,T2,AC.WRI ;DISK WRITES
STORE T3,T1,JW.WDW
LOAD T3,T2,AC.WVR ;VERSION
STORE T3,T1,JW.WVR
LOAD T3,T2,AC.WMT ;MTA
STORE T3,T1,JW.WMT
LOAD T3,T2,AC.WFL ;FILES
STORE T3,T1,JW.WFI
END$
UB$(SPL) ;SPOOL
MOVEI T1,0 ;ASSUME /SPOOL:NONE
MOVE T2,@PROTAB ;GET PROFILE WORD
LOAD T3,T2,AC.CDR ;CDR
STORE T3,T1,JS.PCR
LOAD T3,T2,AC.CDP ;CDP
STORE T3,T1,JS.PCP
LOAD T3,T2,AC.PTP ;PTP
STORE T3,T1,JS.PPT
LOAD T3,T2,AC.PLT ;PLT
STORE T3,T1,JS.PPL
LOAD T3,T2,AC.LPT ;LPT
STORE T3,T1,JS.PLP
END$
UB$(RMK) ;REMARK IS REQUIRED
LOAD T1,@PROTAB,AC.RMK
END$
UB$(ACT) ;ACCOUNT IS REQUIRED
LOAD T1,@PROTAB,AC.ACT
END$
UB$(LOC) ;LOGIN LOCAL
LOAD T1,@PROTAB,AC.LOC
END$
UB$(ROP) ;LOGIN REMOTE OPR OR CTY
LOAD T1,@PROTAB,AC.ROP
END$
UB$(DST) ;LOGIN DATA SET
LOAD T1,@PROTAB,AC.DST
END$
UB$(RMT) ;LOGIN REMOTE
LOAD T1,@PROTAB,AC.RMT
END$
UB$(SBJ) ;LOGIN SUBJOB OF A BATCH JOB
LOAD T1,@PROTAB,AC.SBJ
END$
UB$(BAT) ;LOGIN UNDER BATCH
LOAD T1,@PROTAB,AC.BAT
END$
UB$(NRT) ;NAME REQUIRED UNDER TIMESHARING
LOAD T1,@PROTAB,AC.NRT
END$
UB$(NRB) ;NAME REQUIRED UNDER BATCH
LOAD T1,@PROTAB,AC.NRB
END$
UB$(PRT) ;PASSWORD REQUIRED FOR TIMESHARING
LOAD T1,@PROTAB,AC.PRT
END$
UB$(PRB) ;PASSWORD REQUIRED FOR BATCH
LOAD T1,@PROTAB,AC.PRB
END$
UB$(GOP) ;GALAXY OPERATOR
LOAD T1,@PROTAB,AC.OPR ;GET OPERATOR CODE
END$
UB$(PGM) ;PROGRAM
MOVE T1,@PGMTAB ;GET PROGRAM NAME
END$
UB$(DEV) ;DEVICE
MOVE T1,@DEVTAB ;GET DEVICE NAME
END$
UB$(DIR) ;DIRECTORY
MOVE T1,@DIRTAB ;GET DIRECTORY
END$
UB$(PTR,3) ;PROGRAM TO RUN
PUSHJ P,UB$DEV ;GET DEVICE
MOVEM T1,.UBPTR+1(JP) ;SAVE IT
PUSHJ P,UB$PGM ;GET PROGRAM NAME
MOVEM T1,.UBPTR+2(JP) ;SAVE IT
PUSHJ P,UB$DIR ;GET DIRECTORY
MOVEM T1,.UBPTR+3(JP) ;SAVE IT
MOVEI T1,.UBPTR+1(JP) ;POINT TO IT
END$
UB$(EXP) ;EXPIRATION DATE
LOAD T1,@ESETAB,AC.EXP ;GET EXPIRATION DATE
END$
UB$(SCD) ;SCHEDULER TYPE
LOAD T1,@ESETAB,AC.SCD ;GET SCHEDULER TYPE
END$
UB$(EDQ) ;ENQ/DEQ QUOTAS
LOAD T1,@ESETAB,AC.EDQ ;GET ENQ/DEQ QUOTAS
END$
UB$(CNO) ;CHARGE NUMBER
MOVE T1,@CNOTAB ;GET CHARGE NUMBER
END$
IFN FTIPC,<
UB$(CST) ;COST CENTER
MOVE T1,@CSTTAB ;GET COST CENTER
END$
>
SUBTTL DATA STORAGE
$LOW
A.FILOP:BLOCK .FOLEB+1
A.LOOK: BLOCK LN$LEN
A.BUF: BLOCK 3
DEFINE XX(ARG),<
ARG'TAB: BLOCK 1
>;END DEFINE X
ACTFLD
USRCOR::BLOCK 1
MAXUSR: BLOCK 1
SRTTAB: BLOCK 1
SRTPTR: BLOCK 1
SRTCNT: BLOCK 1
END