--- ray/src/util/rpiece.c 1992/11/12 10:13:35 2.13 +++ ray/src/util/rpiece.c 1993/02/20 17:07:35 2.17 @@ -10,6 +10,19 @@ static char SCCSid[] = "$SunId$ LBL"; #include "standard.h" #include + +#ifndef F_SETLKW + +main(argc, argv) +int argc; +char *argv[]; +{ + fprintf(stderr, "%s: no NFS lock manager on this machine\n", argv[0]); + exit(1); +} + +#else + #include #include "color.h" #include "view.h" @@ -109,12 +122,17 @@ char *argv[]; case 'F': /* syncronization file */ if (argv[i][2]) break; - if ((syncfd = open(argv[++i], O_RDWR)) < 0) { + if ((syncfd = open(argv[++i], + O_RDWR|O_CREAT, 0666)) < 0) { fprintf(stderr, "%s: cannot open\n", argv[i]); exit(1); } continue; + case 'z': /* z-file ist verbotten */ + fprintf(stderr, "%s: -z option not allowed\n", + argv[0]); + exit(1); case 'o': /* output file */ if (argv[i][2]) break; @@ -130,8 +148,7 @@ char *argv[]; } init(argc, argv); rpiece(); - rval = cleanup(0); - exit(rval); + exit(cleanup(0)); } @@ -172,7 +189,7 @@ char **av; if ((fp = fdopen(dup(outfd), "r+")) == NULL) goto filerr; getheader(fp, NULL, NULL); /* skip header */ - if (fscnresolu(&hr, &vr, fp) < 0 || /* check resolution */ + if (!fscnresolu(&hr, &vr, fp) || /* check resolution */ hr != hres*hmult || vr != vres*vmult) { fprintf(stderr, "%s: resolution mismatch on file \"%s\"\n", progname, outfile); @@ -241,7 +258,7 @@ int *xp, *yp; return(0); } } - sprintf(buf, "%d %d\n%d %d\n", hmult, vmult, *xp, *yp); + sprintf(buf, "%4d %4d\n%4d %4d\n", hmult, vmult, *xp, *yp); lseek(syncfd, 0L, 0); /* write new position */ write(syncfd, buf, strlen(buf)); fls.l_type = F_UNLCK; /* release sync file */ @@ -335,7 +352,7 @@ int xpos, ypos; } /* check header from rpict */ getheader(fromrp, NULL, NULL); - if (fscnresolu(&hr, &vr, fromrp) < 0 || hr != hres | vr != vres) { + if (!fscnresolu(&hr, &vr, fromrp) || hr != hres | vr != vres) { fprintf(stderr, "%s: resolution mismatch from %s\n", progname, rpargv[0]); exit(cleanup(1)); @@ -361,11 +378,11 @@ int xpos, ypos; #else pid = -1; /* no forking */ #endif + fls.l_len = (long)vres*hmult*hres*sizeof(COLR); + fls.l_start = scanorig + (vmult-1-ypos)*fls.l_len; #if NFS /* lock file section so NFS doesn't mess up */ fls.l_whence = 0; - fls.l_len = (long)vres*hmult*hres*sizeof(COLR); - fls.l_start = scanorig + (vmult-1-ypos)*fls.l_len; fls.l_type = F_WRLCK; fcntl(outfd, F_SETLKW, &fls); #endif @@ -401,3 +418,5 @@ writerr: fprintf(stderr, "%s: write error on file \"%s\"\n", progname, outfile); _exit(1); } + +#endif