--- ray/src/hd/rholo.c 2003/06/30 14:59:12 3.59 +++ ray/src/hd/rholo.c 2003/10/20 16:01:55 3.61 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rholo.c,v 3.59 2003/06/30 14:59:12 schorsch Exp $"; +static const char RCSid[] = "$Id: rholo.c,v 3.61 2003/10/20 16:01:55 greg Exp $"; #endif /* * Radiance holodeck generation controller @@ -10,6 +10,7 @@ static const char RCSid[] = "$Id: rholo.c,v 3.59 2003/ #include #include "rholo.h" +#include "platform.h" #include "random.h" #ifndef FRAGWARN @@ -278,7 +279,7 @@ initrholo() /* get our holodeck running */ sigdie(SIGXFSZ, "File size exceeded"); #endif /* protect holodeck file */ - orig_mode = resfmode(hdlist[0]->fd, ncprocs>0&force>=0 ? 0 : 0444); + orig_mode = resfmode(hdlist[0]->fd, (ncprocs>0) & (force>=0) ? 0 : 0444); return; memerr: error(SYSTEM, "out of memory in initrholo"); @@ -433,7 +434,7 @@ HDGRID *gp; putw(HOLOMAGIC, fp); /* put magic number */ fd = dup(fileno(fp)); fclose(fp); /* flush and close stdio stream */ - lastloc = lseek(fd, (off_t)0, 2); + lastloc = lseek(fd, (off_t)0, SEEK_END); for (n = vdef(SECTION); n--; gp++) { /* initialize each section */ nextloc = 0L; write(fd, (char *)&nextloc, sizeof(nextloc)); @@ -441,11 +442,11 @@ HDGRID *gp; if (!n) break; nextloc = hdfilen(fd); /* write section pointer */ - if (lseek(fd, (off_t)lastloc, 0) < 0) + if (lseek(fd, (off_t)lastloc, SEEK_SET) < 0) error(SYSTEM, "cannot seek on holodeck file in creatholo"); write(fd, (char *)&nextloc, sizeof(nextloc)); - lseek(fd, (off_t)(lastloc=nextloc), 0); + lseek(fd, (off_t)(lastloc=nextloc), SEEK_SET); } } @@ -483,7 +484,7 @@ loadholo() /* start loading a holodeck from fname */ int n; int32 nextloc; - if (ncprocs > 0 & force >= 0) + if ((ncprocs > 0) & (force >= 0)) fp = fopen(hdkfile, "r+"); else fp = NULL; @@ -512,7 +513,7 @@ loadholo() /* start loading a holodeck from fname */ fd = dup(fileno(fp)); fclose(fp); /* done with stdio */ for (n = 0; nextloc > 0L; n++) { /* initialize each section */ - lseek(fd, (off_t)nextloc, 0); + lseek(fd, (off_t)nextloc, SEEK_SET); read(fd, (char *)&nextloc, sizeof(nextloc)); hdinit(fd, NULL); } @@ -562,11 +563,12 @@ register char *rn, *fn; { char *tp, *dp; - for (tp = NULL, dp = rn; *rn = *fn++; rn++) + for (tp = NULL, dp = rn; (*rn = *fn++); rn++) { if (*rn == '/') dp = rn; else if (*rn == '.') tp = rn; + } if (tp != NULL && tp > dp) *tp = '\0'; } @@ -609,7 +611,7 @@ int ec; if (hdlist[0] != NULL) { /* close holodeck */ if (nprocs > 0) status = done_rtrace(); /* calls hdsync() */ - if (ncprocs > 0 & force >= 0 && vdef(REPORT)) { + if ((ncprocs > 0) & (force >= 0) && vdef(REPORT)) { off_t fsiz, fuse; fsiz = hdfilen(hdlist[0]->fd); fuse = hdfiluse(hdlist[0]->fd, 1);