Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
41297efb
Commit
41297efb
authored
Jul 10, 2010
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "luatelnet: accept multiple commands seperated by '\n' or '\r'."
This reverts commit
f5b8b43a
.
parent
d97a54a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
44 deletions
+15
-44
share/lua/intf/telnet.lua
share/lua/intf/telnet.lua
+15
-44
No files found.
share/lua/intf/telnet.lua
View file @
41297efb
...
@@ -183,68 +183,39 @@ while not vlc.misc.should_die() do
...
@@ -183,68 +183,39 @@ 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
=
string.gsub
(
client
:
recv
(
1000
),
"
\r
"
,
"
\n
"
)
local
str
=
client
:
recv
(
1000
)
local
done
=
false
local
done
=
false
if
not
str
then
-- the telnet client program has leave
-- the telnet client program has leave
if
not
str
then
client
.
buffer
=
"quit"
client
.
buffer
=
"quit"
done
=
true
done
=
true
elseif
string.match
(
str
,
"
\n
$"
)
then
-- Caught a ^D
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
client
.
buffer
=
"quit"
client
.
buffer
=
"quit"
done
=
true
done
=
true
-- '\n' found: a command was sent
elseif
string.match
(
str
,
"
\n
"
)
then
client
.
buffer
=
client
.
buffer
..
str
done
=
true
-- The command is not finished yet
else
else
client
.
buffer
=
client
.
buffer
..
str
client
.
buffer
=
client
.
buffer
..
str
end
end
-- Some cleaning for telnet
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 a command must be parsed
if
done
then
if
done
then
-- loop on all commands (might have more than one commands seperated by '\n'
if
client
.
status
==
host
.
status
.
password
then
local
returned_values
=
""
if
client
.
buffer
==
password
then
while
not
(
client
.
buffer
==
""
)
do
client
:
send
(
IAC
..
WONT
..
ECHO
..
"
\r\n
Welcome, Master\r\n"
)
-- pick the first command
client
.
buffer
=
""
local
commands
=
""
if
string.find
(
client
.
buffer
,
"
\n
"
)
then
commands
=
string.sub
(
client
.
buffer
,
string.find
(
client
.
buffer
,
"
\n
"
)
+
1
)
client
.
buffer
=
string.sub
(
client
.
buffer
,
0
,
string.find
(
client
.
buffer
,
"
\n
"
)
-
1
)
end
local
cmd
=
client
.
buffer
if
client
.
status
==
host
.
status
.
password
then
if
client
.
buffer
==
password
then
client
:
send
(
IAC
..
WONT
..
ECHO
..
"
\r\n
Welcome, Master\r\n"
)
client
.
buffer
=
""
client
:
switch_status
(
host
.
status
.
write
)
else
client
:
send
(
"
\r\n
Wrong password\r\nPassword: "
)
client
.
buffer
=
""
end
elseif
client_command
(
client
)
then
client
:
switch_status
(
host
.
status
.
write
)
client
:
switch_status
(
host
.
status
.
write
)
-- special case to exit the loop
else
if
cmd
==
"quit"
or
cmd
==
"shutdown"
then
break
end
client
:
send
(
"
\r\n
Wrong password\r\nPassword: "
)
client
.
buffer
=
""
end
end
returned_values
=
returned_values
..
client
.
buffer
elseif
client_command
(
client
)
then
client
.
buffer
=
commands
client
:
switch_status
(
host
.
status
.
write
)
end
end
vlc
.
msg
.
err
(
"end of loop"
)
client
.
buffer
=
returned_values
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