From 27732b9e60abfd0707015077e89413f1e2861b9b Mon Sep 17 00:00:00 2001 From: Keitaro Yamashita Date: Wed, 8 Apr 2015 17:33:21 +0900 Subject: open_stream_for_read: read stream from stdin when filename is "-". --- libcrystfel/src/stream.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c index 91b1fb9e..8586c850 100644 --- a/libcrystfel/src/stream.c +++ b/libcrystfel/src/stream.c @@ -1264,7 +1264,12 @@ Stream *open_stream_for_read(const char *filename) st = malloc(sizeof(struct _stream)); if ( st == NULL ) return NULL; - st->fh = fopen(filename, "r"); + if ( strcmp(filename, "-") == 0 ) { + st->fh = stdin; + } else { + st->fh = fopen(filename, "r"); + } + if ( st->fh == NULL ) { free(st); return NULL; -- cgit v1.2.3