From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 23A9C429E54 for ; Mon, 10 Oct 2011 06:50:06 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.3 X-Spam-Level: X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GiHAtv-xuVXc for ; Mon, 10 Oct 2011 06:50:04 -0700 (PDT) Received: from tempo.its.unb.ca (tempo.its.unb.ca [131.202.1.21]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 0D3E4429E42 for ; Mon, 10 Oct 2011 06:49:58 -0700 (PDT) Received: from zancas.localnet (fctnnbsc36w-156034064058.pppoe-dynamic.High-Speed.nb.bellaliant.net [156.34.64.58]) (authenticated bits=0) by tempo.its.unb.ca (8.13.8/8.13.8) with ESMTP id p9ADnt1l010829 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Mon, 10 Oct 2011 10:49:56 -0300 Received: from bremner by zancas.localnet with local (Exim 4.76) (envelope-from ) id 1RDGEq-0006ft-A9; Mon, 10 Oct 2011 10:49:52 -0300 From: david@tethera.net To: notmuch@notmuchmail.org Subject: [PATCH 4/6] notmuch-dump: treat any remaining arguments after the filename as search terms Date: Mon, 10 Oct 2011 10:49:19 -0300 Message-Id: <1318254561-25386-5-git-send-email-david@tethera.net> X-Mailer: git-send-email 1.7.6.3 In-Reply-To: <1318254561-25386-1-git-send-email-david@tethera.net> References: <8739f2qhla.fsf@zancas.localnet> <1318254561-25386-1-git-send-email-david@tethera.net> Cc: David Bremner X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 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: Mon, 10 Oct 2011 13:50:06 -0000 From: David Bremner The main motivation here is allow the fast dumping of tag data for messages having certain tags. In practice it seems too slow to pipe dump to grep. --- notmuch-dump.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/notmuch-dump.c b/notmuch-dump.c index 610144e..ac5d074 100644 --- a/notmuch-dump.c +++ b/notmuch-dump.c @@ -30,6 +30,7 @@ notmuch_dump_command (unused (void *ctx), int argc, char *argv[]) notmuch_messages_t *messages; notmuch_message_t *message; notmuch_tags_t *tags; + const char* query_str = ""; config = notmuch_config_open (ctx, NULL, NULL); if (config == NULL) @@ -56,7 +57,15 @@ notmuch_dump_command (unused (void *ctx), int argc, char *argv[]) argv++; } - query = notmuch_query_create (notmuch, ""); + if (argc) { + query_str = query_string_from_args (notmuch, argc, argv); + if (query_str == NULL) { + fprintf (stderr, "Out of memory.\n"); + return 1; + } + } + + query = notmuch_query_create (notmuch, query_str); if (query == NULL) { fprintf (stderr, "Out of memory\n"); return 1; -- 1.7.6.3