;-*-Midas-*-

	Title :JOBS - List users in groups of job-type

A=1	;General porpoise
B=2
C=3
D=4
E=5
F=6
G=7
T1=10
T2=11
T3=12
P=17

Call=PUSHJ P,
Return=POPJ P,

TTYo==1
DSKi==2

PDLen==10
MaxUsr==250.

MapLoc==5
MapTop==177
MapLen==MapTop-MapLoc+1

 ;;;
;;;;;
 ;;;

Define SYSCAL op,args
	.Call [Setz ? Sixbit /op/ ? args ((Setz))]
	Termin

 ;;;
;;;;;
 ;;;

PDList:	-PDLen,,PDList
	Block PDLen

Who:	Block MaxUsr
What:	Block MaxUsr
Flag:	Block MaxUsr
UAOBJN:	0

NFunny:	-1
Funny:	Block MaxUsr

NCT:	0
TTYSTS:	0
UNAME:	0
XJNAME:	0

Define DEFCAT &string&,list
	[ASCIZ string],,[
    IRP jname,,[list]
	SIXBIT /jname/
    TERMIN
	0]
Termin

Groups:	DEFCAT /  TopLevel/,[DDT,HACTRN,HACRTN,SHELL,D]
	DEFCAT /     Batch/,[BATCH]
	DEFCAT /TTYSupport/,[CRTSTY,NCRTST,SLOSTY,OCRTST]
	DEFCAT /   Diredit/,[DIRED,NDIRED]
	DEFCAT /  FileDump/,[DUMP]
	DEFCAT /AquireData/,[CONSII]
	DEFCAT / File Xfer/,[FTP,CFTP]
	DEFCAT /FileCreate/,[CREATE,MAKE]
	DEFCAT /  TextEdit/,[EMACS,E,NEMACS,OEMACS,OE,XEMACS,TECO,T,NTECO,NE,XE,NT,TD,RMODE,MAILT,MACST,LISPT,LEDIT,EAKMAC,ECCMAC,NEX,EDIT]
	DEFCAT /      Send/,[SEND,LMSEND,S,QSEND,REPLY,MSEND,SSEND,FR,SS,RA,SA,PIX,FS]
	DEFCAT / ListUsers/,[JOBS,W,WHO,WHOJ,WHOM,U,UJ,WHO%,USERS]
	DEFCAT /  MailRead/,[BABYL,RMAIL,NBABYL,VBABYL,VMAIL,TRMAIL,NRMAIL,BABYL,B,BABYLM,ER,EV,READER,BFJW,NREADE,NRDR,QBABYL,ZBABYL]
	DEFCAT /    Finger/,[FINGER,NAME,WHEN,F,WHOARE,WHERES,N]
	DEFCAT /      Talk/,[TALK,UNTALK]
	DEFCAT /FileSearch/,[FIND,COMB]
	DEFCAT /Host Check/,[HOSTAT,HOSTAB]
	DEFCAT /   Student/,[TEACHE,TEACHM,TEACHL]
	DEFCAT /Randomness/,[FOO,BAR,FOOBAR,BAZ,MOOWAH]
	DEFCAT /  FileRead/,[VIEW]
	DEFCAT /LookupUser/,[LOOKUP,WHOIS]
	DEFCAT /      Peek/,[PEEK,P]
	DEFCAT /   Macsyma/,[A,MACSYM,MAC,OMACSY,NMACSY,TM]
	DEFCAT /Net:SUPDUP/,[SUPDUP,SAIL,AI,DM,MC,ML]
	DEFCAT /Off_To_See/,[OZ]
	DEFCAT /Pseudo-TTY/,[PTY,STY]
	DEFCAT /      Mail/,[MAIL,QMAIL,M,BUG,FEATUR,NMAIL]
	DEFCAT /       Spy/,[OS,SN,QFT,!,SPY,SNOOP,RF]
	DEFCAT /  Spooling/,[XGPSPL]
	DEFCAT /:-=Magic=-/,[PANDA,KOALA,LOCK,PDSET,JCOPY]
	DEFCAT /      Lisp/,[LISP,L,XLISP,SL,Q,NIL,(),NILAID,FLAVOR,XL,SCHEME,FOL,MACLIS]
	DEFCAT / NewsPaper/,[AP,NYT]
	DEFCAT /   Justify/,[SCRIBE,XGPTEX,TEX,R,TJ6,R39,NR40,PUB,R40,TXJ,XTEX,NTEX,TEXCM]
	DEFCAT /SettingTTY/,[TCTYP,STTY]
	DEFCAT / LM System/,[LMS,XLMS]
	DEFCAT /Net:TELNET/,[MULTIX,MULTIC,MULT,MUL,TN,XX,RSEXEC,TELSUP,TELNET,LL,SRI,EE,CMUA,CMUB,CHTN,EECS]
	DEFCAT /    Wisdom/,[LIMERI,.,SOLONG,BYE,QUOTE]
	DEFCAT /FylCompare/,[SRCCOM]
	DEFCAT /     Clock/,[DC,CROCK,TIME,TIMOON,DATE,C,DATES,TIMES,DCROCK]
	DEFCAT /     Print/,[PR,LPX]
	DEFCAT /QueuePrint/,[DOVER,XGP,SCAN]
	DEFCAT /Show PRESS/,[DPRESS,NDPRES]
	DEFCAT /  Assemble/,[MIDAS,PDP11]
	DEFCAT /   Compile/,[COMPLR,QN,QC,CL,VASL,NVASL]
	DEFCAT /  Download/,[LMODEM,UPL,DOWNL,UP,DOWN,EM,MMODEM]
	DEFCAT /  SelfHelp/,[INFO,UUO,CALL,DDTDOC,H]
	DEFCAT /   Inquire/,[INQUIR,INQCHK]
	DEFCAT /     Games/,[ADVENT,ZORK,DOCTOR,.GO,.CHESS,.CHES2,.THINK,.YAHTZ,BKG,.BACKG,.WA,.ORTH.,.JOTTO,JOTTO,.NIMLN,.MCTRK,.QUBIC,.STONE,.SPRT.,.DOC.,.PSYCH,.ANIML,ANIMAL,WUMPUS,.WUMP,.SEX.,ADV,.ADV.,GAMES,GAME,O]
	DEFCAT /SpellCheck/,[SPELL]
	DEFCAT /   MemoPad/,[MEMO]
	DEFCAT /  Muddling/,[MUDDLE,MU,MDL,MUDSUB,COMBAT]
	DEFCAT /  Planning/,[PLAN]
	DEFCAT /  Rubiking/,[CUBE]
	DEFCAT / Directory/,[FDIR]
nGroup==.-Groups

 ;;;
;;;;;
 ;;;

Begin:	Move P,PDList
	Syscal OPEN,[%Clbit,,.uao
		     %Climm,,TTYo
		     [Sixbit /TTY/]]
	  .Lose %LsSys
	Move T1,[Squoze 0,NCT]
	.Eval T1,
	  .Lose
	Movem T1,NCT
	Move T2,[Squoze 0,TTYSTS]
	.Eval T2,
	  .Lose
	Add T2,[(A)]	;Indexed by A
	Movem T2,TTYSTS
	Move T3,[Squoze 0,XJNAME]
	.Eval T3,
	  .Lose
	Add T3,[(B)]	;" by B
	Movem T3,XJNAME
	Move A,[Squoze 0,UNAME]
	.Eval A,
	  .Lose
	Add A,[(B)]
	Movem A,UNAME

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;	Inhale the Unames and XJnames of all the users
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

MapSys:	Syscal CORBLK,[%Climm,,%Cbndr
		       %Climm,,%Jself
		     [-MapLen,,MapLoc]
		       %Climm,,%Jsnum]
	 .Value [Ascii /: System map failed? KILL /]
	Movei A,2	;Start at T02
	Setz C,
GetUnm:	Hrre B,@TTYSTS
	Jumple B,NxtUnm
	Hlrz T1,@TTYSTS
	Trnn T1,1
	  Jrst NxtUnm
	Move T1,@UNAME
	Movem T1,Who(C)
	Move T2,@XJNAME
	Movem T2,What(C)
	Addi C,1
NxtUnm:	Addi A,1
	Camg A,NCT
	  Jrst GetUnm
	Movss C
	Movns C
	Movem C,UAOBJN

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;	Now we try and match XJnames.  If we find a match,
;;;	then Flag = Group#, else Flag = -Funny#
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	Move B,UAOBJN
Peg:	Move T1,What(B)		;xj
	Movsi A,-nGroup
Peg0:	Hrrz D,Groups(A)	;Address of first jname
Loop:	Skipn (D)		;No more in group?
	  Jrst NextGroup	;  Nope, so try next.
	Came T1,(D)
	  Aoja D,Loop
Match:	Hrrzm A,Flag(B)
	Jrst NextUname

NextGr:	Aobjn A,Peg0
NoMach:	Skipge A,NFunny
	  Jrst NoM2
NoM1:	Camn T1,Funny(A)
	  Jrst NoM3
	Sojge A,NoM1
NoM2:	Aos A,NFunny
	Movem T1,Funny(A)
NoM3:	Movns A
	Subi A,1
	Movem A,Flag(B)
NextUn:	Aobjn B,Peg

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;	Now we have all the data we need, and it's time to print
;;;	it out all nice and spiffy-looking.
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

PInit:	Move A,UAOBJN
PLoop:	Skipn Who(A)
	  Jrst NextPL
	Skipge C,Flag(A)
	  Jrst Random
	Hlrz T1,Groups(C)
	Hrli T1,440700
	Movei T2,10.
	Syscal SIOT,[%Climm,,TTYo ? T1 ? T2]
	  .Lose %LsSys
P2:	.Iot TTYo,[":]
	.Iot TTYo,[" ]
	Move T1,Who(A)
	Call 6Type
	Setzm Who(A)
	Move D,UAOBJN
Others:	Skipn Who(D)
	  Jrst NextO
	Came C,Flag(D)
	  Jrst NextO
	.Iot TTYo,[" ]
	Move T1,Who(D)
	Call 6Type
	Setzm Who(D)
NextO:	Aobjn D,Others
Whew:	.Iot TTYo,[^M]
	Jrst NextPL

Random:	Setz D,
	Move T1,What(A)
RanFoo:	Setz T2,
	Rotc T1,6
	Aoj D,
	Jumpn T1,RanFoo
	Movei E,10.
	Sub E,D
	.Iot TTYo,[" ]
	Sojn E,.-1
	Move T1,What(A)
	Call 6Type
	Jrst P2

NextPL:	Aobjn A,PLoop
Die:	.Logout 1,

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

6Type:	Setz T2,
	Rotc T1,6
	Addi T2,40
	.Iot TTYo,T2
	Jumpn T1,6Type
	Return

	END BEGIN