From patchwork Fri Jul 20 19:40:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Collin Walling X-Patchwork-Id: 947156 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41XLrk4GyXz9s4s for ; Sat, 21 Jul 2018 05:42:45 +1000 (AEST) Received: from localhost ([::1]:49534 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fgbIY-0005y4-08 for incoming@patchwork.ozlabs.org; Fri, 20 Jul 2018 15:42:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46941) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fgbIA-0005xo-BX for qemu-devel@nongnu.org; Fri, 20 Jul 2018 15:42:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fgbI6-0003ra-Ei for qemu-devel@nongnu.org; Fri, 20 Jul 2018 15:42:18 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:43070) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fgbI6-0003r7-4d for qemu-devel@nongnu.org; Fri, 20 Jul 2018 15:42:14 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6KJcZNJ108881 for ; Fri, 20 Jul 2018 15:42:12 -0400 Received: from e14.ny.us.ibm.com (e14.ny.us.ibm.com [129.33.205.204]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kbjkbrcbf-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 20 Jul 2018 15:42:12 -0400 Received: from localhost by e14.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 20 Jul 2018 15:42:11 -0400 Received: from b01cxnp23032.gho.pok.ibm.com (9.57.198.27) by e14.ny.us.ibm.com (146.89.104.201) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 20 Jul 2018 15:42:09 -0400 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w6KJg8P110551644 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 20 Jul 2018 19:42:08 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7DD34B2067; Fri, 20 Jul 2018 15:41:56 -0400 (EDT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 67340B2066; Fri, 20 Jul 2018 15:41:56 -0400 (EDT) Received: from collin-ThinkPad-W541.pok.ibm.com (unknown [9.56.58.144]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Fri, 20 Jul 2018 15:41:56 -0400 (EDT) From: Collin Walling To: qemu-devel@nongnu.org Date: Fri, 20 Jul 2018 15:40:24 -0400 X-Mailer: git-send-email 2.7.4 X-TM-AS-GCONF: 00 x-cbid: 18072019-0052-0000-0000-000003116920 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009399; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000266; SDB=6.01063666; UDB=6.00546231; IPR=6.00841517; MB=3.00022234; MTD=3.00000008; XFM=3.00000015; UTC=2018-07-20 19:42:11 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18072019-0053-0000-0000-00005D6F2EC5 Message-Id: <1532115624-27568-1-git-send-email-walling@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-07-20_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807200217 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH v2] monitor: print message when using 'help' with an unknown command X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: stzi@linux.ibm.com, dgilbert@redhat.com, armbru@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" When typing 'help' followed by an unknown command, QEMU will not print anything to the command line to let the user know they typed a bad command. Let's fix this by printing a message to the monitor when this happens. For example: (qemu) help xyz unknown command: 'xyz' Reported-by: Stefan Zimmermann Signed-off-by: Collin Walling Reviewed-by: Dr. David Alan Gilbert --- monitor.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/monitor.c b/monitor.c index 7af1f18..deeb41c 100644 --- a/monitor.c +++ b/monitor.c @@ -1013,6 +1013,7 @@ static void help_cmd_dump(Monitor *mon, const mon_cmd_t *cmds, char **args, int nb_args, int arg_index) { const mon_cmd_t *cmd; + size_t i; /* No valid arg need to compare with, dump all in *cmds */ if (arg_index >= nb_args) { @@ -1034,9 +1035,15 @@ static void help_cmd_dump(Monitor *mon, const mon_cmd_t *cmds, } else { help_cmd_dump_one(mon, cmd, args, arg_index); } - break; + return; } } + + /* Command not found */ + monitor_printf(mon, "unknown command: '"); + for (i = 0; i <= arg_index; i++) { + monitor_printf(mon, "%s%s", args[i], i == arg_index ? "'\n" : " "); + } } static void help_cmd(Monitor *mon, const char *name)