+
+ /* Check whether the size of the window has changed, so that
+ the output drivers can adjust their settings as needed. We
+ only do this for the first line of a command, as it's
+ possible that the output drivers are actually in use
+ afterward, and we don't want to confuse them in the middle
+ of output. */
+ if (style == PROMPT_FIRST)
+ terminal_check_size ();
+
+ return !eof;
+}
+
+static void
+readln_close (struct getl_interface *i)
+{
+ free (i);
+}
+
+/* Creates a source which uses readln to get its line */
+struct getl_interface *
+create_readln_source (void)
+{
+ struct readln_source *rlns = xzalloc (sizeof (*rlns));
+
+ rlns->interactive_func = readln_read;
+
+ rlns->parent.interactive = always_true;
+ rlns->parent.read = read_interactive;
+ rlns->parent.close = readln_close;
+
+ return &rlns->parent;
+}
+
+
+#if HAVE_READLINE
+static char *command_generator (const char *text, int state);
+
+/* Returns a set of command name completions for TEXT.
+ This is of the proper form for assigning to
+ rl_attempted_completion_function. */
+static char **
+complete_command_name (const char *text, int start, int end UNUSED)
+{
+ if (start == 0)
+ {
+ /* Complete command name at start of line. */
+ return rl_completion_matches (text, command_generator);
+ }
+ else
+ {
+ /* Otherwise don't do any completion. */
+ rl_attempted_completion_over = 1;
+ return NULL;
+ }