| 173 |
|
char *binval = NULL; |
| 174 |
|
char fmt[8]; |
| 175 |
|
int i, j; |
| 176 |
+ |
/* need at least one argument */ |
| 177 |
+ |
if (argc < 2) { |
| 178 |
+ |
fprintf(stderr, |
| 179 |
+ |
"Usage: %s [-n nprocs][-r][-e expr][-f source][-o ospec][-b binv] {-m mod | -M file} [rtrace options] octree\n", |
| 180 |
+ |
argv[0]); |
| 181 |
+ |
exit(1); |
| 182 |
+ |
} |
| 183 |
|
/* global program name */ |
| 184 |
|
gargv = argv; |
| 185 |
|
/* initialize calcomp routines */ |
| 322 |
|
error(USER, "missing octree argument"); |
| 323 |
|
rtargv[rtargc++] = octree = argv[i]; |
| 324 |
|
rtargv[rtargc] = NULL; |
| 325 |
< |
/* start rtrace & compute contributions */ |
| 325 |
> |
/* start rtrace */ |
| 326 |
|
init(nprocs); |
| 327 |
|
if (recover) /* perform recovery if requested */ |
| 328 |
|
recover_output(stdin); |
| 329 |
< |
trace_contribs(stdin); |
| 329 |
> |
trace_contribs(stdin); /* compute contributions */ |
| 330 |
|
quit(0); |
| 331 |
|
} |
| 332 |
|
|
| 333 |
+ |
#ifndef SIGALRM |
| 334 |
+ |
#define SIGALRM SIGTERM |
| 335 |
+ |
#endif |
| 336 |
|
/* kill persistent rtrace process */ |
| 337 |
|
static void |
| 338 |
|
killpersist(void) |
| 339 |
|
{ |
| 340 |
|
FILE *fp = fopen(persistfn, "r"); |
| 341 |
< |
int pid; |
| 341 |
> |
RT_PID pid; |
| 342 |
|
|
| 343 |
|
if (fp == NULL) |
| 344 |
|
return; |
| 1040 |
|
error(USER, "cannot recover from command"); |
| 1041 |
|
/* open output */ |
| 1042 |
|
fp = fopen(oname, "rb+"); |
| 1043 |
< |
if (fp == NULL) |
| 1044 |
< |
break; /* must be end of modifier */ |
| 1043 |
> |
if (fp == NULL) { |
| 1044 |
> |
if (j) |
| 1045 |
> |
break; /* assume end of modifier */ |
| 1046 |
> |
sprintf(errmsg, "missing recover file '%s'", |
| 1047 |
> |
oname); |
| 1048 |
> |
error(USER, errmsg); |
| 1049 |
> |
} |
| 1050 |
|
nvals = lseek(fileno(fp), 0, SEEK_END); |
| 1051 |
|
if (nvals <= 0) { |
| 1052 |
|
lastout = 0; /* empty output, quit here */ |
| 1100 |
|
if (lastout < 0) { |
| 1101 |
|
error(WARNING, "no output files to recover"); |
| 1102 |
|
return; |
| 1103 |
+ |
} |
| 1104 |
+ |
if (raysleft && lastout >= raysleft) { |
| 1105 |
+ |
error(WARNING, "output appears to be complete"); |
| 1106 |
+ |
/* XXX should read & discard input? */ |
| 1107 |
+ |
quit(0); |
| 1108 |
|
} |
| 1109 |
|
/* seek on all files */ |
| 1110 |
|
nvals = lastout * outvsiz; |