From 812fd060bc0dbd852069a1994c852f3360b2ad7a Mon Sep 17 00:00:00 2001 From: Eric Swenson Date: Sun, 4 Dec 2016 20:19:50 -0800 Subject: [PATCH] Added HSNAME -- prints out a user's HSNAME. --- README.md | 1 + build/build.tcl | 4 ++ src/sysen1/hsname.16 | 109 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100644 src/sysen1/hsname.16 diff --git a/README.md b/README.md index e161890f..b81f699d 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,7 @@ from scratch. - SYSMSG, displays system messages - METER, displays system metering information - DIRED, directory editor (independent from EMACS DIRED) + - HSNAME, displays user's HSNAME 6. A brand new host table is built from the host table source and installed into SYSBIN; HOSTS3 > using H3MAKE. diff --git a/build/build.tcl b/build/build.tcl index abbacf6a..caef85e9 100644 --- a/build/build.tcl +++ b/build/build.tcl @@ -652,6 +652,10 @@ expect ":KILL" respond "*" ":midas sys;ts dired_sysen2;dired\r" expect ":KILL" +# hsname +respond "*" ":midas sys2;ts hsname_sysen1;hsname\r" +expect ":KILL" + # ndskdmp tape respond "*" ":link kshack;good ram,.;ram ram\r" diff --git a/src/sysen1/hsname.16 b/src/sysen1/hsname.16 new file mode 100644 index 00000000..4e5118a7 --- /dev/null +++ b/src/sysen1/hsname.16 @@ -0,0 +1,109 @@ +; -*- midas -*- +title HSNAME -- Print a user's HSNAME + +x=0 +a=1 +b=2 +c=3 +d=4 +t=5 +tt=6 +p=17 + +tyoc=16 + +pdllen==40 + +define syscal op,args + .call [setz ? sixbit /op/ ? args ((setz))] +termin + +argi=:1000,,0 +val=:2000,,0 +cnti=:5000,,0 + +define type &string + move t,[440700,,[asciz string]] + movei tt,<.length string> + syscal SIOT,[argi tyoc ? t ? tt] + .lose %lsfil +termin + + +go: move p,[-pdllen,,pdl] ;init the stack pointer + .break 12,[..rjcl,,jclbuf] ;read in the JCL + syscal open,[cnti .uao\%tjdis ? argi tyoc ? [sixbit /TTY/]] + .lose %lsfil + move d,[440700,,jclbuf] + setzm jclp ;have we seen any real JCL? +jclred: movei c,6 + setz a, ;start with empty word +jclrd0: ildb b,d ;read a char + caie b,", ;Comma? + cain b,40 ; space? + jrst jclrd0 ; yes, read another +jclrd1: caie b,0 ;null? + cain b,^C ; ^C? + jrst jclrd9 ; end of JCL + caie b,^M ;CR? + cain b,^_ ; ^_? + jrst jclrd9 ; these can end JCL too. + caie b,", ;Comma? + cain b,40 ; space? + jrst [ imuli c,6 + skiple c ; unless already full + lshc a,(c) ; align the word properly + pushj p,namhak ; Hack this person + jrst jclred] ; and gobble some more names, maybe + cail b,140 + subi b,40 ;convert to sixbit + subi b,40 + lsh b,36 ;move the char into our word + skiple c ;unless we've already got 6 chars + lshc a,6 ; we shift it into the rightmost part + ildb b,d ;get another character + soja c,jclrd1 ;and add this into the menagerie. + +jclrd9: jumpe a,done ;If no name there, just log out now + imuli c,6 ;convert characters to bits + skiple c ; unless already full + lshc a,(c) + pushj p,namhak ;otherwise hack a name first +done: skipn jclp ;have we found anything at all so far? + jrst penult ; no, try for our own HSNAME + .logout 1, ;and then we're done + +penult: .suset [.rxuname,,a] ;use our own XUNAME + pushj p,namhak ;hack it + .logout 1, ;and bye-bye + +namhak: setom jclp ;say we found some real JCL + type /A/ + movem a,usrnam ;save the name + pushj p,6type ;type it though + type / ==> / + .break 12,[..rhsname,,itsnam] ;get his HSNAME from DDT + move a,usrnam ;type the directory + jrst 6type + +6type: move b,a ;get word in B +6type1: setz a, ;clear out A to receive a char + lshc a,6 ;get the leftmost char in A + cain a,0 ;space? + jrst [ type /^Q/ ; quote it first + jrst .+1] + addi a,40 ;Convert to ascii + .iot tyoc,a ;type it + jumpn b,6type1 ;if there's any more, type it too + popj p, ;otherwise return + +itsnam: 0 +usrnam: 0 +jclp: 0 + +jclbuf: block 40 +pdl: [.lose] + block pdllen + + +end go