aboutsummaryrefslogtreecommitdiff
path: root/applets
diff options
context:
space:
mode:
authorGravatar Tim Riker <tim@rikers.org>2003-11-07 19:37:20 +0000
committerGravatar Tim Riker <tim@rikers.org>2003-11-07 19:37:20 +0000
commitb1ffba040134bd6e93c66a92ff0dca72d22d9cfe (patch)
tree689444038c8704e5cd39c8f8ad38471892d650f5 /applets
parent1b1942f93dba68535df873b6de456ac8325e8dcb (diff)
downloadbusybox-b1ffba040134bd6e93c66a92ff0dca72d22d9cfe.tar.gz
busybox-b1ffba040134bd6e93c66a92ff0dca72d22d9cfe.tar.bz2
wrap bb help output if CONFIG_FEATURE_AUTOWIDTH
Diffstat (limited to 'applets')
-rw-r--r--applets/busybox.c10
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)
/* If we've already been here once, exit now */
if (been_there_done_that == 1 || argc < 1) {
const struct BB_applet *a = applets;
+ int output_width = 60;
+
+#ifdef CONFIG_FEATURE_AUTOWIDTH
+ /* Obtain the terminal width. */
+ get_terminal_width_height(0, &output_width, NULL);
+ /* leading tab and room to wrap */
+ output_width -= 20;
+#endif
fprintf(stderr, "%s\n\n"
"Usage: busybox [function] [arguments]...\n"
@@ -149,7 +157,7 @@ int busybox_main(int argc, char **argv)
col +=
fprintf(stderr, "%s%s", ((col == 0) ? "\t" : ", "),
(a++)->name);
- if (col > 60 && a->name != 0) {
+ if (col > output_width && a->name != 0) {
fprintf(stderr, ",\n");
col = 0;
}