From patchwork Fri Jun 7 11:58:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 249669 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B22EB2C007A for ; Fri, 7 Jun 2013 21:59:33 +1000 (EST) Received: from localhost ([::1]:35892 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkvKN-0000jl-F8 for incoming@patchwork.ozlabs.org; Fri, 07 Jun 2013 07:59:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkvJq-0000hH-8n for qemu-devel@nongnu.org; Fri, 07 Jun 2013 07:59:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UkvJn-0004D0-1N for qemu-devel@nongnu.org; Fri, 07 Jun 2013 07:58:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27884) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkvJm-0004Cq-Q2 for qemu-devel@nongnu.org; Fri, 07 Jun 2013 07:58:54 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r57BwsXC001442 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 7 Jun 2013 07:58:54 -0400 Received: from localhost (ovpn-112-30.ams2.redhat.com [10.36.112.30]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r57BwqKX024550; Fri, 7 Jun 2013 07:58:53 -0400 From: Stefan Hajnoczi To: Date: Fri, 7 Jun 2013 13:58:21 +0200 Message-Id: <1370606325-10680-3-git-send-email-stefanha@redhat.com> In-Reply-To: <1370606325-10680-1-git-send-email-stefanha@redhat.com> References: <1370606325-10680-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Anthony Liguori , Stefan Hajnoczi Subject: [Qemu-devel] [PULL 02/26] qemu-io: Remove unused args_command X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Kevin Wolf The original intention seems to be something with handling multiple images at once, but this has never been implemented and the only function ever registered is implemented to make everything behave like a "global" command. Just do that unconditionally now. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Signed-off-by: Stefan Hajnoczi --- cmd.c | 28 ++-------------------------- cmd.h | 2 -- qemu-io.c | 10 ---------- 3 files changed, 2 insertions(+), 38 deletions(-) diff --git a/cmd.c b/cmd.c index 10a8688..4e7579b 100644 --- a/cmd.c +++ b/cmd.c @@ -34,7 +34,6 @@ cmdinfo_t *cmdtab; int ncmds; -static argsfunc_t args_func; static checkfunc_t check_func; static int ncmdline; static char **cmdline; @@ -127,22 +126,6 @@ void add_user_command(char *optarg) cmdline[ncmdline-1] = optarg; } -static int -args_command( - int index) -{ - if (args_func) - return args_func(index); - return 0; -} - -void -add_args_command( - argsfunc_t af) -{ - args_func = af; -} - static void prep_fetchline(void *opaque) { int *fetchable = opaque; @@ -155,7 +138,7 @@ static char *get_prompt(void); void command_loop(void) { - int c, i, j = 0, done = 0, fetchable = 0, prompted = 0; + int c, i, done = 0, fetchable = 0, prompted = 0; char *input; char **v; const cmdinfo_t *ct; @@ -171,14 +154,7 @@ void command_loop(void) if (c) { ct = find_command(v[0]); if (ct) { - if (ct->flags & CMD_FLAG_GLOBAL) { - done = command(ct, c, v); - } else { - j = 0; - while (!done && (j = args_command(j))) { - done = command(ct, c, v); - } - } + done = command(ct, c, v); } else { fprintf(stderr, _("command \"%s\" not found\n"), v[0]); } diff --git a/cmd.h b/cmd.h index b763b19..8e6f753 100644 --- a/cmd.h +++ b/cmd.h @@ -41,12 +41,10 @@ extern int ncmds; void help_init(void); void quit_init(void); -typedef int (*argsfunc_t)(int index); typedef int (*checkfunc_t)(const cmdinfo_t *ci); void add_command(const cmdinfo_t *ci); void add_user_command(char *optarg); -void add_args_command(argsfunc_t af); void add_check_command(checkfunc_t cf); const cmdinfo_t *find_command(const char *cmd); diff --git a/qemu-io.c b/qemu-io.c index 5e6680b..4288b8c 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -1888,15 +1888,6 @@ static int open_f(int argc, char **argv) return openfile(argv[optind], flags, growable); } -static int init_args_command(int index) -{ - /* only one device allowed so far */ - if (index >= 1) { - return 0; - } - return ++index; -} - static int init_check_command(const cmdinfo_t *ct) { if (ct->flags & CMD_FLAG_GLOBAL) { @@ -2043,7 +2034,6 @@ int main(int argc, char **argv) add_command(&wait_break_cmd); add_command(&abort_cmd); - add_args_command(init_args_command); add_check_command(init_check_command); /* open the device */