Ron Yorston 5a9d2b6e02 libbb: make '--help' handling more consistent
Running an applet with '--help' as its only argument is treated
as a special case.  If additional arguments follow '--help' the
behaviour is inconsistent:

- applets which call single_argv() print help and do nothing else;

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

- expr says "expr: syntax error" and doesn't print help;

- printenv silently ignores '--help', prints any other variables
  and doesn't print help;

- realpath says "--help: No such file or directory", prints the path
  of any other files and doesn't print help.

If the first argument is '--help' ignore any other arguments and print
help.  This is more consistent and most likely what the user wanted.

See also commit 6bdfbc4cb (libbb: fix '--help' handling in
FEATURE_SH_NOFORK=y).

function                                             old     new   delta
show_usage_if_dash_dash_help                          75      69      -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-6)               Total: -6 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-08-22 14:05:01 +02:00
..
2021-06-22 15:28:34 +02:00
2020-12-14 18:25:28 +01:00
2020-12-17 11:22:44 +01:00
2021-02-03 20:43:07 +01:00
2022-02-11 23:03:27 +01:00
2022-02-11 23:03:27 +01:00
2020-10-01 03:07:22 +02:00
2022-07-03 21:41:38 +02:00
2021-02-03 20:52:40 +01:00
2018-07-17 15:04:17 +02:00
2021-09-17 00:47:23 +02:00
2022-01-18 00:36:42 +01:00
2020-12-17 20:53:43 +01:00
2015-04-02 23:03:46 +02:00

Please see the LICENSE file for copyright information (GPLv2)

libbb is BusyBox's utility library.  All of this stuff used to be stuffed into
a single file named utility.c.  When I split utility.c to create libbb, some of
the very oldest stuff ended up without their original copyright and licensing
information (which is now lost in the mists of time).  If you see something
that you wrote that is mis-attributed, do let me know so we can fix that up.

	Erik Andersen
	<andersen@codepoet.org>