[PATCH 1/2] sprinter: add text0 formatter for null character separated text
authorJani Nikula <jani@nikula.org>
Thu, 6 Dec 2012 22:29:57 +0000 (00:29 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:51:37 +0000 (09:51 -0800)
d7/81be28dd558f54be0644de225db8bc6d5683bf [new file with mode: 0644]

diff --git a/d7/81be28dd558f54be0644de225db8bc6d5683bf b/d7/81be28dd558f54be0644de225db8bc6d5683bf
new file mode 100644 (file)
index 0000000..1f24087
--- /dev/null
@@ -0,0 +1,127 @@
+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 601A3431FB6\r
+       for <notmuch@notmuchmail.org>; Thu,  6 Dec 2012 14:30:05 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\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 yQxdTGsctFB8 for <notmuch@notmuchmail.org>;\r
+       Thu,  6 Dec 2012 14:30:05 -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 A9FCF431FAE\r
+       for <notmuch@notmuchmail.org>; Thu,  6 Dec 2012 14:30:04 -0800 (PST)\r
+Received: by mail-la0-f53.google.com with SMTP id w12so5835867lag.26\r
+       for <notmuch@notmuchmail.org>; Thu, 06 Dec 2012 14:30:03 -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:x-gm-message-state;\r
+       bh=ivJzNGYJ+2ho34b0H5sBN4Tn7tXpK1wyuttWWWDbJ3k=;\r
+       b=CImAD2A5NSKaCtZRXWf3Qte4ZfckUqiPjWh6/obZ6pFsT5klCyEr/A1g+k1U+CuSnv\r
+       74C0aywwunK7WiqMcFpCztYnj/03Plqrs6HSTFpgl/RfyN83gFVqjsrHKTUmNVvT444N\r
+       n0t5QNJt/eqhEsm7z49UUXG5nKuBXzeLX5cRkVokSi4NP2u7vqzTPvoRGe3Ndj715f0d\r
+       ZcNo/X+ZGf5E7V2K8TzGn6ZxSpWI9ZE3JCTN5sEE08Pm2ii3eE/HwAxml6YOZ9uCaKU3\r
+       oYljtgjJEzx3Yg9+vhkMGBRzHCQohptpGyZ05cAAikqvsudgN8vnRptl451rYtPZBW5i\r
+       PTHA==\r
+Received: by 10.152.105.68 with SMTP id gk4mr3375775lab.48.1354833001821;\r
+       Thu, 06 Dec 2012 14:30:01 -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 pw17sm3924175lab.5.2012.12.06.14.29.59\r
+       (version=SSLv3 cipher=OTHER); Thu, 06 Dec 2012 14:30:00 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/2] sprinter: add text0 formatter for null character\r
+       separated text\r
+Date: Fri,  7 Dec 2012 00:29:57 +0200\r
+Message-Id:\r
+ <30f03a18ed10c221c13b6672f90654963c76452d.1354832980.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.10.4\r
+X-Gm-Message-State:\r
+ ALoCoQmQpnigYXJ2Vi5ev3kCONReBwMqdJUl0XWI6qCzRXnFh7JE6hNOJ8aLKP7Dos4Cco6Ia3af\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: Thu, 06 Dec 2012 22:30:05 -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 912a526..74e7fec 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