summaryrefslogtreecommitdiffstats
path: root/commands/global.c
diff options
context:
space:
mode:
Diffstat (limited to 'commands/global.c')
-rw-r--r--commands/global.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/commands/global.c b/commands/global.c
index c66bf6e539..a8ff5ea18f 100644
--- a/commands/global.c
+++ b/commands/global.c
@@ -1,21 +1,8 @@
-/*
- * global.c - global shell variables
- *
- * Copyright (c) 2012 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
+// SPDX-License-Identifier: GPL-2.0-only
+// SPDX-FileCopyrightText: © 2012 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
+
+/* global.c - global shell variables */
+
#include <common.h>
#include <malloc.h>
#include <command.h>
@@ -50,11 +37,7 @@ static int do_global(int argc, char *argv[])
return COMMAND_ERROR_USAGE;
for (i = 0; i < argc; i++) {
- value = strchr(argv[i], '=');
- if (value) {
- *value = 0;
- value++;
- }
+ value = parse_assignment(argv[i]);
if (do_remove)
globalvar_remove(argv[i]);
@@ -67,6 +50,7 @@ static int do_global(int argc, char *argv[])
BAREBOX_CMD_HELP_START(global)
BAREBOX_CMD_HELP_TEXT("Add a new global variable named VAR, optionally set to VALUE.")
+BAREBOX_CMD_HELP_TEXT("Without options, print all global and env (prefixed with *) variables.")
BAREBOX_CMD_HELP_TEXT("")
BAREBOX_CMD_HELP_TEXT("Options:")
BAREBOX_CMD_HELP_OPT("-r", "Remove globalvars")
@@ -75,7 +59,7 @@ BAREBOX_CMD_HELP_END
BAREBOX_CMD_START(global)
.cmd = do_global,
BAREBOX_CMD_DESC("create or set global variables")
- BAREBOX_CMD_OPTS("[-r] VAR[=VALUE] ...")
+ BAREBOX_CMD_OPTS("[-r] [VAR[=VALUE] ...]")
BAREBOX_CMD_GROUP(CMD_GRP_ENV)
BAREBOX_CMD_HELP(cmd_global_help)
BAREBOX_CMD_COMPLETE(global_complete)