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.41 by greg, Fri Dec 8 18:49:20 1995 UTC vs.
Revision 2.43 by greg, Wed Feb 7 16:35:18 1996 UTC

# Line 20 | Line 20 | static char SCCSid[] = "$SunId$ LBL";
20   #include  <sys/resource.h>
21   #else
22   #include  <sys/times.h>
23 #include  <sys/utsname.h>
23   #include  <unistd.h>
24   #endif
25   #endif
# Line 140 | Line 139 | int  code;
139   #ifndef NIX
140   report()                /* report progress */
141   {
142 +        extern char  *myhostname();
143          double  u, s;
144   #ifdef BSD
145        char  hostname[257];
145          struct rusage  rubuf;
146   #else
147          struct tms  tbuf;
149        struct utsname  nambuf;
148          double  period;
151 #define hostname  nambuf.nodename
149   #endif
150  
151          tlastrept = time((time_t *)NULL);
# Line 159 | Line 156 | report()               /* report progress */
156          getrusage(RUSAGE_CHILDREN, &rubuf);
157          u += rubuf.ru_utime.tv_sec + rubuf.ru_utime.tv_usec/1e6;
158          s += rubuf.ru_stime.tv_sec + rubuf.ru_stime.tv_usec/1e6;
162        gethostname(hostname, sizeof(hostname));
159   #else
160          times(&tbuf);
161   #ifdef _SC_CLK_TCK
# Line 169 | Line 165 | report()               /* report progress */
165   #endif
166          u = ( tbuf.tms_utime + tbuf.tms_cutime ) * period;
167          s = ( tbuf.tms_stime + tbuf.tms_cstime ) * period;
172        uname(&nambuf);
168   #endif
169  
170          sprintf(errmsg,
171                  "%lu rays, %4.2f%% after %.3fu %.3fs %.3fr hours on %s\n",
172                          nrays, pctdone, u/3600., s/3600.,
173 <                        (tlastrept-tstart)/3600., hostname);
173 >                        (tlastrept-tstart)/3600., myhostname());
174          eputs(errmsg);
175   #ifndef BSD
176          signal(SIGCONT, report);
182 #undef hostname
177   #endif
178   }
179   #else
# Line 398 | Line 392 | char  *zfile, *oldfile;
392          fprtresolu(hres, vres, stdout);
393                                          /* recover file and compute first */
394          i = salvage(oldfile);
395 +        if (i >= vres)
396 +                goto alldone;
397          if (zfd != -1 && i > 0 &&
398                          lseek(zfd, (long)i*hres*sizeof(float), 0) == -1)
399                  error(SYSTEM, "z-file seek error in render");
# Line 453 | Line 449 | char  *zfile, *oldfile;
449          }
450                                                  /* clean up */
451          signal(SIGCONT, SIG_IGN);
452 <        if (zfd != -1) {
457 <                if (write(zfd, (char *)zbar[0], hres*sizeof(float))
452 >        if (zfd != -1 && write(zfd, (char *)zbar[0], hres*sizeof(float))
453                                  < hres*sizeof(float))
454 <                        goto writerr;
454 >                goto writerr;
455 >        fwritescan(scanbar[0], hres, stdout);
456 >        if (fflush(stdout) == EOF)
457 >                goto writerr;
458 > alldone:
459 >        if (zfd != -1) {
460                  if (close(zfd) == -1)
461                          goto writerr;
462                  for (i = 0; i <= psample; i++)
463                          free((char *)zbar[i]);
464          }
465        fwritescan(scanbar[0], hres, stdout);
466        if (fflush(stdout) == EOF)
467                goto writerr;
465          for (i = 0; i <= psample; i++)
466                  free((char *)scanbar[i]);
467          if (sampdens != NULL)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines