]> git.notmuchmail.org Git - notmuch/blobdiff - sprinter-text.c
cli: add --format=text0 to notmuch search
[notmuch] / sprinter-text.c
index 10343be4b4f1dafe514afa25281586631b376a89..7779488f99a3db4c7919e93210e86acccf9c8949 100644 (file)
@@ -67,6 +67,14 @@ text_separator (struct sprinter *sp)
     fputc ('\n', sptxt->stream);
 }
 
+static void
+text0_separator (struct sprinter *sp)
+{
+    struct sprinter_text *sptxt = (struct sprinter_text *) sp;
+
+    fputc ('\0', sptxt->stream);
+}
+
 static void
 text_set_prefix (struct sprinter *sp, const char *prefix)
 {
@@ -133,3 +141,17 @@ sprinter_text_create (const void *ctx, FILE *stream)
     res->stream = stream;
     return &res->vtable;
 }
+
+struct sprinter *
+sprinter_text0_create (const void *ctx, FILE *stream)
+{
+    struct sprinter *sp;
+
+    sp = sprinter_text_create (ctx, stream);
+    if (! sp)
+       return NULL;
+
+    sp->separator = text0_separator;
+
+    return sp;
+}