Blob Blame Raw
diff -up ksh-20120801/src/cmd/ksh93/sh/lex.c.heresub ksh-20120801/src/cmd/ksh93/sh/lex.c
--- ksh-20120801/src/cmd/ksh93/sh/lex.c.heresub	2014-05-21 16:48:42.635700984 +0200
+++ ksh-20120801/src/cmd/ksh93/sh/lex.c	2014-05-21 16:48:42.678700772 +0200
@@ -1557,6 +1557,7 @@ static int comsub(register Lex_t *lp, in
 {
 	register int	n,c,count=1;
 	register int	line=lp->sh->inlineno;
+	struct ionod	*inheredoc = lp->heredoc;
 	char *first,*cp=fcseek(0),word[5];
 	int off, messages=0, assignok=lp->assignok, csub;
 	struct lexstate	save;
@@ -1683,7 +1684,7 @@ done:
 	lp->lexd.dolparen--;
 	lp->lex = save;
 	lp->assignok = (endchar(lp)==RBRACT?assignok:0);
-	if(lp->heredoc)
+	if(lp->heredoc && !inheredoc)
 		errormsg(SH_DICT,ERROR_exit(SYNBAD),e_lexsyntax5,lp->sh->inlineno,lp->heredoc->ioname);
 	return(messages);
 }
diff -up ksh-20120801/src/cmd/ksh93/sh/macro.c.heresub ksh-20120801/src/cmd/ksh93/sh/macro.c
--- ksh-20120801/src/cmd/ksh93/sh/macro.c.heresub	2014-05-21 16:48:42.650700910 +0200
+++ ksh-20120801/src/cmd/ksh93/sh/macro.c	2014-05-21 16:48:42.678700772 +0200
@@ -2085,7 +2085,7 @@ static void comsubst(Mac_t *mp,register
 			}
 			sfputc(stkp,c);
 		}
-		sfputc(stkp,' ');
+		sfputc(stkp,'\n');
 		c = stktell(stkp);
 		str=stkfreeze(stkp,1);
 		/* disable verbose and don't save in history file */