[gnu.bash.bug] General-interest patches needed to make 1.01 on NeXT

jacob@blackbox.gore.com (Jacob Gore) (06/29/89)

This patch is necessary (but not sufficient -- see comments on Makefile
changes below) to make bash-1.01 compile and run on NeXT 0.9.  This
patch should not break anything on non-NeXT systems.

There should be at most two warnings generated during the compilation: in
jobs.c:1329 (due to an apparent bug in gcc on NeXT 0.9, so I didn't put in
a work-around), and one in parse.y (which you won't get if you also apply
Brian's patch to parse.y that declares index() in the right place).

The patch just lists NeXT among systems where strchr exists, and cleans up
all the places in readline.c that assume sighandler==int, and that need
forward-declarations of static functions.  It also includes John Franks'
fix for term_backspace, as amended by Brian.

This compilation is done WITHOUT the -traditional flag.  After this patch,
are there systems where the "-traditional" is still needed?

The following Makefile information is of interest to NeXT people only --
but Brian, could you document "NeXT" as a possible TARGET?

1. Set TARGET=NeXT and OS=Bsd
2. in DEBUG_FLAGS assignment, comment out $(GCC_SUNOS4_FLAG)
3. Set GCC=cc
4. In TRADITIONAL assignment, comment out -traditional (leave assignment empty)
   This is needed because 0.9's include files don't work with -traditional
5. In MALLOC assignment, comment out right-hand side (leave assignment empty)
   This is needed if you want to use the shared libraries.  If you really want
   rcheck-malloc, try using the regular libc.a instead -- I haven't tried it.

That's it.

--
Jacob Gore	Jacob@Gore.Com		{nucsrl,boulder}!gore!jacob
*** /tmp/,RCSt1001747	Wed Jun 28 02:12:31 1989
--- general.c	Wed Jun 28 00:28:27 1989
***************
*** 340,346 ****
    return (0);
  }
  
! #if defined SONY || defined Bsd
  #include <strings.h>
  
  char *
--- 340,346 ----
    return (0);
  }
  
! #if defined SONY || (defined Bsd && !defined NeXT)
  #include <strings.h>
  
  char *
*** /tmp/,RCSt1001747	Wed Jun 28 02:12:34 1989
--- readline.c	Wed Jun 28 02:06:33 1989
***************
*** 69,74 ****
--- 69,83 ----
  #include "readline.h"
  #include "history.h"
  
+ /* Forward declarations of functions in this file
+    that are not equivalent to "extern int function()" */
+ 
+ static update_line();
+ static void output_character_function();
+ static delete_chars();
+ static start_insert();
+ static end_insert();
+ 
  /* #define GCC_BUG */
  
  #ifdef GCC_BUG
***************
*** 77,84 ****
  #endif
  
  #ifdef SIGWINCH
! static int rl_handle_sigwinch ();
! static Function *old_sigwinch = (Function *)NULL;
  #endif
  
  #if defined NOJOBS || defined SYSV
--- 86,93 ----
  #endif
  
  #ifdef SIGWINCH
! static sighandler rl_handle_sigwinch ();
! static SigHandler *old_sigwinch = (SigHandler *)NULL;
  #endif
  
  #if defined NOJOBS || defined SYSV
***************
*** 211,217 ****
    rl_prep_terminal ();
  
  #ifdef SIGWINCH
!   old_sigwinch = (Function *)signal (SIGWINCH, rl_handle_sigwinch);
  #endif
  
  #ifdef HANDLE_SIGNALS
--- 220,226 ----
    rl_prep_terminal ();
  
  #ifdef SIGWINCH
!   old_sigwinch = (SigHandler *)signal (SIGWINCH, rl_handle_sigwinch);
  #endif
  
  #ifdef HANDLE_SIGNALS
***************
*** 243,249 ****
  }
  
  #ifdef SIGWINCH
! static int
  rl_handle_sigwinch (sig, code, scp)
       int sig, code;
       struct sigcontext *scp;
--- 252,258 ----
  }
  
  #ifdef SIGWINCH
! static sighandler
  rl_handle_sigwinch (sig, code, scp)
       int sig, code;
       struct sigcontext *scp;
***************
*** 266,273 ****
        rl_forced_update_display ();
      }
  
!   if (old_sigwinch && old_sigwinch != (Function *)SIG_IGN &&
!       old_sigwinch != (Function *)SIG_DFL)
      (*old_sigwinch)(sig, code, scp);
  }
  #endif  /* SIGWINCH */
--- 275,282 ----
        rl_forced_update_display ();
      }
  
!   if (old_sigwinch && old_sigwinch != (SigHandler *)SIG_IGN &&
!       old_sigwinch != (SigHandler *)SIG_DFL)
      (*old_sigwinch)(sig, code, scp);
  }
  #endif  /* SIGWINCH */
***************
*** 274,286 ****
  
  #ifdef HANDLE_SIGNALS
  /* Interrupt handling. */
! static Function *old_int = (Function *)NULL,
! 	        *old_tstp = (Function *)NULL,
!        		*old_ttou = (Function *)NULL,
!        		*old_ttin = (Function *)NULL,
!        	 	*old_cont = (Function *)NULL;
    
  /* Handle an interrupt character. */
  rl_signal_handler (sig, code, scp)
       int sig, code;
       struct sigcontext *scp;
--- 283,296 ----
  
  #ifdef HANDLE_SIGNALS
  /* Interrupt handling. */
! static SigHandler *old_int = (SigHandler *)NULL,
! 	          *old_tstp = (SigHandler *)NULL,
!        		  *old_ttou = (SigHandler *)NULL,
!        		  *old_ttin = (SigHandler *)NULL,
!        	 	  *old_cont = (SigHandler *)NULL;
    
  /* Handle an interrupt character. */
+ static sighandler
  rl_signal_handler (sig, code, scp)
       int sig, code;
       struct sigcontext *scp;
***************
*** 304,310 ****
  
  #ifdef SIGCONT
      if (sig != SIGINT)
!       old_cont = (Function *)signal (SIGCONT, rl_signal_handler);
  #endif
      break;
  
--- 314,320 ----
  
  #ifdef SIGCONT
      if (sig != SIGINT)
!       old_cont = (SigHandler *)signal (SIGCONT, rl_signal_handler);
  #endif
      break;
  
***************
*** 327,346 ****
  
  rl_set_signals ()
  {
!   static int rl_signal_handler ();
  
!   old_int = (Function *)signal (SIGINT, rl_signal_handler);
!   if (old_int == (Function *)SIG_IGN)
      signal (SIGINT, SIG_IGN);
  
  #ifdef SIGTSTP
!   old_tstp = (Function *)signal (SIGTSTP, rl_signal_handler);
!   if (old_tstp == (Function *)SIG_IGN)
      signal (SIGTSTP, SIG_IGN);
  #endif
  #ifdef SIGTTOU
!   old_ttou = (Function *)signal (SIGTTOU, rl_signal_handler);
!   old_ttin = (Function *)signal (SIGTTIN, rl_signal_handler);
  #endif
  }
  
--- 337,356 ----
  
  rl_set_signals ()
  {
!   static sighandler rl_signal_handler ();
  
!   old_int = (SigHandler *)signal (SIGINT, rl_signal_handler);
!   if (old_int == (SigHandler *)SIG_IGN)
      signal (SIGINT, SIG_IGN);
  
  #ifdef SIGTSTP
!   old_tstp = (SigHandler *)signal (SIGTSTP, rl_signal_handler);
!   if (old_tstp == (SigHandler *)SIG_IGN)
      signal (SIGTSTP, SIG_IGN);
  #endif
  #ifdef SIGTTOU
!   old_ttou = (SigHandler *)signal (SIGTTOU, rl_signal_handler);
!   old_ttin = (SigHandler *)signal (SIGTTIN, rl_signal_handler);
  #endif
  }
  
***************
*** 1309,1317 ****
  
    BC = tgetstr ("pc", &buffer);
    PC = buffer ? *buffer : 0;
-   BC = tgetstr ("le", &buffer);
  
!   term_backspace = tgetstr ("bw", &buffer);
  
    term_cr = tgetstr ("cr", &buffer);
    term_clreol = tgetstr ("ce", &buffer);
--- 1319,1326 ----
  
    BC = tgetstr ("pc", &buffer);
    PC = buffer ? *buffer : 0;
  
!   term_backspace = tgetstr ("le", &buffer);
  
    term_cr = tgetstr ("cr", &buffer);
    term_clreol = tgetstr ("ce", &buffer);
--
Jacob Gore	Jacob@Gore.Com		{nucsrl,boulder}!gore!jacob