diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-10-20 18:49:31 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2007-10-20 18:49:31 +0800 |
commit | d39c8628b8594c29d234427ba07a12538ab36f41 (patch) | |
tree | 6438d14d319a352929319f0b59ee587fc9ac3605 | |
parent | [EXPAND] Added configure --enable-glob and --enable-fnmatch options (diff) | |
download | dash-d39c8628b8594c29d234427ba07a12538ab36f41.tar.gz dash-d39c8628b8594c29d234427ba07a12538ab36f41.zip |
[PARSER] Fix here-doc corruption
The change [PARSER] Recognise here-doc delimiters terminated by EOF introduced a regerssion whereby lines starting with eofmark but are not equal to eofmark would be corrupted. This patch fixes it. Test case: cat << _ACEOF _ASBOX _ACEOF Old result: SASBOX New result: _ASBOX
Diffstat (limited to '')
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/parser.c | 11 |
2 files changed, 7 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog index a821c32..d50d36c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2007-10-20 Herbert Xu <herbert@gondor.apana.org.au> * Added configure --enable-glob and --enable-fnmatch options. + * Fix here-doc corruption. 2007-10-17 Herbert Xu <herbert@gondor.apana.org.au> diff --git a/src/parser.c b/src/parser.c index 4b8a5fe..3832f0b 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1047,16 +1047,17 @@ checkend: { if (c == *eofmark) { if (pfgets(line, sizeof line) != NULL) { char *p, *q; + int cc; p = line; for (q = eofmark + 1;; p++, q++) { - c = *p; - if (c == '\n') - c = 0; - if (!*q || c != *q) + cc = *p; + if (cc == '\n') + cc = 0; + if (!*q || cc != *q) break; } - if (c == *q) { + if (cc == *q) { c = PEOF; plinno++; needprompt = doprompt; |