diff options
Diffstat (limited to 'fcomp.c')
-rw-r--r-- | fcomp.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -131,8 +131,10 @@ static void print_help(char *argv0) "~~~~~~~~~~~"); fprintf(stderr, "%8s %4s %15s %50s\n\n", "-h", "", "help", "Print this help message"); - fprintf(stderr, "%8s %4s %15s %50s\n", "query", "[..]", "", + fprintf(stderr, "%8s %4s %15s %50s\n", "query", "", "", "The term to be matched agains the tokens"); + fprintf(stderr, "%8s %4s %15s %50s\n", "-q", "[..]", "query", + "Same"); fprintf(stderr, "%8s %4s %15s %50s\n", "-f", "[..]", "file", "Select the input file to use"); fprintf(stderr, "%8s %4s %15s %50s\n", "stdin", "[..]", "", @@ -223,7 +225,7 @@ static int parse_cli(int argc, char *argv[]) if (argc < 2) return -1; char c; - while ((c = getopt(argc, argv, "-hIF:xzsaudclrf:i:v:w:t:")) != -1) { + while ((c = getopt(argc, argv, "-hIxzsaudclrq:F:f:i:v:w:t:")) != -1) { switch (c) { case 'I': if (cfg.interactive) { @@ -285,6 +287,7 @@ static int parse_cli(int argc, char *argv[]) cfg.reverse_sort = 1; break; case '\1': + case 'q': cfg.query = optarg; break; case '?': @@ -817,9 +820,11 @@ int main(int argc, char *argv[]) } if (listp) { - get_uniq(listp, &count_res); - pc(&count_res); - cfree(&count_res); + if (listp->n != 0) { + get_uniq(listp, &count_res); + pc(&count_res); + cfree(&count_res); + } if (listp == &ref_list) free(ref_list.s); |