diff options
Diffstat (limited to 'commands/nv.c')
-rw-r--r-- | commands/nv.c | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/commands/nv.c b/commands/nv.c index 01c25a108f..c60bb41677 100644 --- a/commands/nv.c +++ b/commands/nv.c @@ -1,21 +1,8 @@ -/* - * nv.c - non volatile shell variables - * - * Copyright (c) 2014 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: © 2014 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix + +/* nv.c - non volatile shell variables */ + #include <common.h> #include <malloc.h> #include <command.h> @@ -50,6 +37,11 @@ static int do_nv(int argc, char *argv[]) } if (do_save) { + if (!IS_ENABLED(CONFIG_ENV_HANDLING)) { + printf("Error: Current configuration does not support saving variables\n"); + return COMMAND_ERROR; + } + return nvvar_save(); } @@ -63,11 +55,8 @@ static int do_nv(int argc, char *argv[]) for (i = 0; i < argc; i++) { int ret; - value = strchr(argv[0], '='); - if (value) { - *value = 0; - value++; - } + + value = parse_assignment(argv[i]) ?: ""; if (do_remove) { ret = nvvar_remove(argv[i]); |