Test: `./toybox --oops` correctly shows help now
---
main.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/main.c b/main.c
index 6f8490f..46f571e 100644
--- a/main.c
+++ b/main.c
@@ -202,9 +202,11 @@ void toybox_main(void)
int fl = toy_list[i].flags;
if (fl & TOYMASK_LOCATION) {
if (toys.argv[1]) {
- int j;
- for (j=0; toy_paths[j]; j++)
- if (fl & (1<<j)) len += printf("%s", toy_paths[j]);
+ if (!strcmp(toys.argv[1], "--long")) {
+ int j;
+ for (j=0; toy_paths[j]; j++)
+ if (fl & (1<<j)) len += printf("%s", toy_paths[j]);
+ } else help_exit(0);
}
len += printf("%s",toy_list[i].name);
if (++len > 65) len = 0;
--
2.19.1.331.ge82ca0e54c-goog
From fa9b3cb7f7d2c142b1cee483337999b1241bb031 Mon Sep 17 00:00:00 2001
From: Elliott Hughes <[email protected]>
Date: Wed, 17 Oct 2018 15:42:20 -0700
Subject: [PATCH] main.c: don't assume anything starting with -- is --long.
Test: `./toybox --oops` correctly shows help now
---
main.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/main.c b/main.c
index 6f8490f..46f571e 100644
--- a/main.c
+++ b/main.c
@@ -202,9 +202,11 @@ void toybox_main(void)
int fl = toy_list[i].flags;
if (fl & TOYMASK_LOCATION) {
if (toys.argv[1]) {
- int j;
- for (j=0; toy_paths[j]; j++)
- if (fl & (1<<j)) len += printf("%s", toy_paths[j]);
+ if (!strcmp(toys.argv[1], "--long")) {
+ int j;
+ for (j=0; toy_paths[j]; j++)
+ if (fl & (1<<j)) len += printf("%s", toy_paths[j]);
+ } else help_exit(0);
}
len += printf("%s",toy_list[i].name);
if (++len > 65) len = 0;
--
2.19.1.331.ge82ca0e54c-goog
_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net