Commit c1fe0c1c authored by Thomas White's avatar Thomas White
Browse files

facetron: Can't handle stdin

parent 4a235243
......@@ -37,8 +37,8 @@ static void show_help(const char *s)
"\n"
" -h, --help Display this help message.\n"
"\n"
" -i, --input=<filename> Specify the name of the input stream.\n"
" Can be '-' for stdin.\n"
" -i, --input=<filename> Specify the name of the input 'stream'.\n"
" (must be a file, not e.g. stdin)\n"
" -g. --geometry=<file> Get detector geometry from file.\n"
" -x, --prefix=<p> Prefix filenames from input file with <p>.\n"
" --basename Remove the directory parts of the filenames.\n"
......@@ -195,16 +195,12 @@ int main(int argc, char *argv[])
}
if ( infile == NULL ) infile = strdup("-");
if ( strcmp(infile, "-") == 0 ) {
fh = stdin;
} else {
fh = fopen(infile, "r");
}
free(infile);
fh = fopen(infile, "r");
if ( fh == NULL ) {
ERROR("Couldn't open input stream '%s'\n", infile);
return ENOENT;
}
free(infile);
if ( prefix == NULL ) {
prefix = strdup("");
......
Supports Markdown
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