• use a flag for determining here strings, don’t parse delimiter every time
• don’t leak memory parsing possible I/O redirection tokens • get rid of volatile by using more const (also helps codegen, methinks) • support empty here document markers (mksh extension) • pimp the manpage
This commit is contained in:
8
tree.c
8
tree.c
@ -22,7 +22,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/tree.c,v 1.46 2011/05/04 22:38:27 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/tree.c,v 1.47 2011/05/05 00:05:01 tg Exp $");
|
||||
|
||||
#define INDENT 8
|
||||
|
||||
@ -198,12 +198,12 @@ ptree(struct op *t, int indent, struct shf *shf)
|
||||
struct ioword *iop = *ioact++;
|
||||
|
||||
/* heredoc is 0 when tracing (set -x) */
|
||||
if ((iop->flag & IOTYPE) == IOHERE && iop->heredoc &&
|
||||
/* iop->delim[1] == '<' means here string */
|
||||
(!iop->delim || iop->delim[1] != '<')) {
|
||||
if ((iop->flag & (IOTYPE | IOHERESTR)) == IOHERE &&
|
||||
iop->heredoc) {
|
||||
shf_putc('\n', shf);
|
||||
shf_puts(iop->heredoc, shf);
|
||||
fptreef(shf, indent, "%s",
|
||||
iop->flag & IONDELIM ? "<<" :
|
||||
evalstr(iop->delim, 0));
|
||||
need_nl = true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user