1 Return-Path: <bremner@tesseract.cs.unb.ca>
\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 CE02A6DE1502
\r
6 for <notmuch@notmuchmail.org>; Sun, 7 Jun 2015 08:05:21 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=0.219 tagged_above=-999 required=5 tests=[AWL=0.209,
\r
12 T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled
\r
13 Received: from arlo.cworth.org ([127.0.0.1])
\r
14 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id PPh9UVjqxtFE for <notmuch@notmuchmail.org>;
\r
16 Sun, 7 Jun 2015 08:05:20 -0700 (PDT)
\r
17 Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net
\r
19 by arlo.cworth.org (Postfix) with ESMTPS id 154076DE119C
\r
20 for <notmuch@notmuchmail.org>; Sun, 7 Jun 2015 08:05:20 -0700 (PDT)
\r
21 Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim
\r
22 4.80) (envelope-from <bremner@tesseract.cs.unb.ca>)
\r
23 id 1Z1c7q-0004pb-Eu; Sun, 07 Jun 2015 15:04:38 +0000
\r
24 Received: (nullmailer pid 7864 invoked by uid 1000); Sun, 07 Jun 2015
\r
26 From: David Bremner <david@tethera.net>
\r
27 To: notmuch@notmuchmail.org
\r
28 Subject: [PATCH 08/10] cli: add utility routine to print error status.
\r
29 Date: Sun, 7 Jun 2015 17:02:01 +0200
\r
30 Message-Id: <1433689323-7520-9-git-send-email-david@tethera.net>
\r
31 X-Mailer: git-send-email 2.1.4
\r
32 In-Reply-To: <1433689323-7520-1-git-send-email-david@tethera.net>
\r
33 References: <1433689323-7520-1-git-send-email-david@tethera.net>
\r
34 X-BeenThere: notmuch@notmuchmail.org
\r
35 X-Mailman-Version: 2.1.18
\r
37 List-Id: "Use and development of the notmuch mail system."
\r
38 <notmuch.notmuchmail.org>
\r
39 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
40 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
41 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
42 List-Post: <mailto:notmuch@notmuchmail.org>
\r
43 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
44 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
46 X-List-Received-Date: Sun, 07 Jun 2015 15:05:21 -0000
\r
48 No attention to formatting here, initially just focus on getting the
\r
49 relevant strings out of the library.
\r
51 Makefile.local | 1 +
\r
52 notmuch-client.h | 9 +++++++++
\r
53 status.c | 21 +++++++++++++++++++++
\r
54 3 files changed, 31 insertions(+)
\r
55 create mode 100644 status.c
\r
57 diff --git a/Makefile.local b/Makefile.local
\r
58 index 6d54742..4de39b8 100644
\r
59 --- a/Makefile.local
\r
60 +++ b/Makefile.local
\r
61 @@ -271,6 +271,7 @@ dataclean: distclean
\r
62 notmuch_client_srcs = \
\r
63 command-line-arguments.c\
\r
66 gmime-filter-reply.c \
\r
69 diff --git a/notmuch-client.h b/notmuch-client.h
\r
70 index 78680aa..0f52038 100644
\r
71 --- a/notmuch-client.h
\r
72 +++ b/notmuch-client.h
\r
73 @@ -465,6 +465,15 @@ notmuch_database_dump (notmuch_database_t *notmuch,
\r
74 dump_format_t output_format,
\r
75 notmuch_bool_t gzip_output);
\r
77 +/* If status is non-zero (i.e. error) print appropriate
\r
78 + messages to stderr.
\r
82 +print_status_query (const char *loc,
\r
83 + const notmuch_query_t *query,
\r
84 + notmuch_status_t status);
\r
86 #include "command-line-arguments.h"
\r
87 extern const notmuch_opt_desc_t notmuch_shared_options [];
\r
88 void notmuch_process_shared_options (const char* subcommand_name);
\r
89 diff --git a/status.c b/status.c
\r
90 new file mode 100644
\r
91 index 0000000..8fa81cb
\r
95 +#include "notmuch-client.h"
\r
98 +print_status_query (const char *loc,
\r
99 + const notmuch_query_t *query,
\r
100 + notmuch_status_t status)
\r
104 + notmuch_database_t *notmuch;
\r
106 + fprintf (stderr, "%s: %s\n", loc,
\r
107 + notmuch_status_to_string (status));
\r
109 + notmuch = notmuch_query_get_database (query);
\r
110 + msg = notmuch_database_status_string (notmuch);
\r
112 + fputs (msg, stderr);
\r