X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=notmuch-count.c;h=97281374b22252059fcbf65ff28d426615b2a632;hb=23819e82d061502fce8d3876f3e606aa56ca6ea0;hp=493be30f07bb2d93d0beae2af01d7cee3b956c62;hpb=5ce8e0b11b40f733e6231d2067764e76717a341a;p=notmuch diff --git a/notmuch-count.c b/notmuch-count.c index 493be30f..97281374 100644 --- a/notmuch-count.c +++ b/notmuch-count.c @@ -87,8 +87,13 @@ print_count (notmuch_database_t *notmuch, const char *query_str, return -1; } - for (i = 0; i < exclude_tags_length; i++) - notmuch_query_add_tag_exclude (query, exclude_tags[i]); + for (i = 0; i < exclude_tags_length; i++) { + status = notmuch_query_add_tag_exclude (query, exclude_tags[i]); + if (status && status != NOTMUCH_STATUS_IGNORED) { + print_status_query ("notmuch count", query, status); + return -1; + } + } switch (output) { case OUTPUT_MESSAGES: @@ -98,7 +103,7 @@ print_count (notmuch_database_t *notmuch, const char *query_str, printf ("%u", ucount); break; case OUTPUT_THREADS: - status = notmuch_query_count_threads_st (query, &ucount); + status = notmuch_query_count_threads (query, &ucount); if (print_status_query ("notmuch count", query, status)) return -1; printf ("%u", ucount); @@ -106,7 +111,7 @@ print_count (notmuch_database_t *notmuch, const char *query_str, case OUTPUT_FILES: count = count_files (query); if (count >= 0) { - printf ("%u", count); + printf ("%d", count); } else { ret = -1; goto DONE; @@ -199,6 +204,8 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[]) if (batch && opt_index != argc) { fprintf (stderr, "--batch and query string are not compatible\n"); + if (input) + fclose (input); return EXIT_FAILURE; }