summaryrefslogtreecommitdiff
path: root/modutils
diff options
context:
space:
mode:
Diffstat (limited to 'modutils')
-rw-r--r--modutils/lsmod.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/modutils/lsmod.c b/modutils/lsmod.c
index cc6b616..50621c2 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