aboutsummaryrefslogtreecommitdiff
path: root/libbb/appletlib.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2015-04-21 16:00:41 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2015-04-21 16:00:41 +0200
commitde5edadee2dca2896492f97ab3a56e389305e74d (patch)
tree80cdba9f7822f0ca9996dd1b5ceef0607c069c5d /libbb/appletlib.c
parent7d86384b246434e72533332f7f409a7aa9efeacb (diff)
downloadbusybox-w32-de5edadee2dca2896492f97ab3a56e389305e74d.tar.gz
busybox-w32-de5edadee2dca2896492f97ab3a56e389305e74d.tar.bz2
busybox-w32-de5edadee2dca2896492f97ab3a56e389305e74d.zip
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/appletlib.c')
-rw-r--r--libbb/appletlib.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index e0b843d30..ba3d6e7a0 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)
748 xfunc_error_retval = EXIT_FAILURE; 748 xfunc_error_retval = EXIT_FAILURE;
749 applet_name = APPLET_NAME(applet_no); 749 applet_name = APPLET_NAME(applet_no);
750 750
751#if defined APPLET_NO_test
752 /* Special case. POSIX says "test --help" 751 /* Special case. POSIX says "test --help"
753 * should be no different from e.g. "test --foo". 752 * should be no different from e.g. "test --foo".
754 * Thus for "test", we skip --help check. 753 * Thus for "test", we skip --help check.
754 * "true" and "false" are also special.
755 */ 755 */
756 if (applet_no != APPLET_NO_test) 756 if (1
757#if defined APPLET_NO_test
758 && applet_no != APPLET_NO_test
759#endif
760#if defined APPLET_NO_true
761 && applet_no != APPLET_NO_true
757#endif 762#endif
758 {
759 if (argc == 2 && strcmp(argv[1], "--help") == 0) {
760#if defined APPLET_NO_false 763#if defined APPLET_NO_false
761 /* Someone insisted that "false --help" must exit 1. Sigh */ 764 && applet_no != APPLET_NO_false
762 if (applet_no != APPLET_NO_false)
763#endif 765#endif
764 { 766 ) {
765 /* Make "foo --help" exit with 0: */ 767 if (argc == 2 && strcmp(argv[1], "--help") == 0) {
766 xfunc_error_retval = 0; 768 /* Make "foo --help" exit with 0: */
767 } 769 xfunc_error_retval = 0;
768 bb_show_usage(); 770 bb_show_usage();
769 } 771 }
770 } 772 }