[gnu.utils.bug] Patches for make 3.27

tower@WHEATIES.AI.MIT.EDU (Leonard H. Tower Jr.) (01/10/89)

Return-Path: <bug-gnu-emacs-request@prep.ai.mit.edu>
Date: 5 Jan 89 23:09:28 GMT
From: nexus!mike@uunet.uu.net  (Mike Hickey)
Organization: Nexus Inc., Washington DC
Subject: Patches for make 3.27
Sender: bug-gnu-emacs-request@prep.ai.mit.edu
To: bug-gnu-emacs@prep.ai.mit.edu


Greetings!

    Here are some trivial patches that were required by a SysV box
for compilation.

--------------------[ cut here ]--------------------
# Files to patch: make.c, commands.c
#
# make.c:
# Structure member index confused the compiler due to the
# redefinition in make.h
#
#commands.c:
# Use pre-defined macros for wait status.  Their use hadn't
# been propagated through.
#
# The following patches were required for compilation under
# System V.  Tested on an NCR Tower 400 w/O.S. Rel. 2.0.0
#
*** make.c	Mon Dec 12 23:37:13 1988
--- ../patched-make/make.c	Thu Jan  5 22:01:26 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 sindex; /* Index into above.  */
      unsigned int max;	/* Number of pointers allocated.  */
    };
  
***************
*** 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

--- 466,472 -----
    if (makefiles != 0)
      {
        register unsigned int i;
!       for (i = 0; i < makefiles->sindex; ++i)
  	if (makefiles->list[i][0] == '-' && makefiles->list[i][1] == '\0')
  	  {
  	    /* This makefile is standard input.  Since we may re-exec
***************
*** 658,664
  		      ++j;
  		    }
  	    }
! 	  if (directories != 0 && directories->index > 0)
  	    {
  	      char bad;
  	      if (current_directory[0] != '\0')

--- 658,664 -----
  		      ++j;
  		    }
  	    }
! 	  if (directories != 0 && directories->sindex > 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++)

--- 742,748 -----
    other_args = (struct stringlist *) xmalloc (sizeof (struct stringlist));
    other_args->max = 5;
    other_args->list = (char **) xmalloc (5 * sizeof (char *));
!   other_args->sindex = 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;
  			}

--- 782,788 -----
  			  sl = (struct stringlist *)
  			    xmalloc (sizeof (struct stringlist));
  			  sl->max = 5;
! 			  sl->sindex = 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 **)

--- 786,792 -----
  			  sl->list = (char **) xmalloc (5 * sizeof (char *));
  			  *(struct stringlist **) cs->value_ptr = sl;
  			}
! 		      else if (sl->sindex == 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;
  

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

--- 827,833 -----
  	  }
        else
  	{
! 	  if (other_args->sindex == 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];
  	}
      }
  

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

--- 839,845 -----
      }
  
    if (other_args != 0)
!     other_args->list[other_args->sindex] = 0;
  }
  
  static void
*** commands.c	Mon Dec 12 23:37:09 1988
--- ../patched-make/commands.c	Thu Jan  5 21:57:31 1989
***************
*** 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;

--- 165,171 -----
        if (pid == shell_function_pid)
  	{
  	  shell_function_pid
! 	    = (WIFEXITED (status) && WRETCODE (status) == 127) ? -1 : 0;
  
  	  if (sig < 0 && ++dead_children > -sig)
  	    return 0;
***************
*** 180,188
  	    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))
  	      {

--- 180,188 -----
  	    char buf[100];
  
  	    if (WIFEXITED (status))
! 	      if (WRETCODE (status) != 0)
! 		sprintf (buf, "*** Error %d", WRETCODE (status));
! 	      else 
  		buf[0] = '\0';
  	    else if ((WIFSIGNALED (status)))
  	      {
***************
*** 184,190
  		sprintf (buf, "*** Error %d", status.w_retcode);
  	      else
  		buf[0] = '\0';
! 	    else if (WIFSIGNALED (status))
  	      {
  		char *cd = status.w_coredump ? " (core dumped)" : "";
  		if (status.w_termsig > 0 && status.w_termsig < NSIG)

--- 184,190 -----
  		sprintf (buf, "*** Error %d", WRETCODE (status));
  	      else 
  		buf[0] = '\0';
! 	    else if ((WIFSIGNALED (status)))
  	      {
  		char *cd = (WCOREDUMP(status) ? " (core dumped)" : "");
  		if (WTERMSIG (status) > 0 && WTERMSIG (status) < NSIG)
***************
*** 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);
  	      }

--- 186,194 -----
  		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");

--- 190,196 -----
  		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");