On Fri, 2 Nov 2018 at 09:47, Quentin Rameau <quinq@fifth.space> wrote:
>
> > My interpretation of the linked thread was that "starts with" is
> > supposed to mean a strict prefix in POSIX, so "-" doesn't start with
> > "-".  I haven't found anything in the standard that says that
> > explicitly though.  If you'd rather interpret "starts with" to include
> > exact matches, feel free to drop this patch.
>
> Actually I think you're right.

Okay great!

> Although,
>
> > +     return !(arg[0] == '-' && arg[1]) && strcmp(arg, "!") && strcmp(arg, 
> > "(");
>
> Having a negation operator at the start of an expression which does
> not negate the whole expression chain is kind of misleading.

Yeah I see what you mean.

> Why not:
>
> return strcmp(arg, "-") || && strcmp(arg, "!") && strcmp(arg, "(");

Not sure what you're recommending here.  Maybe

return (arg[0] != '-' || !strcmp(arg, "-")) && strcmp(arg, "!") &&
strcmp(arg, "(");

?

-- 
Tavian Barnes

Reply via email to