--- ray/src/hd/rholo.c 2004/09/09 00:25:59 3.66 +++ ray/src/hd/rholo.c 2005/12/21 07:26:29 3.72 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rholo.c,v 3.66 2004/09/09 00:25:59 greg Exp $"; +static const char RCSid[] = "$Id: rholo.c,v 3.72 2005/12/21 07:26:29 greg Exp $"; #endif /* * Radiance holodeck generation controller @@ -90,7 +90,6 @@ main( { int i; - initurand(16384); /* initialize urand */ progname = argv[0]; /* get arguments */ for (i = 1; i < argc && argv[i][0] == '-'; i++) switch (argv[i][1]) { @@ -320,7 +319,7 @@ memerr: static int rholo(void) /* holodeck main loop */ { - static long nextfragwarn = 100*(1L<<20); + static off_t nextfragwarn = 100L<<20; static int idle = 0; PACKET *pl = NULL, *plend; off_t fsiz; @@ -339,25 +338,25 @@ rholo(void) /* holodeck main loop */ return(0); /* all done */ fsiz = hdfilen(hdlist[0]->fd); /* check file size */ if (maxdisk > 0 && fsiz >= maxdisk) { - error(WARNING, "file limit exceeded"); + error(USER, "file limit exceeded"); done_rtrace(); return(1); /* comes back */ } #if FRAGWARN - if (fsiz >= nextfragwarn && - (fsiz-hdfiluse(hdlist[0]->fd,0))/(fsiz/100) > FRAGWARN) { - double pctfrag = 100.*(fsiz-hdfiluse(hdlist[0]->fd,1))/fsiz; - if (pctfrag >= (double)FRAGWARN) { + if (fsiz >= nextfragwarn) { + double pctfrag = 100.*(fsiz-hdfiluse(hdlist[0]->fd))/fsiz; + if (pctfrag >= (double)FRAGWARN) { sprintf(errmsg, "holodeck file fragmentation is %.0f%%", pctfrag); error(WARNING, errmsg); nextfragwarn = fsiz + (fsiz>>2); - } + } else + nextfragwarn = fsiz + (10L<<20); } #endif t = time(NULL); /* check time */ if (endtime > 0 && t >= endtime) { - error(WARNING, "time limit exceeded"); + error(USER, "time limit exceeded"); done_rtrace(); return(1); /* comes back */ } @@ -535,9 +534,10 @@ loadholo(void) /* start loading a holodeck from fnam error(SYSTEM, errmsg); } if (ncprocs > 0) { - sprintf(errmsg, - "\"%s\" opened read-only; new rays will be discarded", - hdkfile); + sprintf(errmsg, "\"%s\" is read-only", hdkfile); + if (outdev == NULL) + error(USER, errmsg); + strcat(errmsg, "; new rays will be discarded"); error(WARNING, errmsg); force = -1; } @@ -662,7 +662,7 @@ int ec; if ((ncprocs > 0) & (force >= 0) && vdef(REPORT)) { off_t fsiz, fuse; fsiz = hdfilen(hdlist[0]->fd); - fuse = hdfiluse(hdlist[0]->fd, 1); + fuse = hdfiluse(hdlist[0]->fd); fprintf(stderr, "%s: %.1f Mbyte holodeck file, %.1f%% fragmentation\n", hdkfile, fsiz/(1024.*1024.),