ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/ranimate.c
(Generate patch)

Comparing ray/src/util/ranimate.c (file contents):
Revision 2.2 by greg, Thu Jan 18 11:25:11 1996 UTC vs.
Revision 2.13 by greg, Tue May 21 14:27:19 1996 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1995 Regents of the University of California */
1 > /* Copyright (c) 1996 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 15 | Line 15 | static char SCCSid[] = "$SunId$ LBL";
15   #include "view.h"
16   #include "vars.h"
17   #include "netproc.h"
18 +                                /* default remote shell */
19 + #ifdef _AUX_SOURCE
20 + #define REMSH           "remsh"
21 + #else
22 + #define REMSH           "rsh"
23 + #endif
24                                  /* input variables */
25   #define HOST            0               /* rendering host machine */
26   #define RENDER          1               /* rendering options */
# Line 38 | Line 44 | static char SCCSid[] = "$SunId$ LBL";
44   #define DISKSPACE       19              /* how much disk space to use */
45   #define RESOLUTION      20              /* desired final resolution */
46   #define EXPOSURE        21              /* how to compute exposure */
47 + #define RSH             22              /* remote shell script or program */
48  
49 < int     NVARS = 22;             /* total number of variables */
49 > int     NVARS = 23;             /* total number of variables */
50  
51   VARIABLE        vv[] = {                /* variable-value pairs */
52          {"host",        4,      0,      NULL,   NULL},
# Line 57 | Line 64 | VARIABLE       vv[] = {                /* variable-value pairs */
64          {"ANIMATE",     2,      0,      NULL,   onevalue},
65          {"TRANSFER",    2,      0,      NULL,   onevalue},
66          {"ARCHIVE",     2,      0,      NULL,   onevalue},
67 <        {"INTERP",      3,      0,      NULL,   intvalue},
68 <        {"OVERSAMP",    2,      0,      NULL,   fltvalue},
67 >        {"INTERPOLATE", 3,      0,      NULL,   intvalue},
68 >        {"OVERSAMPLE",  2,      0,      NULL,   fltvalue},
69          {"MBLUR",       2,      0,      NULL,   onevalue},
70          {"RTRACE",      2,      0,      NULL,   boolvalue},
71          {"DISKSPACE",   3,      0,      NULL,   fltvalue},
72          {"RESOLUTION",  3,      0,      NULL,   onevalue},
73          {"EXPOSURE",    3,      0,      NULL,   onevalue},
74 +        {"RSH",         3,      0,      NULL,   onevalue},
75   };
76  
77   #define SFNAME  "STATUS"                /* status file name */
# Line 84 | Line 92 | int    nowarn = 0;             /* turn warnings off? */
92   int     silent = 0;             /* silent mode? */
93   int     noaction = 0;           /* take no action? */
94  
95 + char    *remsh;                 /* remote shell program/script */
96   char    rendopt[2048] = "";     /* rendering options */
97   char    rresopt[32];            /* rendering resolution options */
98   char    fresopt[32];            /* filter resolution options */
99   int     pfiltalways;            /* always use pfilt? */
100  
101 + char    arcargs[10240];         /* files to archive */
102 + char    *arcfirst, *arcnext;    /* pointers to first and next argument */
103 +
104   struct pslot {
105          int     pid;                    /* process ID (0 if empty) */
106          int     fout;                   /* output frame number */
# Line 99 | Line 111 | int    npslots;                /* number of process slots */
111   int     lastpid;                /* ID of last completed background process */
112   PSERVER *lastpserver;           /* last process server used */
113  
114 + #define phostname(ps)   ((ps)->hostname[0] ? (ps)->hostname : astat.host)
115 +
116   struct pslot    *findpslot();
117  
118   VIEW    *getview();
119   char    *getexp();
120  
121 + extern time_t   fdate(), time();
122  
123 +
124   main(argc, argv)
125   int     argc;
126   char    *argv[];
# Line 161 | Line 177 | char   *argv[];
177                  argv[i] = vval(NEXTANIM);       /* just change input file */
178                  if (!silent)
179                          printargs(argc, argv, stdout);
180 <                execvp(progname, argv);         /* pass to next */
181 <                quit(1);                        /* shouldn't return */
180 >                if ((argv[0] = getpath(progname,getenv("PATH"),X_OK)) == NULL)
181 >                        fprintf(stderr, "%s: command not found\n", progname);
182 >                else
183 >                        execv(progname, argv);
184 >                quit(1);
185          }
186          quit(0);
187   userr:
# Line 173 | Line 192 | userr:
192  
193   getastat()                      /* check/set animation status */
194   {
195 <        char    buf[256];
195 >        char    sfname[256];
196          FILE    *fp;
197  
198 <        sprintf(buf, "%s/%s", vval(DIRECTORY), SFNAME);
199 <        if ((fp = fopen(buf, "r")) == NULL) {
198 >        sprintf(sfname, "%s/%s", vval(DIRECTORY), SFNAME);
199 >        if ((fp = fopen(sfname, "r")) == NULL) {
200                  if (errno != ENOENT) {
201 <                        perror(buf);
201 >                        perror(sfname);
202                          return(-1);
203                  }
204                  astat.rnext = astat.fnext = astat.tnext = 0;
# Line 199 | Line 218 | getastat()                     /* check/set animation status */
218                  goto fmterr;
219          fclose(fp);
220          if (astat.pid != 0) {                   /* thinks it's still running */
221 <                gethostname(buf, sizeof(buf));
203 <                if (strcmp(buf, astat.host)) {
221 >                if (strcmp(myhostname(), astat.host)) {
222                          fprintf(stderr,
223                          "%s: process %d may still be running on host %s\n",
224                                          progname, astat.pid, astat.host);
# Line 218 | Line 236 | getastat()                     /* check/set animation status */
236                                  progname, astat.cfname);
237                  return(-1);
238          }
239 +                                                /* check control file mods. */
240 +        if (!nowarn && fdate(cfname) > fdate(sfname))
241 +                fprintf(stderr,
242 +                        "%s: warning - control file modified since last run\n",
243 +                                progname);
244   setours:                                        /* set our values */
245 <        gethostname(astat.host, sizeof(astat.host));
245 >        strcpy(astat.host, myhostname());
246          astat.pid = getpid();
247          strcpy(astat.cfname, cfname);
248          return(0);
249   fmterr:
250          fprintf(stderr, "%s: format error in status file \"%s\"\n",
251 <                        progname, buf);
251 >                        progname, sfname);
252          fclose(fp);
253          return(-1);
254   }
# Line 277 | Line 300 | checkdir()                     /* make sure we have our directory */
300  
301   setdefaults()                   /* set default values */
302   {
303 +        extern char     *atos();
304          char    buf[256];
305  
306          if (vdef(ANIMATE)) {
# Line 300 | Line 324 | setdefaults()                  /* set default values */
324                  vdef(START)++;
325          }
326          if (!vdef(END)) {
327 <                sprintf(buf, "%d", countviews());
327 >                sprintf(buf, "%d", countviews()+vint(START)-1);
328                  vval(END) = savqstr(buf);
329                  vdef(END)++;
330          }
331 +        if (vint(END) < vint(START)) {
332 +                fprintf(stderr, "%s: ending frame less than starting frame\n",
333 +                                progname);
334 +                quit(1);
335 +        }
336          if (!vdef(BASENAME)) {
337                  sprintf(buf, "%s/frame%%03d", vval(DIRECTORY));
338                  vval(BASENAME) = savqstr(buf);
# Line 337 | Line 366 | setdefaults()                  /* set default values */
366                  vval(DISKSPACE) = "100";
367                  vdef(DISKSPACE)++;
368          }
369 +        if (!vdef(RSH)) {
370 +                vval(RSH) = REMSH;
371 +                vdef(RSH)++;
372 +        }
373 +                                /* locate remote shell program */
374 +        atos(buf, sizeof(buf), vval(RSH));
375 +        if ((remsh = getpath(buf, getenv("PATH"), X_OK)) != NULL)
376 +                remsh = savqstr(remsh);
377 +        else
378 +                remsh = vval(RSH);      /* will generate error if used */
379 +
380                                  /* append rendering options */
381          if (vdef(RENDER))
382                  sprintf(rendopt+strlen(rendopt), " %s", vval(RENDER));
# Line 399 | Line 439 | sethosts()                     /* set up process servers */
439   }
440  
441  
442 < getradfile(rfname)              /* run rad and get needed variables */
443 < char    *rfname;
442 > getradfile(rfargs)              /* run rad and get needed variables */
443 > char    *rfargs;
444   {
445          static short    mvar[] = {OCTREE,PFILT,RESOLUTION,EXPOSURE,-1};
446          char    combuf[256];
# Line 410 | Line 450 | char   *rfname;
450          sprintf(rendopt, " @%s/render.opt", vval(DIRECTORY));
451          sprintf(combuf,
452          "rad -v 0 -s -e -w %s OPTFILE=%s | egrep '^[ \t]*(NOMATCH",
453 <                        rfname, rendopt+2);
453 >                        rfargs, rendopt+2);
454          cp = combuf;
455          while (*cp) cp++;               /* match unset variables */
456          for (i = 0; mvar[i] >= 0; i++)
# Line 422 | Line 462 | char   *rfname;
462          sprintf(cp, ")[ \t]*=' > %s/radset.var", vval(DIRECTORY));
463          cp += 11;                       /* point to file name */
464          if (system(combuf)) {
465 <                fprintf(stderr, "%s: bad rad input file \"%s\"\n",
466 <                                progname, rfname);
465 >                fprintf(stderr, "%s: error executing rad command:\n\t%s\n",
466 >                                progname, combuf);
467                  quit(1);
468          }
469          loadvars(cp);                   /* load variables and remove file */
# Line 472 | Line 512 | animate()                      /* run animation */
512                                          /* figure # frames per batch */
513          d1 = mult*xres*mult*yres*4;             /* space for orig. picture */
514          if ((i=vint(INTERP)) || atoi(vval(MBLUR)))
515 <                d1 += mult*xres*mult*yres*4;    /* space for z-buffer */
515 >                d1 += mult*xres*mult*yres*sizeof(float);        /* Z-buffer */
516          d2 = xres*yres*4;                       /* space for final picture */
517          frames_batch = (i+1)*(vflt(DISKSPACE)*1048576.-d1)/(d1+i*d2);
518          if (frames_batch < i+2) {
# Line 480 | Line 520 | animate()                      /* run animation */
520                                  progname);
521                  quit(1);
522          }
523 +                                        /* initialize archive argument list */
524 +        i = 16;
525 +        if (vdef(ARCHIVE) && strlen(vval(ARCHIVE)) > i)
526 +                i = strlen(vval(ARCHIVE));
527 +        arcnext = arcfirst = arcargs + i;
528                                          /* initialize status file */
529          if (astat.rnext == 0)
530                  astat.rnext = astat.fnext = astat.tnext = vint(START);
# Line 574 | Line 619 | filterframes()                         /* catch up with filtering */
619                  dofilt(i, vp, getexp(i), 0);            /* filter frame */
620          }
621          bwait(0);                       /* wait for filter processes */
622 <        archive(astat.fnext, i-1);      /* archive originals */
622 >        archive();                      /* archive originals */
623          astat.fnext = i;                /* update status */
624          putastat();
625   }
# Line 636 | Line 681 | int    first, last;
681   char    *vfn;
682   {
683          char    combuf[2048];
684 +        char    *inspoint;
685          register int    i;
686  
687          if (!noaction && vint(INTERP))          /* create dummy frames */
# Line 646 | Line 692 | char   *vfn;
692                                  close(open(combuf, O_RDONLY|O_CREAT, 0666));
693                          }
694                                          /* create command */
695 <        sprintf(combuf, "rpict%s -w0 ", rendopt);
695 >        sprintf(combuf, "rpict%s -w0", rendopt);
696          if (vint(INTERP) || atoi(vval(MBLUR)))
697 <                sprintf(combuf+strlen(combuf), "-z %s.zbf ", vval(BASENAME));
698 <        sprintf(combuf+strlen(combuf), "-o %s.unf %s -S %d %s < %s",
699 <                        vval(BASENAME), rresopt, first, vval(OCTREE), vfn);
697 >                sprintf(combuf+strlen(combuf), " -z %s.zbf", vval(BASENAME));
698 >        sprintf(combuf+strlen(combuf), " -o %s.unf %s -S %d",
699 >                        vval(BASENAME), rresopt, first);
700 >        inspoint = combuf + strlen(combuf);
701 >        sprintf(inspoint, " %s < %s", vval(OCTREE), vfn);
702                                          /* run in parallel */
703 <        if (pruncom(combuf, (last-first+1)/(vint(INTERP)+1))) {
703 >        i = (last-first+1)/(vint(INTERP)+1);
704 >        if (i < 1) i = 1;
705 >        if (pruncom(combuf, inspoint, i)) {
706                  fprintf(stderr, "%s: error rendering frames %d through %d\n",
707                                  progname, first, last);
708                  quit(1);
# Line 730 | Line 780 | int    frame;
780   }
781  
782  
783 < archive(first, last)                    /* archive and remove renderings */
734 < int     first, last;
783 > archive()                       /* archive and remove renderings */
784   {
785   #define RMCOML  (sizeof(rmcom)-1)
786          static char     rmcom[] = "rm -f";
738        int     offset = RMCOML;
739        char    combuf[10240];
740        struct stat     stb;
741        register char   *cp;
787          register int    i;
788  
789 <        if (noaction)
790 <                return;
746 <        if (vdef(ARCHIVE) && strlen(vval(ARCHIVE)) > offset)
747 <                offset = strlen(vval(ARCHIVE));
748 <        cp = combuf + offset;
749 <        *cp++ = ' ';                            /* make argument list */
750 <        for (i = first; i <= last; i++) {
751 <                sprintf(cp, vval(BASENAME), i);
752 <                strcat(cp, ".unf");
753 <                if (stat(cp, &stb) == 0 && stb.st_size > 0) {   /* non-zero? */
754 <                        while (*cp) cp++;
755 <                        *cp++ = ' ';
756 <                        sprintf(cp, vval(BASENAME), i);
757 <                        strcat(cp, ".zbf");
758 <                        if (access(cp, F_OK) == 0) {            /* exists? */
759 <                                while (*cp) cp++;
760 <                                *cp++ = ' ';
761 <                        }
762 <                }
763 <        }
764 <        *--cp = '\0';
765 <        if (cp <= combuf + offset)              /* no files? */
766 <                return;
789 >        if (arcnext == arcfirst)
790 >                return;                         /* nothing to do */
791          if (vdef(ARCHIVE)) {                    /* run archive command */
792                  i = strlen(vval(ARCHIVE));
793 <                strncpy(combuf+offset-i, vval(ARCHIVE), i);
794 <                if (runcom(combuf+offset-i)) {
795 <                        fprintf(stderr,
796 <                "%s: error running archive command on frames %d through %d\n",
773 <                                        progname, first, last);
793 >                strncpy(arcfirst-i, vval(ARCHIVE), i);
794 >                if (runcom(arcfirst-i)) {
795 >                        fprintf(stderr, "%s: error running archive command\n",
796 >                                        progname);
797                          quit(1);
798                  }
799          }
800                                                  /* run remove command */
801 <        strncpy(combuf+offset-RMCOML, rmcom, RMCOML);
802 <        runcom(combuf+offset-RMCOML);
801 >        strncpy(arcfirst-RMCOML, rmcom, RMCOML);
802 >        runcom(arcfirst-RMCOML);
803 >        arcnext = arcfirst;                     /* reset argument list */
804   #undef RMCOML
805   }
806  
# Line 789 | Line 813 | char   *ep;
813   int     rvr;
814   {
815          extern int      frecover();
816 +        static int      iter = 0;
817          char    fnbefore[128], fnafter[128];
818 <        char    combuf[1024], fname[128];
819 <        int     usepinterp, usepfilt;
818 >        char    combuf[1024], fname0[128], fname1[128];
819 >        int     usepinterp, usepfilt, nora_rgbe;
820          int     frseq[2];
821                                                  /* check what is needed */
822          usepinterp = atoi(vval(MBLUR));
823          usepfilt = pfiltalways | ep==NULL;
824 +        if (ep != NULL && !strcmp(ep, "1"))
825 +                ep = "+0";
826 +        nora_rgbe = strcmp(vval(OVERSAMP),"1") || ep==NULL ||
827 +                        *ep != '+' || *ep != '-' || !isint(ep);
828                                                  /* compute rendered views */
829          frseq[0] = frame - ((frame-1) % (vint(INTERP)+1));
830          frseq[1] = frseq[0] + vint(INTERP) + 1;
# Line 804 | Line 833 | int    rvr;
833          if (frseq[1] == frame) {                        /* pfilt only */
834                  frseq[0] = frseq[1];
835                  usepinterp = 0;                 /* update what's needed */
836 <                usepfilt |= vflt(OVERSAMP)>1.01 || strcmp(ep,"1");
837 <        } else if (frseq[0] == frame) {         /* no interpolation */
838 <                                                /* update what's needed */
839 <                if (!usepinterp)
840 <                        usepfilt |= vflt(OVERSAMP)>1.01 || strcmp(ep,"1");
836 >                usepfilt |= nora_rgbe;
837 >        } else if (frseq[0] == frame) {         /* no interpolation needed */
838 >                if (!rvr && frame > 1+vint(INTERP)) {   /* archive previous */
839 >                        *arcnext++ = ' ';
840 >                        sprintf(arcnext, vval(BASENAME), frame-vint(INTERP)-1);
841 >                        while (*arcnext) arcnext++;
842 >                        strcpy(arcnext, ".unf");
843 >                        arcnext += 4;
844 >                        if (usepinterp || vint(INTERP)) {       /* and Z-buf */
845 >                                *arcnext++ = ' ';
846 >                                sprintf(arcnext, vval(BASENAME),
847 >                                                frame-vint(INTERP)-1);
848 >                                while (*arcnext) arcnext++;
849 >                                strcpy(arcnext, ".zbf");
850 >                                arcnext += 4;
851 >                        }
852 >                }
853 >                if (!usepinterp)                /* update what's needed */
854 >                        usepfilt |= nora_rgbe;
855          } else                                  /* interpolation needed */
856                  usepinterp++;
857          if (frseq[1] >= astat.rnext)            /* next batch unavailable */
# Line 823 | Line 866 | int    rvr;
866                          return(1);
867                  if (atoi(vval(MBLUR))) {
868                          FILE    *fp;            /* motion blurring */
869 <                        sprintf(fname, "%s/vw0", vval(DIRECTORY));
870 <                        if ((fp = fopen(fname, "w")) == NULL) {
871 <                                perror(fname); quit(1);
869 >                        sprintf(fname0, "%s/vw0%c", vval(DIRECTORY),
870 >                                        'a'+(iter%26));
871 >                        if ((fp = fopen(fname0, "w")) == NULL) {
872 >                                perror(fname0); quit(1);
873                          }
874                          fputs(VIEWSTR, fp);
875                          fprintview(vp, fp);
# Line 836 | Line 880 | int    rvr;
880                                                  progname, frame+1);
881                                  quit(1);
882                          }
883 <                        sprintf(fname, "%s/vw1", vval(DIRECTORY));
884 <                        if ((fp = fopen(fname, "w")) == NULL) {
885 <                                perror(fname); quit(1);
883 >                        sprintf(fname1, "%s/vw1%c", vval(DIRECTORY),
884 >                                        'a'+(iter%26));
885 >                        if ((fp = fopen(fname1, "w")) == NULL) {
886 >                                perror(fname1); quit(1);
887                          }
888                          fputs(VIEWSTR, fp);
889                          fprintview(vp, fp);
890                          putc('\n', fp); fclose(fp);
891                          sprintf(combuf,
892 <        "(pmblur %s %d %s/vw0 %s/vw1; rm -f %s/vw0 %s/vw1) | pinterp -B",
892 >                        "(pmblur %s %d %s %s; rm -f %s %s) | pinterp -B",
893                          *sskip(vval(MBLUR)) ? sskip2(vval(MBLUR),1) : "1",
894 <                                        atoi(vval(MBLUR)), vval(DIRECTORY),
895 <                                        vval(DIRECTORY), vval(DIRECTORY),
896 <                                        vval(DIRECTORY), vval(DIRECTORY));
894 >                                        atoi(vval(MBLUR)),
895 >                                        fname0, fname1, fname0, fname1);
896 >                        iter++;
897                  } else                          /* no blurring */
898                          strcpy(combuf, "pinterp");
899                  strcat(combuf, viewopt(vp));
# Line 895 | Line 940 | int    rvr;
940          } else {                                /* else just check it */
941                  if (rvr == 2)
942                          return(1);
943 <                sprintf(combuf, "ra_rgbe -r %s.unf", fnbefore);
943 >                sprintf(combuf, "ra_rgbe -e %s -r %s.unf", ep, fnbefore);
944          }
945                                                  /* output file name */
946 <        sprintf(fname, vval(BASENAME), frame);
947 <        sprintf(combuf+strlen(combuf), " > %s.pic", fname);
946 >        sprintf(fname0, vval(BASENAME), frame);
947 >        sprintf(combuf+strlen(combuf), " > %s.pic", fname0);
948          if (rvr)                                /* in recovery */
949                  return(runcom(combuf));
950          bruncom(combuf, frame, frecover);       /* else run in background */
# Line 931 | Line 976 | int    n;
976                          quit(1);
977                  }
978          } else if (n < viewnum) {       /* rewind file */
979 +                if (viewnum == 1 && feof(viewfp))
980 +                        return(&curview);               /* just one view */
981                  if (fseek(viewfp, 0L, 0) == EOF) {
982                          perror(vval(VIEWFILE));
983                          quit(1);
# Line 940 | Line 987 | int    n;
987          }
988          while (n > viewnum) {           /* scan to desired view */
989                  if (fgets(linebuf, sizeof(linebuf), viewfp) == NULL)
990 <                        return(NULL);
990 >                        return(viewnum==1 ? &curview : NULL);
991                  if (isview(linebuf) && sscanview(&curview, linebuf) > 0)
992                          viewnum++;
993          }
# Line 1052 | Line 1099 | int    status;
1099          register PROC   *pp;
1100  
1101          pp = ps->proc + pn;
1055        if (!silent) {                  /* echo command */
1056                if (ps->hostname[0])
1057                        printf("On %s:", ps->hostname);
1058                printf("\t%s\n", pp->com);
1059                fflush(stdout);
1060        }
1102          if (pp->elen) {                 /* pass errors */
1103 +                if (ps->hostname[0])
1104 +                        fprintf(stderr, "%s: ", ps->hostname);
1105 +                fprintf(stderr, "Error output from: %s\n", pp->com);
1106                  fputs(pp->errs, stderr);
1107                  fflush(stderr);
1108                  if (ps->hostname[0])
# Line 1097 | Line 1141 | int    (*rf)();
1141  
1142          if (noaction) {
1143                  if (!silent)
1144 <                        printf("\t%s\n", com);  /* just echo it */
1144 >                        printf("\t%s\n", com);  /* echo command */
1145                  return(0);
1146          }
1147                                          /* else start it when we can */
1148          while ((pid = startjob(NULL, savestr(com), donecom)) == -1)
1149                  bwait(1);
1150 +        if (!silent) {                          /* echo command */
1151 +                PSERVER *ps;
1152 +                int     psn = pid;
1153 +                ps = findjob(&psn);
1154 +                printf("\t%s\n", com);
1155 +                printf("\tProcess started on %s\n", phostname(ps));
1156 +                fflush(stdout);
1157 +        }
1158          psl = findpslot(pid);           /* record info. in appropriate slot */
1159          psl->pid = pid;
1160          psl->fout = fout;
# Line 1138 | Line 1190 | int    ncoms;
1190  
1191  
1192   int
1193 < pruncom(com, maxcopies)         /* run a command in parallel over network */
1194 < char    *com;
1193 > pruncom(com, ppins, maxcopies)  /* run a command in parallel over network */
1194 > char    *com, *ppins;
1195   int     maxcopies;
1196   {
1197          int     retstatus = 0;
1198 +        int     hostcopies;
1199 +        char    com1buf[10240], *com1, *endcom1;
1200          int     status;
1201          register PSERVER        *ps;
1202  
1203 <        if (noaction) {
1204 <                if (!silent)
1205 <                        printf("\t%s\n", com);  /* just echo */
1203 >        if (!silent)
1204 >                printf("\t%s\n", com);  /* echo command */
1205 >        if (noaction)
1206                  return(0);
1207 <        }
1207 >        fflush(stdout);
1208                                          /* start jobs on each server */
1209 <        for (ps = pslist; ps != NULL; ps = ps->next)
1209 >        for (ps = pslist; ps != NULL; ps = ps->next) {
1210 >                hostcopies = 0;
1211 >                if (maxcopies > 1 && ps->nprocs > 1 && ppins != NULL) {
1212 >                        strcpy(com1=com1buf, com);      /* build -PP command */
1213 >                        sprintf(com1+(ppins-com), " -PP %s/%s.persist",
1214 >                                        vval(DIRECTORY), phostname(ps));
1215 >                        strcat(com1, ppins);
1216 >                        endcom1 = com1 + strlen(com1);
1217 >                        sprintf(endcom1, "; kill `sed -n '1s/^[^ ]* //p' %s/%s.persist`",
1218 >                                        vval(DIRECTORY), phostname(ps));
1219 >                } else {
1220 >                        com1 = com;
1221 >                        endcom1 = NULL;
1222 >                }
1223                  while (maxcopies > 0 &&
1224 <                                startjob(ps, savestr(com), donecom) != -1) {
1224 >                                startjob(ps, savestr(com1), donecom) != -1) {
1225                          sleep(10);
1226 +                        hostcopies++;
1227                          maxcopies--;
1228 +                        if (endcom1 != NULL)
1229 +                                *endcom1 = '\0';
1230                  }
1231 +                if (!silent && hostcopies) {
1232 +                        if (hostcopies > 1)
1233 +                                printf("\t%d duplicate processes", hostcopies);
1234 +                        else
1235 +                                printf("\tProcess");
1236 +                        printf(" started on %s\n", phostname(ps));
1237 +                        fflush(stdout);
1238 +                }
1239 +        }
1240                                          /* wait for jobs to finish */
1241          while ((status = wait4job(NULL, -1)) != -1)
1242                  if (status)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines