qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [6842] monitor: Provide empty command as final history entry (Jan Kiszka)
@ 2009-03-13 15:02 Anthony Liguori
  0 siblings, 0 replies; only message in thread
From: Anthony Liguori @ 2009-03-13 15:02 UTC (permalink / raw)
  To: qemu-devel

Revision: 6842
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6842
Author:   aliguori
Date:     2009-03-13 15:02:28 +0000 (Fri, 13 Mar 2009)
Log Message:
-----------
monitor: Provide empty command as final history entry (Jan Kiszka)

Provide an empty line as last entry in command line history, just like
bash e.g. does.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

Modified Paths:
--------------
    trunk/readline.c

Modified: trunk/readline.c
===================================================================
--- trunk/readline.c	2009-03-13 15:02:23 UTC (rev 6841)
+++ trunk/readline.c	2009-03-13 15:02:28 UTC (rev 6842)
@@ -196,12 +196,14 @@
 
 static void readline_down_char(ReadLineState *rs)
 {
-    if (rs->hist_entry == READLINE_MAX_CMDS - 1 || rs->hist_entry == -1)
-	return;
-    if (rs->history[++rs->hist_entry] != NULL) {
+    if (rs->hist_entry == -1)
+        return;
+    if (rs->hist_entry < READLINE_MAX_CMDS - 1 &&
+        rs->history[++rs->hist_entry] != NULL) {
 	pstrcpy(rs->cmd_buf, sizeof(rs->cmd_buf),
                 rs->history[rs->hist_entry]);
     } else {
+        rs->cmd_buf[0] = 0;
 	rs->hist_entry = -1;
     }
     rs->cmd_buf_index = rs->cmd_buf_size = strlen(rs->cmd_buf);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-03-13 15:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-13 15:02 [Qemu-devel] [6842] monitor: Provide empty command as final history entry (Jan Kiszka) Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).