Commit 679d1f51 679d1f51a62feeec527d57b47e0145baff19e438 by Sergey Poznyakoff

(mu_argp_init): New function.

1 parent 42a78355
......@@ -48,6 +48,8 @@ extern char *mu_license_text;
extern "C" {
#endif
extern void mu_argp_init __P ((const char *vers, const char *bugaddr));
extern void mu_create_argcv __P ((const char *capa[],
int argc, char **argv,
int *p_argc, char ***p_argv));
......
......@@ -49,8 +49,6 @@
#define ARG_SHOW_OPTIONS 3
#define ARG_LICENSE 4
const char *argp_program_bug_address = "<" PACKAGE_BUGREPORT ">";
static struct argp_option mu_common_argp_options[] =
{
{ NULL, 0, NULL, 0, N_("Common options"), 0},
......@@ -863,6 +861,13 @@ mu_build_argp (const struct argp *template, const char *capa[])
return argp;
}
void
mu_argp_init (const char *vers, const char *bugaddr)
{
argp_program_version = vers ? vers : PACKAGE_STRING;
argp_program_bug_address = bugaddr ? bugaddr : "<" PACKAGE_BUGREPORT ">";
}
error_t
mu_argp_parse(const struct argp *argp,
int *pargc, char **pargv[],
......@@ -874,6 +879,9 @@ mu_argp_parse(const struct argp *argp,
error_t ret;
const struct argp argpnull = { 0 };
/* Make sure we have program version and bug address initialized */
mu_argp_init (argp_program_version, argp_program_bug_address);
if(!argp)
argp = &argpnull;
......