aboutsummaryrefslogtreecommitdiff
path: root/libbb/unicode.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-03-27 01:18:07 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2011-03-27 01:18:07 +0100
commit353680aa46dc91ecfd80dd19db131de7aa90bd22 (patch)
tree05de26c20457b407fa59501708d3b31d2aa081f5 /libbb/unicode.c
parent19311bfa7b8e8c6effa9c375de9b0eb4338bee12 (diff)
downloadbusybox-w32-353680aa46dc91ecfd80dd19db131de7aa90bd22.tar.gz
busybox-w32-353680aa46dc91ecfd80dd19db131de7aa90bd22.tar.bz2
busybox-w32-353680aa46dc91ecfd80dd19db131de7aa90bd22.zip
lineedit: fixes for CONFIG_UNICODE_USING_LOCALE=y
function old new delta load_string 45 91 +46 save_string 40 82 +42 reinit_unicode 34 61 +27 BB_PUTCHAR 97 120 +23 init_unicode 17 37 +20 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 5/0 up/down: 158/0) Total: 158 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/unicode.c')
-rw-r--r--libbb/unicode.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libbb/unicode.c b/libbb/unicode.c
index d01efd9a2..99dc1dfa6 100644
--- a/libbb/unicode.c
+++ b/libbb/unicode.c
@@ -23,12 +23,13 @@ uint8_t unicode_status;
23 23
24/* Unicode support using libc locale support. */ 24/* Unicode support using libc locale support. */
25 25
26void FAST_FUNC reinit_unicode(const char *LANG UNUSED_PARAM) 26void FAST_FUNC reinit_unicode(const char *LANG)
27{ 27{
28 static const char unicode_0x394[] = { 0xce, 0x94, 0 }; 28 static const char unicode_0x394[] = { 0xce, 0x94, 0 };
29 size_t width; 29 size_t width;
30 30
31//TODO: call setlocale(LC_ALL, LANG) here? 31//TODO: avoid repeated calls by caching last string?
32 setlocale(LC_ALL, (LANG && LANG[0]) ? LANG : "C");
32 33
33 /* In unicode, this is a one character string */ 34 /* In unicode, this is a one character string */
34// can use unicode_strlen(string) too, but otherwise unicode_strlen() is unused 35// can use unicode_strlen(string) too, but otherwise unicode_strlen() is unused
@@ -39,7 +40,7 @@ void FAST_FUNC reinit_unicode(const char *LANG UNUSED_PARAM)
39void FAST_FUNC init_unicode(void) 40void FAST_FUNC init_unicode(void)
40{ 41{
41 if (unicode_status == UNICODE_UNKNOWN) 42 if (unicode_status == UNICODE_UNKNOWN)
42 reinit_unicode(NULL /*getenv("LANG")*/); 43 reinit_unicode(getenv("LANG"));
43} 44}
44 45
45#else 46#else