summaryrefslogtreecommitdiff
blob: f74aad63be1f47019893d5651fc5efdc1b6ebe5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
http://lists.gnu.org/archive/html/bug-bash/2014-12/msg00152.html

*** ../bash-4.3-patched/lib/readline/readline.c	2014-10-01 13:08:28.000000000 -0400
--- lib/readline/readline.c	2014-12-20 22:37:28.000000000 -0500
***************
*** 580,592 ****
  	}
  
!       /* EOF typed to a non-blank line is a <NL>.  If we want to change this,
! 	 to force any existing line to be ignored when read(2) reads EOF,
! 	 for example, this is the place to change. */
        if (c == EOF && rl_end)
! 	c = NEWLINE;
  
        /* The character _rl_eof_char typed to blank line, and not as the
! 	 previous character is interpreted as EOF. */
!       if (((c == _rl_eof_char && lastc != c) || c == EOF) && !rl_end)
  	{
  #if defined (READLINE_CALLBACKS)
--- 587,620 ----
  	}
  
!       /* EOF typed to a non-blank line is ^D the first time, EOF the second
! 	 time in a row.  This won't return any partial line read from the tty.
! 	 If we want to change this, to force any existing line to be returned
! 	 when read(2) reads EOF, for example, this is the place to change. */
        if (c == EOF && rl_end)
! 	{
! 	  if (RL_SIG_RECEIVED ())
! 	    {
! 	      RL_CHECK_SIGNALS ();
! 	      if (rl_signal_event_hook)
! 		(*rl_signal_event_hook) ();		/* XXX */
! 	    }
! 
! 	  /* XXX - reading two consecutive EOFs returns EOF */
! 	  if (RL_ISSTATE (RL_STATE_TERMPREPPED))
! 	    {
! 	      if (lastc == _rl_eof_char || lastc == EOF)
! 		rl_end = 0;
! 	      else
! 	        c = _rl_eof_char;
! 	    }
! 	  else
! 	    c = NEWLINE;
! 	}
  
        /* The character _rl_eof_char typed to blank line, and not as the
! 	 previous character is interpreted as EOF.  This doesn't work when
! 	 READLINE_CALLBACKS is defined, so hitting a series of ^Ds will
! 	 erase all the chars on the line and then return EOF. */
!       if (((c == _rl_eof_char && lastc != c) || c == EOF) && rl_end == 0)
  	{
  #if defined (READLINE_CALLBACKS)