--- /dev/null
+Return-Path: <bremner@tethera.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 167526DE18A0\r
+ for <notmuch@notmuchmail.org>; Sat, 12 Mar 2016 04:31:56 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.032\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.032 tagged_above=-999 required=5\r
+ tests=[AWL=-0.021, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01]\r
+ autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 7BqLjOD4JMKv for <notmuch@notmuchmail.org>;\r
+ Sat, 12 Mar 2016 04:31:54 -0800 (PST)\r
+Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 83D716DE18A4\r
+ for <notmuch@notmuchmail.org>; Sat, 12 Mar 2016 04:31:42 -0800 (PST)\r
+Received: from remotemail by fethera.tethera.net with local (Exim 4.84)\r
+ (envelope-from <bremner@tethera.net>)\r
+ id 1aeiiR-0004zj-4w; Sat, 12 Mar 2016 07:32:19 -0500\r
+Received: (nullmailer pid 17177 invoked by uid 1000);\r
+ Sat, 12 Mar 2016 12:31:33 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
+Subject: [PATCH 3/6] CLI: add print_status_database\r
+Date: Sat, 12 Mar 2016 08:31:27 -0400\r
+Message-Id: <1457785890-17058-4-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 2.7.0\r
+In-Reply-To: <1457785890-17058-1-git-send-email-david@tethera.net>\r
+References: <1453561198-2893-1-git-send-email-david@tethera.net>\r
+ <1457785890-17058-1-git-send-email-david@tethera.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 12 Mar 2016 12:31:56 -0000\r
+\r
+This could probably be used at quite a few places in the existing code,\r
+but in the immediate future I plan to use in some new code in\r
+notmuch-dump\r
+---\r
+ notmuch-client.h | 5 +++++\r
+ status.c | 17 +++++++++++++++++\r
+ 2 files changed, 22 insertions(+)\r
+\r
+diff --git a/notmuch-client.h b/notmuch-client.h\r
+index 18e6c60..b3d0b66 100644\r
+--- a/notmuch-client.h\r
++++ b/notmuch-client.h\r
+@@ -462,6 +462,11 @@ print_status_query (const char *loc,\r
+ const notmuch_query_t *query,\r
+ notmuch_status_t status);\r
+ \r
++notmuch_status_t\r
++print_status_database (const char *loc,\r
++ const notmuch_database_t *database,\r
++ notmuch_status_t status);\r
++\r
+ #include "command-line-arguments.h"\r
+ \r
+ extern char *notmuch_requested_db_uuid;\r
+diff --git a/status.c b/status.c\r
+index 8fa81cb..45d3fb4 100644\r
+--- a/status.c\r
++++ b/status.c\r
+@@ -19,3 +19,20 @@ print_status_query (const char *loc,\r
+ }\r
+ return status;\r
+ }\r
++\r
++notmuch_status_t\r
++print_status_database (const char *loc,\r
++ const notmuch_database_t *notmuch,\r
++ notmuch_status_t status)\r
++{\r
++ if (status) {\r
++ const char *msg;\r
++\r
++ fprintf (stderr, "%s: %s\n", loc,\r
++ notmuch_status_to_string (status));\r
++ msg = notmuch_database_status_string (notmuch);\r
++ if (msg)\r
++ fputs (msg, stderr);\r
++ }\r
++ return status;\r
++}\r
+-- \r
+2.7.0\r
+\r