• speed optimisation: drop SF_FIRST flag, factor out skipping the

UTF-8 BOM instead (UTFMODE has a separate value now for activated
  during BOM skipping)
• parsing a COMSUB now skips UTF-8 BOM, too, but only temporarily
This commit is contained in:
tg
2011-03-13 16:03:54 +00:00
parent e66eaab861
commit af53a7d16a
6 changed files with 54 additions and 35 deletions

9
main.c
View File

@ -33,7 +33,7 @@
#include <locale.h>
#endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.180 2011/03/13 01:20:21 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.181 2011/03/13 16:03:52 tg Exp $");
extern char **environ;
@ -663,12 +663,10 @@ shell(Source * volatile s, volatile int toplevel)
volatile int wastty = s->flags & SF_TTY;
volatile int attempts = 13;
volatile int interactive = Flag(FTALKING) && toplevel;
volatile bool sfirst = true;
Source *volatile old_source = source;
int i;
/* enable UTF-8 BOM check */
s->flags |= SF_FIRST;
newenv(E_PARSE);
if (interactive)
really_exit = 0;
@ -730,7 +728,8 @@ shell(Source * volatile s, volatile int toplevel)
j_notify();
set_prompt(PS1, s);
}
t = compile(s);
t = compile(s, sfirst);
sfirst = false;
if (t != NULL && t->type == TEOF) {
if (wastty && Flag(FIGNOREEOF) && --attempts > 0) {
shellf("Use 'exit' to leave mksh\n");