diff options
author | Ron Yorston <rmy@pobox.com> | 2014-10-06 12:50:22 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2014-10-06 12:50:22 +0100 |
commit | b04d11dcbadda2620743a1dd923938f2f3043a38 (patch) | |
tree | 971afe425a81304b79e44122e220c7a69efe2616 /libbb/appletlib.c | |
parent | 124bbf02948b7ac0babb4ead04acd1559db182d3 (diff) | |
parent | 760d035699c4a878f9109544c1d35ea0d5f6b76c (diff) | |
download | busybox-w32-b04d11dcbadda2620743a1dd923938f2f3043a38.tar.gz busybox-w32-b04d11dcbadda2620743a1dd923938f2f3043a38.tar.bz2 busybox-w32-b04d11dcbadda2620743a1dd923938f2f3043a38.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'libbb/appletlib.c')
-rw-r--r-- | libbb/appletlib.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 1d0a8f711..2c85062b4 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c | |||
@@ -184,8 +184,7 @@ void lbb_prepare(const char *applet | |||
184 | #endif | 184 | #endif |
185 | applet_name = applet; | 185 | applet_name = applet; |
186 | 186 | ||
187 | /* Set locale for everybody except 'init' */ | 187 | if (ENABLE_LOCALE_SUPPORT) |
188 | if (ENABLE_LOCALE_SUPPORT && getpid() != 1) | ||
189 | setlocale(LC_ALL, ""); | 188 | setlocale(LC_ALL, ""); |
190 | 189 | ||
191 | #if ENABLE_PLATFORM_MINGW32 | 190 | #if ENABLE_PLATFORM_MINGW32 |
@@ -759,15 +758,25 @@ void FAST_FUNC run_applet_no_and_exit(int applet_no, char **argv) | |||
759 | 758 | ||
760 | /* Reinit some shared global data */ | 759 | /* Reinit some shared global data */ |
761 | xfunc_error_retval = EXIT_FAILURE; | 760 | xfunc_error_retval = EXIT_FAILURE; |
762 | |||
763 | applet_name = APPLET_NAME(applet_no); | 761 | applet_name = APPLET_NAME(applet_no); |
764 | if (argc == 2 && strcmp(argv[1], "--help") == 0) { | 762 | |
765 | /* Special case. POSIX says "test --help" | 763 | #if defined APPLET_NO_test |
766 | * should be no different from e.g. "test --foo". */ | 764 | /* Special case. POSIX says "test --help" |
767 | //TODO: just compare applet_no with APPLET_NO_test | 765 | * should be no different from e.g. "test --foo". |
768 | if (!ENABLE_TEST || strcmp(applet_name, "test") != 0) { | 766 | * Thus for "test", we skip --help check. |
769 | /* If you want "foo --help" to return 0: */ | 767 | */ |
770 | xfunc_error_retval = 0; | 768 | if (applet_no != APPLET_NO_test) |
769 | #endif | ||
770 | { | ||
771 | if (argc == 2 && strcmp(argv[1], "--help") == 0) { | ||
772 | #if defined APPLET_NO_false | ||
773 | /* Someone insisted that "false --help" must exit 1. Sigh */ | ||
774 | if (applet_no != APPLET_NO_false) | ||
775 | #endif | ||
776 | { | ||
777 | /* Make "foo --help" exit with 0: */ | ||
778 | xfunc_error_retval = 0; | ||
779 | } | ||
771 | bb_show_usage(); | 780 | bb_show_usage(); |
772 | } | 781 | } |
773 | } | 782 | } |