aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-08-18 13:49:26 +0200
committerThomas White <taw@physics.org>2012-02-22 15:26:55 +0100
commit13310cf31ef3aa731ab76fc3f7880a6da085e50e (patch)
tree88d9bc10d59282b22e5ee57fb81818c2ca3237a5
parent3bfd8f444202eb427debdd3f218aa31fa0a35590 (diff)
indexamajig: Don't ignore first item (can't rewind() stdin...)
-rw-r--r--src/indexamajig.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/indexamajig.c b/src/indexamajig.c
index d6b0d982..91abc9e1 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -647,7 +647,6 @@ int main(int argc, char *argv[])
ERROR("Failed to prepare indexing.\n");
return 1;
}
- rewind(fh);
gsl_set_error_handler_off();
n_images = 0;
@@ -669,8 +668,13 @@ int main(int argc, char *argv[])
pargs = worker_args[i];
- rval = fgets(line, 1023, fh);
- if ( rval == NULL ) continue;
+ if ( strlen(prepare_line) > 0 ) {
+ strcpy(line, prepare_line);
+ prepare_line[0] = '\0';
+ } else {
+ rval = fgets(line, 1023, fh);
+ if ( rval == NULL ) continue;
+ }
chomp(line);
snprintf(pargs->filename, 1023, "%s%s", prefix, line);