Changeset: b3bc6e506f97 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b3bc6e506f97
Modified Files:
        clients/mapiclient/ReadlineTools.c
        sql/test/mapi/Tests/python_test_monetdb_sql.SQL.bat
        sql/test/mapi/Tests/python_test_monetdb_sql.SQL.sh
Branch: default
Log Message:

Merge with Feb2013 branch.


diffs (75 lines):

diff --git a/clients/mapiclient/ReadlineTools.c 
b/clients/mapiclient/ReadlineTools.c
--- a/clients/mapiclient/ReadlineTools.c
+++ b/clients/mapiclient/ReadlineTools.c
@@ -39,6 +39,8 @@
 #endif
 #endif
 
+#include <errno.h>
+
 #define PATHLENGTH     256     /* maximum file pathname length. */
 
 static const char *sql_commands[] = {
@@ -390,8 +392,36 @@ init_readline(Mapi mid, char *lang, int 
                         mo_find_option(NULL, 0, "prefix"), DIR_SEP, language);
                _save_history = 1;
 #endif
-               if (_save_history)
-                       read_history(_history_file);
+               if (_save_history) {
+                       FILE *f;
+                       switch (read_history(_history_file)) {
+                       case 0:
+                               /* success */
+                               break;
+                       case ENOENT:
+                               /* history file didn't exist, so try to create
+                                * it and then try again */
+                               if ((f = fopen(_history_file, "w")) != NULL) {
+                                       /* failed to create, don't
+                                        * bother saving */
+                                       _save_history = 0;
+                               } else {
+                                       (void) fclose(f);
+                                       if (read_history(_history_file) != 0) {
+                                               /* still no luck, don't
+                                                * bother saving */
+                                               _save_history = 0;
+                                       }
+                               }
+                               break;
+                       default:
+                               /* unrecognized failure, don't bother saving */
+                               _save_history = 0;
+                               break;
+                       }
+               }
+               if (!_save_history)
+                       fprintf(stderr, "Warning: not saving history\n");
        }
 }
 
diff --git a/sql/test/mapi/Tests/python_test_monetdb_sql.SQL.bat 
b/sql/test/mapi/Tests/python_test_monetdb_sql.SQL.bat
--- a/sql/test/mapi/Tests/python_test_monetdb_sql.SQL.bat
+++ b/sql/test/mapi/Tests/python_test_monetdb_sql.SQL.bat
@@ -2,7 +2,7 @@
 
 rem must be aligned with the installation directory chosen in
 rem clients/python/test/Makefile.ag
-set testpath=%TSTSRCBASE%\..\clients\python\test
+set testpath=%TSTSRCBASE%\..\clients\python2\test
 set PYTHONPATH=%testpath%;%PYTHONPATH%
 
 prompt # $t $g  
diff --git a/sql/test/mapi/Tests/python_test_monetdb_sql.SQL.sh 
b/sql/test/mapi/Tests/python_test_monetdb_sql.SQL.sh
--- a/sql/test/mapi/Tests/python_test_monetdb_sql.SQL.sh
+++ b/sql/test/mapi/Tests/python_test_monetdb_sql.SQL.sh
@@ -2,7 +2,7 @@
 
 # must be aligned with the installation directory chosen in
 # clients/python/test/Makefile.ag
-testpath="$TSTSRCBASE/../clients/python/test"
+testpath="$TSTSRCBASE/../clients/python2/test"
 PYTHONPATH=$testpath:$PYTHONPATH
 export PYTHONPATH
 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to