From 58b2d5c7e69b9d9287f350fb55bda1bfaf920413 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Wed, 23 Mar 2016 07:54:49 +2100 Subject: [PATCH] [PATCH 08/13] CLI: add print_status_database --- 23/0c27e773a8519da6623ee6c7ee5e0b0d1f8147 | 99 +++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 23/0c27e773a8519da6623ee6c7ee5e0b0d1f8147 diff --git a/23/0c27e773a8519da6623ee6c7ee5e0b0d1f8147 b/23/0c27e773a8519da6623ee6c7ee5e0b0d1f8147 new file mode 100644 index 000000000..07c899a53 --- /dev/null +++ b/23/0c27e773a8519da6623ee6c7ee5e0b0d1f8147 @@ -0,0 +1,99 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 811A46DE02B7 + for ; Tue, 22 Mar 2016 03:57:11 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.029 +X-Spam-Level: +X-Spam-Status: No, score=-0.029 tagged_above=-999 required=5 + tests=[AWL=-0.018, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] + autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id QerLwCrZy6qN for ; + Tue, 22 Mar 2016 03:57:03 -0700 (PDT) +Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) + by arlo.cworth.org (Postfix) with ESMTPS id 195D06DE02CC + for ; Tue, 22 Mar 2016 03:55:28 -0700 (PDT) +Received: from remotemail by fethera.tethera.net with local (Exim 4.84) + (envelope-from ) + id 1aiJyl-00016o-K5; Tue, 22 Mar 2016 06:56:03 -0400 +Received: (nullmailer pid 14083 invoked by uid 1000); + Tue, 22 Mar 2016 10:55:11 -0000 +From: David Bremner +To: notmuch@notmuchmail.org +Subject: [PATCH 08/13] CLI: add print_status_database +Date: Tue, 22 Mar 2016 07:54:49 -0300 +Message-Id: <1458644094-13951-9-git-send-email-david@tethera.net> +X-Mailer: git-send-email 2.7.0 +In-Reply-To: <1458644094-13951-1-git-send-email-david@tethera.net> +References: <1458644094-13951-1-git-send-email-david@tethera.net> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Tue, 22 Mar 2016 10:57:11 -0000 + +This could probably be used at quite a few places in the existing code, +but in the immediate future I plan to use in some new code in +notmuch-dump +--- + notmuch-client.h | 5 +++++ + status.c | 17 +++++++++++++++++ + 2 files changed, 22 insertions(+) + +diff --git a/notmuch-client.h b/notmuch-client.h +index 18e6c60..b3d0b66 100644 +--- a/notmuch-client.h ++++ b/notmuch-client.h +@@ -462,6 +462,11 @@ print_status_query (const char *loc, + const notmuch_query_t *query, + notmuch_status_t status); + ++notmuch_status_t ++print_status_database (const char *loc, ++ const notmuch_database_t *database, ++ notmuch_status_t status); ++ + #include "command-line-arguments.h" + + extern char *notmuch_requested_db_uuid; +diff --git a/status.c b/status.c +index 8fa81cb..45d3fb4 100644 +--- a/status.c ++++ b/status.c +@@ -19,3 +19,20 @@ print_status_query (const char *loc, + } + return status; + } ++ ++notmuch_status_t ++print_status_database (const char *loc, ++ const notmuch_database_t *notmuch, ++ notmuch_status_t status) ++{ ++ if (status) { ++ const char *msg; ++ ++ fprintf (stderr, "%s: %s\n", loc, ++ notmuch_status_to_string (status)); ++ msg = notmuch_database_status_string (notmuch); ++ if (msg) ++ fputs (msg, stderr); ++ } ++ return status; ++} +-- +2.7.0 + -- 2.26.2