show-config may print default values

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

show-config may print default values

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

Reply to Author | View Threaded | Show Only this Message

Hi everyone out there,

I have just a quick but probably add to gengetopt now. Now we have a shiny _dump() function to print all *given* options to an output stream.  Now I come up with the idea that this funciton be able to print default values as well if it is required.

The reason behind that is my application fills some of the default values at runtime which could not be compiled into the source like the actual value of TEMP environmental variable. (These default values can be overriden by the user, of course) This way I, and what would be more important, the users as well could see easily what went wrong.

--
Papp, Gyozo
Virusbuster Kft


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

Re: show-config may print default values

by Lorenzo Bettini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Papp Gyozo (VBuster) wrote:
> Hi everyone out there,
>
> I have just a quick but probably add to gengetopt now. Now we have a shiny _dump() function to print all *given* options to an output stream.  Now I come up with the idea that this funciton be able to print default values as well if it is required.
>
> The reason behind that is my application fills some of the default values at runtime which could not be compiled into the source like the actual value of TEMP environmental variable. (These default values can be overriden by the user, of course) This way I, and what would be more important, the users as well could see easily what went wrong.
>

Hi there

I'm not sure I understad: do you just need that if an option contains
the default value it should be dumped anyway, am I right?

cheers
        Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
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: show-config may print default values

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

Reply to Author | View Threaded | Show Only this Message

> I'm not sure I understad: do you just need that if an option contains
> the default value it should be dumped anyway, am I right?

yes, something like that. Actually I'm talking about to extend the current condition selecting options to be dumped:

  if (args_info->help_given)
    write_into_file(outfile, "help", 0, 0 );

to something like that:

int
<parser>_dump(FILE *outfile, struct cmdline_options *args_info, int dumpall)
(...)
  if (dumpall || args_info->help_given)
    write_into_file(outfile, "help", 0, 0 );

`dumpall' argument may not be the best or ultimate choice. I rather need if *_orig differs from the actual *_arg, but chances are this kind of check makes no sense in certain cases or too difficult to implement (multiple string choices brr)... and it may be too particular request.

Anyway please think of it! :)


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