[BACK]Return to job.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / make

Diff for /src/usr.bin/make/job.c between version 1.84 and 1.85

version 1.84, 2007/09/23 09:46:08 version 1.85, 2007/09/23 12:49:04
Line 854 
Line 854 
                 (void)fflush(out);                  (void)fflush(out);
         }          }
   
         /*          done = true;
          * Now handle the -B-mode stuff. If the beast still isn't finished,  
          * try and restart the job on the next command. If JobStart says it's  
          * ok, it's ok. If there's an error, this puppy is done.  
          */  
         if (compatMake && WIFEXITED(*status) && job->node->current != NULL) {  
                 switch (JobStart(job->node, job->flags & JOB_IGNDOTS, job)) {  
                 case JOB_RUNNING:  
                         done = false;  
                         break;  
                 case JOB_ERROR:  
                         done = true;  
                         W_SETEXITSTATUS(status, 1);  
                         break;  
                 case JOB_FINISHED:  
                         /*  
                          * If we got back a JOB_FINISHED code, JobStart has  
                          * already called Make_Update and freed the job  
                          * descriptor. We set done to false here to avoid fake  
                          * cycles and double frees.  JobStart needs to do the  
                          * update so we can proceed up the graph when given the  
                          * -n flag..  
                          */  
                         done = false;  
                         break;  
                 }  
         } else  
                 done = true;  
   
         if (done &&          if (done &&
             aborting != ABORT_ERROR &&              aborting != ABORT_ERROR &&
Line 1248 
Line 1221 
          * Check the commands now so any attributes from .DEFAULT have a chance           * Check the commands now so any attributes from .DEFAULT have a chance
          * to migrate to the node           * to migrate to the node
          */           */
         if (!compatMake && job->flags & JOB_FIRST) {          if (job->flags & JOB_FIRST) {
                 cmdsOK = Job_CheckCommands(gn, Error);                  cmdsOK = Job_CheckCommands(gn, Error);
         } else {          } else {
                 cmdsOK = true;                  cmdsOK = true;
Line 1281 
Line 1254 
                 noExec = false;                  noExec = false;
   
                 /*                  /*
                  * used to be backwards; replace when start doing multiple                   * We can do all the commands at once. hooray for
                  * commands per shell.                   * sanity
                  */                   */
                 if (compatMake) {                  numCommands = 0;
                         /*                  Lst_ForEachNodeWhile(&gn->commands, JobPrintCommand,
                          * Be compatible: If this is the first time for this                      job);
                          * node, verify its commands are ok and open the  
                          * commands list for sequential access by later  
                          * invocations of JobStart.  Once that is done, we take  
                          * the next command off the list and print it to the  
                          * command file. If the command was an ellipsis, note  
                          * that there's nothing more to execute.  
                          */  
                         if ((job->flags&JOB_FIRST))  
                                 gn->current = Lst_First(&gn->commands);  
                         else  
                                 gn->current = Lst_Succ(gn->current);  
   
                         if (gn->current == NULL ||                  /*
                             !JobPrintCommand(gn->current, job)) {                   * If we didn't print out any commands to the shell
                                 noExec = true;                   * script, there's not much point in executing the
                                 gn->current = NULL;                   * shell, is there?
                         }                   */
                         if (noExec && !(job->flags & JOB_FIRST)) {                  if (numCommands == 0) {
                                 /*                          noExec = true;
                                  * If we're not going to execute anything, the  
                                  * job is done and we need to close down the  
                                  * various file descriptors we've opened for  
                                  * output, then call JobDoOutput to catch the  
                                  * final characters or send the file to the  
                                  * screen... Note that the i/o streams are only  
                                  * open if this isn't the first job.  Note also  
                                  * that this could not be done in  
                                  * Job_CatchChildren b/c it wasn't clear if  
                                  * there were more commands to execute or  
                                  * not...  
                                  */  
                                 JobClose(job);  
                         }  
                 } else {  
                         /*  
                          * We can do all the commands at once. hooray for  
                          * sanity  
                          */  
                         numCommands = 0;  
                         Lst_ForEachNodeWhile(&gn->commands, JobPrintCommand,  
                             job);  
   
                         /*  
                          * If we didn't print out any commands to the shell  
                          * script, there's not much point in executing the  
                          * shell, is there?  
                          */  
                         if (numCommands == 0) {  
                                 noExec = true;  
                         }  
                 }                  }
         } else if (noExecute) {          } else if (noExecute) {
                 /*                  /*
Line 1422 
Line 1353 
          * get the shell's output. If we're using files, print out that we're           * get the shell's output. If we're using files, print out that we're
          * starting a job and then set up its temporary-file name.           * starting a job and then set up its temporary-file name.
          */           */
         if (!compatMake || (job->flags & JOB_FIRST)) {          if (job->flags & JOB_FIRST) {
                 int fd[2];                  int fd[2];
                 if (pipe(fd) == -1)                  if (pipe(fd) == -1)
                         Punt("Cannot create pipe: %s", strerror(errno));                          Punt("Cannot create pipe: %s", strerror(errno));

Legend:
Removed from v.1.84  
changed lines
  Added in v.1.85