mirror of
https://github.com/PDP-10/its.git
synced 2026-01-29 05:11:14 +00:00
Added LUSER: requests help from registered list of logged-in users.
This commit is contained in:
committed by
Lars Brinkhoff
parent
23da62bc58
commit
e5b40a0717
404
src/syseng/luser.85
Normal file
404
src/syseng/luser.85
Normal file
@@ -0,0 +1,404 @@
|
||||
;;;-*-MIDAS-*-
|
||||
|
||||
title HELP A TOTAL LUSER
|
||||
|
||||
|
||||
;; This less losing version written by RWK.
|
||||
;; Hacked 4/79 by RLB
|
||||
|
||||
|
||||
X=0 ;super-temporary non-index AC
|
||||
A=1
|
||||
b=2
|
||||
c=3 ;I/O channel for output routines.
|
||||
d=4
|
||||
e=5
|
||||
f=6
|
||||
t=7 ;temporary
|
||||
tt=10 ;temporary, and T+1
|
||||
j=11 ;JNAME we're looking for (I.e. HACTRN)
|
||||
H=13 ;pointer to helper
|
||||
M=14 ;offset for machine
|
||||
R=15 ;random pointer into the system
|
||||
U=16 ;pointer into the system for a job
|
||||
sp=17 ;stack pointer
|
||||
p=sp ;synonym for those of us who aren't RWK
|
||||
|
||||
tyoc==1 ;TTY output channel
|
||||
clic==2 ;CLI output channel
|
||||
dskc==3 ;DSK channel for inquir database
|
||||
|
||||
pjrst==jrst ;a JRST hack JRST, that ends in a RET
|
||||
call=pushj sp, ;nicer name for it.
|
||||
ret=popj sp,
|
||||
|
||||
sysloc=400000
|
||||
%jssys==400000 ;system job
|
||||
|
||||
define syscal a,b
|
||||
.call [setz ? sixbit/a/ ? b ? setz+errret+calerr] termin
|
||||
|
||||
argi==1000,,0
|
||||
val==2000,,0
|
||||
errret==3000,,0
|
||||
cnt==4000,,0
|
||||
cnti==5000,,0
|
||||
|
||||
define type &string
|
||||
move t,[440700,,[ascii string]]
|
||||
movei tt,<.length string>
|
||||
.call typebk
|
||||
.lose %lsfil
|
||||
termin
|
||||
|
||||
typebk: setz
|
||||
sixbit /SIOT/
|
||||
c ? t ? setz tt
|
||||
|
||||
iotblk: syscal iot,[c ? x]
|
||||
.lose %lsfil
|
||||
ret
|
||||
IOT=call iotblk
|
||||
|
||||
beg: move sp,pdl ;initialize the pdl
|
||||
call whoami ;find out who we are
|
||||
call syseval ;evaluate some system symbolic locations etc.
|
||||
|
||||
syscal open,[cnti .uao
|
||||
argi tyoc
|
||||
[sixbit /TTY/]]
|
||||
.lose %lsfil
|
||||
|
||||
|
||||
;; gotta do SSTATU since isn't symbolicly in the system!!!!!!!!!!!!!!!!
|
||||
syscal sstatu,[val x ? val x ? val x ? val x ? val x ? val itsnam]
|
||||
.lose %lssys
|
||||
|
||||
move t,itsnam ;get the ITS name
|
||||
movsi m,-itscnt
|
||||
came t,itstab(m) ; Find this machine, or the default
|
||||
aobjn m,.-1
|
||||
usrgo: setz r, ;prepare to map over the jobs
|
||||
setz u,
|
||||
move j,[sixbit /HACTRN/] ;for quick comparison
|
||||
usrlop: skipe @uname ;non-empty job slot?
|
||||
came j,@jname ; and a HACTRN?
|
||||
caia ; nope!
|
||||
call usrchk ; yep, go check him out, maybe he's one
|
||||
add u,lublk ;next job
|
||||
camg u,@usrhi ;still more jobs?
|
||||
jrst usrlop ; yes, try next
|
||||
|
||||
skipe helpsw ;all done, were we helped?
|
||||
jrst [movei c,tyoc ; switch typeout to the TTY
|
||||
type /
|
||||
Help has been sent for, please wait.
|
||||
/
|
||||
.logout 1,] ; yes, bye-bye
|
||||
skipe idlesw ;were there idle people?
|
||||
jrst [movei c,tyoc ; switch typeout to the TTY
|
||||
type /
|
||||
I am sorry, it looks as if all the helpers are away from their
|
||||
consoles. I'd suggest you wait 5 minutes, then try again.
|
||||
/
|
||||
.logout 1,]
|
||||
movei c,tyoc ;no, type on the TTY
|
||||
type /
|
||||
I am sorry, there is no one to help you at the moment.
|
||||
/
|
||||
.logout 1, ;bye-bye
|
||||
|
||||
usrchk: movsi h,-usrmax ;aobjn ptr to helpers
|
||||
skipn b,@xuname ;get his XUNAME
|
||||
ret ; huh? Can't allow 0 UNAME'...
|
||||
setom tellsw ;we tell him we asked
|
||||
|
||||
chklop: camn b,@hlptab(m) ;hlptab(m) -> xxHELP(H) -> sixbit /<helper>/
|
||||
pjrst usrhak ; it's him, go hack him!
|
||||
aobjn h,chklop ;not him, try next?
|
||||
ret ;not one of us!
|
||||
|
||||
usrhak: ;before we get too eager to send the message, find out whether
|
||||
;the helper offers help!
|
||||
skipn turist ;if we're not a turist, help is offered.
|
||||
jrst usrhk1
|
||||
move t,tbits(m) ;pick up turist refuse bits
|
||||
lsh t,(h) ;bit for this helper to sign
|
||||
jumpge t,usrhk1 ;if not refusing, help
|
||||
ret ;else no help.
|
||||
|
||||
usrhk1: syscal open,[cnti .uao ;open the CLI channel!
|
||||
argi clic
|
||||
[sixbit /CLI/]
|
||||
@uname ;helper UNAME
|
||||
[sixbit /HACTRN/]]
|
||||
ret ; gagged or gone!
|
||||
|
||||
movei c,clic ;change output channel to CLI channel
|
||||
move tt,runame ;get our uname!
|
||||
call 6type ;type it
|
||||
.iot clic,["@] ;@ a machine
|
||||
move tt,itsnam ;get the name of the machine
|
||||
call 6type ;and type it
|
||||
type / (T/ ;prettify
|
||||
ldb x,[030300,,ttynum] ;get first digit of our TTY #
|
||||
addi x,60 ;convert to ascii
|
||||
.iot clic,x ;type it
|
||||
ldb x,[000300,,ttynum] ;get second digit of our TTY #
|
||||
addi x,60 ;convert to ascii
|
||||
.iot clic,x ;type it
|
||||
.iot clic,[")] ;prettify
|
||||
.rdatim a, ;get the date & time
|
||||
exch a,b ;switch them into the correct order
|
||||
rot a,14 ;and make the year come last
|
||||
move tt,[440600,,a] ;get 6-bit bytp ptr to chars as date & time
|
||||
movei d,"/ ;get delimiter for first time word in D
|
||||
call timprt
|
||||
movei d,": ;get delimiter for HH:MM:SS in D
|
||||
call timprt ;print the rest
|
||||
type / Help me -- I am a luser.
|
||||
/
|
||||
.close clic, ;sent it off
|
||||
|
||||
move r,@utmptr ;get the ptr to the resource word for this
|
||||
sub r,usrrce ;tree and the offset in that table of
|
||||
;resource words is the TTY # !!!
|
||||
;(That's how .suset [.rcnsl,,] is computed!)
|
||||
caml r,nct ;is it disowned?
|
||||
ret ; yes, don't go any further
|
||||
move a,@time ;get the system time
|
||||
sub a,idlmax ;IDLMAX contains the maximum time before we
|
||||
;consider a user to be asleep!
|
||||
camg a,@ttitm ;is he idle?
|
||||
jrst [ setom helpsw ? ret] ;note we found an active helper
|
||||
setom idlesw ;note we found an idle helper
|
||||
movei c,tyoc ;switch output back to the TTY
|
||||
ret
|
||||
|
||||
whoami:
|
||||
.suset [.RUNAME,,RUNAME] ;get our UNAME
|
||||
.suset [.RXUNAM,,XUN] ;get our XUNAME
|
||||
.suset [.rcnsl,,ttynum] ;get our TTY number
|
||||
|
||||
;;Now ask the INQUIR data base about this user
|
||||
setzm turist ;assume it's not a turist
|
||||
hlrz t,runame
|
||||
cain t,(sixbit /___/) ; Not logged in?
|
||||
jrst lsrnli ; Assume he's a turist
|
||||
;;Get the data base mapped in
|
||||
movei a,dskc
|
||||
move b,[-77,,frepag] ;aobjn to free page range
|
||||
pushj p,lsrtns"lsrmap ;try to map in the data base
|
||||
jrst lsrluz ;no skip if it lost
|
||||
;;Find our entry
|
||||
movei a,dskc
|
||||
move b,xun ;xuname
|
||||
pushj p,lsrtns"lsrunm ;find the entry, addr in B if found
|
||||
jrst lsrluz
|
||||
;;Find out if a turist or unknown
|
||||
pushj p,lsrtns"lsrtur ;skip if turist or unknown
|
||||
caia
|
||||
lsrnli: setom turist ;set flag saying we're a turist
|
||||
lsrluz: .close dskc,
|
||||
ret
|
||||
|
||||
syseval:
|
||||
;;; evaluate all the system symbolic locations
|
||||
movsi t,-.symbt
|
||||
symev: move tt,symbt(t)
|
||||
.eval tt,
|
||||
.lose
|
||||
aos t
|
||||
addi tt,sysloc
|
||||
movem tt,symbt(t)
|
||||
aobjn t,symev
|
||||
|
||||
;;; evaluate all the system symbolic values
|
||||
movsi t,-.vals
|
||||
valev: move tt,valtab(t)
|
||||
.eval tt,
|
||||
.lose
|
||||
aos t
|
||||
movem tt,valtab(t)
|
||||
aobjn t,valev
|
||||
|
||||
movsi t,-.usymb
|
||||
usymev: move tt,usymbt(t)
|
||||
.eval tt,
|
||||
.lose
|
||||
aos t
|
||||
add tt,[sysloc(U)]
|
||||
movem tt,usymbt(t)
|
||||
aobjn t,usymev
|
||||
|
||||
movsi t,-.rsymb
|
||||
rsymev: move tt,rsymbt(t)
|
||||
.eval tt,
|
||||
.lose
|
||||
aos t
|
||||
add tt,[sysloc(R)]
|
||||
movem tt,rsymbt(t)
|
||||
aobjn t,rsymev
|
||||
|
||||
move t,[-200,,0]
|
||||
move tt,[-200,,<sysloc/2000>]
|
||||
syscal corblk,[argi %cbndr
|
||||
argi %jself
|
||||
tt
|
||||
argi %jssys
|
||||
t]
|
||||
.lose %lssys
|
||||
|
||||
ret
|
||||
|
||||
6iot: ildb x,tt ;print a 6bit char from bp in TT
|
||||
addi x,40 ;convert to ascii
|
||||
syscal iot,[c ? x]
|
||||
.lose %lsfil
|
||||
ret
|
||||
|
||||
6iot2: call 6iot ;6iot once
|
||||
pjrst 6iot ;6iot twice
|
||||
|
||||
timprt: .iot clic,[" ] ;type a leading space
|
||||
call 6iot2 ;type the first 2 chars
|
||||
.iot clic,d ;type the delimiter
|
||||
call 6iot2 ;type the next 2 chars
|
||||
.iot clic,d ;type the delimiter again
|
||||
call 6iot2 ;type the last 2 chars
|
||||
ret ;and return
|
||||
|
||||
;;; type a six-bit word
|
||||
6type: setz t, ;clear t
|
||||
lshc t,6 ;grab first char
|
||||
movei x,40(t) ;move to X & convert to ascii
|
||||
IOT ;always type at least one char
|
||||
jumpn tt,6type ;if there's more, keep typing
|
||||
ret
|
||||
|
||||
|
||||
10type: idivi t,10. ;figure first digit
|
||||
push sp,tt ;push remainder
|
||||
skipe t ;done?
|
||||
call 10type ; no compute next one
|
||||
|
||||
decpn1: pop sp,x ;yes, take out in opposite order
|
||||
addi x,60 ;make ascii
|
||||
IOT ;type it out!
|
||||
ret ;and return for the next one.
|
||||
|
||||
;;;Here are the tables of people who offer help to lusers.
|
||||
;An # after a name means this helper doesn't offer to help turists.
|
||||
|
||||
define mactab mac,tab
|
||||
.zzbit==<setz>
|
||||
mac!bits==0
|
||||
mac!help:
|
||||
irps x,y,[tab]
|
||||
sixbit /X/
|
||||
ifse #,[y] mac!bits==mac!bits\.zzbit
|
||||
.zzbit==.zzbit_-1
|
||||
termin
|
||||
loc mac!help+usrmax
|
||||
termin
|
||||
|
||||
usrmax=20. ;keep usrmax < 36 because of bit-encoding above
|
||||
|
||||
MACTAB MC,[Alan#Ellen#GLS,CBF,BEE,KMP,MAP,JPG,HIC,CStacy,GSB,OAF,CENT,Gren,Grenny,Gumby,cent,Maeda]
|
||||
MACTAB MLKA,[Ellen#MRC,GLS,CBF,JPG,HIC,MAP,GSB,Gumby,CStacy,JSOL,CENT]
|
||||
MACTAB AIKA,[CStacy,Chris,RMS,BEE,ED,DLW,MAP,HIC,JIS,Klotz,PGS,JSOL,KWH,Gumby,CENT,Gren]
|
||||
MACTAB DM,[SWG,PDL,CStacy,Chris,MAP,MJL,JSOL]
|
||||
MACTAB AI,[Alan#CStacy,Chris,CENT,MAP,Gren,Gumby,Maeda]
|
||||
MACTAB X,[Alan#CStacy,Chris,CENT,MAP,Gren,Gumby] ; Default
|
||||
|
||||
;;; table of ITS's to get offsets into HLPTAB
|
||||
ITSTAB: irp x,,[MC,MLKA,AIKA,DM,AI]
|
||||
sixbit /X/
|
||||
termin
|
||||
itscnt==.-itstab ;# of ITS's!!!
|
||||
|
||||
;; table of helper-table pointers
|
||||
HLPTAB: irp x,,[MC,MLKA,AIKA,DM,AI]
|
||||
X!help(H)
|
||||
termin
|
||||
XHELP(H) ; Default
|
||||
|
||||
tbits: irp x,,[MC,MLKA,AIKA,DM,AI]
|
||||
x!bits
|
||||
termin
|
||||
XBITS ; Default
|
||||
|
||||
;;Set up and include the inquire database hacking routines
|
||||
lsrtns"$$ulnm==0 ;don't need last name search
|
||||
lsrtns"$$ulnp==0 ;don't need abbrev l.name lookup
|
||||
lsrtns"$$unam==0 ;don't need name permutation
|
||||
lsrtns"$$hsnm==1 ;we need this to get LSRTUR
|
||||
.insrt syseng;lsrtns
|
||||
|
||||
symbt: irp x,,[USRHI,TIME] ;Foo, can't find the version # !!
|
||||
squoze 0,x
|
||||
x: 0
|
||||
termin
|
||||
.symbt==<.-symbt>/2
|
||||
|
||||
usymbt: irp x,,[UNAME,JNAME,UTMPTR,XUNAME]
|
||||
squoze 0,x
|
||||
x: 0
|
||||
termin
|
||||
.usymb==<.-usymbt>/2
|
||||
|
||||
valtab: irp x,,[LUBLK,NCT,USRRCE]
|
||||
squoze 0,x
|
||||
x: 0
|
||||
termin
|
||||
.vals==<.-valtab>/2
|
||||
|
||||
RSYMBT: irp x,,[TTITM]
|
||||
squoze 0,x
|
||||
x: 0
|
||||
termin
|
||||
.rsymb==<.-rsymbt>/2
|
||||
|
||||
|
||||
runame: 0
|
||||
ttynum: 0 ;our TTY number
|
||||
turist: 0 ;nonzero if inquir says we're a turist
|
||||
xun: 0 ;xuname
|
||||
helpsw: 0 ;non-zero if we've been helped
|
||||
itsnam: 0 ;gotta get this via SSTATU !!
|
||||
idlmax: 7.*60.*30. ;7 minutes decimal before we tell him how
|
||||
;long this user has been idle
|
||||
calerr: 0 ;error return from SYSCAL's
|
||||
tellsw: 0 ;set zero to denote this helper is silent.
|
||||
idlesw: 0 ;non-zero means we found an idle helper
|
||||
|
||||
consta
|
||||
variab
|
||||
|
||||
pdl: -40,,.
|
||||
block 40
|
||||
-1
|
||||
frepag=<<.+1777>/2000>
|
||||
|
||||
end beg
|
||||
|
||||
|
||||
|
||||
|
||||
;;; During some flammmage about the services to be provided to
|
||||
;;; unlogged terminals, someone at a TOPS-20 site finally
|
||||
;;; grokked othe idea of a :LUSER program.
|
||||
;;; He explained the idea to the other people with this example:
|
||||
;;;
|
||||
;;; @HELPME
|
||||
;;; Enter request for help, terminate with ^Z. Please be
|
||||
;;; sure to identify yourself and leave a mailbox or phone number
|
||||
;;; where you can be reached. Enter message:
|
||||
;;;
|
||||
;;; please help me very confused unhappy. account doesnt work
|
||||
;;; files dont print and coke machine ate my quarter. can you please
|
||||
;;; tell me where game about caves and dwarves is? thanks.
|
||||
;;; joe at 444-1212. ^Z
|
||||
;;; @
|
||||
;;;
|
||||
;;;
|
||||
Reference in New Issue
Block a user