| 10 |
|
|
| 11 |
|
#include "standard.h" |
| 12 |
|
#include <fcntl.h> |
| 13 |
+ |
|
| 14 |
+ |
#ifndef F_SETLKW |
| 15 |
+ |
|
| 16 |
+ |
main(argc, argv) |
| 17 |
+ |
int argc; |
| 18 |
+ |
char *argv[]; |
| 19 |
+ |
{ |
| 20 |
+ |
fprintf(stderr, "%s: no NFS lock manager on this machine\n", argv[0]); |
| 21 |
+ |
exit(1); |
| 22 |
+ |
} |
| 23 |
+ |
|
| 24 |
+ |
#else |
| 25 |
+ |
|
| 26 |
|
#include <signal.h> |
| 27 |
|
#include "color.h" |
| 28 |
|
#include "view.h" |
| 39 |
|
#define MAXFORK 0 |
| 40 |
|
#endif |
| 41 |
|
#endif |
| 42 |
< |
|
| 42 |
> |
/* protection from SYSV signals(!) */ |
| 43 |
> |
#if defined(sgi) || defined(hpux) |
| 44 |
> |
#define guard_io() sighold(SIGALRM) |
| 45 |
> |
#define unguard() sigrelse(SIGALRM) |
| 46 |
> |
#endif |
| 47 |
> |
#ifndef guard_io |
| 48 |
> |
#define guard_io() 0 |
| 49 |
> |
#define unguard() 0 |
| 50 |
> |
#endif |
| 51 |
|
/* rpict command */ |
| 52 |
|
char *rpargv[128] = {"rpict", "-S", "1", "-x", "512", "-y", "512", "-pa", "1"}; |
| 53 |
|
int rpargc = 9; |
| 266 |
|
return(0); |
| 267 |
|
} |
| 268 |
|
} |
| 269 |
< |
sprintf(buf, "%d %d\n%d %d\n", hmult, vmult, *xp, *yp); |
| 269 |
> |
sprintf(buf, "%4d %4d\n%4d %4d\n", hmult, vmult, *xp, *yp); |
| 270 |
|
lseek(syncfd, 0L, 0); /* write new position */ |
| 271 |
|
write(syncfd, buf, strlen(buf)); |
| 272 |
|
fls.l_type = F_UNLCK; /* release sync file */ |
| 359 |
|
exit(cleanup(1)); |
| 360 |
|
} |
| 361 |
|
/* check header from rpict */ |
| 362 |
+ |
guard_io(); |
| 363 |
|
getheader(fromrp, NULL, NULL); |
| 364 |
|
if (!fscnresolu(&hr, &vr, fromrp) || hr != hres | vr != vres) { |
| 365 |
|
fprintf(stderr, "%s: resolution mismatch from %s\n", |
| 366 |
|
progname, rpargv[0]); |
| 367 |
|
exit(cleanup(1)); |
| 368 |
|
} |
| 369 |
+ |
unguard(); |
| 370 |
|
/* load new piece into buffer */ |
| 371 |
< |
for (y = 0; y < vr; y++) |
| 371 |
> |
for (y = 0; y < vr; y++) { |
| 372 |
> |
guard_io(); |
| 373 |
|
if (freadcolrs(pbuf+y*hr, hr, fromrp) < 0) { |
| 374 |
|
fprintf(stderr, "%s: read error from %s\n", |
| 375 |
|
progname, rpargv[0]); |
| 376 |
|
exit(cleanup(1)); |
| 377 |
|
} |
| 378 |
+ |
unguard(); |
| 379 |
+ |
} |
| 380 |
|
#if MAXFORK |
| 381 |
|
/* fork so we don't slow rpict down */ |
| 382 |
|
if ((pid = fork()) > 0) { |
| 431 |
|
fprintf(stderr, "%s: write error on file \"%s\"\n", progname, outfile); |
| 432 |
|
_exit(1); |
| 433 |
|
} |
| 434 |
+ |
|
| 435 |
+ |
#endif |