* config/tc-mcore.c (mcore_pool_count): New function.
[binutils-gdb.git] / readline / callback.c
index a8f4323c929f467c905b4781e867c641908a1646..117235697e161627ba60ab81c394bd71cd904a5b 100644 (file)
 #if defined (READLINE_CALLBACKS)
 
 #include <sys/types.h>
-
-#ifdef HAVE_STDLIB_H
-#  include <stdlib.h>
-#else
-#  include "ansi_stdlib.h"
-#endif
-
 #include <stdio.h>
 
 /* System-specific feature definitions and include files. */
@@ -59,7 +52,7 @@
    text read in at each end of line.  The terminal is kept prepped and
    signals handled all the time, except during calls to the user's function. */
 
-rl_vcpfunc_t *rl_linefunc;             /* user callback function */
+VFunction *rl_linefunc;                /* user callback function */
 static int in_handler;         /* terminal_prepped and signals set? */
 
 /* Make sure the terminal is set up, initialize readline, and prompt. */
@@ -85,10 +78,11 @@ _rl_callback_newline ()
 /* Install a readline handler, set up the terminal, and issue the prompt. */
 void
 rl_callback_handler_install (prompt, linefunc)
-     const char *prompt;
-     rl_vcpfunc_t *linefunc;
+     char *prompt;
+     VFunction *linefunc;
 {
-  rl_set_prompt (prompt);
+  rl_prompt = prompt;
+  rl_visible_prompt_length = rl_prompt ? rl_expand_prompt (rl_prompt) : 0;
   rl_linefunc = linefunc;
   _rl_callback_newline ();
 }
@@ -108,33 +102,24 @@ rl_callback_read_char ()
 
   eof = readline_internal_char ();
 
-  /* We loop in case some function has pushed input back with rl_execute_next. */
-  for (;;)
+  if (rl_done)
     {
-      if (rl_done)
-       {
-         line = readline_internal_teardown (eof);
+      line = readline_internal_teardown (eof);
 
-         (*rl_deprep_term_function) ();
+      (*rl_deprep_term_function) ();
 #if defined (HANDLE_SIGNALS)
-         rl_clear_signals ();
+      rl_clear_signals ();
 #endif
-         in_handler = 0;
-         (*rl_linefunc) (line);
-
-         /* If the user did not clear out the line, do it for him. */
-         if (rl_line_buffer[0])
-           _rl_init_line_state ();
-
-         /* Redisplay the prompt if readline_handler_{install,remove}
-            not called. */
-         if (in_handler == 0 && rl_linefunc)
-           _rl_callback_newline ();
-       }
-      if (rl_pending_input)
-       eof = readline_internal_char ();
-      else
-        break;
+      in_handler = 0;
+      (*rl_linefunc) (line);
+
+    /* If the user did not clear out the line, do it for him. */
+    if (rl_line_buffer[0])
+      _rl_init_line_state ();
+
+    /* Redisplay the prompt if readline_handler_{install,remove} not called. */
+      if (in_handler == 0 && rl_linefunc)
+       _rl_callback_newline ();
     }
 }