From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id BDC986DE0173 for ; Wed, 30 Mar 2016 13:50:27 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.627 X-Spam-Level: X-Spam-Status: No, score=0.627 tagged_above=-999 required=5 tests=[AWL=-0.025, SPF_NEUTRAL=0.652] 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 zBk0bOeRv9CZ for ; Wed, 30 Mar 2016 13:50:19 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by arlo.cworth.org (Postfix) with ESMTP id 42AA96DE00DF for ; Wed, 30 Mar 2016 13:50:18 -0700 (PDT) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id ED6A81000CA; Wed, 30 Mar 2016 23:50:39 +0300 (EEST) From: Tomi Ollila To: David Bremner , notmuch@notmuchmail.org Subject: Re: [PATCH 1/2] CLI: add print_status_database In-Reply-To: <1459303814-31988-2-git-send-email-david@tethera.net> References: <1459303814-31988-1-git-send-email-david@tethera.net> <1459303814-31988-2-git-send-email-david@tethera.net> User-Agent: Notmuch/0.21+99~g7cbc880 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain 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: Wed, 30 Mar 2016 20:50:27 -0000 On Wed, Mar 30 2016, David Bremner wrote: > 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; LGTM (whole series). I was going to complain about the naming of 'print_status_database()' but David already got through (in 39c54df2) print_status_query() so that ship sailed already (perhaps that it happened is good :). > +} > -- > 2.8.0.rc3