about summary refs log tree commit diff
path: root/Src/lex.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-09-14 14:46:26 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-09-14 14:46:26 +0000
commitf1495f5099073e2e4896c13e28e8d936b4979fd3 (patch)
treed793cce372b9e1c4435db4174867c8a4cb37cb0c /Src/lex.c
parent3b6b4982b9a61cb84888e8eba7200637fc3b3c12 (diff)
downloadzsh-f1495f5099073e2e4896c13e28e8d936b4979fd3.tar.gz
zsh-f1495f5099073e2e4896c13e28e8d936b4979fd3.tar.xz
zsh-f1495f5099073e2e4896c13e28e8d936b4979fd3.zip
28259: Finally fix some ancient problems with here-documents
Diffstat (limited to 'Src/lex.c')
-rw-r--r--Src/lex.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Src/lex.c b/Src/lex.c
index 83257da8c..28899fef0 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -384,16 +384,17 @@ zshlex(void)
     if (tok == NEWLIN || tok == ENDINPUT) {
 	while (hdocs) {
 	    struct heredocs *next = hdocs->next;
-	    char *name;
+	    char *doc, *munged_term;
 
 	    hwbegin(0);
 	    cmdpush(hdocs->type == REDIR_HEREDOC ? CS_HEREDOC : CS_HEREDOCD);
+	    munged_term = dupstring(hdocs->str);
 	    STOPHIST
-	    name = gethere(hdocs->str, hdocs->type);
+	    doc = gethere(&munged_term, hdocs->type);
 	    ALLOWHIST
 	    cmdpop();
 	    hwend();
-	    if (!name) {
+	    if (!doc) {
 		zerr("here document too large");
 		while (hdocs) {
 		    next = hdocs->next;
@@ -403,7 +404,8 @@ zshlex(void)
 		tok = LEXERR;
 		break;
 	    }
-	    setheredoc(hdocs->pc, REDIR_HERESTR, name);
+	    setheredoc(hdocs->pc, REDIR_HERESTR, doc, hdocs->str,
+		       munged_term);
 	    zfree(hdocs, sizeof(struct heredocs));
 	    hdocs = next;
 	}