diff --git a/config.c b/config.c index a73ec45..80e3d99 100644 --- a/config.c +++ b/config.c @@ -448,7 +448,7 @@ static void show_usage(void) { puts("\t-D\t\tDebug"); puts(""); puts("\t-W\t\tWrite output file (recommended to use with -N)"); - puts("\t-f\t\tThe output filename (default: mptsd-output.ts)"); + puts("\t-f\t\tThe output filename (default: mptsd-output.ts) (use - for stdout)"); puts("\t-E\t\tWrite input file"); puts(""); } diff --git a/data.c b/data.c index 1bc748b..8d78e1c 100644 --- a/data.c +++ b/data.c @@ -303,7 +303,12 @@ OUTPUT *output_new() { } void output_open_file(char *filename, OUTPUT *o) { - int fd = open(filename, O_CREAT | O_WRONLY | O_TRUNC, 0660); + int fd = -1; + if (strcmp(filename, "-") == 0) { + fd = STDOUT_FILENO; + } else { + fd = open(filename, O_CREAT | O_WRONLY | O_TRUNC, 0660); + } if (fd == -1) { perror("Cannot open output file\n"); exit(1);