(mh_getopt, mh_help): Accept new argument: a pointer to the doc string.
Showing
2 changed files
with
11 additions
and
9 deletions
... | @@ -31,7 +31,7 @@ char *mh_optarg; | ... | @@ -31,7 +31,7 @@ char *mh_optarg; |
31 | char *mh_optptr; | 31 | char *mh_optptr; |
32 | 32 | ||
33 | int | 33 | int |
34 | mh_getopt (int argc, char **argv, struct mh_option *mh_opt) | 34 | mh_getopt (int argc, char **argv, struct mh_option *mh_opt, const char *doc) |
35 | { | 35 | { |
36 | struct mh_option *p; | 36 | struct mh_option *p; |
37 | int optlen; | 37 | int optlen; |
... | @@ -86,19 +86,19 @@ mh_getopt (int argc, char **argv, struct mh_option *mh_opt) | ... | @@ -86,19 +86,19 @@ mh_getopt (int argc, char **argv, struct mh_option *mh_opt) |
86 | } | 86 | } |
87 | else if (!strcmp (mh_optptr+1, "help")) | 87 | else if (!strcmp (mh_optptr+1, "help")) |
88 | { | 88 | { |
89 | mh_help (mh_opt); | 89 | mh_help (mh_opt, doc); |
90 | exit (1); | 90 | exit (1); |
91 | } | 91 | } |
92 | return '?'; | 92 | return '?'; |
93 | } | 93 | } |
94 | 94 | ||
95 | void | 95 | void |
96 | mh_help (struct mh_option *mh_opt) | 96 | mh_help (struct mh_option *mh_opt, const char *doc) |
97 | { | 97 | { |
98 | struct mh_option *p; | 98 | struct mh_option *p; |
99 | 99 | ||
100 | printf ("Compatibility syntax:\n"); | 100 | printf ("Compatibility syntax:\n"); |
101 | printf ("%s [+folder] [msgs] [switches]\n", program_invocation_short_name); | 101 | printf ("%s [switches] %s\n", program_invocation_short_name, doc); |
102 | printf (" switches are:\n"); | 102 | printf (" switches are:\n"); |
103 | 103 | ||
104 | for (p = mh_opt; p->opt; p++) | 104 | for (p = mh_opt; p->opt; p++) |
... | @@ -120,4 +120,5 @@ mh_help (struct mh_option *mh_opt) | ... | @@ -120,4 +120,5 @@ mh_help (struct mh_option *mh_opt) |
120 | printf ("\n"); | 120 | printf ("\n"); |
121 | } | 121 | } |
122 | printf (" -help\n"); | 122 | printf (" -help\n"); |
123 | printf ("\nPlease use GNU long options instead. Run %s --help for more info on these.\n", program_invocation_short_name); | ||
123 | } | 124 | } | ... | ... |
... | @@ -15,11 +15,12 @@ struct mh_option | ... | @@ -15,11 +15,12 @@ struct mh_option |
15 | extern int mh_optind; | 15 | extern int mh_optind; |
16 | extern char *mh_optarg; | 16 | extern char *mh_optarg; |
17 | 17 | ||
18 | int mh_getopt (int argc, char **argv, struct mh_option *mh_opt); | 18 | int mh_getopt __P((int argc, char **argv, struct mh_option *mh_opt, |
19 | int mh_argp_parse (int argc, char **argv, | 19 | const char *doc)); |
20 | int mh_argp_parse __P((int argc, char **argv, | ||
20 | struct argp_option *option, | 21 | struct argp_option *option, |
21 | struct mh_option *mh_option, | 22 | struct mh_option *mh_option, |
22 | char *argp_doc, char *doc, | 23 | char *argp_doc, char *doc, |
23 | int (*handler)(), void *closure, int *index); | 24 | int (*handler)(), void *closure, int *index)); |
24 | void mh_help (struct mh_option *mh_option); | 25 | void mh_help __P((struct mh_option *mh_option, const char *doc)); |
25 | void mh_license (const char *name); | 26 | void mh_license __P((const char *name)); | ... | ... |
-
Please register or sign in to post a comment