aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-07-11 21:36:13 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-07-11 21:36:13 +0200
commit42a8fd0db08ab8b45fec6eab4af841f99576b260 (patch)
tree55f0600298da0c83c638c985d0c8b6d803be926b /coreutils
parent883cea47518a171ab83f8e41def3aec92207519e (diff)
downloadbusybox-42a8fd0db08ab8b45fec6eab4af841f99576b260.tar.gz
added simplified Unicode support for non-locale-enabled builds
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/ls.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 8a6faf23f..20b979db6 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -30,12 +30,9 @@
* [2009-03]
* ls sorts listing now, and supports almost all options.
*/
-
#include "libbb.h"
+#include "unicode.h"
-#if ENABLE_FEATURE_ASSUME_UNICODE
-#include <wchar.h>
-#endif
/* This is a NOEXEC applet. Be very careful! */
@@ -296,9 +293,8 @@ enum {
/* libbb candidate */
static size_t mbstrlen(const char *string)
{
- size_t width = mbsrtowcs(NULL /*dest*/, &string,
- MAXINT(size_t) /*len*/, NULL /*state*/);
- if (width == (size_t)-1)
+ size_t width = mbstowcs(NULL, string, INT_MAX);
+ if (width == (size_t)-1L)
return strlen(string);
return width;
}
@@ -932,6 +928,8 @@ int ls_main(int argc UNUSED_PARAM, char **argv)
INIT_G();
+ check_unicode_in_env();
+
all_fmt = LIST_SHORT |
(ENABLE_FEATURE_LS_SORTFILES * (SORT_NAME | SORT_FORWARD));