]> git.proxmox.com Git - qemu.git/commitdiff
monitor: Break out readline_show_prompt (Jan Kiszka)
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
Thu, 5 Mar 2009 23:01:10 +0000 (23:01 +0000)
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
Thu, 5 Mar 2009 23:01:10 +0000 (23:01 +0000)
Break readline_show_prompt out of readline_start so that (re-)printing
the prompt can be controlled in a more fine-grained way.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6709 c046a42c-6fe2-441c-8c8c-71466251a162

console.h
monitor.c
readline.c

index 0c86852c4ed39919208cb369d9bfd0220eb8882b..f9f3fc73976fe394896d4e8a0db9d14ec5a6c46f 100644 (file)
--- a/console.h
+++ b/console.h
@@ -316,5 +316,6 @@ void readline_find_completion(const char *cmdline);
 const char *readline_get_history(unsigned int index);
 void readline_start(const char *prompt, int is_password,
                     ReadLineFunc *readline_func, void *opaque);
+void readline_show_prompt(void);
 
 #endif
index dd288899ad532e2ca29a6147022aad0806fe88d1..322cf1ae3a5f36144cd6bcee75431e2f86535625 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -2855,6 +2855,7 @@ void monitor_resume(void)
 static void monitor_start_input(void)
 {
     readline_start("(qemu) ", 0, monitor_handle_command1, NULL);
+    readline_show_prompt();
 }
 
 static void term_event(void *opaque, int event)
@@ -2913,6 +2914,7 @@ static void monitor_readline(const char *prompt, int is_password,
                              char *buf, int buf_size)
 {
     readline_start(prompt, is_password, monitor_readline_cb, NULL);
+    readline_show_prompt();
     monitor_readline_buf = buf;
     monitor_readline_buf_size = buf_size;
     monitor_readline_started = 1;
index 85728412e67d4b56f511b6ed3e2a5fbb02954418..5a089be898efbbb74348d0b44edb0569d6a8d5ff 100644 (file)
@@ -57,7 +57,7 @@ static int term_is_password;
 static char term_prompt[256];
 static void *term_readline_opaque;
 
-static void term_show_prompt2(void)
+void readline_show_prompt(void)
 {
     term_printf("%s", term_prompt);
     term_flush();
@@ -66,13 +66,6 @@ static void term_show_prompt2(void)
     term_esc_state = IS_NORM;
 }
 
-static void term_show_prompt(void)
-{
-    term_show_prompt2();
-    term_cmd_buf_index = 0;
-    term_cmd_buf_size = 0;
-}
-
 /* update the displayed command line */
 static void term_update(void)
 {
@@ -360,7 +353,7 @@ static void term_completion(void)
                 j = 0;
             }
         }
-        term_show_prompt2();
+        readline_show_prompt();
     }
 }
 
@@ -473,7 +466,8 @@ void readline_start(const char *prompt, int is_password,
     term_readline_func = readline_func;
     term_readline_opaque = opaque;
     term_is_password = is_password;
-    term_show_prompt();
+    term_cmd_buf_index = 0;
+    term_cmd_buf_size = 0;
 }
 
 const char *readline_get_history(unsigned int index)