|
From: | Lorenzo Bettini |
Subject: | Re: [help-gengetopt] make cmd_line_list and cmd_line_list_tmp static? |
Date: | Sat, 03 Jun 2006 17:39:07 +0200 |
User-agent: | Thunderbird 1.5.0.2 (X11/20060516) |
Andre Noll wrote:
first of all, sorry for the delay (I was busy trying to get a job) On 15:31, Lorenzo Bettini wrote:so I used the file you sent me and modified it so that the initialization takes place when optind is 1 (and not 0).I also modified the file and renamed the getopt stuffs with the prefix custom_; I then made everything static and include the contents of this file in the generated C files (in case conf or string parsers are generated). The customized version of getopt_long is then used by conf and string parsers and everything seems to work now and also valgrind does not find anything evil.Very nice, thank you very much. Is there a reason to use the custom parser only from cmdline_parser_configfile() but not from cmdline_parser()?I also tested these features with the test_multiple_parsers test program that uses three parsers (and calls the string parsers many times).I just tested the new version and this change finally solves the problem of the grab command :)
Hi againI tried to fix the problem with another solution (the customized getopt can still be inserted in the generated c source, by manually using --include-getopt, which is still a good quick thing, in case your program is destined for a system which does not provide getopt_long):
1. I switched back to optind = 0 (by few days I'll tell you more about what the C library maintainers replied to my bug report) 2. I added a check to see whether the program name is in the remaining arguments and, if so, simply discards it, so that it does not end in the inputs[] array).
This last problem was raised by Papp Gyozo, who's using another version of getopt, and I'd really like to have feedback from him, concerning this new candidate release :-) I've also added a test that manually inserts the program name in the argv[] vector, and checks that it then does not appear in the inputs[] array, (test named no_prog_name), but I'd like to hear from Gyozo too.
here's the new candidate release: http://rap.dsi.unifi.it/~bettini/gengetopt-2.17rc2.tar.gz I hope to hear from you soon :-) cheers Lorenzo -- +-----------------------------------------------------+ | Lorenzo Bettini ICQ# lbetto, 16080134 | | PhD in Computer Science | | Dip. Sistemi e Informatica, Univ. di Firenze | | Florence - Italy (GNU/Linux User # 158233) | | Home Page : http://www.lorenzobettini.it | | http://music.dsi.unifi.it XKlaim language | | http://www.purplesucker.com Deep Purple Cover Band | | http://www.gnu.org/software/src-highlite | | http://www.gnu.org/software/gengetopt | | http://www.lorenzobettini.it/software/gengen | | http://www.lorenzobettini.it/software/doublecpp | +-----------------------------------------------------+
[Prev in Thread] | Current Thread | [Next in Thread] |