summaryrefslogtreecommitdiffstats
path: root/patches/readline-8.0/0004-rlfe-history.patch
blob: 1bd44d33f7a1854cbfbb7ccd9b23a675e8bc38ef (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
55
56
57
58
59
60
From: "andrew@pimlott.net" <andrew@pimlott.net>
Date: Sun, 24 Jan 2010 00:31:48 +0100
Subject: [PATCH] rlfe-history.

rlfe-history.dpatch by  <andrew@pimlott.net>

from:
http://ftp.de.debian.org/debian/pool/main/r/readline6/readline6_6.1-1.diff.gz

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 examples/rlfe/rlfe.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/examples/rlfe/rlfe.c b/examples/rlfe/rlfe.c
index f40b2ddaf00f..89bb17e462db 100644
--- a/examples/rlfe/rlfe.c
+++ b/examples/rlfe/rlfe.c
@@ -154,21 +154,27 @@ struct termios orig_term;
 static pid_t child = -1;
 
 static void
-sig_child (int signo)
+finish_up()
 {
-  int status;
-  wait (&status);
   if (hist_file != 0)
     {
       write_history (hist_file);
       if (hist_size)
 	history_truncate_file (hist_file, hist_size);
     }
-  DPRINT0 ("(Child process died.)\n");
   tcsetattr(STDIN_FILENO, TCSANOW, &orig_term);
   exit (0);
 }
 
+static void
+sig_child (int signo)
+{
+  int status;
+  wait (&status);
+  DPRINT0 ("(Child process died.)\n");
+  finish_up();
+}
+
 volatile int propagate_sigwinch = 0;
 
 /* sigwinch_handler
@@ -710,8 +716,7 @@ main(int argc, char** argv)
 	  if (count <= 0)
 	    {
 	      DPRINT0 ("(Connection closed by foreign host.)\n");
-	      tcsetattr(STDIN_FILENO, TCSANOW, &orig_term);
-	      exit (0);
+              finish_up();
 	    }
 	  old_count = buf_count;