diff options
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) | |||
46 | #if ENABLE_FEATURE_LSMOD_PRETTY_2_6_OUTPUT | 46 | #if ENABLE_FEATURE_LSMOD_PRETTY_2_6_OUTPUT |
47 | char *token[4]; | 47 | char *token[4]; |
48 | parser_t *parser = config_open("/proc/modules"); | 48 | parser_t *parser = config_open("/proc/modules"); |
49 | # if ENABLE_FEATURE_ASSUME_UNICODE | ||
50 | size_t name_len; | ||
51 | # endif | ||
52 | init_unicode(); | 49 | init_unicode(); |
53 | 50 | ||
54 | printf("%-24sSize Used by", "Module"); | 51 | printf("%-24sSize Used by", "Module"); |
@@ -64,9 +61,13 @@ int lsmod_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
64 | } else | 61 | } else |
65 | token[3] = (char *) ""; | 62 | token[3] = (char *) ""; |
66 | # if ENABLE_FEATURE_ASSUME_UNICODE | 63 | # if ENABLE_FEATURE_ASSUME_UNICODE |
67 | name_len = unicode_strlen(token[0]); | 64 | { |
68 | name_len = (name_len > 19) ? 0 : 19 - name_len; | 65 | uni_stat_t uni_stat; |
69 | printf("%s%*s %8s %2s %s\n", token[0], name_len, "", token[1], token[2], token[3]); | 66 | char *uni_name = unicode_conv_to_printable(&uni_stat, token[0]); |
67 | unsigned pad_len = (uni_stat.unicode_width > 19) ? 0 : 19 - uni_stat.unicode_width; | ||
68 | printf("%s%*s %8s %2s %s\n", uni_name, pad_len, "", token[1], token[2], token[3]); | ||
69 | free(uni_name); | ||
70 | } | ||
70 | # else | 71 | # else |
71 | printf("%-19s %8s %2s %s\n", token[0], token[1], token[2], token[3]); | 72 | printf("%-19s %8s %2s %s\n", token[0], token[1], token[2], token[3]); |
72 | # endif | 73 | # endif |
@@ -78,9 +79,13 @@ int lsmod_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
78 | // so trimming the trailing char is just what we need! | 79 | // so trimming the trailing char is just what we need! |
79 | token[3][strlen(token[3])-1] = '\0'; | 80 | token[3][strlen(token[3])-1] = '\0'; |
80 | # if ENABLE_FEATURE_ASSUME_UNICODE | 81 | # if ENABLE_FEATURE_ASSUME_UNICODE |
81 | name_len = unicode_strlen(token[0]); | 82 | { |
82 | name_len = (name_len > 19) ? 0 : 19 - name_len; | 83 | uni_stat_t uni_stat; |
83 | printf("%s%*s %8s %2s %s\n", token[0], name_len, "", token[1], token[2], token[3]); | 84 | char *uni_name = unicode_conv_to_printable(&uni_stat, token[0]); |
85 | unsigned pad_len = (uni_stat.unicode_width > 19) ? 0 : 19 - uni_stat.unicode_width; | ||
86 | printf("%s%*s %8s %2s %s\n", uni_name, pad_len, "", token[1], token[2], token[3]); | ||
87 | free(uni_name); | ||
88 | } | ||
84 | # else | 89 | # else |
85 | printf("%-19s %8s %2s %s\n", token[0], token[1], token[2], token[3]); | 90 | printf("%-19s %8s %2s %s\n", token[0], token[1], token[2], token[3]); |
86 | # endif | 91 | # endif |