[Patch v2 08/13] CLI: add print_status_database
authorDavid Bremner <david@tethera.net>
Sat, 26 Mar 2016 17:57:18 +0000 (14:57 +2100)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:21:24 +0000 (16:21 -0700)
13/adceed786ac1e63152e847a9cd9d41d793984c [new file with mode: 0644]

diff --git a/13/adceed786ac1e63152e847a9cd9d41d793984c b/13/adceed786ac1e63152e847a9cd9d41d793984c
new file mode 100644 (file)
index 0000000..f93f8bd
--- /dev/null
@@ -0,0 +1,98 @@
+Return-Path: <bremner@tesseract.cs.unb.ca>\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 9E7916DE02D0\r
+ for <notmuch@notmuchmail.org>; Sat, 26 Mar 2016 11:23:56 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.02\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.02 tagged_above=-999 required=5 tests=[AWL=-0.021,\r
+  HEADER_FROM_DIFFERENT_DOMAINS=0.001] 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 4XoRpjCcZ7Bu for <notmuch@notmuchmail.org>;\r
+ Sat, 26 Mar 2016 11:23:49 -0700 (PDT)\r
+Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 52AB76DE026C\r
+ for <notmuch@notmuchmail.org>; Sat, 26 Mar 2016 11:23:23 -0700 (PDT)\r
+Received: from remotemail by fethera.tethera.net with local (Exim 4.84)\r
+ (envelope-from <bremner@tesseract.cs.unb.ca>)\r
+ id 1ajsTU-0000v3-Vp; Sat, 26 Mar 2016 13:58:13 -0400\r
+Received: (nullmailer pid 8818 invoked by uid 1000);\r
+ Sat, 26 Mar 2016 17:57:27 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [Patch v2 08/13] CLI: add print_status_database\r
+Date: Sat, 26 Mar 2016 14:57:18 -0300\r
+Message-Id: <1459015043-8460-9-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 2.6.4\r
+In-Reply-To: <1459015043-8460-1-git-send-email-david@tethera.net>\r
+References: <1459015043-8460-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, 26 Mar 2016 18:23: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.6.4\r
+\r