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 -0000 1.22 +++ rs.c 15 Nov 2013 04:00:42 -0000 @@ -42,6 +42,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <unistd.h> long flags; #define TRANSPOSE 000001 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 -0000 1.21 +++ jot.c 15 Nov 2013 03:59:14 -0000 @@ -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