diff -dur boost_1_43_0.orig/libs/program_options/src/options_description.cpp boost_1_43_0/libs/program_options/src/options_description.cpp --- boost_1_43_0.orig/libs/program_options/src/options_description.cpp 2010-01-08 22:00:57.000000000 +0100 +++ boost_1_43_0/libs/program_options/src/options_description.cpp 2010-06-22 14:28:56.115538359 +0200 @@ -305,7 +305,8 @@ bool long_ignore_case, bool short_ignore_case) const { - shared_ptr found; + shared_ptr found_approx; + shared_ptr found_full; vector approximate_matches; vector full_matches; @@ -323,15 +324,15 @@ if (r == option_description::full_match) { full_matches.push_back(m_options[i]->key(name)); + found_full = m_options[i]; } else { // FIXME: the use of 'key' here might not // be the best approach. approximate_matches.push_back(m_options[i]->key(name)); + found_approx = m_options[i]; } - - found = m_options[i]; } if (full_matches.size() > 1) boost::throw_exception( @@ -346,7 +347,9 @@ boost::throw_exception( ambiguous_option(name, approximate_matches)); - return found.get(); + if (!full_matches.empty()) + return found_full.get(); + return found_approx.get(); } BOOST_PROGRAM_OPTIONS_DECL