| 22 |
|
#include <signal.h> |
| 23 |
|
|
| 24 |
|
#include "platform.h" |
| 25 |
+ |
#include "rtprocess.h" |
| 26 |
|
#include "paths.h" |
| 27 |
|
#include "standard.h" |
| 28 |
|
#include "view.h" |
| 33 |
|
#define DEF_NBLUR 5 |
| 34 |
|
#endif |
| 35 |
|
/* default remote shell */ |
| 36 |
< |
#define REMSH "rsh" |
| 36 |
> |
#ifndef REMSH |
| 37 |
> |
#define REMSH "ssh" |
| 38 |
> |
#endif |
| 39 |
|
/* input variables (alphabetical by name) */ |
| 40 |
|
#define ANIMATE 0 /* animation command */ |
| 41 |
|
#define ARCHIVE 1 /* archiving command */ |
| 95 |
|
|
| 96 |
|
struct { |
| 97 |
|
char host[64]; /* control host name */ |
| 98 |
< |
int pid; /* control process id */ |
| 98 |
> |
RT_PID pid; /* control process id */ |
| 99 |
|
char cfname[128]; /* control file name */ |
| 100 |
|
int rnext; /* next frame to render */ |
| 101 |
|
int fnext; /* next frame to filter */ |
| 119 |
|
char *arcfirst, *arcnext; /* pointers to first and next argument */ |
| 120 |
|
|
| 121 |
|
struct pslot { |
| 122 |
< |
int pid; /* process ID (0 if empty) */ |
| 122 |
> |
RT_PID pid; /* process ID (0 if empty) */ |
| 123 |
|
int fout; /* output frame number */ |
| 124 |
|
int (*rcvf)(); /* recover function */ |
| 125 |
|
} *pslot; /* process slots */ |
| 128 |
|
#define phostname(ps) ((ps)->hostname[0] ? (ps)->hostname : astat.host) |
| 129 |
|
PSERVER *lastpserver; /* last process server with error */ |
| 130 |
|
|
| 131 |
< |
static struct pslot * findpslot(int pid); |
| 131 |
> |
static struct pslot * findpslot(RT_PID pid); |
| 132 |
|
static void checkdir(void); |
| 133 |
|
static VIEW * getview(int n); |
| 134 |
|
|
| 142 |
|
static int runcom(char *cs); |
| 143 |
|
static int pruncom(char *com, char *ppins, int maxcopies); |
| 144 |
|
static void bwait(int ncoms); |
| 145 |
< |
static int bruncom(char *com, int fout, int (*rf)()); |
| 145 |
> |
static RT_PID bruncom(char *com, int fout, int (*rf)()); |
| 146 |
|
static int serverdown(void); |
| 147 |
|
static pscompfunc donecom; |
| 148 |
|
static int countviews(void); |
| 218 |
|
animate(); |
| 219 |
|
/* all done */ |
| 220 |
|
if (vdef(NEXTANIM)) { |
| 221 |
+ |
char *fullp; |
| 222 |
|
argv[i] = vval(NEXTANIM); /* just change input file */ |
| 223 |
|
if (!silent) |
| 224 |
|
printargs(argc, argv, stdout); |
| 225 |
< |
if ((argv[0] = getpath(progname,getenv("PATH"),X_OK)) == NULL) |
| 226 |
< |
fprintf(stderr, "%s: command not found\n", progname); |
| 225 |
> |
fflush(stdout); |
| 226 |
> |
if ((fullp = getpath(argv[0],getenv("PATH"),X_OK)) == NULL) |
| 227 |
> |
fprintf(stderr, "%s: command not found\n", argv[0]); |
| 228 |
|
else |
| 229 |
< |
execv(progname, argv); |
| 229 |
> |
execv(fullp, argv); |
| 230 |
|
quit(1); |
| 231 |
|
} |
| 232 |
|
quit(0); |
| 233 |
< |
return 0; /* pro forma return */ |
| 233 |
> |
return(0); /* pro forma return */ |
| 234 |
|
userr: |
| 235 |
|
fprintf(stderr, "Usage: %s [-s][-n][-w][-e] anim_file\n", progname); |
| 236 |
|
quit(1); |
| 708 |
|
*cp++ = ' '; |
| 709 |
|
sprintf(cp, fbase, i); |
| 710 |
|
while (*cp) cp++; |
| 711 |
< |
strcpy(cp, ".pic"); |
| 711 |
> |
strcpy(cp, ".hdr"); |
| 712 |
|
cp += 4; |
| 713 |
|
} |
| 714 |
|
if (runcom(combuf)) { /* transfer frames */ |
| 946 |
|
usepfilt |= nora_rgbe; |
| 947 |
|
} else if (frseq[0] == frame) { /* no interpolation needed */ |
| 948 |
|
if (!rvr && frame > 1+vint(INTERP)) { /* archive previous */ |
| 949 |
+ |
if (arcnext - arcargs + |
| 950 |
+ |
strlen(fbase) >= sizeof(arcargs)-8) { |
| 951 |
+ |
fprintf(stderr, |
| 952 |
+ |
"%s: too many filenames in archive command -- reduce %s variable\n", |
| 953 |
+ |
progname, vnam(DISKSPACE)); |
| 954 |
+ |
quit(1); |
| 955 |
+ |
} |
| 956 |
|
*arcnext++ = ' '; |
| 957 |
|
sprintf(arcnext, fbase, frame-vint(INTERP)-1); |
| 958 |
|
while (*arcnext) arcnext++; |
| 1061 |
|
} |
| 1062 |
|
/* output file name */ |
| 1063 |
|
sprintf(fname0, vval(BASENAME), frame); |
| 1064 |
< |
sprintf(combuf+strlen(combuf), " > %s.pic", fname0); |
| 1064 |
> |
sprintf(combuf+strlen(combuf), " > %s.hdr", fname0); |
| 1065 |
|
if (rvr) /* in recovery */ |
| 1066 |
|
return(runcom(combuf)); |
| 1067 |
|
bruncom(combuf, frame, frecover); /* else run in background */ |
| 1134 |
|
static char * |
| 1135 |
|
getexp(int n) /* get exposure for nth frame */ |
| 1136 |
|
{ |
| 1125 |
– |
extern char *fskip(); |
| 1137 |
|
static char expval[32]; |
| 1138 |
|
static FILE *expfp = NULL; |
| 1139 |
|
static long *exppos; |
| 1201 |
|
|
| 1202 |
|
|
| 1203 |
|
static struct pslot * |
| 1204 |
< |
findpslot(int pid) /* find or allocate a process slot */ |
| 1204 |
> |
findpslot(RT_PID pid) /* find or allocate a process slot */ |
| 1205 |
|
{ |
| 1206 |
|
register struct pslot *psempty = NULL; |
| 1207 |
|
register int i; |
| 1275 |
|
} |
| 1276 |
|
|
| 1277 |
|
|
| 1278 |
< |
static int |
| 1278 |
> |
static RT_PID |
| 1279 |
|
bruncom( /* run a command in the background */ |
| 1280 |
|
char *com, |
| 1281 |
|
int fout, |
| 1282 |
|
int (*rf)() |
| 1283 |
|
) |
| 1284 |
|
{ |
| 1285 |
< |
int pid; |
| 1285 |
> |
RT_PID pid; |
| 1286 |
|
register struct pslot *psl; |
| 1287 |
|
|
| 1288 |
|
if (noaction) { |
| 1295 |
|
bwait(1); |
| 1296 |
|
if (!silent) { /* echo command */ |
| 1297 |
|
PSERVER *ps; |
| 1298 |
< |
int psn = pid; |
| 1298 |
> |
RT_PID psn = pid; |
| 1299 |
|
ps = findjob(&psn); |
| 1300 |
|
printf("\t%s\n", com); |
| 1301 |
|
printf("\tProcess started on %s\n", phostname(ps)); |