| 55 |
|
off_t maxdisk; /* maximum file space (bytes) */ |
| 56 |
|
|
| 57 |
|
int rtargc = 1; /* rtrace command */ |
| 58 |
< |
char *rtargv[128] = {"rtrace", NULL}; |
| 58 |
> |
char *rtargv[MAXRTARGC] = {"rtrace", NULL}; |
| 59 |
|
|
| 60 |
|
int orig_mode = -1; /* original file mode (-1 if unchanged) */ |
| 61 |
|
|
| 164 |
|
quit(0); |
| 165 |
|
userr: |
| 166 |
|
fprintf(stderr, |
| 167 |
< |
"Usage: %s [-n nprocs][-o disp][-w][-r|-f] output.hdk [control.hif|+|- [VAR=val ..]]\n", |
| 167 |
> |
"Usage: %s [-n nprocs][-o disp][-i][-w][-r|-f] output.hdk [control.hif|+|- [VAR=val ..]]\n", |
| 168 |
|
progname); |
| 169 |
|
quit(1); |
| 170 |
|
return 1; /* pro forma return */ |
| 184 |
|
hdsync(NULL, 0); /* don't leave w/o saying goodbye */ |
| 185 |
|
_exit(signo); |
| 186 |
|
} |
| 187 |
< |
alarm(300); /* allow 5 minutes to clean up */ |
| 187 |
> |
alarm(300); /* allow 10 minutes to clean up */ |
| 188 |
|
eputs("signal - "); |
| 189 |
|
eputs(sigerr[signo]); |
| 190 |
|
eputs("\n"); |
| 229 |
|
static void |
| 230 |
|
initrholo(void) /* get our holodeck running */ |
| 231 |
|
{ |
| 232 |
< |
extern int global_packet(); |
| 233 |
< |
register int i; |
| 232 |
> |
int i; |
| 233 |
|
/* close holodeck on exec() */ |
| 234 |
|
fcntl(hdlist[0]->fd, F_SETFD, FD_CLOEXEC); |
| 235 |
|
|
| 249 |
|
hdcachesize = 1024.*1024.*vflt(CACHE); |
| 250 |
|
/* open report file */ |
| 251 |
|
if (vdef(REPORT)) { |
| 252 |
< |
register char *s = sskip2(vval(REPORT), 1); |
| 252 |
> |
char *s = sskip2(vval(REPORT), 1); |
| 253 |
|
if (*s && freopen(s, "a", stderr) == NULL) |
| 254 |
|
quit(2); |
| 255 |
|
} |
| 323 |
|
PACKET *pl = NULL, *plend; |
| 324 |
|
off_t fsiz; |
| 325 |
|
int pksiz; |
| 326 |
< |
register PACKET *p; |
| 326 |
> |
PACKET *p; |
| 327 |
|
time_t t; |
| 328 |
|
/* check display */ |
| 329 |
|
if (nprocs <= 0) |
| 390 |
|
|
| 391 |
|
static void |
| 392 |
|
setdefaults( /* set default values */ |
| 393 |
< |
register HDGRID *gp |
| 393 |
> |
HDGRID *gp |
| 394 |
|
) |
| 395 |
|
{ |
| 396 |
< |
extern char *atos(); |
| 398 |
< |
register int i; |
| 396 |
> |
int i; |
| 397 |
|
int n; |
| 398 |
|
double len[3], d; |
| 399 |
|
|
| 413 |
|
} |
| 414 |
|
/* append rendering options */ |
| 415 |
|
if (vdef(RENDER)) |
| 416 |
< |
rtargc += wordstring(rtargv+rtargc, vval(RENDER)); |
| 416 |
> |
rtargc += wordstring(rtargv+rtargc, MAXRTARGC-rtargc, vval(RENDER)); |
| 417 |
|
|
| 418 |
|
if (gp == NULL) /* already initialized? */ |
| 419 |
|
return; |
| 451 |
|
) |
| 452 |
|
{ |
| 453 |
|
extern char VersionID[]; |
| 454 |
< |
int32 lastloc, nextloc; |
| 454 |
> |
off_t lastloc, nextloc; |
| 455 |
|
int n; |
| 456 |
|
int fd; |
| 457 |
|
FILE *fp; |
| 458 |
|
/* open & truncate file */ |
| 459 |
< |
if ((fp = fopen(hdkfile, "w+")) == NULL) { |
| 459 |
> |
if ((fp = fopen(hdkfile, "wb+")) == NULL) { |
| 460 |
|
sprintf(errmsg, "cannot open \"%s\" for writing", hdkfile); |
| 461 |
|
error(SYSTEM, errmsg); |
| 462 |
|
} |
| 463 |
|
/* write information header */ |
| 464 |
|
newheader("RADIANCE", fp); |
| 465 |
|
fprintf(fp, "SOFTWARE= %s\n", VersionID); |
| 466 |
+ |
fputnow(fp); |
| 467 |
|
printvars(fp); |
| 468 |
+ |
fputendian(fp); |
| 469 |
|
fputformat(HOLOFMT, fp); |
| 470 |
|
fputc('\n', fp); |
| 471 |
|
putw(HOLOMAGIC, fp); /* put magic number */ |
| 479 |
|
if (!n) |
| 480 |
|
break; |
| 481 |
|
nextloc = hdfilen(fd); /* write section pointer */ |
| 482 |
< |
if (lseek(fd, (off_t)lastloc, SEEK_SET) < 0) |
| 482 |
> |
if (lseek(fd, lastloc, SEEK_SET) < 0) |
| 483 |
|
error(SYSTEM, |
| 484 |
|
"cannot seek on holodeck file in creatholo"); |
| 485 |
|
write(fd, (char *)&nextloc, sizeof(nextloc)); |
| 486 |
< |
lseek(fd, (off_t)(lastloc=nextloc), SEEK_SET); |
| 486 |
> |
lseek(fd, (lastloc=nextloc), SEEK_SET); |
| 487 |
|
} |
| 488 |
|
} |
| 489 |
|
|
| 495 |
|
) |
| 496 |
|
{ |
| 497 |
|
extern char FMTSTR[]; |
| 498 |
< |
register char *cp; |
| 499 |
< |
char fmt[32]; |
| 498 |
> |
char *cp; |
| 499 |
> |
char fmt[MAXFMTLEN]; |
| 500 |
|
|
| 501 |
|
if (formatval(fmt, s)) { |
| 502 |
|
if (strcmp(fmt, HOLOFMT)) { |
| 522 |
|
FILE *fp; |
| 523 |
|
int fd; |
| 524 |
|
int n; |
| 525 |
< |
int32 nextloc; |
| 525 |
> |
off_t nextloc; |
| 526 |
|
|
| 527 |
|
if ((ncprocs > 0) & (force >= 0)) |
| 528 |
< |
fp = fopen(hdkfile, "r+"); |
| 528 |
> |
fp = fopen(hdkfile, "rb+"); |
| 529 |
|
else |
| 530 |
|
fp = NULL; |
| 531 |
|
if (fp == NULL) { |
| 532 |
< |
if ((fp = fopen(hdkfile, "r")) == NULL) { |
| 532 |
> |
if ((fp = fopen(hdkfile, "rb")) == NULL) { |
| 533 |
|
sprintf(errmsg, "cannot open \"%s\"", hdkfile); |
| 534 |
|
error(SYSTEM, errmsg); |
| 535 |
|
} |
| 554 |
|
fd = dup(fileno(fp)); |
| 555 |
|
fclose(fp); /* done with stdio */ |
| 556 |
|
for (n = 0; nextloc > 0L; n++) { /* initialize each section */ |
| 557 |
< |
lseek(fd, (off_t)nextloc, SEEK_SET); |
| 557 |
> |
lseek(fd, nextloc, SEEK_SET); |
| 558 |
|
read(fd, (char *)&nextloc, sizeof(nextloc)); |
| 559 |
|
hdinit(fd, NULL); |
| 560 |
|
} |
| 566 |
|
} |
| 567 |
|
|
| 568 |
|
|
| 569 |
< |
extern void |
| 569 |
> |
void |
| 570 |
|
done_packets( /* handle finished packets */ |
| 571 |
|
PACKET *pl |
| 572 |
|
) |
| 573 |
|
{ |
| 574 |
|
static int n2flush = 0; |
| 575 |
< |
register PACKET *p; |
| 575 |
> |
PACKET *p; |
| 576 |
|
|
| 577 |
|
while (pl != NULL) { |
| 578 |
|
p = pl; pl = p->next; p->next = NULL; |
| 603 |
|
|
| 604 |
|
static void |
| 605 |
|
rootname( /* remove tail from end of fn */ |
| 606 |
< |
register char *rn, |
| 607 |
< |
register char *fn |
| 606 |
> |
char *rn, |
| 607 |
> |
char *fn |
| 608 |
|
) |
| 609 |
|
{ |
| 610 |
|
char *tp, *dp; |
| 631 |
|
|
| 632 |
|
|
| 633 |
|
void |
| 634 |
< |
eputs(s) /* put error message to stderr */ |
| 635 |
< |
register char *s; |
| 634 |
> |
eputs(const char *s) /* put error message to stderr */ |
| 635 |
|
{ |
| 636 |
|
static int midline = 0; |
| 637 |
|
|
| 650 |
|
|
| 651 |
|
|
| 652 |
|
void |
| 653 |
< |
quit(ec) /* exit program gracefully */ |
| 655 |
< |
int ec; |
| 653 |
> |
quit(int ec) /* exit program gracefully */ |
| 654 |
|
{ |
| 655 |
|
int status = 0; |
| 656 |
|
|