Re: [Question][CMDLINE_PARSER_PACKAGE]

Lorenzo Bettini <[email protected]> Mon, 01 Jun 2009 19:12:54 +0200
Newsgroups gmane.comp.gnu.gengetopt.general
Message-ID <[email protected]>
Salvatore Santagati wrote:
> Ciao Lorenzo
> 
>> well, that PACKAGE variable is used from within the command line parser to
>> print errors, and thus it should be set to the actual command, and not to
>> the package name.  However, I think you're right about PACKAGE_NAME being
>> useful, for instance when printing the output of --help and --version, am I
>> right?
> 
> Yes, you are right.
> 
>> Then probably PACKAGE_NAME should be used to and probably default to PACKAGE
>> if not specified, am I right?
> 
> Yes,
> http://www.gnu.org/software/hello/manual/autoconf/Initializing-configure.html
> 
> 
> Cheers
> Salvatore
> 
> PS : sorry for double post

Hi

you can find the candidate release, with this feature here:

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

any feedback is more than welcome :-)

now the generated header looks like this

#ifndef CMDLINE_PARSER_PACKAGE
/** @brief the program name (used for printing errors) */
#define CMDLINE_PARSER_PACKAGE PACKAGE
#endif

#ifndef CMDLINE_PARSER_PACKAGE_NAME
/** @brief the complete program name (used for help and version) */
#ifdef PACKAGE_NAME
#define CMDLINE_PARSER_PACKAGE_NAME PACKAGE_NAME
#else
#define CMDLINE_PARSER_PACKAGE_NAME PACKAGE
#endif
#endif

and CMDLINE_PARSER_PACKAGE_NAME is used (if not empty) to print --help 
and --version, while CMDLINE_PARSER_PACKAGE is used for printing errors.

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