diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-03-31 18:43:55 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-03-31 18:43:55 +0000 |
commit | 81901a096c67b079fced2e63af4e15a2ca50465e (patch) | |
tree | 4e20f68dfb7373e902f2fb8430c02209d6eb78e8 | |
parent | 2766eedde85f092153a2affb2d3da491e2670982 (diff) | |
download | busybox-w32-81901a096c67b079fced2e63af4e15a2ca50465e.tar.gz busybox-w32-81901a096c67b079fced2e63af4e15a2ca50465e.tar.bz2 busybox-w32-81901a096c67b079fced2e63af4e15a2ca50465e.zip |
- add option to suppress the terse usage messages. Saves 6.8k for defconfig:
text data bss dec hex filename
861791 11264 1039140 1912195 1d2d83 busybox.have-terse-usage
854799 11264 1039140 1905203 1d1233 busybox.no-terse
-rw-r--r-- | Config.in | 10 | ||||
-rw-r--r-- | applets/applets.c | 4 |
2 files changed, 14 insertions, 0 deletions
@@ -37,9 +37,19 @@ config CONFIG_FEATURE_BUFFERS_GO_IN_BSS | |||
37 | 37 | ||
38 | endchoice | 38 | endchoice |
39 | 39 | ||
40 | config CONFIG_SHOW_USAGE | ||
41 | bool "Show terse applet usage messages" | ||
42 | default y | ||
43 | help | ||
44 | All BusyBox applets will show help messages when invoked with | ||
45 | wrong arguments. You can turn off printing these terse usage | ||
46 | messages if you say no here. | ||
47 | This will save you up to 7k. | ||
48 | |||
40 | config CONFIG_FEATURE_VERBOSE_USAGE | 49 | config CONFIG_FEATURE_VERBOSE_USAGE |
41 | bool "Show verbose applet usage messages" | 50 | bool "Show verbose applet usage messages" |
42 | default n | 51 | default n |
52 | select CONFIG_SHOW_USAGE | ||
43 | help | 53 | help |
44 | All BusyBox applets will show more verbose help messages when | 54 | All BusyBox applets will show more verbose help messages when |
45 | busybox is invoked with --help. This will add a lot of text to the | 55 | busybox is invoked with --help. This will add a lot of text to the |
diff --git a/applets/applets.c b/applets/applets.c index 82a6417de..77e4fdbfe 100644 --- a/applets/applets.c +++ b/applets/applets.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <assert.h> | 32 | #include <assert.h> |
33 | #include "busybox.h" | 33 | #include "busybox.h" |
34 | 34 | ||
35 | #if ENABLE_SHOW_USAGE | ||
35 | const char usage_messages[] = | 36 | const char usage_messages[] = |
36 | 37 | ||
37 | #define MAKE_USAGE | 38 | #define MAKE_USAGE |
@@ -42,6 +43,7 @@ const char usage_messages[] = | |||
42 | ; | 43 | ; |
43 | 44 | ||
44 | #undef MAKE_USAGE | 45 | #undef MAKE_USAGE |
46 | #endif /* ENABLE_SHOW_USAGE */ | ||
45 | #undef APPLET | 47 | #undef APPLET |
46 | #undef APPLET_NOUSAGE | 48 | #undef APPLET_NOUSAGE |
47 | #undef PROTOTYPES | 49 | #undef PROTOTYPES |
@@ -407,6 +409,7 @@ static void check_suid (struct BB_applet *applet) | |||
407 | 409 | ||
408 | void bb_show_usage (void) | 410 | void bb_show_usage (void) |
409 | { | 411 | { |
412 | #if ENABLE_SHOW_USAGE | ||
410 | const char *format_string; | 413 | const char *format_string; |
411 | const char *usage_string = usage_messages; | 414 | const char *usage_string = usage_messages; |
412 | int i; | 415 | int i; |
@@ -422,6 +425,7 @@ void bb_show_usage (void) | |||
422 | format_string = "%s\n\nNo help available.\n\n"; | 425 | format_string = "%s\n\nNo help available.\n\n"; |
423 | fprintf (stderr, format_string, bb_msg_full_version, applet_using->name, | 426 | fprintf (stderr, format_string, bb_msg_full_version, applet_using->name, |
424 | usage_string); | 427 | usage_string); |
428 | #endif /* ENABLE_SHOW_USAGE */ | ||
425 | 429 | ||
426 | exit (bb_default_error_retval); | 430 | exit (bb_default_error_retval); |
427 | } | 431 | } |