From 98597e034a33471c25946db11e8b25e8091b25a6 Mon Sep 17 00:00:00 2001 From: Christoph Niethammer Date: Fri, 6 Dec 2024 22:05:20 +0100 Subject: [PATCH] Fix option parser's long option handling Long option names were only compared to known options based on the length of the option name given in the arguments, resulting in strange matches, e.g., '--step' was matching '--steps'. Signed-off-by: Christoph Niethammer --- src/utils/OptionParser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/OptionParser.cpp b/src/utils/OptionParser.cpp index de5d01c144..72ae9273d2 100644 --- a/src/utils/OptionParser.cpp +++ b/src/utils/OptionParser.cpp @@ -216,7 +216,7 @@ const Option& OptionParser::lookup_long_opt(const std::string& opt) const { std::list matching; for (optMap::const_iterator it = _optmap_l.begin(); it != _optmap_l.end(); ++it) { - if (it->first.compare(0, opt.length(), opt) == 0) + if (it->first == opt) matching.push_back(it->first); } if (matching.size() > 1) {