On 2/21/19 9:15 AM, Bernhard Voelker wrote:
> On 2/19/19 2:53 PM, Eric Blake wrote:
>> [...] - just blindly set
>> opterr without worrying about restoring it.
>
> You are both right, sorry for the confusion.
> Adjusted patches attached.
>
> I added some more test cases as well.
> Finally, I documented the change in 'yes' in NEWS regarding:
>
> $ yes a -- b | head -n1
> a -- b
> vs.
> $ src/yes a -- b | head -n1
> a b
What about putting 'yes' into the 'nohup' category? I mean, we have
the SCAN_ALL flag in our new function, so why not simply use it?
diff --git a/src/yes.c b/src/yes.c
index 0864186f9..477872e92 100644
--- a/src/yes.c
+++ b/src/yes.c
@@ -67,7 +67,7 @@ main (int argc, char **argv)
atexit (close_stdout);
parse_gnu_standard_options_only (argc, argv, PROGRAM_NAME, PACKAGE_NAME,
- Version, true, usage, AUTHORS,
+ Version, false, usage, AUTHORS,
(char const *) NULL);
char **operands = argv + optind;
That makes:
$ src/yes a -- b | sed 1q
a -- b
and also recognizing --help when other arguments are following:
$ src/yes --help a -- b | sed 1q
Usage: src/yes [STRING]...
That is actually our intention, no?
WDYT?
Thanks & have a nice day,
Berny