Re: [hackers] [sbase][PATCH] Minor optimizations for 'yes'

2019-06-28 Thread Mario Rugiero
What about this? #include int main(int argc, const char **argv) { int i; const char *fallback[] = { "y", NULL }; argv = argc <= 1 ? fallback : argv + 1; for (;;) { for (i = 0; argv[i]; ++i) { if (i)

Re: [hackers] [sbase][PATCH] Support -- in all utilities except echo(1)

2019-06-28 Thread Michael Forney
On 2019-06-28, Laslo Hunhold wrote: >> Rather than add a special ENOFLAGS macro, I am tempted to revert >> 9016d288 instead. The question that remains is how to handle arguments >> that look like options (start with `-`) for tools that don't have any >> specified options. It seems for some tools i

Re: [hackers] [sbase][PATCH] Support -- in all utilities except echo(1)

2019-06-28 Thread Michael Forney
On 2019-06-28, Michael Forney wrote: > As far as I know, unless the documentation states that a utility shall > conform to the Utility Syntax Guidelines, it is not required to > support `--`. However, it does use the language "should" which > means[2]: > > For an implementation that conforms

Re: [hackers] [sbase][PATCH] Support -- in all utilities except echo(1)

2019-06-28 Thread Laslo Hunhold
On Fri, 28 Jun 2019 00:52:33 -0700 Michael Forney wrote: Dear Michael, > I'm really sorry for ignoring this for so long. Someone asked me about > the `argv0 = *argv, argv0 ? (argc--, argv++) : (void *)0;` one-liner, > and I remembered this patch. I finally took the time to investigate > this iss

Re: [hackers] [sbase][PATCH] Support -- in all utilities except echo(1)

2019-06-28 Thread Michael Forney
Hi Mattias, I'm really sorry for ignoring this for so long. Someone asked me about the `argv0 = *argv, argv0 ? (argc--, argv++) : (void *)0;` one-liner, and I remembered this patch. I finally took the time to investigate this issue in more detail. On 2018-07-08, Mattias Andrée wrote: > In POSIX-

Re: [hackers] [sbase][PATCH] Minor optimizations for 'yes'

2019-06-28 Thread Laslo Hunhold
On Fri, 28 Jun 2019 01:06:56 -0700 Michael Forney wrote: Dear Michael, thanks for your quick feedback! > I think we are all on the same page here about simplifying yes(1) > rather than optimizing it. See aidanwillie0317's most recent patch. > (I think you mean "space separated" here) Yes, my

Re: [hackers] [sbase][PATCH] Minor optimizations for 'yes'

2019-06-28 Thread Quentin Rameau
> Dear Quentin, Hi Laslo, > > I agree, yes is neither a benchmark tool nor a data generator, it just > > outputs 'y' for piping into other commands. > > Keep it simple. > > I agree with you in general, but are we really "optimizing" yes(1) here > for the sake of performance? This looks to me lik

Re: [hackers] [sbase][PATCH] Minor optimizations for 'yes'

2019-06-28 Thread Michael Forney
On 2019-06-27, Laslo Hunhold wrote: > On Thu, 27 Jun 2019 09:10:28 +0200 > Quentin Rameau wrote: > > Dear Quentin, > >> I agree, yes is neither a benchmark tool nor a data generator, it just >> outputs 'y' for piping into other commands. >> Keep it simple. > > I agree with you in general, but are