busybox/include
Denys Vlasenko 6bdfbc4cb5 libbb: fix '--help' handling in FEATURE_SH_NOFORK=y
Most BusyBox applets respond to the '--help' option by printing
a usage message.  This is normally handled by busybox_main() so
applet main routines don't have support for '--help'.

In standalone shell mode with FEATURE_SH_NOFORK enabled nofork
applets are invoked directly, bypassing busybox_main().  This
results in inconsistent handling of '--help':

- applets which call getopt() report "unrecognized option '--help'"
  and print help anyway;

- realpath says "--help: No such file or directory" and doesn't
  print help;

- usleep says "invalid number '--help'" and doesn't print help.

Avoid inconsistency by checking for '--help' in run_nofork_applet().

Bug found by Ron Yorston.

function                                             old     new   delta
show_usage_if_dash_dash_help                           -      70     +70
run_nofork_applet                                    347     362     +15
run_applet_no_and_exit                               432     365     -67
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 85/-67)             Total: 18 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-18 23:30:24 +01:00
..
.gitignore ash: allow shell scripts to be embedded in the binary 2018-11-01 10:15:13 +01:00
applet_metadata.h
applets.h.sh
applets.src.h Tweaks to build process for embedded scripts 2018-11-27 10:38:10 +01:00
ar_.h archival: avoid std namespace for local includes 2020-11-16 13:24:24 +01:00
bb_archive.h libarchive: treat one "FIXME: avoid seek" 2019-05-24 17:03:28 +02:00
bb_e2fs_defs.h
busybox.h
dump.h od: unbreak it 2020-10-25 23:44:22 +01:00
fix_u32.h
grp_.h
inet_common.h
libbb.h libbb: fix '--help' handling in FEATURE_SH_NOFORK=y 2021-02-18 23:30:24 +01:00
liblzo_interface.h lzop: code shrink 2018-02-01 01:41:31 +01:00
platform.h ash: placate -Werror=format-security 2021-02-18 13:45:49 +01:00
pwd_.h
rtc_.h move ADJTIME_PATH define to header files 2020-12-17 20:53:43 +01:00
shadow_.h
unicode.h
usage.src.h move ADJTIME_PATH define to header files 2020-12-17 20:53:43 +01:00
volume_id.h
xatonum.h
xregex.h