Commit 3951d0a4 authored by Martin Storsjo's avatar Martin Storsjo

Allow opening stdin when "-" is specified

parent e7348e7a
...@@ -68,7 +68,10 @@ void* wav_read_open(const char *filename) { ...@@ -68,7 +68,10 @@ void* wav_read_open(const char *filename) {
long data_pos = 0; long data_pos = 0;
memset(wr, 0, sizeof(*wr)); memset(wr, 0, sizeof(*wr));
wr->wav = fopen(filename, "rb"); if (!strcmp(filename, "-"))
wr->wav = stdin;
else
wr->wav = fopen(filename, "rb");
if (wr->wav == NULL) { if (wr->wav == NULL) {
free(wr); free(wr);
return NULL; return NULL;
...@@ -136,7 +139,8 @@ void* wav_read_open(const char *filename) { ...@@ -136,7 +139,8 @@ void* wav_read_open(const char *filename) {
void wav_read_close(void* obj) { void wav_read_close(void* obj) {
struct wav_reader* wr = (struct wav_reader*) obj; struct wav_reader* wr = (struct wav_reader*) obj;
fclose(wr->wav); if (wr->wav != stdin)
fclose(wr->wav);
free(wr); free(wr);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment