summaryrefslogtreecommitdiffstats
path: root/debian/patches/rlfe-history.diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--debian/patches/rlfe-history.diff50
1 files changed, 50 insertions, 0 deletions
diff --git a/debian/patches/rlfe-history.diff b/debian/patches/rlfe-history.diff
new file mode 100644
index 0000000..7962003
--- /dev/null
+++ b/debian/patches/rlfe-history.diff
@@ -0,0 +1,50 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## rlfe-history.dpatch by <andrew@pimlott.net>
+##
+## DP: Fix rlfe, always writing a history file.
+
+@DPATCH@
+--- 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;
+