|
|
@ -238,12 +238,14 @@ optparse_long(struct optparse *options,
|
|
|
|
/* Parse as long option. */
|
|
|
|
/* Parse as long option. */
|
|
|
|
options->errmsg[0] = '\0';
|
|
|
|
options->errmsg[0] = '\0';
|
|
|
|
options->optopt = 0;
|
|
|
|
options->optopt = 0;
|
|
|
|
|
|
|
|
options->optlongname = 0;
|
|
|
|
options->optarg = 0;
|
|
|
|
options->optarg = 0;
|
|
|
|
option += 2; /* skip "--" */
|
|
|
|
option += 2; /* skip "--" */
|
|
|
|
options->optind++;
|
|
|
|
options->optind++;
|
|
|
|
for (int i = 0; !longopts_end(longopts, i); i++) {
|
|
|
|
for (int i = 0; !longopts_end(longopts, i); i++) {
|
|
|
|
const char *name = longopts[i].longname;
|
|
|
|
const char *name = longopts[i].longname;
|
|
|
|
if (longopts_match(name, option)) {
|
|
|
|
if (longopts_match(name, option)) {
|
|
|
|
|
|
|
|
options->optlongname = option;
|
|
|
|
if (longindex)
|
|
|
|
if (longindex)
|
|
|
|
*longindex = i;
|
|
|
|
*longindex = i;
|
|
|
|
options->optopt = longopts[i].shortname;
|
|
|
|
options->optopt = longopts[i].shortname;
|
|
|
|