add new #ifdef MKSH_ASSUME_UTF8 which saves us from needing to

call setlocale() if we know the result will always be UTF-8
This commit is contained in:
tg 2007-02-10 21:59:15 +00:00
parent 665fba6dbf
commit a0fcdecb75
2 changed files with 8 additions and 4 deletions

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/Makefile,v 1.29 2007/01/18 16:05:05 tg Exp $
# $MirOS: src/bin/mksh/Makefile,v 1.30 2007/02/10 21:59:15 tg Exp $
PROG= mksh
SRCS= alloc.c edit.c eval.c exec.c expr.c funcs.c histrap.c \
@ -13,10 +13,10 @@ CPPFLAGS+= -DHAVE_ATTRIBUTE=1 -DHAVE_ATTRIBUTE_BOUNDED=1 \
-DHAVE_SYS_SIGNAME=1 -DHAVE__SYS_SIGNAME=0 \
-DHAVE_SYS_SIGLIST=1 -DHAVE_STRSIGNAL=0 -DHAVE_ARC4RANDOM=1 \
-DHAVE_ARC4RANDOM_PUSH=1 -DHAVE_FLOCK_EX=1 \
-DHAVE_SETLOCALE_CTYPE=1 -DHAVE_LANGINFO_CODESET=1 \
-DHAVE_SETLOCALE_CTYPE=0 -DHAVE_LANGINFO_CODESET=0 \
-DHAVE_REVOKE=1 -DHAVE_SETMODE=1 -DHAVE_SETRESUGID=1 \
-DHAVE_SETGROUPS=1 -DHAVE_STRCASESTR=1 -DHAVE_STRLCPY=1 \
-DHAVE_MULTI_IDSTRING=1
-DHAVE_MULTI_IDSTRING=1 -DMKSH_ASSUME_UTF8
.endif
CDIAGFLAGS+= -Wno-cast-qual

6
main.c
View File

@ -13,7 +13,7 @@
#include <locale.h>
#endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.68 2007/01/15 00:18:47 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.69 2007/02/10 21:59:15 tg Exp $");
extern char **environ;
@ -280,6 +280,7 @@ main(int argc, char *argv[])
j_init(i);
/* Do this after j_init(), as tty_fd is not initialised 'til then */
if (Flag(FTALKING)) {
#ifndef MKSH_ASSUME_UTF8
#if HAVE_SETLOCALE_CTYPE
#define isuc(x) (((x) != NULL) && \
(strcasestr((x), "UTF-8") || strcasestr((x), "utf8")))
@ -293,6 +294,9 @@ main(int argc, char *argv[])
Flag(FUTFHACK) = isuc(cc);
}
#undef isuc
#endif
#else
Flag(FUTFHACK) = 1;
#endif
x_init();
}