[Toybox] lib/args.c tweak
Rob Landley
rob at landley.net
Wed Feb 16 16:43:44 PST 2022
Some commands like blkid take no arguments and only use lib/args.c to ensure
there's one arg, but:
$ toybox blkid -file
blkid: Unknown option 'file' (see "blkid --help")
I _think_ that when the option string is just requiring a minimum or maximum
number of arguments but has no actual _flags_, it should default to including
"^?" (stop at first nonoption argument, pass through unknown arguments).
A lot of commands are doing "<1>1" and such without that, and I was going
through and adding them but... should the plumbing just default to that?
$ grep ', "[<>][0-9][^a-zA-Z]*"' toys/*/*.c | wc -l
40
Some of them like printf already have ?^ but most don't. I _think_ it's what we
always want, but I'm wondering if there's a gotcha lurking. (Other than "if you
add an option then suddenly "load_policy -potato" stops working, although we can
always tck on a ^? when we DO add such an argument if something cares...)
Rob
More information about the Toybox
mailing list