94 |
|
|
95 |
|
#define renderopts (*setqopts[vscale(QUALITY)]) |
96 |
|
|
97 |
+ |
/* overture calculation file */ |
98 |
+ |
#ifdef NIX |
99 |
+ |
char overfile[] = "overture.raw"; |
100 |
+ |
#else |
101 |
+ |
char overfile[] = "/dev/null"; |
102 |
+ |
#endif |
103 |
+ |
|
104 |
|
extern long fdate(), time(); |
105 |
|
|
106 |
|
long scenedate; /* date of latest scene or object file */ |
107 |
|
long octreedate; /* date of octree */ |
108 |
+ |
long matdate; /* date of latest material file */ |
109 |
|
|
110 |
|
int explicate = 0; /* explicate variables */ |
111 |
|
int silent = 0; /* do work silently */ |
167 |
|
/* print all values if requested */ |
168 |
|
if (explicate) |
169 |
|
printvals(); |
170 |
< |
/* run simulation */ |
170 |
> |
/* build octree */ |
171 |
|
oconv(); |
172 |
+ |
/* check date on ambient file */ |
173 |
+ |
checkambfile(); |
174 |
+ |
/* run simulation */ |
175 |
|
renderopts(ropts); |
176 |
|
xferopts(ropts); |
177 |
|
if (rvdevice != NULL) |
206 |
|
char *rfname; |
207 |
|
{ |
208 |
|
FILE *fp; |
209 |
< |
char buf[256]; |
209 |
> |
char buf[512]; |
210 |
|
register char *cp; |
211 |
|
|
212 |
|
if (rfname == NULL) |
223 |
|
case '#': |
224 |
|
*cp = '\0'; |
225 |
|
break; |
226 |
+ |
default: |
227 |
+ |
continue; |
228 |
|
} |
229 |
|
break; |
230 |
|
} |
273 |
|
exit(1); |
274 |
|
} |
275 |
|
/* assign new value */ |
276 |
< |
cp = vp->value; i = vp->nass; |
277 |
< |
while (i--) |
278 |
< |
while (*cp++) |
279 |
< |
; |
280 |
< |
i = cp - vp->value; |
281 |
< |
vp->value = realloc(vp->value, i+n+1); |
276 |
> |
if (i = vp->nass) { |
277 |
> |
cp = vp->value; |
278 |
> |
while (i--) |
279 |
> |
while (*cp++) |
280 |
> |
; |
281 |
> |
i = cp - vp->value; |
282 |
> |
vp->value = realloc(vp->value, i+n+1); |
283 |
> |
} else |
284 |
> |
vp->value = malloc(n+1); |
285 |
|
if (vp->value == NULL) |
286 |
|
syserr(progname); |
287 |
|
strcpy(vp->value+i, ass); |
385 |
|
while (*fnames) { |
386 |
|
while (isspace(*fnames)) fnames++; |
387 |
|
cp = thisfile; |
388 |
< |
while (*fnames && !isspace(*fnames)) *cp++ = *fnames++; |
388 |
> |
while (*fnames && !isspace(*fnames)) |
389 |
> |
*cp++ = *fnames++; |
390 |
|
*cp = '\0'; |
391 |
|
if ((thisdate = fdate(thisfile)) < 0) |
392 |
|
syserr(thisfile); |
424 |
|
vnam(OCTREE), vnam(SCENE)); |
425 |
|
exit(1); |
426 |
|
} |
427 |
+ |
matdate = -1; |
428 |
+ |
if (vdef(MATERIAL)) |
429 |
+ |
matdate = checklast(vval(MATERIAL)); |
430 |
|
} |
431 |
|
|
432 |
|
|
508 |
|
register int i, j; |
509 |
|
|
510 |
|
for (i = 0; i < NVARS; i++) |
511 |
< |
for (j = 0; j < vv[i].nass; j++) |
512 |
< |
printf("%s= %s\n", vv[i].name, nvalue(vv+i, j)); |
511 |
> |
for (j = 0; j < vdef(i); j++) |
512 |
> |
printf("%s= %s\n", vnam(i), nvalue(vv+i, j)); |
513 |
|
fflush(stdout); |
514 |
|
} |
515 |
|
|
522 |
|
return; |
523 |
|
/* build command */ |
524 |
|
oconvopts(ocopts); |
525 |
< |
sprintf(combuf, "oconv%s %s %s > %s", ocopts, |
526 |
< |
vdef(MATERIAL) ? vval(MATERIAL) : "", |
527 |
< |
vval(SCENE), vval(OCTREE)); |
528 |
< |
if (!silent) { /* echo it */ |
529 |
< |
printf("\t%s\n", combuf); |
530 |
< |
fflush(stdout); |
531 |
< |
} |
532 |
< |
if (noaction) |
513 |
< |
return; |
514 |
< |
if (system(combuf)) { /* run it */ |
525 |
> |
if (vdef(MATERIAL)) |
526 |
> |
sprintf(combuf, "oconv%s %s %s > %s", ocopts, |
527 |
> |
vval(MATERIAL), vval(SCENE), vval(OCTREE)); |
528 |
> |
else |
529 |
> |
sprintf(combuf, "oconv%s %s > %s", ocopts, |
530 |
> |
vval(SCENE), vval(OCTREE)); |
531 |
> |
|
532 |
> |
if (runcom(combuf)) { /* run it */ |
533 |
|
fprintf(stderr, "%s: error generating octree\n\t%s removed\n", |
534 |
|
progname, vval(OCTREE)); |
535 |
|
unlink(vval(OCTREE)); |
561 |
|
} |
562 |
|
|
563 |
|
|
564 |
+ |
checkambfile() /* check date on ambient file */ |
565 |
+ |
{ |
566 |
+ |
long afdate; |
567 |
+ |
|
568 |
+ |
if (!vdef(AMBFILE)) |
569 |
+ |
return; |
570 |
+ |
if ((afdate = fdate(vval(AMBFILE))) < 0) |
571 |
+ |
return; |
572 |
+ |
if (octreedate > afdate | matdate > afdate) |
573 |
+ |
rmfile(vval(AMBFILE)); |
574 |
+ |
} |
575 |
+ |
|
576 |
+ |
|
577 |
|
double |
578 |
|
ambval() /* compute ambient value */ |
579 |
|
{ |
606 |
|
d *= 3./(siz[0]+siz[1]+siz[2]); |
607 |
|
switch (vscale(DETAIL)) { |
608 |
|
case LOW: |
609 |
< |
op = addarg(op, "-ps 16"); |
579 |
< |
op = addarg(op, "-dp 16"); |
609 |
> |
op = addarg(op, "-ps 16 -dp 16"); |
610 |
|
sprintf(op, " -ar %d", (int)(4*d)); |
611 |
|
op += strlen(op); |
612 |
|
break; |
613 |
|
case MEDIUM: |
614 |
< |
op = addarg(op, "-ps 8"); |
585 |
< |
op = addarg(op, "-dp 32"); |
614 |
> |
op = addarg(op, "-ps 8 -dp 32"); |
615 |
|
sprintf(op, " -ar %d", (int)(8*d)); |
616 |
|
op += strlen(op); |
617 |
|
break; |
618 |
|
case HIGH: |
619 |
< |
op = addarg(op, "-ps 4"); |
591 |
< |
op = addarg(op, "-dp 64"); |
619 |
> |
op = addarg(op, "-ps 4 -dp 64"); |
620 |
|
sprintf(op, " -ar %d", (int)(16*d)); |
621 |
|
op += strlen(op); |
622 |
|
break; |
624 |
|
op = addarg(op, "-pt .16"); |
625 |
|
if (vbool(PENUMBRAS)) |
626 |
|
op = addarg(op, "-ds .4"); |
627 |
< |
op = addarg(op, "-dt .2"); |
628 |
< |
op = addarg(op, "-dc .25"); |
629 |
< |
op = addarg(op, "-dr 0"); |
602 |
< |
op = addarg(op, "-sj 0"); |
603 |
< |
op = addarg(op, "-st .7"); |
604 |
< |
op = addarg(op, "-ab 0"); |
627 |
> |
else |
628 |
> |
op = addarg(op, "-ds 0"); |
629 |
> |
op = addarg(op, "-dt .2 -dc .25 -dr 0 -sj 0 -st .7"); |
630 |
|
if (vdef(AMBFILE)) { |
631 |
|
sprintf(op, " -af %s", vval(AMBFILE)); |
632 |
|
op += strlen(op); |
634 |
|
overture = 0; |
635 |
|
switch (vscale(VARIABILITY)) { |
636 |
|
case LOW: |
637 |
< |
op = addarg(op, "-aa .4"); |
613 |
< |
op = addarg(op, "-ad 32"); |
637 |
> |
op = addarg(op, "-aa .4 -ad 64"); |
638 |
|
break; |
639 |
|
case MEDIUM: |
640 |
< |
op = addarg(op, "-aa .3"); |
617 |
< |
op = addarg(op, "-ad 64"); |
640 |
> |
op = addarg(op, "-aa .3 -ad 128"); |
641 |
|
break; |
642 |
|
case HIGH: |
643 |
< |
op = addarg(op, "-aa .25"); |
621 |
< |
op = addarg(op, "-ad 128"); |
643 |
> |
op = addarg(op, "-aa .25 -ad 256"); |
644 |
|
break; |
645 |
|
} |
646 |
|
op = addarg(op, "-as 0"); |
647 |
|
d = ambval(); |
648 |
|
sprintf(op, " -av %.2g %.2g %.2g", d, d, d); |
649 |
|
op += strlen(op); |
650 |
< |
op = addarg(op, "-lr 3"); |
629 |
< |
op = addarg(op, "-lw .02"); |
650 |
> |
op = addarg(op, "-lr 3 -lw .02"); |
651 |
|
if (vdef(RENDER)) |
652 |
|
op = addarg(op, vval(RENDER)); |
653 |
|
} |
686 |
|
break; |
687 |
|
} |
688 |
|
op = addarg(op, "-pt .08"); |
689 |
< |
if (vbool(PENUMBRAS)) { |
690 |
< |
op = addarg(op, "-ds .2"); |
691 |
< |
op = addarg(op, "-dj .35"); |
671 |
< |
} else |
689 |
> |
if (vbool(PENUMBRAS)) |
690 |
> |
op = addarg(op, "-ds .2 -dj .35"); |
691 |
> |
else |
692 |
|
op = addarg(op, "-ds .3"); |
693 |
< |
op = addarg(op, "-dt .1"); |
694 |
< |
op = addarg(op, "-dc .5"); |
695 |
< |
op = addarg(op, "-dr 1"); |
696 |
< |
op = addarg(op, "-sj .7"); |
697 |
< |
op = addarg(op, "-st .15"); |
678 |
< |
sprintf(op, " -ab %d", overture=vint(INDIRECT)); |
679 |
< |
op += strlen(op); |
693 |
> |
op = addarg(op, "-dt .1 -dc .5 -dr 1 -sj .7 -st .15"); |
694 |
> |
if (overture = vint(INDIRECT)) { |
695 |
> |
sprintf(op, " -ab %d", overture); |
696 |
> |
op += strlen(op); |
697 |
> |
} |
698 |
|
if (vdef(AMBFILE)) { |
699 |
|
sprintf(op, " -af %s", vval(AMBFILE)); |
700 |
|
op += strlen(op); |
702 |
|
overture = 0; |
703 |
|
switch (vscale(VARIABILITY)) { |
704 |
|
case LOW: |
705 |
< |
op = addarg(op, "-aa .25"); |
688 |
< |
op = addarg(op, "-ad 128"); |
689 |
< |
op = addarg(op, "-as 0"); |
705 |
> |
op = addarg(op, "-aa .25 -ad 196 -as 0"); |
706 |
|
break; |
707 |
|
case MEDIUM: |
708 |
< |
op = addarg(op, "-aa .2"); |
693 |
< |
op = addarg(op, "-ad 300"); |
694 |
< |
op = addarg(op, "-as 64"); |
708 |
> |
op = addarg(op, "-aa .2 -ad 400 -as 64"); |
709 |
|
break; |
710 |
|
case HIGH: |
711 |
< |
op = addarg(op, "-aa .15"); |
698 |
< |
op = addarg(op, "-ad 500"); |
699 |
< |
op = addarg(op, "-as 128"); |
711 |
> |
op = addarg(op, "-aa .15 -ad 768 -as 196"); |
712 |
|
break; |
713 |
|
} |
714 |
|
d = ambval(); |
715 |
|
sprintf(op, " -av %.2g %.2g %.2g", d, d, d); |
716 |
|
op += strlen(op); |
717 |
< |
op = addarg(op, "-lr 6"); |
706 |
< |
op = addarg(op, "-lw .002"); |
717 |
> |
op = addarg(op, "-lr 6 -lw .002"); |
718 |
|
if (vdef(RENDER)) |
719 |
|
op = addarg(op, vval(RENDER)); |
720 |
|
} |
753 |
|
break; |
754 |
|
} |
755 |
|
op = addarg(op, "-pt .04"); |
756 |
< |
if (vbool(PENUMBRAS)) { |
757 |
< |
op = addarg(op, "-ds .1"); |
758 |
< |
op = addarg(op, "-dj .7"); |
748 |
< |
} else |
756 |
> |
if (vbool(PENUMBRAS)) |
757 |
> |
op = addarg(op, "-ds .1 -dj .7"); |
758 |
> |
else |
759 |
|
op = addarg(op, "-ds .2"); |
760 |
< |
op = addarg(op, "-dt .05"); |
751 |
< |
op = addarg(op, "-dc .75"); |
752 |
< |
op = addarg(op, "-dr 3"); |
753 |
< |
op = addarg(op, "-sj 1"); |
754 |
< |
op = addarg(op, "-st .03"); |
760 |
> |
op = addarg(op, "-dt .05 -dc .75 -dr 3 -sj 1 -st .03"); |
761 |
|
sprintf(op, " -ab %d", overture=vint(INDIRECT)+1); |
762 |
|
op += strlen(op); |
763 |
|
if (vdef(AMBFILE)) { |
767 |
|
overture = 0; |
768 |
|
switch (vscale(VARIABILITY)) { |
769 |
|
case LOW: |
770 |
< |
op = addarg(op, "-aa .15"); |
765 |
< |
op = addarg(op, "-ad 200"); |
766 |
< |
op = addarg(op, "-as 0"); |
770 |
> |
op = addarg(op, "-aa .15 -ad 256 -as 0"); |
771 |
|
break; |
772 |
|
case MEDIUM: |
773 |
< |
op = addarg(op, "-aa .125"); |
770 |
< |
op = addarg(op, "-ad 512"); |
771 |
< |
op = addarg(op, "-as 128"); |
773 |
> |
op = addarg(op, "-aa .125 -ad 512 -as 256"); |
774 |
|
break; |
775 |
|
case HIGH: |
776 |
< |
op = addarg(op, "-aa .08"); |
775 |
< |
op = addarg(op, "-ad 850"); |
776 |
< |
op = addarg(op, "-as 256"); |
776 |
> |
op = addarg(op, "-aa .08 -ad 1024 -as 512"); |
777 |
|
break; |
778 |
|
} |
779 |
|
d = ambval(); |
780 |
|
sprintf(op, " -av %.2g %.2g %.2g", d, d, d); |
781 |
|
op += strlen(op); |
782 |
< |
op = addarg(op, "-lr 12"); |
783 |
< |
op = addarg(op, "-lw .0005"); |
782 |
> |
op = addarg(op, "-lr 12 -lw .0005"); |
783 |
|
if (vdef(RENDER)) |
784 |
|
op = addarg(op, vval(RENDER)); |
785 |
|
} |
789 |
|
char *ro; |
790 |
|
{ |
791 |
|
int fd, n; |
792 |
+ |
register char *cp; |
793 |
|
|
794 |
|
n = strlen(ro); |
795 |
|
if (n < 2) |
796 |
|
return; |
797 |
|
if (vdef(OPTFILE)) { |
798 |
< |
if ((fd = open(vval(OPTFILE), O_WRONLY|O_CREAT|O_TRUNC, 0666)) == -1) |
798 |
> |
for (cp = ro; cp[1]; cp++) |
799 |
> |
if (isspace(cp[1]) && cp[2] == '-' && isalpha(cp[3])) |
800 |
> |
*cp = '\n'; |
801 |
> |
else |
802 |
> |
*cp = cp[1]; |
803 |
> |
*cp = '\n'; |
804 |
> |
fd = open(vval(OPTFILE), O_WRONLY|O_CREAT|O_TRUNC, 0666); |
805 |
> |
if (fd < 0 || write(fd, ro, n) != n || close(fd) < 0) |
806 |
|
syserr(vval(OPTFILE)); |
807 |
< |
if (write(fd, ro+1, n-1) != n-1) |
801 |
< |
syserr(vval(OPTFILE)); |
802 |
< |
write(fd, "\n", 1); |
803 |
< |
close(fd); |
804 |
< |
ro[0] = ' '; |
805 |
< |
ro[1] = '^'; |
806 |
< |
strcpy(ro+2, vval(OPTFILE)); |
807 |
> |
sprintf(ro, " @%s", vval(OPTFILE)); |
808 |
|
} |
809 |
|
#ifdef MSDOS |
810 |
|
else if (n > 50) { |
811 |
< |
register char *evp = bmalloc(n+6); |
811 |
< |
if (evp == NULL) |
812 |
< |
syserr(progname); |
813 |
< |
strcpy(evp, "ROPT="); |
814 |
< |
strcat(evp, ro); |
815 |
< |
if (putenv(evp) != 0) { |
816 |
< |
fprintf(stderr, "%s: out of environment space\n", |
817 |
< |
progname); |
818 |
< |
exit(1); |
819 |
< |
} |
811 |
> |
setenv("ROPT", ro+1); |
812 |
|
strcpy(ro, " $ROPT"); |
813 |
|
} |
814 |
|
#endif |
823 |
|
po = addarg(po, "-1 -e"); |
824 |
|
po = addarg(po, vval(EXPOSURE)); |
825 |
|
} |
826 |
< |
if (vscale(QUALITY) == HIGH) |
827 |
< |
po = addarg(po, "-r .65"); |
826 |
> |
switch (vscale(QUALITY)) { |
827 |
> |
case MEDIUM: |
828 |
> |
po = addarg(po, "-r 1"); |
829 |
> |
break; |
830 |
> |
case HIGH: |
831 |
> |
po = addarg(po, "-m .25"); |
832 |
> |
break; |
833 |
> |
} |
834 |
|
if (vdef(PFILT)) |
835 |
|
po = addarg(po, vval(PFILT)); |
836 |
|
} |
946 |
|
break; |
947 |
|
} |
948 |
|
} else { |
949 |
< |
while (*vs && !isspace(*vs)) /* else skip id */ |
950 |
< |
vs++; |
949 |
> |
while (!isspace(*vs)) /* else skip id */ |
950 |
> |
if (!*vs++) |
951 |
> |
return(NULL); |
952 |
|
if (upax) { /* specify up vector */ |
953 |
|
strcpy(cp, vup[upax+3]); |
954 |
|
cp += strlen(cp); |
955 |
|
} |
956 |
|
} |
957 |
< |
/* append any additional options */ |
958 |
< |
strcpy(cp, vs); |
957 |
> |
strcpy(cp, vs); /* append any additional options */ |
958 |
> |
#ifdef MSDOS |
959 |
> |
if (strlen(viewopts) > 40) { |
960 |
> |
setenv("VIEW", viewopts); |
961 |
> |
return("$VIEW"); |
962 |
> |
} |
963 |
> |
#endif |
964 |
|
return(viewopts); |
965 |
|
} |
966 |
|
|
968 |
|
char * |
969 |
|
getview(n, vn) /* get view n, or NULL if none */ |
970 |
|
int n; |
971 |
< |
char *vn; |
971 |
> |
char *vn; /* returned view name */ |
972 |
|
{ |
973 |
< |
register char *mv; |
973 |
> |
register char *mv = NULL; |
974 |
|
|
975 |
< |
if (viewselect != NULL) { |
975 |
> |
if (viewselect != NULL) { /* command-line selected */ |
976 |
|
if (n) /* only do one */ |
977 |
|
return(NULL); |
978 |
|
if (viewselect[0] == '-') { /* already specified */ |
991 |
|
return(specview(mv)); |
992 |
|
return(specview(viewselect)); /* standard view? */ |
993 |
|
} |
994 |
< |
if (vn != NULL && (mv = nvalue(vv+VIEW, n)) != NULL) { |
994 |
> |
mv = nvalue(vv+VIEW, n); /* use view n */ |
995 |
> |
if (vn != NULL & mv != NULL) { |
996 |
|
if (*mv != '-') |
997 |
|
while (*mv && !isspace(*mv)) |
998 |
|
*vn++ = *mv++; |
999 |
|
*vn = '\0'; |
1000 |
|
} |
1001 |
< |
return(specview(nvalue(vv+VIEW, n))); /* use view n */ |
1001 |
> |
return(specview(mv)); |
1002 |
|
} |
1003 |
|
|
1004 |
|
|
1011 |
|
if (rvdevice != NULL) |
1012 |
|
sprintf(combuf+strlen(combuf), "-o %s ", rvdevice); |
1013 |
|
strcat(combuf, vval(OCTREE)); |
1014 |
< |
if (!silent) { /* echo it */ |
1010 |
< |
printf("\t%s\n", combuf); |
1011 |
< |
fflush(stdout); |
1012 |
< |
} |
1013 |
< |
if (noaction) |
1014 |
< |
return; |
1015 |
< |
if (system(combuf)) { /* run it */ |
1014 |
> |
if (runcom(combuf)) { /* run it */ |
1015 |
|
fprintf(stderr, "%s: error running rview\n", progname); |
1016 |
|
exit(1); |
1017 |
|
} |
1026 |
|
char pfopts[128]; |
1027 |
|
char vs[32], *vw; |
1028 |
|
int vn, mult; |
1029 |
+ |
long lastdate; |
1030 |
|
/* get pfilt options */ |
1031 |
|
pfiltopts(pfopts); |
1032 |
|
/* get resolution, reporting */ |
1057 |
|
else |
1058 |
|
badvalue(REPORT); |
1059 |
|
} |
1060 |
< |
/* check date on ambient file */ |
1061 |
< |
if (vdef(AMBFILE)) { |
1062 |
< |
long afdate = fdate(vval(AMBFILE)); |
1063 |
< |
if (afdate >= 0 & octreedate > afdate) { |
1064 |
< |
if (!silent) |
1065 |
< |
#ifdef MSDOS |
1066 |
< |
printf("\tdel %s\n", vval(AMBFILE)); |
1067 |
< |
#else |
1068 |
< |
printf("\trm %s\n", vval(AMBFILE)); |
1069 |
< |
#endif |
1070 |
< |
if (!noaction) |
1071 |
< |
unlink(vval(AMBFILE)); |
1072 |
< |
} |
1073 |
< |
} |
1060 |
> |
/* get update time */ |
1061 |
> |
lastdate = octreedate > matdate ? octreedate : matdate; |
1062 |
|
/* do each view */ |
1063 |
|
vn = 0; |
1064 |
|
while ((vw = getview(vn++, vs)) != NULL) { |
1066 |
|
sprintf(vs, "%d", vn); |
1067 |
|
sprintf(picfile, "%s_%s.pic", vval(PICTURE), vs); |
1068 |
|
/* check date on picture */ |
1069 |
< |
if (fdate(picfile) > octreedate) |
1069 |
> |
if (fdate(picfile) >= lastdate) |
1070 |
|
continue; |
1071 |
|
/* build rpict command */ |
1072 |
|
sprintf(rawfile, "%s_%s.raw", vval(PICTURE), vs); |
1073 |
< |
if (fdate(rawfile) > octreedate) /* recover */ |
1073 |
> |
if (fdate(rawfile) >= octreedate) /* recover */ |
1074 |
|
sprintf(combuf, "rpict%s%s -ro %s %s", |
1075 |
|
rep, opts, rawfile, vval(OCTREE)); |
1076 |
|
else { |
1078 |
|
sprintf(combuf, |
1079 |
|
"rpict%s %s%s -x 64 -y 64 -ps 1 %s > %s", |
1080 |
|
rep, vw, opts, |
1081 |
< |
vval(OCTREE), rawfile); |
1082 |
< |
if (!silent) { |
1095 |
< |
printf("\t%s\n", combuf); |
1096 |
< |
fflush(stdout); |
1097 |
< |
} |
1098 |
< |
if (!noaction && system(combuf)) { |
1081 |
> |
vval(OCTREE), overfile); |
1082 |
> |
if (runcom(combuf)) { |
1083 |
|
fprintf(stderr, |
1084 |
< |
"%s: error in overture for view %s\n\t%s removed\n", |
1085 |
< |
progname, vs, rawfile); |
1102 |
< |
unlink(rawfile); |
1084 |
> |
"%s: error in overture for view %s\n", |
1085 |
> |
progname, vs); |
1086 |
|
exit(1); |
1087 |
|
} |
1088 |
+ |
#ifdef NIX |
1089 |
+ |
rmfile(overfile); |
1090 |
+ |
#endif |
1091 |
|
} |
1092 |
|
sprintf(combuf, "rpict%s %s %s%s %s > %s", |
1093 |
|
rep, vw, res, opts, |
1094 |
|
vval(OCTREE), rawfile); |
1095 |
|
} |
1096 |
< |
if (!silent) { /* echo rpict command */ |
1111 |
< |
printf("\t%s\n", combuf); |
1112 |
< |
fflush(stdout); |
1113 |
< |
} |
1114 |
< |
if (!noaction && system(combuf)) { /* run rpict */ |
1096 |
> |
if (runcom(combuf)) { /* run rpict */ |
1097 |
|
fprintf(stderr, "%s: error rendering view %s\n", |
1098 |
|
progname, vs); |
1099 |
|
exit(1); |
1105 |
|
else |
1106 |
|
sprintf(combuf, "pfilt%s %s > %s", pfopts, |
1107 |
|
rawfile, picfile); |
1108 |
< |
if (!silent) { /* echo pfilt command */ |
1127 |
< |
printf("\t%s\n", combuf); |
1128 |
< |
fflush(stdout); |
1129 |
< |
} |
1130 |
< |
if (!noaction && system(combuf)) { /* run pfilt */ |
1108 |
> |
if (runcom(combuf)) { /* run pfilt */ |
1109 |
|
fprintf(stderr, |
1110 |
|
"%s: error filtering view %s\n\t%s removed\n", |
1111 |
|
progname, vs, picfile); |
1113 |
|
exit(1); |
1114 |
|
} |
1115 |
|
/* remove raw file */ |
1116 |
< |
if (!silent) |
1116 |
> |
rmfile(rawfile); |
1117 |
> |
} |
1118 |
> |
} |
1119 |
> |
|
1120 |
> |
|
1121 |
> |
runcom(cs) /* run command */ |
1122 |
> |
char *cs; |
1123 |
> |
{ |
1124 |
> |
if (!silent) /* echo it */ |
1125 |
> |
printf("\t%s\n", cs); |
1126 |
> |
if (noaction) |
1127 |
> |
return(0); |
1128 |
> |
fflush(stdout); /* flush output and pass to shell */ |
1129 |
> |
return(system(cs)); |
1130 |
> |
} |
1131 |
> |
|
1132 |
> |
|
1133 |
> |
rmfile(fn) /* remove a file */ |
1134 |
> |
char *fn; |
1135 |
> |
{ |
1136 |
> |
if (!silent) |
1137 |
|
#ifdef MSDOS |
1138 |
< |
printf("\tdel %s\n", rawfile); |
1138 |
> |
printf("\tdel %s\n", fn); |
1139 |
|
#else |
1140 |
< |
printf("\trm %s\n", rawfile); |
1140 |
> |
printf("\trm -f %s\n", fn); |
1141 |
|
#endif |
1142 |
< |
if (!noaction) |
1143 |
< |
unlink(rawfile); |
1142 |
> |
if (noaction) |
1143 |
> |
return(0); |
1144 |
> |
return(unlink(fn)); |
1145 |
> |
} |
1146 |
> |
|
1147 |
> |
|
1148 |
> |
#ifdef MSDOS |
1149 |
> |
setenv(vname, value) /* set an environment variable */ |
1150 |
> |
char *vname, *value; |
1151 |
> |
{ |
1152 |
> |
register char *evp; |
1153 |
> |
|
1154 |
> |
evp = bmalloc(strlen(vname)+strlen(value)+2); |
1155 |
> |
if (evp == NULL) |
1156 |
> |
syserr(progname); |
1157 |
> |
sprintf(evp, "%s=%s", vname, value); |
1158 |
> |
if (putenv(evp) != 0) { |
1159 |
> |
fprintf(stderr, "%s: out of environment space\n", progname); |
1160 |
> |
exit(1); |
1161 |
|
} |
1162 |
+ |
if (!silent) |
1163 |
+ |
printf("set %s\n", evp); |
1164 |
|
} |
1165 |
+ |
#endif |
1166 |
|
|
1167 |
|
|
1168 |
|
badvalue(vc) /* report bad variable value and exit */ |