From 8885d068b5830240895645ca6432f53eacb51d71 Mon Sep 17 00:00:00 2001 From: slioch Date: Thu, 28 Aug 2008 10:21:45 -0700 Subject: Handle double and single quote within a command argument. First quote turns on automatic escaping, second turns off. Will support unquoted, single quoted and double quoted forms of text strings. --- parse.y | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/parse.y b/parse.y index e9323c8..68e9537 100644 --- a/parse.y +++ b/parse.y @@ -1984,18 +1984,27 @@ shell_getc (remove_quoted_newline) //find where string starts (skipping whitespace) if (strncmp(&shell_input_line[pos],"set ",4) == 0 || - strncmp(&shell_input_line[pos],"delete",4) == 0) { - if ((c == ';' || - c == '&' || - c == '(' || - c == ')' || - c == '>' || - c == '<' || - c == '|' || - c == '!' || - c == '`' || - c == '$') && - shell_input_line[i-1] != '\\') { + strncmp(&shell_input_line[pos],"delete ",7) == 0) { + if (c == '"' || c == '\'') { + //this suppresses a quoted string + if (no_escape == 1) { + no_escape = 0; + } + else { + no_escape = 1; + } + } + else if ((c == ';' || + c == '&' || + c == '(' || + c == ')' || + c == '>' || + c == '<' || + c == '|' || + c == '!' || + c == '`' || + c == '$') && + shell_input_line[i-1] != '\\') { if (no_escape == 0) { shell_input_line[i++] = '\\'; @@ -2008,15 +2017,6 @@ shell_getc (remove_quoted_newline) } } } - else if (c == '"') { - //this suppresses a quoted string - if (no_escape == 1) { - no_escape = 0; - } - else { - no_escape = 1; - } - } } shell_input_line[i++] = c; -- cgit v1.2.3