| 22 |
|
#else |
| 23 |
|
#define DELCMD "rm -f" |
| 24 |
|
#define RENAMECMD "mv" |
| 25 |
+ |
#include <sys/types.h> |
| 26 |
+ |
#include <sys/wait.h> |
| 27 |
|
#endif |
| 28 |
|
|
| 29 |
|
/* variables (alphabetical by name) */ |
| 123 |
|
|
| 124 |
|
#define inchild() (children_running < 0) |
| 125 |
|
|
| 126 |
+ |
static void rootname(char *rn, char *fn); |
| 127 |
+ |
static time_t checklast(char *fnames); |
| 128 |
+ |
static char * newfname(char *orig, int pred); |
| 129 |
+ |
static void checkfiles(void); |
| 130 |
+ |
static void getoctcube(double org[3], double *sizp); |
| 131 |
+ |
static void setdefaults(void); |
| 132 |
+ |
static void oconv(void); |
| 133 |
+ |
static char * addarg(char *op, char *arg); |
| 134 |
+ |
static void oconvopts(char *oo); |
| 135 |
+ |
static void mkillumopts(char *mo); |
| 136 |
+ |
static void checkambfile(void); |
| 137 |
+ |
static double ambval(void); |
| 138 |
+ |
static void renderopts(char *op, char *po); |
| 139 |
+ |
static void lowqopts(char *op, char *po); |
| 140 |
+ |
static void medqopts(char *op, char *po); |
| 141 |
+ |
static void hiqopts(char *op, char *po); |
| 142 |
+ |
static void xferopts(char *ro); |
| 143 |
+ |
static void pfiltopts(char *po); |
| 144 |
+ |
static int matchword(char *s1, char *s2); |
| 145 |
+ |
static char * specview(char *vs); |
| 146 |
+ |
static char * getview(int n, char *vn); |
| 147 |
+ |
static int myprintview(char *vopts, FILE *fp); |
| 148 |
+ |
static void rvu(char *opts, char *po); |
| 149 |
+ |
static void rpict(char *opts, char *po); |
| 150 |
+ |
static int touch(char *fn); |
| 151 |
+ |
static int runcom(char *cs); |
| 152 |
+ |
static int rmfile(char *fn); |
| 153 |
+ |
static int mvfile(char *fold, char *fnew); |
| 154 |
+ |
static int next_process(void); |
| 155 |
+ |
static void wait_process(int all); |
| 156 |
+ |
static void finish_process(void); |
| 157 |
+ |
static void badvalue(int vc); |
| 158 |
+ |
static void syserr(char *s); |
| 159 |
|
|
| 160 |
< |
main(argc, argv) |
| 161 |
< |
int argc; |
| 162 |
< |
char *argv[]; |
| 160 |
> |
|
| 161 |
> |
int |
| 162 |
> |
main( |
| 163 |
> |
int argc, |
| 164 |
> |
char *argv[] |
| 165 |
> |
) |
| 166 |
|
{ |
| 167 |
|
char ropts[512]; |
| 168 |
|
char popts[64]; |
| 247 |
|
"Usage: %s [-w][-s][-n|-N npr][-t][-e][-V][-v view][-o dev] rfile [VAR=value ..]\n", |
| 248 |
|
progname); |
| 249 |
|
quit(1); |
| 250 |
+ |
return 1; /* pro forma return */ |
| 251 |
|
} |
| 252 |
|
|
| 253 |
|
|
| 254 |
< |
rootname(rn, fn) /* remove tail from end of fn */ |
| 255 |
< |
register char *rn, *fn; |
| 254 |
> |
static void |
| 255 |
> |
rootname( /* remove tail from end of fn */ |
| 256 |
> |
register char *rn, |
| 257 |
> |
register char *fn |
| 258 |
> |
) |
| 259 |
|
{ |
| 260 |
|
char *tp, *dp; |
| 261 |
|
|
| 269 |
|
} |
| 270 |
|
|
| 271 |
|
|
| 272 |
< |
time_t |
| 273 |
< |
checklast(fnames) /* check files and find most recent */ |
| 274 |
< |
register char *fnames; |
| 272 |
> |
static time_t |
| 273 |
> |
checklast( /* check files and find most recent */ |
| 274 |
> |
register char *fnames |
| 275 |
> |
) |
| 276 |
|
{ |
| 277 |
|
char thisfile[PATH_MAX]; |
| 278 |
|
time_t thisdate, lastdate = 0; |
| 292 |
|
} |
| 293 |
|
|
| 294 |
|
|
| 295 |
< |
char * |
| 296 |
< |
newfname(orig, pred) /* create modified file name */ |
| 297 |
< |
char *orig; |
| 298 |
< |
int pred; |
| 295 |
> |
static char * |
| 296 |
> |
newfname( /* create modified file name */ |
| 297 |
> |
char *orig, |
| 298 |
> |
int pred |
| 299 |
> |
) |
| 300 |
|
{ |
| 301 |
|
register char *cp; |
| 302 |
|
register int n; |
| 318 |
|
} |
| 319 |
|
|
| 320 |
|
|
| 321 |
< |
checkfiles() /* check for existence and modified times */ |
| 321 |
> |
static void |
| 322 |
> |
checkfiles(void) /* check for existence and modified times */ |
| 323 |
|
{ |
| 324 |
|
time_t objdate; |
| 325 |
|
|
| 354 |
|
} |
| 355 |
|
|
| 356 |
|
|
| 357 |
< |
getoctcube(org, sizp) /* get octree bounding cube */ |
| 358 |
< |
double org[3], *sizp; |
| 357 |
> |
static void |
| 358 |
> |
getoctcube( /* get octree bounding cube */ |
| 359 |
> |
double org[3], |
| 360 |
> |
double *sizp |
| 361 |
> |
) |
| 362 |
|
{ |
| 363 |
|
static double oorg[3], osiz = 0.; |
| 364 |
|
double min[3], max[3]; |
| 407 |
|
} |
| 408 |
|
|
| 409 |
|
|
| 410 |
< |
setdefaults() /* set default values for unassigned var's */ |
| 410 |
> |
static void |
| 411 |
> |
setdefaults(void) /* set default values for unassigned var's */ |
| 412 |
|
{ |
| 413 |
|
double org[3], lim[3], size; |
| 414 |
|
char buf[128]; |
| 465 |
|
} |
| 466 |
|
|
| 467 |
|
|
| 468 |
< |
oconv() /* run oconv and mkillum if necessary */ |
| 468 |
> |
static void |
| 469 |
> |
oconv(void) /* run oconv and mkillum if necessary */ |
| 470 |
|
{ |
| 471 |
|
static char illumtmp[] = "ilXXXXXX"; |
| 472 |
|
char combuf[PATH_MAX], ocopts[64], mkopts[64]; |
| 568 |
|
} |
| 569 |
|
|
| 570 |
|
|
| 571 |
< |
char * |
| 572 |
< |
addarg(op, arg) /* add argument and advance pointer */ |
| 573 |
< |
register char *op, *arg; |
| 571 |
> |
static char * |
| 572 |
> |
addarg( /* add argument and advance pointer */ |
| 573 |
> |
register char *op, |
| 574 |
> |
register char *arg |
| 575 |
> |
) |
| 576 |
|
{ |
| 577 |
|
*op = ' '; |
| 578 |
|
while ( (*++op = *arg++) ) |
| 581 |
|
} |
| 582 |
|
|
| 583 |
|
|
| 584 |
< |
oconvopts(oo) /* get oconv options */ |
| 585 |
< |
register char *oo; |
| 584 |
> |
static void |
| 585 |
> |
oconvopts( /* get oconv options */ |
| 586 |
> |
register char *oo |
| 587 |
> |
) |
| 588 |
|
{ |
| 589 |
|
/* BEWARE: This may be called via setdefaults(), so no assumptions */ |
| 590 |
|
|
| 594 |
|
} |
| 595 |
|
|
| 596 |
|
|
| 597 |
< |
mkillumopts(mo) /* get mkillum options */ |
| 598 |
< |
register char *mo; |
| 597 |
> |
static void |
| 598 |
> |
mkillumopts( /* get mkillum options */ |
| 599 |
> |
register char *mo |
| 600 |
> |
) |
| 601 |
|
{ |
| 602 |
|
/* BEWARE: This may be called via setdefaults(), so no assumptions */ |
| 603 |
|
|
| 607 |
|
} |
| 608 |
|
|
| 609 |
|
|
| 610 |
< |
checkambfile() /* check date on ambient file */ |
| 610 |
> |
static void |
| 611 |
> |
checkambfile(void) /* check date on ambient file */ |
| 612 |
|
{ |
| 613 |
|
time_t afdate; |
| 614 |
|
|
| 625 |
|
} |
| 626 |
|
|
| 627 |
|
|
| 628 |
< |
double |
| 629 |
< |
ambval() /* compute ambient value */ |
| 628 |
> |
static double |
| 629 |
> |
ambval(void) /* compute ambient value */ |
| 630 |
|
{ |
| 631 |
|
if (vdef(EXPOSURE)) { |
| 632 |
|
if (vval(EXPOSURE)[0] == '+' || vval(EXPOSURE)[0] == '-') |
| 638 |
|
if (vlet(ZONE) == 'I') |
| 639 |
|
return(.01); |
| 640 |
|
badvalue(ZONE); |
| 641 |
+ |
return 0; /* pro forma return */ |
| 642 |
|
} |
| 643 |
|
|
| 644 |
|
|
| 645 |
< |
renderopts(op, po) /* set rendering options */ |
| 646 |
< |
char *op, *po; |
| 645 |
> |
static void |
| 646 |
> |
renderopts( /* set rendering options */ |
| 647 |
> |
char *op, |
| 648 |
> |
char *po |
| 649 |
> |
) |
| 650 |
|
{ |
| 651 |
|
switch(vscale(QUALITY)) { |
| 652 |
|
case LOW: |
| 662 |
|
} |
| 663 |
|
|
| 664 |
|
|
| 665 |
< |
lowqopts(op, po) /* low quality rendering options */ |
| 666 |
< |
register char *op; |
| 667 |
< |
char *po; |
| 665 |
> |
static void |
| 666 |
> |
lowqopts( /* low quality rendering options */ |
| 667 |
> |
register char *op, |
| 668 |
> |
char *po |
| 669 |
> |
) |
| 670 |
|
{ |
| 671 |
|
double d, org[3], siz[3]; |
| 672 |
|
|
| 732 |
|
} |
| 733 |
|
|
| 734 |
|
|
| 735 |
< |
medqopts(op, po) /* medium quality rendering options */ |
| 736 |
< |
register char *op; |
| 737 |
< |
char *po; |
| 735 |
> |
static void |
| 736 |
> |
medqopts( /* medium quality rendering options */ |
| 737 |
> |
register char *op, |
| 738 |
> |
char *po |
| 739 |
> |
) |
| 740 |
|
{ |
| 741 |
|
double d, org[3], siz[3], asz; |
| 742 |
|
|
| 812 |
|
} |
| 813 |
|
|
| 814 |
|
|
| 815 |
< |
hiqopts(op, po) /* high quality rendering options */ |
| 816 |
< |
register char *op; |
| 817 |
< |
char *po; |
| 815 |
> |
static void |
| 816 |
> |
hiqopts( /* high quality rendering options */ |
| 817 |
> |
register char *op, |
| 818 |
> |
char *po |
| 819 |
> |
) |
| 820 |
|
{ |
| 821 |
|
double d, org[3], siz[3], asz; |
| 822 |
|
|
| 890 |
|
} |
| 891 |
|
|
| 892 |
|
|
| 893 |
< |
xferopts(ro) /* transfer options if indicated */ |
| 894 |
< |
char *ro; |
| 893 |
> |
static void |
| 894 |
> |
xferopts( /* transfer options if indicated */ |
| 895 |
> |
char *ro |
| 896 |
> |
) |
| 897 |
|
{ |
| 898 |
|
int fd, n; |
| 899 |
|
register char *cp; |
| 923 |
|
} |
| 924 |
|
|
| 925 |
|
|
| 926 |
< |
pfiltopts(po) /* get pfilt options */ |
| 927 |
< |
register char *po; |
| 926 |
> |
static void |
| 927 |
> |
pfiltopts( /* get pfilt options */ |
| 928 |
> |
register char *po |
| 929 |
> |
) |
| 930 |
|
{ |
| 931 |
|
*po = '\0'; |
| 932 |
|
if (vdef(EXPOSURE)) { |
| 946 |
|
} |
| 947 |
|
|
| 948 |
|
|
| 949 |
< |
matchword(s1, s2) /* match white-delimited words */ |
| 950 |
< |
register char *s1, *s2; |
| 949 |
> |
static int |
| 950 |
> |
matchword( /* match white-delimited words */ |
| 951 |
> |
register char *s1, |
| 952 |
> |
register char *s2 |
| 953 |
> |
) |
| 954 |
|
{ |
| 955 |
|
while (isspace(*s1)) s1++; |
| 956 |
|
while (isspace(*s2)) s2++; |
| 961 |
|
} |
| 962 |
|
|
| 963 |
|
|
| 964 |
< |
char * |
| 965 |
< |
specview(vs) /* get proper view spec from vs */ |
| 966 |
< |
register char *vs; |
| 964 |
> |
static char * |
| 965 |
> |
specview( /* get proper view spec from vs */ |
| 966 |
> |
register char *vs |
| 967 |
> |
) |
| 968 |
|
{ |
| 969 |
|
static char vup[7][12] = {"-vu 0 0 -1","-vu 0 -1 0","-vu -1 0 0", |
| 970 |
|
"-vu 0 0 1", "-vu 1 0 0","-vu 0 1 0","-vu 0 0 1"}; |
| 1086 |
|
} |
| 1087 |
|
|
| 1088 |
|
|
| 1089 |
< |
char * |
| 1090 |
< |
getview(n, vn) /* get view n, or NULL if none */ |
| 1091 |
< |
int n; |
| 1092 |
< |
char *vn; /* returned view name */ |
| 1089 |
> |
static char * |
| 1090 |
> |
getview( /* get view n, or NULL if none */ |
| 1091 |
> |
int n, |
| 1092 |
> |
char *vn /* returned view name */ |
| 1093 |
> |
) |
| 1094 |
|
{ |
| 1095 |
|
register char *mv; |
| 1096 |
|
|
| 1128 |
|
} |
| 1129 |
|
|
| 1130 |
|
|
| 1131 |
< |
int |
| 1132 |
< |
myprintview(vopts, fp) /* print out selected view */ |
| 1133 |
< |
register char *vopts; |
| 1134 |
< |
FILE *fp; |
| 1131 |
> |
static int |
| 1132 |
> |
myprintview( /* print out selected view */ |
| 1133 |
> |
register char *vopts, |
| 1134 |
> |
FILE *fp |
| 1135 |
> |
) |
| 1136 |
|
{ |
| 1137 |
|
VIEW vwr; |
| 1138 |
|
char buf[128]; |
| 1139 |
|
register char *cp; |
| 1063 |
– |
again: |
| 1140 |
|
if (vopts == NULL) |
| 1141 |
|
return(-1); |
| 1142 |
|
#ifdef _WIN32 |
| 1159 |
|
} |
| 1160 |
|
|
| 1161 |
|
|
| 1162 |
< |
rvu(opts, po) /* run rvu with first view */ |
| 1163 |
< |
char *opts, *po; |
| 1162 |
> |
static void |
| 1163 |
> |
rvu( /* run rvu with first view */ |
| 1164 |
> |
char *opts, |
| 1165 |
> |
char *po |
| 1166 |
> |
) |
| 1167 |
|
{ |
| 1168 |
|
char *vw; |
| 1169 |
|
char combuf[PATH_MAX]; |
| 1185 |
|
} |
| 1186 |
|
|
| 1187 |
|
|
| 1188 |
< |
rpict(opts, po) /* run rpict and pfilt for each view */ |
| 1189 |
< |
char *opts, *po; |
| 1188 |
> |
static void |
| 1189 |
> |
rpict( /* run rpict and pfilt for each view */ |
| 1190 |
> |
char *opts, |
| 1191 |
> |
char *po |
| 1192 |
> |
) |
| 1193 |
|
{ |
| 1194 |
|
char combuf[PATH_MAX]; |
| 1195 |
|
char rawfile[PATH_MAX], picfile[PATH_MAX]; |
| 1366 |
|
} |
| 1367 |
|
|
| 1368 |
|
|
| 1369 |
< |
touch(fn) /* update a file */ |
| 1370 |
< |
char *fn; |
| 1369 |
> |
static int |
| 1370 |
> |
touch( /* update a file */ |
| 1371 |
> |
char *fn |
| 1372 |
> |
) |
| 1373 |
|
{ |
| 1374 |
|
if (!silent) |
| 1375 |
|
printf("\ttouch %s\n", fn); |
| 1384 |
|
} |
| 1385 |
|
|
| 1386 |
|
|
| 1387 |
< |
runcom(cs) /* run command */ |
| 1388 |
< |
char *cs; |
| 1387 |
> |
static int |
| 1388 |
> |
runcom( /* run command */ |
| 1389 |
> |
char *cs |
| 1390 |
> |
) |
| 1391 |
|
{ |
| 1392 |
|
if (!silent) /* echo it */ |
| 1393 |
|
printf("\t%s\n", cs); |
| 1398 |
|
} |
| 1399 |
|
|
| 1400 |
|
|
| 1401 |
< |
rmfile(fn) /* remove a file */ |
| 1402 |
< |
char *fn; |
| 1401 |
> |
static int |
| 1402 |
> |
rmfile( /* remove a file */ |
| 1403 |
> |
char *fn |
| 1404 |
> |
) |
| 1405 |
|
{ |
| 1406 |
|
if (!silent) |
| 1407 |
|
printf("\t%s %s\n", DELCMD, fn); |
| 1411 |
|
} |
| 1412 |
|
|
| 1413 |
|
|
| 1414 |
< |
mvfile(fold, fnew) /* move a file */ |
| 1415 |
< |
char *fold, *fnew; |
| 1414 |
> |
static int |
| 1415 |
> |
mvfile( /* move a file */ |
| 1416 |
> |
char *fold, |
| 1417 |
> |
char *fnew |
| 1418 |
> |
) |
| 1419 |
|
{ |
| 1420 |
|
if (!silent) |
| 1421 |
|
printf("\t%s %s %s\n", RENAMECMD, fold, fnew); |
| 1426 |
|
|
| 1427 |
|
|
| 1428 |
|
#ifdef RHAS_FORK_EXEC |
| 1429 |
< |
int |
| 1430 |
< |
next_process() /* fork the next process (max. nprocs) */ |
| 1429 |
> |
static int |
| 1430 |
> |
next_process(void) /* fork the next process (max. nprocs) */ |
| 1431 |
|
{ |
| 1432 |
|
int child_pid; |
| 1433 |
|
|
| 1454 |
|
return(0); |
| 1455 |
|
} |
| 1456 |
|
|
| 1457 |
< |
wait_process(all) /* wait for process(es) to finish */ |
| 1458 |
< |
int all; |
| 1457 |
> |
static void |
| 1458 |
> |
wait_process( /* wait for process(es) to finish */ |
| 1459 |
> |
int all |
| 1460 |
> |
) |
| 1461 |
|
{ |
| 1462 |
|
int ourstatus = 0; |
| 1463 |
|
int pid, status; |
| 1484 |
|
quit(ourstatus); /* bad status from child */ |
| 1485 |
|
} |
| 1486 |
|
#else /* ! RHAS_FORK_EXEC */ |
| 1487 |
< |
int |
| 1488 |
< |
next_process() |
| 1487 |
> |
static int |
| 1488 |
> |
next_process(void) |
| 1489 |
|
{ |
| 1490 |
|
return(0); /* cannot start new process */ |
| 1491 |
|
} |
| 1492 |
+ |
static void |
| 1493 |
|
wait_process(all) |
| 1494 |
|
int all; |
| 1495 |
|
{ |
| 1503 |
|
} |
| 1504 |
|
#endif /* ! RHAS_FORK_EXEC */ |
| 1505 |
|
|
| 1506 |
< |
finish_process() /* exit a child process */ |
| 1506 |
> |
static void |
| 1507 |
> |
finish_process(void) /* exit a child process */ |
| 1508 |
|
{ |
| 1509 |
|
if (!inchild()) |
| 1510 |
|
return; /* in parent -- noop */ |
| 1531 |
|
#endif |
| 1532 |
|
|
| 1533 |
|
|
| 1534 |
< |
badvalue(vc) /* report bad variable value and exit */ |
| 1535 |
< |
int vc; |
| 1534 |
> |
static void |
| 1535 |
> |
badvalue( /* report bad variable value and exit */ |
| 1536 |
> |
int vc |
| 1537 |
> |
) |
| 1538 |
|
{ |
| 1539 |
|
fprintf(stderr, "%s: bad value for variable '%s'\n", |
| 1540 |
|
progname, vnam(vc)); |
| 1542 |
|
} |
| 1543 |
|
|
| 1544 |
|
|
| 1545 |
< |
syserr(s) /* report a system error and exit */ |
| 1546 |
< |
char *s; |
| 1545 |
> |
static void |
| 1546 |
> |
syserr( /* report a system error and exit */ |
| 1547 |
> |
char *s |
| 1548 |
> |
) |
| 1549 |
|
{ |
| 1550 |
|
perror(s); |
| 1551 |
|
quit(1); |