mksh/mksh.logging/exec.c
static int
hereinval(struct ioword *iop, int sub, char **resbuf, struct shf *shf)
{
	const char * volatile ccp = iop->heredoc;
	struct source *s, *osource;

	osource = source;
	newenv(E_ERRH);
	if (kshsetjmp(e->jbuf)) {
		source = osource;
		quitenv(shf);
		/* special to iosetup(): don't print error */
		return (-2);
	}
	if (iop->ioflag & IOHERESTR) {
	  ccp = evalstr(iop->delim, DOHERESTR | DOSCALAR | DOHEREDOC, 0);
	} else if (sub) {
		/* do substitutions on the content of heredoc */
		s = pushs(SSTRING, ATEMP);
		s->start = s->str = ccp;
		source = s;
		if (yylex(sub) != LWORD)
			internal_errorf("%s: %s", "herein", "yylex");
		source = osource;
		ccp = evalstr(yylval.cp, DOSCALAR | DOHEREDOC, 0);
	}

	if (resbuf == NULL)
		shf_puts(ccp, shf);
	else
		strdupx(*resbuf, ccp, APERM);

	quitenv(NULL);
	return (0);
}
/*
 * Process here documents by providing the content, either as
 * result (globally allocated) string or in a temp file; if
 * unquoted, the string is expanded first.
 */
Process here documents by providing the content, either as
result (globally allocated) string or in a temp file; if
unquoted, the string is expanded first.
Process here documents by providing the content either as result ( globally allocated ) string or in a temp file ; if unquoted the string is expanded first .
static int
hereinval(struct ioword *iop, int sub, char **resbuf, struct shf *shf)
{
	const char * volatile ccp = iop->heredoc;
	struct source *s, *osource;
	osource = source;
	newenv(E_ERRH);
	if (kshsetjmp(e->jbuf)) {
		source = osource;
		quitenv(shf);
		return (-2);
	}
	if (iop->ioflag & IOHERESTR) {
	  ccp = evalstr(iop->delim, DOHERESTR | DOSCALAR | DOHEREDOC, 0);
	} else if (sub) {
		s = pushs(SSTRING, ATEMP);
		s->start = s->str = ccp;
		source = s;
		if (yylex(sub) != LWORD)
			internal_errorf("%s: %s", "herein", "yylex");
		source = osource;
		ccp = evalstr(yylval.cp, DOSCALAR | DOHEREDOC, 0);
	}
	if (resbuf == NULL)
		shf_puts(ccp, shf);
	else
		strdupx(*resbuf, ccp, APERM);
	quitenv(NULL);
	return (0);
}
static int hereinval ( struct ioword * iop , int sub , char * * resbuf , struct shf * shf ) { const char * volatile ccp = iop -> heredoc ; struct source * s , * osource ; osource = source ; newenv ( E_ERRH ) ; if ( kshsetjmp ( e -> jbuf ) ) { source = osource ; quitenv ( shf ) ; return ( -2 ) ; } if ( iop -> ioflag & IOHERESTR ) { ccp = evalstr ( iop -> delim , DOHERESTR | DOSCALAR | DOHEREDOC , 0 ) ; } else if ( sub ) { s = pushs ( SSTRING , ATEMP ) ; s -> start = s -> str = ccp ; source = s ; if ( yylex ( sub ) != LWORD ) internal_errorf ( " " , " " , " " ) ; source = osource ; ccp = evalstr ( yylval . cp , DOSCALAR | DOHEREDOC , 0 ) ; } if ( resbuf == NULL ) shf_puts ( ccp , shf ) ; else strdupx ( * resbuf , ccp , APERM ) ; quitenv ( NULL ) ; return ( 0 ) ; }
Process here documents by providing the content, either as
 result (globally allocated) string or in a temp file; if
 unquoted, the string is expanded first.
Process here documents by providing the content either as result ( globally allocated ) string or in a temp file ; if unquoted the string is expanded first .
/* special to iosetup(): don't print error */ /* do substitutions on the content of heredoc */