--- ray/src/util/rpiece.c 1992/08/21 12:31:27 2.12 +++ ray/src/util/rpiece.c 1993/01/29 11:56:09 2.16 @@ -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)); } @@ -171,8 +188,8 @@ char **av; } else if ((outfd = open(outfile, O_RDWR)) >= 0) { if ((fp = fdopen(dup(outfd), "r+")) == NULL) goto filerr; - getheader(fp, NULL); /* skip header */ - if (fscnresolu(&hr, &vr, fp) < 0 || /* check resolution */ + getheader(fp, NULL, NULL); /* skip header */ + if (!fscnresolu(&hr, &vr, fp) || /* check resolution */ hr != hres*hmult || vr != vres*vmult) { fprintf(stderr, "%s: resolution mismatch on file \"%s\"\n", progname, outfile); @@ -334,8 +351,8 @@ int xpos, ypos; exit(cleanup(1)); } /* check header from rpict */ - getheader(fromrp, NULL); - if (fscnresolu(&hr, &vr, fromrp) < 0 || hr != hres | vr != vres) { + getheader(fromrp, NULL, NULL); + 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