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