diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-08-14 21:16:21 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-08-16 08:40:33 +0200 |
commit | 016082f85e30d1bc24c3c9713476e5e8d8584668 (patch) | |
tree | 4ce0191421d7ca78d74f5a6da77051e6ca57130e /commands | |
parent | ba3b39d5f0f5523b6895308d35874726009647fa (diff) | |
download | barebox-016082f85e30d1bc24c3c9713476e5e8d8584668.tar.gz barebox-016082f85e30d1bc24c3c9713476e5e8d8584668.tar.xz |
globalvar: Allow to set initial value
Calling globalvar_add_simple() and setting a value is more than common.
Add a parameter for the initial value.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r-- | commands/bootm.c | 6 | ||||
-rw-r--r-- | commands/global.c | 17 |
2 files changed, 4 insertions, 19 deletions
diff --git a/commands/bootm.c b/commands/bootm.c index 97a6698b9b..eefcae3a74 100644 --- a/commands/bootm.c +++ b/commands/bootm.c @@ -164,10 +164,10 @@ err_out: static int bootm_init(void) { - globalvar_add_simple("bootm.image"); - globalvar_add_simple("bootm.oftree"); + globalvar_add_simple("bootm.image", NULL); + globalvar_add_simple("bootm.oftree", NULL); if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD)) - globalvar_add_simple("bootm.initrd"); + globalvar_add_simple("bootm.initrd", NULL); return 0; } diff --git a/commands/global.c b/commands/global.c index 427a231a9e..c526e6571a 100644 --- a/commands/global.c +++ b/commands/global.c @@ -23,21 +23,6 @@ #include <environment.h> #include <getopt.h> -static int globalvar_set(char* name, char* value) -{ - int ret; - - ret = globalvar_add_simple(name); - - if (value) { - char *tmp = asprintf("global.%s", name); - ret = setenv(tmp, value); - free(tmp); - } - - return ret ? 1 : 0; -} - static int do_global(int argc, char *argv[]) { int opt; @@ -72,7 +57,7 @@ static int do_global(int argc, char *argv[]) return 0; } - return globalvar_set(argv[0], value); + return globalvar_add_simple(argv[0], value); } BAREBOX_CMD_HELP_START(global) |