From patchwork Wed May 29 13:50:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 247396 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0B4962C02A4 for ; Thu, 30 May 2013 06:13:49 +1000 (EST) Received: from localhost ([::1]:57148 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uhmkl-0003So-7i for incoming@patchwork.ozlabs.org; Wed, 29 May 2013 16:13:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37277) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhgnA-0001af-9W for qemu-devel@nongnu.org; Wed, 29 May 2013 09:51:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uhgn8-00077g-Vu for qemu-devel@nongnu.org; Wed, 29 May 2013 09:51:52 -0400 Received: from smtprelay01.ispgateway.de ([80.67.18.13]:40145) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uhgn8-00077W-MZ for qemu-devel@nongnu.org; Wed, 29 May 2013 09:51:50 -0400 Received: from [217.84.5.141] (helo=stokes.schwinge.homeip.net) by smtprelay01.ispgateway.de with esmtpa (Exim 4.68) (envelope-from ) id 1UhgmX-0003fF-Re for qemu-devel@nongnu.org; Wed, 29 May 2013 15:51:14 +0200 Received: (qmail 5306 invoked from network); 29 May 2013 13:50:59 -0000 Received: from feldtkeller.schwinge.homeip.net (192.168.111.172) by stokes.schwinge.homeip.net with QMQP; 29 May 2013 13:50:59 -0000 Received: (nullmailer pid 28199 invoked by uid 1000); Wed, 29 May 2013 13:50:51 -0000 From: Thomas Schwinge To: qemu-devel@nongnu.org Date: Wed, 29 May 2013 15:50:34 +0200 Message-Id: <1369835434-27727-5-git-send-email-thomas@codesourcery.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1369835434-27727-1-git-send-email-thomas@codesourcery.com> References: <1369835434-27727-1-git-send-email-thomas@codesourcery.com> X-Df-Sender: dGhvbWFzQHNjaHdpbmdlLm5hbWU= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 80.67.18.13 X-Mailman-Approved-At: Wed, 29 May 2013 16:11:28 -0400 Cc: peter.maydell@linaro.org, aliguori@us.ibm.com, sw@weilnetz.de, riku.voipio@iki.fi, agraf@suse.de, paul@codesourcery.com, j.schauer@email.de, Thomas Schwinge Subject: [Qemu-devel] [PATCH 4/4] linux-user: Restore original behavior of the -E and -U command-line options. 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 Revert the change in behavior that had been introducecd in commit fc9c54124d134dbd76338a92a91804dab2df8166 for the -E and -U command-line options, but keep the comma-splitting for the QEMU_SET_ENV and QEMU_UNSET_ENV environment variables. Signed-off-by: Thomas Schwinge --- linux-user/main.c | 51 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git linux-user/main.c linux-user/main.c index b7d49f4..874791b 100644 --- linux-user/main.c +++ linux-user/main.c @@ -3209,15 +3209,37 @@ static void handle_arg_log_filename(arg_origin whence, const char *arg) static void handle_arg_set_env(arg_origin whence, const char *arg) { - if (envlist_parse_set(envlist, arg) != 0) { - usage(); + switch (whence) { + case ARG_ORIGIN_ENV: + if (envlist_parse_set(envlist, arg) != 0) { + usage(); + } + break; + case ARG_ORIGIN_CMDLINE: + if (envlist_setenv(envlist, arg) != 0) { + usage(); + } + break; + default: + abort(); } } static void handle_arg_unset_env(arg_origin whence, const char *arg) { - if (envlist_parse_unset(envlist, arg) != 0) { - usage(); + switch (whence) { + case ARG_ORIGIN_ENV: + if (envlist_parse_unset(envlist, arg) != 0) { + usage(); + } + break; + case ARG_ORIGIN_CMDLINE: + if (envlist_unsetenv(envlist, arg) != 0) { + usage(); + } + break; + default: + abort(); } } @@ -3443,18 +3465,15 @@ static void usage(void) guest_stack_size); printf("\n" - "You can use -E and -U options or the QEMU_SET_ENV and\n" - "QEMU_UNSET_ENV environment variables to set and unset\n" - "environment variables for the target process.\n" - "It is possible to provide several variables by separating them\n" - "by commas in getsubopt(3) style. Additionally it is possible to\n" - "provide the -E and -U options multiple times.\n" - "The following lines are equivalent:\n" - " -E var1=val2 -E var2=val2 -U LD_PRELOAD -U LD_DEBUG\n" - " -E var1=val2,var2=val2 -U LD_PRELOAD,LD_DEBUG\n" - " QEMU_SET_ENV=var1=val2,var2=val2 QEMU_UNSET_ENV=LD_PRELOAD,LD_DEBUG\n" - "Note that if you provide several changes to a single variable\n" - "the last change will stay in effect.\n"); +"The -E and -U command-line options can be provided multiple times to set\n" +"and unset environment variables for the target process, and -E can be used\n" +"to specify values containing commas. When using the QEMU_SET_ENV and\n" +"QEMU_UNSET_ENV environment variables, a comma is used in getsubopt(3) style\n" +"to set or unset several variables. The following lines are equivalent:\n" +" -E var1=val2 -E var2=val2 -U LD_PRELOAD -U LD_DEBUG\n" +" QEMU_SET_ENV=var1=val2,var2=val2 QEMU_UNSET_ENV=LD_PRELOAD,LD_DEBUG\n" +"Note that if you provide several changes to a single variable, the last\n" +"change will stay in effect.\n"); exit(1); }