diff --git a/test/test.c b/test/test.c index b21da28e..e8080e3a 100644 --- a/test/test.c +++ b/test/test.c @@ -18,6 +18,7 @@ void usage(const char * name) { "\t-f fade time: fade time (seconds), default 10.0\n" "\t-i: ignore looping information and play the whole stream once\n" "\t-p: output to stdout (for piping into another program)\n" + "\t-P: output to stdout even if stdout is a terminal\n" "\t-c: loop forever (continuously)\n" "\t-m: print metadata only, don't decode\n" "\t-x: decode and print adxencd command line to encode as ADX\n" @@ -40,13 +41,14 @@ int main(int argc, char ** argv) { int force_loop = 0; int really_force_loop = 0; int play = 0; + int play_wreckless = 0; int forever = 0; int metaonly = 0; int adxencd = 0; double loop_count = 2.0; double fade_time = 10.0; - while ((opt = getopt(argc, argv, "o:l:f:ipcmxeE")) != -1) { + while ((opt = getopt(argc, argv, "o:l:f:ipPcmxeE")) != -1) { switch (opt) { case 'o': outfilename = optarg; @@ -63,6 +65,10 @@ int main(int argc, char ** argv) { case 'p': play = 1; break; + case 'P': + play_wreckless = 1; + play = 1; + break; case 'c': forever = 1; break; @@ -95,6 +101,11 @@ int main(int argc, char ** argv) { return 1; } + if (play && (!play_wreckless &&isatty(STDOUT_FILENO))) { + fprintf(stderr,"Are you sure you want to output wave data to the terminal?\nIf so use -P instead of -p.\n"); + return 1; + } + if (ignore_loop && force_loop) { fprintf(stderr,"-e and -i are incompatible\n"); return 1;