(mu_argp_init): New function.
Showing
2 changed files
with
12 additions
and
2 deletions
... | @@ -48,6 +48,8 @@ extern char *mu_license_text; | ... | @@ -48,6 +48,8 @@ extern char *mu_license_text; |
48 | extern "C" { | 48 | extern "C" { |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | extern void mu_argp_init __P ((const char *vers, const char *bugaddr)); | ||
52 | |||
51 | extern void mu_create_argcv __P ((const char *capa[], | 53 | extern void mu_create_argcv __P ((const char *capa[], |
52 | int argc, char **argv, | 54 | int argc, char **argv, |
53 | int *p_argc, char ***p_argv)); | 55 | int *p_argc, char ***p_argv)); | ... | ... |
... | @@ -49,8 +49,6 @@ | ... | @@ -49,8 +49,6 @@ |
49 | #define ARG_SHOW_OPTIONS 3 | 49 | #define ARG_SHOW_OPTIONS 3 |
50 | #define ARG_LICENSE 4 | 50 | #define ARG_LICENSE 4 |
51 | 51 | ||
52 | const char *argp_program_bug_address = "<" PACKAGE_BUGREPORT ">"; | ||
53 | |||
54 | static struct argp_option mu_common_argp_options[] = | 52 | static struct argp_option mu_common_argp_options[] = |
55 | { | 53 | { |
56 | { NULL, 0, NULL, 0, N_("Common options"), 0}, | 54 | { NULL, 0, NULL, 0, N_("Common options"), 0}, |
... | @@ -863,6 +861,13 @@ mu_build_argp (const struct argp *template, const char *capa[]) | ... | @@ -863,6 +861,13 @@ mu_build_argp (const struct argp *template, const char *capa[]) |
863 | return argp; | 861 | return argp; |
864 | } | 862 | } |
865 | 863 | ||
864 | void | ||
865 | mu_argp_init (const char *vers, const char *bugaddr) | ||
866 | { | ||
867 | argp_program_version = vers ? vers : PACKAGE_STRING; | ||
868 | argp_program_bug_address = bugaddr ? bugaddr : "<" PACKAGE_BUGREPORT ">"; | ||
869 | } | ||
870 | |||
866 | error_t | 871 | error_t |
867 | mu_argp_parse(const struct argp *argp, | 872 | mu_argp_parse(const struct argp *argp, |
868 | int *pargc, char **pargv[], | 873 | int *pargc, char **pargv[], |
... | @@ -874,6 +879,9 @@ mu_argp_parse(const struct argp *argp, | ... | @@ -874,6 +879,9 @@ mu_argp_parse(const struct argp *argp, |
874 | error_t ret; | 879 | error_t ret; |
875 | const struct argp argpnull = { 0 }; | 880 | const struct argp argpnull = { 0 }; |
876 | 881 | ||
882 | /* Make sure we have program version and bug address initialized */ | ||
883 | mu_argp_init (argp_program_version, argp_program_bug_address); | ||
884 | |||
877 | if(!argp) | 885 | if(!argp) |
878 | argp = &argpnull; | 886 | argp = &argpnull; |
879 | 887 | ... | ... |
-
Please register or sign in to post a comment