| 5 |
|
* Radiance holodeck generation controller |
| 6 |
|
*/ |
| 7 |
|
|
| 8 |
– |
#include "rholo.h" |
| 9 |
– |
#include "random.h" |
| 8 |
|
#include <signal.h> |
| 9 |
|
#include <sys/stat.h> |
| 10 |
+ |
#include <string.h> |
| 11 |
|
|
| 12 |
+ |
#include "rholo.h" |
| 13 |
+ |
#include "random.h" |
| 14 |
+ |
|
| 15 |
|
#ifndef FRAGWARN |
| 16 |
|
#define FRAGWARN 20 /* fragmentation for warning (%) */ |
| 17 |
|
#endif |
| 217 |
|
init_global(); |
| 218 |
|
/* record disk space limit */ |
| 219 |
|
if (!vdef(DISKSPACE)) |
| 220 |
< |
maxdisk = (1L<<(sizeof(off_t)*8-2)) - 1024; |
| 220 |
> |
maxdisk = ((off_t)1<<(sizeof(off_t)*8-2)) - 1024; |
| 221 |
|
else |
| 222 |
|
maxdisk = 1024.*1024.*vflt(DISKSPACE); |
| 223 |
|
/* set up memory cache */ |
| 278 |
|
sigdie(SIGXFSZ, "File size exceeded"); |
| 279 |
|
#endif |
| 280 |
|
/* protect holodeck file */ |
| 281 |
< |
orig_mode = resfmode(hdlist[0]->fd, ncprocs>0&force>=0 ? 0 : 0444); |
| 281 |
> |
orig_mode = resfmode(hdlist[0]->fd, (ncprocs>0) & (force>=0) ? 0 : 0444); |
| 282 |
|
return; |
| 283 |
|
memerr: |
| 284 |
|
error(SYSTEM, "out of memory in initrholo"); |
| 415 |
|
HDGRID *gp; |
| 416 |
|
{ |
| 417 |
|
extern char VersionID[]; |
| 418 |
< |
int4 lastloc, nextloc; |
| 418 |
> |
int32 lastloc, nextloc; |
| 419 |
|
int n; |
| 420 |
|
int fd; |
| 421 |
|
FILE *fp; |
| 481 |
|
FILE *fp; |
| 482 |
|
int fd; |
| 483 |
|
int n; |
| 484 |
< |
int4 nextloc; |
| 484 |
> |
int32 nextloc; |
| 485 |
|
|
| 486 |
< |
if (ncprocs > 0 & force >= 0) |
| 486 |
> |
if ((ncprocs > 0) & (force >= 0)) |
| 487 |
|
fp = fopen(hdkfile, "r+"); |
| 488 |
|
else |
| 489 |
|
fp = NULL; |
| 533 |
|
while (pl != NULL) { |
| 534 |
|
p = pl; pl = p->next; p->next = NULL; |
| 535 |
|
if (p->nr > 0) { /* add to holodeck */ |
| 536 |
< |
bcopy((void *)p->ra, |
| 537 |
< |
(void *)hdnewrays(hdlist[p->hd],p->bi,p->nr), |
| 536 |
> |
memcpy( (void *)hdnewrays(hdlist[p->hd],p->bi,p->nr), |
| 537 |
> |
(void *)p->ra, |
| 538 |
|
p->nr*sizeof(RAYVAL)); |
| 539 |
|
if (outdev != NULL) /* display it */ |
| 540 |
|
disp_packet((PACKHEAD *)p); |
| 562 |
|
{ |
| 563 |
|
char *tp, *dp; |
| 564 |
|
|
| 565 |
< |
for (tp = NULL, dp = rn; *rn = *fn++; rn++) |
| 565 |
> |
for (tp = NULL, dp = rn; (*rn = *fn++); rn++) { |
| 566 |
|
if (*rn == '/') |
| 567 |
|
dp = rn; |
| 568 |
|
else if (*rn == '.') |
| 569 |
|
tp = rn; |
| 570 |
+ |
} |
| 571 |
|
if (tp != NULL && tp > dp) |
| 572 |
|
*tp = '\0'; |
| 573 |
|
} |
| 610 |
|
if (hdlist[0] != NULL) { /* close holodeck */ |
| 611 |
|
if (nprocs > 0) |
| 612 |
|
status = done_rtrace(); /* calls hdsync() */ |
| 613 |
< |
if (ncprocs > 0 & force >= 0 && vdef(REPORT)) { |
| 613 |
> |
if ((ncprocs > 0) & (force >= 0) && vdef(REPORT)) { |
| 614 |
|
off_t fsiz, fuse; |
| 615 |
|
fsiz = hdfilen(hdlist[0]->fd); |
| 616 |
|
fuse = hdfiluse(hdlist[0]->fd, 1); |