+ if (input_format == DUMP_FORMAT_AUTO)
+ input_format = DUMP_FORMAT_BATCH_TAG;
+
+ if (input_format == DUMP_FORMAT_SUP)
+ if ( xregcomp (®ex,
+ "^([^ ]+) \\(([^)]*)\\)$",
+ REG_EXTENDED) )
+ INTERNAL_ERROR ("compile time constant regex failed.");
+
+ do {
+ char *query_string;
+
+ if (line_ctx != NULL)
+ talloc_free (line_ctx);
+
+ line_ctx = talloc_new (ctx);
+ if (input_format == DUMP_FORMAT_SUP) {
+ ret = parse_sup_line (line_ctx, line, &query_string, tag_ops);
+ } else {
+ ret = parse_tag_line (line_ctx, line, TAG_FLAG_BE_GENEROUS,
+ &query_string, tag_ops);
+
+ if (ret == 0) {
+ if (strncmp ("id:", query_string, 3) != 0) {
+ fprintf (stderr, "Warning: unsupported query: %s\n", query_string);
+ continue;
+ }
+ /* delete id: from front of string; tag_message
+ * expects a raw message-id.
+ *
+ * XXX: Note that query string id:foo and bar will be
+ * interpreted as a message id "foo and bar". This
+ * should eventually be fixed to give a better error
+ * message.
+ */
+ query_string = query_string + 3;
+ }
+ }
+
+ if (ret > 0)
+ continue;
+
+ if (ret < 0)
+ break;
+
+ ret = tag_message (line_ctx, notmuch, query_string,
+ tag_ops, flags);
+ if (ret)
+ break;
+
+ } while ((line_len = getline (&line, &line_size, input)) != -1);
+
+ if (line_ctx != NULL)
+ talloc_free (line_ctx);
+
+ if (input_format == DUMP_FORMAT_SUP)
+ regfree (®ex);