[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [help-gengetopt] gengetopt C example
From: |
Lorenzo Bettini |
Subject: |
Re: [help-gengetopt] gengetopt C example |
Date: |
Wed, 23 Oct 2013 07:46:44 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 |
On 23/10/2013 00:31, Tong Sun wrote:
> Further investigation:
>
>> Here are the example files distributed from my Debian/Ubuntu package
>>
>> /usr/share/doc/gengetopt/examples
>> /usr/share/doc/gengetopt/examples/cmdline2.c.gz
>> /usr/share/doc/gengetopt/examples/cmdline2.h.gz
>
> Having expanded the distributed cmdline2.h/c, then compare them with my
> generated ones, I get:
>
> $ diff -wU 1 /usr/share/doc/gengetopt/examples/cmdline2.h cmdline2.h
> -- same
>
> $ diff -wU 1 /usr/share/doc/gengetopt/examples/cmdline2.c cmdline2.c
> --- /usr/share/doc/gengetopt/examples/cmdline2.c 2013-05-09
> 13:33:53.000000000 -0400
> +++ cmdline2.c 2013-10-22 17:33:42.380298444 -0400
> @@ -3,3 +3,3 @@
> generated with the following command:
> - ../src/gengetopt --input=./sample2.ggo --func-name=my_cmdline_parser
> --file-name=cmdline2 --unamed-opts --no-handle-help --no-handle-version
> + gengetopt --input=sample2.ggo --func-name=my_cmdline_parser
> --file-name=cmdline2 --unamed-opts
>
It looks like it has been generated with a different command line; you
see that the original one has been generated with the additional options
--no-handle-help --no-handle-version
I think...
I'll try to take a look at this issue, but I don't have lot of time;
please also file a bug report for gengetopt so that I can keep track of
that.
cheers
Lorenzo
> @@ -664,29 +664,11 @@
> case 'h': /* Print help and exit. */
> -
> -
> - if (update_arg( 0 ,
> - 0 , &(args_info->help_given),
> - &(local_args_info.help_given), optarg, 0, 0, ARG_NO,
> - check_ambiguity, override, 0, 0,
> - "help", 'h',
> - additional_error))
> - goto failure;
> + my_cmdline_parser_print_help ();
> my_cmdline_parser_free (&local_args_info);
> - return 0;
> + exit (EXIT_SUCCESS);
>
> - break;
> case 'V': /* Print version and exit. */
> -
> -
> - if (update_arg( 0 ,
> - 0 , &(args_info->version_given),
> - &(local_args_info.version_given), optarg, 0, 0, ARG_NO,
> - check_ambiguity, override, 0, 0,
> - "version", 'V',
> - additional_error))
> - goto failure;
> + my_cmdline_parser_print_version ();
> my_cmdline_parser_free (&local_args_info);
> - return 0;
> + exit (EXIT_SUCCESS);
>
> - break;
> case 's': /* A string option. */
> @@ -823,20 +805,8 @@
> case 0: /* Long option with no short option */
> - /* Print help, including hidden options, and exit. */
> - if (strcmp (long_options[option_index].name, "full-help") == 0)
> - {
> -
> -
> - if (update_arg( 0 ,
> - 0 , &(args_info->full_help_given),
> - &(local_args_info.full_help_given), optarg, 0, 0, ARG_NO,
> - check_ambiguity, override, 0, 0,
> - "full-help", '-',
> - additional_error))
> - goto failure;
> + if (strcmp (long_options[option_index].name, "full-help") == 0) {
> + my_cmdline_parser_print_full_help ();
> my_cmdline_parser_free (&local_args_info);
> - return 0;
> -
> + exit (EXIT_SUCCESS);
> }
>
> - break;
> case '?': /* Invalid option. */
>
> Looks to me that the gengetopt is behaving as always, since the generated
> files are (almost) the same.
>
> So the error is caused by the new gcc?
>
> Any easy fix?
>
> PS.
>
> $ apt-cache policy gcc
> gcc:
> Installed: 4:4.8.0-0ubuntu13
> Candidate: 4:4.8.1-2ubuntu3
> Version table:
> 4:4.8.1-2ubuntu3 0
> 500 http://us.archive.ubuntu.com/ubuntu/ saucy/main i386 Packages
> *** 4:4.8.0-0ubuntu13 0
> 100 /var/lib/dpkg/status
>
> Thanks
>
>
> _______________________________________________
> Help-gengetopt mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-gengetopt
>
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book