diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2017-02-16 21:38:40 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2017-02-17 08:14:10 +0200 |
commit | 43fb1f13a88924654da3d45bbb820a7206a69d55 (patch) | |
tree | b0c145b920982498ced5e2943d3bb73a037b17bd /libmailutils/tests/Makefile.am | |
parent | 0f97d2e1e02a9365e4e20aa3e9f6e4781b8f57c0 (diff) | |
download | mailutils-43fb1f13a88924654da3d45bbb820a7206a69d55.tar.gz mailutils-43fb1f13a88924654da3d45bbb820a7206a69d55.tar.bz2 |
Fix handling of ambiguous command line options.
The approach used so far failed to recognize ambiguous abbreviations
located in different groups. It also didn't work when
MU_PARSEOPT_NO_SORT was requested. This commit fixes it by keeping
an additional array of indices to long options. The array is sorted
so that its elements produce a lexicographically ascending list of
long options.
* include/mailutils/opt.h (mu_parseopt): New members po_longcnt,
po_longidx keep a sorted array of indices to po_optv with long
options.
* libmailutils/opt/opt.c (find_long_option): Iterate over po_longidx.
(parseopt_init): Initialize and sort po_longidx.
(mu_parseopt_free): Free po_longidx.
* libmailutils/tests/parseopt.c: Add three more potentially
ambiguous options
* libmailutils/tests/parseopt26.at: New testcase.
* libmailutils/tests/parseopt27.at: New testcase.
* libmailutils/tests/Makefile.am: Add new testcases.
* libmailutils/tests/testsuite.at: Likewise.
Diffstat (limited to 'libmailutils/tests/Makefile.am')
-rw-r--r-- | libmailutils/tests/Makefile.am | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libmailutils/tests/Makefile.am b/libmailutils/tests/Makefile.am index 4c6b2f3e5..c534684da 100644 --- a/libmailutils/tests/Makefile.am +++ b/libmailutils/tests/Makefile.am @@ -138,6 +138,8 @@ TESTSUITE_AT = \ parseopt23.at\ parseopt24.at\ parseopt25.at\ + parseopt26.at\ + parseopt27.at\ parseopt_help00.at\ parseopt_help01.at\ parseopt_help02.at\ |