+ opt_output_format ? : "ctf");
+
+ if (!opt_input_format) {
+ fprintf(stdout, "Error: input format autodetection not implemented yet.\n\n");
+ usage(stdout);
+ exit(EXIT_FAILURE);
+ }
+ fmt_read = bt_lookup_format(g_quark_from_static_string(opt_input_format));
+ if (!fmt_read) {
+ fprintf(stdout, "Error: format \"%s\" is not supported.\n\n",
+ opt_input_format);
+ exit(EXIT_FAILURE);
+ }
+ if (!opt_output_format)
+ opt_output_format = "ctf";
+ fmt_write = bt_lookup_format(g_quark_from_static_string(opt_output_format));
+ if (!fmt_write) {
+ fprintf(stdout, "Error: format \"%s\" is not supported.\n\n",
+ opt_output_format);
+ exit(EXIT_FAILURE);
+ }
+
+ td_read = fmt_read->open_trace(opt_input_path, O_RDONLY);
+ if (!td_read) {
+ fprintf(stdout, "Error opening trace \"%s\" for reading.\n\n",
+ opt_input_path);
+ goto error_td_read;
+ }
+
+ td_write = fmt_write->open_trace(opt_output_path, O_WRONLY);
+ if (!td_write) {
+ fprintf(stdout, "Error opening trace \"%s\" for writing.\n\n",
+ opt_output_path);
+ goto error_td_write;
+ }
+
+ fmt_write->close_trace(td_write);
+ fmt_read->close_trace(td_read);
+ exit(EXIT_SUCCESS);