aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-11-04 18:01:17 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2009-11-04 18:01:17 +0100
commitf8a73bfa332c540f7f877132736905285c24249c (patch)
tree7fa8920601ce2f6eb783f16727dbff655bebc93c
parentb57eee8beb35706d4358ff5fb2a6f806765685ab (diff)
downloadbusybox-w32-f8a73bfa332c540f7f877132736905285c24249c.tar.gz
busybox-w32-f8a73bfa332c540f7f877132736905285c24249c.tar.bz2
busybox-w32-f8a73bfa332c540f7f877132736905285c24249c.zip
lsmod: beautify. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--modutils/lsmod.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/modutils/lsmod.c b/modutils/lsmod.c
index 50a7897ce..582503b66 100644
--- a/modutils/lsmod.c
+++ b/modutils/lsmod.c
@@ -7,7 +7,6 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
9 */ 9 */
10
11#include "libbb.h" 10#include "libbb.h"
12#include "unicode.h" 11#include "unicode.h"
13 12
@@ -47,9 +46,9 @@ int lsmod_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
47#if ENABLE_FEATURE_LSMOD_PRETTY_2_6_OUTPUT 46#if ENABLE_FEATURE_LSMOD_PRETTY_2_6_OUTPUT
48 char *token[4]; 47 char *token[4];
49 parser_t *parser = config_open("/proc/modules"); 48 parser_t *parser = config_open("/proc/modules");
50#if ENABLE_FEATURE_ASSUME_UNICODE 49# if ENABLE_FEATURE_ASSUME_UNICODE
51 size_t name_len; 50 size_t name_len;
52#endif 51# endif
53 check_unicode_in_env(); 52 check_unicode_in_env();
54 53
55 printf("%-24sSize Used by", "Module"); 54 printf("%-24sSize Used by", "Module");
@@ -64,13 +63,13 @@ int lsmod_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
64 token[3][strlen(token[3])-1] = '\0'; 63 token[3][strlen(token[3])-1] = '\0';
65 } else 64 } else
66 token[3] = (char *) ""; 65 token[3] = (char *) "";
67#if ENABLE_FEATURE_ASSUME_UNICODE 66# if ENABLE_FEATURE_ASSUME_UNICODE
68 name_len = bb_mbstrlen(token[0]); 67 name_len = bb_mbstrlen(token[0]);
69 name_len = (name_len > 19) ? 0 : 19 - name_len; 68 name_len = (name_len > 19) ? 0 : 19 - name_len;
70 printf("%s%*s %8s %2s %s\n", token[0], name_len, "", token[1], token[2], token[3]); 69 printf("%s%*s %8s %2s %s\n", token[0], name_len, "", token[1], token[2], token[3]);
71#else 70# else
72 printf("%-19s %8s %2s %s\n", token[0], token[1], token[2], token[3]); 71 printf("%-19s %8s %2s %s\n", token[0], token[1], token[2], token[3]);
73#endif 72# endif
74 } 73 }
75 } else { 74 } else {
76 while (config_read(parser, token, 4, 4, "# \t", PARSE_NORMAL & ~PARSE_GREEDY)) { 75 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)
78 // or comma-separated list ended by comma 77 // or comma-separated list ended by comma
79 // so trimming the trailing char is just what we need! 78 // so trimming the trailing char is just what we need!
80 token[3][strlen(token[3])-1] = '\0'; 79 token[3][strlen(token[3])-1] = '\0';
81#if ENABLE_FEATURE_ASSUME_UNICODE 80# if ENABLE_FEATURE_ASSUME_UNICODE
82 name_len = bb_mbstrlen(token[0]); 81 name_len = bb_mbstrlen(token[0]);
83 name_len = (name_len > 19) ? 0 : 19 - name_len; 82 name_len = (name_len > 19) ? 0 : 19 - name_len;
84 printf("%s%*s %8s %2s %s\n", token[0], name_len, "", token[1], token[2], token[3]); 83 printf("%s%*s %8s %2s %s\n", token[0], name_len, "", token[1], token[2], token[3]);
85#else 84# else
86 printf("%-19s %8s %2s %s\n", token[0], token[1], token[2], token[3]); 85 printf("%-19s %8s %2s %s\n", token[0], token[1], token[2], token[3]);
87#endif 86# endif
88 } 87 }
89 } 88 }
90 if (ENABLE_FEATURE_CLEAN_UP) 89 if (ENABLE_FEATURE_CLEAN_UP)