[PATCH v4 2/5] sprinter: add text0 formatter for null character separated text
authorJani Nikula <jani@nikula.org>
Sun, 16 Dec 2012 22:05:10 +0000 (00:05 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:52:27 +0000 (09:52 -0800)
09/219ad96d68ad7ab28d468f55d6fbe8c703b953 [new file with mode: 0644]

diff --git a/09/219ad96d68ad7ab28d468f55d6fbe8c703b953 b/09/219ad96d68ad7ab28d468f55d6fbe8c703b953
new file mode 100644 (file)
index 0000000..0ead96a
--- /dev/null
@@ -0,0 +1,133 @@
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id C436C429E36\r
+       for <notmuch@notmuchmail.org>; Sun, 16 Dec 2012 14:05:27 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id bU1uiAhtmCJ1 for <notmuch@notmuchmail.org>;\r
+       Sun, 16 Dec 2012 14:05:26 -0800 (PST)\r
+Received: from mail-la0-f53.google.com (mail-la0-f53.google.com\r
+       [209.85.215.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 8FC33431FD2\r
+       for <notmuch@notmuchmail.org>; Sun, 16 Dec 2012 14:05:25 -0800 (PST)\r
+Received: by mail-la0-f53.google.com with SMTP id w12so4065400lag.26\r
+       for <notmuch@notmuchmail.org>; Sun, 16 Dec 2012 14:05:24 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=google.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references\r
+       :in-reply-to:references:x-gm-message-state;\r
+       bh=yB+hA6dX1WwjVFKH/ANzufa8mVAszdN9OyGxjSv9O74=;\r
+       b=ahWY9uhxaAm4Eh2w8EEyudOafhn1ZOSnmnn/wbUpq9CUytaTntTtXuVJefpFxang1p\r
+       fzeGai4uA9B51y02xlGdh9HucTKD4tsXvPcOBPDqcnnXUjfuqRq/6nXs5Ut76Opjpk95\r
+       nRNJACyz3wmqKTGMh6mZ1sBCbeBj5/M9VNJmw1l4XgUhdTBi1xxjanGIY2f/q3wFoqFx\r
+       XQLuDQCiOyFsqMOxlSQqsnrLFQ4JVJaxExtabfRjMhu6EDHI666GY8r+pJy2uNQw2eLY\r
+       eSKtKdd+/hPtjevSD0Cq2MCW+jRCNu1BKjDi1BkL4QQsD+3njjynJjEIEtISQKGjF0Sy\r
+       UlBA==\r
+Received: by 10.112.43.161 with SMTP id x1mr5107336lbl.32.1355695522635;\r
+       Sun, 16 Dec 2012 14:05:22 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw4-50df51-27.dhcp.inet.fi.\r
+       [80.223.81.27])\r
+       by mx.google.com with ESMTPS id sj3sm4118235lab.2.2012.12.16.14.05.20\r
+       (version=SSLv3 cipher=OTHER); Sun, 16 Dec 2012 14:05:21 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v4 2/5] sprinter: add text0 formatter for null character\r
+       separated text\r
+Date: Mon, 17 Dec 2012 00:05:10 +0200\r
+Message-Id:\r
+ <67652be343e8eec1934c57aaf0809f7a658866f5.1355695036.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <cover.1355695036.git.jani@nikula.org>\r
+References: <cover.1355695036.git.jani@nikula.org>\r
+In-Reply-To: <cover.1355695036.git.jani@nikula.org>\r
+References: <cover.1355695036.git.jani@nikula.org>\r
+X-Gm-Message-State:\r
+ ALoCoQlprmwhmqDeHISA9aZCfh8eRwLQ0eKUcNS9PosRMUg+wgc2VAxgi8nb/6rMDIoRgiuvY/aK\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 16 Dec 2012 22:05:28 -0000\r
+\r
+Same as the text formatter, but with each field separated by a null\r
+character rather than a newline character.\r
+---\r
+ sprinter-text.c |   22 ++++++++++++++++++++++\r
+ sprinter.h      |    6 ++++++\r
+ 2 files changed, 28 insertions(+)\r
+\r
+diff --git a/sprinter-text.c b/sprinter-text.c\r
+index 10343be..7779488 100644\r
+--- a/sprinter-text.c\r
++++ b/sprinter-text.c\r
+@@ -68,6 +68,14 @@ text_separator (struct sprinter *sp)\r
+ }\r
\r
+ static void\r
++text0_separator (struct sprinter *sp)\r
++{\r
++    struct sprinter_text *sptxt = (struct sprinter_text *) sp;\r
++\r
++    fputc ('\0', sptxt->stream);\r
++}\r
++\r
++static void\r
+ text_set_prefix (struct sprinter *sp, const char *prefix)\r
+ {\r
+     struct sprinter_text *sptxt = (struct sprinter_text *) sp;\r
+@@ -133,3 +141,17 @@ sprinter_text_create (const void *ctx, FILE *stream)\r
+     res->stream = stream;\r
+     return &res->vtable;\r
+ }\r
++\r
++struct sprinter *\r
++sprinter_text0_create (const void *ctx, FILE *stream)\r
++{\r
++    struct sprinter *sp;\r
++\r
++    sp = sprinter_text_create (ctx, stream);\r
++    if (! sp)\r
++      return NULL;\r
++\r
++    sp->separator = text0_separator;\r
++\r
++    return sp;\r
++}\r
+diff --git a/sprinter.h b/sprinter.h\r
+index f43a844..f859672 100644\r
+--- a/sprinter.h\r
++++ b/sprinter.h\r
+@@ -67,6 +67,12 @@ typedef struct sprinter {\r
+ struct sprinter *\r
+ sprinter_text_create (const void *ctx, FILE *stream);\r
\r
++/* Create a new unstructured printer that emits the text format for\r
++ * "notmuch search", with each field separated by a null character\r
++ * instead of the newline character. */\r
++struct sprinter *\r
++sprinter_text0_create (const void *ctx, FILE *stream);\r
++\r
+ /* Create a new structure printer that emits JSON. */\r
+ struct sprinter *\r
+ sprinter_json_create (const void *ctx, FILE *stream);\r
+-- \r
+1.7.10.4\r
+\r