segmatch: Allow candidate output threshold to be set by flag

Signed-off-by: Rick Altherr <kc8apf@kc8apf.net>
Signed-off-by: Tim 'mithro' Ansell <mithro@mithis.com>
This commit is contained in:
Rick Altherr 2017-11-14 19:05:04 -08:00 committed by Tim 'mithro' Ansell
parent 0f68a516bb
commit edc665d6df
1 changed files with 12 additions and 2 deletions

View File

@ -152,9 +152,10 @@ int main(int argc, char **argv)
{
const char *outfile = nullptr;
int min_each = 0, min_total = 0;
int candidate_output_limit = 4;
int opt;
while ((opt = getopt(argc, argv, "io:m:M:")) != -1)
while ((opt = getopt(argc, argv, "c:io:m:M:")) != -1)
switch (opt)
{
case 'o':
@ -169,6 +170,9 @@ int main(int argc, char **argv)
case 'i':
mode_inv = true;
break;
case 'c':
candidate_output_limit = atoi(optarg);
break;
default:
goto help;
}
@ -190,6 +194,10 @@ help:
fprintf(stderr, " -i\n");
fprintf(stderr, " add inverted tags\n");
fprintf(stderr, "\n");
fprintf(stderr, " -c <int>\n");
fprintf(stderr, " threshold under which candidates are output\n");
fprintf(stderr, " set to -1 to output all\n");
fprintf(stderr, "\n");
return 1;
}
@ -294,7 +302,9 @@ help:
cnt_candidates += 1;
}
if (0 < num_candidates && num_candidates <= 4) {
if (candidate_output_limit < 0 ||
(0 < num_candidates &&
num_candidates <= candidate_output_limit)) {
std::vector<std::string> out_tags;
for (int bit_idx = 0; bit_idx < num_bits; bit_idx++)
if (mask.at(bit_idx))