Peter Eisentraut <peter_e@gmx.net> writes:
> No it's not, unfortunately. BSD versions of getopt, including the one we
> ship as replacement, have a bug that considers any argument that starts
> with '--' to be equivalent with '--' (which means end of options).
I believe we could trivially fix our substitute version: at line 74 of
src/utils/getopt.c,
if (place[1] && *++place == '-')
should be
if (place[1] && *++place == '-' && place[1] == '\0')
It might still not work on older BSDen, but there's no reason it
shouldn't work on platforms where we use our own code.
A slightly more aggressive answer would be to use our own code always,
or to test for brokenness of the system getopt in configure and use our
own code if so.
regards, tom lane