47 |
|
#define guard_io() 0 |
48 |
|
#define unguard() 0 |
49 |
|
#endif |
50 |
+ |
|
51 |
+ |
#ifndef linux |
52 |
+ |
extern char *sys_errlist[]; |
53 |
+ |
#endif |
54 |
+ |
|
55 |
|
/* rpict command */ |
56 |
|
char *rpargv[128] = {"rpict", "-S", "1"}; |
57 |
|
int rpargc = 3; |
77 |
|
unsigned timelim = 0; |
78 |
|
int rvrlim = -1; |
79 |
|
|
75 |
– |
extern long lseek(), ftell(); |
76 |
– |
|
80 |
|
int gotalrm = 0; |
81 |
|
int onalrm() { gotalrm++; } |
82 |
|
|
122 |
|
case 'p': /* pixel aspect ratio? */ |
123 |
|
if (argv[i][2] != 'a' || argv[i][3]) |
124 |
|
break; |
125 |
< |
pixaspect = atof(argv[i+1]); |
125 |
> |
pixaspect = atof(argv[++i]); |
126 |
|
continue; |
127 |
|
case 'T': /* time limit (hours) */ |
128 |
|
if (argv[i][2]) |
196 |
|
int ltyp; |
197 |
|
{ |
198 |
|
static struct flock fls; /* static so initialized to zeroes */ |
196 |
– |
extern char *sys_errlist[]; |
199 |
|
|
200 |
|
fls.l_type = ltyp; |
201 |
|
if (fcntl(fd, F_SETLKW, &fls) < 0) { |
417 |
|
pview.horiz = ourview.horiz / hmult; |
418 |
|
pview.vert = ourview.vert / vmult; |
419 |
|
break; |
420 |
+ |
case VT_CYL: |
421 |
+ |
pview.horiz = ourview.horiz / hmult; |
422 |
+ |
pview.vert = 2.*180./PI*atan( |
423 |
+ |
tan(PI/180./2.*ourview.vert)/vmult ); |
424 |
+ |
break; |
425 |
|
case VT_HEM: |
426 |
|
pview.horiz = 2.*180./PI*asin( |
427 |
|
sin(PI/180./2.*ourview.horiz)/hmult ); |
435 |
|
} |
436 |
|
/* render each piece */ |
437 |
|
while (nextpiece(&xorg, &yorg)) { |
438 |
< |
pview.hoff = ourview.hoff + xorg - 0.5*(hmult-1); |
439 |
< |
pview.voff = ourview.voff + yorg - 0.5*(vmult-1); |
438 |
> |
pview.hoff = ourview.hoff*hmult + xorg - 0.5*(hmult-1); |
439 |
> |
pview.voff = ourview.voff*vmult + yorg - 0.5*(vmult-1); |
440 |
|
fputs(VIEWSTR, torp); |
441 |
|
fprintview(&pview, torp); |
442 |
|
putc('\n', torp); |
508 |
|
filerr("lock"); |
509 |
|
#endif |
510 |
|
/* write new piece to file */ |
511 |
< |
if (lseek(outfd, fls.l_start, 0) == -1) |
511 |
> |
if (lseek(outfd, fls.l_start, 0) < 0) |
512 |
|
filerr("seek"); |
513 |
|
if (hmult == 1) { |
514 |
|
if (writebuf(outfd, (char *)pbuf, |
521 |
|
filerr("write"); |
522 |
|
if (y < vr-1 && lseek(outfd, |
523 |
|
(long)(hmult-1)*hr*sizeof(COLR), |
524 |
< |
1) == -1) |
524 |
> |
1) < 0) |
525 |
|
filerr("seek"); |
526 |
|
} |
527 |
|
#if NFS |
529 |
|
if (fcntl(outfd, F_SETLKW, &fls) < 0) |
530 |
|
filerr("lock"); |
531 |
|
#endif |
532 |
+ |
if (verbose) { /* notify caller */ |
533 |
+ |
printf("%d %d done\n", xpos, ypos); |
534 |
+ |
fflush(stdout); |
535 |
+ |
} |
536 |
|
if (syncfp != NULL) { /* record what's been done */ |
537 |
|
sflock(F_WRLCK); |
538 |
|
fseek(syncfp, 0L, 2); /* append index */ |
541 |
|
/*** Unlock not necessary, since |
542 |
|
sflock(F_UNLCK); _exit() or nextpiece() is next ***/ |
543 |
|
} |
533 |
– |
if (verbose) { /* notify caller */ |
534 |
– |
printf("%d %d done\n", xpos, ypos); |
535 |
– |
fflush(stdout); |
536 |
– |
} |
544 |
|
if (pid == -1) /* didn't fork or fork failed */ |
545 |
|
return(0); |
546 |
|
_exit(0); /* else exit child process (releasing locks) */ |
550 |
|
filerr(t) /* report file error and exit */ |
551 |
|
char *t; |
552 |
|
{ |
546 |
– |
extern char *sys_errlist[]; |
547 |
– |
|
553 |
|
fprintf(stderr, "%s: %s error on file \"%s\": %s\n", |
554 |
|
progname, t, outfile, sys_errlist[errno]); |
555 |
|
_exit(1); |