Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 30 Sep 2012 17:13:29 -0400
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: better compatibility with bsd getopt()

On Sun, Sep 30, 2012 at 11:18:33PM +0200, Daniel Cegiełka wrote:
> >
> > If the only need is option resetting, I think we can handle that
> > without any cost, and avoid linking in duplicate code to meet
> > applications' needs.
> >
> > Rich
> 
> OpenBSD solves gnu reset option in this way:
> 
> 	/*
> 	 * XXX Some GNU programs (like cvs) set optind to 0 instead of
> 	 * XXX using optreset.  Work around this braindamage.
> 	 */
> 	if (optind == 0)
> 		optind = optreset = 1;

Except the BSD way is the braindamaged one because it violates the
namespace. The GNU way simply defines something that was previously
undefined by the standard without affecting the namespace.

If needed, I think it's possible to support both, with some weak
symbol hacks...

Rich

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ