From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50759) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVNpt-0005Qi-Ly for qemu-devel@nongnu.org; Thu, 25 Apr 2013 11:11:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVNpq-0006qE-HD for qemu-devel@nongnu.org; Thu, 25 Apr 2013 11:11:49 -0400 Received: from smtprelay05.ispgateway.de ([80.67.31.93]:40423) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVNpq-0006pW-7a for qemu-devel@nongnu.org; Thu, 25 Apr 2013 11:11:46 -0400 Received: from [217.84.9.72] (helo=stokes.schwinge.homeip.net) by smtprelay05.ispgateway.de with esmtpa (Exim 4.68) (envelope-from ) id 1UVNlV-000072-Mj for qemu-devel@nongnu.org; Thu, 25 Apr 2013 17:07:17 +0200 From: Thomas Schwinge Date: Thu, 25 Apr 2013 17:06:43 +0200 Message-Id: <1366902405-19117-2-git-send-email-thomas@codesourcery.com> In-Reply-To: <1366902405-19117-1-git-send-email-thomas@codesourcery.com> References: <20130425122252.GA4850@afflict.kos.to> <87k3nrq56l.fsf@schwinge.name> <1366902405-19117-1-git-send-email-thomas@codesourcery.com> Subject: [Qemu-devel] [PATCH 2/4] linux-user: Use existing envlist_parse_set/envlist_parse_unset interface. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: riku.voipio@iki.fi Cc: peter.maydell@linaro.org, aliguori@us.ibm.com, sw@weilnetz.de, agraf@suse.de, qemu-devel@nongnu.org, paul@codesourcery.com, j.schauer@email.de, Thomas Schwinge 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 4e92a0b..7f81821 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. * -- 1.7.10.4