Consider the first equals sign found in the option to be the delimiter
between it and its argument, even if it matches an equals sign in the
option name. This avoids consuming the equals sign, which would prevent
finding the argument. Instead, it forces a partial match of the part of
the option name before the equals sign.
Maintainer's note: GNU getopt_long does not explicitly document this
behavior, but it can be seen as a consequence of how partial matches
are specified, and at least GNU (bfd) ld is known to make use of it.
const char *name = longopts[i].name;
opt = argv[optind]+1;
if (*opt == '-') opt++;
- for (; *name && *name == *opt; name++, opt++);
+ while (*opt && *opt != '=' && *opt == *name)
+ name++, opt++;
if (*opt && *opt != '=') continue;
arg = opt;
match = i;