fix tree printing multiple heredocs in one command, bug found by izabera

This commit is contained in:
tg
2015-09-05 20:20:48 +00:00
parent 4adcfe8b58
commit edc2acd61d
4 changed files with 76 additions and 29 deletions

10
lex.c
View File

@@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.206 2015/09/05 19:19:06 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.207 2015/09/05 20:20:46 tg Exp $");
/*
* states while lexing word
@@ -946,6 +946,14 @@ yylex(int cf)
c2 = getsc();
} else if (c2 == '<')
iop->ioflag |= IOHERESTR;
if (c2 == ' ') {
/*XXX reentrancy hack IONDELIM */
c2 = getsc();
if (c2 != '\n') {
ungetsc(c2);
c2 = ' ';
}
}
ungetsc(c2);
if (c2 == '\n')
iop->ioflag |= IONDELIM;