From 42ce6272f5a3824bc3512c1888384e3914a386b5 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 4 Apr 2022 11:44:30 -0500 Subject: [PATCH] When args.c is just enforcing max/min argument count with no options, imply ? so "command -123" isn't an unknown option error. --- lib/args.c | 3 ++- toys/other/ionice.c | 2 +- 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" -- 2.39.2