[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.68 and 1.69

version 1.68, 2007/09/17 09:28:36 version 1.69, 2007/09/17 10:17:26
Line 91 
Line 91 
 #include <errno.h>  #include <errno.h>
 #include <fcntl.h>  #include <fcntl.h>
 #include <signal.h>  #include <signal.h>
 #include <stddef.h>  #include <stdarg.h>
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
Line 347 
Line 347 
                                                    * commands in the Makefile*/                                                     * commands in the Makefile*/
 static char     *shellPath = NULL,                /* full pathname of  static char     *shellPath = NULL,                /* full pathname of
                                                    * executable image */                                                     * executable image */
                 *shellName = NULL,                /* last component of shell */                  *shellName = NULL;                /* last component of shell */
                 *shellArgv = NULL;                /* Custom shell args */  
   
   
 static int      maxJobs;        /* The most children we can run at once */  static int      maxJobs;        /* The most children we can run at once */
Line 431 
Line 430 
 static void JobDoOutput(Job *, bool);  static void JobDoOutput(Job *, bool);
 static void JobInterrupt(int, int);  static void JobInterrupt(int, int);
 static void JobRestartJobs(void);  static void JobRestartJobs(void);
   static void DBPRINTF(Job *, const char *, ...);
   
 static volatile sig_atomic_t got_SIGINT, got_SIGHUP, got_SIGQUIT,  static volatile sig_atomic_t got_SIGINT, got_SIGHUP, got_SIGQUIT,
     got_SIGTERM;      got_SIGTERM;
Line 629 
Line 629 
         return *(pid_t *)pid - ((Job *)job)->pid;          return *(pid_t *)pid - ((Job *)job)->pid;
 }  }
   
   static void
   DBPRINTF(Job *job, const char *fmt, ...)
   {
           va_list va;
           va_start(va, fmt);
           if (DEBUG(JOB)) {
                   (void)vfprintf(stdout, fmt, va);
                   fflush(stdout);
           }
           vfprintf(job->cmdFILE, fmt, va);
           va_end(va);
   }
   
 /*-  /*-
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  * JobPrintCommand  --   * JobPrintCommand  --
Line 685 
Line 698 
                 return 1;                  return 1;
         }          }
   
 #define DBPRINTF(fmt, arg) if (DEBUG(JOB)) {    \  
         (void)fprintf(stdout, fmt, arg);        \  
         (void)fflush(stdout);                   \  
     }                                           \  
    (void)fprintf(job->cmdFILE, fmt, arg);       \  
    (void)fflush(job->cmdFILE);  
   
         numCommands++;          numCommands++;
   
         /* For debugging, we replace each command with the result of expanding          /* For debugging, we replace each command with the result of expanding
Line 719 
Line 725 
         if (shutUp) {          if (shutUp) {
                 if (!(job->flags & JOB_SILENT) && !noSpecials &&                  if (!(job->flags & JOB_SILENT) && !noSpecials &&
                     commandShell->hasEchoCtl) {                      commandShell->hasEchoCtl) {
                         DBPRINTF("%s\n", commandShell->echoOff);                          DBPRINTF(job, "%s\n", commandShell->echoOff);
                 } else {                  } else {
                         shutUp = false;                          shutUp = false;
                 }                  }
Line 739 
Line 745 
                                  */                                   */
                                 if (!(job->flags & JOB_SILENT) && !shutUp &&                                  if (!(job->flags & JOB_SILENT) && !shutUp &&
                                     commandShell->hasEchoCtl) {                                      commandShell->hasEchoCtl) {
                                         DBPRINTF("%s\n", commandShell->echoOff);                                          DBPRINTF(job, "%s\n", commandShell->echoOff);
                                         DBPRINTF("%s\n", commandShell->ignErr);                                          DBPRINTF(job, "%s\n", commandShell->ignErr);
                                         DBPRINTF("%s\n", commandShell->echoOn);                                          DBPRINTF(job, "%s\n", commandShell->echoOn);
                                 } else {                                  } else {
                                         DBPRINTF("%s\n", commandShell->ignErr);                                          DBPRINTF(job, "%s\n", commandShell->ignErr);
                                 }                                  }
                         } else if (commandShell->ignErr &&                          } else if (commandShell->ignErr &&
                             (*commandShell->ignErr != '\0')) {                              (*commandShell->ignErr != '\0')) {
Line 760 
Line 766 
                                  */                                   */
                                 if (!(job->flags & JOB_SILENT) && !shutUp &&                                  if (!(job->flags & JOB_SILENT) && !shutUp &&
                                     commandShell->hasEchoCtl) {                                      commandShell->hasEchoCtl) {
                                         DBPRINTF("%s\n", commandShell->echoOff);                                          DBPRINTF(job, "%s\n", commandShell->echoOff);
                                         DBPRINTF(commandShell->errCheck, cmd);                                          DBPRINTF(job, commandShell->errCheck, cmd);
                                         shutUp = true;                                          shutUp = true;
                                 }                                  }
                                 cmdTemplate = commandShell->ignErr;                                  cmdTemplate = commandShell->ignErr;
Line 779 
Line 785 
                 }                  }
         }          }
   
         DBPRINTF(cmdTemplate, cmd);          DBPRINTF(job, cmdTemplate, cmd);
   
         if (errOff) {          if (errOff) {
                 /*                  /*
Line 789 
Line 795 
                  */                   */
                 if (!shutUp && !(job->flags & JOB_SILENT) &&                  if (!shutUp && !(job->flags & JOB_SILENT) &&
                     commandShell->hasEchoCtl){                      commandShell->hasEchoCtl){
                         DBPRINTF("%s\n", commandShell->echoOff);                          DBPRINTF(job, "%s\n", commandShell->echoOff);
                         shutUp = true;                          shutUp = true;
                 }                  }
                 DBPRINTF("%s\n", commandShell->errCheck);                  DBPRINTF(job, "%s\n", commandShell->errCheck);
         }          }
         if (shutUp) {          if (shutUp) {
                 DBPRINTF("%s\n", commandShell->echoOn);                  DBPRINTF(job, "%s\n", commandShell->echoOn);
         }          }
         return 1;          return 1;
 }  }

Legend:
Removed from v.1.68  
changed lines
  Added in v.1.69