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

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines