[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[help-gengetopt] RE: a small improvement(?) in the config file parser
From: |
Gyozo, PAPP (VBuster) |
Subject: |
[help-gengetopt] RE: a small improvement(?) in the config file parser |
Date: |
Tue, 5 Oct 2004 18:57:54 +0200 |
Sorry,
this time I am the one being in hurry. At later I will be back (as Arnold in
Terminator :) and try to summarize my opinions.
" -----Original Message-----
" From: Lorenzo Bettini [mailto:address@hidden
" Sent: Tuesday, October 05, 2004 6:33 PM
" To: Gyozo, PAPP (VBuster)
" Cc: address@hidden
" Subject: Re: a small improvement(?) in the config file parser
"
"
" Gyozo, PAPP (VBuster) wrote:
" > Hi there,
" >
" > I've run into a problem (with gengetopt 2.13) which I could
" not resolve reassuringly.
" > The problem involves the new config file parser function
" (btw I think the old one would also be subject of this problem.)
" >
" > Take the following .ggo resource file
" > # option.ggo
" > option "option-with-arg" - "this option must have an
" argument" type=string no
" > option "arbitrary" - "this option is arbitrary, but
" has great importance in this example" no
" >
" > and the following config file given to the application:
" > # config.ini
" > option-with-arg = # no option is specified, error!
" > arbitrary
" >
" > The problem is that the _configfile() parser function
" currently ignores the equal-sign and simply generates
" "--option-with-arg" for the corresponding argv element, and
" then finally "--arbitrary" is also added to the virtual
" commandline which will be passed to the _internal() perser
" function. So after reading up the preceding config file
" cmdline_internal() receives the following argv array:
" > [0] = PACKAGE_VAR_NAME
" > [1] = "--option-with-arg"
" > [2] = "arbitrary"
" >
" > At this point, you can easily guess what the real problem
" is. Yes, the parser function thinks that "arbitrary" is the
" option-argument of "--option-with-arg", so the whole
" configuration will be messed up. I patched the configfile
" parser template which checks now if equal sign is present in
" the current line, and if so, it adds the equal sign to the
" corresponding argv element.
" > [0] = PACKAGE_VAR_NAME
" > [1] = "--option-with-arg="
" > [2] = "arbitrary"
" >
" > This hack may suffice my current needs, but I think the
" real solution would be if options read by _configfile()
" function was processed immediately without translating the
" options to a virtual command line and then processed by _internal().
" >
"
" Well I'm quite skeptical of going back to let the config
" parser function
" to actually parse the arguments, since this would not be
" consistent with
" the getopt_long function.
"
" Moreover, I'm quite sure that the behavior of the current code is
" actually the same of what would happen if you gave at the
" command line
" the sequence
"
" --option-with-arg = --arbitrary
"
" i.e., intepret --arbitrary as the argument to --option-with-arg
"
" if this is not the case, I think the best solution is to
" issue an error
" saying that in the conf file the line "--option-with-arg = "
" is wrong...
"
" I'm not sure I understood the solution of your patch, I mean,
" what does
" the vector
"
" [0] = PACKAGE_VAR_NAME
" [1] = "--option-with-arg="
" [2] = "arbitrary"
"
" produce?
"
" cheers
" Lorenzo
"
"
"
" --
" +-----------------------------------------------------+
" | Lorenzo Bettini ICQ# lbetto, 16080134 |
" | PhD in Computer Science |
" | Dip. Sistemi e Informatica, Univ. di Firenze |
" | Tel +39 055 4796741, Fax +39 055 4796730 |
" | Florence - Italy (GNU/Linux User # 158233) |
" | Home Page : http://www.lorenzobettini.it |
" | http://music.dsi.unifi.it XKlaim language |
" | http://www.lorenzobettini.it/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 |
" +-----------------------------------------------------+
"
"
- [help-gengetopt] RE: a small improvement(?) in the config file parser,
Gyozo, PAPP (VBuster) <=