1 |
– |
/* Copyright (c) 1998 Silicon Graphics, Inc. */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ SGI"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* Executive program for oconv, rpict and pfilt |
6 |
|
*/ |
7 |
|
|
8 |
|
#include "standard.h" |
9 |
+ |
|
10 |
+ |
#include <ctype.h> |
11 |
+ |
#include <time.h> |
12 |
+ |
|
13 |
+ |
#include "platform.h" |
14 |
|
#include "view.h" |
15 |
|
#include "paths.h" |
16 |
|
#include "vars.h" |
15 |
– |
#include <ctype.h> |
16 |
– |
#include <sys/types.h> |
17 |
|
|
18 |
+ |
#ifdef _WIN32 |
19 |
+ |
#define DELCMD "del" |
20 |
+ |
#define RENAMECMD "rename" |
21 |
+ |
#else |
22 |
+ |
#define DELCMD "rm -f" |
23 |
+ |
#define RENAMECMD "mv" |
24 |
+ |
#endif |
25 |
+ |
|
26 |
|
/* variables (alphabetical by name) */ |
27 |
|
#define AMBFILE 0 /* ambient file name */ |
28 |
|
#define DETAIL 1 /* level of scene detail */ |
83 |
|
}; |
84 |
|
|
85 |
|
/* overture calculation file */ |
86 |
< |
#ifdef NIX |
87 |
< |
char overfile[] = "overture.unf"; |
86 |
> |
#ifdef NULL_DEVICE |
87 |
> |
char overfile[] = NULL_DEVICE; |
88 |
|
#else |
89 |
< |
char overfile[] = "/dev/null"; |
89 |
> |
char overfile[] = "overture.unf"; |
90 |
|
#endif |
91 |
|
|
84 |
– |
extern time_t fdate(), time(); |
92 |
|
|
93 |
|
time_t scenedate; /* date of latest scene or object file */ |
94 |
|
time_t octreedate; /* date of octree */ |
104 |
|
int explicate = 0; /* explicate variables */ |
105 |
|
int silent = 0; /* do work silently */ |
106 |
|
int touchonly = 0; /* touch files only */ |
107 |
< |
int noaction = 0; /* don't do anything */ |
107 |
> |
int nprocs = 1; /* maximum executing processes */ |
108 |
|
int sayview = 0; /* print view out */ |
109 |
|
char *rvdevice = NULL; /* rview output device */ |
110 |
|
char *viewselect = NULL; /* specific view only */ |
111 |
|
|
112 |
|
int overture = 0; /* overture calculation needed */ |
113 |
|
|
114 |
+ |
int children_running = 0; /* set negative in children */ |
115 |
+ |
|
116 |
|
char *progname; /* global argv[0] */ |
117 |
|
char *rifname; /* global rad input file name */ |
118 |
|
|
119 |
< |
char radname[MAXPATH]; /* root Radiance file name */ |
119 |
> |
char radname[PATH_MAX]; /* root Radiance file name */ |
120 |
|
|
121 |
+ |
#define inchild() (children_running < 0) |
122 |
|
|
123 |
+ |
|
124 |
|
main(argc, argv) |
125 |
|
int argc; |
126 |
|
char *argv[]; |
137 |
|
silent++; |
138 |
|
break; |
139 |
|
case 'n': |
140 |
< |
noaction++; |
140 |
> |
nprocs = 0; |
141 |
|
break; |
142 |
+ |
case 'N': |
143 |
+ |
nprocs = atoi(argv[++i]); |
144 |
+ |
if (nprocs < 0) |
145 |
+ |
nprocs = 0; |
146 |
+ |
break; |
147 |
|
case 't': |
148 |
|
touchonly++; |
149 |
|
break; |
168 |
|
if (i >= argc) |
169 |
|
goto userr; |
170 |
|
rifname = argv[i]; |
171 |
+ |
/* check command-line options */ |
172 |
+ |
if (nprocs > 1 & viewselect != NULL) |
173 |
+ |
nprocs = 1; |
174 |
|
/* assign Radiance root file name */ |
175 |
|
rootname(radname, rifname); |
176 |
|
/* load variable values */ |
205 |
|
quit(0); |
206 |
|
userr: |
207 |
|
fprintf(stderr, |
208 |
< |
"Usage: %s [-w][-s][-n][-t][-e][-V][-v view][-o dev] rfile [VAR=value ..]\n", |
208 |
> |
"Usage: %s [-w][-s][-n|-N npr][-t][-e][-V][-v view][-o dev] rfile [VAR=value ..]\n", |
209 |
|
progname); |
210 |
|
quit(1); |
211 |
|
} |
230 |
|
checklast(fnames) /* check files and find most recent */ |
231 |
|
register char *fnames; |
232 |
|
{ |
233 |
< |
char thisfile[MAXPATH]; |
233 |
> |
char thisfile[PATH_MAX]; |
234 |
|
time_t thisdate, lastdate = 0; |
216 |
– |
register char *cp; |
235 |
|
|
236 |
|
if (fnames == NULL) |
237 |
|
return(0); |
238 |
< |
while (*fnames) { |
239 |
< |
while (isspace(*fnames)) fnames++; |
240 |
< |
cp = thisfile; |
241 |
< |
while (*fnames && !isspace(*fnames)) |
224 |
< |
*cp++ = *fnames++; |
225 |
< |
*cp = '\0'; |
238 |
> |
while ((fnames = nextword(thisfile, PATH_MAX, fnames)) != NULL) { |
239 |
> |
if (thisfile[0] == '!' || |
240 |
> |
(thisfile[0] == '\\' && thisfile[1] == '!')) |
241 |
> |
continue; |
242 |
|
if (!(thisdate = fdate(thisfile))) |
243 |
|
syserr(thisfile); |
244 |
|
if (thisdate > lastdate) |
253 |
|
char *orig; |
254 |
|
int pred; |
255 |
|
{ |
240 |
– |
extern char *rindex(); |
256 |
|
register char *cp; |
257 |
|
register int n; |
258 |
|
int suffix; |
282 |
|
syserr(progname); |
283 |
|
sprintf(vval(OCTREE), "%s.oct", radname); |
284 |
|
vdef(OCTREE)++; |
285 |
+ |
} else if (vval(OCTREE)[0] == '!') { |
286 |
+ |
fprintf(stderr, "%s: illegal '%s' specification\n", |
287 |
+ |
progname, vnam(OCTREE)); |
288 |
+ |
quit(1); |
289 |
|
} |
290 |
|
octreedate = fdate(vval(OCTREE)); |
291 |
|
if (vdef(ILLUM)) { /* illum requires secondary octrees */ |
318 |
|
FILE *fp; |
319 |
|
register int i; |
320 |
|
|
321 |
< |
if (osiz <= FTINY) |
322 |
< |
if (noaction && fdate(oct1name) < |
321 |
> |
if (osiz <= FTINY) { |
322 |
> |
if (!nprocs && fdate(oct1name) < |
323 |
|
(scenedate>illumdate?scenedate:illumdate)) { |
324 |
|
/* run getbbox */ |
325 |
|
sprintf(buf, "getbbox -w -h %s", |
354 |
|
} |
355 |
|
pclose(fp); |
356 |
|
} |
357 |
+ |
} |
358 |
|
org[0] = oorg[0]; org[1] = oorg[1]; org[2] = oorg[2]; *sizp = osiz; |
359 |
|
} |
360 |
|
|
361 |
|
|
362 |
|
setdefaults() /* set default values for unassigned var's */ |
363 |
|
{ |
364 |
< |
double org[3], size; |
364 |
> |
double org[3], lim[3], size; |
365 |
|
char buf[128]; |
366 |
|
|
367 |
|
if (!vdef(ZONE)) { |
371 |
|
vval(ZONE) = savqstr(buf); |
372 |
|
vdef(ZONE)++; |
373 |
|
} |
374 |
+ |
if (!vdef(EYESEP)) { |
375 |
+ |
if (sscanf(vval(ZONE), "%*s %lf %lf %lf %lf %lf %lf", |
376 |
+ |
&org[0], &lim[0], &org[1], &lim[1], |
377 |
+ |
&org[2], &lim[2]) != 6) |
378 |
+ |
badvalue(ZONE); |
379 |
+ |
sprintf(buf, "%f", |
380 |
+ |
0.01*(lim[0]-org[0]+lim[1]-org[1]+lim[2]-org[2])); |
381 |
+ |
vval(EYESEP) = savqstr(buf); |
382 |
+ |
vdef(EYESEP)++; |
383 |
+ |
} |
384 |
|
if (!vdef(INDIRECT)) { |
385 |
|
vval(INDIRECT) = "0"; |
386 |
|
vdef(INDIRECT)++; |
419 |
|
oconv() /* run oconv and mkillum if necessary */ |
420 |
|
{ |
421 |
|
static char illumtmp[] = "ilXXXXXX"; |
422 |
< |
char combuf[1024], ocopts[64], mkopts[64]; |
422 |
> |
char combuf[PATH_MAX], ocopts[64], mkopts[64]; |
423 |
|
|
424 |
|
oconvopts(ocopts); /* get options */ |
425 |
|
if (octreedate < scenedate) { /* check date on original octree */ |
559 |
|
return; |
560 |
|
if (!(afdate = fdate(vval(AMBFILE)))) |
561 |
|
return; |
562 |
< |
if (oct1date > afdate) |
562 |
> |
if (oct1date > afdate) { |
563 |
|
if (touchonly) |
564 |
|
touch(vval(AMBFILE)); |
565 |
|
else |
566 |
|
rmfile(vval(AMBFILE)); |
567 |
+ |
} |
568 |
|
} |
569 |
|
|
570 |
|
|
845 |
|
syserr(vval(OPTFILE)); |
846 |
|
sprintf(ro, " @%s", vval(OPTFILE)); |
847 |
|
} |
848 |
< |
#ifdef MSDOS |
848 |
> |
#ifdef _WIN32 |
849 |
|
else if (n > 50) { |
850 |
|
setenv("ROPT", ro+1); |
851 |
|
strcpy(ro, " $ROPT"); |
864 |
|
} |
865 |
|
switch (vscale(QUALITY)) { |
866 |
|
case MEDIUM: |
867 |
< |
po = addarg(po, "-r 1"); |
867 |
> |
po = addarg(po, "-r .6"); |
868 |
|
break; |
869 |
|
case HIGH: |
870 |
|
po = addarg(po, "-m .25"); |
1001 |
|
if (cp == viewopts) /* append any additional options */ |
1002 |
|
vs++; /* skip prefixed space if unneeded */ |
1003 |
|
strcpy(cp, vs); |
1004 |
< |
#ifdef MSDOS |
1004 |
> |
#ifdef _WIN32 |
1005 |
|
if (strlen(viewopts) > 40) { |
1006 |
|
setenv("VIEW", viewopts); |
1007 |
|
return("$VIEW"); |
1052 |
|
} |
1053 |
|
|
1054 |
|
|
1055 |
< |
printview(vopts) /* print out selected view */ |
1055 |
> |
int |
1056 |
> |
myprintview(vopts, fp) /* print out selected view */ |
1057 |
|
register char *vopts; |
1058 |
+ |
FILE *fp; |
1059 |
|
{ |
1027 |
– |
extern char *strstr(), *atos(), *getenv(); |
1060 |
|
VIEW vwr; |
1061 |
|
char buf[128]; |
1062 |
|
register char *cp; |
1063 |
|
again: |
1064 |
|
if (vopts == NULL) |
1065 |
|
return(-1); |
1066 |
< |
#ifdef MSDOS |
1066 |
> |
#ifdef _WIN32 |
1067 |
|
if (vopts[0] == '$') { |
1068 |
|
vopts = getenv(vopts+1); |
1069 |
|
goto again; |
1070 |
|
} |
1071 |
|
#endif |
1072 |
< |
copystruct(&vwr, &stdview); |
1073 |
< |
cp = vopts; /* get -vf files first */ |
1072 |
> |
vwr = stdview; |
1073 |
> |
sscanview(&vwr, cp=vopts); /* set initial options */ |
1074 |
|
while ((cp = strstr(cp, "-vf ")) != NULL && |
1075 |
< |
*atos(buf, sizeof(buf), cp += 4)) |
1076 |
< |
viewfile(buf, &vwr, NULL); |
1077 |
< |
sscanview(&vwr, vopts); /* get the rest */ |
1078 |
< |
fputs(VIEWSTR, stdout); |
1079 |
< |
fprintview(&vwr, stdout); /* print full spec. */ |
1080 |
< |
fputc('\n', stdout); |
1075 |
> |
*atos(buf, sizeof(buf), cp += 4)) { |
1076 |
> |
viewfile(buf, &vwr, NULL); /* load -vf file */ |
1077 |
> |
sscanview(&vwr, cp); /* reset tail */ |
1078 |
> |
} |
1079 |
> |
fputs(VIEWSTR, fp); |
1080 |
> |
fprintview(&vwr, fp); /* print full spec. */ |
1081 |
> |
fputc('\n', fp); |
1082 |
|
return(0); |
1083 |
|
} |
1084 |
|
|
1087 |
|
char *opts, *po; |
1088 |
|
{ |
1089 |
|
char *vw; |
1090 |
< |
char combuf[512]; |
1090 |
> |
char combuf[PATH_MAX]; |
1091 |
|
/* build command */ |
1092 |
|
if (touchonly || (vw = getview(0, NULL)) == NULL) |
1093 |
|
return; |
1094 |
|
if (sayview) |
1095 |
< |
printview(vw); |
1095 |
> |
myprintview(vw, stdout); |
1096 |
|
sprintf(combuf, "rview %s%s%s -R %s ", vw, po, opts, rifname); |
1097 |
|
if (rvdevice != NULL) |
1098 |
|
sprintf(combuf+strlen(combuf), "-o %s ", rvdevice); |
1109 |
|
rpict(opts, po) /* run rpict and pfilt for each view */ |
1110 |
|
char *opts, *po; |
1111 |
|
{ |
1112 |
< |
char combuf[1024]; |
1113 |
< |
char rawfile[MAXPATH], picfile[MAXPATH]; |
1114 |
< |
char zopt[MAXPATH+4], rep[MAXPATH+16], res[32]; |
1112 |
> |
char combuf[PATH_MAX]; |
1113 |
> |
char rawfile[PATH_MAX], picfile[PATH_MAX]; |
1114 |
> |
char zopt[PATH_MAX+4], rep[PATH_MAX+16], res[32]; |
1115 |
> |
char rppopt[128], *pfile = NULL; |
1116 |
|
char pfopts[128]; |
1117 |
|
char vs[32], *vw; |
1118 |
|
int vn, mult; |
1119 |
+ |
FILE *fp; |
1120 |
|
time_t rfdt, pfdt; |
1121 |
|
/* get pfilt options */ |
1122 |
|
pfiltopts(pfopts); |
1158 |
|
else |
1159 |
|
badvalue(REPORT); |
1160 |
|
} |
1161 |
< |
/* do each view */ |
1162 |
< |
vn = 0; |
1161 |
> |
/* set up parallel rendering */ |
1162 |
> |
if (nprocs > 1 & !vdef(ZFILE)) { |
1163 |
> |
strcpy(rppopt, "-S 1 -PP pfXXXXXX"); |
1164 |
> |
pfile = rppopt+9; |
1165 |
> |
if (mktemp(pfile) == NULL) |
1166 |
> |
pfile = NULL; |
1167 |
> |
} |
1168 |
> |
vn = 0; /* do each view */ |
1169 |
|
while ((vw = getview(vn++, vs)) != NULL) { |
1170 |
|
if (sayview) |
1171 |
< |
printview(vw); |
1171 |
> |
myprintview(vw, stdout); |
1172 |
|
if (!vs[0]) |
1173 |
|
sprintf(vs, "%d", vn); |
1174 |
|
sprintf(picfile, "%s_%s.pic", vval(PICTURE), vs); |
1192 |
|
touch(picfile); |
1193 |
|
continue; |
1194 |
|
} |
1195 |
+ |
if (next_process()) { /* parallel running? */ |
1196 |
+ |
if (pfile != NULL) |
1197 |
+ |
sleep(20); |
1198 |
+ |
continue; |
1199 |
+ |
} |
1200 |
+ |
/* XXX Remember to call finish_process() */ |
1201 |
|
/* build rpict command */ |
1202 |
< |
if (rfdt >= oct1date) /* recover */ |
1202 |
> |
if (rfdt >= oct1date) { /* recover */ |
1203 |
|
sprintf(combuf, "rpict%s%s%s%s -ro %s %s", |
1204 |
|
rep, po, opts, zopt, rawfile, oct1name); |
1205 |
< |
else { |
1205 |
> |
if (runcom(combuf)) /* run rpict */ |
1206 |
> |
goto rperror; |
1207 |
> |
} else { |
1208 |
|
if (overture) { /* run overture calculation */ |
1209 |
|
sprintf(combuf, |
1210 |
|
"rpict%s %s%s -x 64 -y 64 -ps 1 %s > %s", |
1216 |
|
progname, vs); |
1217 |
|
quit(1); |
1218 |
|
} |
1219 |
< |
#ifdef NIX |
1219 |
> |
#ifndef NULL_DEVICE |
1220 |
|
rmfile(overfile); |
1221 |
|
#endif |
1222 |
|
} |
1223 |
|
sprintf(combuf, "rpict%s %s %s%s%s%s %s > %s", |
1224 |
< |
rep, vw, res, po, opts, zopt, |
1225 |
< |
oct1name, rawfile); |
1224 |
> |
rep, vw, res, po, opts, |
1225 |
> |
zopt, oct1name, rawfile); |
1226 |
> |
if (pfile != NULL && inchild()) { |
1227 |
> |
/* rpict persistent mode */ |
1228 |
> |
if (!silent) |
1229 |
> |
printf("\t%s\n", combuf); |
1230 |
> |
sprintf(combuf, "rpict%s %s %s%s%s %s > %s", |
1231 |
> |
rep, rppopt, res, po, opts, |
1232 |
> |
oct1name, rawfile); |
1233 |
> |
fflush(stdout); |
1234 |
> |
fp = popen(combuf, "w"); |
1235 |
> |
if (fp == NULL) |
1236 |
> |
goto rperror; |
1237 |
> |
myprintview(vw, fp); |
1238 |
> |
if (pclose(fp)) |
1239 |
> |
goto rperror; |
1240 |
> |
} else { /* rpict normal mode */ |
1241 |
> |
if (runcom(combuf)) |
1242 |
> |
goto rperror; |
1243 |
> |
} |
1244 |
|
} |
1178 |
– |
if (runcom(combuf)) { /* run rpict */ |
1179 |
– |
fprintf(stderr, "%s: error rendering view %s\n", |
1180 |
– |
progname, vs); |
1181 |
– |
quit(1); |
1182 |
– |
} |
1245 |
|
if (!vdef(RAWFILE) || strcmp(vval(RAWFILE),vval(PICTURE))) { |
1246 |
|
/* build pfilt command */ |
1247 |
|
if (mult > 1) |
1250 |
|
else |
1251 |
|
sprintf(combuf, "pfilt%s %s > %s", pfopts, |
1252 |
|
rawfile, picfile); |
1253 |
< |
if (runcom(combuf)) { /* run pfilt */ |
1253 |
> |
if (runcom(combuf)) { /* run pfilt */ |
1254 |
|
fprintf(stderr, |
1255 |
|
"%s: error filtering view %s\n\t%s removed\n", |
1256 |
|
progname, vs, picfile); |
1264 |
|
mvfile(rawfile, combuf); |
1265 |
|
} else |
1266 |
|
rmfile(rawfile); |
1267 |
+ |
finish_process(); /* leave if child */ |
1268 |
|
} |
1269 |
+ |
wait_process(1); /* wait for children to finish */ |
1270 |
+ |
if (pfile != NULL) { /* clean up rpict persistent mode */ |
1271 |
+ |
int pid; |
1272 |
+ |
fp = fopen(pfile, "r"); |
1273 |
+ |
if (fp != NULL) { |
1274 |
+ |
if (fscanf(fp, "%*s %d", &pid) != 1 || |
1275 |
+ |
kill(pid, 1) == -1) |
1276 |
+ |
unlink(pfile); |
1277 |
+ |
fclose(fp); |
1278 |
+ |
} |
1279 |
+ |
} |
1280 |
+ |
return; |
1281 |
+ |
rperror: |
1282 |
+ |
fprintf(stderr, "%s: error rendering view %s\n", progname, vs); |
1283 |
+ |
quit(1); |
1284 |
|
} |
1285 |
|
|
1286 |
|
|
1289 |
|
{ |
1290 |
|
if (!silent) |
1291 |
|
printf("\ttouch %s\n", fn); |
1292 |
< |
if (noaction) |
1292 |
> |
if (!nprocs) |
1293 |
|
return(0); |
1294 |
|
#ifdef notused |
1295 |
|
if (access(fn, F_OK) == -1) /* create it */ |
1305 |
|
{ |
1306 |
|
if (!silent) /* echo it */ |
1307 |
|
printf("\t%s\n", cs); |
1308 |
< |
if (noaction) |
1308 |
> |
if (!nprocs) |
1309 |
|
return(0); |
1310 |
|
fflush(stdout); /* flush output and pass to shell */ |
1311 |
|
return(system(cs)); |
1316 |
|
char *fn; |
1317 |
|
{ |
1318 |
|
if (!silent) |
1319 |
< |
#ifdef MSDOS |
1320 |
< |
printf("\tdel %s\n", fn); |
1243 |
< |
#else |
1244 |
< |
printf("\trm -f %s\n", fn); |
1245 |
< |
#endif |
1246 |
< |
if (noaction) |
1319 |
> |
printf("\t%s %s\n", DELCMD, fn); |
1320 |
> |
if (!nprocs) |
1321 |
|
return(0); |
1322 |
|
return(unlink(fn)); |
1323 |
|
} |
1327 |
|
char *fold, *fnew; |
1328 |
|
{ |
1329 |
|
if (!silent) |
1330 |
< |
#ifdef MSDOS |
1331 |
< |
printf("\trename %s %s\n", fold, fnew); |
1258 |
< |
#else |
1259 |
< |
printf("\tmv %s %s\n", fold, fnew); |
1260 |
< |
#endif |
1261 |
< |
if (noaction) |
1330 |
> |
printf("\t%s %s %s\n", RENAMECMD, fold, fnew); |
1331 |
> |
if (!nprocs) |
1332 |
|
return(0); |
1333 |
|
return(rename(fold, fnew)); |
1334 |
|
} |
1335 |
|
|
1336 |
|
|
1337 |
< |
#ifdef MSDOS |
1337 |
> |
#ifdef RHAS_FORK_EXEC |
1338 |
> |
int |
1339 |
> |
next_process() /* fork the next process (max. nprocs) */ |
1340 |
> |
{ |
1341 |
> |
int child_pid; |
1342 |
> |
|
1343 |
> |
if (nprocs <= 1) |
1344 |
> |
return(0); /* it's us or no one */ |
1345 |
> |
if (inchild()) { |
1346 |
> |
fprintf(stderr, "%s: internal error 1 in spawn_process()\n", |
1347 |
> |
progname); |
1348 |
> |
quit(1); |
1349 |
> |
} |
1350 |
> |
if (children_running >= nprocs) |
1351 |
> |
wait_process(0); /* wait for someone to finish */ |
1352 |
> |
fflush(stdout); |
1353 |
> |
child_pid = fork(); /* split process */ |
1354 |
> |
if (child_pid == 0) { /* we're the child */ |
1355 |
> |
children_running = -1; |
1356 |
> |
return(0); |
1357 |
> |
} |
1358 |
> |
if (child_pid > 0) { /* we're the parent */ |
1359 |
> |
++children_running; |
1360 |
> |
return(1); |
1361 |
> |
} |
1362 |
> |
fprintf(stderr, "%s: warning -- fork() failed\n", progname); |
1363 |
> |
return(0); |
1364 |
> |
} |
1365 |
> |
|
1366 |
> |
wait_process(all) /* wait for process(es) to finish */ |
1367 |
> |
int all; |
1368 |
> |
{ |
1369 |
> |
int ourstatus = 0; |
1370 |
> |
int pid, status; |
1371 |
> |
|
1372 |
> |
if (all) |
1373 |
> |
all = children_running; |
1374 |
> |
else if (children_running > 0) |
1375 |
> |
all = 1; |
1376 |
> |
while (all-- > 0) { |
1377 |
> |
pid = wait(&status); |
1378 |
> |
if (pid < 0) |
1379 |
> |
syserr(progname); |
1380 |
> |
status = status>>8 & 0xff; |
1381 |
> |
--children_running; |
1382 |
> |
if (status != 0) { /* child's problem is our problem */ |
1383 |
> |
if (ourstatus == 0 & children_running > 0) |
1384 |
> |
fprintf(stderr, "%s: waiting for remaining processes\n", |
1385 |
> |
progname); |
1386 |
> |
ourstatus = status; |
1387 |
> |
all = children_running; |
1388 |
> |
} |
1389 |
> |
} |
1390 |
> |
if (ourstatus != 0) |
1391 |
> |
quit(ourstatus); /* bad status from child */ |
1392 |
> |
} |
1393 |
> |
#else /* ! RHAS_FORK_EXEC */ |
1394 |
> |
int |
1395 |
> |
next_process() |
1396 |
> |
{ |
1397 |
> |
return(0); /* cannot start new process */ |
1398 |
> |
} |
1399 |
> |
wait_process(all) |
1400 |
> |
int all; |
1401 |
> |
{ |
1402 |
> |
(void)all; /* no one to wait for */ |
1403 |
> |
} |
1404 |
> |
int |
1405 |
> |
kill(pid, sig) /* win|unix_process.c should also wait and kill */ |
1406 |
> |
int pid, sig; |
1407 |
> |
{ |
1408 |
> |
return 0; |
1409 |
> |
} |
1410 |
> |
#endif /* ! RHAS_FORK_EXEC */ |
1411 |
> |
|
1412 |
> |
finish_process() /* exit a child process */ |
1413 |
> |
{ |
1414 |
> |
if (!inchild()) |
1415 |
> |
return; /* in parent -- noop */ |
1416 |
> |
exit(0); |
1417 |
> |
} |
1418 |
> |
|
1419 |
> |
#ifdef _WIN32 |
1420 |
|
setenv(vname, value) /* set an environment variable */ |
1421 |
|
char *vname, *value; |
1422 |
|
{ |
1453 |
|
} |
1454 |
|
|
1455 |
|
|
1456 |
+ |
void |
1457 |
|
quit(ec) /* exit program */ |
1458 |
|
int ec; |
1459 |
|
{ |