--- ray/src/util/rtcontrib.c 2005/06/14 02:50:23 1.22 +++ ray/src/util/rtcontrib.c 2005/06/17 16:07:18 1.24 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rtcontrib.c,v 1.22 2005/06/14 02:50:23 greg Exp $"; +static const char RCSid[] = "$Id: rtcontrib.c,v 1.24 2005/06/17 16:07:18 greg Exp $"; #endif /* * Gather rtrace output to compute contributions from particular sources @@ -315,11 +315,11 @@ main(int argc, char *argv[]) error(USER, "missing octree argument"); rtargv[rtargc++] = octree = argv[i]; rtargv[rtargc] = NULL; - /* start rtrace & compute contributions */ + /* start rtrace */ init(nprocs); if (recover) /* perform recovery if requested */ recover_output(stdin); - trace_contribs(stdin); + trace_contribs(stdin); /* compute contributions */ quit(0); } @@ -1030,8 +1030,13 @@ recover_output(FILE *fin) error(USER, "cannot recover from command"); /* open output */ fp = fopen(oname, "rb+"); - if (fp == NULL) - break; /* must be end of modifier */ + if (fp == NULL) { + if (j) + break; /* assume end of modifier */ + sprintf(errmsg, "missing recover file '%s'", + oname); + error(USER, errmsg); + } nvals = lseek(fileno(fp), 0, SEEK_END); if (nvals <= 0) { lastout = 0; /* empty output, quit here */ @@ -1085,6 +1090,11 @@ recover_output(FILE *fin) if (lastout < 0) { error(WARNING, "no output files to recover"); return; + } + if (raysleft && lastout >= raysleft) { + error(WARNING, "output appears to be complete"); + /* XXX should read & discard input? */ + quit(0); } /* seek on all files */ nvals = lastout * outvsiz;