ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/persist.c
(Generate patch)

Comparing ray/src/rt/persist.c (file contents):
Revision 2.8 by greg, Wed Mar 3 09:07:52 1993 UTC vs.
Revision 2.9 by greg, Thu Apr 1 08:55:37 1993 UTC

# Line 180 | Line 180 | io_process()           /* just act as conduits to and from actu
180                          error(SYSTEM, "cannot open output pipe in io_process");
181          }
182                                  /* pass input to output */
183 <        cp = buf; n = sizeof(buf);
184 <                                /* do as much as we can each way */
185 <        while ((nr = read(0, cp, n)) > 0) {
186 <                nr += cp-buf;
187 <                if ((n = write(1, buf, nr)) <= 0)
188 <                        goto writerr;
189 <                cp = buf;
190 <                while (n < nr)
191 <                        *cp++ = buf[n++];
192 <                n = sizeof(buf) - (cp-buf);
193 <        }
183 >                                /* read as much as we can, write all of it */
184 >        while ((nr = read(0, cp=buf, sizeof(buf))) > 0)
185 >                do {
186 >                        if ((n = write(1, cp, nr)) <= 0)
187 >                                goto writerr;
188 >                        cp += n;
189 >                } while ((nr -= n) > 0);
190          if (nr < 0)
191                  error(SYSTEM, "read error in io_process");
192          close(0);               /* close input */
197        nr = cp-buf;            /* write remainder */
198        cp = buf;
199        while (nr > 0) {
200                if ((n = write(1, cp, nr)) <= 0)
201                        goto writerr;
202                cp += n;
203                nr -= n;
204        }
193          close(1);               /* close output */
194          if (pid)                /* parent waits for child */
195                  wait(0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines