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

Comparing ray/src/util/rpiece.c (file contents):
Revision 2.25 by greg, Fri Aug 6 17:19:52 1993 UTC vs.
Revision 2.26 by greg, Sat Aug 7 08:43:32 1993 UTC

# Line 321 | Line 321 | int  *xp, *yp;
321                  sflock(F_UNLCK);                /* release sync file */
322                  return(1);
323          }
324 <        if (scanf("%d %d", xp, yp) == 2)        /* use stdin */
325 <                return(1);
326 <        fprintf(stderr, "%s: input format error\n", progname);
327 <        exit(cleanup(1));
324 >        return(scanf("%d %d", xp, yp) == 2);    /* use stdin */
325   }
326  
327  
# Line 484 | Line 481 | int  xpos, ypos;
481                                  /* lock file section so NFS doesn't mess up */
482          fls.l_whence = 0;
483          fls.l_type = F_WRLCK;
484 <        fcntl(outfd, F_SETLKW, &fls);
484 >        if (fcntl(outfd, F_SETLKW, &fls) < 0)
485 >                filerr("lock");
486   #endif
487                                  /* write new piece to file */
488          if (lseek(outfd, fls.l_start, 0) == -1)
489 <                goto seekerr;
489 >                filerr("seek");
490          if (hmult == 1) {
491                  if (writebuf(outfd, (char *)pbuf,
492                                  vr*hr*sizeof(COLR)) != vr*hr*sizeof(COLR))
493 <                        goto writerr;
493 >                        filerr("write");
494          } else
495                  for (y = 0; y < vr; y++) {
496                          if (writebuf(outfd, (char *)(pbuf+y*hr),
497                                          hr*sizeof(COLR)) != hr*sizeof(COLR))
498 <                                goto writerr;
498 >                                filerr("write");
499                          if (y < vr-1 && lseek(outfd,
500                                          (long)(hmult-1)*hr*sizeof(COLR),
501                                          1) == -1)
502 <                                goto seekerr;
502 >                                filerr("seek");
503                  }
504   #if NFS
505          fls.l_type = F_UNLCK;           /* release lock */
506 <        fcntl(outfd, F_SETLKW, &fls);
506 >        if (fcntl(outfd, F_SETLKW, &fls) < 0)
507 >                filerr("lock");
508   #endif
509          if (syncfp != NULL) {                   /* record what's been done */
510                  sflock(F_WRLCK);
# Line 522 | Line 521 | int  xpos, ypos;
521          if (pid == -1)          /* didn't fork or fork failed */
522                  return(0);
523          _exit(0);               /* else exit child process (releasing locks) */
524 < seekerr:
525 <        fprintf(stderr, "%s: seek error on file \"%s\"\n", progname, outfile);
526 <        _exit(1);
527 < writerr:
528 <        fprintf(stderr, "%s: write error on file \"%s\"\n", progname, outfile);
524 > }
525 >
526 >
527 > filerr(t)                       /* report file error and exit */
528 > char  *t;
529 > {
530 >        extern char  *sys_errlist[];
531 >
532 >        fprintf(stderr, "%s: %s error on file \"%s\": %s\n",
533 >                        progname, t, outfile, sys_errlist[errno]);
534          _exit(1);
535   }
536  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines