getopt.h and gnulib

Paul Eggert eggert@cs.ucla.edu
Wed Mar 22 20:49:00 GMT 2017


On 03/22/2017 12:35 PM, Zack Weinberg wrote:
> what would you think of splitting
> getopt.h in gnulib into three files?  getopt_posix.h with just the
> stuff that glibc wants in unistd.h, getopt_ext.h with all the
> extensions, and getopt.h which is the public wrapper that includes
> both of them and has all the non-glibc compatibility logic.
> getopt_posix.h and getopt_ext.h would be shared between gnulib and
> glibc, but getopt.h would_not_  be shared.  glibc would install
> getopt_posix.h and getopt_ext.h in the bits subdirectory, and it would
> provide its own getopt.h that doesn't have any of the compatibility
> logic.

That all sounds doable. getopt.h is not shared now, so it's not much of 
a change from gnulib's point of view. (I'd like to have getopt.h be 
shared too, but that's a different topic.)

FYI the following other __need_* symbols are used in both glibc and 
gnulib: __need_error_t, __need_FILE, __need___FILE, __need_NULL, 
__need_sigset_t, __need_size_t, and __need_wint_t. I don't offhand see 
problems with them either.



More information about the Libc-alpha mailing list