diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-30 23:16:21 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-30 23:16:21 +0100 |
commit | e17764c8fb566f85020217dd8fd05fb6bc227e98 (patch) | |
tree | cf0a42cc23cd4aae92e69924087610a941c712a4 /coreutils | |
parent | ecd90fd488cd0c519070656f5cfa0b0959979be9 (diff) | |
download | busybox-w32-e17764c8fb566f85020217dd8fd05fb6bc227e98.tar.gz busybox-w32-e17764c8fb566f85020217dd8fd05fb6bc227e98.tar.bz2 busybox-w32-e17764c8fb566f85020217dd8fd05fb6bc227e98.zip |
further work on unicodization
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/cal.c | 2 | ||||
-rw-r--r-- | coreutils/df.c | 17 |
2 files changed, 10 insertions, 9 deletions
diff --git a/coreutils/cal.c b/coreutils/cal.c index 5ecb9131d..207fa967b 100644 --- a/coreutils/cal.c +++ b/coreutils/cal.c | |||
@@ -135,7 +135,7 @@ int cal_main(int argc UNUSED_PARAM, char **argv) | |||
135 | if (julian) | 135 | if (julian) |
136 | *hp++ = ' '; | 136 | *hp++ = ' '; |
137 | { | 137 | { |
138 | char *two_wchars = unicode_cut_nchars(2, buf); | 138 | char *two_wchars = unicode_conv_to_printable_fixedwidth(NULL, buf, 2); |
139 | strcpy(hp, two_wchars); | 139 | strcpy(hp, two_wchars); |
140 | free(two_wchars); | 140 | free(two_wchars); |
141 | } | 141 | } |
diff --git a/coreutils/df.c b/coreutils/df.c index ae68f0831..4b23faa7a 100644 --- a/coreutils/df.c +++ b/coreutils/df.c | |||
@@ -114,9 +114,6 @@ int df_main(int argc UNUSED_PARAM, char **argv) | |||
114 | while (1) { | 114 | while (1) { |
115 | const char *device; | 115 | const char *device; |
116 | const char *mount_point; | 116 | const char *mount_point; |
117 | #if ENABLE_FEATURE_ASSUME_UNICODE | ||
118 | size_t dev_len; | ||
119 | #endif | ||
120 | 117 | ||
121 | if (mount_table) { | 118 | if (mount_table) { |
122 | mount_entry = getmntent(mount_table); | 119 | mount_entry = getmntent(mount_table); |
@@ -178,11 +175,15 @@ int df_main(int argc UNUSED_PARAM, char **argv) | |||
178 | #endif | 175 | #endif |
179 | 176 | ||
180 | #if ENABLE_FEATURE_ASSUME_UNICODE | 177 | #if ENABLE_FEATURE_ASSUME_UNICODE |
181 | dev_len = unicode_strlen(device); | 178 | { |
182 | if (dev_len > 20) { | 179 | uni_stat_t uni_stat; |
183 | printf("%s\n%20s", device, ""); | 180 | char *uni_dev = unicode_conv_to_printable(&uni_stat, device); |
184 | } else { | 181 | if (uni_stat.unicode_width > 20) { |
185 | printf("%s%*s", device, 20 - (int)dev_len, ""); | 182 | printf("%s\n%20s", uni_dev, ""); |
183 | } else { | ||
184 | printf("%s%*s", uni_dev, 20 - (int)uni_stat.unicode_width, ""); | ||
185 | } | ||
186 | free(uni_dev); | ||
186 | } | 187 | } |
187 | #else | 188 | #else |
188 | if (printf("\n%-20s" + 1, device) > 20) | 189 | if (printf("\n%-20s" + 1, device) > 20) |