Discussion:
[Toybox] [PATCH] main.c: don't assume anything starting with -- is --long.
enh
2018-10-17 22:43:52 UTC
Permalink
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
Loading...