--- ray/src/rt/rpmain.c 2003/07/21 22:30:19 2.7 +++ ray/src/rt/rpmain.c 2005/06/15 15:36:52 2.10 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rpmain.c,v 2.7 2003/07/21 22:30:19 schorsch Exp $"; +static const char RCSid[] = "$Id: rpmain.c,v 2.10 2005/06/15 15:36:52 greg Exp $"; #endif /* * rpmain.c - main for rpict batch rendering program @@ -7,7 +7,7 @@ static const char RCSid[] = "$Id: rpmain.c,v 2.7 2003/ #include "copyright.h" -#include +#include #include #include "platform.h" @@ -27,13 +27,9 @@ static const char RCSid[] = "$Id: rpmain.c,v 2.7 2003/ #endif char *progname; /* argv[0] */ - char *octname; /* octree name */ - char *sigerr[NSIG]; /* signal error messages */ - char *shm_boundary = NULL; /* boundary of shared memory */ - char *errfile = NULL; /* error output file */ extern time_t time(); @@ -53,15 +49,15 @@ extern double dstrpix; /* square pixel distribution extern double mblur; /* motion blur parameter */ -void onsig(); -void sigdie(); -void printdefaults(); +extern double dblur; /* depth-of-field blur parameter */ +static void onsig(int signo); +static void sigdie(int signo, char *msg); +static void printdefaults(void); + int -main(argc, argv) -int argc; -char *argv[]; +main(int argc, char *argv[]) { #define check(ol,al) if (argv[i][ol] || \ badarg(argc-i-1,argv+i+1,al)) \ @@ -158,6 +154,10 @@ char *argv[]; check(3,"f"); mblur = atof(argv[++i]); break; + case 'd': /* aperture */ + check(3,"f"); + dblur = atof(argv[++i]); + break; default: goto badopt; } @@ -227,6 +227,7 @@ char *argv[]; initotypes(); /* initialize urand */ initurand(2048); + srandom(rand_samp ? (long)time(0) : 0L); /* set up signal handling */ sigdie(SIGINT, "Interrupt"); #ifdef SIGHUP @@ -354,6 +355,7 @@ runagain: badopt: sprintf(errmsg, "command line error at '%s'", argv[i]); error(USER, errmsg); + return 1; /* pro forma return */ #undef check #undef bool @@ -361,8 +363,9 @@ badopt: void -wputs(s) /* warning output function */ -char *s; +wputs( /* warning output function */ + char *s +) { int lasterrno = errno; eputs(s); @@ -371,8 +374,9 @@ char *s; void -eputs(s) /* put string to stderr */ -register char *s; +eputs( /* put string to stderr */ + register char *s +) { static int midline = 0; @@ -390,9 +394,10 @@ register char *s; } -void -onsig(signo) /* fatal signal */ -int signo; +static void +onsig( /* fatal signal */ + int signo +) { static int gotsig = 0; @@ -410,10 +415,11 @@ int signo; } -void -sigdie(signo, msg) /* set fatal signal */ -int signo; -char *msg; +static void +sigdie( /* set fatal signal */ + int signo, + char *msg +) { if (signal(signo, onsig) == SIG_IGN) signal(signo, SIG_IGN); @@ -421,8 +427,8 @@ char *msg; } -void -printdefaults() /* print default values to stdout */ +static void +printdefaults(void) /* print default values to stdout */ { printf("-vt%c\t\t\t\t# view type %s\n", ourview.type, ourview.type==VT_PER ? "perspective" : @@ -448,6 +454,7 @@ printdefaults() /* print default values to stdout */ printf("-pa %f\t\t\t# pixel aspect ratio\n", pixaspect); printf("-pj %f\t\t\t# pixel jitter\n", dstrpix); printf("-pm %f\t\t\t# pixel motion\n", mblur); + printf("-pd %f\t\t\t# pixel depth-of-field\n", dblur); printf("-ps %-9d\t\t\t# pixel sample\n", psample); printf("-pt %f\t\t\t# pixel threshold\n", maxdiff); printf("-t %-9d\t\t\t# time between reports\n", ralrm);