allow apos wrapped vals for telnet, fixes #5

This commit is contained in:
Josh Baker 2016-10-14 09:00:32 -07:00
parent 3ca743f4c9
commit bd8eb49594
1 changed files with 5 additions and 2 deletions

View File

@ -530,6 +530,7 @@ func (rd *Reader) readCommands(leftover *int) ([]Command, error) {
}
var cmd Command
var quote bool
var quotech byte
var escape bool
outer:
for {
@ -544,10 +545,11 @@ func (rd *Reader) readCommands(leftover *int) ([]Command, error) {
line = line[i+1:]
continue outer
}
if c == '"' {
if c == '"' || c == '\'' {
if i != 0 {
return nil, errUnbalancedQuotes
}
quotech = c
quote = true
line = line[i+1:]
continue outer
@ -563,8 +565,9 @@ func (rd *Reader) readCommands(leftover *int) ([]Command, error) {
case 't':
c = '\t'
}
} else if c == '"' {
} else if c == quotech {
quote = false
quotech = 0
cmd.Args = append(cmd.Args, nline)
line = line[i+1:]
if len(line) > 0 && line[0] != ' ' {