autfilt: print match count even on parse errors

* bin/autfilt.cc: If -c is used, print the match_count even
in present of parse errors.
* tests/core/readsave.test: Adjust.
* NEWS: Mention the bug.
This commit is contained in:
Alexandre Duret-Lutz 2022-12-02 15:22:32 +01:00
parent a032abf0c5
commit 29037c1f55
3 changed files with 17 additions and 11 deletions

View file

@ -1763,15 +1763,17 @@ main(int argc, char** argv)
post.set_level(level);
autfilt_processor processor(post, o.dict);
if (processor.run())
return 2;
// Diagnose unused -x options
extra_options.report_unused_options();
int err = processor.run();
if (automaton_format == Count)
std::cout << match_count << std::endl;
// Diagnose unused -x options
if (!err)
extra_options.report_unused_options();
else
return 2;
check_cout();
return match_count ? 0 : 1;
});