[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/4] linux-user: Use existing envlist_parse_set/envl
From: |
Thomas Schwinge |
Subject: |
[Qemu-devel] [PATCH 2/4] linux-user: Use existing envlist_parse_set/envlist_parse_unset interface. |
Date: |
Thu, 25 Apr 2013 17:06:43 +0200 |
Signed-off-by: Thomas Schwinge <address@hidden>
---
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
- [Qemu-devel] Environment variables for user-mode QEMU, Thomas Schwinge, 2013/04/24
- Re: [Qemu-devel] Environment variables for user-mode QEMU, Thomas Schwinge, 2013/04/24
- [Qemu-devel] [PATCH 1/4] util/envlist: Properly forward a callback's error in envlist_parse., Thomas Schwinge, 2013/04/25
- [Qemu-devel] [PATCH 2/4] linux-user: Use existing envlist_parse_set/envlist_parse_unset interface.,
Thomas Schwinge <=
- [Qemu-devel] [PATCH 4/4] linux-user: Restore original behavior of the -E and -U command-line options., Thomas Schwinge, 2013/04/25
- Re: [Qemu-devel] [PATCH 4/4] linux-user: Restore original behavior of the -E and -U command-line options., Peter Maydell, 2013/04/25
- Re: [Qemu-devel] [PATCH 4/4] linux-user: Restore original behavior of the -E and -U command-line options., Thomas Schwinge, 2013/04/25
- Re: [Qemu-devel] [PATCH 4/4] linux-user: Restore original behavior of the -E and -U command-line options., Peter Maydell, 2013/04/25
- [Qemu-devel] [PATCH] qemu-doc: Option -ignore-environment removed., Thomas Schwinge, 2013/04/26
- Re: [Qemu-devel] [PATCH] qemu-doc: Option -ignore-environment removed., Peter Maydell, 2013/04/25
- Re: [Qemu-devel] [PATCH] qemu-doc: Option -ignore-environment removed., Stefan Hajnoczi, 2013/04/26
- [Qemu-devel] [PATCH v2] linux-user: Restore original behavior of the -E and -U command-line options., Thomas Schwinge, 2013/04/26
- [Qemu-devel] [PATCH 3/4] linux-user: Tell handler_arg_* which context they're invoked from., Thomas Schwinge, 2013/04/25