Changeset: 9f7d76987f96 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9f7d76987f96
Modified Files:
        clients/src/mapiclient/ReadlineTools.c
        clients/src/mapiclient/ReadlineTools.h
        clients/src/mapiclient/mclient.c
Branch: Oct2010
Log Message:

Save readline history as we go along.
This is a different (and better, since we don't depend on interrupts)
way for fixing bug 2632.


diffs (46 lines):

diff -r fe6bfdec4834 -r 9f7d76987f96 clients/src/mapiclient/ReadlineTools.c
--- a/clients/src/mapiclient/ReadlineTools.c    Fri Oct 01 16:26:53 2010 +0200
+++ b/clients/src/mapiclient/ReadlineTools.c    Fri Oct 01 16:50:26 2010 +0200
@@ -390,10 +390,16 @@
 void
 deinit_readline(void)
 {
-       if (_save_history) {
-               write_history(_history_file);
-       }
+       /* nothing to do since we use append_history() */
 }
 
+void
+save_line(const char *s)
+{
+       add_history(s);
+       if (_save_history)
+               append_history(1, _history_file);
+}
+
 
 #endif /* HAVE_LIBREADLINE */
diff -r fe6bfdec4834 -r 9f7d76987f96 clients/src/mapiclient/ReadlineTools.h
--- a/clients/src/mapiclient/ReadlineTools.h    Fri Oct 01 16:26:53 2010 +0200
+++ b/clients/src/mapiclient/ReadlineTools.h    Fri Oct 01 16:50:26 2010 +0200
@@ -24,6 +24,7 @@
 
 void init_readline(Mapi mid, char *language, int save_history);
 void deinit_readline(void);
+void save_line(const char *s);
 rl_completion_func_t *suspend_completion(void);
 void continue_completion(rl_completion_func_t * func);
 
diff -r fe6bfdec4834 -r 9f7d76987f96 clients/src/mapiclient/mclient.c
--- a/clients/src/mapiclient/mclient.c  Fri Oct 01 16:26:53 2010 +0200
+++ b/clients/src/mapiclient/mclient.c  Fri Oct 01 16:50:26 2010 +0200
@@ -1781,7 +1781,7 @@
                        if (buf) {
                                length = strlen(buf);
                                if (length > 1)
-                                       add_history(buf);
+                                       save_line(buf);
                                buf = realloc(buf, length + 2);
                                buf[length++] = '\n';
                                buf[length] = 0;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to