fix bug whereby getopt_long allowed mismatch in last char of option name
This commit is contained in:
parent
45a3219944
commit
6f0259a4fc
1 changed files with 1 additions and 1 deletions
|
|
@ -14,7 +14,7 @@ static int __getopt_long(int argc, char *const *argv, const char *optstring, con
|
||||||
const char *name = longopts[i].name;
|
const char *name = longopts[i].name;
|
||||||
char *opt = argv[optind]+1;
|
char *opt = argv[optind]+1;
|
||||||
if (*opt == '-') opt++;
|
if (*opt == '-') opt++;
|
||||||
while (*name && *name++ == *opt++);
|
for (; *name && *name == *opt; name++, opt++);
|
||||||
if (*name || (*opt && *opt != '=')) continue;
|
if (*name || (*opt && *opt != '=')) continue;
|
||||||
if (*opt == '=') {
|
if (*opt == '=') {
|
||||||
if (!longopts[i].has_arg) continue;
|
if (!longopts[i].has_arg) continue;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue