rename DONTCARE as OPTIONAL
[unix-history] / usr / src / usr.bin / make / job.c
index b1e5a4e..184e42d 100644 (file)
@@ -1,19 +1,33 @@
+/*
+ * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
+ * Copyright (c) 1988, 1989 by Adam de Boor
+ * Copyright (c) 1989 by Berkeley Softworks
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Adam de Boor.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)job.c      5.11 (Berkeley) %G%";
+#endif /* not lint */
+
 /*-
  * job.c --
  *     handle the creation etc. of our child processes.
  *
 /*-
  * job.c --
  *     handle the creation etc. of our child processes.
  *
- * Copyright (c) 1988, 1989 by the Regents of the University of California
- * Copyright (c) 1988, 1989 by Adam de Boor
- * Copyright (c) 1989 by Berkeley Softworks
- *
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any non-commercial purpose
- * and without fee is hereby granted, provided that the above copyright
- * notice appears in all copies.  The University of California,
- * Berkeley Softworks and Adam de Boor make no representations about
- * the suitability of this software for any purpose.  It is provided
- * "as is" without express or implied warranty.
- *
  * Interface:
  *     Job_Make                Start the creation of the given target.
  *
  * Interface:
  *     Job_Make                Start the creation of the given target.
  *
  *
  *     Job_Wait                Wait for all currently-running jobs to finish.
  */
  *
  *     Job_Wait                Wait for all currently-running jobs to finish.
  */
-#ifndef lint
-static char     *rcsid = "$Id: job.c,v 1.97 89/11/14 13:43:51 adam Exp $ SPRITE (Berkeley)";
-#endif lint
-
-#include    <stdio.h>
-#include    <string.h>
-#include    <sys/types.h>
-#include    <sys/signal.h>
-#include    <sys/stat.h>
-#include    <fcntl.h>
-#include    <sys/file.h>
-#include    <sys/time.h>
-#include    <sys/wait.h>
-#include    <ctype.h>
-#include    <errno.h>
-extern int  errno;
-#include    "make.h"
-#include    "job.h"
 
 
-/*
- * Some systems define the fd_set we use, but not the macros to deal with it
- * (SunOS 3.5, e.g.)
- */
-#ifndef FD_SET
-
-# ifdef NEED_FD_SET
-/*
- * Then there are the systems that don't even define fd_set...
- */
-#  ifndef      FD_SETSIZE
-#  define      FD_SETSIZE      256
-#  endif
-#  ifndef NBBY
-#  define NBBY 8
-#  endif
-
-typedef long   fd_mask;
-#define NFDBITS        (sizeof(fd_mask) * NBBY)        /* bits per mask */
-#ifndef howmany
-#define        howmany(x, y)   ((unsigned int)(((x)+((y)-1)))/(unsigned int)(y))
-#endif
-
-typedef        struct fd_set {
-       fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
-} fd_set;
-
-# endif /* NEED_FD_SET */
-
-#define        FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
-#define        FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
-#define        FD_ISSET(n, p)  ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
-#define FD_ZERO(p)     bzero((char *)(p), sizeof(*(p)))
-
-#endif /* FD_SET */
+#include "make.h"
+#include <sys/signal.h>
+#include <sys/stat.h>
+#include <sys/file.h>
+#include <sys/time.h>
+#include <sys/wait.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include "job.h"
+#include "pathnames.h"
 
 
+extern int  errno;
 
 /*
  * error handling variables 
 
 /*
  * error handling variables 
@@ -182,11 +155,7 @@ static Shell    shells[] = {
 {
     "sh",
     TRUE, "set -", "set -v", "set -", 5,
 {
     "sh",
     TRUE, "set -", "set -v", "set -", 5,
-#if (defined(sun) && !defined(Sprite)) || defined(SYSV)
-    TRUE, "set -e", "set +e",
-#else
     FALSE, "echo \"%s\"\n", "sh -c '%s || exit 0'\n",
     FALSE, "echo \"%s\"\n", "sh -c '%s || exit 0'\n",
-#endif
     "v", "e",
 },
     /*
     "v", "e",
 },
     /*
@@ -242,20 +211,16 @@ Lst           stoppedJobs;        /* Lst of Job structures describing
                                 * limits or migration home */
 
 
                                 * limits or migration home */
 
 
-#if defined(USE_PGRP) && defined(SYSV)
-#define KILL(pid,sig)  killpg(-(pid),(sig))
-#else
 # if defined(USE_PGRP)
 #define KILL(pid,sig)  killpg((pid),(sig))
 # else
 #define KILL(pid,sig)  kill((pid),(sig))
 # endif
 # if defined(USE_PGRP)
 #define KILL(pid,sig)  killpg((pid),(sig))
 # else
 #define KILL(pid,sig)  kill((pid),(sig))
 # endif
-#endif
 
 static void JobRestart();
 static int  JobStart();
 static void JobInterrupt();
 
 static void JobRestart();
 static int  JobStart();
 static void JobInterrupt();
-\f
+
 /*-
  *-----------------------------------------------------------------------
  * JobCondPassSig --
 /*-
  *-----------------------------------------------------------------------
  * JobCondPassSig --
@@ -349,7 +314,7 @@ JobPassSig(signo)
     signal(signo, JobPassSig);
 
 }
     signal(signo, JobPassSig);
 
 }
-\f
+
 /*-
  *-----------------------------------------------------------------------
  * JobCmpPid  --
 /*-
  *-----------------------------------------------------------------------
  * JobCmpPid  --
@@ -371,7 +336,7 @@ JobCmpPid (job, pid)
 {
     return (pid - job->pid);
 }
 {
     return (pid - job->pid);
 }
-\f
+
 /*-
  *-----------------------------------------------------------------------
  * JobPrintCommand  --
 /*-
  *-----------------------------------------------------------------------
  * JobPrintCommand  --
@@ -534,7 +499,7 @@ JobPrintCommand (cmd, job)
     }
     return (0);
 }
     }
     return (0);
 }
-\f
+
 /*-
  *-----------------------------------------------------------------------
  * JobSaveCommand --
 /*-
  *-----------------------------------------------------------------------
  * JobSaveCommand --
@@ -558,7 +523,7 @@ JobSaveCommand (cmd, gn)
     (void)Lst_AtEnd (postCommands->commands, (ClientData)cmd);
     return (0);
 }
     (void)Lst_AtEnd (postCommands->commands, (ClientData)cmd);
     return (0);
 }
-\f
+
 /*-
  *-----------------------------------------------------------------------
  * JobFinish  --
 /*-
  *-----------------------------------------------------------------------
  * JobFinish  --
@@ -591,18 +556,14 @@ JobFinish (job, status)
     Boolean      done;
 
     if ((WIFEXITED(status) &&
     Boolean      done;
 
     if ((WIFEXITED(status) &&
-         (((status.w_retcode != 0) && !(job->flags & JOB_IGNERR)) ||
-          !backwards)) ||
+         (((status.w_retcode != 0) && !(job->flags & JOB_IGNERR)))) ||
        (WIFSIGNALED(status) && (status.w_termsig != SIGCONT)))
     {
        /*
         * If it exited non-zero and either we're doing things our
         * way or we're not ignoring errors, the job is finished.
        (WIFSIGNALED(status) && (status.w_termsig != SIGCONT)))
     {
        /*
         * If it exited non-zero and either we're doing things our
         * way or we're not ignoring errors, the job is finished.
-        * Similarly, if the shell died because of a signal (the
-        * conditional on SIGCONT is to handle the mapping of Sprite
-        * signal semantics whereby wait will return a signal
-        * termination with SIGCONT being the signal to indicate that the
-        * child has resumed), the job is also finished. In these
+        * Similarly, if the shell died because of a signal
+        * the job is also finished. In these
         * cases, finish out the job's output before printing the exit
         * status...
         */
         * cases, finish out the job's output before printing the exit
         * status...
         */
@@ -626,7 +587,7 @@ JobFinish (job, status)
            fclose(job->cmdFILE);
        }
        done = TRUE;
            fclose(job->cmdFILE);
        }
        done = TRUE;
-    } else if (backwards && WIFEXITED(status) && status.w_retcode != 0) {
+    } else if (WIFEXITED(status) && status.w_retcode != 0) {
        /*
         * Deal with ignored errors in -B mode. We need to print a message
         * telling of the ignored error as well as setting status.w_status
        /*
         * Deal with ignored errors in -B mode. We need to print a message
         * telling of the ignored error as well as setting status.w_status
@@ -650,7 +611,7 @@ JobFinish (job, status)
     {
        FILE      *out;
        
     {
        FILE      *out;
        
-       if (backwards && !usePipes && (job->flags & JOB_IGNERR)) {
+       if (!usePipes && (job->flags & JOB_IGNERR)) {
            /*
             * If output is going to a file and this job is ignoring
             * errors, arrange to have the exit status sent to the
            /*
             * If output is going to a file and this job is ignoring
             * errors, arrange to have the exit status sent to the
@@ -738,7 +699,7 @@ JobFinish (job, status)
      * 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.
      */
      * 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 (backwards && (status.w_status == 0) &&
+    if ((status.w_status == 0) &&
        !Lst_IsAtEnd (job->node->commands))
     {
        switch (JobStart (job->node,
        !Lst_IsAtEnd (job->node->commands))
     {
        switch (JobStart (job->node,
@@ -816,7 +777,7 @@ JobFinish (job, status)
        Finish (errors);
     }
 }
        Finish (errors);
     }
 }
-\f
+
 /*-
  *-----------------------------------------------------------------------
  * Job_Touch --
 /*-
  *-----------------------------------------------------------------------
  * Job_Touch --
@@ -840,9 +801,9 @@ Job_Touch (gn, silent)
     struct timeval times[2];   /* Times for utimes() call */
     struct stat attr;        /* Attributes of the file */
 
     struct timeval times[2];   /* Times for utimes() call */
     struct stat attr;        /* Attributes of the file */
 
-    if (gn->type & (OP_JOIN|OP_USE|OP_EXEC|OP_DONTCARE)) {
+    if (gn->type & (OP_JOIN|OP_USE|OP_EXEC|OP_OPTIONAL)) {
        /*
        /*
-        * .JOIN, .USE, .ZEROTIME and .DONTCARE targets are "virtual" targets
+        * .JOIN, .USE, .ZEROTIME and .OPTIONAL targets are "virtual" targets
         * and, as such, shouldn't really be created.
         */
        return;
         * and, as such, shouldn't really be created.
         */
        return;
@@ -889,7 +850,7 @@ Job_Touch (gn, silent)
        }
     }
 }
        }
     }
 }
-\f
+
 /*-
  *-----------------------------------------------------------------------
  * Job_CheckCommands --
 /*-
  *-----------------------------------------------------------------------
  * Job_CheckCommands --
@@ -935,7 +896,7 @@ Job_CheckCommands (gn, abortProc)
             * given, we stop in our tracks, otherwise we just don't update
             * this node's parents so they never get examined. 
             */
             * given, we stop in our tracks, otherwise we just don't update
             * this node's parents so they never get examined. 
             */
-           if (gn->type & OP_DONTCARE) {
+           if (gn->type & OP_OPTIONAL) {
                printf ("Can't figure out how to make %s (ignored)\n",
                        gn->name);
            } else if (keepgoing) {
                printf ("Can't figure out how to make %s (ignored)\n",
                        gn->name);
            } else if (keepgoing) {
@@ -974,7 +935,7 @@ JobLocalInput(stream, job)
     JobDoOutput(job, FALSE);
 }
 #endif /* RMT_WILL_WATCH */
     JobDoOutput(job, FALSE);
 }
 #endif /* RMT_WILL_WATCH */
-\f
+
 /*-
  *-----------------------------------------------------------------------
  * JobExec --
 /*-
  *-----------------------------------------------------------------------
  * JobExec --
@@ -1071,19 +1032,10 @@ JobExec(job, argv)
         * by killing its process family, but not commit suicide.
         */
        
         * by killing its process family, but not commit suicide.
         */
        
-#if defined(SYSV)
-       (void) setpgrp();
-#else
        (void) setpgrp(0, getpid());
        (void) setpgrp(0, getpid());
-#endif
 #endif USE_PGRP
 
 #endif USE_PGRP
 
-       if (job->flags & JOB_REMOTE) {
-           Rmt_Exec (shellPath, argv, FALSE);
-       } else {
-           (void) execv (shellPath, argv);
-       }
-
+       (void) execv (shellPath, argv);
        (void) write (2, "Could not execute shell\n",
                 sizeof ("Could not execute shell"));
        _exit (1);
        (void) write (2, "Could not execute shell\n",
                 sizeof ("Could not execute shell"));
        _exit (1);
@@ -1106,7 +1058,7 @@ JobExec(job, argv)
        }
 
        if (job->flags & JOB_REMOTE) {
        }
 
        if (job->flags & JOB_REMOTE) {
-           job->rmtID = (char *)Rmt_LastID(job->pid);
+           job->rmtID = (char *)0;
        } else {
            nLocal += 1;
            /*
        } else {
            nLocal += 1;
            /*
@@ -1129,7 +1081,7 @@ jobExecFinish:
        jobFull = TRUE;
     }
 }
        jobFull = TRUE;
     }
 }
-\f
+
 /*-
  *-----------------------------------------------------------------------
  * JobMakeArgv --
 /*-
  *-----------------------------------------------------------------------
  * JobMakeArgv --
@@ -1184,15 +1136,11 @@ JobMakeArgv(job, argv)
     }
     argv[argc] = (char *)NULL;
 }
     }
     argv[argc] = (char *)NULL;
 }
-\f
+
 /*-
  *-----------------------------------------------------------------------
  * JobRestart --
 /*-
  *-----------------------------------------------------------------------
  * JobRestart --
- *     Restart a job that stopped for some reason. If the job stopped
- *     because it migrated home again, we tell the Rmt module to
- *     find a new home for it and make it runnable if Rmt_ReExport
- *     succeeded (if it didn't and the job may be run locally, we
- *     simply resume it). If the job didn't run and can now, we run it.
+ *     Restart a job that stopped for some reason. 
  *
  * Results:
  *     None.
  *
  * Results:
  *     None.
@@ -1210,11 +1158,7 @@ JobRestart(job)
        if (DEBUG(JOB)) {
            printf("Remigrating %x\n", job->pid);
        }
        if (DEBUG(JOB)) {
            printf("Remigrating %x\n", job->pid);
        }
-       if (!Rmt_ReExport(job->pid)) {
-           if (DEBUG(JOB)) {
-               printf("Couldn't migrate...");
-           }
-           if (nLocal != maxLocal) {
+       if (nLocal != maxLocal) {
                /*
                 * Job cannot be remigrated, but there's room on the local
                 * machine, so resume the job and note that another
                /*
                 * Job cannot be remigrated, but there's room on the local
                 * machine, so resume the job and note that another
@@ -1226,7 +1170,7 @@ JobRestart(job)
                KILL(job->pid, SIGCONT);
                nLocal +=1;
                job->flags &= ~(JOB_REMIGRATE|JOB_RESUME);
                KILL(job->pid, SIGCONT);
                nLocal +=1;
                job->flags &= ~(JOB_REMIGRATE|JOB_RESUME);
-           } else {
+       } else {
                /*
                 * Job cannot be restarted. Mark the table as full and
                 * place the job back on the list of stopped jobs.
                /*
                 * Job cannot be restarted. Mark the table as full and
                 * place the job back on the list of stopped jobs.
@@ -1240,14 +1184,6 @@ JobRestart(job)
                    printf("Job queue is full.\n");
                }
                return;
                    printf("Job queue is full.\n");
                }
                return;
-           }
-       } else {
-           /*
-            * Clear out the remigrate and resume flags. If MIGRATE was set,
-            * leave that around for JobFinish to see so it doesn't print out
-            * that the job was continued.
-            */
-           job->flags &= ~(JOB_REMIGRATE|JOB_RESUME);
        }
        
        (void)Lst_AtEnd(jobs, (ClientData)job);
        }
        
        (void)Lst_AtEnd(jobs, (ClientData)job);
@@ -1274,20 +1210,7 @@ JobRestart(job)
        if (DEBUG(JOB)) {
            printf("Restarting %s...", job->node->name);
        }
        if (DEBUG(JOB)) {
            printf("Restarting %s...", job->node->name);
        }
-       if ((job->node->type&OP_NOEXPORT) ||
-#ifdef RMT_NO_EXEC
-           !Rmt_Export(shellPath, argv, job)
-#else
-           !Rmt_Begin(shellPath, argv, job->node)
-#endif
-           )
-       {
-           if (
-#ifdef sparc               /* KLUDGE */
-               (job->node->type & OP_M68020) ||
-#endif
-               ((nLocal >= maxLocal) && ! (job->flags & JOB_SPECIAL)))
-           {
+       if (((nLocal >= maxLocal) && ! (job->flags & JOB_SPECIAL))) {
                /*
                 * Can't be exported and not allowed to run locally -- put it
                 * back on the hold queue and mark the table full
                /*
                 * Can't be exported and not allowed to run locally -- put it
                 * back on the hold queue and mark the table full
@@ -1301,7 +1224,7 @@ JobRestart(job)
                    printf("Job queue is full.\n");
                }
                return;
                    printf("Job queue is full.\n");
                }
                return;
-           } else {
+       } else {
                /*
                 * Job may be run locally.
                 */
                /*
                 * Job may be run locally.
                 */
@@ -1309,15 +1232,6 @@ JobRestart(job)
                    printf("running locally\n");
                }
                job->flags &= ~JOB_REMOTE;
                    printf("running locally\n");
                }
                job->flags &= ~JOB_REMOTE;
-           }
-       } else {
-           /*
-            * Can be exported. Hooray!
-            */
-           if (DEBUG(JOB)) {
-               printf("exporting\n");
-           }
-           job->flags |= JOB_REMOTE;
        }
        JobExec(job, argv);
     } else {
        }
        JobExec(job, argv);
     } else {
@@ -1330,8 +1244,7 @@ JobRestart(job)
        }
        if (((job->flags & JOB_REMOTE) ||
             (nLocal < maxLocal) ||
        }
        if (((job->flags & JOB_REMOTE) ||
             (nLocal < maxLocal) ||
-            (((job->flags & JOB_SPECIAL) ||
-              (job->node->type & OP_NOEXPORT)) &&
+            (((job->flags & JOB_SPECIAL)) &&
              (maxLocal == 0))) &&
            (nJobs != maxJobs))
        {
              (maxLocal == 0))) &&
            (nJobs != maxJobs))
        {
@@ -1390,7 +1303,7 @@ JobRestart(job)
        }
     }
 }
        }
     }
 }
-\f
+
 /*-
  *-----------------------------------------------------------------------
  * JobStart  --
 /*-
  *-----------------------------------------------------------------------
  * JobStart  --
@@ -1427,7 +1340,7 @@ JobStart (gn, flags, previous)
        previous->flags &= ~ (JOB_FIRST|JOB_IGNERR|JOB_SILENT|JOB_REMOTE);
        job = previous;
     } else {
        previous->flags &= ~ (JOB_FIRST|JOB_IGNERR|JOB_SILENT|JOB_REMOTE);
        job = previous;
     } else {
-       job = (Job *) malloc (sizeof (Job));
+       job = (Job *) emalloc (sizeof (Job));
        if (job == (Job *)NULL) {
            Punt("JobStart out of memory");
        }
        if (job == (Job *)NULL) {
            Punt("JobStart out of memory");
        }
@@ -1455,7 +1368,7 @@ JobStart (gn, flags, previous)
      * Check the commands now so any attributes from .DEFAULT have a chance
      * to migrate to the node
      */
      * Check the commands now so any attributes from .DEFAULT have a chance
      * to migrate to the node
      */
-    if (!backwards || (job->flags & JOB_FIRST)) {
+    if (job->flags & JOB_FIRST) {
        cmdsOK = Job_CheckCommands(gn, Error);
     } else {
        cmdsOK = TRUE;
        cmdsOK = Job_CheckCommands(gn, Error);
     } else {
        cmdsOK = TRUE;
@@ -1487,7 +1400,11 @@ JobStart (gn, flags, previous)
         */
        noExec = FALSE;
 
         */
        noExec = FALSE;
 
-       if (backwards) {
+       /*
+        * used to be backwards; replace when start doing multiple commands
+        * per shell.
+        */
+       if (1) {
            /*
             * Be compatible: If this is the first time for this node,
             * verify its commands are ok and open the commands list for
            /*
             * Be compatible: If this is the first time for this node,
             * verify its commands are ok and open the commands list for
@@ -1635,7 +1552,7 @@ JobStart (gn, flags, previous)
      * starting a job and then set up its temporary-file name. This is just
      * tfile with two extra digits tacked on -- jobno.
      */
      * starting a job and then set up its temporary-file name. This is just
      * tfile with two extra digits tacked on -- jobno.
      */
-    if (!backwards || (job->flags & JOB_FIRST)) {
+    if (job->flags & JOB_FIRST) {
        if (usePipes) {
            int fd[2];
            (void) pipe(fd); 
        if (usePipes) {
            int fd[2];
            (void) pipe(fd); 
@@ -1653,26 +1570,11 @@ JobStart (gn, flags, previous)
        }
     }
 
        }
     }
 
-    if (!(gn->type & OP_NOEXPORT)) {
-#ifdef RMT_NO_EXEC
-       local = !Rmt_Export(shellPath, argv, job);
-#else
-       local = !Rmt_Begin (shellPath, argv, gn);
-#endif /* RMT_NO_EXEC */
-       if (!local) {
-           job->flags |= JOB_REMOTE;
-       }
-    } else {
-       local = TRUE;
-    }
+    local = TRUE;
 
 
-    if (local && (
-#ifdef sparc   /* KLUDGE */
-       (gn->type & OP_M68020) ||
-#endif
-       ((nLocal >= maxLocal) &&
+    if (local && (((nLocal >= maxLocal) &&
         !(job->flags & JOB_SPECIAL) &&
         !(job->flags & JOB_SPECIAL) &&
-        (!(gn->type & OP_NOEXPORT) || (maxLocal != 0)))))
+        (maxLocal != 0))))
     {
        /*
         * The job can only be run locally, but we've hit the limit of
     {
        /*
         * The job can only be run locally, but we've hit the limit of
@@ -1680,8 +1582,7 @@ JobStart (gn, flags, previous)
         * finishes. Note that the special jobs (.BEGIN, .INTERRUPT and .END)
         * may be run locally even when the local limit has been reached
         * (e.g. when maxLocal == 0), though they will be exported if at
         * finishes. Note that the special jobs (.BEGIN, .INTERRUPT and .END)
         * may be run locally even when the local limit has been reached
         * (e.g. when maxLocal == 0), though they will be exported if at
-        * all possible. In addition, any target marked with .NOEXPORT will
-        * be run locally if maxLocal is 0.
+        * all possible. 
         */
        jobFull = TRUE;
        
         */
        jobFull = TRUE;
        
@@ -1705,7 +1606,7 @@ JobStart (gn, flags, previous)
     }
     return(JOB_RUNNING);
 }
     }
     return(JOB_RUNNING);
 }
-\f
+
 /*-
  *-----------------------------------------------------------------------
  * JobDoOutput  --
 /*-
  *-----------------------------------------------------------------------
  * JobDoOutput  --
@@ -1970,7 +1871,7 @@ end_loop:
     }
     fflush(stdout);
 }
     }
     fflush(stdout);
 }
-\f
+
 /*-
  *-----------------------------------------------------------------------
  * Job_CatchChildren --
 /*-
  *-----------------------------------------------------------------------
  * Job_CatchChildren --
@@ -2009,13 +1910,8 @@ Job_CatchChildren (block)
     while ((pid = wait3(&status, (block?0:WNOHANG)|WUNTRACED,
                        (struct rusage *)0)) > 0)
     {
     while ((pid = wait3(&status, (block?0:WNOHANG)|WUNTRACED,
                        (struct rusage *)0)) > 0)
     {
-       if (DEBUG(JOB)) {
-#ifdef Sprite
-           printf("Process %x exited or stopped.\n", pid);
-#else
+       if (DEBUG(JOB))
            printf("Process %d exited or stopped.\n", pid);
            printf("Process %d exited or stopped.\n", pid);
-#endif /* Sprite */
-       }
            
 
        jnode = Lst_Find (jobs, (ClientData)pid, JobCmpPid);
            
 
        jnode = Lst_Find (jobs, (ClientData)pid, JobCmpPid);
@@ -2024,21 +1920,13 @@ Job_CatchChildren (block)
            if (WIFSIGNALED(status) && (status.w_termsig == SIGCONT)) {
                jnode = Lst_Find(stoppedJobs, (ClientData)pid, JobCmpPid);
                if (jnode == NILLNODE) {
            if (WIFSIGNALED(status) && (status.w_termsig == SIGCONT)) {
                jnode = Lst_Find(stoppedJobs, (ClientData)pid, JobCmpPid);
                if (jnode == NILLNODE) {
-#ifdef Sprite
-                   Error("Resumed child (%x) not in table", pid);
-#else
                    Error("Resumed child (%d) not in table", pid);
                    Error("Resumed child (%d) not in table", pid);
-#endif /* Sprite */
                    continue;
                }
                job = (Job *)Lst_Datum(jnode);
                (void)Lst_Remove(stoppedJobs, jnode);
            } else {
                    continue;
                }
                job = (Job *)Lst_Datum(jnode);
                (void)Lst_Remove(stoppedJobs, jnode);
            } else {
-#ifdef Sprite
-               Error ("Child (%x) not in table?", pid);
-#else
                Error ("Child (%d) not in table?", pid);
                Error ("Child (%d) not in table?", pid);
-#endif /* Sprite */
                continue;
            }
        } else {
                continue;
            }
        } else {
@@ -2049,18 +1937,13 @@ Job_CatchChildren (block)
                printf("Job queue is no longer full.\n");
            }
            jobFull = FALSE;
                printf("Job queue is no longer full.\n");
            }
            jobFull = FALSE;
-       
-           if (job->flags & JOB_REMOTE) {
-               Rmt_Done (job->rmtID);
-           } else {
-               nLocal -= 1;
-           }
+           nLocal -= 1;
        }
 
        JobFinish (job, status);
     }
 }
        }
 
        JobFinish (job, status);
     }
 }
-\f
+
 /*-
  *-----------------------------------------------------------------------
  * Job_CatchOutput --
 /*-
  *-----------------------------------------------------------------------
  * Job_CatchOutput --
@@ -2135,7 +2018,7 @@ Job_CatchOutput ()
     }
 #endif /* RMT_WILL_WATCH */
 }
     }
 #endif /* RMT_WILL_WATCH */
 }
-\f
+
 /*-
  *-----------------------------------------------------------------------
  * Job_Make --
 /*-
  *-----------------------------------------------------------------------
  * Job_Make --
@@ -2156,7 +2039,7 @@ Job_Make (gn)
 {
     (void)JobStart (gn, 0, (Job *)NULL);
 }
 {
     (void)JobStart (gn, 0, (Job *)NULL);
 }
-\f
+
 /*-
  *-----------------------------------------------------------------------
  * Job_Init --
 /*-
  *-----------------------------------------------------------------------
  * Job_Init --
@@ -2178,11 +2061,7 @@ Job_Init (maxproc, maxlocal)
 {
     GNode         *begin;     /* node for commands to do at the very start */
 
 {
     GNode         *begin;     /* node for commands to do at the very start */
 
-#ifdef Sprite
-    sprintf (tfile, "/tmp/make%05x", getpid());
-#else
     sprintf (tfile, "/tmp/make%05d", getpid());
     sprintf (tfile, "/tmp/make%05d", getpid());
-#endif /* Sprite */
 
     jobs =       Lst_Init (FALSE);
     stoppedJobs = Lst_Init(FALSE);
 
     jobs =       Lst_Init (FALSE);
     stoppedJobs = Lst_Init(FALSE);
@@ -2213,10 +2092,10 @@ Job_Init (maxproc, maxlocal)
         * default one... Both the absolute path and the last component
         * must be set. The last component is taken from the 'name' field
         * of the default shell description pointed-to by commandShell.
         * default one... Both the absolute path and the last component
         * must be set. The last component is taken from the 'name' field
         * of the default shell description pointed-to by commandShell.
-        * All default shells are located in DEFSHELLDIR.
+        * All default shells are located in _PATH_DEFSHELLDIR.
         */
        shellName = commandShell->name;
         */
        shellName = commandShell->name;
-       shellPath = Str_Concat (DEFSHELLDIR, shellName, STR_ADDSLASH);
+       shellPath = str_concat (_PATH_DEFSHELLDIR, shellName, STR_ADDSLASH);
     }
 
     if (commandShell->exit == (char *)NULL) {
     }
 
     if (commandShell->exit == (char *)NULL) {
@@ -2276,7 +2155,7 @@ Job_Init (maxproc, maxlocal)
     }
     postCommands = Targ_FindNode (".END", TARG_CREATE);
 }
     }
     postCommands = Targ_FindNode (".END", TARG_CREATE);
 }
-\f
+
 /*-
  *-----------------------------------------------------------------------
  * Job_Full --
 /*-
  *-----------------------------------------------------------------------
  * Job_Full --
@@ -2296,7 +2175,7 @@ Job_Full ()
 {
     return (aborting || jobFull);
 }
 {
     return (aborting || jobFull);
 }
-\f
+
 /*-
  *-----------------------------------------------------------------------
  * Job_Empty --
 /*-
  *-----------------------------------------------------------------------
  * Job_Empty --
@@ -2334,7 +2213,7 @@ Job_Empty ()
        return(FALSE);
     }
 }
        return(FALSE);
     }
 }
-\f
+
 /*-
  *-----------------------------------------------------------------------
  * JobMatchShell --
 /*-
  *-----------------------------------------------------------------------
  * JobMatchShell --
@@ -2377,7 +2256,7 @@ JobMatchShell (name)
     }
     return (match == (Shell *) NULL ? sh : match);
 }
     }
     return (match == (Shell *) NULL ? sh : match);
 }
-\f
+
 /*-
  *-----------------------------------------------------------------------
  * Job_ParseShell --
 /*-
  *-----------------------------------------------------------------------
  * Job_ParseShell --
@@ -2436,7 +2315,7 @@ Job_ParseShell (line)
     while (isspace (*line)) {
        line++;
     }
     while (isspace (*line)) {
        line++;
     }
-    words = Str_BreakString (line, " \t", "\n", &wordCount);
+    words = brk_string (line, &wordCount);
 
     bzero ((Address)&newShell, sizeof(newShell));
     
 
     bzero ((Address)&newShell, sizeof(newShell));
     
@@ -2473,7 +2352,6 @@ Job_ParseShell (line)
                 } else {
                     Parse_Error (PARSE_FATAL, "Unknown keyword \"%s\"",
                                  *argv);
                 } else {
                     Parse_Error (PARSE_FATAL, "Unknown keyword \"%s\"",
                                  *argv);
-                    Str_FreeVec (wordCount, words);
                     return (FAILURE);
                 }
                 fullSpec = TRUE;
                     return (FAILURE);
                 }
                 fullSpec = TRUE;
@@ -2489,7 +2367,6 @@ Job_ParseShell (line)
         */
        if (newShell.name == (char *)NULL) {
            Parse_Error (PARSE_FATAL, "Neither path nor name specified");
         */
        if (newShell.name == (char *)NULL) {
            Parse_Error (PARSE_FATAL, "Neither path nor name specified");
-           Str_FreeVec (wordCount, words);
            return (FAILURE);
        } else {
            commandShell = JobMatchShell (newShell.name);
            return (FAILURE);
        } else {
            commandShell = JobMatchShell (newShell.name);
@@ -2518,7 +2395,7 @@ Job_ParseShell (line)
        if (!fullSpec) {
            commandShell = JobMatchShell (shellName);
        } else {
        if (!fullSpec) {
            commandShell = JobMatchShell (shellName);
        } else {
-           commandShell = (Shell *) malloc(sizeof(Shell));
+           commandShell = (Shell *) emalloc(sizeof(Shell));
            *commandShell = newShell;
        }
     }
            *commandShell = newShell;
        }
     }
@@ -2543,7 +2420,7 @@ Job_ParseShell (line)
     free (words);
     return SUCCESS;
 }
     free (words);
     return SUCCESS;
 }
-\f
+
 /*-
  *-----------------------------------------------------------------------
  * JobInterrupt --
 /*-
  *-----------------------------------------------------------------------
  * JobInterrupt --
@@ -2624,7 +2501,7 @@ JobInterrupt (runINTERRUPT)
     (void) unlink (tfile);
     exit (0);
 }
     (void) unlink (tfile);
     exit (0);
 }
-\f
+
 /*
  *-----------------------------------------------------------------------
  * Job_End --
 /*
  *-----------------------------------------------------------------------
  * Job_End --
@@ -2660,7 +2537,7 @@ Job_End ()
     (void) unlink (tfile);
     return(errors);
 }
     (void) unlink (tfile);
     return(errors);
 }
-\f
+
 /*-
  *-----------------------------------------------------------------------
  * Job_Wait --
 /*-
  *-----------------------------------------------------------------------
  * Job_Wait --
@@ -2687,7 +2564,7 @@ Job_Wait()
     }
     aborting = 0;
 }
     }
     aborting = 0;
 }
-\f
+
 /*-
  *-----------------------------------------------------------------------
  * Job_AbortAll --
 /*-
  *-----------------------------------------------------------------------
  * Job_AbortAll --