summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorroot <root@eng-140.vyatta.com>2008-07-25 15:05:41 -0700
committerroot <root@eng-140.vyatta.com>2008-07-25 15:05:41 -0700
commit227acb909745307bfe5d28e202de02f6c9101714 (patch)
treec569e514f68b7bbff91c297ae48ab31ed18c1485 /parse.y
parent082b170efdb062ec735eafa5213dbeb18fd7ecaa (diff)
downloadvyatta-bash-227acb909745307bfe5d28e202de02f6c9101714.tar.gz
vyatta-bash-227acb909745307bfe5d28e202de02f6c9101714.zip
skipping whitespace at beginning of command when matching set|delete.
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y53
1 files changed, 31 insertions, 22 deletions
diff --git a/parse.y b/parse.y
index f4e09ec..0997406 100644
--- a/parse.y
+++ b/parse.y
@@ -1973,29 +1973,38 @@ shell_getc (remove_quoted_newline)
//need to fix terminating special character ';'
//vyatta
if (interactive &&
- shell_input_line &&
- (
- strncmp(shell_input_line,"set ",4) == 0 ||
- strncmp(shell_input_line,"delete",4) == 0)) {
- if ((c == ';' ||
- c == '&' ||
- c == '(' ||
- c == ')' ||
- c == '>' ||
- c == '<' ||
- c == '|' ||
- c == '`' ||
- c == '$') &&
- shell_input_line[i-1] != '\\') {
- if (no_escape == 0) {
- shell_input_line[i++] = '\\';
-
- history_buf = realloc(history_buf,i+1);
- register int j;
- for (j = history_start; j < i-1; ++j) {
- history_buf[history_index++] = shell_input_line[j];
+ shell_input_line) {
+
+ char *string = shell_input_line;
+
+ while (*string && (whitespace (*string) || *string == '\n'))
+ string++;
+
+ int pos = string - shell_input_line;
+
+ //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 == '$') &&
+ shell_input_line[i-1] != '\\') {
+ if (no_escape == 0) {
+ shell_input_line[i++] = '\\';
+
+ history_buf = realloc(history_buf,i+1);
+ register int j;
+ for (j = history_start; j < i-1; ++j) {
+ history_buf[history_index++] = shell_input_line[j];
+ }
+ history_start = i;
}
- history_start = i;
}
}
else if (c == '"') {