Commit 3a2ce6db 3a2ce6dbe69d0e54b6813a07e074fee79ba33386 by Sergey Poznyakoff

(mh_getopt, mh_help): Accept new argument: a pointer to the doc string.

1 parent 90accacc
......@@ -31,7 +31,7 @@ char *mh_optarg;
char *mh_optptr;
int
mh_getopt (int argc, char **argv, struct mh_option *mh_opt)
mh_getopt (int argc, char **argv, struct mh_option *mh_opt, const char *doc)
{
struct mh_option *p;
int optlen;
......@@ -86,19 +86,19 @@ mh_getopt (int argc, char **argv, struct mh_option *mh_opt)
}
else if (!strcmp (mh_optptr+1, "help"))
{
mh_help (mh_opt);
mh_help (mh_opt, doc);
exit (1);
}
return '?';
}
void
mh_help (struct mh_option *mh_opt)
mh_help (struct mh_option *mh_opt, const char *doc)
{
struct mh_option *p;
printf ("Compatibility syntax:\n");
printf ("%s [+folder] [msgs] [switches]\n", program_invocation_short_name);
printf ("%s [switches] %s\n", program_invocation_short_name, doc);
printf (" switches are:\n");
for (p = mh_opt; p->opt; p++)
......@@ -120,4 +120,5 @@ mh_help (struct mh_option *mh_opt)
printf ("\n");
}
printf (" -help\n");
printf ("\nPlease use GNU long options instead. Run %s --help for more info on these.\n", program_invocation_short_name);
}
......
......@@ -15,11 +15,12 @@ struct mh_option
extern int mh_optind;
extern char *mh_optarg;
int mh_getopt (int argc, char **argv, struct mh_option *mh_opt);
int mh_argp_parse (int argc, char **argv,
struct argp_option *option,
struct mh_option *mh_option,
char *argp_doc, char *doc,
int (*handler)(), void *closure, int *index);
void mh_help (struct mh_option *mh_option);
void mh_license (const char *name);
int mh_getopt __P((int argc, char **argv, struct mh_option *mh_opt,
const char *doc));
int mh_argp_parse __P((int argc, char **argv,
struct argp_option *option,
struct mh_option *mh_option,
char *argp_doc, char *doc,
int (*handler)(), void *closure, int *index));
void mh_help __P((struct mh_option *mh_option, const char *doc));
void mh_license __P((const char *name));
......