Re: database error
[notmuch-archives.git] / e9 / e61f8d7d154180b4713d27fdcfde5cf2a54c2a
1 Return-Path: <bremner@tethera.net>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5  by arlo.cworth.org (Postfix) with ESMTP id 167526DE18A0\r
6  for <notmuch@notmuchmail.org>; Sat, 12 Mar 2016 04:31:56 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.032\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.032 tagged_above=-999 required=5\r
12  tests=[AWL=-0.021, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01]\r
13  autolearn=disabled\r
14 Received: from arlo.cworth.org ([127.0.0.1])\r
15  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
16  with ESMTP id 7BqLjOD4JMKv for <notmuch@notmuchmail.org>;\r
17  Sat, 12 Mar 2016 04:31:54 -0800 (PST)\r
18 Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197])\r
19  by arlo.cworth.org (Postfix) with ESMTPS id 83D716DE18A4\r
20  for <notmuch@notmuchmail.org>; Sat, 12 Mar 2016 04:31:42 -0800 (PST)\r
21 Received: from remotemail by fethera.tethera.net with local (Exim 4.84)\r
22  (envelope-from <bremner@tethera.net>)\r
23  id 1aeiiR-0004zj-4w; Sat, 12 Mar 2016 07:32:19 -0500\r
24 Received: (nullmailer pid 17177 invoked by uid 1000);\r
25  Sat, 12 Mar 2016 12:31:33 -0000\r
26 From: David Bremner <david@tethera.net>\r
27 To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
28 Subject: [PATCH 3/6] CLI: add print_status_database\r
29 Date: Sat, 12 Mar 2016 08:31:27 -0400\r
30 Message-Id: <1457785890-17058-4-git-send-email-david@tethera.net>\r
31 X-Mailer: git-send-email 2.7.0\r
32 In-Reply-To: <1457785890-17058-1-git-send-email-david@tethera.net>\r
33 References: <1453561198-2893-1-git-send-email-david@tethera.net>\r
34  <1457785890-17058-1-git-send-email-david@tethera.net>\r
35 X-BeenThere: notmuch@notmuchmail.org\r
36 X-Mailman-Version: 2.1.20\r
37 Precedence: list\r
38 List-Id: "Use and development of the notmuch mail system."\r
39  <notmuch.notmuchmail.org>\r
40 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
41  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
42 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
43 List-Post: <mailto:notmuch@notmuchmail.org>\r
44 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
45 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
46  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
47 X-List-Received-Date: Sat, 12 Mar 2016 12:31:56 -0000\r
48 \r
49 This could probably be used at quite a few places in the existing code,\r
50 but in the immediate future I plan to use in some new code in\r
51 notmuch-dump\r
52 ---\r
53  notmuch-client.h |  5 +++++\r
54  status.c         | 17 +++++++++++++++++\r
55  2 files changed, 22 insertions(+)\r
56 \r
57 diff --git a/notmuch-client.h b/notmuch-client.h\r
58 index 18e6c60..b3d0b66 100644\r
59 --- a/notmuch-client.h\r
60 +++ b/notmuch-client.h\r
61 @@ -462,6 +462,11 @@ print_status_query (const char *loc,\r
62                     const notmuch_query_t *query,\r
63                     notmuch_status_t status);\r
64  \r
65 +notmuch_status_t\r
66 +print_status_database (const char *loc,\r
67 +                      const notmuch_database_t *database,\r
68 +                      notmuch_status_t status);\r
69 +\r
70  #include "command-line-arguments.h"\r
71  \r
72  extern char *notmuch_requested_db_uuid;\r
73 diff --git a/status.c b/status.c\r
74 index 8fa81cb..45d3fb4 100644\r
75 --- a/status.c\r
76 +++ b/status.c\r
77 @@ -19,3 +19,20 @@ print_status_query (const char *loc,\r
78      }\r
79      return status;\r
80  }\r
81 +\r
82 +notmuch_status_t\r
83 +print_status_database (const char *loc,\r
84 +                   const notmuch_database_t *notmuch,\r
85 +                   notmuch_status_t status)\r
86 +{\r
87 +    if (status) {\r
88 +       const char *msg;\r
89 +\r
90 +       fprintf (stderr, "%s: %s\n", loc,\r
91 +                notmuch_status_to_string (status));\r
92 +       msg = notmuch_database_status_string (notmuch);\r
93 +       if (msg)\r
94 +           fputs (msg, stderr);\r
95 +    }\r
96 +    return status;\r
97 +}\r
98 -- \r
99 2.7.0\r
100 \r