aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2021-06-10 21:22:35 -0500
committerRob Landley <rob@landley.net>2021-06-10 21:22:35 -0500
commit08bfbd965e3b7714105ed6c1130f507ae06a5159 (patch)
treeb7b9c6c09a14139d4ddcf23e01bedaad6e2871b1
parent0c6000ad4847a21ef1513985b1d96f5e1a0503e4 (diff)
downloadtoybox-08bfbd965e3b7714105ed6c1130f507ae06a5159.tar.gz
Revert the --help change, it breaks stuff like "echo -- --help".
-rw-r--r--main.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/main.c b/main.c
index ae50431c..ffaece07 100644
--- a/main.c
+++ b/main.c
@@ -75,21 +75,17 @@ void toy_singleinit(struct toy_list *which, char *argv[])
toys.toycount = ARRAY_LEN(toy_list);
// Parse --help and --version for (almost) all commands
- if (CFG_TOYBOX_HELP_DASHDASH && !(which->flags & TOYFLAG_NOHELP)) {
- char **args;
-
- for (args = toys.argv+1; *args; args++) {
- if (!strcmp(*args, "--help")) {
- if (CFG_TOYBOX && toys.which == toy_list && args[1])
- if (!(toys.which = toy_find(args[1]))) unknown(args[1]);
- show_help(stdout, 1);
- xexit();
- }
+ if (CFG_TOYBOX_HELP_DASHDASH && !(which->flags & TOYFLAG_NOHELP) && argv[1]) {
+ if (!strcmp(argv[1], "--help")) {
+ if (CFG_TOYBOX && toys.which == toy_list && toys.argv[2])
+ if (!(toys.which = toy_find(toys.argv[2]))) unknown(toys.argv[2]);
+ show_help(stdout, 1);
+ xexit();
+ }
- if (!strcmp(*args, "--version")) {
- xprintf("toybox %s\n", toybox_version);
- xexit();
- }
+ if (!strcmp(argv[1], "--version")) {
+ xprintf("toybox %s\n", toybox_version);
+ xexit();
}
}