Reform string library.
[pspp-builds.git] / src / ui / terminal / read-line.c
index e92113514aae370953d1a582322c393b8e690533..a87adfcf7ef8eacda1ce785abb6ccdf6ed57bb1e 100644 (file)
 
 #include <config.h>
 
+#include "read-line.h"
+
 #include <stdlib.h>
 #include <stdbool.h>
 #include <assert.h>
 #include <errno.h>
 
-#include "read-line.h"
+#include "msg-ui.h"
+
+#include <data/file-name.h>
+#include <data/file-name.h>
+#include <data/settings.h>
 #include <language/command.h>
-#include <data/filename.h>
-#include <libpspp/version.h>
+#include <libpspp/message.h>
 #include <libpspp/str.h>
+#include <libpspp/version.h>
 #include <output/table.h>
-#include <libpspp/message.h>
-#include <data/filename.h>
-#include <data/settings.h>
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
@@ -53,8 +56,9 @@ readln_initialize (void)
 {
   initialised = true;
 
-#if HAVE_READLINE 
-  rl_completion_entry_function = pspp_completion_function;
+#if HAVE_READLINE
+  rl_basic_word_break_characters = "\n";
+  rl_attempted_completion_function = pspp_attempted_completion_function;
 #ifdef unix
   if (history_file == NULL)
     {
@@ -117,8 +121,7 @@ readln_read (struct string *line, const char *prompt)
   
   assert(initialised);
 
-  err_error_count = err_warning_count = 0;
-  err_already_flagged = 0;
+  reset_msg_count ();
 
   welcome ();
 
@@ -130,14 +133,14 @@ readln_read (struct string *line, const char *prompt)
     {
       if (string[0])
         add_history (string);
-      ds_replace (line, string);
+      ds_assign_cstr (line, string);
       free (string);
       return true; 
     }
 #else
   fputs (prompt, stdout);
   fflush (stdout);
-  if (ds_gets (line, stdin)) 
+  if (ds_read_line (line, stdin)) 
     {
       ds_chomp (line, '\n');
       return true;