ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/rad.c
(Generate patch)

Comparing ray/src/util/rad.c (file contents):
Revision 2.4 by greg, Fri Mar 12 13:37:03 1993 UTC vs.
Revision 2.37 by greg, Sat Jan 1 09:16:50 1994 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1993 Regents of the University of California */
1 > /* Copyright (c) 1994 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 11 | Line 11 | static char SCCSid[] = "$SunId$ LBL";
11   #include "standard.h"
12   #include "paths.h"
13   #include <ctype.h>
14 + #include <sys/types.h>
15  
16  
17   typedef struct {
# Line 21 | Line 22 | typedef struct {
22          int     (*fixval)();    /* assignment checking function */
23   } VARIABLE;
24  
25 < int     onevalue(), catvalues();
25 > int     onevalue(), catvalues(), boolvalue(),
26 >        qualvalue(), fltvalue(), intvalue();
27  
28                                  /* variables */
29   #define OBJECT          0               /* object files */
30   #define SCENE           1               /* scene files */
31   #define MATERIAL        2               /* material files */
32 < #define RENDER          3               /* rendering options */
33 < #define OCONV           4               /* oconv options */
34 < #define PFILT           5               /* pfilt options */
35 < #define VIEW            6               /* view(s) for picture(s) */
36 < #define ZONE            7               /* simulation zone */
37 < #define QUALITY         8               /* desired rendering quality */
38 < #define OCTREE          9               /* octree file name */
39 < #define PICTURE         10              /* picture file name */
40 < #define AMBFILE         11              /* ambient file name */
41 < #define OPTFILE         12              /* rendering options file */
42 < #define EXPOSURE        13              /* picture exposure setting */
43 < #define RESOLUTION      14              /* maximum picture resolution */
44 < #define UP              15              /* view up (X, Y or Z) */
45 < #define INDIRECT        16              /* indirection in lighting */
46 < #define DETAIL          17              /* level of scene detail */
47 < #define PENUMBRAS       18              /* shadow penumbras are desired */
48 < #define VARIABILITY     19              /* level of light variability */
49 < #define REPORT          20              /* report frequency and errfile */
32 > #define ILLUM           3               /* mkillum input files */
33 > #define MKILLUM         4               /* mkillum options */
34 > #define RENDER          5               /* rendering options */
35 > #define OCONV           6               /* oconv options */
36 > #define PFILT           7               /* pfilt options */
37 > #define VIEW            8               /* view(s) for picture(s) */
38 > #define ZONE            9               /* simulation zone */
39 > #define QUALITY         10              /* desired rendering quality */
40 > #define OCTREE          11              /* octree file name */
41 > #define PICTURE         12              /* picture file name */
42 > #define AMBFILE         13              /* ambient file name */
43 > #define OPTFILE         14              /* rendering options file */
44 > #define EXPOSURE        15              /* picture exposure setting */
45 > #define RESOLUTION      16              /* maximum picture resolution */
46 > #define UP              17              /* view up (X, Y or Z) */
47 > #define INDIRECT        18              /* indirection in lighting */
48 > #define DETAIL          19              /* level of scene detail */
49 > #define PENUMBRAS       20              /* shadow penumbras are desired */
50 > #define VARIABILITY     21              /* level of light variability */
51 > #define REPORT          22              /* report frequency and errfile */
52                                  /* total number of variables */
53 < #define NVARS           21
53 > #define NVARS           23
54  
55   VARIABLE        vv[NVARS] = {           /* variable-value pairs */
56          {"objects",     3,      0,      NULL,   catvalues},
57          {"scene",       3,      0,      NULL,   catvalues},
58          {"materials",   3,      0,      NULL,   catvalues},
59 +        {"illum",       3,      0,      NULL,   catvalues},
60 +        {"mkillum",     3,      0,      NULL,   catvalues},
61          {"render",      3,      0,      NULL,   catvalues},
62          {"oconv",       3,      0,      NULL,   catvalues},
63          {"pfilt",       2,      0,      NULL,   catvalues},
64          {"view",        2,      0,      NULL,   NULL},
65          {"ZONE",        2,      0,      NULL,   onevalue},
66 <        {"QUALITY",     3,      0,      NULL,   onevalue},
66 >        {"QUALITY",     3,      0,      NULL,   qualvalue},
67          {"OCTREE",      3,      0,      NULL,   onevalue},
68          {"PICTURE",     3,      0,      NULL,   onevalue},
69          {"AMBFILE",     3,      0,      NULL,   onevalue},
70          {"OPTFILE",     3,      0,      NULL,   onevalue},
71 <        {"EXPOSURE",    3,      0,      NULL,   onevalue},
71 >        {"EXPOSURE",    3,      0,      NULL,   fltvalue},
72          {"RESOLUTION",  3,      0,      NULL,   onevalue},
73          {"UP",          2,      0,      NULL,   onevalue},
74 <        {"INDIRECT",    3,      0,      NULL,   onevalue},
75 <        {"DETAIL",      3,      0,      NULL,   onevalue},
76 <        {"PENUMBRAS",   3,      0,      NULL,   onevalue},
77 <        {"VARIABILITY", 3,      0,      NULL,   onevalue},
74 >        {"INDIRECT",    3,      0,      NULL,   intvalue},
75 >        {"DETAIL",      3,      0,      NULL,   qualvalue},
76 >        {"PENUMBRAS",   3,      0,      NULL,   boolvalue},
77 >        {"VARIABILITY", 3,      0,      NULL,   qualvalue},
78          {"REPORT",      3,      0,      NULL,   onevalue},
79   };
80  
81   VARIABLE        *matchvar();
82   char    *nvalue();
77 int     vscale();
83  
84   #define UPPER(c)        ((c)&~0x20)     /* ASCII trick */
85  
# Line 83 | Line 88 | int    vscale();
88   #define vval(vc)        (vv[vc].value)
89   #define vint(vc)        atoi(vval(vc))
90   #define vlet(vc)        UPPER(vval(vc)[0])
91 + #define vscale          vlet
92   #define vbool(vc)       (vlet(vc)=='T')
93  
94 < #define HIGH            2
95 < #define MEDIUM          1
96 < #define LOW             0
94 > #define HIGH            'H'
95 > #define MEDIUM          'M'
96 > #define LOW             'L'
97  
98 < int     lowqopts(), medqopts(), hiqopts();
99 < int     (*setqopts[3])() = {lowqopts, medqopts, hiqopts};
98 >                                /* overture calculation file */
99 > #ifdef NIX
100 > char    overfile[] = "overture.raw";
101 > #else
102 > char    overfile[] = "/dev/null";
103 > #endif
104  
105 < #define renderopts      (*setqopts[vscale(QUALITY)])
105 > extern time_t   fdate(), time();
106  
107 < extern long     fdate(), time();
107 > time_t  scenedate;              /* date of latest scene or object file */
108 > time_t  octreedate;             /* date of octree */
109 > time_t  matdate;                /* date of latest material file */
110 > time_t  illumdate;              /* date of last illum file */
111  
112 < long    scenedate;              /* date of latest scene or object file */
113 < long    octreedate;             /* date of octree */
112 > char    *oct0name;              /* name of pre-mkillum octree */
113 > time_t  oct0date;               /* date of pre-mkillum octree */
114 > char    *oct1name;              /* name of post-mkillum octree */
115 > time_t  oct1date;               /* date of post-mkillum octree (>= matdate) */
116  
117 + int     nowarn = 0;             /* no warnings */
118   int     explicate = 0;          /* explicate variables */
119   int     silent = 0;             /* do work silently */
120   int     noaction = 0;           /* don't do anything */
121 + int     sayview = 0;            /* print view out */
122   char    *rvdevice = NULL;       /* rview output device */
123   char    *viewselect = NULL;     /* specific view only */
124  
125   int     overture = 0;           /* overture calculation needed */
126  
127   char    *progname;              /* global argv[0] */
128 + char    *rifname;               /* global rad input file name */
129  
130   char    radname[MAXPATH];       /* root Radiance file name */
131  
# Line 135 | Line 153 | char   *argv[];
153                  case 'o':
154                          rvdevice = argv[++i];
155                          break;
156 +                case 'V':
157 +                        sayview++;
158 +                        break;
159                  case 'v':
160                          viewselect = argv[++i];
161                          break;
162 +                case 'w':
163 +                        nowarn++;
164 +                        break;
165                  default:
166                          goto userr;
167                  }
168          if (i >= argc)
169                  goto userr;
170 +        rifname = argv[i];
171                                  /* assign Radiance root file name */
172 <        rootname(radname, argv[i]);
172 >        rootname(radname, rifname);
173                                  /* load variable values */
174 <        load(argv[i]);
174 >        load(rifname);
175                                  /* get any additional assignments */
176          for (i++; i < argc; i++)
177                  setvariable(argv[i]);
# Line 159 | Line 184 | char   *argv[];
184                                  /* print all values if requested */
185          if (explicate)
186                  printvals();
187 <                                /* run simulation */
187 >                                /* build octree (and run mkillum) */
188          oconv();
189 +                                /* check date on ambient file */
190 +        checkambfile();
191 +                                /* run simulation */
192          renderopts(ropts);
193          xferopts(ropts);
194          if (rvdevice != NULL)
# Line 170 | Line 198 | char   *argv[];
198          exit(0);
199   userr:
200          fprintf(stderr,
201 <        "Usage: %s [-s][-n][-e][-v view][-o dev] rfile [VAR=value ..]\n",
201 >        "Usage: %s [-s][-n][-e][-V][-v view][-o dev] rfile [VAR=value ..]\n",
202                          progname);
203          exit(1);
204   }
# Line 191 | Line 219 | register char  *rn, *fn;
219   }
220  
221  
222 + #define NOCHAR  127             /* constant for character to delete */
223 +
224 +
225   load(rfname)                    /* load Radiance simulation file */
226   char    *rfname;
227   {
# Line 206 | Line 237 | char   *rfname;
237                  for (cp = buf; *cp; cp++) {
238                          switch (*cp) {
239                          case '\\':
240 <                        case '\n':
210 <                                *cp = ' ';
240 >                                *cp++ = NOCHAR;
241                                  continue;
242                          case '#':
243                                  *cp = '\0';
# Line 227 | Line 257 | setvariable(ass)               /* assign variable according to stri
257   register char   *ass;
258   {
259          char    varname[32];
260 +        int     n;
261          register char   *cp;
262          register VARIABLE       *vp;
263          register int    i;
233        int     n;
264  
265          while (isspace(*ass))           /* skip leading space */
266                  ass++;
# Line 244 | Line 274 | register char  *ass;
274                                          /* trim value */
275          while (isspace(*ass) || *ass == '=')
276                  ass++;
277 <        cp = ass + strlen(ass);
278 <        do
279 <                *cp-- = '\0';
280 <        while (cp >= ass && isspace(*cp));
251 <        n = cp - ass + 1;
252 <        if (!n) {
277 >        for (n = strlen(ass); n > 0; n--)
278 >                if (!isspace(ass[n-1]))
279 >                        break;
280 >        if (!n && !nowarn) {
281                  fprintf(stderr, "%s: warning - missing value for variable '%s'\n",
282                                  progname, varname);
283                  return;
# Line 273 | Line 301 | register char  *ass;
301                  vp->value = malloc(n+1);
302          if (vp->value == NULL)
303                  syserr(progname);
304 <        strcpy(vp->value+i, ass);
304 >        cp = vp->value+i;               /* copy value, squeezing spaces */
305 >        *cp = *ass;
306 >        for (i = 1; i <= n; i++) {
307 >                if (ass[i] == NOCHAR)
308 >                        continue;
309 >                if (isspace(*cp))
310 >                        while (isspace(ass[i]))
311 >                                i++;
312 >                *++cp = ass[i];
313 >        }
314 >        if (isspace(*cp))               /* remove trailing space */
315 >                *cp = '\0';
316          vp->nass++;
317   }
318  
# Line 299 | Line 338 | register int   n;
338   {
339          register char   *cp;
340  
341 <        if (vp == NULL || n < 0 || n >= vp->nass)
341 >        if (vp == NULL | n < 0 | n >= vp->nass)
342                  return(NULL);
343          cp = vp->value;
344          while (n--)
# Line 309 | Line 348 | register int   n;
348   }
349  
350  
312 int
313 vscale(vc)                      /* return scale for variable vc */
314 int     vc;
315 {
316        switch(vlet(vc)) {
317        case 'H':
318                return(HIGH);
319        case 'M':
320                return(MEDIUM);
321        case 'L':
322                return(LOW);
323        }
324        badvalue(vc);
325 }
326
327
351   checkvalues()                   /* check assignments */
352   {
353          register int    i;
# Line 340 | Line 363 | register VARIABLE      *vp;
363   {
364          if (vp->nass < 2)
365                  return;
366 <        fprintf(stderr, "%s: warning - multiple assignment of variable '%s'\n",
366 >        if (!nowarn)
367 >                fprintf(stderr,
368 >                "%s: warning - multiple assignment of variable '%s'\n",
369                          progname, vp->name);
370          do
371                  vp->value += strlen(vp->value)+1;
# Line 363 | Line 388 | register VARIABLE      *vp;
388   }
389  
390  
391 < long
391 > int
392 > badmatch(tv, cv)                /* case insensitive truncated comparison */
393 > register char   *tv, *cv;
394 > {
395 >        if (!*tv) return(1);            /* null string cannot match */
396 >        do
397 >                if (UPPER(*tv) != *cv++)
398 >                        return(1);
399 >        while (*++tv);
400 >        return(0);              /* OK */
401 > }
402 >
403 >
404 > boolvalue(vp)                   /* check boolean for legal values */
405 > register VARIABLE       *vp;
406 > {
407 >        if (!vp->nass) return;
408 >        onevalue(vp);
409 >        switch (UPPER(vp->value[0])) {
410 >        case 'T':
411 >                if (badmatch(vp->value, "TRUE")) break;
412 >                return;
413 >        case 'F':
414 >                if (badmatch(vp->value, "FALSE")) break;
415 >                return;
416 >        }
417 >        fprintf(stderr, "%s: illegal value for boolean variable '%s'\n",
418 >                        progname, vp->name);
419 >        exit(1);
420 > }
421 >
422 >
423 > qualvalue(vp)                   /* check qualitative var. for legal values */
424 > register VARIABLE       *vp;
425 > {
426 >        if (!vp->nass) return;
427 >        onevalue(vp);
428 >        switch (UPPER(vp->value[0])) {
429 >        case 'L':
430 >                if (badmatch(vp->value, "LOW")) break;
431 >                return;
432 >        case 'M':
433 >                if (badmatch(vp->value, "MEDIUM")) break;
434 >                return;
435 >        case 'H':
436 >                if (badmatch(vp->value, "HIGH")) break;
437 >                return;
438 >        }
439 >        fprintf(stderr, "%s: illegal value for qualitative variable '%s'\n",
440 >                        progname, vp->name);
441 >        exit(1);
442 > }
443 >
444 >
445 > intvalue(vp)                    /* check integer variable for legal values */
446 > register VARIABLE       *vp;
447 > {
448 >        if (!vp->nass) return;
449 >        onevalue(vp);
450 >        if (isint(vp->value)) return;
451 >        fprintf(stderr, "%s: illegal value for integer variable '%s'\n",
452 >                        progname, vp->name);
453 >        exit(1);
454 > }
455 >
456 >
457 > fltvalue(vp)                    /* check float variable for legal values */
458 > register VARIABLE       *vp;
459 > {
460 >        if (!vp->nass) return;
461 >        onevalue(vp);
462 >        if (isflt(vp->value)) return;
463 >        fprintf(stderr, "%s: illegal value for real variable '%s'\n",
464 >                        progname, vp->name);
465 >        exit(1);
466 > }
467 >
468 >
469 > time_t
470   checklast(fnames)                       /* check files and find most recent */
471   register char   *fnames;
472   {
473          char    thisfile[MAXPATH];
474 <        long    thisdate, lastdate = -1;
474 >        time_t  thisdate, lastdate = 0;
475          register char   *cp;
476  
477 +        if (fnames == NULL)
478 +                return(0);
479          while (*fnames) {
480                  while (isspace(*fnames)) fnames++;
481                  cp = thisfile;
482                  while (*fnames && !isspace(*fnames))
483                          *cp++ = *fnames++;
484                  *cp = '\0';
485 <                if ((thisdate = fdate(thisfile)) < 0)
485 >                if (!(thisdate = fdate(thisfile)))
486                          syserr(thisfile);
487                  if (thisdate > lastdate)
488                          lastdate = thisdate;
# Line 386 | Line 491 | register char  *fnames;
491   }
492  
493  
494 + char *
495 + newfname(orig, pred)            /* create modified file name */
496 + char    *orig;
497 + int     pred;
498 + {
499 +        extern char     *rindex();
500 +        register char   *cp;
501 +        register int    n;
502 +        int     suffix;
503 +
504 +        n = 0; cp = orig; suffix = -1;          /* suffix position, length */
505 +        while (*cp) {
506 +                if (*cp == '.') suffix = n;
507 +                else if (ISDIRSEP(*cp)) suffix = -1;
508 +                cp++; n++;
509 +        }
510 +        if (suffix == -1) suffix = n;
511 +        if ((cp = bmalloc(n+2)) == NULL)
512 +                syserr(progname);
513 +        strncpy(cp, orig, suffix);
514 +        cp[suffix] = pred;                      /* root name + pred + suffix */
515 +        strcpy(cp+suffix+1, orig+suffix);
516 +        return(cp);
517 + }
518 +
519 +
520   checkfiles()                    /* check for existence and modified times */
521   {
522 <        char    *cp;
392 <        long    objdate;
522 >        time_t  objdate;
523  
524          if (!vdef(OCTREE)) {
525 <                if ((cp = bmalloc(strlen(radname)+5)) == NULL)
525 >                if ((vval(OCTREE) = bmalloc(strlen(radname)+5)) == NULL)
526                          syserr(progname);
527 <                sprintf(cp, "%s.oct", radname);
398 <                vval(OCTREE) = cp;
527 >                sprintf(vval(OCTREE), "%s.oct", radname);
528                  vdef(OCTREE)++;
529          }
530          octreedate = fdate(vval(OCTREE));
531 <        scenedate = -1;
532 <        if (vdef(SCENE)) {
533 <                scenedate = checklast(vval(SCENE));
534 <                if (vdef(OBJECT)) {
535 <                        objdate = checklast(vval(OBJECT));
536 <                        if (objdate > scenedate)
537 <                                scenedate = objdate;
538 <                }
539 <        }
540 <        if (octreedate < 0 & scenedate < 0) {
541 <                fprintf(stderr, "%s: need '%s' or '%s'\n", progname,
542 <                                vnam(OCTREE), vnam(SCENE));
531 >        if (vdef(ILLUM)) {              /* illum requires secondary octrees */
532 >                oct0name = newfname(vval(OCTREE), '0');
533 >                oct1name = newfname(vval(OCTREE), '1');
534 >                oct0date = fdate(oct0name);
535 >                oct1date = fdate(oct1name);
536 >        } else
537 >                oct0name = oct1name = vval(OCTREE);
538 >        if ((scenedate = checklast(vval(SCENE))) &&
539 >                        (objdate = checklast(vval(OBJECT))) > scenedate)
540 >                scenedate = objdate;
541 >        illumdate = checklast(vval(ILLUM));
542 >        if (!octreedate & !scenedate & !illumdate) {
543 >                fprintf(stderr, "%s: need '%s' or '%s' or '%s'\n", progname,
544 >                                vnam(OCTREE), vnam(SCENE), vnam(ILLUM));
545                  exit(1);
546          }
547 +        matdate = checklast(vval(MATERIAL));
548   }      
549  
550  
# Line 421 | Line 553 | double org[3], *sizp;
553   {
554          extern FILE     *popen();
555          static double   oorg[3], osiz = 0.;
556 <        char    buf[MAXPATH+16];
556 >        double  min[3], max[3];
557 >        char    buf[512];
558          FILE    *fp;
559 +        register int    i;
560  
561 <        if (osiz <= FTINY) {
562 <                oconv();                /* does nothing if done already */
563 <                sprintf(buf, "getinfo -d < %s", vval(OCTREE));
564 <                if ((fp = popen(buf, "r")) == NULL)
565 <                        syserr("getinfo");
566 <                if (fscanf(fp, "%lf %lf %lf %lf", &oorg[0], &oorg[1],
567 <                                &oorg[2], &osiz) != 4) {
568 <                        fprintf(stderr,
561 >        if (osiz <= FTINY)
562 >                if (noaction && fdate(oct1name) <
563 >                                (scenedate>illumdate?scenedate:illumdate)) {
564 >                                                        /* run getbbox */
565 >                        sprintf(buf, "getbbox -w -h %s",
566 >                                vdef(SCENE) ? vval(SCENE) : vval(ILLUM));
567 >                        if ((fp = popen(buf, "r")) == NULL)
568 >                                syserr("getbbox");
569 >                        if (fscanf(fp, "%lf %lf %lf %lf %lf %lf",
570 >                                        &min[0], &max[0], &min[1], &max[1],
571 >                                        &min[2], &max[2]) != 6) {
572 >                                fprintf(stderr,
573 >                        "%s: error reading bounding box from getbbox\n",
574 >                                                progname);
575 >                                exit(1);
576 >                        }
577 >                        for (i = 0; i < 3; i++)
578 >                                if (max[i] - min[i] > osiz)
579 >                                        osiz = max[i] - min[i];
580 >                        for (i = 0; i < 3; i++)
581 >                                oorg[i] = (max[i]+min[i]-osiz)*.5;
582 >                        pclose(fp);
583 >                } else {                                /* from octree */
584 >                        oconv();        /* does nothing if done already */
585 >                        sprintf(buf, "getinfo -d < %s", oct1name);
586 >                        if ((fp = popen(buf, "r")) == NULL)
587 >                                syserr("getinfo");
588 >                        if (fscanf(fp, "%lf %lf %lf %lf", &oorg[0], &oorg[1],
589 >                                        &oorg[2], &osiz) != 4) {
590 >                                fprintf(stderr,
591                          "%s: error reading bounding cube from getinfo\n",
592 <                                        progname);
593 <                        exit(1);
592 >                                                progname);
593 >                                exit(1);
594 >                        }
595 >                        pclose(fp);
596                  }
439                pclose(fp);
440        }
597          org[0] = oorg[0]; org[1] = oorg[1]; org[2] = oorg[2]; *sizp = osiz;
598   }
599  
# Line 491 | Line 647 | setdefaults()                  /* set default values for unassigned v
647  
648   printvals()                     /* print variable values */
649   {
650 <        register int    i, j;
650 >        int     i, j, clipline;
651 >        register char   *cp;
652 >        register int    k;
653  
654 <        for (i = 0; i < NVARS; i++)
655 <                for (j = 0; j < vdef(i); j++)
656 <                        printf("%s= %s\n", vnam(i), nvalue(vv+i, j));
654 >        for (i = 0; i < NVARS; i++)             /* print each variable */
655 >            for (j = 0; j < vdef(i); j++) {     /* print each assignment */
656 >                fputs(vnam(i), stdout);
657 >                fputs("= ", stdout);
658 >                k = clipline = ( vv[i].fixval == catvalues ? 64 : 320 )
659 >                                - strlen(vnam(i)) ;
660 >                cp = nvalue(vv+i, j);
661 >                while (*cp) {
662 >                    putchar(*cp++);
663 >                    if (--k <= 0) {             /* line too long */
664 >                        while (*cp && !isspace(*cp))
665 >                            putchar(*cp++);     /* finish this word */
666 >                        if (*cp) {              /* start new line */
667 >                            putchar('\n');
668 >                            fputs(vnam(i), stdout);
669 >                            putchar('=');
670 >                            k = clipline;
671 >                        }
672 >                    }
673 >                }
674 >                putchar('\n');
675 >            }
676          fflush(stdout);
677   }
678  
679  
680 < oconv()                         /* run oconv if necessary */
680 > oconv()                         /* run oconv and mkillum if necessary */
681   {
682 <        char    combuf[512], ocopts[64];
682 >        static char     illumtmp[] = "ilXXXXXX";
683 >        char    combuf[512], ocopts[64], mkopts[64];
684  
685 <        if (octreedate >= scenedate)    /* check dates */
686 <                return;
687 <                                        /* build command */
688 <        oconvopts(ocopts);
689 <        if (vdef(MATERIAL))
512 <                sprintf(combuf, "oconv%s %s %s > %s", ocopts,
685 >        oconvopts(ocopts);              /* get options */
686 >        if (octreedate < scenedate) {   /* check date on original octree */
687 >                                                /* build command */
688 >                if (vdef(MATERIAL))
689 >                        sprintf(combuf, "oconv%s %s %s > %s", ocopts,
690                                  vval(MATERIAL), vval(SCENE), vval(OCTREE));
691 +                else
692 +                        sprintf(combuf, "oconv%s %s > %s", ocopts,
693 +                                        vval(SCENE), vval(OCTREE));
694 +                
695 +                if (runcom(combuf)) {           /* run it */
696 +                        fprintf(stderr,
697 +                                "%s: error generating octree\n\t%s removed\n",
698 +                                        progname, vval(OCTREE));
699 +                        unlink(vval(OCTREE));
700 +                        exit(1);
701 +                }
702 +                octreedate = time((time_t *)NULL);
703 +        }
704 +        if (oct1name == vval(OCTREE))           /* no mkillum? */
705 +                oct1date = octreedate > matdate ? octreedate : matdate;
706 +        if (oct1date >= octreedate & oct1date >= matdate
707 +                        & oct1date >= illumdate)        /* all done */
708 +                return;
709 +                                                /* make octree0 */
710 +        if (oct0date < scenedate | oct0date < illumdate) {
711 +                                                /* build command */
712 +                if (octreedate)
713 +                        sprintf(combuf, "oconv%s -i %s %s > %s", ocopts,
714 +                                vval(OCTREE), vval(ILLUM), oct0name);
715 +                else if (vdef(MATERIAL))
716 +                        sprintf(combuf, "oconv%s %s %s > %s", ocopts,
717 +                                vval(MATERIAL), vval(ILLUM), oct0name);
718 +                else
719 +                        sprintf(combuf, "oconv%s %s > %s", ocopts,
720 +                                vval(ILLUM), oct0name);
721 +                if (runcom(combuf)) {           /* run it */
722 +                        fprintf(stderr,
723 +                                "%s: error generating octree\n\t%s removed\n",
724 +                                        progname, oct0name);
725 +                        unlink(oct0name);
726 +                        exit(1);
727 +                }
728 +                oct0date = time((time_t *)NULL);
729 +        }
730 +        mkillumopts(mkopts);                    /* build mkillum command */
731 +        mktemp(illumtmp);
732 +        sprintf(combuf, "mkillum%s %s \"<\" %s > %s", mkopts,
733 +                        oct0name, vval(ILLUM), illumtmp);
734 +        if (runcom(combuf)) {                   /* run it */
735 +                fprintf(stderr, "%s: error running mkillum\n", progname);
736 +                unlink(illumtmp);
737 +                exit(1);
738 +        }
739 +                                                /* make octree1 (frozen) */
740 +        if (octreedate)
741 +                sprintf(combuf, "oconv%s -f -i %s %s > %s", ocopts,
742 +                        vval(OCTREE), illumtmp, oct1name);
743 +        else if (vdef(MATERIAL))
744 +                sprintf(combuf, "oconv%s -f %s %s > %s", ocopts,
745 +                        vval(MATERIAL), illumtmp, oct1name);
746          else
747 <                sprintf(combuf, "oconv%s %s > %s", ocopts,
748 <                                vval(SCENE), vval(OCTREE));
517 <        
747 >                sprintf(combuf, "oconv%s -f %s > %s", ocopts,
748 >                        illumtmp, oct1name);
749          if (runcom(combuf)) {           /* run it */
750 <                fprintf(stderr, "%s: error generating octree\n\t%s removed\n",
751 <                                progname, vval(OCTREE));
752 <                unlink(vval(OCTREE));
750 >                fprintf(stderr,
751 >                        "%s: error generating octree\n\t%s removed\n",
752 >                                progname, oct1name);
753 >                unlink(oct1name);
754                  exit(1);
755          }
756 <        octreedate = time(0);
756 >        oct1date = time((time_t *)NULL);
757 >        rmfile(illumtmp);
758   }
759  
760  
# Line 547 | Line 780 | register char  *oo;
780   }
781  
782  
783 + mkillumopts(mo)                         /* get mkillum options */
784 + register char   *mo;
785 + {
786 +        /* BEWARE:  This may be called via setdefaults(), so no assumptions */
787 +
788 +        *mo = '\0';
789 +        if (vdef(MKILLUM))
790 +                addarg(mo, vval(MKILLUM));
791 + }
792 +
793 +
794 + checkambfile()                  /* check date on ambient file */
795 + {
796 +        time_t  afdate;
797 +
798 +        if (!vdef(AMBFILE))
799 +                return;
800 +        if (!(afdate = fdate(vval(AMBFILE))))
801 +                return;
802 +        if (oct1date > afdate)
803 +                rmfile(vval(AMBFILE));
804 + }
805 +
806 +
807   double
808   ambval()                                /* compute ambient value */
809   {
810          if (vdef(EXPOSURE)) {
811                  if (vval(EXPOSURE)[0] == '+' || vval(EXPOSURE)[0] == '-')
812                          return(.5/pow(2.,atof(vval(EXPOSURE))));
813 <                if (isdigit(vval(EXPOSURE)[0]) || vval(EXPOSURE)[0] == '.')
557 <                        return(.5/atof(vval(EXPOSURE)));
558 <                badvalue(EXPOSURE);
813 >                return(.5/atof(vval(EXPOSURE)));
814          }
815          if (vlet(ZONE) == 'E')
816                  return(10.);
# Line 565 | Line 820 | ambval()                               /* compute ambient value */
820   }
821  
822  
823 + renderopts(op)                          /* set rendering options */
824 + char    *op;
825 + {
826 +        switch(vscale(QUALITY)) {
827 +        case LOW:
828 +                lowqopts(op);
829 +                break;
830 +        case MEDIUM:
831 +                medqopts(op);
832 +                break;
833 +        case HIGH:
834 +                hiqopts(op);
835 +                break;
836 +        }
837 + }
838 +
839 +
840   lowqopts(op)                            /* low quality rendering options */
841   register char   *op;
842   {
# Line 579 | Line 851 | register char  *op;
851          d *= 3./(siz[0]+siz[1]+siz[2]);
852          switch (vscale(DETAIL)) {
853          case LOW:
854 <                op = addarg(op, "-ps 16 -dp 16");
854 >                op = addarg(op, "-ps 16 -dp 64");
855                  sprintf(op, " -ar %d", (int)(4*d));
856                  op += strlen(op);
857                  break;
858          case MEDIUM:
859 <                op = addarg(op, "-ps 8 -dp 32");
859 >                op = addarg(op, "-ps 8 -dp 128");
860                  sprintf(op, " -ar %d", (int)(8*d));
861                  op += strlen(op);
862                  break;
863          case HIGH:
864 <                op = addarg(op, "-ps 4 -dp 64");
864 >                op = addarg(op, "-ps 4 -dp 256");
865                  sprintf(op, " -ar %d", (int)(16*d));
866                  op += strlen(op);
867                  break;
# Line 599 | Line 871 | register char  *op;
871                  op = addarg(op, "-ds .4");
872          else
873                  op = addarg(op, "-ds 0");
874 <        op = addarg(op, "-dt .2 -dc .25 -dr 0 -sj 0 -st .7");
874 >        op = addarg(op, "-dt .2 -dc .25 -dr 0 -sj 0 -st .5");
875          if (vdef(AMBFILE)) {
876                  sprintf(op, " -af %s", vval(AMBFILE));
877                  op += strlen(op);
# Line 607 | Line 879 | register char  *op;
879                  overture = 0;
880          switch (vscale(VARIABILITY)) {
881          case LOW:
882 <                op = addarg(op, "-aa .4 -ad 32");
882 >                op = addarg(op, "-aa .4 -ad 64");
883                  break;
884          case MEDIUM:
885 <                op = addarg(op, "-aa .3 -ad 64");
885 >                op = addarg(op, "-aa .3 -ad 128");
886                  break;
887          case HIGH:
888 <                op = addarg(op, "-aa .25 -ad 128");
888 >                op = addarg(op, "-aa .25 -ad 256");
889                  break;
890          }
891          op = addarg(op, "-as 0");
# Line 641 | Line 913 | register char  *op;
913          switch (vscale(DETAIL)) {
914          case LOW:
915                  op = addarg(op, vbool(PENUMBRAS) ? "-ps 4" : "-ps 8");
916 <                op = addarg(op, "-dp 64");
916 >                op = addarg(op, "-dp 256");
917                  sprintf(op, " -ar %d", (int)(8*d));
918                  op += strlen(op);
919                  break;
920          case MEDIUM:
921                  op = addarg(op, vbool(PENUMBRAS) ? "-ps 3" : "-ps 6");
922 <                op = addarg(op, "-dp 128");
922 >                op = addarg(op, "-dp 512");
923                  sprintf(op, " -ar %d", (int)(16*d));
924                  op += strlen(op);
925                  break;
926          case HIGH:
927                  op = addarg(op, vbool(PENUMBRAS) ? "-ps 2" : "-ps 4");
928 <                op = addarg(op, "-dp 256");
928 >                op = addarg(op, "-dp 1024");
929                  sprintf(op, " -ar %d", (int)(32*d));
930                  op += strlen(op);
931                  break;
932          }
933          op = addarg(op, "-pt .08");
934          if (vbool(PENUMBRAS))
935 <                op = addarg(op, "-ds .2 -dj .35");
935 >                op = addarg(op, "-ds .2 -dj .5");
936          else
937                  op = addarg(op, "-ds .3");
938 <        op = addarg(op, "-dt .1 -dc .5 -dr 1 -sj .7 -st .15");
939 <        sprintf(op, " -ab %d", overture=vint(INDIRECT));
940 <        op += strlen(op);
938 >        op = addarg(op, "-dt .1 -dc .5 -dr 1 -sj .7 -st .1");
939 >        if (overture = vint(INDIRECT)) {
940 >                sprintf(op, " -ab %d", overture);
941 >                op += strlen(op);
942 >        }
943          if (vdef(AMBFILE)) {
944                  sprintf(op, " -af %s", vval(AMBFILE));
945                  op += strlen(op);
# Line 673 | Line 947 | register char  *op;
947                  overture = 0;
948          switch (vscale(VARIABILITY)) {
949          case LOW:
950 <                op = addarg(op, "-aa .25 -ad 128 -as 0");
950 >                op = addarg(op, "-aa .25 -ad 196 -as 0");
951                  break;
952          case MEDIUM:
953 <                op = addarg(op, "-aa .2 -ad 300 -as 64");
953 >                op = addarg(op, "-aa .2 -ad 400 -as 64");
954                  break;
955          case HIGH:
956 <                op = addarg(op, "-aa .15 -ad 500 -as 128");
956 >                op = addarg(op, "-aa .15 -ad 768 -as 196");
957                  break;
958          }
959          d = ambval();
# Line 706 | Line 980 | register char  *op;
980          switch (vscale(DETAIL)) {
981          case LOW:
982                  op = addarg(op, vbool(PENUMBRAS) ? "-ps 1" : "-ps 8");
983 <                op = addarg(op, "-dp 256");
983 >                op = addarg(op, "-dp 1024");
984                  sprintf(op, " -ar %d", (int)(16*d));
985                  op += strlen(op);
986                  break;
987          case MEDIUM:
988                  op = addarg(op, vbool(PENUMBRAS) ? "-ps 1" : "-ps 5");
989 <                op = addarg(op, "-dp 512");
989 >                op = addarg(op, "-dp 2048");
990                  sprintf(op, " -ar %d", (int)(32*d));
991                  op += strlen(op);
992                  break;
993          case HIGH:
994                  op = addarg(op, vbool(PENUMBRAS) ? "-ps 1" : "-ps 3");
995 <                op = addarg(op, "-dp 1024");
995 >                op = addarg(op, "-dp 4096");
996                  sprintf(op, " -ar %d", (int)(64*d));
997                  op += strlen(op);
998                  break;
# Line 728 | Line 1002 | register char  *op;
1002                  op = addarg(op, "-ds .1 -dj .7");
1003          else
1004                  op = addarg(op, "-ds .2");
1005 <        op = addarg(op, "-dt .05 -dc .75 -dr 3 -sj 1 -st .03");
1005 >        op = addarg(op, "-dt .05 -dc .75 -dr 3 -sj 1 -st .01");
1006          sprintf(op, " -ab %d", overture=vint(INDIRECT)+1);
1007          op += strlen(op);
1008          if (vdef(AMBFILE)) {
# Line 738 | Line 1012 | register char  *op;
1012                  overture = 0;
1013          switch (vscale(VARIABILITY)) {
1014          case LOW:
1015 <                op = addarg(op, "-aa .15 -ad 200 -as 0");
1015 >                op = addarg(op, "-aa .15 -ad 256 -as 0");
1016                  break;
1017          case MEDIUM:
1018 <                op = addarg(op, "-aa .125 -ad 512 -as 128");
1018 >                op = addarg(op, "-aa .125 -ad 512 -as 256");
1019                  break;
1020          case HIGH:
1021 <                op = addarg(op, "-aa .08 -ad 850 -as 256");
1021 >                op = addarg(op, "-aa .08 -ad 1024 -as 512");
1022                  break;
1023          }
1024          d = ambval();
# Line 760 | Line 1034 | xferopts(ro)                           /* transfer options if indicated */
1034   char    *ro;
1035   {
1036          int     fd, n;
1037 +        register char   *cp;
1038          
1039          n = strlen(ro);
1040          if (n < 2)
1041                  return;
1042          if (vdef(OPTFILE)) {
1043 <                if ((fd = open(vval(OPTFILE), O_WRONLY|O_CREAT|O_TRUNC, 0666)) == -1)
1043 >                for (cp = ro; cp[1]; cp++)
1044 >                        if (isspace(cp[1]) && cp[2] == '-' && isalpha(cp[3]))
1045 >                                *cp = '\n';
1046 >                        else
1047 >                                *cp = cp[1];
1048 >                *cp = '\n';
1049 >                fd = open(vval(OPTFILE), O_WRONLY|O_CREAT|O_TRUNC, 0666);
1050 >                if (fd < 0 || write(fd, ro, n) != n || close(fd) < 0)
1051                          syserr(vval(OPTFILE));
1052 <                if (write(fd, ro+1, n-1) != n-1)
771 <                        syserr(vval(OPTFILE));
772 <                write(fd, "\n", 1);
773 <                close(fd);
774 <                sprintf(ro, " \"^%s\"", vval(OPTFILE));
1052 >                sprintf(ro, " @%s", vval(OPTFILE));
1053          }
1054   #ifdef MSDOS
1055          else if (n > 50) {
1056 <                register char   *evp = bmalloc(n+6);
779 <                if (evp == NULL)
780 <                        syserr(progname);
781 <                strcpy(evp, "ROPT=");
782 <                strcat(evp, ro);
783 <                if (putenv(evp) != 0) {
784 <                        fprintf(stderr, "%s: out of environment space\n",
785 <                                        progname);
786 <                        exit(1);
787 <                }
1056 >                setenv("ROPT", ro+1);
1057                  strcpy(ro, " $ROPT");
1058          }
1059   #endif
# Line 799 | Line 1068 | register char  *po;
1068                  po = addarg(po, "-1 -e");
1069                  po = addarg(po, vval(EXPOSURE));
1070          }
1071 <        if (vscale(QUALITY) == HIGH)
1072 <                po = addarg(po, "-r .65");
1071 >        switch (vscale(QUALITY)) {
1072 >        case MEDIUM:
1073 >                po = addarg(po, "-r 1");
1074 >                break;
1075 >        case HIGH:
1076 >                po = addarg(po, "-m .25");
1077 >                break;
1078 >        }
1079          if (vdef(PFILT))
1080                  po = addarg(po, vval(PFILT));
1081   }
# Line 924 | Line 1199 | register char  *vs;
1199                          cp += strlen(cp);
1200                  }
1201          }
1202 <                                        /* append any additional options */
1202 >        if (cp == viewopts)             /* append any additional options */
1203 >                vs++;           /* skip prefixed space if unneeded */
1204          strcpy(cp, vs);
1205 + #ifdef MSDOS
1206 +        if (strlen(viewopts) > 40) {
1207 +                setenv("VIEW", viewopts);
1208 +                return("$VIEW");
1209 +        }
1210 + #endif
1211          return(viewopts);
1212   }
1213  
# Line 933 | Line 1215 | register char  *vs;
1215   char *
1216   getview(n, vn)                          /* get view n, or NULL if none */
1217   int     n;
1218 < char    *vn;
1218 > char    *vn;            /* returned view name */
1219   {
1220          register char   *mv;
1221  
1222 <        if (viewselect != NULL) {
1222 >        if (viewselect != NULL) {               /* command-line selected */
1223                  if (n)                          /* only do one */
1224                          return(NULL);
1225                  if (viewselect[0] == '-') {     /* already specified */
# Line 950 | Line 1232 | char   *vn;
1232                                  ;
1233                          *vn = '\0';
1234                  }
1235 +                                                /* view number? */
1236 +                if (isint(viewselect))
1237 +                        return(specview(nvalue(vv+VIEW, atoi(viewselect)-1)));
1238                                                  /* check list */
1239                  while ((mv = nvalue(vv+VIEW, n++)) != NULL)
1240                          if (matchword(viewselect, mv))
1241                                  return(specview(mv));
1242                  return(specview(viewselect));   /* standard view? */
1243          }
1244 <        if (vn != NULL && (mv = nvalue(vv+VIEW, n)) != NULL) {
1245 <                if (*mv != '-')
1246 <                        while (*mv && !isspace(*mv))
1247 <                                *vn++ = *mv++;
1244 >        mv = nvalue(vv+VIEW, n);                /* use view n */
1245 >        if (vn != NULL & mv != NULL) {
1246 >                register char   *mv2 = mv;
1247 >                if (*mv2 != '-')
1248 >                        while (*mv2 && !isspace(*mv2))
1249 >                                *vn++ = *mv2++;
1250                  *vn = '\0';
1251          }
1252 <        return(specview(nvalue(vv+VIEW, n)));   /* use view n */
1252 >        return(specview(mv));
1253   }
1254  
1255  
1256 + printview(vopts)                        /* print out selected view */
1257 + register char   *vopts;
1258 + {
1259 +        extern char     *atos(), *getenv();
1260 +        char    buf[256];
1261 +        FILE    *fp;
1262 +        register char   *cp;
1263 +
1264 +        if (vopts == NULL)
1265 +                return(-1);
1266 +        fputs("VIEW=", stdout);
1267 +        do {
1268 +                if (matchword(vopts, "-vf")) {          /* expand view file */
1269 +                        vopts = sskip(vopts);
1270 +                        if (!*atos(buf, sizeof(buf), vopts))
1271 +                                return(-1);
1272 +                        if ((fp = fopen(buf, "r")) == NULL)
1273 +                                return(-1);
1274 +                        for (buf[sizeof(buf)-2] = '\n';
1275 +                                        fgets(buf, sizeof(buf), fp) != NULL &&
1276 +                                                buf[0] != '\n';
1277 +                                        buf[sizeof(buf)-2] = '\n') {
1278 +                                if (buf[sizeof(buf)-2] != '\n') {
1279 +                                        ungetc(buf[sizeof(buf)-2], fp);
1280 +                                        buf[sizeof(buf)-2] = '\0';
1281 +                                }
1282 +                                if (matchword(buf, "VIEW=") ||
1283 +                                                matchword(buf, "rview")) {
1284 +                                        for (cp = sskip(buf); *cp && *cp != '\n'; cp++)
1285 +                                                putchar(*cp);
1286 +                                }
1287 +                        }
1288 +                        fclose(fp);
1289 +                        vopts = sskip(vopts);
1290 +                } else {
1291 +                        while (isspace(*vopts))
1292 +                                vopts++;
1293 +                        putchar(' ');
1294 + #ifdef MSDOS
1295 +                        if (*vopts == '$') {            /* expand env. var. */
1296 +                                if (!*atos(buf, sizeof(buf), vopts+1))
1297 +                                        return(-1);
1298 +                                if ((cp = getenv(buf)) == NULL)
1299 +                                        return(-1);
1300 +                                fputs(cp, stdout);
1301 +                                vopts = sskip(vopts);
1302 +                        } else
1303 + #endif
1304 +                                while (*vopts && !isspace(*vopts))
1305 +                                        putchar(*vopts++);
1306 +                }
1307 +        } while (*vopts++);
1308 +        putchar('\n');
1309 +        return(0);
1310 + }
1311 +
1312 +
1313   rview(opts)                             /* run rview with first view */
1314   char    *opts;
1315   {
1316 +        char    *vw;
1317          char    combuf[512];
1318                                          /* build command */
1319 <        sprintf(combuf, "rview %s%s ", getview(0, NULL), opts);
1319 >        if ((vw = getview(0, NULL)) == NULL)
1320 >                return;
1321 >        if (sayview)
1322 >                printview(vw);
1323 >        sprintf(combuf, "rview %s%s -R %s ", vw, opts, rifname);
1324          if (rvdevice != NULL)
1325                  sprintf(combuf+strlen(combuf), "-o %s ", rvdevice);
1326 <        strcat(combuf, vval(OCTREE));
1326 >        if (vdef(EXPOSURE))
1327 >                sprintf(combuf+strlen(combuf), "-pe %s ", vval(EXPOSURE));
1328 >        strcat(combuf, oct1name);
1329          if (runcom(combuf)) {           /* run it */
1330                  fprintf(stderr, "%s: error running rview\n", progname);
1331                  exit(1);
# Line 993 | Line 1344 | char   *opts;
1344                                          /* get pfilt options */
1345          pfiltopts(pfopts);
1346                                          /* get resolution, reporting */
1347 <        mult = vscale(QUALITY)+1;
1347 >        switch (vscale(QUALITY)) {
1348 >        case LOW:
1349 >                mult = 1;
1350 >                break;
1351 >        case MEDIUM:
1352 >                mult = 2;
1353 >                break;
1354 >        case HIGH:
1355 >                mult = 3;
1356 >                break;
1357 >        }
1358          {
1359                  int     xres, yres;
1360                  double  aspect;
# Line 1020 | Line 1381 | char   *opts;
1381                  else
1382                          badvalue(REPORT);
1383          }
1023                                        /* check date on ambient file */
1024        if (vdef(AMBFILE)) {
1025                long    afdate = fdate(vval(AMBFILE));
1026                if (afdate >= 0 & octreedate > afdate)
1027                        rmfile(vval(AMBFILE));
1028        }
1384                                          /* do each view */
1385          vn = 0;
1386          while ((vw = getview(vn++, vs)) != NULL) {
1387 +                if (sayview)
1388 +                        printview(vw);
1389                  if (!vs[0])
1390                          sprintf(vs, "%d", vn);
1391                  sprintf(picfile, "%s_%s.pic", vval(PICTURE), vs);
1392                                                  /* check date on picture */
1393 <                if (fdate(picfile) > octreedate)
1393 >                if (fdate(picfile) >= oct1date)
1394                          continue;
1395                                                  /* build rpict command */
1396                  sprintf(rawfile, "%s_%s.raw", vval(PICTURE), vs);
1397 <                if (fdate(rawfile) > octreedate)        /* recover */
1397 >                if (fdate(rawfile) >= oct1date)         /* recover */
1398                          sprintf(combuf, "rpict%s%s -ro %s %s",
1399 <                                        rep, opts, rawfile, vval(OCTREE));
1399 >                                        rep, opts, rawfile, oct1name);
1400                  else {
1401                          if (overture) {         /* run overture calculation */
1402                                  sprintf(combuf,
1403                                  "rpict%s %s%s -x 64 -y 64 -ps 1 %s > %s",
1404                                                  rep, vw, opts,
1405 <                                                vval(OCTREE), rawfile);
1405 >                                                oct1name, overfile);
1406                                  if (runcom(combuf)) {
1407                                          fprintf(stderr,
1408 <                        "%s: error in overture for view %s\n\t%s removed\n",
1409 <                                                progname, vs, rawfile);
1053 <                                        unlink(rawfile);
1408 >                                        "%s: error in overture for view %s\n",
1409 >                                                progname, vs);
1410                                          exit(1);
1411                                  }
1412 + #ifdef NIX
1413 +                                rmfile(overfile);
1414 + #endif
1415                          }
1416                          sprintf(combuf, "rpict%s %s %s%s %s > %s",
1417                                          rep, vw, res, opts,
1418 <                                        vval(OCTREE), rawfile);
1418 >                                oct1name, rawfile);
1419                  }
1420                  if (runcom(combuf)) {           /* run rpict */
1421                          fprintf(stderr, "%s: error rendering view %s\n",
# Line 1108 | Line 1467 | char   *fn;
1467                  return(0);
1468          return(unlink(fn));
1469   }
1470 +
1471 +
1472 + #ifdef MSDOS
1473 + setenv(vname, value)            /* set an environment variable */
1474 + char    *vname, *value;
1475 + {
1476 +        register char   *evp;
1477 +
1478 +        evp = bmalloc(strlen(vname)+strlen(value)+2);
1479 +        if (evp == NULL)
1480 +                syserr(progname);
1481 +        sprintf(evp, "%s=%s", vname, value);
1482 +        if (putenv(evp) != 0) {
1483 +                fprintf(stderr, "%s: out of environment space\n", progname);
1484 +                exit(1);
1485 +        }
1486 +        if (!silent)
1487 +                printf("set %s\n", evp);
1488 + }
1489 + #endif
1490  
1491  
1492   badvalue(vc)                    /* report bad variable value and exit */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines