--- ray/src/util/rpiece.c 2003/06/08 12:03:11 2.38 +++ ray/src/util/rpiece.c 2003/10/20 16:01:55 2.42 @@ -1,10 +1,11 @@ #ifndef lint -static const char RCSid[] = "$Id: rpiece.c,v 2.38 2003/06/08 12:03:11 schorsch Exp $"; +static const char RCSid[] = "$Id: rpiece.c,v 2.42 2003/10/20 16:01:55 greg Exp $"; #endif /* * Generate sections of a picture. */ +#include "platform.h" #include "standard.h" #ifndef F_SETLKW @@ -20,8 +21,10 @@ char *argv[]; #else #include + #include "color.h" #include "view.h" +#include "rtprocess.h" #ifndef NFS #define NFS 1 @@ -49,7 +52,6 @@ extern char *strerror(); /* rpict command */ char *rpargv[128] = {"rpict", "-S", "1"}; int rpargc = 3; -int rpd[3]; FILE *torp, *fromrp; COLR *pbuf; /* our view parameters */ @@ -210,6 +212,7 @@ char **av; char *err; FILE *fp; int hr, vr; + SUBPROC rpd; /* since we don't close_process(), this can be local */ /* set up view */ if ((err = setview(&ourview)) != NULL) { fprintf(stderr, "%s: %s\n", progname, err); @@ -268,12 +271,12 @@ char **av; goto filerr; dolock(outfd, F_UNLCK); /* start rpict process */ - if (open_process(rpd, rpargv) <= 0) { + if (open_process(&rpd, rpargv) <= 0) { fprintf(stderr, "%s: cannot start %s\n", progname, rpargv[0]); exit(1); } - if ((fromrp = fdopen(rpd[0], "r")) == NULL || - (torp = fdopen(rpd[1], "w")) == NULL) { + if ((fromrp = fdopen(rpd.r, "r")) == NULL || + (torp = fdopen(rpd.w, "w")) == NULL) { fprintf(stderr, "%s: cannot open stream to %s\n", progname, rpargv[0]); exit(1); @@ -399,7 +402,7 @@ rpiece() /* render picture piece by piece */ VIEW pview; int xorg, yorg; /* compute view parameters */ - copystruct(&pview, &ourview); + pview = ourview; switch (ourview.type) { case VT_PER: pview.horiz = 2.*180./PI*atan( @@ -450,7 +453,7 @@ int xpos, ypos; int hr, vr; register int y; /* check bounds */ - if (xpos < 0 | ypos < 0 | xpos >= hmult | ypos >= vmult) { + if ((xpos < 0) | (ypos < 0) | (xpos >= hmult) | (ypos >= vmult)) { fprintf(stderr, "%s: requested piece (%d,%d) out of range\n", progname, xpos, ypos); exit(cleanup(1)); @@ -458,7 +461,7 @@ int xpos, ypos; /* check header from rpict */ guard_io(); getheader(fromrp, NULL, NULL); - if (!fscnresolu(&hr, &vr, fromrp) || hr != hres | vr != vres) { + if (!fscnresolu(&hr, &vr, fromrp) || (hr != hres) | (vr != vres)) { fprintf(stderr, "%s: resolution mismatch from %s\n", progname, rpargv[0]); exit(cleanup(1)); @@ -503,7 +506,7 @@ int xpos, ypos; filerr("lock"); #endif /* write new piece to file */ - if (lseek(outfd, (off_t)fls.l_start, 0) < 0) + if (lseek(outfd, (off_t)fls.l_start, SEEK_SET) < 0) filerr("seek"); if (hmult == 1) { if (writebuf(outfd, (char *)pbuf, @@ -516,7 +519,7 @@ int xpos, ypos; filerr("write"); if (y < vr-1 && lseek(outfd, (off_t)(hmult-1)*hr*sizeof(COLR), - 1) < 0) + SEEK_CUR) < 0) filerr("seek"); } #if NFS