portability touch-up #2

Peter S. Mazinger ps.m at gmx.net
Fri May 26 22:28:06 UTC 2006


On Sat, 27 May 2006, Bernhard Fischer wrote:

> On Fri, May 26, 2006 at 11:40:54PM +0200, Peter S. Mazinger wrote:
> >On Fri, 26 May 2006, Bernhard Fischer wrote:
> >
> >> This is the rest of the initial diff.
> >> 
> >> These bits are needed to be able to configure busybox with a non-gcc
> >> C-compiler on a non-linux box.
> >> 
> >> Just for reference..
> >
> >s/getopt.h/unistd.h/ as of SuSv3
> 
> Ouch. You're right.

http://www.opengroup.org/onlinepubs/009695399/functions/getopt.html

Peter
> 
> #ifdef  __USE_POSIX2
> /* Get definitions and prototypes for functions to process the
>    arguments in ARGV (ARGC of them, minus the program name) for
>    options given in OPTS.  */
> # define __need_getopt
> # include <getopt.h>
> #endif
> 
> for glibc; resp.:
> 
> /*
>  * POSIX requires that certain values be included in unistd.h.  It also
>  * requires that when _POSIX_C_SOURCE is defined (>= 1) only those 
>  * standard specific values are present.  This header includes all the
>  * POSIX
>  * required entries.
>  */
> 
> #if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 1)
> /* Symbolic constants for the "lseek" function: */
> 
> #include <sys/seek.h>
> #include <getopt.h>
> 
> /***AAB-XPG4*** must protect from XPG4 ***/
> #ifdef _OSF_SOURCE
> extern char **environ;          /* Environment description variable */
> /* forward declaration for bindresvport() */
> struct sockaddr_in;
> #endif /*OSF_SOURCE*/
> 
> We still have some direct getopt users, so they ought to include
> getopt.h themselves; The getopt_ulflags users which don't use optind
> nor optarg could (and should) thusly of course drop that include.
> Thanks for the hint.
> 
> 

-- 
Peter S. Mazinger <ps dot m at gmx dot net>           ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08  BB6E C389 975E A5F0 59F2




More information about the busybox mailing list