Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 7FC31431FC3 for ; Thu, 6 Dec 2012 14:30:07 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 vs7260780s4X for ; Thu, 6 Dec 2012 14:30:06 -0800 (PST) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com [209.85.217.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 5266D431FB6 for ; Thu, 6 Dec 2012 14:30:06 -0800 (PST) Received: by mail-lb0-f181.google.com with SMTP id ge1so5963329lbb.26 for ; Thu, 06 Dec 2012 14:30:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :in-reply-to:references:x-gm-message-state; bh=E0nmYxZa4zj9OEgpzdGo0YLCcREbynpS29fF4iIyop0=; b=pq9zX7QsRsgLIOdq8h1hI4tXAOpWSNzX26rM+KSUFFqUVDlzLl5pqm91oxuFF8M1ho 3X2W/Q/eBLpoQD/MbQ4m99dBDj2HVhT9vDhIyE0vNvNYmPzT6zyWnVJPwrnGEBL2azHS AB85fnbWHuIRuy9xPYpB21wuwvjtC2S4EE8ZDCdZuvaaM6mwjk3Z3x/iV4D9OFSTRUO1 O3TIOK3a/yBwjtYgv6Ewnn33NVuPR+BhyMm/OvrrVkhk/2THY5BRkny3sjuVUSRcI5IV /kat3DqsAT0w3p4w/QH49ZO3rCi6i1iWud3ce4G2f9XKY2srB0mVbgGjArCYKdL5w6Uf 9+1w== Received: by 10.152.103.38 with SMTP id ft6mr3388055lab.40.1354833004855; Thu, 06 Dec 2012 14:30:04 -0800 (PST) Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi. [80.223.81.27]) by mx.google.com with ESMTPS id n7sm2533516lbg.3.2012.12.06.14.30.03 (version=SSLv3 cipher=OTHER); Thu, 06 Dec 2012 14:30:04 -0800 (PST) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH 2/2] cli: add --format=text0 to notmuch search Date: Fri, 7 Dec 2012 00:29:58 +0200 Message-Id: <89998d45f1f14d580c51511a545cf9e399061e1f.1354832980.git.jani@nikula.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <30f03a18ed10c221c13b6672f90654963c76452d.1354832980.git.jani@nikula.org> References: <30f03a18ed10c221c13b6672f90654963c76452d.1354832980.git.jani@nikula.org> In-Reply-To: <30f03a18ed10c221c13b6672f90654963c76452d.1354832980.git.jani@nikula.org> References: <30f03a18ed10c221c13b6672f90654963c76452d.1354832980.git.jani@nikula.org> X-Gm-Message-State: ALoCoQkblPzSlPfNnX3LGA1O28R7qNd3SRrfJo5Re79eiKJ1lri651xdY+lIGV7wTbFcLTyf7/g2 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: Thu, 06 Dec 2012 22:30:07 -0000 Add new format text0, which is otherwise the same as text, but use the null character as separator instead of the newline character. This is similar to find(1) -print0 option, and works together with the xargs(1) -0 option. --- notmuch-search.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/notmuch-search.c b/notmuch-search.c index 830c4e4..cd02b1d 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -305,8 +305,11 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) int exclude = EXCLUDE_TRUE; unsigned int i; - enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT } - format_sel = NOTMUCH_FORMAT_TEXT; + enum { + NOTMUCH_FORMAT_JSON, + NOTMUCH_FORMAT_TEXT, + NOTMUCH_FORMAT_TEXT0, + } format_sel = NOTMUCH_FORMAT_TEXT; notmuch_opt_desc_t options[] = { { NOTMUCH_OPT_KEYWORD, &sort, "sort", 's', @@ -316,6 +319,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) { NOTMUCH_OPT_KEYWORD, &format_sel, "format", 'f', (notmuch_keyword_t []){ { "json", NOTMUCH_FORMAT_JSON }, { "text", NOTMUCH_FORMAT_TEXT }, + { "text0", NOTMUCH_FORMAT_TEXT0 }, { 0, 0 } } }, { NOTMUCH_OPT_KEYWORD, &output, "output", 'o', (notmuch_keyword_t []){ { "summary", OUTPUT_SUMMARY }, @@ -344,6 +348,9 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) case NOTMUCH_FORMAT_TEXT: format = sprinter_text_create (ctx, stdout); break; + case NOTMUCH_FORMAT_TEXT0: + format = sprinter_text0_create (ctx, stdout); + break; case NOTMUCH_FORMAT_JSON: format = sprinter_json_create (ctx, stdout); break; -- 1.7.10.4