--- esound-0.2.41.old/esdfilt.c +++ esound-0.2.41/esdfilt.c @@ -8,6 +8,8 @@ #include #include +static int is_stdout = 0; + int main(int argc, char **argv) { octet buf[ESD_BUF_SIZE]; @@ -53,7 +55,19 @@ twice = 1; printf( "doubling data\n" ); } else { - target = fopen( argv[arg], "w" ); + char *tfname = argv [arg]; + + if ((strcmp (tfname, "-" ) == 0) || + (strcmp (tfname, "stdout") == 0)) + { + is_stdout = 1; + target = stdout; + } + else + { + target = fopen (tfname, "w"); + } + if (!target) { printf("%s: couldn't write to '%s'\n", argv[0], argv[arg]); } @@ -105,8 +119,12 @@ return 1; write( sock, buf, length ); - printf( "\rtotal bytes streamed: %d", total ); - fflush( stdout ); + if (!is_stdout) + { + printf ("\rtotal bytes streamed: %d", total); + fflush (stdout); + } + total += length; } close( sock );