X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=notmuch-count.c;h=0d700a9e12f8205fbe92f3309cb162dd7cc15d95;hb=968965635197a6646688c0edd759f0c4f74181cb;hp=77aa4338db27e2b3cdfceaff43e2233d3788bdd7;hpb=53f8cc565126db4a003dbfc02850d2bf3b260636;p=notmuch diff --git a/notmuch-count.c b/notmuch-count.c index 77aa4338..0d700a9e 100644 --- a/notmuch-count.c +++ b/notmuch-count.c @@ -35,6 +35,8 @@ notmuch_count_command (void *ctx, int argc, char *argv[]) notmuch_sort_t sort = NOTMUCH_SORT_NEWEST_FIRST; #endif + argc--; argv++; /* skip subcommand argument */ + for (i = 0; i < argc && argv[i][0] == '-'; i++) { if (strcmp (argv[i], "--") == 0) { i++; @@ -90,9 +92,9 @@ notmuch_count_command (void *ctx, int argc, char *argv[]) fprintf (stderr, "Out of memory.\n"); return 1; } + if (*query_str == '\0') { - fprintf (stderr, "Error: notmuch count requires at least one count term.\n"); - return 1; + query_str = talloc_strdup (ctx, ""); } query = notmuch_query_create (notmuch, query_str);