diff options
author | Thomas White <taw@physics.org> | 2010-10-15 17:29:39 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:03 +0100 |
commit | 29b4148c8f6435d680a8fdfd51d0cfd84a5aca12 (patch) | |
tree | 94ea21af14040c95403982a76df5e6027936df65 /src | |
parent | facc28d900aeb9c084908c3a21094ee792f78a80 (diff) |
indexamajig: Bodge round inability to rewind(stdin)
Diffstat (limited to 'src')
-rw-r--r-- | src/indexamajig.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/indexamajig.c b/src/indexamajig.c index a1a08150..d0260a8e 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -743,13 +743,21 @@ int main(int argc, char *argv[]) fflush(ofh); /* Get first filename and use it to set up the indexing */ - rval = fgets(prepare_line, 1023, fh); - if ( rval == NULL ) { - ERROR("Failed to get filename to prepare indexing.\n"); - return 1; + if ( fh != stdin ) { + rval = fgets(prepare_line, 1023, fh); + if ( rval == NULL ) { + ERROR("Failed to get filename to prepare indexing.\n"); + return 1; + } + chomp(prepare_line); + snprintf(prepare_filename, 1023, "%s%s", prefix, prepare_line); + rewind(fh); + } else { + STATUS("Reading input filenames from stdin, so can't (yet)"); + STATUS(" use the first file for preparing the indexing.\n"); + STATUS("Stuff might break.\n"); + prepare_filename[0] = '\0'; } - chomp(prepare_line); - snprintf(prepare_filename, 1023, "%s%s", prefix, prepare_line); ipriv = prepare_indexing(indm, cell, prepare_filename, det); if ( ipriv == NULL ) { ERROR("Failed to prepare indexing.\n"); |