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" |
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); |
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++; |
1202 |
|
|
1203 |
|
|
1204 |
|
static struct pslot * |
1205 |
< |
findpslot(int pid) /* find or allocate a process slot */ |
1205 |
> |
findpslot(RT_PID pid) /* find or allocate a process slot */ |
1206 |
|
{ |
1207 |
|
register struct pslot *psempty = NULL; |
1208 |
|
register int i; |
1276 |
|
} |
1277 |
|
|
1278 |
|
|
1279 |
< |
static int |
1279 |
> |
static RT_PID |
1280 |
|
bruncom( /* run a command in the background */ |
1281 |
|
char *com, |
1282 |
|
int fout, |
1283 |
|
int (*rf)() |
1284 |
|
) |
1285 |
|
{ |
1286 |
< |
int pid; |
1286 |
> |
RT_PID pid; |
1287 |
|
register struct pslot *psl; |
1288 |
|
|
1289 |
|
if (noaction) { |
1296 |
|
bwait(1); |
1297 |
|
if (!silent) { /* echo command */ |
1298 |
|
PSERVER *ps; |
1299 |
< |
int psn = pid; |
1299 |
> |
RT_PID psn = pid; |
1300 |
|
ps = findjob(&psn); |
1301 |
|
printf("\t%s\n", com); |
1302 |
|
printf("\tProcess started on %s\n", phostname(ps)); |