tweak some iop/conservative_fds-related things I picked up while thinking lksh

This commit is contained in:
tg
2015-10-09 19:29:50 +00:00
parent 22fff17047
commit fc48729336
6 changed files with 28 additions and 24 deletions

10
syn.c
View File

@@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.105 2015/10/09 17:48:53 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.106 2015/10/09 19:29:50 tg Exp $");
struct nesting_state {
int start_token; /* token than began nesting (eg, FOR) */
@@ -210,18 +210,22 @@ synio(int cf)
yyerror("too many %ss\n", "<<");
*herep++ = iop;
} else
iop->name = yylval.cp;
iop->ioname = yylval.cp;
if (iop->ioflag & IOBASH) {
char *cp;
nextiop = alloc(sizeof(*iop), ATEMP);
nextiop->name = cp = alloc(5, ATEMP);
#ifdef MKSH_CONSERVATIVE_FDS
nextiop->ioname = cp = alloc(3, ATEMP);
#else
nextiop->ioname = cp = alloc(5, ATEMP);
if (iop->unit > 9) {
*cp++ = CHAR;
*cp++ = digits_lc[iop->unit / 10];
}
#endif
*cp++ = CHAR;
*cp++ = digits_lc[iop->unit % 10];
*cp = EOS;