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

Comparing ray/src/rt/rv2.c (file contents):
Revision 1.24 by greg, Thu Jul 18 16:37:59 1991 UTC vs.
Revision 1.28 by greg, Thu Oct 10 12:08:58 1991 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1987 Regents of the University of California */
1 > /* Copyright (c) 1991 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 306 | Line 306 | char  *str, *dsc;
306   int  typ;
307   register union {int i; double d; COLOR C;}  *ptr;
308   {
309 +        extern char  *index();
310          int  i0;
311          double  d0, d1, d2;
312          char  buf[48];
# Line 339 | Line 340 | register union {int i; double d; COLOR C;}  *ptr;
340                          sprintf(buf, " (%c): ", ptr->i ? 'y' : 'n');
341                          (*dev->comout)(buf);
342                          (*dev->comin)(buf, NULL);
343 +                        if (buf[0] == '\0' ||
344 +                                        index("yY+1tTnN-0fF", buf[0]) == NULL)
345 +                                break;
346                  }
347 <                ptr->i = tolower(buf[0]) == 'y';
347 >                ptr->i = index("yY+1tT", buf[0]) != NULL;
348                  break;
349          case 'C':                       /* color */
350                  if (sscanf(str, "%lf %lf %lf", &d0, &d1, &d2) != 3) {
# Line 468 | Line 472 | register char  *s;
472                  break;
473          default:;
474   badparam:
475 +                *sskip(s) = '\0';
476                  sprintf(errmsg, "%s: unknown variable", s);
477                  error(COMMAND, errmsg);
478                  break;
# Line 537 | Line 542 | char  *s;
542   writepict(s)                            /* write the picture to a file */
543   char  *s;
544   {
545 +        extern char  VersionID[];
546          static char  buf[128];
547          char  *fname;
548          FILE  *fp;
# Line 560 | Line 566 | char  *s;
566          fputs(progname, fp);
567          fprintview(&ourview, fp);
568          putc('\n', fp);
569 +        fprintf(fp, "SOFTWARE= %s\n", VersionID);
570          if (exposure != 1.0)
571                  fputexpos(exposure, fp);
572          if (dev->pixaspect != 1.0)
# Line 569 | Line 576 | char  *s;
576          fputresolu(YMAJOR|YDECR, hresolu, vresolu, fp);
577  
578          scanline = (COLR *)malloc(hresolu*sizeof(COLR));
579 <        if (scanline == NULL)
580 <                error(SYSTEM, "out of memory in writepict");
579 >        if (scanline == NULL) {
580 >                error(COMMAND, "not enough memory!");
581 >                fclose(fp);
582 >                unlink(fname);
583 >                return;
584 >        }
585          for (y = vresolu-1; y >= 0; y--) {
586                  getpictcolrs(y, scanline, &ptrunk, hresolu, vresolu);
587                  if (fwritecolrs(scanline, hresolu, fp) < 0)
588                          break;
589          }
590 +        free((char *)scanline);
591          if (fclose(fp) < 0)
592                  error(COMMAND, "write error");
581        free((char *)scanline);
593   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines