diff options
author | Keitaro Yamashita <k.yamashita@spring8.or.jp> | 2015-04-08 17:33:21 +0900 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2015-04-20 12:56:13 +0200 |
commit | 27732b9e60abfd0707015077e89413f1e2861b9b (patch) | |
tree | 817ab1a742c0ae5606c00ec1895ad41a424dc80a | |
parent | b91dbbe0052f17b44ba0b47befe46a4567906c33 (diff) |
open_stream_for_read: read stream from stdin when filename is "-".
-rw-r--r-- | libcrystfel/src/stream.c | 7 |
1 files changed, 6 insertions, 1 deletions
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; |