From patchwork Wed May 29 13:50:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 247395 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 315112C034F for ; Thu, 30 May 2013 06:12:09 +1000 (EST) Received: from localhost ([::1]:51098 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uhmj9-0008QC-AD for incoming@patchwork.ozlabs.org; Wed, 29 May 2013 16:12:07 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhgnF-0001bV-IU for qemu-devel@nongnu.org; Wed, 29 May 2013 09:51:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UhgnE-000794-6m for qemu-devel@nongnu.org; Wed, 29 May 2013 09:51:57 -0400 Received: from smtprelay01.ispgateway.de ([80.67.31.24]:33230) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhgnD-00078v-TX for qemu-devel@nongnu.org; Wed, 29 May 2013 09:51:56 -0400 Received: from [217.84.5.141] (helo=stokes.schwinge.homeip.net) by smtprelay01.ispgateway.de with esmtpa (Exim 4.68) (envelope-from ) id 1UhgmZ-0003fF-FJ for qemu-devel@nongnu.org; Wed, 29 May 2013 15:51:15 +0200 Received: (qmail 5332 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 28195 invoked by uid 1000); Wed, 29 May 2013 13:50:50 -0000 From: Thomas Schwinge To: qemu-devel@nongnu.org Date: Wed, 29 May 2013 15:50:32 +0200 Message-Id: <1369835434-27727-3-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.31.24 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 2/4] linux-user: Use existing envlist_parse_set/envlist_parse_unset interface. 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 Signed-off-by: Thomas Schwinge --- linux-user/main.c | 18 ++++-------------- util/envlist.c | 4 ++-- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git linux-user/main.c linux-user/main.c index b97b8cf..a0ea161 100644 --- linux-user/main.c +++ linux-user/main.c @@ -3204,26 +3204,16 @@ static void handle_arg_log_filename(const char *arg) static void handle_arg_set_env(const char *arg) { - char *r, *p, *token; - r = p = strdup(arg); - while ((token = strsep(&p, ",")) != NULL) { - if (envlist_setenv(envlist, token) != 0) { - usage(); - } + if (envlist_parse_set(envlist, arg) != 0) { + usage(); } - free(r); } static void handle_arg_unset_env(const char *arg) { - char *r, *p, *token; - r = p = strdup(arg); - while ((token = strsep(&p, ",")) != NULL) { - if (envlist_unsetenv(envlist, token) != 0) { - usage(); - } + if (envlist_parse_unset(envlist, arg) != 0) { + usage(); } - free(r); } static void handle_arg_argv0(const char *arg) diff --git util/envlist.c util/envlist.c index cbbf7e5..8027bbf 100644 --- util/envlist.c +++ util/envlist.c @@ -55,10 +55,10 @@ envlist_free(envlist_t *envlist) /* * Parses comma separated list of set/modify environment - * variable entries and updates given enlist accordingly. + * variable entries and updates given envlist accordingly. * * For example: - * envlist_parse(el, "HOME=foo,SHELL=/bin/sh"); + * envlist_parse_set(el, "HOME=foo,SHELL=/bin/sh"); * * inserts/sets environment variables HOME and SHELL. *