diff options
author | Rich Felker <dalias@aerifal.cx> | 2018-04-27 11:22:39 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2018-04-27 11:22:39 -0400 |
commit | 9be4ed5d89ecca80123311a4ec73781e5cc97a9c (patch) | |
tree | 440b01aea13be8434868832507474ec6979954c7 /README | |
parent | b4b1e10364c8737a632be61582e05a8d3acf5690 (diff) | |
download | musl-9be4ed5d89ecca80123311a4ec73781e5cc97a9c.tar.gz |
getopt_long_only: don't prefix-match long-options that match short ones
for getopt_long, partial (prefix) matches of long options always begin
with "--" and thus can never be ambiguous with a short option. for
getopt_long_only, though, a single-character option can match both a
short option and as a prefix for a long option. in this case, we
wrongly interpreted it as a prefix for the long option.
introduce a new pass, only in long-only mode, to check the prefix
match against short options before accepting it. the only reason
there's a slightly nontrivial loop being introduced rather than strchr
is that our getopt already supports multibyte short options, and
getopt_long_long should handle them consistently. a temp buffer and
strstr could have been used, but the code to set it up would be just
as large as what's introduced here and it would unnecessarily pull in
relatively large code for strstr.
Diffstat (limited to 'README')
0 files changed, 0 insertions, 0 deletions