a certain size optimisation broke the utf8bom-3 regression test if

mksh was configured to have utf-8 mode “always on” (because it's
really only always on for interactive shells); setting it to really
always on would break the other half of this regression test, so
do the optimisation only if MKSH_SMALL
This commit is contained in:
tg 2007-05-10 19:22:11 +00:00
parent 384032b729
commit d2d035355f
2 changed files with 4 additions and 3 deletions

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.102 2007/05/10 19:08:47 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.103 2007/05/10 19:22:10 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -3955,6 +3955,7 @@ expected-stdout:
name: utf8bom-3
description:
Reading the UTF-8 BOM should enable the utf8-hack flag
(unless both MKSH_ASSUME_UTF8 and MKSH_SMALL are set)
category: pdksh
stdin:
$0 -c ':; x=$(set +o); if [[ $x = *utf8* ]]; then print on; else print off; fi'

4
lex.c
View File

@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.29 2007/04/26 11:58:53 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.30 2007/05/10 19:22:11 tg Exp $");
/* Structure to keep track of the lexing state and the various pieces of info
* needed for each particular state. */
@ -957,7 +957,7 @@ getsc__(void)
(((const unsigned char *)(s->str))[0] == 0xBB) &&
(((const unsigned char *)(s->str))[1] == 0xBF)) {
s->str += 2;
#ifndef MKSH_ASSUME_UTF8 /* otherwise it's always on */
#if !defined(MKSH_ASSUME_UTF8) || !defined(MKSH_SMALL)
Flag(FUTFHACK) = 1;
#endif
goto getsc_again;