--- ray/src/rt/rpict.c 1993/11/22 09:34:15 2.32 +++ ray/src/rt/rpict.c 1993/12/22 21:03:54 2.37 @@ -1,4 +1,4 @@ -/* Copyright (c) 1992 Regents of the University of California */ +/* Copyright (c) 1993 Regents of the University of California */ #ifndef lint static char SCCSid[] = "$SunId$ LBL"; @@ -21,7 +21,7 @@ static char SCCSid[] = "$SunId$ LBL"; #else #include #include -#include +#include #endif #endif @@ -140,7 +140,8 @@ report() /* report progress */ #else struct tms tbuf; struct utsname nambuf; -#define hostname nambuf.sysname + double period; +#define hostname nambuf.nodename #endif tlastrept = time((time_t *)NULL); @@ -154,8 +155,13 @@ report() /* report progress */ gethostname(hostname, sizeof(hostname)); #else times(&tbuf); - u = ( tbuf.tms_utime + tbuf.tms_cutime ) / CLK_TCK; - s = ( tbuf.tms_stime + tbuf.tms_cstime ) / CLK_TCK; +#ifdef _SC_CLK_TCK + period = 1.0 / sysconf(_SC_CLK_TCK); +#else + period = 1.0 / 60.0; +#endif + u = ( tbuf.tms_utime + tbuf.tms_cutime ) * period; + s = ( tbuf.tms_stime + tbuf.tms_cstime ) * period; uname(&nambuf); #endif @@ -164,7 +170,10 @@ report() /* report progress */ nrays, pctdone, u/3600., s/3600., (tlastrept-tstart)/3600., hostname); eputs(errmsg); +#ifndef BSD + signal(SIGCONT, report); #undef hostname +#endif } #else report() /* report progress */ @@ -173,7 +182,6 @@ report() /* report progress */ sprintf(errmsg, "%lu rays, %4.2f%% after %5.4f hours\n", nrays, pctdone, (tlastrept-tstart)/3600.0); eputs(errmsg); - signal(SIGCONT, report); } #endif @@ -620,12 +628,12 @@ char *oldfile; int x, y; if (oldfile == NULL) - return(0); - + goto gotzip; + if ((fp = fopen(oldfile, "r")) == NULL) { sprintf(errmsg, "cannot open recover file \"%s\"", oldfile); error(WARNING, errmsg); - return(0); + goto gotzip; } #ifdef MSDOS setmode(fileno(fp), O_BINARY); @@ -638,7 +646,7 @@ char *oldfile; oldfile); error(WARNING, errmsg); fclose(fp); - return(0); + goto gotzip; } if (x != hres || y != vres) { @@ -662,6 +670,10 @@ char *oldfile; fclose(fp); unlink(oldfile); return(y); +gotzip: + if (fflush(stdout) == EOF) + error(SYSTEM, "error writing picture header"); + return(0); writerr: sprintf(errmsg, "write error during recovery of \"%s\"", oldfile); error(SYSTEM, errmsg);