help-gengetopt
[Top][All Lists]
Advanced

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

Re: [help-gengetopt]patch for gm.c


From: Scott Haug
Subject: Re: [help-gengetopt]patch for gm.c
Date: Tue, 10 Oct 2000 11:20:23 -0700
User-agent: Mutt/1.2.5i

On Tue, Oct 10, 2000 at 04:11:43PM +0100, Lorenzo Bettini wrote:
> 
> If you send me the url of your project I can put a link in the gengetopt
> page.
> 

http://www.id3lib.org

As the name implies, id3lib is a library, so it has no use for command-line
parsing.  But the source includes a few demo apps that do.  The next release
will be the first one to use ggo.

> > Second, it #undef's PACKAGE and VERSION before setting them.  id3lib ships 
> > with
> > several example apps as a part of a single tarball.  The toplevel 
> > configure.in
> > defines PACAKGE and VERSION to be for the entire library, and I want 
> > different
> > names (and possibly different version numbers) for the various example apps
> > that ship with it.  #undef'ing these macros prevents compiler warnings.  It
> > might be best to choose different macro names for these two (GGO_PACKAGE and
> > GGO_VERSION?).
> 
> ... and let them point to PACKAGE and VERSION by default?

Here's what I would like to see.  If the ggo file specifies package/version,
then GGO_PACKAGE/GGO_VERSION should be set to that.  If they aren't specified,
and if PACKAGE/VERSION are defined, then GGO_PACKAGE/GGO_VERSION should be set
to that.  Otherwise, they should be set to "", like it is currently.

I imagine the code would like like this:

  if (gengetopt_package != NULL)
        printf ("\
#define GGO_PACKAGE \"%s\"\n\
", gengetopt_package);
  else
        printf ("\
#if defined PACKAGE\n\
#  define GGO_PACKAGE PACKAGE\n\
#else
/* ******* WRITE THE NAME OF YOUR PROGRAM HERE ******* */\n\
#  define GGO_PACKAGE \"\"
#endif\n\
");

  if (gengetopt_version != NULL)
        printf ("\
#define GGO_VERSION \"%s\"\n\
", gengetopt_version);
  else
        printf ("\
#if defined VERSION\n\
#  define GGO_VERSION VERSION
#else
/* ******* WRITE THE VERSION OF YOUR PROGRAM HERE ******* */\n\
#  define GGO_VERSION \"\"
#endif\n\
");


Then the print_version(void) function would print the following line:

  printf (\"%%s %%s\\n\", GGO_PACKAGE, GGO_VERSION);\n\

How does that sound?

-Scott

-- 



reply via email to

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