diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/parser.c | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index 670682b..cf56c9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-09-26 Herbert Xu <herbert@gondor.apana.org.au> + + * Recognise here-doc delimiters terminated by EOF. + 2007-09-26 Roy Marples <uberlord@gentoo.org> * Refresh stack pointers after makestrspace in _rmescapes. diff --git a/src/parser.c b/src/parser.c index 1a483d4..cac0aa5 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1049,8 +1049,14 @@ checkend: { char *p, *q; p = line; - for (q = eofmark + 1 ; *q && *p == *q ; p++, q++); - if (*p == '\n' && *q == '\0') { + for (q = eofmark + 1;; p++, q++) { + c = *p; + if (c == '\n') + c = 0; + if (!*q || c != *q) + break; + } + if (c == *q) { c = PEOF; plinno++; needprompt = doprompt; |