🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by iwtpm!imdave Thu, 05 Jan 1989 00:44
gnumake 3.27 patches
#1444
Author: iwtpm!imdave
Date: Thu, 05 Jan 1989 00:44
1231 lines
32673 bytes
Hi,

I've found some bugs in gnu make 3.27 for USG system V release 2,
release 3, and Microport's system V release 2 80286 port.  The patchs
are enclosed.  The Microport and ar*.c patches are probably necessary
for other 16-bit systems too.  Some of these fixes were posted previously
-- I don't remember who posted them tho... sorry.

One should define in the Makefile either USGr2 or USGr3 if USG is defined.

------------------- cut here ---------------------
Bugs:

ar.c, arscan.c made the assumption that an int is the same size as a long.

arscan.c needs to strip a trailing '/' from ar_name[] if PORTAR or
	u3b2 is defined.

commands.c had incorrect wait status macros for USG.  I also added
	dup2() for USGr2, and a couple of functions to replace some
	macros that the Microport compiler is too buggy to handle.

	Also, in USG systems (at least the ones I have access to) a
	SIGCLD handler must do a wait() to get rid of the dead child.
	If the signal() system call is issued to re-instate the handler,
	we immediately re-enter the handler.  This continues until the
	stack grows too large, and we get a core file.  The most straight-
	forward fix for USG is just to not use a SIGCLD handler.

dep.h replaces macro dep_name() with a function for Microport.

make.c used "index" as a structure member name -- this makes trouble
	when index is #defined to strchr in make.h when USG is defined.

	The SIGCLD handler is not used for USG.

	Also, I found that job_slots was always being set to 1, even
	when I used the -j command line switch.  The problem is that
	MAKEFLAGS is scanned after the command line, and MAKEFLAGS
	is initialized with "-j1".  So, I made the command line
	override MAKEFLAGS.

make.h replaces macro streq() with a function for Microport.



*** /tmp/,RCSt1a06425	Wed Jan  4 12:21:29 1989
--- ar.c	Wed Jan  4 12:20:31 1989
***************
*** 18,24
  
  
  /* Defined in arscan.c  */
! extern int ar_scan (), ar_member_touch ();
  
  
  /* Return nonzero if NAME is an archive-member reference, zero if not.

--- 18,25 -----
  
  
  /* Defined in arscan.c  */
! extern long ar_scan ();
! extern int ar_member_touch ();
  
  
  /* Return nonzero if NAME is an archive-member reference, zero if not.
***************
*** 41,47
    return 1;
  }
  
! static int ar_member_date_1 ();
  
  /* Return the modtime of NAME.  */
  

--- 42,48 -----
    return 1;
  }
  
! static long ar_member_date_1 ();
  
  /* Return the modtime of NAME.  */
  
***************
*** 52,58
    char *arname;
    char *memname;
    char *p;
!   int val;
  
    /* This "file" is an archive member.  */
    p = index (name, '(');

--- 53,59 -----
    char *arname;
    char *memname;
    char *p;
!   long val;
  
    /* This "file" is an archive member.  */
    p = index (name, '(');
***************
*** 64,70
       member are run, and they will change the archive itself.  */
    (void) f_mtime (enter_file (arname));
  
!   val = ar_scan (arname, ar_member_date_1, (int) memname);
  
    free (arname);
    free (memname);

--- 65,71 -----
       member are run, and they will change the archive itself.  */
    (void) f_mtime (enter_file (arname));
  
!   val = ar_scan (arname, ar_member_date_1, (long) memname);
  
    free (arname);
    free (memname);
***************
*** 74,80
  /* This function is called by `ar_scan' to find which member to look at.  */
  
  /* ARGSUSED */
! static int
  ar_member_date_1 (desc, name, hdrpos, datapos, size, date, uid, gid, mode, mem)
       int desc;
       char *name;

--- 75,81 -----
  /* This function is called by `ar_scan' to find which member to look at.  */
  
  /* ARGSUSED */
! static long
  ar_member_date_1 (desc, name, hdrpos, datapos, size, date, uid, gid, mode, mem)
       int desc;
       char *name;
***************
*** 78,84
  ar_member_date_1 (desc, name, hdrpos, datapos, size, date, uid, gid, mode, mem)
       int desc;
       char *name;
!      int hdrpos, datapos, size, date, uid, gid, mode;
       char *mem;
  {
    return streq (name, mem) ? date : 0;

--- 79,86 -----
  ar_member_date_1 (desc, name, hdrpos, datapos, size, date, uid, gid, mode, mem)
       int desc;
       char *name;
!      long hdrpos, datapos, size, date;
!      int uid, gid, mode;
       char *mem;
  {
    return streq (name, mem) ? date : 0;
*** /tmp/,RCSt1a06425	Wed Jan  4 12:21:31 1989
--- arscan.c	Wed Jan  4 12:20:32 1989
***************
*** 119,125
  
  
  extern int open (), read (), close (), write (), fstat ();
! extern long int lseek ();
  extern int atoi (), strcmp ();
  
  /* Takes three arguments ARCHIVE, FUNCTION and ARG.

--- 119,125 -----
  
  
  extern int open (), read (), close (), write (), fstat ();
! extern long int atol (), lseek ();
  extern int atoi (), strcmp ();
  
  /* Takes three arguments ARCHIVE, FUNCTION and ARG.
***************
*** 128,137
     and for each one call FUNCTION with the following arguments:
       archive file descriptor for reading the data,
       member name,
!      member header position in file,
!      member data position in file,
!      member data size,
!      member date,
       member uid,
       member gid,
       member protection mode,

--- 128,137 -----
     and for each one call FUNCTION with the following arguments:
       archive file descriptor for reading the data,
       member name,
!      member header position (long) in file,
!      member data position (long) in file,
!      member data size (long),
!      member date (long),
       member uid,
       member gid,
       member protection mode,
***************
*** 135,141
       member uid,
       member gid,
       member protection mode,
!      ARG.
  
     The descriptor is poised to read the data of the member
     when FUNCTION is called.  It does not matter how much

--- 135,141 -----
       member uid,
       member gid,
       member protection mode,
!      ARG (long).
  
     The descriptor is poised to read the data of the member
     when FUNCTION is called.  It does not matter how much
***************
*** 148,154
     Returns -2 if archive has invalid format.
     Returns 0 if have scanned successfully.  */
  
! int
  ar_scan (archive, function, arg)
       char *archive;
       int (*function) ();

--- 148,154 -----
     Returns -2 if archive has invalid format.
     Returns 0 if have scanned successfully.  */
  
! long
  ar_scan (archive, function, arg)
       char *archive;
       int (*function) ();
***************
*** 152,158
  ar_scan (archive, function, arg)
       char *archive;
       int (*function) ();
!      int arg;
  {
    register int desc = open (archive, O_RDONLY, 0);
    if (desc < 0)

--- 152,158 -----
  ar_scan (archive, function, arg)
       char *archive;
       int (*function) ();
!      long arg;
  {
    register int desc = open (archive, O_RDONLY, 0);
    if (desc < 0)
***************
*** 194,200
  	register int nread;
  	struct ar_hdr member_header;
  	char name [1 + sizeof member_header.ar_name];
! 	int eltsize;
  	int eltmode;
  	int fnval;
  

--- 194,200 -----
  	register int nread;
  	struct ar_hdr member_header;
  	char name [1 + sizeof member_header.ar_name];
! 	long eltsize;
  	int eltmode;
  	long fnval;
  
***************
*** 196,202
  	char name [1 + sizeof member_header.ar_name];
  	int eltsize;
  	int eltmode;
! 	int fnval;
  
  	if (lseek (desc, member_offset, 0) < 0)
  	  {

--- 196,202 -----
  	char name [1 + sizeof member_header.ar_name];
  	long eltsize;
  	int eltmode;
! 	long fnval;
  
  	if (lseek (desc, member_offset, 0) < 0)
  	  {
***************
*** 222,227
  	{
  	  register char *p = name + sizeof member_header.ar_name;
  	  while (p > name && *--p == ' ') *p = 0;
  	}
  
  	sscanf (member_header.ar_mode, "%o", &eltmode);

--- 222,231 -----
  	{
  	  register char *p = name + sizeof member_header.ar_name;
  	  while (p > name && *--p == ' ') *p = 0;
+ #if defined(PORTAR) || defined(u3b2)
+ 	  if (*p == '/')
+ 	    *p = 0;
+ #endif
  	}
  
  	sscanf (member_header.ar_mode, "%o", &eltmode);
***************
*** 225,231
  	}
  
  	sscanf (member_header.ar_mode, "%o", &eltmode);
! 	eltsize = atoi (member_header.ar_size);
  
  	fnval =
  	  (*function) (desc, name, member_offset,

--- 229,235 -----
  	}
  
  	sscanf (member_header.ar_mode, "%o", &eltmode);
! 	eltsize = atol (member_header.ar_size);
  
  	fnval =
  	  (*function) (desc, name, member_offset,
***************
*** 230,236
  	fnval =
  	  (*function) (desc, name, member_offset,
  		       member_offset + sizeof (member_header), eltsize,
! 		       atoi (member_header.ar_date),
  		       atoi (member_header.ar_uid),
  		       atoi (member_header.ar_gid),
  		       eltmode, arg);

--- 234,240 -----
  	fnval =
  	  (*function) (desc, name, member_offset,
  		       member_offset + sizeof (member_header), eltsize,
! 		       atol (member_header.ar_date),
  		       atoi (member_header.ar_uid),
  		       atoi (member_header.ar_gid),
  		       eltmode, arg);
***************
*** 251,257
  }
  
  /* ARGSUSED */
! static int
  ar_member_pos (desc, name, hdrpos, datapos, size, date, uid, gid, mode, mem)
       int desc;
       char *name;

--- 255,261 -----
  }
  
  /* ARGSUSED */
! static long
  ar_member_pos (desc, name, hdrpos, datapos, size, date, uid, gid, mode, mem)
       int desc;
       char *name;
***************
*** 255,261
  ar_member_pos (desc, name, hdrpos, datapos, size, date, uid, gid, mode, mem)
       int desc;
       char *name;
!      int hdrpos, datapos, size, date, uid, gid, mode;
       char *mem;
  {
    if (strcmp (name, mem))

--- 259,266 -----
  ar_member_pos (desc, name, hdrpos, datapos, size, date, uid, gid, mode, mem)
       int desc;
       char *name;
!      long hdrpos, datapos, size, date;
!      int uid, gid, mode;
       char *mem;
  {
    if (strcmp (name, mem))
***************
*** 274,280
  ar_member_touch (arname, memname)
       char *arname, *memname;
  {
!   register long int pos = ar_scan (arname, ar_member_pos, (int) memname);
    register int fd;
    struct ar_hdr ar_hdr;
    register int i;

--- 279,285 -----
  ar_member_touch (arname, memname)
       char *arname, *memname;
  {
!   register long int pos = ar_scan (arname, ar_member_pos, (long) memname);
    register int fd;
    struct ar_hdr ar_hdr;
    register int i;
***************
*** 305,311
    /* Advance member's time to that time */
    for (i = 0; i < sizeof ar_hdr.ar_date; i++)
      ar_hdr.ar_date[i] = ' ';
!   sprintf (ar_hdr.ar_date, "%d", statbuf.st_mtime);
  #else
    ar_hdr.ar_date = statbuf.st_mtime;
  #endif

--- 310,316 -----
    /* Advance member's time to that time */
    for (i = 0; i < sizeof ar_hdr.ar_date; i++)
      ar_hdr.ar_date[i] = ' ';
!   sprintf (ar_hdr.ar_date, "%ld", statbuf.st_mtime);
  #else
    ar_hdr.ar_date = statbuf.st_mtime;
  #endif
***************
*** 326,332
  
  #ifdef TEST
  
! int
  describe_member (desc, name, hdrpos, datapos, size, date, uid, gid, mode)
       int desc;
       char *name;

--- 331,337 -----
  
  #ifdef TEST
  
! long
  describe_member (desc, name, hdrpos, datapos, size, date, uid, gid, mode)
       int desc;
       char *name;
***************
*** 330,336
  describe_member (desc, name, hdrpos, datapos, size, date, uid, gid, mode)
       int desc;
       char *name;
!      int hdrpos, datapos, size, date, uid, gid, mode;
  {
    printf ("Member %s: %d bytes at %d (%d).\n", name, size, hdrpos, datapos);
    printf ("  Date %s", ctime (&date));

--- 335,342 -----
  describe_member (desc, name, hdrpos, datapos, size, date, uid, gid, mode)
       int desc;
       char *name;
!      long hdrpos, datapos, size, date;
!      int uid, gid, mode;
  {
    extern char *ctime();
    printf ("Member %s: %ld bytes at %ld (%ld).\n", name, size, hdrpos, datapos);
***************
*** 332,338
       char *name;
       int hdrpos, datapos, size, date, uid, gid, mode;
  {
!   printf ("Member %s: %d bytes at %d (%d).\n", name, size, hdrpos, datapos);
    printf ("  Date %s", ctime (&date));
    printf ("  uid = %d, gid = %d, mode = 0%o.\n", uid, gid, mode);
    return 0;

--- 338,345 -----
       long hdrpos, datapos, size, date;
       int uid, gid, mode;
  {
!   extern char *ctime();
!   printf ("Member %s: %ld bytes at %ld (%ld).\n", name, size, hdrpos, datapos);
    printf ("  Date %s", ctime (&date));
    printf ("  uid = %d, gid = %d, mode = 0%o.\n", uid, gid, mode);
    return 0;
*** /tmp/,RCSt1a06425	Wed Jan  4 12:21:33 1989
--- commands.c	Wed Jan  4 12:20:32 1989
***************
*** 22,30
  #ifdef	USG
  
  #define WAIT_T int
! #define WTERMSIG(x) ((x) & 0xf7)
! #define WCOREDUMP(x) ((x) & 0x01)
! #define WRETCODE(x) ((x) & (0xff >> 8))
  #define WIFSIGNALED(x) (WTERMSIG (x) != 0)
  #define WIFEXITED(x) (WTERMSIG (x) == 0)
  

--- 22,30 -----
  #ifdef	USG
  
  #define WAIT_T int
! #define WTERMSIG(x) ((x) & 0x7f)
! #define WCOREDUMP(x) ((x) & 0200)
! #define WRETCODE(x) (((x) >> 8) & 0xff)
  #define WIFSIGNALED(x) (WTERMSIG (x) != 0)
  #define WIFEXITED(x) (WTERMSIG (x) == 0)
  
***************
*** 28,33
  #define WIFSIGNALED(x) (WTERMSIG (x) != 0)
  #define WIFEXITED(x) (WTERMSIG (x) == 0)
  
  #else	/* not USG	*/
  
  #include <sys/wait.h>

--- 28,38 -----
  #define WIFSIGNALED(x) (WTERMSIG (x) != 0)
  #define WIFEXITED(x) (WTERMSIG (x) == 0)
  
+ #ifdef	USGr2
+ #include <errno.h>
+ #include <fcntl.h>
+ #endif
+ 
  #else	/* not USG	*/
  
  #include <sys/wait.h>
***************
*** 116,122
  
  extern int shell_function_pid;
  
! /* Handle a child-termination signal (SIGCHLD, or SIGCLD for USG),
     storing the returned status and the new command state (`cs_finished')
     in the `file' member of the `struct child' for the dead child,
     and removing the child from the chain.

--- 121,127 -----
  
  extern int shell_function_pid;
  
! /* Handle a child-termination signal (SIGCHLD),
     storing the returned status and the new command state (`cs_finished')
     in the `file' member of the `struct child' for the dead child,
     and removing the child from the chain.
***************
*** 121,128
     in the `file' member of the `struct child' for the dead child,
     and removing the child from the chain.
  
!    If we were called as a signal handler, SIG should be SIGCHLD
!    (SIGCLD for USG).  If instead it is zero, we were called explicitly
     and should block waiting for running children.
     If SIG is < 0, - SIG is the maximum number of children to bury (record
     status of and remove from the chain).  */

--- 126,133 -----
     in the `file' member of the `struct child' for the dead child,
     and removing the child from the chain.
  
!    If we were called as a signal handler (never true for USG), SIG
!    should be SIGCHLD.  If instead it is zero, we were called explicitly
     and should block waiting for running children.
     If SIG is < 0, - SIG is the maximum number of children to bury (record
     status of and remove from the chain).  */
***************
*** 136,151
    unsigned int dead_children = 0;
  
  #ifdef	USG
-   if (sig > 0)
-     {
-       /* No safe signals!  */
- #	ifdef	SIGCHLD
-       (void) signal (SIGCHLD, child_handler);
- #	else
-       (void) signal (SIGCLD, child_handler);
- #	endif
-     }
- 
    /* System V has no wait3 system call, so it can't wait without
       blocking, so we must avoid hanging if we have no children.  */
    if (children == 0 && shell_function_pid <= 0)

--- 141,146 -----
    unsigned int dead_children = 0;
  
  #ifdef	USG
    /* System V has no wait3 system call, so it can't wait without
       blocking, so we must avoid hanging if we have no children.  */
    if (children == 0 && shell_function_pid <= 0)
***************
*** 151,157
    if (children == 0 && shell_function_pid <= 0)
      return 0;
  
!   while (wait (&status) > 0)
  #else	/* not USG	*/
    while ((sig <= 0
  	  ? (pid = wait (&status))

--- 146,152 -----
    if (children == 0 && shell_function_pid <= 0)
      return 0;
  
!   while ((pid = wait (&status)) > 0)
  #else	/* not USG	*/
    while ((sig <= 0
  	  ? (pid = wait (&status))
***************
*** 165,171
        if (pid == shell_function_pid)
  	{
  	  shell_function_pid
! 	    = (WIFEXITED (status) && status.w_retcode == 127) ? -1 : 0;
  
  	  if (sig < 0 && ++dead_children > -sig)
  	    return 0;

--- 160,166 -----
        if (pid == shell_function_pid)
  	{
  	  shell_function_pid
! 	    = (WIFEXITED (status) && WRETCODE(status) == 127) ? -1 : 0;
  
  	  if (sig < 0 && ++dead_children > -sig)
  	    return 0;
***************
*** 180,187
  	    char buf[100];
  
  	    if (WIFEXITED (status))
! 	      if (status.w_retcode != 0)
! 		sprintf (buf, "*** Error %d", status.w_retcode);
  	      else
  		buf[0] = '\0';
  	    else if (WIFSIGNALED (status))

--- 175,182 -----
  	    char buf[100];
  
  	    if (WIFEXITED (status))
! 	      if (WRETCODE (status) != 0)
! 		sprintf (buf, "*** Error %d", WRETCODE (status));
  	      else
  		buf[0] = '\0';
  	    else if (WIFSIGNALED (status))
***************
*** 186,194
  		buf[0] = '\0';
  	    else if (WIFSIGNALED (status))
  	      {
! 		char *cd = status.w_coredump ? " (core dumped)" : "";
! 		if (status.w_termsig > 0 && status.w_termsig < NSIG)
! 		  sprintf (buf, "*** %s%s", sys_siglist[status.w_termsig], cd);
  		else
  		  sprintf (buf, "*** Signal %d%s", status.w_termsig, cd);
  	      }

--- 181,189 -----
  		buf[0] = '\0';
  	    else if (WIFSIGNALED (status))
  	      {
! 		char *cd = WCOREDUMP (status) ? " (core dumped)" : "";
! 		if (WTERMSIG (status) > 0 && WTERMSIG (status) < NSIG)
! 		  sprintf (buf, "*** %s%s", sys_siglist[WTERMSIG(status)], cd);
  		else
  		  sprintf (buf, "*** Signal %d%s", WTERMSIG (status), cd);
  	      }
***************
*** 190,196
  		if (status.w_termsig > 0 && status.w_termsig < NSIG)
  		  sprintf (buf, "*** %s%s", sys_siglist[status.w_termsig], cd);
  		else
! 		  sprintf (buf, "*** Signal %d%s", status.w_termsig, cd);
  	      }
  	    else
  	      strcpy (buf, "*** Strange Error");

--- 185,191 -----
  		if (WTERMSIG (status) > 0 && WTERMSIG (status) < NSIG)
  		  sprintf (buf, "*** %s%s", sys_siglist[WTERMSIG(status)], cd);
  		else
! 		  sprintf (buf, "*** Signal %d%s", WTERMSIG (status), cd);
  	      }
  	    else
  	      strcpy (buf, "*** Strange Error");
***************
*** 302,307
  #ifdef SIGCHLD
    (void) signal (SIGCHLD, SIG_IGN);
  #else
    (void) signal (SIGCLD, SIG_IGN);
  #endif
  

--- 297,303 -----
  #ifdef SIGCHLD
    (void) signal (SIGCHLD, SIG_IGN);
  #else
+ #ifndef USG
    (void) signal (SIGCLD, SIG_IGN);
  #endif
  #endif
***************
*** 304,309
  #else
    (void) signal (SIGCLD, SIG_IGN);
  #endif
  
    /* Call child_handler to do the work.  */
    (void) child_handler (- (int) n);

--- 300,306 -----
  #ifndef USG
    (void) signal (SIGCLD, SIG_IGN);
  #endif
+ #endif
  
    /* Call child_handler to do the work.  */
    (void) child_handler (- (int) n);
***************
*** 312,317
  #ifdef SIGCHLD
    (void) signal (SIGCHLD, child_handler);
  #else
    (void) signal (SIGCLD, child_handler);
  #endif
  }

--- 309,315 -----
  #ifdef SIGCHLD
    (void) signal (SIGCHLD, child_handler);
  #else
+ #ifndef USG
    (void) signal (SIGCLD, child_handler);
  #endif
  #endif
***************
*** 314,319
  #else
    (void) signal (SIGCLD, child_handler);
  #endif
  }
  
  /* Start a job to run the commands specified in CHILD.

--- 312,318 -----
  #ifndef USG
    (void) signal (SIGCLD, child_handler);
  #endif
+ #endif
  }
  
  /* Start a job to run the commands specified in CHILD.
***************
*** 475,480
    return 0;
  }
  
  /* Execute the commands to remake FILE.  If they are currently executing,
     return success (0).  If they have already finished executing, return
     their status.  Otherwise, fork off a child process to run the first

--- 474,502 -----
    return 0;
  }
  
+ #ifdef	USGr2
+ /*
+  * SVR2 does not have the dup2() system call...
+  */
+ int
+ dup2( fd1, fd2 )
+ {
+   extern int errno;
+   int newfd;
+ 
+   (void) close (fd2);
+   if ((newfd = fcntl (fd1, F_DUPFD, fd2)) == -1)
+     return -1;
+   if (newfd != fd2)
+     {
+     (void) close (newfd);
+     errno = EMFILE;
+     return -1;
+     }
+   return newfd;
+ }
+ #endif
+ 
  /* Execute the commands to remake FILE.  If they are currently executing,
     return success (0).  If they have already finished executing, return
     their status.  Otherwise, fork off a child process to run the first
***************
*** 851,856
  
    puts (cmds->commands);
  }
  
  /* Set Emacs C-mode style.
     Local Variables:

--- 873,901 -----
  
    puts (cmds->commands);
  }
+ 
+ #ifdef	iAPX286
+ /*
+  * Streq() -- compiler cannot handle streq() macro in some contexts, so...
+  */
+ int
+ streq (a, b)
+      register char *a, *b;
+ {
+   return (a == b || (*a == *b && (*a == '\0' || !strcmp (a + 1, b + 1))));
+ }
+ 
+ /*
+  * Dep_name() -- compiler cannot handle dep_name() macro in some
+  * contexts either...
+  */
+ char *
+ dep_name (d)
+      register struct dep *d;
+ {
+   return d->name == 0 ? d->file->name : d->name;
+ }
+ #endif
  
  /* Set Emacs C-mode style.
     Local Variables:
No differences encountered
*** /tmp/,RCSt1a06425	Wed Jan  4 12:21:39 1989
--- dep.h	Wed Jan  4 12:20:33 1989
***************
*** 40,45
  extern struct nameseq *multi_glob (), *parse_file_seq ();
  
  
  #define dep_name(d) ((d)->name == 0 ? (d)->file->name : (d)->name)
  
  

--- 40,48 -----
  extern struct nameseq *multi_glob (), *parse_file_seq ();
  
  
+ #ifdef	iAPX286
+ extern char *dep_name();	/* buggy compiler work-around */
+ #else
  #define dep_name(d) ((d)->name == 0 ? (d)->file->name : (d)->name)
  #endif
  
***************
*** 41,46
  
  
  #define dep_name(d) ((d)->name == 0 ? (d)->file->name : (d)->name)
  
  
  /* Set Emacs C-mode style.

--- 44,50 -----
  extern char *dep_name();	/* buggy compiler work-around */
  #else
  #define dep_name(d) ((d)->name == 0 ? (d)->file->name : (d)->name)
+ #endif
  
  
  /* Set Emacs C-mode style.
*** /tmp/,RCSt1a06425	Wed Jan  4 12:21:46 1989
--- make.c	Wed Jan  4 12:20:35 1989
***************
*** 96,102
  struct stringlist
    {
      char **list;	/* Nil-terminated list of strings.  */
!     unsigned int index;	/* Index into above.  */
      unsigned int max;	/* Number of pointers allocated.  */
    };
  

--- 96,102 -----
  struct stringlist
    {
      char **list;	/* Nil-terminated list of strings.  */
!     unsigned int ndex;	/* Index into above.  */
      unsigned int max;	/* Number of pointers allocated.  */
    };
  
***************
*** 244,249
    register struct file *f;
    register unsigned int i;
    int status;
    register char *cmd_defs;
    register unsigned int cmd_defs_len, cmd_defs_idx;
    char **p;

--- 244,250 -----
    register struct file *f;
    register unsigned int i;
    int status;
+   int original_job_slots;
    register char *cmd_defs;
    register unsigned int cmd_defs_len, cmd_defs_idx;
    char **p;
***************
*** 257,262
    reading_filename = 0;
    reading_lineno_ptr = 0;
    
    if (signal (SIGHUP, fatal_error_signal) == SIG_IGN)
      (void) signal (SIGHUP, SIG_IGN);
    if (signal (SIGQUIT, fatal_error_signal) == SIG_IGN)

--- 258,264 -----
    reading_filename = 0;
    reading_lineno_ptr = 0;
    
+ #ifndef DEBUG
    if (signal (SIGHUP, fatal_error_signal) == SIG_IGN)
      (void) signal (SIGHUP, SIG_IGN);
    if (signal (SIGQUIT, fatal_error_signal) == SIG_IGN)
***************
*** 289,294
    if (signal (SIGXFSZ, fatal_error_signal) == SIG_IGN)
      (void) signal (SIGXFSZ, SIG_IGN);
  #endif
  
    /* Figure out where this program lives.  */
  

--- 291,297 -----
    if (signal (SIGXFSZ, fatal_error_signal) == SIG_IGN)
      (void) signal (SIGXFSZ, SIG_IGN);
  #endif
+ #endif
  
    /* Figure out where this program lives.  */
  
***************
*** 466,472
    if (makefiles != 0)
      {
        register unsigned int i;
!       for (i = 0; i < makefiles->index; ++i)
  	if (makefiles->list[i][0] == '-' && makefiles->list[i][1] == '\0')
  	  {
  	    /* This makefile is standard input.  Since we may re-exec

--- 469,475 -----
    if (makefiles != 0)
      {
        register unsigned int i;
!       for (i = 0; i < makefiles->ndex; ++i)
  	if (makefiles->list[i][0] == '-' && makefiles->list[i][1] == '\0')
  	  {
  	    /* This makefile is standard input.  Since we may re-exec
***************
*** 514,519
  #ifdef SIGCHLD
    (void) signal (SIGCHLD, child_handler);
  #else
    (void) signal (SIGCLD, child_handler);
  #endif
  

--- 517,523 -----
  #ifdef SIGCHLD
    (void) signal (SIGCHLD, child_handler);
  #else
+ #ifndef USG
    (void) signal (SIGCLD, child_handler);
  #endif
  #endif
***************
*** 516,521
  #else
    (void) signal (SIGCLD, child_handler);
  #endif
  
    read_makefiles
      = read_all_makefiles (makefiles == 0 ? (char **) 0 : makefiles->list);

--- 520,526 -----
  #ifndef USG
    (void) signal (SIGCLD, child_handler);
  #endif
+ #endif
  
    read_makefiles
      = read_all_makefiles (makefiles == 0 ? (char **) 0 : makefiles->list);
***************
*** 520,525
    read_makefiles
      = read_all_makefiles (makefiles == 0 ? (char **) 0 : makefiles->list);
  
    decode_env_switches ("MAKEFLAGS", 9);
    decode_env_switches ("MFLAGS", 6);
  

--- 525,538 -----
    read_makefiles
      = read_all_makefiles (makefiles == 0 ? (char **) 0 : makefiles->list);
  
+   /* job_slots is either 1 (as initialized), or it has been set from the
+      command line -j argument.  However, MAKEFLAGS has been created with
+      -j1, so we can't just call decode_env_switches() -- this will always
+      reset job_slots to 1.  So, if -j is specified on the command line,
+      it will override the environment. */
+ 
+   original_job_slots = job_slots;
+ 
    decode_env_switches ("MAKEFLAGS", 9);
    decode_env_switches ("MFLAGS", 6);
  
***************
*** 523,528
    decode_env_switches ("MAKEFLAGS", 9);
    decode_env_switches ("MFLAGS", 6);
  
    ignore_errors_flag |= lookup_file (".IGNORE") != 0;
  
    silent_flag |= lookup_file (".SILENT") != 0;

--- 536,551 -----
    decode_env_switches ("MAKEFLAGS", 9);
    decode_env_switches ("MFLAGS", 6);
  
+   if (original_job_slots != 1)		/* command line -jn */
+     {
+       if (job_slots == 1)		/* MAKEFLAGS=-j1 */
+ 	job_slots = original_job_slots;	/* command line overrides MAKEFLAGS */
+       else
+ 	/* both command line and MAKEFLAGS specified -j */
+ 	if (makelevel == 0)
+ 	  job_slots = original_job_slots;/* command line takes precedence */
+     }
+ 
    ignore_errors_flag |= lookup_file (".IGNORE") != 0;
  
    silent_flag |= lookup_file (".SILENT") != 0;
***************
*** 658,664
  		      ++j;
  		    }
  	    }
! 	  if (directories != 0 && directories->index > 0)
  	    {
  	      char bad;
  	      if (current_directory[0] != '\0')

--- 681,687 -----
  		      ++j;
  		    }
  	    }
! 	  if (directories != 0 && directories->ndex > 0)
  	    {
  	      char bad;
  	      if (current_directory[0] != '\0')
***************
*** 742,748
    other_args = (struct stringlist *) xmalloc (sizeof (struct stringlist));
    other_args->max = 5;
    other_args->list = (char **) xmalloc (5 * sizeof (char *));
!   other_args->index = 1;
    other_args->list[0] = savestring (argv[0], strlen (argv[0]));
  
    for (i = 1; i < argc; i++)

--- 765,771 -----
    other_args = (struct stringlist *) xmalloc (sizeof (struct stringlist));
    other_args->max = 5;
    other_args->list = (char **) xmalloc (5 * sizeof (char *));
!   other_args->ndex = 1;
    other_args->list[0] = savestring (argv[0], strlen (argv[0]));
  
    for (i = 1; i < argc; i++)
***************
*** 782,788
  			  sl = (struct stringlist *)
  			    xmalloc (sizeof (struct stringlist));
  			  sl->max = 5;
! 			  sl->index = 0;
  			  sl->list = (char **) xmalloc (5 * sizeof (char *));
  			  *(struct stringlist **) cs->value_ptr = sl;
  			}

--- 805,811 -----
  			  sl = (struct stringlist *)
  			    xmalloc (sizeof (struct stringlist));
  			  sl->max = 5;
! 			  sl->ndex = 0;
  			  sl->list = (char **) xmalloc (5 * sizeof (char *));
  			  *(struct stringlist **) cs->value_ptr = sl;
  			}
***************
*** 786,792
  			  sl->list = (char **) xmalloc (5 * sizeof (char *));
  			  *(struct stringlist **) cs->value_ptr = sl;
  			}
! 		      else if (sl->index == sl->max - 1)
  			{
  			  sl->max += 5;
  			  sl->list = (char **)

--- 809,815 -----
  			  sl->list = (char **) xmalloc (5 * sizeof (char *));
  			  *(struct stringlist **) cs->value_ptr = sl;
  			}
! 		      else if (sl->ndex == sl->max - 1)
  			{
  			  sl->max += 5;
  			  sl->list = (char **)
***************
*** 793,800
  			    xrealloc ((char *) sl->list,
  				      sl->max * sizeof (char *));
  			}
! 		      sl->list[sl->index++] = savestring (arg, strlen (arg));
! 		      sl->list[sl->index] = 0;
  		      sw = "";
  		      break;
  

--- 816,823 -----
  			    xrealloc ((char *) sl->list,
  				      sl->max * sizeof (char *));
  			}
! 		      sl->list[sl->ndex++] = savestring (arg, strlen (arg));
! 		      sl->list[sl->ndex] = 0;
  		      sw = "";
  		      break;
  
***************
*** 827,833
  	  }
        else
  	{
! 	  if (other_args->index == other_args->max - 1)
  	    {
  	      other_args->max += 5;
  	      other_args->list = (char **)

--- 850,856 -----
  	  }
        else
  	{
! 	  if (other_args->ndex == other_args->max - 1)
  	    {
  	      other_args->max += 5;
  	      other_args->list = (char **)
***************
*** 834,840
  		xrealloc ((char *) other_args->list,
  			  other_args->max * sizeof (char *));
  	    }
! 	  other_args->list[other_args->index++] = argv[i];
  	}
      }
  

--- 857,863 -----
  		xrealloc ((char *) other_args->list,
  			  other_args->max * sizeof (char *));
  	    }
! 	  other_args->list[other_args->ndex++] = argv[i];
  	}
      }
  
***************
*** 839,845
      }
  
    if (other_args != 0)
!     other_args->list[other_args->index] = 0;
  }
  
  static void

--- 862,868 -----
      }
  
    if (other_args != 0)
!     other_args->list[other_args->ndex] = 0;
  }
  
  static void
*** /tmp/,RCSt1a06425	Wed Jan  4 12:21:51 1989
--- make.h	Wed Jan  4 12:20:35 1989
***************
*** 32,37
  #define MAXPATHLEN 1024
  #endif	/* no MAXPATHLEN	*/
  
  #define streq(a, b) \
    ((a) == (b) || \
     (*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1))))

--- 32,40 -----
  #define MAXPATHLEN 1024
  #endif	/* no MAXPATHLEN	*/
  
+ #ifdef	iAPX286
+ extern int streq();	/* buggy compiler work-around */
+ #else
  #define streq(a, b) \
    ((a) == (b) || \
     (*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1))))
***************
*** 35,40
  #define streq(a, b) \
    ((a) == (b) || \
     (*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1))))
  
  
  extern void die ();

--- 38,44 -----
  #define streq(a, b) \
    ((a) == (b) || \
     (*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1))))
+ #endif
  
  
  extern void die ();

----------------- end of patches ----------------


Dave Bodenstab
AT&T Bell Labs
...att!iwsl8!imdave
gnumake 3.27 patches
#1445
Author: Richard Stallman
Date: Thu, 05 Jan 1989 03:04
3 lines
578 bytes
In general, GNU software assumes that an int is the same size as a long.
Although some programs may distinguish in a few cases,
we don't undertake to support 16-bit machines.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads