further work on unicodization
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user