aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2022-04-04 11:44:30 -0500
committerRob Landley <rob@landley.net>2022-04-04 11:44:30 -0500
commit42ce6272f5a3824bc3512c1888384e3914a386b5 (patch)
tree8cc1bb8dd0a42bb87e0ad8ebfbc7b9b88aac1634
parenta682f18b338d1eda088744d9b103689ff674f580 (diff)
downloadtoybox-42ce6272f5a3824bc3512c1888384e3914a386b5.tar.gz
When args.c is just enforcing max/min argument count with no options, imply ?
so "command -123" isn't an unknown option error.
-rw-r--r--lib/args.c3
-rw-r--r--toys/other/ionice.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/args.c b/lib/args.c
index 247c1944..2b8da7c7 100644
--- a/lib/args.c
+++ b/lib/args.c
@@ -77,6 +77,7 @@
// ? Allow unknown arguments (pass them through to command).
// & first arg has imaginary dash (ala tar/ps/ar) which sets FLAGS_NODASH
// 0 Include argv[0] in optargs
+// note: ^ and ? implied when no options
//
// At the end: [groups] of previously seen options
// - Only one in group (switch off) [-abc] means -ab=-b, -ba=-a, -abc=-c
@@ -254,7 +255,7 @@ static int parse_optflaglist(struct getoptflagstate *gof)
// Parse option string into a linked list of options with attributes.
- if (!*options) gof->stopearly++;
+ if (!*options) gof->stopearly++, gof->noerror++;
while (*options) {
char *temp;
diff --git a/toys/other/ionice.c b/toys/other/ionice.c
index 07a212b2..db3a6f41 100644
--- a/toys/other/ionice.c
+++ b/toys/other/ionice.c
@@ -6,7 +6,7 @@
* Documentation/block/ioprio.txt in the linux source.
USE_IONICE(NEWTOY(ionice, "^tc#<0>3=2n#<0>7=5p#", TOYFLAG_USR|TOYFLAG_BIN))
-USE_IORENICE(NEWTOY(iorenice, "?<1>3", TOYFLAG_USR|TOYFLAG_BIN))
+USE_IORENICE(NEWTOY(iorenice, "<1>3", TOYFLAG_USR|TOYFLAG_BIN))
config IONICE
bool "ionice"