On Fri, Apr 11, 2014 at 10:27 PM, Ralph Siegler <[email protected]> wrote:
> On Fri, 11 Apr 2014 19:27:03 -0430, Andres Perera wrote:
>
>> On Fri, Apr 11, 2014 at 7:02 PM, Ralph Siegler <[email protected]>
>> wrote:
>>> On Thu, 10 Apr 2014 21:55:13 -0700, Philip Guenther wrote:
>>>
>>>> On Thu, Apr 10, 2014 at 7:14 PM, Ralph Siegler <[email protected]>
>>>> wrote:
>>>>> On Thu, 14 Nov 2013 23:17:24 -0500, Eitan Adler wrote:
>>>>>> I was looking through some OpenBSD code and noticed that rs and jot
>>>>>> are both missing #include <unistd.h> even though they use getopt.
>>>>>> It seems that stdlib.h defines getopt on OpenBSD.  However, this is
>>>>>> not the correct header file, and it makes it not possible to compile
>>>>>> OpenBSD's utilities on other platforms.
>>>>>
>>>>> I just looked on my linux box and found this in stdlib.h
>>>> ...
>>>>> So I'm wondering about your assertion that this is "not the correct
>>>>> header file"....looking at links in your post, do you really mean
>>>>> "FreeBSD doesn't define them there but everyone else on the planet
>>>>> might"?
>>>>
>>>> He's perhaps referring to the POSIX standard, which specifies that
>>>> that *in a conforming compilation environment* <unistd.h> MUST declare
>>>> getopt() and <stdlib.h> MUST NOT declare getopt().
>>>>
>>>> (Ya'll know that the current POSIX standard can be downloaded after a
>>>> free registration, don'cha?)
>>>>
>>>>
>>>> Philip Guenther
>>>
>>> Well Philip, had we mentioned any POSIX 2008.1 certified or compliant
>>> OS in this thread that would be an interesting point to bring up.  But
>>> neither GNU/Linux, OpenBSD, nor FreeBSD is fully compliant.
>>>
>>> On the other hand, Mac OSX Mavericks is 100% compliant and certified,
>>> and per spec has, for example, sem_init and sem_destroy in the header
>>> files.......but lo and behold doesn't actually implement them in the
>>> libraries.  This and similar show-without-go has bummed out more than
>>> one code porter.
>>>
>>> Meanwhile, OpenBSD doesn't have the 100% 2008.1 beef stamp on its hind
>>> quarters but will compile and run code having those
>>> functions......which is better?
>>
>> Yes, de facto standards can be important.
>>
>> Now, does this issue in particular--namely, the decision of which header
>> declares getopt()--merit reconsideration? Should OpenBSD or another OS
>> depart from POSIX in this regard? If so, what is the motivation?
>>
>>
>
>
> OpenBSD uses the magic of #ifndef to get away with defining it in two
> places, so following POSIX (and the OpenBSD man page) and #include
> <unistd.h>  gets the getopt(3) and so Eitan should be happy.
>
> But back in the pre-1992 POSIX.2 days,  it was defined (as least in some
> Unix I know) to be in stdlib.h.  And lo and behold OpenBSD will define
> it  there if it hasn't been defined yet.

Well, starting with r1.54 [0], stdlib.h never declares getopt().

However, I think the conversation could continue in spite of that.

I would expect "motivation" to be aggregated cost in the form:

* a significant amount of patched ports;

* a significant amount of affected port prospects; or

* a significant amount of patched user programs.

You happen to mention the last item. Are there other users interested
in this facet of source compatibility?

Also, are there other possible costs?

[0] 
http://www.openbsd.org/cgi-bin/cvsweb/src/include/stdlib.h.diff?r1=1.53;r2=1.54;f=h

Reply via email to