ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/rpiece.c
Revision: 2.49
Committed: Thu Apr 24 10:28:25 2008 UTC (15 years, 11 months ago) by schorsch
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R9
Changes since 2.48: +3 -2 lines
Log Message:
More fixes for mingw build/install.

File Contents

# User Rev Content
1 greg 2.1 #ifndef lint
2 schorsch 2.49 static const char RCSid[] = "$Id: rpiece.c,v 2.48 2008/03/11 02:21:47 greg Exp $";
3 greg 2.1 #endif
4     /*
5     * Generate sections of a picture.
6     */
7    
8 schorsch 2.43
9     #include <stdio.h>
10     #include <signal.h>
11     #include <sys/types.h>
12 schorsch 2.49
13     #include "platform.h"
14 schorsch 2.45 #ifndef NON_POSIX /* XXX need abstraction for process management */
15     #include <sys/wait.h>
16     #endif
17 schorsch 2.43
18 greg 2.44 #include "standard.h"
19 schorsch 2.43 #include "color.h"
20     #include "view.h"
21     #include "rtprocess.h"
22 greg 2.16
23     #ifndef F_SETLKW
24    
25 schorsch 2.43 int
26     main(
27     int argc,
28     char *argv[]
29     )
30 greg 2.16 {
31     fprintf(stderr, "%s: no NFS lock manager on this machine\n", argv[0]);
32     exit(1);
33     }
34    
35     #else
36    
37 greg 2.12 #ifndef NFS
38     #define NFS 1
39     #endif
40 greg 2.9 /* set the following to 0 to forgo forking */
41     #ifndef MAXFORK
42 greg 2.12 #if NFS
43 greg 2.10 #define MAXFORK 3 /* allotment of duped processes */
44 greg 2.12 #else
45     #define MAXFORK 0
46 greg 2.9 #endif
47 greg 2.12 #endif
48 greg 2.18 /* protection from SYSV signals(!) */
49 greg 2.27 #if defined(sgi)
50 greg 2.18 #define guard_io() sighold(SIGALRM)
51     #define unguard() sigrelse(SIGALRM)
52     #endif
53     #ifndef guard_io
54 schorsch 2.43 #define guard_io()
55     #define unguard()
56 greg 2.18 #endif
57 gregl 2.34
58 greg 2.37 extern char *strerror();
59 gregl 2.34
60 greg 2.1 /* rpict command */
61 greg 2.23 char *rpargv[128] = {"rpict", "-S", "1"};
62     int rpargc = 3;
63 greg 2.1 FILE *torp, *fromrp;
64 greg 2.8 COLR *pbuf;
65 greg 2.1 /* our view parameters */
66     VIEW ourview = STDVIEW;
67 greg 2.4 double pixaspect = 1.0;
68 greg 2.23 int hres = 1024, vres = 1024, hmult = 4, vmult = 4;
69 greg 2.1 /* output file */
70     char *outfile = NULL;
71     int outfd;
72     long scanorig;
73 greg 2.25 FILE *syncfp = NULL; /* synchronization file pointer */
74     int synclst = F_UNLCK; /* synchronization file lock status */
75 greg 2.9 int nforked = 0;
76 greg 2.1
77 greg 2.25 #define sflock(t) if ((t)!=synclst) dolock(fileno(syncfp),synclst=t)
78    
79 greg 2.1 char *progname;
80     int verbose = 0;
81 greg 2.31 unsigned timelim = 0;
82 greg 2.25 int rvrlim = -1;
83 greg 2.1
84 greg 2.6 int gotalrm = 0;
85 schorsch 2.38 void onalrm(int i) { gotalrm++; }
86 greg 2.1
87 schorsch 2.43 static void dolock(int fd, int ltyp);
88     static void init(int ac, char **av);
89     static int nextpiece(int *xp, int *yp);
90     static int rvrpiece(int *xp, int *yp);
91     static int cleanup(int rstat);
92     static void rpiece(void);
93     static int putpiece(int xpos, int ypos);
94     static void filerr(char *t);
95 greg 2.6
96 schorsch 2.43
97     int
98     main(
99     int argc,
100     char *argv[]
101     )
102 greg 2.1 {
103     register int i, rval;
104    
105     progname = argv[0];
106     for (i = 1; i < argc; i++) {
107 greg 2.22 /* expand arguments */
108 greg 2.37 while ((rval = expandarg(&argc, &argv, i)) > 0)
109     ;
110     if (rval < 0) {
111     fprintf(stderr, "%s: cannot expand '%s'",
112     argv[0], argv[i]);
113     exit(1);
114     }
115 greg 2.1 if (argv[i][0] == '-')
116     switch (argv[i][1]) {
117     case 'v':
118     switch (argv[i][2]) {
119     case '\0': /* verbose option */
120     verbose = !verbose;
121     continue;
122     case 'f': /* view file */
123     if (viewfile(argv[++i], &ourview, NULL) <= 0) {
124     fprintf(stderr,
125     "%s: not a view file\n", argv[i]);
126     exit(1);
127     }
128     continue;
129     default: /* view option? */
130     rval = getviewopt(&ourview, argc-i, argv+i);
131     if (rval >= 0) {
132     i += rval;
133     continue;
134     }
135     break;
136     }
137     break;
138     case 'p': /* pixel aspect ratio? */
139 greg 2.23 if (argv[i][2] != 'a' || argv[i][3])
140     break;
141 gregl 2.35 pixaspect = atof(argv[++i]);
142 greg 2.23 continue;
143 greg 2.31 case 'T': /* time limit (hours) */
144     if (argv[i][2])
145     break;
146     timelim = atof(argv[++i])*3600. + .5;
147     break;
148 greg 2.23 case 'x': /* overall x resolution */
149     if (argv[i][2])
150     break;
151     hres = atoi(argv[++i]);
152     continue;
153     case 'y': /* overall y resolution */
154     if (argv[i][2])
155     break;
156     vres = atoi(argv[++i]);
157     continue;
158 greg 2.1 case 'X': /* horizontal multiplier */
159     if (argv[i][2])
160     break;
161     hmult = atoi(argv[++i]);
162     continue;
163     case 'Y': /* vertical multiplier */
164     if (argv[i][2])
165     break;
166     vmult = atoi(argv[++i]);
167     continue;
168 greg 2.25 case 'R': /* recover */
169     if (argv[i][2])
170     break;
171     rvrlim = 0;
172     /* fall through */
173 greg 2.5 case 'F': /* syncronization file */
174     if (argv[i][2])
175     break;
176 greg 2.28 if ((syncfp =
177     fdopen(open(argv[++i],O_RDWR|O_CREAT,0666),"r+")) == NULL) {
178 greg 2.5 fprintf(stderr, "%s: cannot open\n",
179     argv[i]);
180     exit(1);
181     }
182     continue;
183 greg 2.15 case 'z': /* z-file ist verbotten */
184     fprintf(stderr, "%s: -z option not allowed\n",
185     argv[0]);
186     exit(1);
187 greg 2.1 case 'o': /* output file */
188     if (argv[i][2])
189     break;
190     outfile = argv[++i];
191     continue;
192 greg 2.23 } else if (i >= argc-1)
193     break;
194 greg 2.1 rpargv[rpargc++] = argv[i];
195     }
196 greg 2.23 if (i >= argc) {
197     fprintf(stderr, "%s: missing octree argument\n", argv[0]);
198     exit(1);
199     }
200 greg 2.1 if (outfile == NULL) {
201     fprintf(stderr, "%s: missing output file\n", argv[0]);
202     exit(1);
203     }
204     init(argc, argv);
205     rpiece();
206 greg 2.15 exit(cleanup(0));
207 greg 2.1 }
208    
209    
210 schorsch 2.43 static void
211     dolock( /* lock or unlock a file */
212     int fd,
213     int ltyp
214     )
215 greg 2.25 {
216     static struct flock fls; /* static so initialized to zeroes */
217    
218     fls.l_type = ltyp;
219     if (fcntl(fd, F_SETLKW, &fls) < 0) {
220 greg 2.28 fprintf(stderr, "%s: cannot lock/unlock file: %s\n",
221 greg 2.37 progname, strerror(errno));
222 greg 2.25 exit(1);
223     }
224     }
225    
226    
227 schorsch 2.43 static void
228     init( /* set up output file and start rpict */
229     int ac,
230     char **av
231     )
232 greg 2.1 {
233 greg 2.23 static char hrbuf[16], vrbuf[16];
234 greg 2.2 extern char VersionID[];
235 greg 2.1 char *err;
236     FILE *fp;
237     int hr, vr;
238 schorsch 2.39 SUBPROC rpd; /* since we don't close_process(), this can be local */
239 greg 2.1 /* set up view */
240     if ((err = setview(&ourview)) != NULL) {
241     fprintf(stderr, "%s: %s\n", progname, err);
242     exit(1);
243     }
244 greg 2.25 if (syncfp != NULL) {
245     sflock(F_RDLCK);
246     fscanf(syncfp, "%d %d", &hmult, &vmult);
247     sflock(F_UNLCK);
248 greg 2.5 }
249 greg 2.23 /* compute piece size */
250     hres /= hmult;
251     vres /= vmult;
252 greg 2.46 if (hres <= 0 || vres <= 0) {
253 greg 2.47 fprintf(stderr, "%s: illegal resolution/subdivision\n", progname);
254 greg 2.46 exit(1);
255     }
256 greg 2.1 normaspect(viewaspect(&ourview)*hmult/vmult, &pixaspect, &hres, &vres);
257 greg 2.23 sprintf(hrbuf, "%d", hres);
258     rpargv[rpargc++] = "-x"; rpargv[rpargc++] = hrbuf;
259     sprintf(vrbuf, "%d", vres);
260     rpargv[rpargc++] = "-y"; rpargv[rpargc++] = vrbuf;
261     rpargv[rpargc++] = "-pa"; rpargv[rpargc++] = "0";
262     rpargv[rpargc++] = av[ac-1];
263     rpargv[rpargc] = NULL;
264 greg 2.1 /* open output file */
265     if ((outfd = open(outfile, O_WRONLY|O_CREAT|O_EXCL, 0666)) >= 0) {
266 greg 2.25 dolock(outfd, F_WRLCK);
267 greg 2.1 if ((fp = fdopen(dup(outfd), "w")) == NULL)
268     goto filerr;
269 greg 2.29 newheader("RADIANCE", fp); /* create header */
270     printargs(ac, av, fp);
271 greg 2.2 fprintf(fp, "SOFTWARE= %s\n", VersionID);
272 greg 2.1 fputs(VIEWSTR, fp);
273     fprintview(&ourview, fp);
274     putc('\n', fp);
275     if (pixaspect < .99 || pixaspect > 1.01)
276     fputaspect(pixaspect, fp);
277     fputformat(COLRFMT, fp);
278     putc('\n', fp);
279     fprtresolu(hres*hmult, vres*vmult, fp);
280     } else if ((outfd = open(outfile, O_RDWR)) >= 0) {
281 greg 2.25 dolock(outfd, F_RDLCK);
282 greg 2.1 if ((fp = fdopen(dup(outfd), "r+")) == NULL)
283     goto filerr;
284 greg 2.13 getheader(fp, NULL, NULL); /* skip header */
285 greg 2.15 if (!fscnresolu(&hr, &vr, fp) || /* check resolution */
286 greg 2.1 hr != hres*hmult || vr != vres*vmult) {
287 greg 2.8 fprintf(stderr, "%s: resolution mismatch on file \"%s\"\n",
288     progname, outfile);
289 greg 2.1 exit(1);
290     }
291     } else {
292 greg 2.8 fprintf(stderr, "%s: cannot open file \"%s\"\n",
293     progname, outfile);
294 greg 2.1 exit(1);
295     }
296     scanorig = ftell(fp); /* record position of first scanline */
297     if (fclose(fp) == -1) /* done with stream i/o */
298     goto filerr;
299 greg 2.25 dolock(outfd, F_UNLCK);
300 greg 2.1 /* start rpict process */
301 schorsch 2.39 if (open_process(&rpd, rpargv) <= 0) {
302 greg 2.3 fprintf(stderr, "%s: cannot start %s\n", progname, rpargv[0]);
303 greg 2.1 exit(1);
304     }
305 schorsch 2.39 if ((fromrp = fdopen(rpd.r, "r")) == NULL ||
306     (torp = fdopen(rpd.w, "w")) == NULL) {
307 greg 2.1 fprintf(stderr, "%s: cannot open stream to %s\n",
308     progname, rpargv[0]);
309     exit(1);
310     }
311 greg 2.23 if ((pbuf = (COLR *)bmalloc(hres*vres*sizeof(COLR))) == NULL) {
312 greg 2.1 fprintf(stderr, "%s: out of memory\n", progname);
313     exit(1);
314     }
315 greg 2.6 signal(SIGALRM, onalrm);
316 greg 2.31 if (timelim)
317     alarm(timelim);
318 greg 2.1 return;
319     filerr:
320 greg 2.8 fprintf(stderr, "%s: i/o error on file \"%s\"\n", progname, outfile);
321 greg 2.1 exit(1);
322     }
323    
324    
325 schorsch 2.43 static int
326     nextpiece( /* get next piece assignment */
327     int *xp,
328     int *yp
329     )
330 greg 2.5 {
331 greg 2.6 if (gotalrm) /* someone wants us to quit */
332     return(0);
333 greg 2.25 if (syncfp != NULL) { /* use sync file */
334     /*
335     * So we don't necessarily have to lock and unlock the file
336     * multiple times (very slow), we establish an exclusive
337     * lock at the beginning on our synchronization file and
338     * maintain it in the subroutine rvrpiece().
339     */
340     sflock(F_WRLCK);
341     fseek(syncfp, 0L, 0); /* read position */
342     if (fscanf(syncfp, "%*d %*d %d %d", xp, yp) < 2) {
343 greg 2.8 *xp = hmult-1;
344     *yp = vmult;
345     }
346 greg 2.25 if (rvrlim == 0) /* initialize recovery limit */
347     rvrlim = *xp*vmult + *yp;
348     if (rvrpiece(xp, yp)) { /* do stragglers first */
349     sflock(F_UNLCK);
350     return(1);
351     }
352 greg 2.8 if (--(*yp) < 0) { /* decrement position */
353 greg 2.5 *yp = vmult-1;
354 greg 2.25 if (--(*xp) < 0) { /* all done */
355     sflock(F_UNLCK);
356 greg 2.5 return(0);
357     }
358     }
359 greg 2.25 fseek(syncfp, 0L, 0); /* write new position */
360     fprintf(syncfp, "%4d %4d\n%4d %4d\n\n", hmult, vmult, *xp, *yp);
361     fflush(syncfp);
362     sflock(F_UNLCK); /* release sync file */
363 greg 2.5 return(1);
364     }
365 greg 2.26 return(scanf("%d %d", xp, yp) == 2); /* use stdin */
366 greg 2.5 }
367    
368    
369 schorsch 2.43 static int
370     rvrpiece( /* check for recoverable pieces */
371     register int *xp,
372     register int *yp
373     )
374 greg 2.25 {
375     static char *pdone = NULL; /* which pieces are done */
376     static long readpos = -1; /* how far we've read */
377     register int i;
378     /*
379     * This routine is called by nextpiece() with an
380     * exclusive lock on syncfp and the file pointer at the
381     * appropriate position to read in the finished pieces.
382     */
383     if (rvrlim < 0)
384     return(0); /* only check if asked */
385     if (pdone == NULL) /* first call */
386     pdone = calloc(hmult*vmult, sizeof(char));
387 greg 2.30 if (pdone == NULL) {
388     fprintf(stderr, "%s: out of memory\n", progname);
389     exit(1);
390     }
391 greg 2.25 if (readpos != -1) /* mark what's been done */
392     fseek(syncfp, readpos, 0);
393     while (fscanf(syncfp, "%d %d", xp, yp) == 2)
394     pdone[*xp*vmult+*yp] = 1;
395     if (!feof(syncfp)) {
396     fprintf(stderr, "%s: format error in sync file\n", progname);
397     exit(1);
398     }
399     readpos = ftell(syncfp);
400     i = hmult*vmult; /* find an unaccounted for piece */
401     while (i-- > rvrlim)
402     if (!pdone[i]) {
403     *xp = i / vmult;
404     *yp = i % vmult;
405     pdone[i] = 1; /* consider it done */
406     return(1);
407     }
408     rvrlim = -1; /* nothing left to recover */
409     free(pdone);
410     pdone = NULL;
411     return(0);
412     }
413    
414    
415 schorsch 2.43 static int
416     cleanup( /* close rpict process and clean up */
417     int rstat
418     )
419 greg 2.1 {
420 greg 2.10 int status;
421 greg 2.1
422 greg 2.23 bfree((char *)pbuf, hres*vres*sizeof(COLR));
423 greg 2.1 fclose(torp);
424     fclose(fromrp);
425 greg 2.10 while (wait(&status) != -1)
426 greg 2.9 if (rstat == 0)
427     rstat = status>>8 & 0xff;
428     return(rstat);
429 greg 2.1 }
430    
431    
432 schorsch 2.43 static void
433     rpiece(void) /* render picture piece by piece */
434 greg 2.1 {
435     VIEW pview;
436     int xorg, yorg;
437 greg 2.11 /* compute view parameters */
438 schorsch 2.40 pview = ourview;
439 greg 2.11 switch (ourview.type) {
440     case VT_PER:
441 greg 2.48 pview.horiz = (2.*180./PI)*atan(
442     tan((PI/180./2.)*ourview.horiz)/hmult );
443     pview.vert = (2.*180./PI)*atan(
444     tan((PI/180./2.)*ourview.vert)/vmult );
445 greg 2.11 break;
446     case VT_PAR:
447     case VT_ANG:
448     pview.horiz = ourview.horiz / hmult;
449     pview.vert = ourview.vert / vmult;
450     break;
451 greg 2.32 case VT_CYL:
452     pview.horiz = ourview.horiz / hmult;
453 greg 2.48 pview.vert = (2.*180./PI)*atan(
454     tan((PI/180./2.)*ourview.vert)/vmult );
455 greg 2.32 break;
456 greg 2.11 case VT_HEM:
457 greg 2.48 pview.horiz = (2.*180./PI)*asin(
458     sin((PI/180./2.)*ourview.horiz)/hmult );
459     pview.vert = (2.*180./PI)*asin(
460     sin((PI/180./2.)*ourview.vert)/vmult );
461     break;
462     case VT_PLS:
463     pview.horiz = sin((PI/180./2.)*ourview.horiz) /
464     (1.0 + cos((PI/180./2.)*ourview.horiz)) / hmult;
465     pview.horiz *= pview.horiz;
466     pview.horiz = (2.*180./PI)*acos((1. - pview.horiz) /
467     (1. + pview.horiz));
468     pview.vert = sin((PI/180./2.)*ourview.vert) /
469     (1.0 + cos((PI/180./2.)*ourview.vert)) / vmult;
470     pview.vert *= pview.vert;
471     pview.vert = (2.*180./PI)*acos((1. - pview.vert) /
472     (1. + pview.vert));
473 greg 2.11 break;
474     default:
475     fprintf(stderr, "%s: unknown view type '-vt%c'\n",
476     progname, ourview.type);
477     exit(cleanup(1));
478     }
479     /* render each piece */
480 greg 2.5 while (nextpiece(&xorg, &yorg)) {
481 gregl 2.33 pview.hoff = ourview.hoff*hmult + xorg - 0.5*(hmult-1);
482     pview.voff = ourview.voff*vmult + yorg - 0.5*(vmult-1);
483 greg 2.1 fputs(VIEWSTR, torp);
484     fprintview(&pview, torp);
485     putc('\n', torp);
486 greg 2.11 fflush(torp); /* assigns piece to rpict */
487 greg 2.1 putpiece(xorg, yorg); /* place piece in output */
488     }
489     }
490    
491    
492 schorsch 2.43 static int
493     putpiece( /* get next piece from rpict */
494     int xpos,
495     int ypos
496     )
497 greg 2.1 {
498 greg 2.7 struct flock fls;
499 greg 2.9 int pid, status;
500 greg 2.1 int hr, vr;
501 greg 2.8 register int y;
502     /* check bounds */
503 schorsch 2.41 if ((xpos < 0) | (ypos < 0) | (xpos >= hmult) | (ypos >= vmult)) {
504 greg 2.5 fprintf(stderr, "%s: requested piece (%d,%d) out of range\n",
505     progname, xpos, ypos);
506 greg 2.10 exit(cleanup(1));
507 greg 2.5 }
508 greg 2.8 /* check header from rpict */
509 greg 2.18 guard_io();
510 greg 2.13 getheader(fromrp, NULL, NULL);
511 schorsch 2.41 if (!fscnresolu(&hr, &vr, fromrp) || (hr != hres) | (vr != vres)) {
512 greg 2.3 fprintf(stderr, "%s: resolution mismatch from %s\n",
513     progname, rpargv[0]);
514 greg 2.10 exit(cleanup(1));
515 greg 2.1 }
516 greg 2.24 if (verbose) { /* notify caller */
517     printf("%d %d begun\n", xpos, ypos);
518     fflush(stdout);
519     }
520 greg 2.18 unguard();
521 greg 2.8 /* load new piece into buffer */
522 greg 2.18 for (y = 0; y < vr; y++) {
523     guard_io();
524 greg 2.8 if (freadcolrs(pbuf+y*hr, hr, fromrp) < 0) {
525 greg 2.3 fprintf(stderr, "%s: read error from %s\n",
526     progname, rpargv[0]);
527 greg 2.10 exit(cleanup(1));
528 greg 2.1 }
529 greg 2.18 unguard();
530     }
531 greg 2.9 #if MAXFORK
532     /* fork so we don't slow rpict down */
533     if ((pid = fork()) > 0) {
534 greg 2.10 if (++nforked >= MAXFORK) {
535 greg 2.9 wait(&status); /* reap a child */
536     if (status)
537 greg 2.10 exit(cleanup(status>>8 & 0xff));
538 greg 2.9 nforked--;
539     }
540     return(pid);
541     }
542     #else
543     pid = -1; /* no forking */
544     #endif
545 greg 2.19 fls.l_start = scanorig +
546     ((long)(vmult-1-ypos)*vres*hmult+xpos)*hres*sizeof(COLR);
547 greg 2.12 #if NFS
548 greg 2.19 fls.l_len = ((long)(vres-1)*hmult+1)*hres*sizeof(COLR);
549 greg 2.8 /* lock file section so NFS doesn't mess up */
550     fls.l_whence = 0;
551     fls.l_type = F_WRLCK;
552 greg 2.26 if (fcntl(outfd, F_SETLKW, &fls) < 0)
553     filerr("lock");
554 greg 2.12 #endif
555 greg 2.8 /* write new piece to file */
556 greg 2.42 if (lseek(outfd, (off_t)fls.l_start, SEEK_SET) < 0)
557 greg 2.26 filerr("seek");
558 greg 2.9 if (hmult == 1) {
559     if (writebuf(outfd, (char *)pbuf,
560     vr*hr*sizeof(COLR)) != vr*hr*sizeof(COLR))
561 greg 2.26 filerr("write");
562 greg 2.9 } else
563     for (y = 0; y < vr; y++) {
564     if (writebuf(outfd, (char *)(pbuf+y*hr),
565     hr*sizeof(COLR)) != hr*sizeof(COLR))
566 greg 2.26 filerr("write");
567 greg 2.9 if (y < vr-1 && lseek(outfd,
568 greg 2.37 (off_t)(hmult-1)*hr*sizeof(COLR),
569 greg 2.42 SEEK_CUR) < 0)
570 greg 2.26 filerr("seek");
571 greg 2.1 }
572 greg 2.25 #if NFS
573     fls.l_type = F_UNLCK; /* release lock */
574 greg 2.26 if (fcntl(outfd, F_SETLKW, &fls) < 0)
575     filerr("lock");
576 greg 2.25 #endif
577 greg 2.32 if (verbose) { /* notify caller */
578     printf("%d %d done\n", xpos, ypos);
579     fflush(stdout);
580     }
581 greg 2.25 if (syncfp != NULL) { /* record what's been done */
582     sflock(F_WRLCK);
583     fseek(syncfp, 0L, 2); /* append index */
584     fprintf(syncfp, "%4d %4d\n", xpos, ypos);
585     fflush(syncfp);
586     /*** Unlock not necessary, since
587     sflock(F_UNLCK); _exit() or nextpiece() is next ***/
588 greg 2.20 }
589 greg 2.25 if (pid == -1) /* didn't fork or fork failed */
590 greg 2.9 return(0);
591 greg 2.25 _exit(0); /* else exit child process (releasing locks) */
592 greg 2.26 }
593    
594    
595 schorsch 2.43 static void
596     filerr( /* report file error and exit */
597     char *t
598     )
599 greg 2.26 {
600     fprintf(stderr, "%s: %s error on file \"%s\": %s\n",
601 greg 2.37 progname, t, outfile, strerror(errno));
602 greg 2.9 _exit(1);
603 greg 2.1 }
604 greg 2.16
605     #endif