Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
71ed5a7b
Commit
71ed5a7b
authored
Jul 10, 2010
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
luatelnet: really add the possibility to pipe commands into the telnet interface.
parent
41297efb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
12 deletions
+20
-12
share/lua/intf/modules/host.lua
share/lua/intf/modules/host.lua
+1
-0
share/lua/intf/telnet.lua
share/lua/intf/telnet.lua
+19
-12
No files found.
share/lua/intf/modules/host.lua
View file @
71ed5a7b
...
@@ -159,6 +159,7 @@ function host()
...
@@ -159,6 +159,7 @@ function host()
wfd
=
wfd
or
fd
,
wfd
=
wfd
or
fd
,
status
=
status
.
init
,
status
=
status
.
init
,
buffer
=
""
,
buffer
=
""
,
cmds
=
""
,
type
=
t
,
type
=
t
,
-- methods
-- methods
fd
=
fd_client
,
fd
=
fd_client
,
...
...
share/lua/intf/telnet.lua
View file @
71ed5a7b
...
@@ -183,27 +183,33 @@ while not vlc.misc.should_die() do
...
@@ -183,27 +183,33 @@ while not vlc.misc.should_die() do
-- Handle reads
-- Handle reads
for
_
,
client
in
pairs
(
r
)
do
for
_
,
client
in
pairs
(
r
)
do
local
str
=
client
:
recv
(
1000
)
local
str
=
client
.
cmds
..
string.gsub
(
client
:
recv
(
1000
),
"
\r
"
,
"
\n
"
)
local
done
=
false
if
not
str
then
-- the telnet client program has leave
if
not
str
then
-- the telnet client program has leave
client
.
buffer
=
"quit"
client
.
cmds
=
"quit"
done
=
true
elseif
string.match
(
str
,
"
\n
"
)
then
elseif
string.match
(
str
,
"
\n
$"
)
then
client
.
cmds
=
str
client
.
buffer
=
string.gsub
(
client
.
buffer
..
str
,
"
\r
?\n$"
,
""
)
done
=
true
elseif
client
.
buffer
==
""
elseif
client
.
buffer
==
""
and
((
client
.
type
==
host
.
client_type
.
stdio
and
str
==
""
)
and
((
client
.
type
==
host
.
client_type
.
stdio
and
str
==
""
)
or
(
client
.
type
==
host
.
client_type
.
net
and
str
==
"
\004
"
))
then
or
(
client
.
type
==
host
.
client_type
.
net
and
str
==
"
\004
"
))
then
-- Caught a ^D
-- Caught a ^D
client
.
buffer
=
"quit"
client
.
cmds
=
"quit"
done
=
true
else
client
.
buffer
=
client
.
buffer
..
str
end
end
if
client
.
type
==
host
.
client_type
.
net
then
if
client
.
type
==
host
.
client_type
.
net
then
telnet_commands
(
client
)
telnet_commands
(
client
)
end
end
if
done
then
client
.
buffer
=
""
-- split the command at the first '\n'
while
string.find
(
client
.
cmds
,
"
\n
"
)
do
-- save the buffer to send to the client
local
saved_buffer
=
client
.
buffer
-- get the next command
local
index
=
string.find
(
client
.
cmds
,
"
\n
"
)
client
.
buffer
=
string.gsub
(
string.sub
(
client
.
cmds
,
0
,
index
-
1
),
"^%s*(.-)%s*$"
,
"%1"
)
client
.
cmds
=
string.sub
(
client
.
cmds
,
index
+
1
)
if
client
.
status
==
host
.
status
.
password
then
if
client
.
status
==
host
.
status
.
password
then
if
client
.
buffer
==
password
then
if
client
.
buffer
==
password
then
client
:
send
(
IAC
..
WONT
..
ECHO
..
"
\r\n
Welcome, Master\r\n"
)
client
:
send
(
IAC
..
WONT
..
ECHO
..
"
\r\n
Welcome, Master\r\n"
)
...
@@ -216,6 +222,7 @@ while not vlc.misc.should_die() do
...
@@ -216,6 +222,7 @@ while not vlc.misc.should_die() do
elseif
client_command
(
client
)
then
elseif
client_command
(
client
)
then
client
:
switch_status
(
host
.
status
.
write
)
client
:
switch_status
(
host
.
status
.
write
)
end
end
client
.
buffer
=
saved_buffer
..
client
.
buffer
end
end
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment