From patchwork Mon Oct 2 15:25:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 820577 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=gnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@gnu.org; receiver=) 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 3y5RBw6dwWz9t6s for ; Tue, 3 Oct 2017 02:38:16 +1100 (AEDT) Received: from localhost ([::1]:52870 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz2nO-0000ns-Tb for incoming@patchwork.ozlabs.org; Mon, 02 Oct 2017 11:38:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38819) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz2be-0007zA-FC for qemu-devel@nongnu.org; Mon, 02 Oct 2017 11:26:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dz2bc-0007yD-1c for qemu-devel@nongnu.org; Mon, 02 Oct 2017 11:26:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56122) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dz2bb-0007we-PO for qemu-devel@nongnu.org; Mon, 02 Oct 2017 11:26:03 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A6A49C0587F7; Mon, 2 Oct 2017 15:26:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A6A49C0587F7 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=armbru@redhat.com Received: from blackfin.pond.sub.org (ovpn-116-91.ams2.redhat.com [10.36.116.91]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 50E8D6FDAC; Mon, 2 Oct 2017 15:26:02 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id D88F611562F0; Mon, 2 Oct 2017 17:25:52 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 17:25:49 +0200 Message-Id: <20171002152552.27999-30-armbru@redhat.com> In-Reply-To: <20171002152552.27999-1-armbru@redhat.com> References: <20171002152552.27999-1-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 02 Oct 2017 15:26:02 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC PATCH 29/32] qapi/options: QAPIfy --echr argument type X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marcandre.lureau@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@gnu.org Sender: "Qemu-devel" Bonus: more rigorous error checking. Crap like '-echar 666' and '-echar 0x' are now rejected. FIXME the error messages are crap: qemu-system-x86_64: -echr 666: Parameter 'null' expects int8_t qemu-system-x86_64: -echr 0x: Parameter '' expects integer Signed-off-by: Markus Armbruster --- qapi/options.json | 2 +- vl.c | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/qapi/options.json b/qapi/options.json index 5a8fdc04ad..853908560d 100644 --- a/qapi/options.json +++ b/qapi/options.json @@ -3892,7 +3892,7 @@ # !end texinfo ## { 'option': '--echr', - 'data': 'str', # FIXME int + 'data': 'int8', 'help': "-echr chr set terminal escape character instead of ctrl-a" } ## diff --git a/vl.c b/vl.c index b9524f7e11..4af2905c60 100644 --- a/vl.c +++ b/vl.c @@ -3574,14 +3574,8 @@ int main(int argc, char **argv, char **envp) } break; case QAPI_OPTION_KIND_ECHR: - { - char *r; - term_escape_char = strtol(qopt[i].u.echr.data, &r, 0); - if (r == qopt[i].u.echr.data) { - printf("Bad argument to echr\n"); - } - break; - } + term_escape_char = qopt[i].u.echr.data; + break; case QAPI_OPTION_KIND_MONITOR: default_monitor = 0; if (strncmp(qopt[i].u.monitor.data, "none", 4)) {