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"; |
155 |
|
gethostname(hostname, sizeof(hostname)); |
156 |
|
#else |
157 |
|
times(&tbuf); |
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); |
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 */ |
182 |
|
sprintf(errmsg, "%lu rays, %4.2f%% after %5.4f hours\n", |
183 |
|
nrays, pctdone, (tlastrept-tstart)/3600.0); |
184 |
|
eputs(errmsg); |
178 |
– |
signal(SIGCONT, report); |
185 |
|
} |
186 |
|
#endif |
187 |
|
|
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); |
646 |
|
oldfile); |
647 |
|
error(WARNING, errmsg); |
648 |
|
fclose(fp); |
649 |
< |
return(0); |
649 |
> |
goto gotzip; |
650 |
|
} |
651 |
|
|
652 |
|
if (x != hres || y != vres) { |
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); |