added simplified Unicode support for non-locale-enabled builds
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index e5d0c1b..ab32972 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -34,10 +34,7 @@
* PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
*/
#include "libbb.h"
-#if ENABLE_FEATURE_ASSUME_UNICODE
-# include <wchar.h>
-# include <wctype.h>
-#endif
+#include "unicode.h"
/* FIXME: obsolete CONFIG item? */
#define ENABLE_FEATURE_NONPRINTABLE_INVERSE_PUT 0
@@ -1581,7 +1578,7 @@
return ic;
unicode_buf[unicode_idx++] = ic;
unicode_buf[unicode_idx] = '\0';
- if (mbstowcs(&wc, unicode_buf, 1) < 1 && unicode_idx < MB_CUR_MAX) {
+ if (mbstowcs(&wc, unicode_buf, 1) != 1 && unicode_idx < MB_CUR_MAX) {
delay = 50;
goto poll_again;
}
@@ -1636,6 +1633,8 @@
return len;
}
+ check_unicode_in_env();
+
// FIXME: audit & improve this
if (maxsize > MAX_LINELEN)
maxsize = MAX_LINELEN;