Commit 480b4f66 480b4f66f97f7960b3c6ab9dad4963873f67186a by Sergey Poznyakoff

(mh_argp_parse): Increased number of arguments.

The last argument points to a location where to store the
ordinal number of the first non-option argument (can be NULL).

Call mh_init2() after parsing.
1 parent 36fe5b5f
...@@ -70,7 +70,7 @@ mh_argp_parse (int argc, char **argv, ...@@ -70,7 +70,7 @@ mh_argp_parse (int argc, char **argv,
70 struct argp_option *option, 70 struct argp_option *option,
71 struct mh_option *mh_option, 71 struct mh_option *mh_option,
72 char *argp_doc, char *doc, 72 char *argp_doc, char *doc,
73 int (*handler)(), void *closure) 73 int (*handler)(), void *closure, int *index)
74 { 74 {
75 struct argp argp; 75 struct argp argp;
76 struct mh_argp_data data; 76 struct mh_argp_data data;
...@@ -117,11 +117,12 @@ mh_argp_parse (int argc, char **argv, ...@@ -117,11 +117,12 @@ mh_argp_parse (int argc, char **argv,
117 for (; i < _argc; i++) 117 for (; i < _argc; i++)
118 _argv[i] = xargv[i-argc]; 118 _argv[i] = xargv[i-argc];
119 _argv[i] = NULL; 119 _argv[i] = NULL;
120 argp_parse (&argp, _argc, _argv, 0, 0, &data); 120 argp_parse (&argp, _argc, _argv, 0, index, &data);
121 free (_argv); 121 free (_argv);
122 } 122 }
123 else 123 else
124 argp_parse (&argp, argc, argv, 0, 0, &data); 124 argp_parse (&argp, argc, argv, 0, index, &data);
125 mh_init2 ();
125 return 0; 126 return 0;
126 } 127 }
127 128
......