--- ray/src/util/ranimate.c 2005/02/07 17:08:17 2.49 +++ ray/src/util/ranimate.c 2013/06/08 02:49:19 2.55 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: ranimate.c,v 2.49 2005/02/07 17:08:17 greg Exp $"; +static const char RCSid[] = "$Id: ranimate.c,v 2.55 2013/06/08 02:49:19 greg Exp $"; #endif /* * Radiance animation control program @@ -22,6 +22,7 @@ static const char RCSid[] = "$Id: ranimate.c,v 2.49 20 #include #include "platform.h" +#include "rtprocess.h" #include "paths.h" #include "standard.h" #include "view.h" @@ -94,7 +95,7 @@ VARIABLE vv[] = { /* variable-value pairs */ struct { char host[64]; /* control host name */ - int pid; /* control process id */ + RT_PID pid; /* control process id */ char cfname[128]; /* control file name */ int rnext; /* next frame to render */ int fnext; /* next frame to filter */ @@ -118,7 +119,7 @@ char arcargs[10240]; /* files to archive */ char *arcfirst, *arcnext; /* pointers to first and next argument */ struct pslot { - int pid; /* process ID (0 if empty) */ + RT_PID pid; /* process ID (0 if empty) */ int fout; /* output frame number */ int (*rcvf)(); /* recover function */ } *pslot; /* process slots */ @@ -127,7 +128,7 @@ int npslots; /* number of process slots */ #define phostname(ps) ((ps)->hostname[0] ? (ps)->hostname : astat.host) PSERVER *lastpserver; /* last process server with error */ -static struct pslot * findpslot(int pid); +static struct pslot * findpslot(RT_PID pid); static void checkdir(void); static VIEW * getview(int n); @@ -141,7 +142,7 @@ static int rmfile(char *fn); static int runcom(char *cs); static int pruncom(char *com, char *ppins, int maxcopies); static void bwait(int ncoms); -static int bruncom(char *com, int fout, int (*rf)()); +static RT_PID bruncom(char *com, int fout, int (*rf)()); static int serverdown(void); static pscompfunc donecom; static int countviews(void); @@ -217,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); @@ -413,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)) { @@ -705,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 */ @@ -943,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++; @@ -1051,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 */ @@ -1124,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; @@ -1192,7 +1201,7 @@ getexp(int n) /* get exposure for nth frame */ static struct pslot * -findpslot(int pid) /* find or allocate a process slot */ +findpslot(RT_PID pid) /* find or allocate a process slot */ { register struct pslot *psempty = NULL; register int i; @@ -1266,14 +1275,14 @@ serverdown(void) /* check status of last process ser } -static int +static RT_PID bruncom( /* run a command in the background */ char *com, int fout, int (*rf)() ) { - int pid; + RT_PID pid; register struct pslot *psl; if (noaction) { @@ -1286,7 +1295,7 @@ int (*rf)() bwait(1); if (!silent) { /* echo command */ PSERVER *ps; - int psn = pid; + RT_PID psn = pid; ps = findjob(&psn); printf("\t%s\n", com); printf("\tProcess started on %s\n", phostname(ps));