]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch-dump.c
reply: add test for multiple Delivered-To headers
[notmuch] / notmuch-dump.c
index 6c5c1433dbde7ebb5a3c96f154fac9755fa295a7..ae89e4da80ccbf90f53109539115a81b45410eb9 100644 (file)
@@ -51,7 +51,9 @@ database_dump_config (notmuch_database_t *notmuch, gzFile output)
            goto DONE;
        }
 
-       GZPRINTF (output, " %s\n", buffer);
+       GZPUTS (output, " ");
+       GZPUTS (output, buffer);
+       GZPUTS (output, "\n");
     }
 
     ret = EXIT_SUCCESS;
@@ -76,7 +78,7 @@ print_dump_header (gzFile output, int output_format, int include)
              NOTMUCH_DUMP_VERSION);
 
     if (include & DUMP_INCLUDE_CONFIG) {
-       gzputs (output, "config");
+       GZPUTS (output, "config");
        sep = ",";
     }
     if (include & DUMP_INCLUDE_PROPERTIES) {
@@ -86,7 +88,7 @@ print_dump_header (gzFile output, int output_format, int include)
     if (include & DUMP_INCLUDE_TAGS) {
        GZPRINTF (output, "%stags", sep);
     }
-    gzputs (output, "\n");
+    GZPUTS (output, "\n");
 }
 
 static int
@@ -174,12 +176,12 @@ dump_tags_message (void *ctx,
        const char *tag_str = notmuch_tags_get (tags);
 
        if (! first)
-           gzputs (output, " ");
+           GZPUTS (output, " ");
 
        first = 0;
 
        if (output_format == DUMP_FORMAT_SUP) {
-           gzputs (output, tag_str);
+           GZPUTS (output, tag_str);
        } else {
            if (hex_encode (ctx, tag_str,
                            buffer_p, size_p) != HEX_SUCCESS) {
@@ -192,7 +194,7 @@ dump_tags_message (void *ctx,
     }
 
     if (output_format == DUMP_FORMAT_SUP) {
-       gzputs (output, ")\n");
+       GZPUTS (output, ")\n");
     } else {
        if (make_boolean_term (ctx, "id", message_id,
                               buffer_p, size_p)) {
@@ -337,7 +339,7 @@ notmuch_database_dump (notmuch_database_t *notmuch,
        output = NULL;
        goto DONE;
     } else
-        output = NULL;
+       output = NULL;
 
     if (output_file_name) {
        ret = rename (tempname, output_file_name);
@@ -359,16 +361,11 @@ notmuch_database_dump (notmuch_database_t *notmuch,
 }
 
 int
-notmuch_dump_command (notmuch_config_t *config, int argc, char *argv[])
+notmuch_dump_command (notmuch_database_t *notmuch, int argc, char *argv[])
 {
-    notmuch_database_t *notmuch;
     const char *query_str = NULL;
     int ret;
 
-    if (notmuch_database_open (notmuch_config_get_database_path (config),
-                              NOTMUCH_DATABASE_MODE_READ_WRITE, &notmuch))
-       return EXIT_FAILURE;
-
     notmuch_exit_if_unmatched_db_uuid (notmuch);
 
     const char *output_file_name = NULL;