summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenys Vlasenko2009-07-11 22:26:48 +0200
committerDenys Vlasenko2009-07-11 22:26:48 +0200
commitfda8f57360aaf24dba3784aae4818f5a351f5c7d (patch)
treeb8de1ad1663efc5270ae2e5e1067d84a1530474f /coreutils
parent42a8fd0db08ab8b45fec6eab4af841f99576b260 (diff)
downloadbusybox-fda8f57360aaf24dba3784aae4818f5a351f5c7d.zip
busybox-fda8f57360aaf24dba3784aae4818f5a351f5c7d.tar.gz
tweaking Unicode support
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/ls.c20
1 files changed, 3 insertions, 17 deletions
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 @@ enum {
} 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 @@ static void showfiles(struct dnode **dn, int nfiles)
} 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 @@ static int print_name(const char *name)
{
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 @@ static int print_name(const char *name)
/* No -Q: */
#if ENABLE_FEATURE_ASSUME_UNICODE
fputs(name, stdout);
- return mbstrlen(name);
+ return bb_mbstrlen(name);
#else
return printf("%s", name);
#endif