Use stdout output by default
[babeltrace.git] / converter / babeltrace.c
index dd6b9a2c40c3f3079a8c920e336eaa16a112058f..c0c6541af5b41b6085593b5c09605460809b101b 100644 (file)
@@ -133,10 +133,6 @@ static int parse_options(int argc, char **argv)
                goto end;
        }
        opt_output_path = poptGetArg(pc);
-       if (!opt_output_path) {
-               ret = -EINVAL;
-               goto end;
-       }
 end:
        if (pc) {
                poptFreeContext(pc);
@@ -169,7 +165,8 @@ int main(int argc, char **argv)
        printf_verbose("Converting from file: %s\n", opt_input_path);
        printf_verbose("Converting from format: %s\n",
                opt_input_format ? : "<autodetect>");
-       printf_verbose("Converting to file: %s\n", opt_output_path);
+       printf_verbose("Converting to file: %s\n",
+               opt_output_path ? : "<stdout>");
        printf_verbose("Converting to format: %s\n",
                opt_output_format ? : "ctf");
 
@@ -200,6 +197,8 @@ int main(int argc, char **argv)
                goto error_td_read;
        }
 
+       if (!opt_output_path)
+               opt_output_path = "/dev/stdout";
        td_write = fmt_write->open_trace(opt_output_path, O_WRONLY);
        if (!td_write) {
                fprintf(stdout, "Error opening trace \"%s\" for writing.\n\n",
@@ -207,11 +206,18 @@ int main(int argc, char **argv)
                goto error_td_write;
        }
 
+       ret = convert_trace(td_write, td_read);
+       if (ret) {
+               fprintf(stdout, "Error printing trace.\n\n");
+               goto error_copy_trace;
+       }
+
        fmt_write->close_trace(td_write);
        fmt_read->close_trace(td_read);
        exit(EXIT_SUCCESS);
 
        /* Error handling */
+error_copy_trace:
        fmt_write->close_trace(td_write);
 error_td_write:
        fmt_read->close_trace(td_read);
This page took 0.024135 seconds and 4 git commands to generate.