From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Li8u6-0008Lj-U5 for qemu-devel@nongnu.org; Fri, 13 Mar 2009 11:02:31 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Li8u6-0008Kh-67 for qemu-devel@nongnu.org; Fri, 13 Mar 2009 11:02:30 -0400 Received: from [199.232.76.173] (port=40770 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Li8u6-0008KQ-1O for qemu-devel@nongnu.org; Fri, 13 Mar 2009 11:02:30 -0400 Received: from savannah.gnu.org ([199.232.41.3]:33010 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Li8u5-0007nk-JR for qemu-devel@nongnu.org; Fri, 13 Mar 2009 11:02:29 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Li8u4-0008A8-TF for qemu-devel@nongnu.org; Fri, 13 Mar 2009 15:02:28 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.69) (envelope-from ) id 1Li8u4-0008A4-MR for qemu-devel@nongnu.org; Fri, 13 Mar 2009 15:02:28 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Fri, 13 Mar 2009 15:02:28 +0000 Subject: [Qemu-devel] [6842] monitor: Provide empty command as final history entry (Jan Kiszka) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 Signed-off-by: Anthony Liguori 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);