Commit 90accacc 90accacc7194a29e6851412065d2c4ce9b9396cb by Sergey Poznyakoff

(struct mh_argp_data): New member `doc'. Keeps the

documentation string.
(parse_opt): Pass the data->doc member to mh_getopt.
(mh_argp_parse): Initialize data.doc.
1 parent 57c7eddd
...@@ -31,6 +31,7 @@ struct mh_argp_data ...@@ -31,6 +31,7 @@ struct mh_argp_data
31 struct mh_option *mh_option; 31 struct mh_option *mh_option;
32 int (*handler)(); 32 int (*handler)();
33 void *closure; 33 void *closure;
34 char *doc;
34 }; 35 };
35 36
36 static error_t 37 static error_t
...@@ -40,7 +41,8 @@ parse_opt (int key, char *arg, struct argp_state *state) ...@@ -40,7 +41,8 @@ parse_opt (int key, char *arg, struct argp_state *state)
40 switch (key) 41 switch (key)
41 { 42 {
42 case ARGP_KEY_INIT: 43 case ARGP_KEY_INIT:
43 while ((key = mh_getopt (state->argc, state->argv, data->mh_option)) 44 while ((key = mh_getopt (state->argc, state->argv, data->mh_option,
45 data->doc))
44 != EOF 46 != EOF
45 && key != '?') 47 && key != '?')
46 { 48 {
...@@ -93,6 +95,7 @@ mh_argp_parse (int argc, char **argv, ...@@ -93,6 +95,7 @@ mh_argp_parse (int argc, char **argv,
93 data.mh_option = mh_option; 95 data.mh_option = mh_option;
94 data.closure = closure; 96 data.closure = closure;
95 data.handler = handler; 97 data.handler = handler;
98 data.doc = argp_doc;
96 99
97 p = mh_profile_value (program_invocation_short_name, NULL); 100 p = mh_profile_value (program_invocation_short_name, NULL);
98 if (p) 101 if (p)
......