summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko2015-04-21 16:00:41 +0200
committerDenys Vlasenko2015-04-21 16:00:41 +0200
commitde5edadee2dca2896492f97ab3a56e389305e74d (patch)
tree80cdba9f7822f0ca9996dd1b5ceef0607c069c5d /libbb
parent7d86384b246434e72533332f7f409a7aa9efeacb (diff)
downloadbusybox-de5edadee2dca2896492f97ab3a56e389305e74d.zip
busybox-de5edadee2dca2896492f97ab3a56e389305e74d.tar.gz
special-case {true,false,test} --help
This also removes their help texts. function old new delta run_applet_no_and_exit 442 452 +10 packed_usage 30713 30625 -88 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/appletlib.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index e0b843d..ba3d6e7 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -748,23 +748,25 @@ void FAST_FUNC run_applet_no_and_exit(int applet_no, char **argv)
xfunc_error_retval = EXIT_FAILURE;
applet_name = APPLET_NAME(applet_no);
-#if defined APPLET_NO_test
/* Special case. POSIX says "test --help"
* should be no different from e.g. "test --foo".
* Thus for "test", we skip --help check.
+ * "true" and "false" are also special.
*/
- if (applet_no != APPLET_NO_test)
+ if (1
+#if defined APPLET_NO_test
+ && applet_no != APPLET_NO_test
+#endif
+#if defined APPLET_NO_true
+ && applet_no != APPLET_NO_true
#endif
- {
- if (argc == 2 && strcmp(argv[1], "--help") == 0) {
#if defined APPLET_NO_false
- /* Someone insisted that "false --help" must exit 1. Sigh */
- if (applet_no != APPLET_NO_false)
+ && applet_no != APPLET_NO_false
#endif
- {
- /* Make "foo --help" exit with 0: */
- xfunc_error_retval = 0;
- }
+ ) {
+ if (argc == 2 && strcmp(argv[1], "--help") == 0) {
+ /* Make "foo --help" exit with 0: */
+ xfunc_error_retval = 0;
bb_show_usage();
}
}