From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54537) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WG8pq-0000pE-8U for qemu-devel@nongnu.org; Wed, 19 Feb 2014 10:13:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WG8pk-0002iZ-9m for qemu-devel@nongnu.org; Wed, 19 Feb 2014 10:13:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:30651) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WG8pk-0002iV-1x for qemu-devel@nongnu.org; Wed, 19 Feb 2014 10:13:12 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1JFDBQK016493 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 19 Feb 2014 10:13:11 -0500 From: Kevin Wolf Date: Wed, 19 Feb 2014 16:12:58 +0100 Message-Id: <1392822778-4823-8-git-send-email-kwolf@redhat.com> In-Reply-To: <1392822778-4823-1-git-send-email-kwolf@redhat.com> References: <1392822778-4823-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 7/7] qemu-img amend: Support multiple -o options List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, mreitz@redhat.com Multiple -o options has the same meaning as having a single option with all settings in the order of their respective -o options. Signed-off-by: Kevin Wolf --- qemu-img.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index e0d19f8..1a98926 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -2783,18 +2783,16 @@ static int img_amend(int argc, char **argv) if (is_help_option(optarg)) { options_help = true; } else if (!options) { - options = optarg; + options = g_strdup(optarg); } else { - error_report("-o cannot be used multiple times. Please use a " - "single -o option with comma-separated settings " - "instead."); - return 1; + options = g_strdup_printf("%s,%s", options, optarg); } break; case 'f': if (fmt) { error_report("-f may only be specified once"); - return 1; + ret = -1; + goto out; } fmt = optarg; break; @@ -2850,6 +2848,8 @@ out: } free_option_parameters(create_options); free_option_parameters(options_param); + g_free(options); + if (ret) { return 1; } -- 1.8.1.4