Start work on testing and debugging AGGREGATE.
[pspp-builds.git] / src / getline.c
index a5b0148e1dedb4203d7b736079c057a2387b85f1..0b7d4b6df1161a7047e249f430dcd1aab01f53e6 100644 (file)
@@ -24,6 +24,7 @@
 #include <errno.h>
 #include <stdlib.h>
 #include "alloc.h"
+#include "command.h"
 #include "error.h"
 #include "filename.h"
 #include "lexer.h"
@@ -43,6 +44,10 @@ int getl_welcomed;
 int getl_mode;
 int getl_prompt;
 
+#if HAVE_LIBREADLINE
+#include <readline/readline.h>
+#endif
+
 #if HAVE_LIBHISTORY
 static char *history_file;
 
@@ -57,6 +62,7 @@ extern int write_history (char *);
 #endif /* no readline/history.h */
 #endif /* -lhistory */
 
+
 extern struct cmd_set cmd;
 
 static struct string getl_include_path;
@@ -75,16 +81,22 @@ getl_initialize (void)
   ds_create (&getl_include_path,
             fn_getenv_default ("STAT_INCLUDE_PATH", include_path));
   ds_init (&getl_buf, 256);
+#if HAVE_LIBREADLINE 
+  rl_completion_entry_function = pspp_completion_function;
+#endif
 }
 
 /* Close getline. */
 void
 getl_uninitialize (void)
 {
+  getl_close_all();
 #if HAVE_LIBHISTORY && defined (unix)
   if (history_file)
     write_history (history_file);
 #endif
+  ds_destroy (&getl_buf);
+  ds_destroy (&getl_include_path);
 }
 
 /* Returns a string that represents the directory that the syntax file