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

Comparing ray/src/rt/rpict.c (file contents):
Revision 2.32 by greg, Mon Nov 22 09:34:15 1993 UTC vs.
Revision 2.37 by greg, Wed Dec 22 21:03:54 1993 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1992 Regents of the University of California */
1 > /* Copyright (c) 1993 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 21 | Line 21 | static char SCCSid[] = "$SunId$ LBL";
21   #else
22   #include  <sys/times.h>
23   #include  <sys/utsname.h>
24 < #include  <limits.h>
24 > #include  <unistd.h>
25   #endif
26   #endif
27  
# Line 140 | Line 140 | report()               /* report progress */
140   #else
141          struct tms  tbuf;
142          struct utsname  nambuf;
143 < #define hostname  nambuf.sysname
143 >        double  period;
144 > #define hostname  nambuf.nodename
145   #endif
146  
147          tlastrept = time((time_t *)NULL);
# Line 154 | Line 155 | report()               /* report progress */
155          gethostname(hostname, sizeof(hostname));
156   #else
157          times(&tbuf);
158 <        u = ( tbuf.tms_utime + tbuf.tms_cutime ) / CLK_TCK;
159 <        s = ( tbuf.tms_stime + tbuf.tms_cstime ) / CLK_TCK;
158 > #ifdef _SC_CLK_TCK
159 >        period = 1.0 / sysconf(_SC_CLK_TCK);
160 > #else
161 >        period = 1.0 / 60.0;
162 > #endif
163 >        u = ( tbuf.tms_utime + tbuf.tms_cutime ) * period;
164 >        s = ( tbuf.tms_stime + tbuf.tms_cstime ) * period;
165          uname(&nambuf);
166   #endif
167  
# Line 164 | Line 170 | report()               /* report progress */
170                          nrays, pctdone, u/3600., s/3600.,
171                          (tlastrept-tstart)/3600., hostname);
172          eputs(errmsg);
173 + #ifndef BSD
174 +        signal(SIGCONT, report);
175   #undef hostname
176 + #endif
177   }
178   #else
179   report()                /* report progress */
# Line 173 | Line 182 | report()               /* report progress */
182          sprintf(errmsg, "%lu rays, %4.2f%% after %5.4f hours\n",
183                          nrays, pctdone, (tlastrept-tstart)/3600.0);
184          eputs(errmsg);
176        signal(SIGCONT, report);
185   }
186   #endif
187  
# Line 620 | Line 628 | char  *oldfile;
628          int  x, y;
629  
630          if (oldfile == NULL)
631 <                return(0);
632 <        
631 >                goto gotzip;
632 >
633          if ((fp = fopen(oldfile, "r")) == NULL) {
634                  sprintf(errmsg, "cannot open recover file \"%s\"", oldfile);
635                  error(WARNING, errmsg);
636 <                return(0);
636 >                goto gotzip;
637          }
638   #ifdef MSDOS
639          setmode(fileno(fp), O_BINARY);
# Line 638 | Line 646 | char  *oldfile;
646                                  oldfile);
647                  error(WARNING, errmsg);
648                  fclose(fp);
649 <                return(0);
649 >                goto gotzip;
650          }
651  
652          if (x != hres || y != vres) {
# Line 662 | Line 670 | char  *oldfile;
670          fclose(fp);
671          unlink(oldfile);
672          return(y);
673 + gotzip:
674 +        if (fflush(stdout) == EOF)
675 +                error(SYSTEM, "error writing picture header");
676 +        return(0);
677   writerr:
678          sprintf(errmsg, "write error during recovery of \"%s\"", oldfile);
679          error(SYSTEM, errmsg);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines