shell/ash.c+9 -3
| @@ -11592,11 +11592,17 @@ checkend: { |
| if (c == *eofmark) { |
| if (pfgets(line, sizeof(line)) != NULL) { |
| char *p, *q; |
| + | int cc; |
| |
| p = line; |
| - | for (q = eofmark + 1; *q && *p == *q; p++, q++) |
| - | continue; |
| - | if (*p == '\n' && *q == '\0') { |
| + | for (q = eofmark + 1;; p++, q++) { |
| + | cc = *p; |
| + | if (cc == '\n') |
| + | cc = 0; |
| + | if (!*q || cc != *q) |
| + | break; |
| + | } |
| + | if (cc == *q) { |
| c = PEOF; |
| nlnoprompt(); |
| } else { |
shell/ash_test/ash-heredoc/heredoc6.right+2 -0
| @@ -0,0 +1,2 @@ |
| + | test |
| + | OK:0 |
shell/ash_test/ash-heredoc/heredoc6.tests+4 -0
| @@ -0,0 +1,4 @@ |
| + | eval 'cat <<- NOT |
| + | test |
| + | NOT' |
| + | echo OK:$? |
shell/ash_test/ash-heredoc/heredoc7.right+1 -0
shell/ash_test/ash-heredoc/heredoc7.tests+3 -0
| @@ -0,0 +1,3 @@ |
| + | cat << _ACEOF |
| + | _ASBOX |
| + | _ACEOF |
shell/hush_test/hush-heredoc/heredoc6.right+2 -0
| @@ -0,0 +1,2 @@ |
| + | test |
| + | OK:0 |
shell/hush_test/hush-heredoc/heredoc6.tests+4 -0
| @@ -0,0 +1,4 @@ |
| + | eval 'cat <<- NOT |
| + | test |
| + | NOT' |
| + | echo OK:$? |
shell/hush_test/hush-heredoc/heredoc7.right+1 -0
shell/hush_test/hush-heredoc/heredoc7.tests+3 -0
| @@ -0,0 +1,3 @@ |
| + | cat << _ACEOF |
| + | _ASBOX |
| + | _ACEOF |