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 /modutils | |
parent | ecd90fd488cd0c519070656f5cfa0b0959979be9 (diff) |
further work on unicodization
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'modutils')
-rw-r--r-- | modutils/lsmod.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/modutils/lsmod.c b/modutils/lsmod.c index cc6b6162f..50621c245 100644 --- a/modutils/lsmod.c +++ b/modutils/lsmod.c @@ -46,9 +46,6 @@ int lsmod_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) #if ENABLE_FEATURE_LSMOD_PRETTY_2_6_OUTPUT char *token[4]; parser_t *parser = config_open("/proc/modules"); -# if ENABLE_FEATURE_ASSUME_UNICODE - size_t name_len; -# endif init_unicode(); printf("%-24sSize Used by", "Module"); @@ -64,9 +61,13 @@ int lsmod_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) } else token[3] = (char *) ""; # if ENABLE_FEATURE_ASSUME_UNICODE - name_len = unicode_strlen(token[0]); - name_len = (name_len > 19) ? 0 : 19 - name_len; - printf("%s%*s %8s %2s %s\n", token[0], name_len, "", token[1], token[2], token[3]); + { + uni_stat_t uni_stat; + char *uni_name = unicode_conv_to_printable(&uni_stat, token[0]); + unsigned pad_len = (uni_stat.unicode_width > 19) ? 0 : 19 - uni_stat.unicode_width; + printf("%s%*s %8s %2s %s\n", uni_name, pad_len, "", token[1], token[2], token[3]); + free(uni_name); + } # else printf("%-19s %8s %2s %s\n", token[0], token[1], token[2], token[3]); # endif @@ -78,9 +79,13 @@ int lsmod_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) // so trimming the trailing char is just what we need! token[3][strlen(token[3])-1] = '\0'; # if ENABLE_FEATURE_ASSUME_UNICODE - name_len = unicode_strlen(token[0]); - name_len = (name_len > 19) ? 0 : 19 - name_len; - printf("%s%*s %8s %2s %s\n", token[0], name_len, "", token[1], token[2], token[3]); + { + uni_stat_t uni_stat; + char *uni_name = unicode_conv_to_printable(&uni_stat, token[0]); + unsigned pad_len = (uni_stat.unicode_width > 19) ? 0 : 19 - uni_stat.unicode_width; + printf("%s%*s %8s %2s %s\n", uni_name, pad_len, "", token[1], token[2], token[3]); + free(uni_name); + } # else printf("%-19s %8s %2s %s\n", token[0], token[1], token[2], token[3]); # endif |