goto DONE;
}
- GZPRINTF (output, " %s\n", buffer);
+ GZPUTS (output, " ");
+ GZPUTS (output, buffer);
+ GZPUTS (output, "\n");
}
ret = EXIT_SUCCESS;
NOTMUCH_DUMP_VERSION);
if (include & DUMP_INCLUDE_CONFIG) {
- gzputs (output, "config");
+ GZPUTS (output, "config");
sep = ",";
}
if (include & DUMP_INCLUDE_PROPERTIES) {
if (include & DUMP_INCLUDE_TAGS) {
GZPRINTF (output, "%stags", sep);
}
- gzputs (output, "\n");
+ GZPUTS (output, "\n");
}
static int
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) {
}
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)) {
if (! query_str)
query_str = "";
- query = notmuch_query_create (notmuch, query_str);
- if (query == NULL) {
- fprintf (stderr, "Out of memory\n");
+ status = notmuch_query_create_with_syntax (notmuch, query_str,
+ shared_option_query_syntax (),
+ &query);
+ if (print_status_database ("notmuch dump", notmuch, status))
return EXIT_FAILURE;
- }
+
/* Don't ask xapian to sort by Message-ID. Xapian optimizes returning the
* first results quickly at the expense of total time.
*/
output = NULL;
goto DONE;
} else
- output = NULL;
+ output = NULL;
if (output_file_name) {
ret = rename (tempname, output_file_name);
}
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, ¬much))
- return EXIT_FAILURE;
-
- notmuch_exit_if_unmatched_db_uuid (notmuch);
-
const char *output_file_name = NULL;
int opt_index;
if (opt_index < 0)
return EXIT_FAILURE;
- notmuch_process_shared_options (argv[0]);
+ notmuch_process_shared_options (notmuch, argv[0]);
if (include == 0)
include = DUMP_INCLUDE_CONFIG | DUMP_INCLUDE_TAGS | DUMP_INCLUDE_PROPERTIES;