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"; |
241 |
|
nextpiece(xp, yp) /* get next piece assignment */ |
242 |
|
int *xp, *yp; |
243 |
|
{ |
244 |
– |
extern char *fgets(); |
244 |
|
struct flock fls; |
245 |
|
char buf[64]; |
246 |
|
|
335 |
|
putc('\n', torp); |
336 |
|
fflush(torp); /* assigns piece to rpict */ |
337 |
|
putpiece(xorg, yorg); /* place piece in output */ |
339 |
– |
if (verbose) { /* notify caller */ |
340 |
– |
printf("%d %d done\n", xorg, yorg); |
341 |
– |
fflush(stdout); |
342 |
– |
} |
338 |
|
} |
339 |
|
} |
340 |
|
|
386 |
|
#else |
387 |
|
pid = -1; /* no forking */ |
388 |
|
#endif |
389 |
< |
fls.l_len = (long)vres*hmult*hres*sizeof(COLR); |
390 |
< |
fls.l_start = scanorig + (vmult-1-ypos)*fls.l_len; |
389 |
> |
fls.l_start = scanorig + |
390 |
> |
((long)(vmult-1-ypos)*vres*hmult+xpos)*hres*sizeof(COLR); |
391 |
|
#if NFS |
392 |
+ |
fls.l_len = ((long)(vres-1)*hmult+1)*hres*sizeof(COLR); |
393 |
|
/* lock file section so NFS doesn't mess up */ |
394 |
|
fls.l_whence = 0; |
395 |
|
fls.l_type = F_WRLCK; |
396 |
|
fcntl(outfd, F_SETLKW, &fls); |
397 |
|
#endif |
398 |
|
/* write new piece to file */ |
399 |
< |
if (lseek(outfd, fls.l_start+(long)xpos*hres*sizeof(COLR), 0) == -1) |
399 |
> |
if (lseek(outfd, fls.l_start, 0) == -1) |
400 |
|
goto seekerr; |
401 |
|
if (hmult == 1) { |
402 |
|
if (writebuf(outfd, (char *)pbuf, |
412 |
|
1) == -1) |
413 |
|
goto seekerr; |
414 |
|
} |
415 |
< |
if (pid == -1) { /* fork failed */ |
415 |
> |
if (verbose) { /* notify caller */ |
416 |
> |
printf("%d %d done\n", xpos, ypos); |
417 |
> |
fflush(stdout); |
418 |
> |
} |
419 |
> |
if (pid == -1) { /* didn't fork or fork failed */ |
420 |
|
#if NFS |
421 |
|
fls.l_type = F_UNLCK; /* release lock */ |
422 |
|
fcntl(outfd, F_SETLKW, &fls); |