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

Comparing ray/src/util/ranimate.c (file contents):
Revision 2.23 by gregl, Fri Oct 31 15:02:43 1997 UTC vs.
Revision 2.24 by gwlarson, Thu Feb 26 10:27:45 1998 UTC

# Line 985 | Line 985 | int    n;
985                  }
986                  return(NULL);
987          }
988 <        if (viewfp == NULL) {           /* open file */
988 >        if (viewfp == NULL) {                   /* open file */
989                  if ((viewfp = fopen(vval(VIEWFILE), "r")) == NULL) {
990                          perror(vval(VIEWFILE));
991                          quit(1);
992                  }
993 <        } else if (n < viewnum) {       /* rewind file */
993 >        } else if (n > 0 && n < viewnum) {      /* rewind file */
994                  if (viewnum == 1 && feof(viewfp))
995                          return(&curview);               /* just one view */
996                  if (fseek(viewfp, 0L, 0) == EOF) {
# Line 1000 | Line 1000 | int    n;
1000                  copystruct(&curview, &stdview);
1001                  viewnum = 0;
1002          }
1003 +        if (n < 0) {                            /* get next view */
1004 +                register int    c = getc(viewfp);
1005 +                if (c == EOF)
1006 +                        return((VIEW *)NULL);           /* that's it */
1007 +                ungetc(c, viewfp);
1008 +                n = viewnum + 1;
1009 +        }
1010          while (n > viewnum) {           /* scan to desired view */
1011                  if (fgets(linebuf, sizeof(linebuf), viewfp) == NULL)
1012                          return(viewnum==1 ? &curview : (VIEW *)NULL);
# Line 1013 | Line 1020 | int    n;
1020   int
1021   countviews()                    /* count views in view file */
1022   {
1023 <        register int    n = 0;
1023 >        int     n;
1024  
1025 <        while (getview(n+1) != NULL)
1025 >        if (getview(n=1) == NULL)
1026 >                return(0);
1027 >        while (getview(-1) != NULL)
1028                  n++;
1029          return(n);
1030   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines