add a way to quit nsh sessions, ^]
This commit is contained in:
parent
1994d25f5f
commit
f6c61622bc
@ -1,5 +1,4 @@
|
|||||||
function nshc_w(evPP,nid)
|
function nshc_w(evPP,nid)
|
||||||
write("\f")
|
|
||||||
while true do
|
while true do
|
||||||
if ev[1] == "net_msg" then
|
if ev[1] == "net_msg" then
|
||||||
local V,msg=false,tostring(ev[4])
|
local V,msg=false,tostring(ev[4])
|
||||||
@ -8,22 +7,23 @@ function nshc_w(evPP,nid)
|
|||||||
write(msg:sub(4))
|
write(msg:sub(4))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif ev[1] == "key" and ev[2] == tT[cT][3].sI then
|
elseif ev[1] == "key" and ev[2] == E().sI and ev[3] == 29 and ev[4] == 27 then
|
||||||
|
break
|
||||||
|
elseif ev[1] == "key" and ev[2] == E().sI then
|
||||||
ns(nid,evPP,"key"..tostring(ev[3]))
|
ns(nid,evPP,"key"..tostring(ev[3]))
|
||||||
end
|
end
|
||||||
C.yield()
|
C.yield()
|
||||||
end
|
end
|
||||||
|
ns(nid,evPP,"exit")
|
||||||
end
|
end
|
||||||
|
|
||||||
function nshc(P,nid)
|
function nshc(P,nid)
|
||||||
ns(nid,P,"initnsh")
|
ns(nid,P,"initnsh")
|
||||||
while true do
|
while true do
|
||||||
if ev[1] == "net_msg" then
|
|
||||||
print(T.unpack(ev))
|
|
||||||
end
|
|
||||||
if ev[1] == "net_msg" and ev[2] == nid and ev[3] == P then
|
if ev[1] == "net_msg" and ev[2] == nid and ev[3] == P then
|
||||||
nshc_w(ev[4],nid)
|
break
|
||||||
end
|
end
|
||||||
C.yield()
|
C.yield()
|
||||||
end
|
end
|
||||||
|
nshc_w(ev[4],nid)
|
||||||
end
|
end
|
||||||
|
@ -6,6 +6,7 @@ s("netsh daemon - "..tostring(sI),function() print(pcall(function()
|
|||||||
if ev[3] == evPP and ev[2] == cA then
|
if ev[3] == evPP and ev[2] == cA then
|
||||||
if msg:sub(1,3) == "key" then
|
if msg:sub(1,3) == "key" then
|
||||||
h("key",tT[cT][3].sI,tonumber(msg:sub(4)),0)
|
h("key",tT[cT][3].sI,tonumber(msg:sub(4)),0)
|
||||||
|
elseif msg == "exit" then break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif ev[1] == "display" and ev[3] == tT[cT][3].sI then
|
elseif ev[1] == "display" and ev[3] == tT[cT][3].sI then
|
||||||
|
Loading…
Reference in New Issue
Block a user