[cfarm-users] getopt on AIX

Jeffrey Walton noloader at gmail.com
Mon Jul 6 00:04:50 CEST 2020


On Sun, Jul 5, 2020 at 3:07 PM zatrazz <zatrazz at gmail.com> wrote:
>
> On Sun, Jul 5, 2020 at 4:00 PM Bruno Haible via cfarm-users <cfarm-users at lists.tetaneutral.net> wrote:
>>
>> > b2sum-src/b2sum.c:266:26: error: array type has incomplete element
>> > type 'struct option'
>> >      static struct option long_options[] = {
>> >                           ^~~~~~~~~~~~
>>
>> When you use 'struct option', you need to
>>
>>   1) use Gnulib module 'getopt-gnu' - see the documentation
>>      https://www.gnu.org/software/gnulib/manual/html_node/getopt.html
>>      https://www.gnu.org/software/gnulib/manual/html_node/getopt_002eh.html
>>      https://www.gnu.org/software/gnulib/manual/html_node/getopt_005flong.html
>>
>>   2) #include <getopt.h>, not <unistd.h> - see the documentation
>>      https://www.gnu.org/software/gnulib/MODULES.html#module=getopt-gnu
>
> And getopt(3) with long options is a GNU extension implemented by glibc, some
> other libc also provides similar interfaces (such as FreeBSD with getopt_long).
>
> However it seems that AIX does not have a similar interface so the best option
> is indeed to use gnulib.

Ack, thanks Bruno and zatrazz.

Jeff


More information about the cfarm-users mailing list