help-gengetopt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [help-gengetopt] cmdline_file_save accepts file handler instead


From: Lorenzo Bettini
Subject: Re: [help-gengetopt] cmdline_file_save accepts file handler instead
Date: Wed, 03 Oct 2007 14:24:29 +0200
User-agent: Thunderbird 2.0.0.4 (Windows/20070604)

Papp Gyozo (VBuster) wrote:
by the way, I still haven't started to work on the group options we

Never mind because in the meanwhile we also postponed the integration of the 
two product where it could lend me some help. By the way, I still support it.


OK, as soon as I have something ready I'll tell you

discussed because I'm refactoring the generated code so that there's
much less duplicated code,

Ooh then one another thing (I'm afraid I noted it earlier, too.)
What about merging the two help array into one? As far as I know, there are two separate 
array one with help string with each option while the other with only "public" 
options (no hidden). I prefer to do it like this:

struct {
   const char *text;
   int        public;
} cmdline_options_help[] = {
  { "  -h, --help                   Print help and exit", 1 },
  ...
};

void
cmdline_print_help (void)
{
  ...
  for (i = 0; cmdline_options_help[i]; i++ ) {
    if ( cmdline_options_help[i].public )
       printf("%s\n", cmdline_options_help[i].text );
  }
}

void
cmdline_print_help (void)
{
  ...
  while (cmdline_options_full_help[i].text)
    printf("%s\n", cmdline_options_full_help[i++].text);
}


It's just code cosmetic but it may leverage someone's convenience level with 
the gengetopt sources.


yes, actually I was also starting to work on this. I'm a little bit reluctant on using a structure for the help strings, since this might break previous code... I could build one array starting from the other though (sharing strings)...

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
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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]