X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;ds=sidebyside;f=notmuch-count.c;h=f752ef6254c72aebde7c0ff73eb6730a49f2661c;hb=fd6f8e6c30e0443d1ead248047ab572120df85e9;hp=1ae7d5146d9244f8b85f7618367cab0acd1397dc;hpb=0f314c0c99befea599a68bea51d759b4133efef6;p=notmuch diff --git a/notmuch-count.c b/notmuch-count.c index 1ae7d514..f752ef62 100644 --- a/notmuch-count.c +++ b/notmuch-count.c @@ -27,12 +27,6 @@ enum { OUTPUT_FILES, }; -/* The following is to allow future options to be added more easily */ -enum { - EXCLUDE_true, - EXCLUDE_false, -}; - /* Return the number of files matching the query, or -1 for an error */ static int count_files (notmuch_query_t *query) @@ -154,13 +148,13 @@ count_file (notmuch_database_t *notmuch, FILE *input, const char **exclude_tags, } int -notmuch_count_command (notmuch_config_t *config, int argc, char *argv[]) +notmuch_count_command (notmuch_config_t *config, unused(notmuch_database_t *notmuch), int argc, char *argv[]) { notmuch_database_t *notmuch; char *query_str; int opt_index; int output = OUTPUT_MESSAGES; - int exclude = EXCLUDE_true; + bool exclude = true; const char **search_exclude_tags = NULL; size_t search_exclude_tags_length = 0; bool batch = false; @@ -171,14 +165,11 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[]) notmuch_opt_desc_t options[] = { { .opt_keyword = &output, .name = "output", .keywords = - (notmuch_keyword_t []){ { "threads", OUTPUT_THREADS }, - { "messages", OUTPUT_MESSAGES }, - { "files", OUTPUT_FILES }, - { 0, 0 } } }, - { .opt_keyword = &exclude, .name = "exclude", .keywords = - (notmuch_keyword_t []){ { "true", EXCLUDE_true }, - { "false", EXCLUDE_false }, - { 0, 0 } } }, + (notmuch_keyword_t []){ { "threads", OUTPUT_THREADS }, + { "messages", OUTPUT_MESSAGES }, + { "files", OUTPUT_FILES }, + { 0, 0 } } }, + { .opt_bool = &exclude, .name = "exclude" }, { .opt_bool = &print_lastmod, .name = "lastmod" }, { .opt_bool = &batch, .name = "batch" }, { .opt_string = &input_file_name, .name = "input" }, @@ -221,9 +212,9 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[]) return EXIT_FAILURE; } - if (exclude == EXCLUDE_true) { + if (exclude) { search_exclude_tags = notmuch_config_get_search_exclude_tags - (config, &search_exclude_tags_length); + (config, &search_exclude_tags_length); } if (batch)