--- ray/src/px/xshowtrace.c 2003/02/22 02:07:28 2.7 +++ ray/src/px/xshowtrace.c 2003/11/10 12:28:56 2.9 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: xshowtrace.c,v 2.7 2003/02/22 02:07:28 greg Exp $"; +static const char RCSid[] = "$Id: xshowtrace.c,v 2.9 2003/11/10 12:28:56 schorsch Exp $"; #endif /* * Display an image and watch the rays get traced. @@ -7,9 +7,11 @@ static const char RCSid[] = "$Id: xshowtrace.c,v 2.7 2 * 9/21/90 Greg Ward */ +#include + #include "standard.h" +#include "paths.h" #include "view.h" -#include #define MAXDEPTH 32 /* ridiculous ray tree depth */ @@ -49,7 +51,7 @@ int argc; char *argv[]; { int i; - char combuf[256]; + char combuf[PATH_MAX]; progname = argv[0]; for (i = 1; i < argc-2; i++) @@ -78,7 +80,7 @@ char *argv[]; exit(1); } /* build input command */ - sprintf(combuf, "%s %s | %s", xicom, picture, rtcom); + sprintf(combuf, "%s \"%s\" | %s", xicom, picture, rtcom); for ( ; i < argc-1; i++) { strcat(combuf, " "); strcat(combuf, argv[i]); @@ -136,10 +138,12 @@ mainloop() /* get and process input */ freetree(tp) /* free a trace tree */ struct node *tp; { - register struct node *kid; + register struct node *kid, *k2; - for (kid = tp->daughter; kid != NULL; kid = kid->sister) + for (kid = tp->daughter; kid != NULL; kid = k2) { + k2 = kid->sister; freetree(kid); + } free((void *)tp); }