From: Thomas Schwinge <thomas@codesourcery.com>
To: qemu-devel@nongnu.org
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 <thomas@codesourcery.com>
Subject: [Qemu-devel] [PATCH 2/4] linux-user: Use existing envlist_parse_set/envlist_parse_unset interface.
Date: Wed, 29 May 2013 15:50:32 +0200 [thread overview]
Message-ID: <1369835434-27727-3-git-send-email-thomas@codesourcery.com> (raw)
In-Reply-To: <1369835434-27727-1-git-send-email-thomas@codesourcery.com>
Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
---
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.
*
--
1.7.10.4
next prev parent reply other threads:[~2013-05-29 13:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-29 13:50 [Qemu-devel] [PATCH, resend] linux-user: environment variables Thomas Schwinge
2013-05-29 13:50 ` [Qemu-devel] [PATCH 1/4] util/envlist: Properly forward a callback's error in envlist_parse Thomas Schwinge
2013-06-27 17:36 ` Peter Maydell
2013-05-29 13:50 ` Thomas Schwinge [this message]
2013-06-27 17:49 ` [Qemu-devel] [PATCH 2/4] linux-user: Use existing envlist_parse_set/envlist_parse_unset interface Peter Maydell
2013-05-29 13:50 ` [Qemu-devel] [PATCH 3/4] linux-user: Tell handler_arg_* which context they're invoked from Thomas Schwinge
2013-05-29 13:50 ` [Qemu-devel] [PATCH 4/4] linux-user: Restore original behavior of the -E and -U command-line options Thomas Schwinge
2013-06-14 1:08 ` Alexander Graf
2013-06-27 17:54 ` Peter Maydell
2013-06-07 15:44 ` [Qemu-devel] [PATCH, resend] linux-user: environment variables Thomas Schwinge
-- strict thread matches above, loose matches on Subject: below --
2013-04-25 12:22 [Qemu-devel] Environment variables for user-mode QEMU Riku Voipio
2013-04-24 16:11 ` Thomas Schwinge
2013-04-25 15:06 ` [Qemu-devel] [PATCH 1/4] util/envlist: Properly forward a callback's error in envlist_parse Thomas Schwinge
2013-04-25 15:06 ` [Qemu-devel] [PATCH 2/4] linux-user: Use existing envlist_parse_set/envlist_parse_unset interface Thomas Schwinge
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1369835434-27727-3-git-send-email-thomas@codesourcery.com \
--to=thomas@codesourcery.com \
--cc=agraf@suse.de \
--cc=aliguori@us.ibm.com \
--cc=j.schauer@email.de \
--cc=paul@codesourcery.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
--cc=sw@weilnetz.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).