home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
rxnet2.zip
/
WHO.CMD
< prev
Wrap
OS/2 REXX Batch file
|
1993-08-19
|
2KB
|
105 lines
/*
who.CMD
Show how many users logged on and optionally the users as well
Usage: who [sort name]|[name|ALL]
*/
tab = d2c(9)
onscreen = 22
call rxfuncadd SysLoadFuncs, REXXUTIL, SysLoadFuncs
call SysLoadFuncs
if rxfuncadd(NetLoadFuncs, "RexxNet", NetLoadFuncs) = 20 then do
say "Failed to find REXXNET.DLL"
exit
end
call NetLoadFuncs
parse upper arg find
say ""
say "Counting Logged on Users..."
retc = NetGetDCName('', 'DCP01', Server)
if retc \= 0 then do
call error
signal finish
end
if find = '' then
retc = NetLogonEnum(Server, 0, Info)
else
retc = NetLogonEnum(Server, 2, Info)
if retc \= 0 then do
call error
signal finish
end
say ""
say "There are currently" Info.Entries "users logged on."
say ""
select
when find = '' then
exit 0
when find = 'ALL' then do
j = 0
do i = 0 to Info.Entries - 1
say left("\\"||Info.i.computer, 12) left(Info.i.eff_name, 10) Info.i.usrcomment
j = j + 1
if j = 23 then do
say ""
call charout '', "Hit ENTER to continue "
parse pull wait
if wait \= '' then
leave
j = 0
end
end
end
when find = 'SORT' then
say "Not supported yet!"
otherwise do
say "Searching for" find
say ""
j = 0
do i = 0 to Info.Entries - 1
user = Info.i.eff_name Info.i.usrcomment Info.i.computer
parse upper var user user
if pos(find, user) \= 0 then do
j = j + 1
say substr("\\"||info.i.computer, 1, 12) substr(Info.i.eff_name, 1, 10) Info.i.usrcomment
if j - (j % onscreen) * onscreen = onscreen - 1 then do
say ""
call charout '', "Enter to continue, any other to quit"
parse pull quit
if quit \= '' then
leave
say ""
end
end
end
end
end
finish:
call NetDropFuncs
exit 0
error:
if retc \= 0 then do
if retc < 2100 then
say SysGetMessage(retc)
else
say SysGetMessage(retc, "NET.MSG")
end
else
say "Completed Successfully"
return