diff options
author | Tim Riker <tim@rikers.org> | 2003-11-07 19:37:20 +0000 |
---|---|---|
committer | Tim Riker <tim@rikers.org> | 2003-11-07 19:37:20 +0000 |
commit | b1ffba040134bd6e93c66a92ff0dca72d22d9cfe (patch) | |
tree | 689444038c8704e5cd39c8f8ad38471892d650f5 | |
parent | 1b1942f93dba68535df873b6de456ac8325e8dcb (diff) | |
download | busybox-w32-b1ffba040134bd6e93c66a92ff0dca72d22d9cfe.tar.gz busybox-w32-b1ffba040134bd6e93c66a92ff0dca72d22d9cfe.tar.bz2 busybox-w32-b1ffba040134bd6e93c66a92ff0dca72d22d9cfe.zip |
wrap bb help output if CONFIG_FEATURE_AUTOWIDTH
-rw-r--r-- | applets/busybox.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/applets/busybox.c b/applets/busybox.c index 997c15514..dfcf400e0 100644 --- a/applets/busybox.c +++ b/applets/busybox.c | |||
@@ -135,6 +135,14 @@ int busybox_main(int argc, char **argv) | |||
135 | /* If we've already been here once, exit now */ | 135 | /* If we've already been here once, exit now */ |
136 | if (been_there_done_that == 1 || argc < 1) { | 136 | if (been_there_done_that == 1 || argc < 1) { |
137 | const struct BB_applet *a = applets; | 137 | const struct BB_applet *a = applets; |
138 | int output_width = 60; | ||
139 | |||
140 | #ifdef CONFIG_FEATURE_AUTOWIDTH | ||
141 | /* Obtain the terminal width. */ | ||
142 | get_terminal_width_height(0, &output_width, NULL); | ||
143 | /* leading tab and room to wrap */ | ||
144 | output_width -= 20; | ||
145 | #endif | ||
138 | 146 | ||
139 | fprintf(stderr, "%s\n\n" | 147 | fprintf(stderr, "%s\n\n" |
140 | "Usage: busybox [function] [arguments]...\n" | 148 | "Usage: busybox [function] [arguments]...\n" |
@@ -149,7 +157,7 @@ int busybox_main(int argc, char **argv) | |||
149 | col += | 157 | col += |
150 | fprintf(stderr, "%s%s", ((col == 0) ? "\t" : ", "), | 158 | fprintf(stderr, "%s%s", ((col == 0) ? "\t" : ", "), |
151 | (a++)->name); | 159 | (a++)->name); |
152 | if (col > 60 && a->name != 0) { | 160 | if (col > output_width && a->name != 0) { |
153 | fprintf(stderr, ",\n"); | 161 | fprintf(stderr, ",\n"); |
154 | col = 0; | 162 | col = 0; |
155 | } | 163 | } |