Re: rs, jot: missing headers

2014-04-12 Thread Ralph Siegler
On Fri, 11 Apr 2014 22:56:52 -0700, Philip Guenther wrote:


 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?
 
 Best for what? 

best for the particular example I gave.  There are others, where system 
gets the POSIX stamp of approval by having .h functions from a list but 
doesn't actually implement them or just partially implements them.   Just 
a part of the proofs that 100% POSIX chest-thumping is silly, that spec 
needs some spiffing up before it should be taken 100% seriously.

 OpenBSD doesn't strive to be the be-all and end-all of
 UNIX-like OSes.  We ain't realtime, and our threading and MP are still
 both bad and ugly in many places, and we don't have lots of the flashy
 bells that other OSes have.  What we have a strong drive to incubate
 better quality in ourselves and the entire software community by
 exposing,
 pushing on, and redirecting bad practices in software development.

Yes, OpenBSD excels at clobbering code that does careless things ;  my 
code, new and old, still runs fine on it, thanks.  You left out emphasis 
on security, robustness and correctness.  That's why I've been using and 
contributing money to OpenBSD project for 13+ years.

 
 If you want an OS that has infinite backwards compat and offers all the
 bells and whistles, look elsewhere.  Those are both anathema to OpenBSD
 and requests for them will be fruitless.

I am not implying any desire for any other backwards compatible additions 
to the project.  Because  OpenBSD already has those! Has had them from 
day one, and there are good reasons for that. The one who is doing 
something fruitless is you.


So, let's see you successfully submit patches to *remove* those 
non-2008.1 features and backwards compatibilities to .1 and even before, 
and fix the collateral damage to the distro  that the minus diffs cause. 
I double-dog dare you.

 
 
 Philip




Re: rs, jot: missing headers

2014-04-12 Thread Ralph Siegler
On Fri, 11 Apr 2014 22:10:05 -0700, Philip Guenther wrote:

 On Sat, 12 Apr 2014, Ralph Siegler wrote:
  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
 
 You are mistaken, it was just defined in different place/way in same
 file, even 18 years ago it is found in OpenBSD in stdlib.h (as well as
 in unistd.h):
 
 Gotcha: you don't want to update a program to meet 18+ year old
 standards.
 Is your beef with OpenBSD?  Or is it with POSIX for specifying in 1995
 that getopt() only be declared in unistd.h and not stdlib.h?
 
 
 It doesn't hurt anything to provide this backward compatibility
 
 It makes the header more complex and annoying to maintain, just to
 support programs that haven't been updated for 18+ years.  That's a
 negative.

Wrong, the stuff is already in the headers, no maintenance necessary.  
what would be HARD is to remove all the non-2008.1,  and fix the 
breakages it would cause,  then modify and add calls for the missing 
functionality, again without breaking anything.   It would be much fun 
and entertainment to watch such an endeavor, I'll pop popcorn for that 
space opera series.  

 
 You may find it interesting to see how long a source tree might work
 without changes, but that's not of interest to OpenBSD.  It's probably
 of *negative* interest of OpenBSD, as adding #include unistd.h is a
 trivial cost to the person compiling said unmaintained program, and such
 a program probably hasn't been scrutinized for the various sins of the
 past like buffer and string handling, TOCTOU violations, etc.  History
 is neat to study, but living in it sucks.

All BSD have much history in them, even with the fantastic evolution, 
fixes and improvements.

 
 
 Philip




Re: rs, jot: missing headers

2014-04-12 Thread Kenneth Westerback
On 12 April 2014 10:47, Ralph Siegler rsieg...@rsiegler.org wrote:
 On Fri, 11 Apr 2014 22:56:52 -0700, Philip Guenther wrote:


 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?

 Best for what?

 best for the particular example I gave.  There are others, where system
 gets the POSIX stamp of approval by having .h functions from a list but
 doesn't actually implement them or just partially implements them.   Just
 a part of the proofs that 100% POSIX chest-thumping is silly, that spec
 needs some spiffing up before it should be taken 100% seriously.

  OpenBSD doesn't strive to be the be-all and end-all of
 UNIX-like OSes.  We ain't realtime, and our threading and MP are still
 both bad and ugly in many places, and we don't have lots of the flashy
 bells that other OSes have.  What we have a strong drive to incubate
 better quality in ourselves and the entire software community by
 exposing,
 pushing on, and redirecting bad practices in software development.

 Yes, OpenBSD excels at clobbering code that does careless things ;  my
 code, new and old, still runs fine on it, thanks.  You left out emphasis
 on security, robustness and correctness.  That's why I've been using and
 contributing money to OpenBSD project for 13+ years.


 If you want an OS that has infinite backwards compat and offers all the
 bells and whistles, look elsewhere.  Those are both anathema to OpenBSD
 and requests for them will be fruitless.

 I am not implying any desire for any other backwards compatible additions
 to the project.  Because  OpenBSD already has those! Has had them from
 day one, and there are good reasons for that. The one who is doing
 something fruitless is you.


 So, let's see you successfully submit patches to *remove* those
 non-2008.1 features and backwards compatibilities to .1 and even before,
 and fix the collateral damage to the distro  that the minus diffs cause.
 I double-dog dare you.

the distro? What the fuck is the distro? Has OpenBSD suddenly
morphed into Linux?

I recommend against 'double-dog' daring Philip about this (assuming
your goal to to prevent the changes) since he has complete freedom to
commit these changes whenever the mood strikes him.

And on that day, many programs and libraries will know what it is to
be roasted in the depths of a POSIX specification.

 Ken




 Philip





Re: rs, jot: missing headers

2014-04-12 Thread Ralph Siegler
On Sat, 12 Apr 2014 11:36:56 -0400, Kenneth Westerback wrote:

 On 12 April 2014 10:47, Ralph Siegler rsieg...@rsiegler.org wrote:
 On Fri, 11 Apr 2014 22:56:52 -0700, Philip Guenther wrote:


 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?

 Best for what?

 best for the particular example I gave.  There are others, where system
 gets the POSIX stamp of approval by having .h functions from a list but
 doesn't actually implement them or just partially implements them.  
 Just a part of the proofs that 100% POSIX chest-thumping is silly, that
 spec needs some spiffing up before it should be taken 100% seriously.

  OpenBSD doesn't strive to be the be-all and end-all of
 UNIX-like OSes.  We ain't realtime, and our threading and MP are still
 both bad and ugly in many places, and we don't have lots of the flashy
 bells that other OSes have.  What we have a strong drive to incubate
 better quality in ourselves and the entire software community by
 exposing,
 pushing on, and redirecting bad practices in software development.

 Yes, OpenBSD excels at clobbering code that does careless things ;  my
 code, new and old, still runs fine on it, thanks.  You left out
 emphasis on security, robustness and correctness.  That's why I've been
 using and contributing money to OpenBSD project for 13+ years.


 If you want an OS that has infinite backwards compat and offers all
 the bells and whistles, look elsewhere.  Those are both anathema to
 OpenBSD and requests for them will be fruitless.

 I am not implying any desire for any other backwards compatible
 additions to the project.  Because  OpenBSD already has those! Has had
 them from day one, and there are good reasons for that. The one who is
 doing something fruitless is you.


 So, let's see you successfully submit patches to *remove* those
 non-2008.1 features and backwards compatibilities to .1 and even
 before, and fix the collateral damage to the distro  that the minus
 diffs cause. I double-dog dare you.
 
 the distro? What the fuck is the distro? Has OpenBSD suddenly
 morphed into Linux?

that is merely slang for The Distribution, the OpenBSD project itself 
certainly uses the longer phrase, and sorry if the slang shorter one 
connotates legions of marauding penguins to you.

 
 I recommend against 'double-dog' daring Philip about this (assuming your
 goal to to prevent the changes) since he has complete freedom to commit
 these changes whenever the mood strikes him.

Just my way of pointing out that attempting 100% POSIX compliance  would 
be extraordinarily difficult; the spec has grey areas, incomplete areas, 
vague areas (hence the silliness of holding it up as a golden benchmark), 
and would necessitate some drastic changes to the code (to say nothing of 
the ports). 

The cost in man-hours would be likely too high a price for six dozen 
(admittedly gifted) developers to pay; and the result would only be 
compliance subject to certain interpretations and caveats. 

There are legacy support in the code that makes the OS very useful and 
easier to port to, to remove them would have dire consequences to the 
user community. 





 
 And on that day, many programs and libraries will know what it is to be
 roasted in the depths of a POSIX specification.
 
  Ken





Re: rs, jot: missing headers

2014-04-12 Thread Philip Guenther
On Sat, Apr 12, 2014 at 7:47 AM, Ralph Siegler rsieg...@rsiegler.org wrote:
...
 So, let's see you successfully submit patches to *remove* those
 non-2008.1 features and backwards compatibilities to .1 and even before,
 and fix the collateral damage to the distro  that the minus diffs cause.
 I double-dog dare you.

You're daring me to do something that I've been doing for years, and
that the OpenBSD ports team *supports*, asking for our headers to be
made cleaner.
Ookay.


Philip Guenther



Re: rs, jot: missing headers

2014-04-11 Thread Ralph Siegler
On Thu, 10 Apr 2014 21:55:13 -0700, Philip Guenther wrote:

 On Thu, Apr 10, 2014 at 7:14 PM, Ralph Siegler rsieg...@rsiegler.org
 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 filelooking 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?


Ralph



Re: rs, jot: missing headers

2014-04-11 Thread Andres Perera
On Fri, Apr 11, 2014 at 7:02 PM, Ralph Siegler rsieg...@rsiegler.org wrote:
 On Thu, 10 Apr 2014 21:55:13 -0700, Philip Guenther wrote:

 On Thu, Apr 10, 2014 at 7:14 PM, Ralph Siegler rsieg...@rsiegler.org
 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 filelooking 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?



 Ralph




Re: rs, jot: missing headers

2014-04-11 Thread Ralph Siegler
On Fri, 11 Apr 2014 19:27:03 -0430, Andres Perera wrote:

 On Fri, Apr 11, 2014 at 7:02 PM, Ralph Siegler rsieg...@rsiegler.org
 wrote:
 On Thu, 10 Apr 2014 21:55:13 -0700, Philip Guenther wrote:

 On Thu, Apr 10, 2014 at 7:14 PM, Ralph Siegler rsieg...@rsiegler.org
 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 filelooking 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.  This can make old coots like me 
happy in the event we want to play with our old coot code from days of 
yore.  Don't let young whippersnappers take away our security blankets, 
like that meanie who posted patch for removing old-EBCDIC support from a 
command and only leaving new fangled EBCDIC.  


Ralph (older than Unix)



Re: rs, jot: missing headers

2014-04-11 Thread Andres Perera
On Fri, Apr 11, 2014 at 10:27 PM, Ralph Siegler rsieg...@rsiegler.org wrote:
 On Fri, 11 Apr 2014 19:27:03 -0430, Andres Perera wrote:

 On Fri, Apr 11, 2014 at 7:02 PM, Ralph Siegler rsieg...@rsiegler.org
 wrote:
 On Thu, 10 Apr 2014 21:55:13 -0700, Philip Guenther wrote:

 On Thu, Apr 10, 2014 at 7:14 PM, Ralph Siegler rsieg...@rsiegler.org
 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 filelooking 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



Re: rs, jot: missing headers

2014-04-11 Thread Ralph Siegler

 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


You are mistaken, it was just defined in different place/way in same 
file, even 18 years ago it is found in OpenBSD in stdlib.h (as well as in 
unistd.h):

http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/include/stdlib.h?
rev=1.1;content-type=text%2Fplain;f=h


It doesn't hurt anything to provide this backward compatibility


Ralph





Re: rs, jot: missing headers

2014-04-11 Thread Philip Guenther
On Sat, 12 Apr 2014, Ralph Siegler wrote:
  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
 
 You are mistaken, it was just defined in different place/way in same 
 file, even 18 years ago it is found in OpenBSD in stdlib.h (as well as 
 in unistd.h):

Gotcha: you don't want to update a program to meet 18+ year old standards.  
Is your beef with OpenBSD?  Or is it with POSIX for specifying in 1995 
that getopt() only be declared in unistd.h and not stdlib.h?


 It doesn't hurt anything to provide this backward compatibility

It makes the header more complex and annoying to maintain, just to support 
programs that haven't been updated for 18+ years.  That's a negative.

You may find it interesting to see how long a source tree might work 
without changes, but that's not of interest to OpenBSD.  It's probably of 
*negative* interest of OpenBSD, as adding #include unistd.h is a 
trivial cost to the person compiling said unmaintained program, and such a 
program probably hasn't been scrutinized for the various sins of the past 
like buffer and string handling, TOCTOU violations, etc.  History is neat 
to study, but living in it sucks.


Philip



Re: rs, jot: missing headers

2014-04-11 Thread Philip Guenther
On Fri, 11 Apr 2014, Ralph Siegler wrote:
 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.

So you and other porters have taken your concerns about the incompletenes 
of the UNIX03 test suite to the group that see the money for it?  No?

Ah, so you're in that group that promulgates an alternate, complete 
standard with a compliance test suite which porters can rely on!

No?  So that makes you a programmer that wants the interfaces that didn't 
exist until POSIX specified them (sem_init), but doesn't like POSIX 
namespace rules and hasn't worked in POSIX to change them.  POSIX isn't an 
unalloyed blessing, but nilists can whine elsewhere.


 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?

Best for what?  OpenBSD doesn't strive to be the be-all and end-all of 
UNIX-like OSes.  We ain't realtime, and our threading and MP are still 
both bad and ugly in many places, and we don't have lots of the flashy 
bells that other OSes have.  What we have a strong drive to incubate 
better quality in ourselves and the entire software community by exposing, 
pushing on, and redirecting bad practices in software development.

If you want an OS that has infinite backwards compat and offers all the 
bells and whistles, look elsewhere.  Those are both anathema to OpenBSD 
and requests for them will be fruitless.


Philip



Re: rs, jot: missing headers

2014-04-10 Thread Ralph Siegler
On Thu, 14 Nov 2013 23:17:24 -0500, Eitan Adler wrote:

 Hey all,
 
 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

#ifndef _GETOPT_DEFINED_
#define _GETOPT_DEFINED_
int  getopt(int, char * const *, const char *);
extern   char *optarg;  /* getopt(3) external variables */
extern   int opterr, optind, optopt, optreset;
int  getsubopt(char **, char * const *, char **);
extern   char *suboptarg;   /* getsubopt(3) external variable 
*/
#endif /* _GETOPT_DEFINED_ */

So I'm wondering about your assertion that this is not the correct 
header filelooking at links in your post, do you really mean FreeBSD 
doesn't define them there but everyone else on the planet might?





(Notice:  I just paid SCO $600 license as protection against any 
infringement my posting of part of a linux .h file might cause)



Re: rs, jot: missing headers

2014-04-10 Thread Philip Guenther
On Thu, Apr 10, 2014 at 7:14 PM, Ralph Siegler rsieg...@rsiegler.org 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 filelooking 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



rs, jot: missing headers

2013-11-14 Thread Eitan Adler
Hey all,

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.

There may be additional instances of this throughout the OpenBSD tree
but these are the ones I noticed.

Index: rs.c
===
RCS file: /cvs/src/usr.bin/rs/rs.c,v
retrieving revision 1.22
diff -u -r1.22 rs.c
--- rs.c 3 Dec 2012 19:26:24 - 1.22
+++ rs.c 15 Nov 2013 04:00:42 -
@@ -42,6 +42,7 @@
 #include stdio.h
 #include stdlib.h
 #include string.h
+#include unistd.h

 long flags;
 #define TRANSPOSE 01

Index: jot.c
===
RCS file: /cvs/src/usr.bin/jot/jot.c,v
retrieving revision 1.21
diff -u -r1.21 jot.c
--- jot.c 30 Jan 2012 14:08:18 - 1.21
+++ jot.c 15 Nov 2013 03:59:14 -
@@ -43,6 +43,7 @@
 #include stdio.h
 #include stdlib.h
 #include string.h
+#include unistd.h

 #define REPS_DEF 100
 #define BEGIN_DEF 1

[ in case my patches get mangled:
http://people.freebsd.org/~eadler/files/o/0001.jot.diff and
http://people.freebsd.org/~eadler/files/o/0002.rs.diff ]



-- 
Eitan Adler
FreeBSD Source, Ports, Doc committer