ch = i_getch(input);
nommu_addchr(as_string, ch);
if (ch == '\n'
+ /* TODO: or EOF? (heredoc delimiter may end with <eof>, not only <eol> */
&& ((heredoc_flags & HEREDOC_QUOTED) || prev != '\\')
) {
if (strcmp(heredoc.data + past_EOL, word) == 0) {
return heredoc.data;
}
do {
- o_addchr(&heredoc, ch);
+ o_addchr(&heredoc, '\n');
+ prev = 0; /* not \ */
past_EOL = heredoc.length;
jump_in:
do {
return NULL;
}
o_addchr(&heredoc, ch);
+ if (prev == '\\' && ch == '\\')
+ /* Correctly handle foo\\<eol> (not a line cont.) */
+ prev = 0; /* not \ */
+ else
+ prev = ch;
nommu_addchr(as_string, ch);
- prev = ch;
}
}
Quoted heredoc:
a\
b
+a\\
+ b
123456 -$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
-$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
c\
Unquoted heredoc:
a b
+a\
+ b
123456 -qwerty-\t-\-\"-\'-`-\--\z-\*-\?-
-qwerty-\t-\-\"-\'-`-\--\z-\*-\?-
cEOF2
Quoted -heredoc:
a\
+b
+a\\
b
123456 -$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
-$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
Unquoted -heredoc:
a b
+a\
+b
123456 -qwerty-\t-\-\"-\'-`-\--\z-\*-\?-
-qwerty-\t-\-\"-\'-`-\--\z-\*-\?-
cEOF4
cat <<"EOF1"
a\
b
+a\\
+ b
123456 -$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
-$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
c\
cat <<EOF2
a\
b
+a\\
+ b
123456 -$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
-$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
c\
cat <<-"EOF3"
a\
b
+a\\
+ b
123456 -$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
-$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
c\
cat <<-EOF4
a\
b
+a\\
+ b
123456 -$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
-$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
c\