32 |
|
|
33 |
|
int readinp = 0; /* read commands from stdin */ |
34 |
|
|
35 |
+ |
int force = 0; /* allow overwrite of holodeck */ |
36 |
+ |
|
37 |
|
time_t starttime; /* time we got started */ |
38 |
|
time_t endtime; /* time we should end by */ |
39 |
|
time_t reporttime; /* time for next report */ |
61 |
|
{ |
62 |
|
HDGRID hdg; |
63 |
|
int i; |
62 |
– |
int force = 0; |
64 |
|
/* mark start time */ |
65 |
|
starttime = time(NULL); |
66 |
< |
initurand(10240); /* initialize urand */ |
66 |
> |
initurand(16384); /* initialize urand */ |
67 |
|
progname = argv[0]; /* get arguments */ |
68 |
|
for (i = 1; i < argc && argv[i][0] == '-'; i++) |
69 |
|
switch (argv[i][1]) { |
225 |
|
if (ncprocs > 0) { |
226 |
|
i = start_rtrace(); |
227 |
|
if (i < 1) |
228 |
< |
error(USER, "cannot start rtrace process"); |
228 |
> |
error(USER, "cannot start rtrace process(es)"); |
229 |
|
if (vdef(REPORT)) { /* make first report */ |
230 |
|
printargs(rtargc, rtargv, stderr); |
231 |
|
report(0); |
280 |
|
if (!disp_check(idle)) |
281 |
|
return(0); |
282 |
|
/* display only? */ |
283 |
< |
if (ncprocs <= 0) |
283 |
> |
if (nprocs <= 0) |
284 |
|
return(1); |
285 |
|
/* check file size */ |
286 |
|
if (maxdisk > 0 && hdfilen(hdlist[0]->fd) >= maxdisk) { |
501 |
|
p->next = freepacks; |
502 |
|
freepacks = p; |
503 |
|
} |
504 |
< |
if (n2flush > 512*RPACKSIZ*ncprocs) { |
504 |
> |
if (n2flush > 512*RPACKSIZ*nprocs) { |
505 |
|
hdflush(NULL); /* flush holodeck buffers */ |
506 |
|
n2flush = 0; |
507 |
|
} |
508 |
|
} |
509 |
|
|
510 |
|
|
511 |
+ |
checkrad() /* check to make sure octree is up to date */ |
512 |
+ |
{ |
513 |
+ |
char combuf[128]; |
514 |
+ |
|
515 |
+ |
if (!vdef(RIF)) |
516 |
+ |
return; |
517 |
+ |
sprintf(combuf, "rad -v 0 -s -w %s", vval(RIF)); |
518 |
+ |
if (system(combuf)) |
519 |
+ |
error(WARNING, "error running rad"); |
520 |
+ |
} |
521 |
+ |
|
522 |
+ |
|
523 |
|
getradfile(rfargs) /* run rad and get needed variables */ |
524 |
|
char *rfargs; |
525 |
|
{ |
553 |
|
else |
554 |
|
sprintf(cp, ")[ \t]*=' > %s", tf2); |
555 |
|
if (system(combuf)) { |
543 |
– |
error(SYSTEM, "cannot execute rad command"); |
556 |
|
unlink(tf2); /* clean up */ |
557 |
|
unlink(tf1); |
558 |
< |
quit(1); |
558 |
> |
error(SYSTEM, "cannot execute rad command"); |
559 |
|
} |
560 |
|
if (pippt == NULL) { |
561 |
|
loadvars(tf2); /* load variables */ |
622 |
|
int status = 0; |
623 |
|
|
624 |
|
if (hdlist[0] != NULL) { /* flush holodeck */ |
625 |
< |
if (ncprocs > 0) { |
625 |
> |
if (nprocs > 0) { |
626 |
|
done_packets(flush_queue()); |
627 |
|
status = end_rtrace(); /* close rtrace */ |
628 |
< |
hdflush(NULL); |
629 |
< |
if (vdef(REPORT)) { |
630 |
< |
long fsiz, fuse; |
631 |
< |
report(0); |
632 |
< |
fsiz = hdfilen(hdlist[0]->fd); |
633 |
< |
fuse = hdfiluse(hdlist[0]->fd, 1); |
634 |
< |
fprintf(stderr, |
628 |
> |
} |
629 |
> |
hdflush(NULL); |
630 |
> |
if (ncprocs > 0 && vdef(REPORT)) { |
631 |
> |
long fsiz, fuse; |
632 |
> |
report(0); |
633 |
> |
fsiz = hdfilen(hdlist[0]->fd); |
634 |
> |
fuse = hdfiluse(hdlist[0]->fd, 1); |
635 |
> |
fprintf(stderr, |
636 |
|
"%s: %.1f Mbyte holodeck file, %.1f%% fragmentation\n", |
637 |
< |
hdkfile, fsiz/(1024.*1024.), |
638 |
< |
100.*(fsiz-fuse)/fsiz); |
639 |
< |
} |
627 |
< |
} else |
628 |
< |
hdflush(NULL); |
637 |
> |
hdkfile, fsiz/(1024.*1024.), |
638 |
> |
100.*(fsiz-fuse)/fsiz); |
639 |
> |
} |
640 |
|
} |
641 |
|
if (orig_mode >= 0) /* reset holodeck access mode */ |
642 |
|
fchmod(hdlist[0]->fd, orig_mode); |