--no-handle-help|version

View: New views
8 Messages — Rating Filter:   Alert me  

--no-handle-help|version

by Papp Gyozo (VBuster) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there,

another minor issue I've been faced up now. Even if I add '--no-handle-version' the processing of the commandline finishes right after it encounters with a '-V' or '--version' option.

My application should behave differently, ie. prints the version of other loaded libraries if the required options are given. Now the situation is the latter one does not print engine and vdb version to the output:

  vbscan --vdb= ... --engine=... --version ; both --vdb and --engine processed
  vbscan --version --vdb= ... --engine=... ; neither --vdb and --engine processed

however in general beside this, gengetopt generated parsers do not deal with the exact order of the program arguments.

      switch (c)
        {

        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;
          getoptions_free (&local_args_info);
          return 0;

          break;

I think this 'return 0' should be gone away? What do you think?

--
Papp, Gyozo
Virusbuster Kft


_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt

Re: --no-handle-help|version

by Lorenzo Bettini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Papp Gyozo (VBuster) wrote:
> Hi there,
>
> another minor issue I've been faced up now. Even if I add '--no-handle-version' the processing of the commandline finishes right after it encounters with a '-V' or '--version' option.
>
> My application should behave differently, ie. prints the version of other loaded libraries if the required options are given. Now the situation is the latter one does not print engine and vdb version to the output:
>
>   vbscan --vdb= ... --engine=... --version ; both --vdb and --engine processed
>   vbscan --version --vdb= ... --engine=... ; neither --vdb and --engine processed
>

hi there

actually, --no-handle-version (and similarly --no-handle-help) was
thought to be used to handle --version in a custom way, while keeping
the semantics that if --version is specified then the parsing stops (see
the description of --version option printed by --help)...

However, I agree with you that one might want to go on with parsing...

I don't know whether it's better to change the current
--no-handle-version implementation and remove the return statement as
you said (risking to break existing code that used to make the above
assumption about --version implementation), or provide a way to
completely redefine the version (and help) options, in such a way that
the programmer has the complete control for them if he wants to...

any suggestion?

> however in general beside this, gengetopt generated parsers do not deal with the exact order of the program arguments.

could you please provide an example?
notice that the parser completely relies on getopt_long implementation
about this...

cheers
        Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net



_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt

Re: --no-handle-help|version

by Papp Gyozo (VBuster) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

> > another minor issue I've been faced up now. Even if I add
> '--no-handle-version' the processing of the commandline finishes right after
> it encounters with a '-V' or '--version' option.
> >
> > My application should behave differently, ie. prints the version of other
> loaded libraries if the required options are given. Now the situation is the
> latter one does not print engine and vdb version to the output:
> >
> >   vbscan --vdb= ... --engine=... --version ; both --vdb and --engine
> processed
> >   vbscan --version --vdb= ... --engine=... ; neither --vdb and --engine
> processed

> I don't know whether it's better to change the current [...]
> the programmer has the complete control for them if he wants to...

The "entire bypass" may be the best if someone really needs. But if it needs a lot to do, then don't do it. I could live with this behaviour. As I mentioned it is really a minor issue.

 
> > however in general beside this, gengetopt generated parsers do not deal
> with the exact order of the program arguments.
>
> could you please provide an example?

Look at above! It doesn't usually matter either --vdb or --engine comes first, the result from the application's view will be the same.

> notice that the parser completely relies on getopt_long implementation about
Yes, you are right indeed.


_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt

Re: --no-handle-help|version

by Lorenzo Bettini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

I added the --no-help and --no-version options for gengetopt that avoid
automatically generating --help and --version

I've committed the modifications in the CVS or you can find a temporary
version here:

http://rap.dsi.unifi.it/~bettini/gengetopt-2.22b.tar.gz

look forward to getting feedback :-)
cheers
        Lorenzo

Papp Gyozo (VBuster) wrote:

> Hi,
>
>>> another minor issue I've been faced up now. Even if I add
>> '--no-handle-version' the processing of the commandline finishes right after
>> it encounters with a '-V' or '--version' option.
>>> My application should behave differently, ie. prints the version of other
>> loaded libraries if the required options are given. Now the situation is the
>> latter one does not print engine and vdb version to the output:
>>>   vbscan --vdb= ... --engine=... --version ; both --vdb and --engine
>> processed
>>>   vbscan --version --vdb= ... --engine=... ; neither --vdb and --engine
>> processed
>
>> I don't know whether it's better to change the current [...]
>> the programmer has the complete control for them if he wants to...
>
> The "entire bypass" may be the best if someone really needs. But if it needs a lot to do, then don't do it. I could live with this behaviour. As I mentioned it is really a minor issue.
>
>  
>>> however in general beside this, gengetopt generated parsers do not deal
>> with the exact order of the program arguments.
>>
>> could you please provide an example?
>
> Look at above! It doesn't usually matter either --vdb or --engine comes first, the result from the application's view will be the same.
>
>> notice that the parser completely relies on getopt_long implementation about
> Yes, you are right indeed.
>
>
> _______________________________________________
> Help-gengetopt mailing list
> Help-gengetopt@...
> http://lists.gnu.org/mailman/listinfo/help-gengetopt
>


--
Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt

Re: --no-handle-help|version

by Papp Gyozo (VBuster) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> I added the --no-help and --no-version options for gengetopt that avoid
> automatically generating --help and --version

So, you suggest me solving this situation with --no-version. This --version handling is totally up to the application. In other words with --no-version enabled options named "version" or "help" are as regular options as the others specified in .ggo files. Am I right?

> Papp Gyozo (VBuster) wrote:
> > Hi,
> >
> >>> another minor issue I've been faced up now. Even if I add
> >> '--no-handle-version' the processing of the commandline finishes right
> after
> >> it encounters with a '-V' or '--version' option.
> >>> My application should behave differently, ie. prints the version of
> other
> >> loaded libraries if the required options are given. Now the situation is
> the
> >> latter one does not print engine and vdb version to the output:
> >>>   vbscan --vdb= ... --engine=... --version ; both --vdb and --engine
> >> processed
> >>>   vbscan --version --vdb= ... --engine=... ; neither --vdb and --engine
> >> processed
> >
> >> I don't know whether it's better to change the current [...]
> >> the programmer has the complete control for them if he wants to...
> >
> > The "entire bypass" may be the best if someone really needs. But if it
> needs a lot to do, then don't do it. I could live with this behaviour. As I
> mentioned it is really a minor issue.
> >
> >  
> >>> however in general beside this, gengetopt generated parsers do not deal
> >> with the exact order of the program arguments.
> >>
> >> could you please provide an example?
> >
> > Look at above! It doesn't usually matter either --vdb or --engine comes
> first, the result from the application's view will be the same.
> >
> > notice that the parser completely relies on getopt_long implementation
> > about Yes, you are right indeed.


_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt

Re: --no-handle-help|version

by J. David Bryan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 5 Dec 2007 at 21:18, Lorenzo Bettini wrote:

> I've committed the modifications in the CVS or you can find a temporary
> version here:
>
> http://rap.dsi.unifi.it/~bettini/gengetopt-2.22b.tar.gz

I see that the 'update_arg' function is now suppressed if it is not needed
(e.g., with a .ggo file that does not contain any option statements).  
Thanks!

                                      -- Dave



_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt

Re: --no-handle-help|version

by Lorenzo Bettini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Papp Gyozo (VBuster) wrote:
>> I added the --no-help and --no-version options for gengetopt that avoid
>> automatically generating --help and --version
>
> So, you suggest me solving this situation with --no-version. This --version handling is totally up to the application. In other words with --no-version enabled options named "version" or "help" are as regular options as the others specified in .ggo files. Am I right?
>

that's exactly as you said :-)

--
Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net



_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt

Re: --no-handle-help|version

by Lorenzo Bettini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

J. David Bryan wrote:

> On 5 Dec 2007 at 21:18, Lorenzo Bettini wrote:
>
>> I've committed the modifications in the CVS or you can find a temporary
>> version here:
>>
>> http://rap.dsi.unifi.it/~bettini/gengetopt-2.22b.tar.gz
>
> I see that the 'update_arg' function is now suppressed if it is not needed
> (e.g., with a .ggo file that does not contain any option statements).  
> Thanks!

yes, I probably forgot to mention that in my last email :-)

--
Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net



_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt