51 |
|
HDGRID hdg; |
52 |
|
int i; |
53 |
|
int force = 0; |
54 |
< |
|
54 |
> |
/* mark start time */ |
55 |
> |
starttime = time(NULL); |
56 |
|
progname = argv[0]; /* get arguments */ |
57 |
|
for (i = 1; i < argc && argv[i][0] == '-'; i++) |
58 |
|
switch (argv[i][1]) { |
103 |
|
"holodeck file exists -- use -f to overwrite"); |
104 |
|
/* create holodeck */ |
105 |
|
creatholo(&hdg); |
106 |
< |
} else /* else load holodeck */ |
106 |
> |
} else { /* else load holodeck */ |
107 |
|
loadholo(); |
108 |
+ |
if (vdef(RIF)) /* load RIF if any */ |
109 |
+ |
getradfile(vval(RIF)); |
110 |
+ |
} |
111 |
|
/* initialize */ |
112 |
|
initrholo(); |
113 |
|
/* run */ |
132 |
|
open_display(outdev); |
133 |
|
else if (ncprocs > 0) /* else use global ray feed */ |
134 |
|
init_global(); |
135 |
< |
/* record the time */ |
132 |
< |
starttime = time(NULL); |
135 |
> |
/* record end time */ |
136 |
|
if (!vdef(TIME) || vflt(TIME) <= FTINY) |
137 |
|
endtime = 0; |
138 |
|
else |
198 |
|
hdfiluse(hdlist[0]->fd, 0) + hdmemuse(0) >= l) |
199 |
|
return(0); |
200 |
|
/* check time */ |
201 |
< |
if (endtime > 0 || vdef(REPORT)) |
201 |
> |
if (endtime > 0 || reporttime > 0) |
202 |
|
t = time(NULL); |
203 |
|
if (endtime > 0 && t >= endtime) |
204 |
|
return(0); |
205 |
< |
if (vdef(REPORT) && t >= reporttime) |
205 |
> |
if (reporttime > 0 && t >= reporttime) |
206 |
|
report(t); |
207 |
|
/* get packets to process */ |
208 |
|
while (freepacks != NULL) { |
233 |
|
fprintf(stderr, "%s: %ld packets (%ld rays) done after %.2f hours\n", |
234 |
|
progname, npacksdone, nraysdone, (t-starttime)/3600.); |
235 |
|
fflush(stderr); |
236 |
< |
reporttime = t + (time_t)(vflt(REPORT)*60.); |
236 |
> |
if (vdef(REPORT)) |
237 |
> |
reporttime = t + (time_t)(vflt(REPORT)*60.+.5); |
238 |
|
} |
239 |
|
|
240 |
|
|
419 |
|
static char tf1[] = TEMPLATE; |
420 |
|
char tf2[64]; |
421 |
|
char combuf[256]; |
422 |
+ |
char *pippt; |
423 |
|
register int i; |
424 |
|
register char *cp; |
425 |
|
/* create rad command */ |
429 |
|
"rad -v 0 -s -e -w %s OPTFILE=%s | egrep '^[ \t]*(NOMATCH", |
430 |
|
rfargs, tf1); |
431 |
|
cp = combuf; |
432 |
< |
while (*cp) cp++; /* match unset variables */ |
432 |
> |
while (*cp){ |
433 |
> |
if (*cp == '|') pippt = cp; |
434 |
> |
cp++; |
435 |
> |
} /* match unset variables */ |
436 |
|
for (i = 0; mvar[i] >= 0; i++) |
437 |
|
if (!vdef(mvar[i])) { |
438 |
|
*cp++ = '|'; |
439 |
|
strcpy(cp, vnam(mvar[i])); |
440 |
|
while (*cp) cp++; |
441 |
+ |
pippt = NULL; |
442 |
|
} |
443 |
< |
sprintf(cp, ")[ \t]*=' > %s", tf2); |
443 |
> |
if (pippt != NULL) |
444 |
> |
strcpy(pippt, "> /dev/null"); /* nothing to match */ |
445 |
> |
else |
446 |
> |
sprintf(cp, ")[ \t]*=' > %s", tf2); |
447 |
|
if (system(combuf)) { |
448 |
|
error(SYSTEM, "cannot execute rad command"); |
449 |
|
unlink(tf2); /* clean up */ |
450 |
|
unlink(tf1); |
451 |
|
quit(1); |
452 |
|
} |
453 |
< |
loadvars(tf2); /* load variables */ |
453 |
> |
if (pippt == NULL) { |
454 |
> |
loadvars(tf2); /* load variables */ |
455 |
> |
unlink(tf2); |
456 |
> |
} |
457 |
|
rtargc += wordfile(rtargv+rtargc, tf1); /* get rtrace options */ |
458 |
< |
unlink(tf2); /* clean up */ |
444 |
< |
unlink(tf1); |
458 |
> |
unlink(tf1); /* clean up */ |
459 |
|
} |
460 |
|
|
461 |
|
|
525 |
|
fsiz = lseek(hdlist[0]->fd, 0L, 2); |
526 |
|
fuse = hdfiluse(hdlist[0]->fd, 1); |
527 |
|
fprintf(stderr, |
528 |
< |
"%s: %.1f Mbyte holodeck file, %.2f%% fragmentation\n", |
528 |
> |
"%s: %.1f Mbyte holodeck file, %.1f%% fragmentation\n", |
529 |
|
hdkfile, fsiz/(1024.*1024.), |
530 |
|
100.*(fsiz-fuse)/fsiz); |
531 |
|
} |