tweaking Unicode support
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 20b979d..827b350 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -289,20 +289,6 @@
} while (0)
-#if ENABLE_FEATURE_ASSUME_UNICODE
-/* libbb candidate */
-static size_t mbstrlen(const char *string)
-{
- size_t width = mbstowcs(NULL, string, INT_MAX);
- if (width == (size_t)-1L)
- return strlen(string);
- return width;
-}
-#else
-#define mbstrlen(string) strlen(string)
-#endif
-
-
static struct dnode *my_stat(const char *fullname, const char *name, int force_follow)
{
struct stat dstat;
@@ -570,7 +556,7 @@
} else {
/* find the longest file name, use that as the column width */
for (i = 0; i < nfiles; i++) {
- int len = mbstrlen(dn[i]->name);
+ int len = bb_mbstrlen(dn[i]->name);
if (column_width < len)
column_width = len;
}
@@ -717,7 +703,7 @@
{
if (option_mask32 & OPT_Q) {
#if ENABLE_FEATURE_ASSUME_UNICODE
- int len = 2 + mbstrlen(name);
+ int len = 2 + bb_mbstrlen(name);
#else
int len = 2;
#endif
@@ -737,7 +723,7 @@
/* No -Q: */
#if ENABLE_FEATURE_ASSUME_UNICODE
fputs(name, stdout);
- return mbstrlen(name);
+ return bb_mbstrlen(name);
#else
return printf("%s", name);
#endif