diff options
author | slioch <slioch@eng-140.vyatta.com> | 2008-08-28 10:21:45 -0700 |
---|---|---|
committer | slioch <slioch@eng-140.vyatta.com> | 2008-08-28 10:21:45 -0700 |
commit | 8885d068b5830240895645ca6432f53eacb51d71 (patch) | |
tree | c108f0996f2e4d431c37d258a644229909141d48 /parse.y | |
parent | dc6a7a5657b06a8058f559adb6b486dfcaf483ec (diff) | |
download | vyatta-bash-8885d068b5830240895645ca6432f53eacb51d71.tar.gz vyatta-bash-8885d068b5830240895645ca6432f53eacb51d71.zip |
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.
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 42 |
1 files changed, 21 insertions, 21 deletions
@@ -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; |