Fix "toybox command --help".

This commit is contained in:
Rob Landley 2022-03-31 16:08:56 -05:00
parent 690526a84f
commit 83d5d7a0bb
2 changed files with 5 additions and 3 deletions

5
main.c
View File

@ -114,8 +114,9 @@ static void unknown(char *name)
// Parse --help and --version for (almost) all commands
void check_help(char **arg)
{
if (!CFG_TOYBOX_HELP_DASHDASH || !*arg || (toys.which->flags&TOYFLAG_NOHELP))
return;
if (!CFG_TOYBOX_HELP_DASHDASH || !*arg) return;
if (!CFG_TOYBOX || toys.which != toy_list)
if (toys.which->flags&TOYFLAG_NOHELP) return;
if (!strcmp(*arg, "--help")) {
if (CFG_TOYBOX && toys.which == toy_list && arg[1])

View File

@ -43,7 +43,8 @@ if isnewer "$GENDIR"/newtoys.h toys
then
echo -n "$GENDIR/newtoys.h "
echo "USE_TOYBOX(NEWTOY(toybox, NULL, TOYFLAG_STAYROOT))" > "$GENDIR"/newtoys.h
echo "USE_TOYBOX(NEWTOY(toybox, NULL, TOYFLAG_STAYROOT|TOYFLAG_NOHELP))" \
> "$GENDIR"/newtoys.h
$SED -n -e 's/^USE_[A-Z0-9_]*(/&/p' toys/*/*.c \
| $SED 's/\(.*TOY(\)\([^,]*\),\(.*\)/\2 \1\2,\3/' | sort -s -k 1,1 \
| $SED 's/[^ ]* //' >> "$GENDIR"/newtoys.h