[gnu.utils.bug] GNU Make 3.56: Fix for MFLAGS/MAKEFLAGS with -j#

chip@ateng.ateng.com (Chip Salzenberg) (10/11/89)

[BUG FIX]

Fix creation of MFLAGS/MAKEFLAGS when job_slots > 1.  The old code wrote
   "-j#" in the string array, then advanced the pointer too far.  The result
   was that "-j#" was the last option propagated to child makes.

Index: main.c
***************
*** 1108,1115 ****
  
    i = 0;
-   flags[i++] = '-';
  
    for (cs = switches; cs->c != '\0'; ++cs)
!     if (cs->toenv)
        switch (cs->type)
  	{
--- 1129,1139 ----
  
    i = 0;
  
    for (cs = switches; cs->c != '\0'; ++cs)
!     {
!       if (! cs->toenv)
! 	continue;
!       if (i == 0 || flags[i - 1] == ' ')
! 	flags[i++] = '-';
        switch (cs->type)
  	{
***************
*** 1142,1153 ****
  		{
  		  strcpy (&flags[i], "j1 ");
! 		  i += 5;
  		}
  	      else
  		{
! 		  char *p = &flags[i];
! 		  sprintf (p, "%c%u ", cs->c,
  			   *(unsigned int *) cs->value_ptr);
! 		  i += strlen (p);
  		}
  	    }
--- 1166,1176 ----
  		{
  		  strcpy (&flags[i], "j1 ");
! 		  i += strlen (&flags[i]);
  		}
  	      else
  		{
! 		  sprintf (&flags[i], "%c%u ", cs->c,
  			   *(unsigned int *) cs->value_ptr);
! 		  i += strlen (&flags[i]);
  		}
  	    }
***************
*** 1174,1177 ****
--- 1197,1201 ----
  	  break;
  	}
+     }
  
    if (i == 0)