Chris
PS. I hope this is of use to someone (ANYONE!) :-)
------------------------------8<--[ CUT HERE ]-->8------------------------------
$!
$!******************************************************************************
$!* LOOK - 1994 Enigma at Staffordshire University *
$!* Uses: RWHO - 1992 Weirdbeard at Staffordshire University *
$!* Phone code - 1994 Author Unknown on the Internet *
$!* 'Tweeked', Tidied up and Merged by Enigma *
$!* Will recognise VMS and UNIX nodes *
$!* Email: c.ro...@staffordshire.ac.uk (as at 1994) *
$!******************************************************************************
$!
$look:
$rwho:
$ p2=p1 ! p2 is redefined to remain compatibility with original code
$ ver:='f$verify(0)
$ set message/noid/nofac/nosev/notext
$ on error then goto lookexit
$ on warning then goto lookexit
$ on severe_error then goto lookexit
$ on control_y then goto lookexit
$ if p2 .eqs. "" then inquire/nopunc p2 "Please enter node to list: "
$ if p2 .eqs. "" then exit
$ p2 = p2-":"-":"
$ wr:=write sys$output
$ num = 0
$ cmd[0,8] = 15
$ close/nolog phn ! make sure it's closed
$ wr "Attempting connection to node ''p2'..."
$ tstring="Users on "+p2+" at "+f$time()
$ open/read/write/share/error=lookexit phn 'p2'::"29="
$ wr ""
$ wr tstring
$ wr ""
$ wr " Username Process Name Terminal Phone Status"
$ wr ""
$looklupe:
$ write/error=lookclose phn cmd
$ read/end=lookclose/error=lookclose phn str
$ if f$length(str).eq.0 then goto lookclose
$ username=f$extract(15,13,str)
$ process_name=f$extract(0,15,str)
$ str[0,13]:="''username'"
$ str[13,15]:="''process_name'"
$ wr str
$ num = num+1
$ goto looklupe
$lookclose:
$ close/nolog phn
$ wr ""
$ wr f$fao("!SL person!%S listed.",num)
$lookexit:
$ if .not. $status then goto lookrwho
$ close/nolog phn
$ set message/id/fac/sev/text
$ exit
$lookrwho:
$ close/nolog phn ! close phn just incase left open
$ conv:="sys$login:rwho.conv"
$ tmp:="sys$login:rwho.tmp"
$ on severe_error then goto rwhoerr
$ on warning then goto rwhoerr
$ on error then goto rwhoerr
$ on control_y then goto rwhoerr
$rwhostart:
$ copy 'p2'::"/etc/utmp" sys$login:rwho.tmp
$ found=0
$ exchange copy 'tmp 'conv/transfer_mode=block
$ wr ""
$ wr tstring
$ wr ""
$ close/nolog file
$ open/read/error=rwhoerr file 'conv
$ g=""
$rwholoop:
$ read/end=eof/error=rwhoerr file line
$ line=g+line
$rwholoop1:
$ lenline=f$len(line)
$ if lenline .gt. 35 then gosub rwhoprocess
$ if lenline .gt. 35 then line=f$extract(36,lenline,line)
$ if lenline .gt. 35 then goto rwholoop1
$ g=line
$ goto rwholoop
$eof:
$ close/nolog file
$ wr ""
$ wr f$fao("!SL person!%S listed.",num)
$rwhobye:
$ close/nolog file ! close file just incase left open
$ if f$search("''tmp';*") .nes. "" then delete/noconfirm 'tmp;*
$ if f$search("''conv';*") .nes. "" then delete/noconfirm 'conv;*
$ set message/id/fac/sev/text
$ exit
$rwhoerr:
$ if .not. $status then wr "''p2' is an unknown node."
$ goto rwhobye
$rwhoprocess:
$ if f$cvui(0,8,line) .eq. 0 .or. f$cvui(64,8,line) .eq. 0 then return
$ tty=f$extract(0,8,line)
$ uid=f$extract(8,8,line)
$ where=f$extract(16,16,line)
$ a=1
$rwhopadtty:
$ if f$cvui(0,8,f$extract(a,1,tty)) .eq. 0 then tty=f$extract(0,a,tty)+" "+f$extract(a+1,f$len(tty),tty)
$ a=a+1
$ if a .lt. f$len(tty) then goto rwhopadtty
$ a=1
$rwhopaduid:
$ if f$cvui(0,8,f$extract(a,1,uid)) .eq. 0 then uid=f$extract(0,a,uid)+" "+f$extract(a+1,f$len(uid),uid)
$ a=a+1
$ if a .lt. f$len(uid) then goto rwhopaduid
$ if found .eq. 0
$ then
$ wr " Username Terminal Logged on From"
$ wr ""
$ else
$ wr " ",uid," ",tty," ",where
$ num=num+1
$ endif
$ found=1
$ return
--------------------------8<--[ CUT HERE ]-->8----------------------------------
--
+-------------------------------+----------------------------------------------+
| Chris Roberts, | " Remember man thou art but dust; " |
| 70. Corporation Street, | " And back to dust thou shalt return. " |
| Stafford, |----------------------------------------------|
| Staffordshire, | E-Mail: c.ro...@staffordshire.ac.uk |
| ST16 3LT, |----------------------------------------------|
| England. | School of Computing |
| +44 (0)785 226195 | Staffordshire University, England |
+-------------------------------+----------------------------------------------+
.. and what percentage of Unix machines in the world run Decnet?
/---------------------------------------------------------------------------\
| Robert Wright | Wrig...@cupid.curtin.edu.au |
| Curtin University | R.Wr...@icarus.curtin.edu.au |
| Perth, Western Australia | psi%0505294523000:Wright_RJ |
| Voice:+61 9 351 7385 | Wright_RJ%cc.curti...@cunyvm.bitnet |
| FAX: 09-351-2673 | uunet!munnari.oz!cc.curtin.edu.au!Wright_RJ |
|-----------------------------------------------------------------------------|
| Duncan's First Law of Modelling: the stimulation of simulation is greater |
| the pleasurement of the measurement, but it makes you go blind. |
\---------------------------------------------------------------------------/
Chris
--
Chris Roberts "Remember man thou art but dust;"
E-Mail: c.ro...@staffordshire.ac.uk "And back to dust thou shalt return."