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

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();
}