summaryrefslogtreecommitdiffstats
path: root/fcomp.c
diff options
context:
space:
mode:
Diffstat (limited to 'fcomp.c')
-rw-r--r--fcomp.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/fcomp.c b/fcomp.c
index a41c75d..c10fc2e 100644
--- a/fcomp.c
+++ b/fcomp.c
@@ -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);