mirror of
https://github.com/sheumann/hush.git
synced 2025-01-03 00:31:16 +00:00
lsmod: beautify. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
b57eee8beb
commit
f8a73bfa33
@ -7,7 +7,6 @@
|
|||||||
*
|
*
|
||||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "libbb.h"
|
#include "libbb.h"
|
||||||
#include "unicode.h"
|
#include "unicode.h"
|
||||||
|
|
||||||
@ -47,9 +46,9 @@ int lsmod_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
|
|||||||
#if ENABLE_FEATURE_LSMOD_PRETTY_2_6_OUTPUT
|
#if ENABLE_FEATURE_LSMOD_PRETTY_2_6_OUTPUT
|
||||||
char *token[4];
|
char *token[4];
|
||||||
parser_t *parser = config_open("/proc/modules");
|
parser_t *parser = config_open("/proc/modules");
|
||||||
#if ENABLE_FEATURE_ASSUME_UNICODE
|
# if ENABLE_FEATURE_ASSUME_UNICODE
|
||||||
size_t name_len;
|
size_t name_len;
|
||||||
#endif
|
# endif
|
||||||
check_unicode_in_env();
|
check_unicode_in_env();
|
||||||
|
|
||||||
printf("%-24sSize Used by", "Module");
|
printf("%-24sSize Used by", "Module");
|
||||||
@ -64,13 +63,13 @@ int lsmod_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
|
|||||||
token[3][strlen(token[3])-1] = '\0';
|
token[3][strlen(token[3])-1] = '\0';
|
||||||
} else
|
} else
|
||||||
token[3] = (char *) "";
|
token[3] = (char *) "";
|
||||||
#if ENABLE_FEATURE_ASSUME_UNICODE
|
# if ENABLE_FEATURE_ASSUME_UNICODE
|
||||||
name_len = bb_mbstrlen(token[0]);
|
name_len = bb_mbstrlen(token[0]);
|
||||||
name_len = (name_len > 19) ? 0 : 19 - name_len;
|
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]);
|
printf("%s%*s %8s %2s %s\n", token[0], name_len, "", token[1], token[2], token[3]);
|
||||||
#else
|
# else
|
||||||
printf("%-19s %8s %2s %s\n", token[0], token[1], token[2], token[3]);
|
printf("%-19s %8s %2s %s\n", token[0], token[1], token[2], token[3]);
|
||||||
#endif
|
# endif
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while (config_read(parser, token, 4, 4, "# \t", PARSE_NORMAL & ~PARSE_GREEDY)) {
|
while (config_read(parser, token, 4, 4, "# \t", PARSE_NORMAL & ~PARSE_GREEDY)) {
|
||||||
@ -78,13 +77,13 @@ int lsmod_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
|
|||||||
// or comma-separated list ended by comma
|
// or comma-separated list ended by comma
|
||||||
// so trimming the trailing char is just what we need!
|
// so trimming the trailing char is just what we need!
|
||||||
token[3][strlen(token[3])-1] = '\0';
|
token[3][strlen(token[3])-1] = '\0';
|
||||||
#if ENABLE_FEATURE_ASSUME_UNICODE
|
# if ENABLE_FEATURE_ASSUME_UNICODE
|
||||||
name_len = bb_mbstrlen(token[0]);
|
name_len = bb_mbstrlen(token[0]);
|
||||||
name_len = (name_len > 19) ? 0 : 19 - name_len;
|
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]);
|
printf("%s%*s %8s %2s %s\n", token[0], name_len, "", token[1], token[2], token[3]);
|
||||||
#else
|
# else
|
||||||
printf("%-19s %8s %2s %s\n", token[0], token[1], token[2], token[3]);
|
printf("%-19s %8s %2s %s\n", token[0], token[1], token[2], token[3]);
|
||||||
#endif
|
# endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ENABLE_FEATURE_CLEAN_UP)
|
if (ENABLE_FEATURE_CLEAN_UP)
|
||||||
|
Loading…
Reference in New Issue
Block a user