[m-rev.] for review: Check availability of getopt() directly.

Peter Wang novalazy at gmail.com
Sat Jun 1 15:06:00 AEST 2019


On Sat, 1 Jun 2019 14:04:53 +1000, Peter Wang <novalazy at gmail.com> wrote:
> On Fri, 31 May 2019 19:26:02 +1000 (AEST), Julien Fischer <jfischer at opturion.com> wrote:
> > > +# Link in local copy of getopt() only if required.
> > > +# XXX The files in runtime/GETOPT may not compile cleanly with modern
> > > +# compilers. We should replace it with another implementation.
> > 
> > We need to replace them (certainly the one in runtime/mercury_getopt.c)
> > for licensing reasons anyway.
> 
> How about this implementation?
> 
>     https://github.com/kubo/ya_getopt
> 
> It has a simple permissive licence and the code looks okay (at a glance).
> It comes with a test script that checks if the implementation matches
> the GNU implementation. On my system only ya_getopt_long_only() does NOT
> exactly match getopt_long_only(); it may be that the GNU implementation
> changed. We don't use getopt_long_only() anyway.

For interest, yes, the GNU implementation changed a lot between glibc
2.25 and 2.26. ya_getopt does pass its own tests when compared to an
older glibc implementation.

Peter


More information about the reviews mailing list