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.23 by greg, Tue Sep 7 11:57:04 1993 UTC vs.
Revision 2.48 by greg, Tue Dec 12 13:30:14 1995 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1993 Regents of the University of California */
1 > /* Copyright (c) 1995 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 10 | Line 10 | static char SCCSid[] = "$SunId$ LBL";
10  
11   #include "standard.h"
12   #include "paths.h"
13 + #include "vars.h"
14   #include <ctype.h>
15 + #include <sys/types.h>
16  
15
16 typedef struct {
17        char    *name;          /* variable name */
18        short   nick;           /* # characters required for nickname */
19        short   nass;           /* # assignments made */
20        char    *value;         /* assigned value(s) */
21        int     (*fixval)();    /* assignment checking function */
22 } VARIABLE;
23
24 int     onevalue(), catvalues();
25
17                                  /* variables */
18   #define OBJECT          0               /* object files */
19   #define SCENE           1               /* scene files */
20   #define MATERIAL        2               /* material files */
21 < #define RENDER          3               /* rendering options */
22 < #define OCONV           4               /* oconv options */
23 < #define PFILT           5               /* pfilt options */
24 < #define VIEW            6               /* view(s) for picture(s) */
25 < #define ZONE            7               /* simulation zone */
26 < #define QUALITY         8               /* desired rendering quality */
27 < #define OCTREE          9               /* octree file name */
28 < #define PICTURE         10              /* picture file name */
29 < #define AMBFILE         11              /* ambient file name */
30 < #define OPTFILE         12              /* rendering options file */
31 < #define EXPOSURE        13              /* picture exposure setting */
32 < #define RESOLUTION      14              /* maximum picture resolution */
33 < #define UP              15              /* view up (X, Y or Z) */
34 < #define INDIRECT        16              /* indirection in lighting */
35 < #define DETAIL          17              /* level of scene detail */
36 < #define PENUMBRAS       18              /* shadow penumbras are desired */
37 < #define VARIABILITY     19              /* level of light variability */
38 < #define REPORT          20              /* report frequency and errfile */
21 > #define ILLUM           3               /* mkillum input files */
22 > #define MKILLUM         4               /* mkillum options */
23 > #define RENDER          5               /* rendering options */
24 > #define OCONV           6               /* oconv options */
25 > #define PFILT           7               /* pfilt options */
26 > #define VIEW            8               /* view(s) for picture(s) */
27 > #define ZONE            9               /* simulation zone */
28 > #define QUALITY         10              /* desired rendering quality */
29 > #define OCTREE          11              /* octree file name */
30 > #define PICTURE         12              /* picture file root name */
31 > #define AMBFILE         13              /* ambient file name */
32 > #define OPTFILE         14              /* rendering options file */
33 > #define EXPOSURE        15              /* picture exposure setting */
34 > #define RESOLUTION      16              /* maximum picture resolution */
35 > #define UP              17              /* view up (X, Y or Z) */
36 > #define INDIRECT        18              /* indirection in lighting */
37 > #define DETAIL          19              /* level of scene detail */
38 > #define PENUMBRAS       20              /* shadow penumbras are desired */
39 > #define VARIABILITY     21              /* level of light variability */
40 > #define REPORT          22              /* report frequency and errfile */
41 > #define RAWFILE         23              /* raw picture file root name */
42 > #define ZFILE           24              /* distance file root name */
43                                  /* total number of variables */
44 < #define NVARS           21
44 > int NVARS = 25;
45  
46 < VARIABLE        vv[NVARS] = {           /* variable-value pairs */
46 > VARIABLE        vv[] = {                /* variable-value pairs */
47          {"objects",     3,      0,      NULL,   catvalues},
48          {"scene",       3,      0,      NULL,   catvalues},
49          {"materials",   3,      0,      NULL,   catvalues},
50 +        {"illum",       3,      0,      NULL,   catvalues},
51 +        {"mkillum",     3,      0,      NULL,   catvalues},
52          {"render",      3,      0,      NULL,   catvalues},
53          {"oconv",       3,      0,      NULL,   catvalues},
54          {"pfilt",       2,      0,      NULL,   catvalues},
55          {"view",        2,      0,      NULL,   NULL},
56          {"ZONE",        2,      0,      NULL,   onevalue},
57 <        {"QUALITY",     3,      0,      NULL,   onevalue},
57 >        {"QUALITY",     3,      0,      NULL,   qualvalue},
58          {"OCTREE",      3,      0,      NULL,   onevalue},
59          {"PICTURE",     3,      0,      NULL,   onevalue},
60          {"AMBFILE",     3,      0,      NULL,   onevalue},
61          {"OPTFILE",     3,      0,      NULL,   onevalue},
62 <        {"EXPOSURE",    3,      0,      NULL,   onevalue},
62 >        {"EXPOSURE",    3,      0,      NULL,   fltvalue},
63          {"RESOLUTION",  3,      0,      NULL,   onevalue},
64          {"UP",          2,      0,      NULL,   onevalue},
65 <        {"INDIRECT",    3,      0,      NULL,   onevalue},
66 <        {"DETAIL",      3,      0,      NULL,   onevalue},
67 <        {"PENUMBRAS",   3,      0,      NULL,   onevalue},
68 <        {"VARIABILITY", 3,      0,      NULL,   onevalue},
65 >        {"INDIRECT",    3,      0,      NULL,   intvalue},
66 >        {"DETAIL",      3,      0,      NULL,   qualvalue},
67 >        {"PENUMBRAS",   3,      0,      NULL,   boolvalue},
68 >        {"VARIABILITY", 3,      0,      NULL,   qualvalue},
69          {"REPORT",      3,      0,      NULL,   onevalue},
70 +        {"RAWFILE",     3,      0,      NULL,   onevalue},
71 +        {"ZFILE",       2,      0,      NULL,   onevalue},
72   };
73  
75 VARIABLE        *matchvar();
76 char    *nvalue();
77 int     vscale();
78
79 #define UPPER(c)        ((c)&~0x20)     /* ASCII trick */
80
81 #define vnam(vc)        (vv[vc].name)
82 #define vdef(vc)        (vv[vc].nass)
83 #define vval(vc)        (vv[vc].value)
84 #define vint(vc)        atoi(vval(vc))
85 #define vlet(vc)        UPPER(vval(vc)[0])
86 #define vbool(vc)       (vlet(vc)=='T')
87
88 #define HIGH            2
89 #define MEDIUM          1
90 #define LOW             0
91
92 int     lowqopts(), medqopts(), hiqopts();
93 int     (*setqopts[3])() = {lowqopts, medqopts, hiqopts};
94
95 #define renderopts      (*setqopts[vscale(QUALITY)])
96
74                                  /* overture calculation file */
75   #ifdef NIX
76 < char    overfile[] = "overture.raw";
76 > char    overfile[] = "overture.unf";
77   #else
78   char    overfile[] = "/dev/null";
79   #endif
80  
81 < extern long     fdate(), time();
81 > extern time_t   fdate(), time();
82  
83 < long    scenedate;              /* date of latest scene or object file */
84 < long    octreedate;             /* date of octree */
85 < long    matdate;                /* date of latest material file */
83 > time_t  scenedate;              /* date of latest scene or object file */
84 > time_t  octreedate;             /* date of octree */
85 > time_t  matdate;                /* date of latest material file */
86 > time_t  illumdate;              /* date of last illum file */
87  
88 + char    *oct0name;              /* name of pre-mkillum octree */
89 + time_t  oct0date;               /* date of pre-mkillum octree */
90 + char    *oct1name;              /* name of post-mkillum octree */
91 + time_t  oct1date;               /* date of post-mkillum octree (>= matdate) */
92 +
93 + int     nowarn = 0;             /* no warnings */
94   int     explicate = 0;          /* explicate variables */
95   int     silent = 0;             /* do work silently */
96 + int     touchonly = 0;          /* touch files only */
97   int     noaction = 0;           /* don't do anything */
98   int     sayview = 0;            /* print view out */
99   char    *rvdevice = NULL;       /* rview output device */
# Line 127 | Line 112 | int    argc;
112   char    *argv[];
113   {
114          char    ropts[512];
115 +        char    popts[64];
116          int     i;
117  
118          progname = argv[0];
# Line 139 | Line 125 | char   *argv[];
125                  case 'n':
126                          noaction++;
127                          break;
128 +                case 't':
129 +                        touchonly++;
130 +                        break;
131                  case 'e':
132                          explicate++;
133                          break;
# Line 151 | Line 140 | char   *argv[];
140                  case 'v':
141                          viewselect = argv[++i];
142                          break;
143 +                case 'w':
144 +                        nowarn++;
145 +                        break;
146                  default:
147                          goto userr;
148                  }
# Line 160 | Line 152 | char   *argv[];
152                                  /* assign Radiance root file name */
153          rootname(radname, rifname);
154                                  /* load variable values */
155 <        load(rifname);
155 >        loadvars(rifname);
156                                  /* get any additional assignments */
157          for (i++; i < argc; i++)
158                  setvariable(argv[i]);
# Line 172 | Line 164 | char   *argv[];
164          setdefaults();
165                                  /* print all values if requested */
166          if (explicate)
167 <                printvals();
168 <                                /* build octree */
167 >                printvars(stdout);
168 >                                /* build octree (and run mkillum) */
169          oconv();
170                                  /* check date on ambient file */
171          checkambfile();
172                                  /* run simulation */
173 <        renderopts(ropts);
173 >        renderopts(ropts, popts);
174          xferopts(ropts);
175          if (rvdevice != NULL)
176 <                rview(ropts);
176 >                rview(ropts, popts);
177          else
178 <                rpict(ropts);
178 >                rpict(ropts, popts);
179          exit(0);
180   userr:
181          fprintf(stderr,
182 <        "Usage: %s [-s][-n][-e][-v view][-o dev] rfile [VAR=value ..]\n",
182 > "Usage: %s [-s][-n][-t][-e][-V][-v view][-o dev] rfile [VAR=value ..]\n",
183                          progname);
184          exit(1);
185   }
# Line 208 | Line 200 | register char  *rn, *fn;
200   }
201  
202  
203 < load(rfname)                    /* load Radiance simulation file */
212 < char    *rfname;
213 < {
214 <        FILE    *fp;
215 <        char    buf[512];
216 <        register char   *cp;
217 <
218 <        if (rfname == NULL)
219 <                fp = stdin;
220 <        else if ((fp = fopen(rfname, "r")) == NULL)
221 <                syserr(rfname);
222 <        while (fgetline(buf, sizeof(buf), fp) != NULL) {
223 <                for (cp = buf; *cp; cp++) {
224 <                        switch (*cp) {
225 <                        case '\\':
226 <                        case '\n':
227 <                                *cp = ' ';
228 <                                continue;
229 <                        case '#':
230 <                                *cp = '\0';
231 <                                break;
232 <                        default:
233 <                                continue;
234 <                        }
235 <                        break;
236 <                }
237 <                setvariable(buf);
238 <        }
239 <        fclose(fp);
240 < }
241 <
242 <
243 < setvariable(ass)                /* assign variable according to string */
244 < register char   *ass;
245 < {
246 <        char    varname[32];
247 <        register char   *cp;
248 <        register VARIABLE       *vp;
249 <        register int    i;
250 <        int     n;
251 <
252 <        while (isspace(*ass))           /* skip leading space */
253 <                ass++;
254 <        cp = varname;                   /* extract name */
255 <        while (cp < varname+sizeof(varname)-1
256 <                        && *ass && !isspace(*ass) && *ass != '=')
257 <                *cp++ = *ass++;
258 <        *cp = '\0';
259 <        if (!varname[0])
260 <                return;         /* no variable name! */
261 <                                        /* trim value */
262 <        while (isspace(*ass) || *ass == '=')
263 <                ass++;
264 <        cp = ass + strlen(ass);
265 <        do
266 <                *cp-- = '\0';
267 <        while (cp >= ass && isspace(*cp));
268 <        n = cp - ass + 1;
269 <        if (!n) {
270 <                fprintf(stderr, "%s: warning - missing value for variable '%s'\n",
271 <                                progname, varname);
272 <                return;
273 <        }
274 <                                        /* match variable from list */
275 <        vp = matchvar(varname);
276 <        if (vp == NULL) {
277 <                fprintf(stderr, "%s: unknown variable '%s'\n",
278 <                                progname, varname);
279 <                exit(1);
280 <        }
281 <                                        /* assign new value */
282 <        if (i = vp->nass) {
283 <                cp = vp->value;
284 <                while (i--)
285 <                        while (*cp++)
286 <                                ;
287 <                i = cp - vp->value;
288 <                vp->value = realloc(vp->value, i+n+1);
289 <        } else
290 <                vp->value = malloc(n+1);
291 <        if (vp->value == NULL)
292 <                syserr(progname);
293 <        strcpy(vp->value+i, ass);
294 <        vp->nass++;
295 < }
296 <
297 <
298 < VARIABLE *
299 < matchvar(nam)                   /* match a variable by its name */
300 < char    *nam;
301 < {
302 <        int     n = strlen(nam);
303 <        register int    i;
304 <
305 <        for (i = 0; i < NVARS; i++)
306 <                if (n >= vv[i].nick && !strncmp(nam, vv[i].name, n))
307 <                        return(vv+i);
308 <        return(NULL);
309 < }
310 <
311 <
312 < char *
313 < nvalue(vp, n)                   /* return nth variable value */
314 < VARIABLE        *vp;
315 < register int    n;
316 < {
317 <        register char   *cp;
318 <
319 <        if (vp == NULL | n < 0 | n >= vp->nass)
320 <                return(NULL);
321 <        cp = vp->value;
322 <        while (n--)
323 <                while (*cp++)
324 <                        ;
325 <        return(cp);
326 < }
327 <
328 <
329 < int
330 < vscale(vc)                      /* return scale for variable vc */
331 < int     vc;
332 < {
333 <        switch(vlet(vc)) {
334 <        case 'H':
335 <                return(HIGH);
336 <        case 'M':
337 <                return(MEDIUM);
338 <        case 'L':
339 <                return(LOW);
340 <        }
341 <        badvalue(vc);
342 < }
343 <
344 <
345 < checkvalues()                   /* check assignments */
346 < {
347 <        register int    i;
348 <
349 <        for (i = 0; i < NVARS; i++)
350 <                if (vv[i].fixval != NULL)
351 <                        (*vv[i].fixval)(vv+i);
352 < }
353 <
354 <
355 < onevalue(vp)                    /* only one assignment for this variable */
356 < register VARIABLE       *vp;
357 < {
358 <        if (vp->nass < 2)
359 <                return;
360 <        fprintf(stderr, "%s: warning - multiple assignment of variable '%s'\n",
361 <                        progname, vp->name);
362 <        do
363 <                vp->value += strlen(vp->value)+1;
364 <        while (--vp->nass > 1);
365 < }
366 <
367 <
368 < catvalues(vp)                   /* concatenate variable values */
369 < register VARIABLE       *vp;
370 < {
371 <        register char   *cp;
372 <
373 <        if (vp->nass < 2)
374 <                return;
375 <        for (cp = vp->value; vp->nass > 1; vp->nass--) {
376 <                while (*cp)
377 <                        cp++;
378 <                *cp++ = ' ';
379 <        }
380 < }
381 <
382 <
383 < long
203 > time_t
204   checklast(fnames)                       /* check files and find most recent */
205   register char   *fnames;
206   {
207          char    thisfile[MAXPATH];
208 <        long    thisdate, lastdate = -1;
208 >        time_t  thisdate, lastdate = 0;
209          register char   *cp;
210  
211 +        if (fnames == NULL)
212 +                return(0);
213          while (*fnames) {
214                  while (isspace(*fnames)) fnames++;
215                  cp = thisfile;
216                  while (*fnames && !isspace(*fnames))
217                          *cp++ = *fnames++;
218                  *cp = '\0';
219 <                if ((thisdate = fdate(thisfile)) < 0)
219 >                if (!(thisdate = fdate(thisfile)))
220                          syserr(thisfile);
221                  if (thisdate > lastdate)
222                          lastdate = thisdate;
# Line 403 | Line 225 | register char  *fnames;
225   }
226  
227  
228 + char *
229 + newfname(orig, pred)            /* create modified file name */
230 + char    *orig;
231 + int     pred;
232 + {
233 +        extern char     *rindex();
234 +        register char   *cp;
235 +        register int    n;
236 +        int     suffix;
237 +
238 +        n = 0; cp = orig; suffix = -1;          /* suffix position, length */
239 +        while (*cp) {
240 +                if (*cp == '.') suffix = n;
241 +                else if (ISDIRSEP(*cp)) suffix = -1;
242 +                cp++; n++;
243 +        }
244 +        if (suffix == -1) suffix = n;
245 +        if ((cp = bmalloc(n+2)) == NULL)
246 +                syserr(progname);
247 +        strncpy(cp, orig, suffix);
248 +        cp[suffix] = pred;                      /* root name + pred + suffix */
249 +        strcpy(cp+suffix+1, orig+suffix);
250 +        return(cp);
251 + }
252 +
253 +
254   checkfiles()                    /* check for existence and modified times */
255   {
256 <        char    *cp;
409 <        long    objdate;
256 >        time_t  objdate;
257  
258          if (!vdef(OCTREE)) {
259 <                if ((cp = bmalloc(strlen(radname)+5)) == NULL)
259 >                if ((vval(OCTREE) = bmalloc(strlen(radname)+5)) == NULL)
260                          syserr(progname);
261 <                sprintf(cp, "%s.oct", radname);
415 <                vval(OCTREE) = cp;
261 >                sprintf(vval(OCTREE), "%s.oct", radname);
262                  vdef(OCTREE)++;
263          }
264          octreedate = fdate(vval(OCTREE));
265 <        scenedate = -1;
266 <        if (vdef(SCENE)) {
267 <                scenedate = checklast(vval(SCENE));
268 <                if (vdef(OBJECT)) {
269 <                        objdate = checklast(vval(OBJECT));
270 <                        if (objdate > scenedate)
271 <                                scenedate = objdate;
272 <                }
273 <        }
274 <        if (octreedate < 0 & scenedate < 0) {
275 <                fprintf(stderr, "%s: need '%s' or '%s'\n", progname,
276 <                                vnam(OCTREE), vnam(SCENE));
265 >        if (vdef(ILLUM)) {              /* illum requires secondary octrees */
266 >                oct0name = newfname(vval(OCTREE), '0');
267 >                oct1name = newfname(vval(OCTREE), '1');
268 >                oct0date = fdate(oct0name);
269 >                oct1date = fdate(oct1name);
270 >        } else
271 >                oct0name = oct1name = vval(OCTREE);
272 >        if ((scenedate = checklast(vval(SCENE))) &&
273 >                        (objdate = checklast(vval(OBJECT))) > scenedate)
274 >                scenedate = objdate;
275 >        illumdate = checklast(vval(ILLUM));
276 >        if (!octreedate & !scenedate & !illumdate) {
277 >                fprintf(stderr, "%s: need '%s' or '%s' or '%s'\n", progname,
278 >                                vnam(OCTREE), vnam(SCENE), vnam(ILLUM));
279                  exit(1);
280          }
281 <        matdate = -1;
434 <        if (vdef(MATERIAL))
435 <                matdate = checklast(vval(MATERIAL));
281 >        matdate = checklast(vval(MATERIAL));
282   }      
283  
284  
# Line 441 | Line 287 | double org[3], *sizp;
287   {
288          extern FILE     *popen();
289          static double   oorg[3], osiz = 0.;
290 <        char    buf[MAXPATH+16];
290 >        double  min[3], max[3];
291 >        char    buf[1024];
292          FILE    *fp;
293 +        register int    i;
294  
295 <        if (osiz <= FTINY) {
296 <                oconv();                /* does nothing if done already */
297 <                sprintf(buf, "getinfo -d < %s", vval(OCTREE));
298 <                if ((fp = popen(buf, "r")) == NULL)
299 <                        syserr("getinfo");
300 <                if (fscanf(fp, "%lf %lf %lf %lf", &oorg[0], &oorg[1],
301 <                                &oorg[2], &osiz) != 4) {
302 <                        fprintf(stderr,
295 >        if (osiz <= FTINY)
296 >                if (noaction && fdate(oct1name) <
297 >                                (scenedate>illumdate?scenedate:illumdate)) {
298 >                                                        /* run getbbox */
299 >                        sprintf(buf, "getbbox -w -h %s",
300 >                                vdef(SCENE) ? vval(SCENE) : vval(ILLUM));
301 >                        if ((fp = popen(buf, "r")) == NULL)
302 >                                syserr("getbbox");
303 >                        if (fscanf(fp, "%lf %lf %lf %lf %lf %lf",
304 >                                        &min[0], &max[0], &min[1], &max[1],
305 >                                        &min[2], &max[2]) != 6) {
306 >                                fprintf(stderr,
307 >                        "%s: error reading bounding box from getbbox\n",
308 >                                                progname);
309 >                                exit(1);
310 >                        }
311 >                        for (i = 0; i < 3; i++)
312 >                                if (max[i] - min[i] > osiz)
313 >                                        osiz = max[i] - min[i];
314 >                        for (i = 0; i < 3; i++)
315 >                                oorg[i] = (max[i]+min[i]-osiz)*.5;
316 >                        pclose(fp);
317 >                } else {                                /* from octree */
318 >                        oconv();        /* does nothing if done already */
319 >                        sprintf(buf, "getinfo -d < %s", oct1name);
320 >                        if ((fp = popen(buf, "r")) == NULL)
321 >                                syserr("getinfo");
322 >                        if (fscanf(fp, "%lf %lf %lf %lf", &oorg[0], &oorg[1],
323 >                                        &oorg[2], &osiz) != 4) {
324 >                                fprintf(stderr,
325                          "%s: error reading bounding cube from getinfo\n",
326 <                                        progname);
327 <                        exit(1);
326 >                                                progname);
327 >                                exit(1);
328 >                        }
329 >                        pclose(fp);
330                  }
459                pclose(fp);
460        }
331          org[0] = oorg[0]; org[1] = oorg[1]; org[2] = oorg[2]; *sizp = osiz;
332   }
333  
# Line 509 | Line 379 | setdefaults()                  /* set default values for unassigned v
379   }
380  
381  
382 < printvals()                     /* print variable values */
382 > oconv()                         /* run oconv and mkillum if necessary */
383   {
384 <        register int    i, j;
384 >        static char     illumtmp[] = "ilXXXXXX";
385 >        char    combuf[1024], ocopts[64], mkopts[64];
386  
387 <        for (i = 0; i < NVARS; i++)
388 <                for (j = 0; j < vdef(i); j++)
389 <                        printf("%s= %s\n", vnam(i), nvalue(vv+i, j));
390 <        fflush(stdout);
391 < }
392 <
393 <
394 < oconv()                         /* run oconv if necessary */
395 < {
396 <        char    combuf[512], ocopts[64];
397 <
398 <        if (octreedate >= scenedate)    /* check dates */
387 >        oconvopts(ocopts);              /* get options */
388 >        if (octreedate < scenedate) {   /* check date on original octree */
389 >                if (touchonly && octreedate)
390 >                        touch(vval(OCTREE));
391 >                else {                          /* build command */
392 >                        if (vdef(MATERIAL))
393 >                                sprintf(combuf, "oconv%s %s %s > %s", ocopts,
394 >                                                vval(MATERIAL), vval(SCENE),
395 >                                                vval(OCTREE));
396 >                        else
397 >                                sprintf(combuf, "oconv%s %s > %s", ocopts,
398 >                                                vval(SCENE), vval(OCTREE));
399 >                        
400 >                        if (runcom(combuf)) {           /* run it */
401 >                                fprintf(stderr,
402 >                                "%s: error generating octree\n\t%s removed\n",
403 >                                                progname, vval(OCTREE));
404 >                                unlink(vval(OCTREE));
405 >                                exit(1);
406 >                        }
407 >                }
408 >                octreedate = time((time_t *)NULL);
409 >                if (octreedate < scenedate)     /* in case clock is off */
410 >                        octreedate = scenedate;
411 >        }
412 >        if (oct1name == vval(OCTREE))           /* no mkillum? */
413 >                oct1date = octreedate > matdate ? octreedate : matdate;
414 >        if (oct1date >= octreedate & oct1date >= matdate
415 >                        & oct1date >= illumdate)        /* all done */
416                  return;
417 <                                        /* build command */
418 <        oconvopts(ocopts);
419 <        if (vdef(MATERIAL))
420 <                sprintf(combuf, "oconv%s %s %s > %s", ocopts,
421 <                                vval(MATERIAL), vval(SCENE), vval(OCTREE));
422 <        else
423 <                sprintf(combuf, "oconv%s %s > %s", ocopts,
424 <                                vval(SCENE), vval(OCTREE));
425 <        
426 <        if (runcom(combuf)) {           /* run it */
427 <                fprintf(stderr, "%s: error generating octree\n\t%s removed\n",
428 <                                progname, vval(OCTREE));
429 <                unlink(vval(OCTREE));
430 <                exit(1);
417 >                                                /* make octree0 */
418 >        if (oct0date < scenedate | oct0date < illumdate) {
419 >                if (touchonly && oct0date)
420 >                        touch(oct0name);
421 >                else {                          /* build command */
422 >                        if (octreedate)
423 >                                sprintf(combuf, "oconv%s -i %s %s > %s", ocopts,
424 >                                        vval(OCTREE), vval(ILLUM), oct0name);
425 >                        else if (vdef(MATERIAL))
426 >                                sprintf(combuf, "oconv%s %s %s > %s", ocopts,
427 >                                        vval(MATERIAL), vval(ILLUM), oct0name);
428 >                        else
429 >                                sprintf(combuf, "oconv%s %s > %s", ocopts,
430 >                                        vval(ILLUM), oct0name);
431 >                        if (runcom(combuf)) {           /* run it */
432 >                                fprintf(stderr,
433 >                                "%s: error generating octree\n\t%s removed\n",
434 >                                                progname, oct0name);
435 >                                unlink(oct0name);
436 >                                exit(1);
437 >                        }
438 >                }
439 >                oct0date = time((time_t *)NULL);
440 >                if (oct0date < octreedate)      /* in case clock is off */
441 >                        oct0date = octreedate;
442 >                if (oct0date < illumdate)       /* ditto */
443 >                        oct0date = illumdate;
444 >                }
445 >        if (touchonly && oct1date)
446 >                touch(oct1name);
447 >        else {
448 >                mkillumopts(mkopts);            /* build mkillum command */
449 >                mktemp(illumtmp);
450 >                sprintf(combuf, "mkillum%s %s \"<\" %s > %s", mkopts,
451 >                                oct0name, vval(ILLUM), illumtmp);
452 >                if (runcom(combuf)) {                   /* run it */
453 >                        fprintf(stderr, "%s: error running mkillum\n",
454 >                                        progname);
455 >                        unlink(illumtmp);
456 >                        exit(1);
457 >                }
458 >                                                /* make octree1 (frozen) */
459 >                if (octreedate)
460 >                        sprintf(combuf, "oconv%s -f -i %s %s > %s", ocopts,
461 >                                vval(OCTREE), illumtmp, oct1name);
462 >                else if (vdef(MATERIAL))
463 >                        sprintf(combuf, "oconv%s -f %s %s > %s", ocopts,
464 >                                vval(MATERIAL), illumtmp, oct1name);
465 >                else
466 >                        sprintf(combuf, "oconv%s -f %s > %s", ocopts,
467 >                                illumtmp, oct1name);
468 >                if (runcom(combuf)) {           /* run it */
469 >                        fprintf(stderr,
470 >                                "%s: error generating octree\n\t%s removed\n",
471 >                                        progname, oct1name);
472 >                        unlink(oct1name);
473 >                        unlink(illumtmp);
474 >                        exit(1);
475 >                }
476 >                rmfile(illumtmp);
477          }
478 <        octreedate = time(0);
478 >        oct1date = time((time_t *)NULL);
479 >        if (oct1date < oct0date)        /* in case clock is off */
480 >                oct1date = oct0date;
481   }
482  
483  
# Line 567 | Line 503 | register char  *oo;
503   }
504  
505  
506 + mkillumopts(mo)                         /* get mkillum options */
507 + register char   *mo;
508 + {
509 +        /* BEWARE:  This may be called via setdefaults(), so no assumptions */
510 +
511 +        *mo = '\0';
512 +        if (vdef(MKILLUM))
513 +                addarg(mo, vval(MKILLUM));
514 + }
515 +
516 +
517   checkambfile()                  /* check date on ambient file */
518   {
519 <        long    afdate;
519 >        time_t  afdate;
520  
521          if (!vdef(AMBFILE))
522                  return;
523 <        if ((afdate = fdate(vval(AMBFILE))) < 0)
523 >        if (!(afdate = fdate(vval(AMBFILE))))
524                  return;
525 <        if (octreedate > afdate | matdate > afdate)
526 <                rmfile(vval(AMBFILE));
525 >        if (oct1date > afdate)
526 >                if (touchonly)
527 >                        touch(vval(AMBFILE));
528 >                else
529 >                        rmfile(vval(AMBFILE));
530   }
531  
532  
# Line 584 | Line 534 | double
534   ambval()                                /* compute ambient value */
535   {
536          if (vdef(EXPOSURE)) {
587                if (!isflt(vval(EXPOSURE)))
588                        badvalue(EXPOSURE);
537                  if (vval(EXPOSURE)[0] == '+' || vval(EXPOSURE)[0] == '-')
538                          return(.5/pow(2.,atof(vval(EXPOSURE))));
539                  return(.5/atof(vval(EXPOSURE)));
# Line 598 | Line 546 | ambval()                               /* compute ambient value */
546   }
547  
548  
549 < lowqopts(op)                            /* low quality rendering options */
549 > renderopts(op, po)                      /* set rendering options */
550 > char    *op, *po;
551 > {
552 >        switch(vscale(QUALITY)) {
553 >        case LOW:
554 >                lowqopts(op, po);
555 >                break;
556 >        case MEDIUM:
557 >                medqopts(op, po);
558 >                break;
559 >        case HIGH:
560 >                hiqopts(op, po);
561 >                break;
562 >        }
563 > }
564 >
565 >
566 > lowqopts(op, po)                        /* low quality rendering options */
567   register char   *op;
568 + char    *po;
569   {
570          double  d, org[3], siz[3];
571  
572          *op = '\0';
573 +        *po = '\0';
574          if (sscanf(vval(ZONE), "%*s %lf %lf %lf %lf %lf %lf", &org[0],
575                          &siz[0], &org[1], &siz[1], &org[2], &siz[2]) != 6)
576                  badvalue(ZONE);
577          siz[0] -= org[0]; siz[1] -= org[1]; siz[2] -= org[2];
578 +        if (siz[0] <= FTINY | siz[1] <= FTINY | siz[2] <= FTINY)
579 +                badvalue(ZONE);
580          getoctcube(org, &d);
581          d *= 3./(siz[0]+siz[1]+siz[2]);
582          switch (vscale(DETAIL)) {
583          case LOW:
584 <                op = addarg(op, "-ps 16 -dp 64");
584 >                po = addarg(po, "-ps 16");
585 >                op = addarg(op, "-dp 64");
586                  sprintf(op, " -ar %d", (int)(4*d));
587                  op += strlen(op);
588                  break;
589          case MEDIUM:
590 <                op = addarg(op, "-ps 8 -dp 128");
590 >                po = addarg(po, "-ps 8");
591 >                op = addarg(op, "-dp 128");
592                  sprintf(op, " -ar %d", (int)(8*d));
593                  op += strlen(op);
594                  break;
595          case HIGH:
596 <                op = addarg(op, "-ps 4 -dp 256");
596 >                po = addarg(po, "-ps 4");
597 >                op = addarg(op, "-dp 256");
598                  sprintf(op, " -ar %d", (int)(16*d));
599                  op += strlen(op);
600                  break;
601          }
602 <        op = addarg(op, "-pt .16");
602 >        po = addarg(po, "-pt .16");
603          if (vbool(PENUMBRAS))
604                  op = addarg(op, "-ds .4");
605          else
# Line 659 | Line 631 | register char  *op;
631   }
632  
633  
634 < medqopts(op)                            /* medium quality rendering options */
634 > medqopts(op, po)                        /* medium quality rendering options */
635   register char   *op;
636 + char    *po;
637   {
638 <        double  d, org[3], siz[3];
638 >        double  d, org[3], siz[3], asz;
639  
640          *op = '\0';
641 +        *po = '\0';
642          if (sscanf(vval(ZONE), "%*s %lf %lf %lf %lf %lf %lf", &org[0],
643                          &siz[0], &org[1], &siz[1], &org[2], &siz[2]) != 6)
644                  badvalue(ZONE);
645          siz[0] -= org[0]; siz[1] -= org[1]; siz[2] -= org[2];
646 +        if (siz[0] <= FTINY | siz[1] <= FTINY | siz[2] <= FTINY)
647 +                badvalue(ZONE);
648          getoctcube(org, &d);
649 <        d *= 3./(siz[0]+siz[1]+siz[2]);
649 >        asz = (siz[0]+siz[1]+siz[2])/3.;
650 >        d /= asz;
651          switch (vscale(DETAIL)) {
652          case LOW:
653 <                op = addarg(op, vbool(PENUMBRAS) ? "-ps 4" : "-ps 8");
653 >                po = addarg(po, vbool(PENUMBRAS) ? "-ps 4" : "-ps 8");
654                  op = addarg(op, "-dp 256");
655                  sprintf(op, " -ar %d", (int)(8*d));
656                  op += strlen(op);
657 +                sprintf(op, " -ms %.2g", asz/20.);
658 +                op += strlen(op);
659                  break;
660          case MEDIUM:
661 <                op = addarg(op, vbool(PENUMBRAS) ? "-ps 3" : "-ps 6");
661 >                po = addarg(po, vbool(PENUMBRAS) ? "-ps 3" : "-ps 6");
662                  op = addarg(op, "-dp 512");
663                  sprintf(op, " -ar %d", (int)(16*d));
664                  op += strlen(op);
665 +                sprintf(op, " -ms %.2g", asz/40.);
666 +                op += strlen(op);
667                  break;
668          case HIGH:
669 <                op = addarg(op, vbool(PENUMBRAS) ? "-ps 2" : "-ps 4");
669 >                po = addarg(po, vbool(PENUMBRAS) ? "-ps 2" : "-ps 4");
670                  op = addarg(op, "-dp 1024");
671                  sprintf(op, " -ar %d", (int)(32*d));
672                  op += strlen(op);
673 +                sprintf(op, " -ms %.2g", asz/80.);
674 +                op += strlen(op);
675                  break;
676          }
677 <        op = addarg(op, "-pt .08");
677 >        po = addarg(po, "-pt .08");
678          if (vbool(PENUMBRAS))
679 <                op = addarg(op, "-ds .2 -dj .35");
679 >                op = addarg(op, "-ds .2 -dj .5");
680          else
681                  op = addarg(op, "-ds .3");
682          op = addarg(op, "-dt .1 -dc .5 -dr 1 -sj .7 -st .1");
# Line 726 | Line 709 | register char  *op;
709   }
710  
711  
712 < hiqopts(op)                             /* high quality rendering options */
712 > hiqopts(op, po)                         /* high quality rendering options */
713   register char   *op;
714 + char    *po;
715   {
716 <        double  d, org[3], siz[3];
716 >        double  d, org[3], siz[3], asz;
717  
718          *op = '\0';
719 +        *po = '\0';
720          if (sscanf(vval(ZONE), "%*s %lf %lf %lf %lf %lf %lf", &org[0],
721                          &siz[0], &org[1], &siz[1], &org[2], &siz[2]) != 6)
722                  badvalue(ZONE);
723          siz[0] -= org[0]; siz[1] -= org[1]; siz[2] -= org[2];
724 +        if (siz[0] <= FTINY | siz[1] <= FTINY | siz[2] <= FTINY)
725 +                badvalue(ZONE);
726          getoctcube(org, &d);
727 <        d *= 3./(siz[0]+siz[1]+siz[2]);
727 >        asz = (siz[0]+siz[1]+siz[2])/3.;
728 >        d /= asz;
729          switch (vscale(DETAIL)) {
730          case LOW:
731 <                op = addarg(op, vbool(PENUMBRAS) ? "-ps 1" : "-ps 8");
731 >                po = addarg(po, vbool(PENUMBRAS) ? "-ps 1" : "-ps 8");
732                  op = addarg(op, "-dp 1024");
733                  sprintf(op, " -ar %d", (int)(16*d));
734                  op += strlen(op);
735 +                sprintf(op, " -ms %.2g", asz/40.);
736 +                op += strlen(op);
737                  break;
738          case MEDIUM:
739 <                op = addarg(op, vbool(PENUMBRAS) ? "-ps 1" : "-ps 5");
739 >                po = addarg(po, vbool(PENUMBRAS) ? "-ps 1" : "-ps 5");
740                  op = addarg(op, "-dp 2048");
741                  sprintf(op, " -ar %d", (int)(32*d));
742                  op += strlen(op);
743 +                sprintf(op, " -ms %.2g", asz/80.);
744 +                op += strlen(op);
745                  break;
746          case HIGH:
747 <                op = addarg(op, vbool(PENUMBRAS) ? "-ps 1" : "-ps 3");
747 >                po = addarg(po, vbool(PENUMBRAS) ? "-ps 1" : "-ps 3");
748                  op = addarg(op, "-dp 4096");
749                  sprintf(op, " -ar %d", (int)(64*d));
750                  op += strlen(op);
751 +                sprintf(op, " -ms %.2g", asz/160.);
752 +                op += strlen(op);
753                  break;
754          }
755 <        op = addarg(op, "-pt .04");
755 >        po = addarg(po, "-pt .04");
756          if (vbool(PENUMBRAS))
757 <                op = addarg(op, "-ds .1 -dj .7");
757 >                op = addarg(op, "-ds .1 -dj .65");
758          else
759                  op = addarg(op, "-ds .2");
760          op = addarg(op, "-dt .05 -dc .75 -dr 3 -sj 1 -st .01");
# Line 897 | Line 891 | register char  *vs;
891                  zpos = -1; vs++;
892          }
893          viewtype = 'v';
894 <        if (*vs == 'v' | *vs == 'l' | *vs == 'a' | *vs == 'h')
894 >        if (*vs == 'v' | *vs == 'l' | *vs == 'a' | *vs == 'h' | *vs == 'c')
895                  viewtype = *vs++;
896          cp = viewopts;
897          if ((!*vs || isspace(*vs)) && (xpos|ypos|zpos)) {       /* got one! */
# Line 908 | Line 902 | register char  *vs;
902                          badvalue(ZONE);
903                  for (i = 0; i < 3; i++) {
904                          dim[i] -= cent[i];
905 +                        if (dim[i] <= FTINY)
906 +                                badvalue(ZONE);
907                          cent[i] += .5*dim[i];
908                  }
909                  mult = vlet(ZONE)=='E' ? 2. : .45 ;
# Line 950 | Line 946 | register char  *vs;
946                  case 'h':
947                          cp = addarg(cp, "-vh 180 -vv 180");
948                          break;
949 +                case 'c':
950 +                        cp = addarg(cp, "-vh 180 -vv 90");
951 +                        break;
952                  }
953          } else {
954                  while (!isspace(*vs))           /* else skip id */
# Line 960 | Line 959 | register char  *vs;
959                          cp += strlen(cp);
960                  }
961          }
962 <        strcpy(cp, vs);                 /* append any additional options */
962 >        if (cp == viewopts)             /* append any additional options */
963 >                vs++;           /* skip prefixed space if unneeded */
964 >        strcpy(cp, vs);
965   #ifdef MSDOS
966          if (strlen(viewopts) > 40) {
967                  setenv("VIEW", viewopts);
# Line 1015 | Line 1016 | char   *vn;            /* returned view name */
1016   printview(vopts)                        /* print out selected view */
1017   register char   *vopts;
1018   {
1019 <        extern char     *atos();
1019 >        extern char     *atos(), *getenv();
1020          char    buf[256];
1021          FILE    *fp;
1022          register char   *cp;
# Line 1050 | Line 1051 | register char  *vopts;
1051                          while (isspace(*vopts))
1052                                  vopts++;
1053                          putchar(' ');
1054 <                        while (*vopts && !isspace(*vopts))
1055 <                                putchar(*vopts++);
1054 > #ifdef MSDOS
1055 >                        if (*vopts == '$') {            /* expand env. var. */
1056 >                                if (!*atos(buf, sizeof(buf), vopts+1))
1057 >                                        return(-1);
1058 >                                if ((cp = getenv(buf)) == NULL)
1059 >                                        return(-1);
1060 >                                fputs(cp, stdout);
1061 >                                vopts = sskip(vopts);
1062 >                        } else
1063 > #endif
1064 >                                while (*vopts && !isspace(*vopts))
1065 >                                        putchar(*vopts++);
1066                  }
1067          } while (*vopts++);
1068          putchar('\n');
# Line 1059 | Line 1070 | register char  *vopts;
1070   }
1071  
1072  
1073 < rview(opts)                             /* run rview with first view */
1074 < char    *opts;
1073 > rview(opts, po)                         /* run rview with first view */
1074 > char    *opts, *po;
1075   {
1076          char    *vw;
1077          char    combuf[512];
1078                                          /* build command */
1079 <        if ((vw = getview(0, NULL)) == NULL)
1079 >        if (touchonly || (vw = getview(0, NULL)) == NULL)
1080                  return;
1081          if (sayview)
1082                  printview(vw);
1083 <        sprintf(combuf, "rview %s%s -R %s ", vw, opts, rifname);
1083 >        sprintf(combuf, "rview %s%s%s -R %s ", vw, po, opts, rifname);
1084          if (rvdevice != NULL)
1085                  sprintf(combuf+strlen(combuf), "-o %s ", rvdevice);
1086 <        strcat(combuf, vval(OCTREE));
1086 >        if (vdef(EXPOSURE))
1087 >                sprintf(combuf+strlen(combuf), "-pe %s ", vval(EXPOSURE));
1088 >        strcat(combuf, oct1name);
1089          if (runcom(combuf)) {           /* run it */
1090                  fprintf(stderr, "%s: error running rview\n", progname);
1091                  exit(1);
# Line 1080 | Line 1093 | char   *opts;
1093   }
1094  
1095  
1096 < rpict(opts)                             /* run rpict and pfilt for each view */
1097 < char    *opts;
1096 > rpict(opts, po)                         /* run rpict and pfilt for each view */
1097 > char    *opts, *po;
1098   {
1099          char    combuf[1024];
1100 <        char    rawfile[MAXPATH], picfile[MAXPATH], rep[MAXPATH+16], res[32];
1100 >        char    rawfile[MAXPATH], picfile[MAXPATH];
1101 >        char    zopt[MAXPATH+4], rep[MAXPATH+16], res[32];
1102          char    pfopts[128];
1103          char    vs[32], *vw;
1104          int     vn, mult;
1105 <        long    lastdate;
1105 >        time_t  rfdt, pfdt;
1106                                          /* get pfilt options */
1107          pfiltopts(pfopts);
1108                                          /* get resolution, reporting */
1109 <        mult = vscale(QUALITY)+1;
1109 >        switch (vscale(QUALITY)) {
1110 >        case LOW:
1111 >                mult = 1;
1112 >                break;
1113 >        case MEDIUM:
1114 >                mult = 2;
1115 >                break;
1116 >        case HIGH:
1117 >                mult = 3;
1118 >                break;
1119 >        }
1120          {
1121                  int     xres, yres;
1122                  double  aspect;
# Line 1119 | Line 1143 | char   *opts;
1143                  else
1144                          badvalue(REPORT);
1145          }
1122                                        /* get update time */
1123        lastdate = octreedate > matdate ? octreedate : matdate;
1146                                          /* do each view */
1147          vn = 0;
1148          while ((vw = getview(vn++, vs)) != NULL) {
# Line 1129 | Line 1151 | char   *opts;
1151                  if (!vs[0])
1152                          sprintf(vs, "%d", vn);
1153                  sprintf(picfile, "%s_%s.pic", vval(PICTURE), vs);
1154 +                if (vdef(ZFILE))
1155 +                        sprintf(zopt, " -z %s_%s.zbf", vval(ZFILE), vs);
1156 +                else
1157 +                        zopt[0] = '\0';
1158                                                  /* check date on picture */
1159 <                if (fdate(picfile) >= lastdate)
1159 >                pfdt = fdate(picfile);
1160 >                if (pfdt >= oct1date)
1161                          continue;
1162 +                                                /* get raw file name */
1163 +                sprintf(rawfile, "%s_%s.unf",
1164 +                        vdef(RAWFILE) ? vval(RAWFILE) : vval(PICTURE), vs);
1165 +                rfdt = fdate(rawfile);
1166 +                if (touchonly) {                /* update times only */
1167 +                        if (rfdt) {
1168 +                                if (rfdt < oct1date)
1169 +                                        touch(rawfile);
1170 +                        } else if (pfdt && pfdt < oct1date)
1171 +                                touch(picfile);
1172 +                        continue;
1173 +                }
1174                                                  /* build rpict command */
1175 <                sprintf(rawfile, "%s_%s.raw", vval(PICTURE), vs);
1176 <                if (fdate(rawfile) >= octreedate)       /* recover */
1177 <                        sprintf(combuf, "rpict%s%s -ro %s %s",
1139 <                                        rep, opts, rawfile, vval(OCTREE));
1175 >                if (rfdt >= oct1date)           /* recover */
1176 >                        sprintf(combuf, "rpict%s%s%s%s -ro %s %s",
1177 >                                rep, po, opts, zopt, rawfile, oct1name);
1178                  else {
1179                          if (overture) {         /* run overture calculation */
1180                                  sprintf(combuf,
1181                                  "rpict%s %s%s -x 64 -y 64 -ps 1 %s > %s",
1182                                                  rep, vw, opts,
1183 <                                                vval(OCTREE), overfile);
1183 >                                                oct1name, overfile);
1184                                  if (runcom(combuf)) {
1185                                          fprintf(stderr,
1186                                          "%s: error in overture for view %s\n",
# Line 1153 | Line 1191 | char   *opts;
1191                                  rmfile(overfile);
1192   #endif
1193                          }
1194 <                        sprintf(combuf, "rpict%s %s %s%s %s > %s",
1195 <                                        rep, vw, res, opts,
1196 <                                        vval(OCTREE), rawfile);
1194 >                        sprintf(combuf, "rpict%s %s %s%s%s%s %s > %s",
1195 >                                        rep, vw, res, po, opts, zopt,
1196 >                                        oct1name, rawfile);
1197                  }
1198                  if (runcom(combuf)) {           /* run rpict */
1199                          fprintf(stderr, "%s: error rendering view %s\n",
1200                                          progname, vs);
1201                          exit(1);
1202                  }
1203 +                if (!vdef(RAWFILE) || strcmp(vval(RAWFILE),vval(PICTURE))) {
1204                                                  /* build pfilt command */
1205 <                if (mult > 1)
1206 <                        sprintf(combuf, "pfilt%s -x /%d -y /%d %s > %s",
1205 >                        if (mult > 1)
1206 >                                sprintf(combuf, "pfilt%s -x /%d -y /%d %s > %s",
1207                                          pfopts, mult, mult, rawfile, picfile);
1208 <                else
1209 <                        sprintf(combuf, "pfilt%s %s > %s", pfopts,
1210 <                                        rawfile, picfile);
1211 <                if (runcom(combuf)) {           /* run pfilt */
1212 <                        fprintf(stderr,
1213 <                        "%s: error filtering view %s\n\t%s removed\n",
1214 <                                        progname, vs, picfile);
1215 <                        unlink(picfile);
1216 <                        exit(1);
1208 >                        else
1209 >                                sprintf(combuf, "pfilt%s %s > %s", pfopts,
1210 >                                                rawfile, picfile);
1211 >                        if (runcom(combuf)) {           /* run pfilt */
1212 >                                fprintf(stderr,
1213 >                                "%s: error filtering view %s\n\t%s removed\n",
1214 >                                                progname, vs, picfile);
1215 >                                unlink(picfile);
1216 >                                exit(1);
1217 >                        }
1218                  }
1219 <                                                /* remove raw file */
1220 <                rmfile(rawfile);
1219 >                                                /* remove/rename raw file */
1220 >                if (vdef(RAWFILE)) {
1221 >                        sprintf(combuf, "%s_%s.pic", vval(RAWFILE), vs);
1222 >                        mvfile(rawfile, combuf);
1223 >                } else
1224 >                        rmfile(rawfile);
1225          }
1226   }
1227  
1228  
1229 + touch(fn)                       /* update a file */
1230 + char    *fn;
1231 + {
1232 +        if (!silent)
1233 +                printf("\ttouch %s\n", fn);
1234 +        if (noaction)
1235 +                return(0);
1236 + #ifdef notused
1237 +        if (access(fn, F_OK) == -1)             /* create it */
1238 +                if (close(open(fn, O_WRONLY|O_CREAT, 0666)) == -1)
1239 +                        return(-1);
1240 + #endif
1241 +        return(setfdate(fn, time((time_t *)NULL)));
1242 + }
1243 +
1244 +
1245   runcom(cs)                      /* run command */
1246   char    *cs;
1247   {
# Line 1206 | Line 1266 | char   *fn;
1266          if (noaction)
1267                  return(0);
1268          return(unlink(fn));
1269 + }
1270 +
1271 +
1272 + mvfile(fold, fnew)              /* move a file */
1273 + char    *fold, *fnew;
1274 + {
1275 +        if (!silent)
1276 + #ifdef MSDOS
1277 +                printf("\trename %s %s\n", fold, fnew);
1278 + #else
1279 +                printf("\tmv %s %s\n", fold, fnew);
1280 + #endif
1281 +        if (noaction)
1282 +                return(0);
1283 +        return(rename(fold, fnew));
1284   }
1285  
1286  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines