* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
count_files (notmuch_query_t *query)
{
notmuch_messages_t *messages;
notmuch_message_t *message;
notmuch_filenames_t *filenames;
count_files (notmuch_query_t *query)
{
notmuch_messages_t *messages;
notmuch_message_t *message;
notmuch_filenames_t *filenames;
- messages = notmuch_query_search_messages (query);
- if (messages == NULL)
- return 0;
+ status = notmuch_query_search_messages (query, &messages);
+ if (print_status_query ("notmuch count", query, status))
+ return -1;
static int
print_count (notmuch_database_t *notmuch, const char *query_str,
const char **exclude_tags, size_t exclude_tags_length, int output, int print_lastmod)
{
notmuch_query_t *query;
size_t i;
static int
print_count (notmuch_database_t *notmuch, const char *query_str,
const char **exclude_tags, size_t exclude_tags_length, int output, int print_lastmod)
{
notmuch_query_t *query;
size_t i;
query = notmuch_query_create (notmuch, query_str);
if (query == NULL) {
fprintf (stderr, "Out of memory\n");
query = notmuch_query_create (notmuch, query_str);
if (query == NULL) {
fprintf (stderr, "Out of memory\n");
- printf ("%u", notmuch_query_count_messages (query));
+ status = notmuch_query_count_messages_st (query, &ucount);
+ if (print_status_query ("notmuch count", query, status))
+ return -1;
+ printf ("%u", ucount);
- printf ("%u", notmuch_query_count_threads (query));
+ status = notmuch_query_count_threads_st (query, &ucount);
+ if (print_status_query ("notmuch count", query, status))
+ return -1;
+ printf ("%u", ucount);
chomp_newline (line);
ret = print_count (notmuch, line, exclude_tags, exclude_tags_length,
output, print_lastmod);
chomp_newline (line);
ret = print_count (notmuch, line, exclude_tags, exclude_tags_length,
output, print_lastmod);