[PATCH v2 1/4] sprinter: add text0 formatter for null character separated text
authorJani Nikula <jani@nikula.org>
Sun, 9 Dec 2012 14:55:56 +0000 (16:55 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:51:54 +0000 (09:51 -0800)
de/4a2ca98d9d6812ab7c0a4a3ec6b8557bde3048 [new file with mode: 0644]

diff --git a/de/4a2ca98d9d6812ab7c0a4a3ec6b8557bde3048 b/de/4a2ca98d9d6812ab7c0a4a3ec6b8557bde3048
new file mode 100644 (file)
index 0000000..5946f8e
--- /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 037AD431FB6\r
+       for <notmuch@notmuchmail.org>; Sun,  9 Dec 2012 06:56:08 -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 IU2R33PpEXn7 for <notmuch@notmuchmail.org>;\r
+       Sun,  9 Dec 2012 06:56:07 -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 59C2B431FAE\r
+       for <notmuch@notmuchmail.org>; Sun,  9 Dec 2012 06:56:07 -0800 (PST)\r
+Received: by mail-la0-f53.google.com with SMTP id w12so1484159lag.26\r
+       for <notmuch@notmuchmail.org>; Sun, 09 Dec 2012 06:56:05 -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=oIyKI9+q1AfWdENA+zsqDHraydwElEClbKo9xqgXFaQ=;\r
+       b=QOpRz2qt4oWkMzost+x3YCR+ylKOAoCNwoelZyj6WCNcbSJcNdCE0rmjFKxF0oC0HP\r
+       POChpbr1l5M/gPbkn4kr8EZF72bhFkMAhEqQ9J+v3j7BbkOhVtUmNMV4NZEbLsH3JyOb\r
+       e3pI0I1zbVvs+gMGQueY99l/IgqfWwOzUjd01uu9sU+Jt0JRJpzR0y+JBxbT56T3tQFd\r
+       eN0AsCXLAqhLhCM2jZRsxuvuFWJZ2Y0c9qegQq2/cQ67PiqUCCoAZ4bjwlBa5Q/5Mk9n\r
+       h4pfo1v5zjjcIothJtmjVbhd95R5QaTpR7/B+l0StnGsSgHP7uP9g5FHW8Yj1TLW1MMS\r
+       1opQ==\r
+Received: by 10.112.31.194 with SMTP id c2mr4745686lbi.44.1355064965775;\r
+       Sun, 09 Dec 2012 06:56:05 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi.\r
+       [80.223.81.27])\r
+       by mx.google.com with ESMTPS id pz9sm6651897lab.11.2012.12.09.06.56.04\r
+       (version=SSLv3 cipher=OTHER); Sun, 09 Dec 2012 06:56:04 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 1/4] sprinter: add text0 formatter for null character\r
+       separated text\r
+Date: Sun,  9 Dec 2012 16:55:56 +0200\r
+Message-Id:\r
+ <33103d6a747093548d890816bd55314043396cbd.1355064714.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <cover.1355064714.git.jani@nikula.org>\r
+References: <cover.1355064714.git.jani@nikula.org>\r
+In-Reply-To: <cover.1355064714.git.jani@nikula.org>\r
+References: <cover.1355064714.git.jani@nikula.org>\r
+X-Gm-Message-State:\r
+ ALoCoQnu46/RuFFHCVAo8Y4aahYKhhIBz7RyPnyDlqhOW0aYzhLMUAih4n260AC1lZAxh5Cx8/6P\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, 09 Dec 2012 14:56:08 -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 59776a9..f36b999 100644\r
+--- a/sprinter.h\r
++++ b/sprinter.h\r
+@@ -66,6 +66,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