diff options
-rw-r--r-- | shell/ash.c | 12 | ||||
-rw-r--r-- | shell/ash_test/ash-heredoc/heredoc6.right | 2 | ||||
-rwxr-xr-x | shell/ash_test/ash-heredoc/heredoc6.tests | 4 | ||||
-rw-r--r-- | shell/ash_test/ash-heredoc/heredoc7.right | 1 | ||||
-rwxr-xr-x | shell/ash_test/ash-heredoc/heredoc7.tests | 3 | ||||
-rw-r--r-- | shell/hush_test/hush-heredoc/heredoc6.right | 2 | ||||
-rwxr-xr-x | shell/hush_test/hush-heredoc/heredoc6.tests | 4 | ||||
-rw-r--r-- | shell/hush_test/hush-heredoc/heredoc7.right | 1 | ||||
-rwxr-xr-x | shell/hush_test/hush-heredoc/heredoc7.tests | 3 |
9 files changed, 29 insertions, 3 deletions
diff --git a/shell/ash.c b/shell/ash.c index 2cebfe2c0..e0828d4a7 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -11592,11 +11592,17 @@ checkend: { | |||
11592 | if (c == *eofmark) { | 11592 | if (c == *eofmark) { |
11593 | if (pfgets(line, sizeof(line)) != NULL) { | 11593 | if (pfgets(line, sizeof(line)) != NULL) { |
11594 | char *p, *q; | 11594 | char *p, *q; |
11595 | int cc; | ||
11595 | 11596 | ||
11596 | p = line; | 11597 | p = line; |
11597 | for (q = eofmark + 1; *q && *p == *q; p++, q++) | 11598 | for (q = eofmark + 1;; p++, q++) { |
11598 | continue; | 11599 | cc = *p; |
11599 | if (*p == '\n' && *q == '\0') { | 11600 | if (cc == '\n') |
11601 | cc = 0; | ||
11602 | if (!*q || cc != *q) | ||
11603 | break; | ||
11604 | } | ||
11605 | if (cc == *q) { | ||
11600 | c = PEOF; | 11606 | c = PEOF; |
11601 | nlnoprompt(); | 11607 | nlnoprompt(); |
11602 | } else { | 11608 | } else { |
diff --git a/shell/ash_test/ash-heredoc/heredoc6.right b/shell/ash_test/ash-heredoc/heredoc6.right new file mode 100644 index 000000000..5d0f077cd --- /dev/null +++ b/shell/ash_test/ash-heredoc/heredoc6.right | |||
@@ -0,0 +1,2 @@ | |||
1 | test | ||
2 | OK:0 | ||
diff --git a/shell/ash_test/ash-heredoc/heredoc6.tests b/shell/ash_test/ash-heredoc/heredoc6.tests new file mode 100755 index 000000000..346f5949a --- /dev/null +++ b/shell/ash_test/ash-heredoc/heredoc6.tests | |||
@@ -0,0 +1,4 @@ | |||
1 | eval 'cat <<- NOT | ||
2 | test | ||
3 | NOT' | ||
4 | echo OK:$? | ||
diff --git a/shell/ash_test/ash-heredoc/heredoc7.right b/shell/ash_test/ash-heredoc/heredoc7.right new file mode 100644 index 000000000..5d9c6c6c0 --- /dev/null +++ b/shell/ash_test/ash-heredoc/heredoc7.right | |||
@@ -0,0 +1 @@ | |||
_ASBOX | |||
diff --git a/shell/ash_test/ash-heredoc/heredoc7.tests b/shell/ash_test/ash-heredoc/heredoc7.tests new file mode 100755 index 000000000..abd5941d9 --- /dev/null +++ b/shell/ash_test/ash-heredoc/heredoc7.tests | |||
@@ -0,0 +1,3 @@ | |||
1 | cat << _ACEOF | ||
2 | _ASBOX | ||
3 | _ACEOF | ||
diff --git a/shell/hush_test/hush-heredoc/heredoc6.right b/shell/hush_test/hush-heredoc/heredoc6.right new file mode 100644 index 000000000..5d0f077cd --- /dev/null +++ b/shell/hush_test/hush-heredoc/heredoc6.right | |||
@@ -0,0 +1,2 @@ | |||
1 | test | ||
2 | OK:0 | ||
diff --git a/shell/hush_test/hush-heredoc/heredoc6.tests b/shell/hush_test/hush-heredoc/heredoc6.tests new file mode 100755 index 000000000..346f5949a --- /dev/null +++ b/shell/hush_test/hush-heredoc/heredoc6.tests | |||
@@ -0,0 +1,4 @@ | |||
1 | eval 'cat <<- NOT | ||
2 | test | ||
3 | NOT' | ||
4 | echo OK:$? | ||
diff --git a/shell/hush_test/hush-heredoc/heredoc7.right b/shell/hush_test/hush-heredoc/heredoc7.right new file mode 100644 index 000000000..5d9c6c6c0 --- /dev/null +++ b/shell/hush_test/hush-heredoc/heredoc7.right | |||
@@ -0,0 +1 @@ | |||
_ASBOX | |||
diff --git a/shell/hush_test/hush-heredoc/heredoc7.tests b/shell/hush_test/hush-heredoc/heredoc7.tests new file mode 100755 index 000000000..abd5941d9 --- /dev/null +++ b/shell/hush_test/hush-heredoc/heredoc7.tests | |||
@@ -0,0 +1,3 @@ | |||
1 | cat << _ACEOF | ||
2 | _ASBOX | ||
3 | _ACEOF | ||