--- ray/src/gen/genworm.c 2003/08/04 22:37:53 2.6 +++ ray/src/gen/genworm.c 2004/08/21 11:54:06 2.8 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: genworm.c,v 2.6 2003/08/04 22:37:53 greg Exp $"; +static const char RCSid[] = "$Id: genworm.c,v 2.8 2004/08/21 11:54:06 greg Exp $"; #endif /* * genworm.c - program to generate worms (strings with varying thickness). @@ -11,9 +11,14 @@ static const char RCSid[] = "$Id: genworm.c,v 2.6 2003 * 9/24/87 */ +#include #include #include +#include + #include "calcomp.h" +#include "resolu.h" +#include "rterror.h" #include "fvect.h" #define XNAME "X`SYS`" /* x function name */ @@ -26,16 +31,17 @@ static const char RCSid[] = "$Id: genworm.c,v 2.6 2003 #define max(a,b) ((a) > (b) ? (a) : (b)) +/* XXX redundant, move to library */ double l_hermite(char *), l_bezier(char *), l_bspline(char *); -void quit(); +int main(argc, argv) int argc; char *argv[]; { char stmp[256]; - double t, f, lastr, r; + double t, f, lastr = 0, r; FVECT lastp, p; int i, nseg; @@ -67,7 +73,8 @@ char *argv[]; if (nseg <= 0) goto userror; - printhead(argc, argv); + fputs("# ", stdout); + printargs(argc, argv, stdout); eclock = 0; for (i = 0; i <= nseg; i++) { @@ -110,50 +117,13 @@ char *argv[]; VCOPY(lastp, p); lastr = r; } - quit(0); + return 0; userror: fprintf(stderr, "Usage: %s material name x(t) y(t) z(t) r(t) nseg [-e expr] [-f file]\n", argv[0]); - quit(1); -} - - -void -eputs(msg) -char *msg; -{ - fputs(msg, stderr); -} - - -void -wputs(msg) -char *msg; -{ - eputs(msg); -} - - -void -quit(code) -int code; -{ - exit(code); -} - - -printhead(ac, av) /* print command header */ -register int ac; -register char **av; -{ - putchar('#'); - while (ac--) { - putchar(' '); - fputs(*av++, stdout); - } - putchar('\n'); + return 1; }