--- ray/src/util/ranimate.c 2005/09/12 14:40:14 2.50 +++ ray/src/util/ranimate.c 2023/06/10 15:49:55 2.58 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: ranimate.c,v 2.50 2005/09/12 14:40:14 schorsch Exp $"; +static const char RCSid[] = "$Id: ranimate.c,v 2.58 2023/06/10 15:49:55 greg Exp $"; #endif /* * Radiance animation control program @@ -67,28 +67,28 @@ int NVARS = 24; /* total number of variables */ VARIABLE vv[] = { /* variable-value pairs */ {"ANIMATE", 2, 0, NULL, onevalue}, {"ARCHIVE", 2, 0, NULL, onevalue}, - {"BASENAME", 3, 0, NULL, onevalue}, + {"BASENAME", 3, 0, NULL, strvalue}, {"DBLUR", 2, 0, NULL, onevalue}, - {"DIRECTORY", 3, 0, NULL, onevalue}, + {"DIRECTORY", 3, 0, NULL, strvalue}, {"DISKSPACE", 3, 0, NULL, fltvalue}, {"END", 2, 0, NULL, intvalue}, {"EXPOSURE", 3, 0, NULL, onevalue}, {"host", 4, 0, NULL, NULL}, {"INTERPOLATE", 3, 0, NULL, intvalue}, {"MBLUR", 2, 0, NULL, onevalue}, - {"NEXTANIM", 3, 0, NULL, onevalue}, - {"OCTREE", 3, 0, NULL, onevalue}, + {"NEXTANIM", 3, 0, NULL, strvalue}, + {"OCTREE", 3, 0, NULL, strvalue}, {"OVERSAMPLE", 2, 0, NULL, fltvalue}, {"pfilt", 2, 0, NULL, catvalues}, {"pinterp", 2, 0, NULL, catvalues}, {"render", 3, 0, NULL, catvalues}, {"RESOLUTION", 3, 0, NULL, onevalue}, - {"RIF", 3, 0, NULL, onevalue}, + {"RIF", 3, 0, NULL, strvalue}, {"RSH", 3, 0, NULL, onevalue}, {"RTRACE", 2, 0, NULL, boolvalue}, {"START", 2, 0, NULL, intvalue}, {"TRANSFER", 2, 0, NULL, onevalue}, - {"VIEWFILE", 2, 0, NULL, onevalue}, + {"VIEWFILE", 2, 0, NULL, strvalue}, }; #define SFNAME "STATUS" /* status file name */ @@ -218,17 +218,19 @@ main( animate(); /* all done */ if (vdef(NEXTANIM)) { + char *fullp; argv[i] = vval(NEXTANIM); /* just change input file */ if (!silent) printargs(argc, argv, stdout); - if ((argv[0] = getpath(progname,getenv("PATH"),X_OK)) == NULL) - fprintf(stderr, "%s: command not found\n", progname); + fflush(stdout); + if ((fullp = getpath(argv[0],getenv("PATH"),X_OK)) == NULL) + fprintf(stderr, "%s: command not found\n", argv[0]); else - execv(progname, argv); + execv(fullp, argv); quit(1); } quit(0); - return 0; /* pro forma return */ + return(0); /* pro forma return */ userr: fprintf(stderr, "Usage: %s [-s][-n][-w][-e] anim_file\n", progname); quit(1); @@ -414,9 +416,9 @@ setdefaults(void) /* set default values */ if (!vdef(DISKSPACE)) { if (!nowarn) fprintf(stderr, - "%s: warning - no %s setting, assuming 100 Mbytes available\n", + "%s: warning - no %s setting, assuming 1000 Mbytes available\n", progname, vnam(DISKSPACE)); - vval(DISKSPACE) = "100"; + vval(DISKSPACE) = "1000"; vdef(DISKSPACE)++; } if (!vdef(RSH)) { @@ -706,7 +708,7 @@ transferframes(void) /* catch up with picture transf *cp++ = ' '; sprintf(cp, fbase, i); while (*cp) cp++; - strcpy(cp, ".pic"); + strcpy(cp, ".hdr"); cp += 4; } if (runcom(combuf)) { /* transfer frames */ @@ -944,6 +946,13 @@ int rvr usepfilt |= nora_rgbe; } else if (frseq[0] == frame) { /* no interpolation needed */ if (!rvr && frame > 1+vint(INTERP)) { /* archive previous */ + if (arcnext - arcargs + + strlen(fbase) >= sizeof(arcargs)-8) { + fprintf(stderr, +"%s: too many filenames in archive command -- reduce %s variable\n", + progname, vnam(DISKSPACE)); + quit(1); + } *arcnext++ = ' '; sprintf(arcnext, fbase, frame-vint(INTERP)-1); while (*arcnext) arcnext++; @@ -1052,7 +1061,7 @@ int rvr } /* output file name */ sprintf(fname0, vval(BASENAME), frame); - sprintf(combuf+strlen(combuf), " > %s.pic", fname0); + sprintf(combuf+strlen(combuf), " > %s.hdr", fname0); if (rvr) /* in recovery */ return(runcom(combuf)); bruncom(combuf, frame, frecover); /* else run in background */ @@ -1125,7 +1134,6 @@ countviews(void) /* count views in view file */ static char * getexp(int n) /* get exposure for nth frame */ { - extern char *fskip(); static char expval[32]; static FILE *expfp = NULL; static long *exppos; @@ -1404,7 +1412,7 @@ static int rmfile(char *fn) /* remove a file */ { if (!silent) -#ifdef _WIN32 +#if defined(_WIN32) || defined(_WIN64) printf("\tdel %s\n", fn); #else printf("\trm -f %s\n", fn); @@ -1457,7 +1465,7 @@ getblur(double *mbf, double *dbf) /* get # blur sample int nmblur, ndblur; char *s; /* get motion blur */ - if (!vdef(MBLUR) || (mblurf = atof(vval(MBLUR))) < 0.0) + if (vdef(ANIMATE) || !vdef(MBLUR) || (mblurf = atof(vval(MBLUR))) < 0.0) mblurf = 0.0; if (mbf != NULL) *mbf = mblurf;