[cfarm-users] getopt on AIX

zatrazz zatrazz at gmail.com
Sun Jul 5 21:07:15 CEST 2020


On Sun, Jul 5, 2020 at 4:00 PM Bruno Haible via cfarm-users <
cfarm-users at lists.tetaneutral.net> wrote:

> Jeffrey,
>
> > 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
>
> Bruno
>

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.

-- 
"Tradition is not the worship of ashes, but the preservation of fire."
- Gustav Mahler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.tetaneutral.net/pipermail/cfarm-users/attachments/20200705/de1cb53a/attachment.html>


More information about the cfarm-users mailing list