Re: gengetopt C example

Tong Sun <[email protected]> Thu, 24 Oct 2013 11:35:24 -0700 (PDT)
Newsgroups gmane.comp.gnu.gengetopt.general
Message-ID <[email protected]>
On Thursday, 24 October 2013, 14:27, Tong Sun <[email protected]> wro=
te:

Thanks for your reply,=A0Lorenzo.


[Retry again]

> please also file a bug report for gengetopt so that I can keep track of
> that.

Sure, will do after I go home tonight. Also the "Segmentation fault" bug
that I'll report later.=A0

> If I remember correctly, that example generates a file that expected a
> PACKAGE and VERSION passed on the compilation command line, e.g.,
>=A0
> gcc -DPACKAGE=3D"..." -DVERSION=3D"..."

That didn't work, but=A0

=A0 gcc -DPACKAGE=3D'"..."' -DVERSION=3D"..."

works.=A0

> this should be documented in the manual.

OK, here are the things need to be changed:

,-----
| From /usr/share/doc/gengetopt/examples/README.example:
|=A0
| ...=A0
|=A0
| # commands to try the C example:=A0
|=A0
| gengetopt --input=3Dsample2.ggo --func-name=3Dmy_cmdline_parser=A0
| --file-name=3Dcmdline2 --unamed-opts
| gcc -o main2 main2.c cmdline2.c
| ./main2 -h
| ...=A0
`-----

the C example that come with the Debian/Ubuntu package
was generated with a different command line:=A0

=A0gengetopt --input=3D./sample2.ggo --func-name=3Dmy_cmdline_parser --file=
-name=3Dcmdline2 --unamed-opts --no-handle-help --no-handle-version

To compile,=A0

=A0 gcc -DPACKAGE=3D'"cmdline2"' -DVERSION=3D"1.1" -o main2 main2.c cmdline=
2.c