2017-06-20 04:36:55 +10:00
|
|
|
function nshcs_w(evPP,nid,pW)
|
2017-06-19 23:21:13 +10:00
|
|
|
local sI = E().sI or 1
|
|
|
|
chauthc(nid,evPP,pW)
|
|
|
|
while true do
|
|
|
|
if ev[1] == "net_msg" then
|
|
|
|
local V,msg=false,tostring(ev[4])
|
|
|
|
if ev[3] == evPP and ev[2] == nid then
|
|
|
|
if msg:sub(1,3) == "dis" then
|
|
|
|
write(msg:sub(4))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
elseif ev[1] == "key" and ev[2] == sI and ev[3] == 29 and ev[4] == 27 then
|
|
|
|
break
|
|
|
|
elseif ev[1] == "key" and ev[2] == sI then
|
|
|
|
ns(nid,evPP,"key"..tostring(ev[3]))
|
|
|
|
end
|
|
|
|
C.yield()
|
|
|
|
end
|
|
|
|
ns(nid,evPP,"exit")
|
|
|
|
end
|
|
|
|
|
2017-06-20 04:36:55 +10:00
|
|
|
function nshcs(P,nid,pW)
|
2017-06-19 23:25:37 +10:00
|
|
|
pW=(pW or readln("*"))
|
2017-06-19 23:21:13 +10:00
|
|
|
ns(nid,P,"initnsh")
|
|
|
|
while true do
|
|
|
|
if ev[1] == "net_msg" and ev[2] == nid and ev[3] == P then
|
|
|
|
break
|
2017-06-19 23:30:29 +10:00
|
|
|
elseif ev[1] == "key" and ev[2] == sI and ev[3] == 29 and ev[4] == 27 then
|
|
|
|
break
|
2017-06-19 23:21:13 +10:00
|
|
|
end
|
|
|
|
C.yield()
|
|
|
|
end
|
2017-06-20 04:36:55 +10:00
|
|
|
nshcs_w(ev[4],nid,pW)
|
2017-06-19 23:21:13 +10:00
|
|
|
end
|