2007-11-09 21:09:25 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2007 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief setenv: Set an environment variables
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <command.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <environment.h>
|
|
|
|
|
2011-12-21 13:18:57 +00:00
|
|
|
static int do_setenv(int argc, char *argv[])
|
2007-11-09 21:09:25 +00:00
|
|
|
{
|
2009-10-17 10:44:19 +00:00
|
|
|
if (argc < 2)
|
|
|
|
return COMMAND_ERROR_USAGE;
|
2007-11-09 21:09:25 +00:00
|
|
|
|
|
|
|
setenv(argv[1], argv[2]);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-11-01 17:04:04 +00:00
|
|
|
BAREBOX_CMD_HELP_START(setenv)
|
|
|
|
BAREBOX_CMD_HELP_USAGE("setenv <name> [<value>]\n")
|
|
|
|
BAREBOX_CMD_HELP_SHORT("Set environment variable to a value or delete if value is avoided.\n")
|
|
|
|
BAREBOX_CMD_HELP_END
|
2008-04-04 09:46:55 +00:00
|
|
|
|
2010-11-01 17:04:04 +00:00
|
|
|
/**
|
|
|
|
* @page setenv_command
|
|
|
|
|
|
|
|
<p> This command is only available if the simple command line parser is
|
|
|
|
in use. Within the hush shell, \c setenv is not required.</p>
|
|
|
|
|
|
|
|
\todo Check if kconfig does this correctly.
|
|
|
|
|
|
|
|
*/
|
2008-04-04 09:46:55 +00:00
|
|
|
|
2009-12-15 08:11:09 +00:00
|
|
|
BAREBOX_CMD_START(setenv)
|
2007-11-09 21:09:25 +00:00
|
|
|
.cmd = do_setenv,
|
|
|
|
.usage = "set environment variables",
|
commands: group 'help' output
The old output of "help" was just producing a long list, that usually
scrolled of the screen (even on a X11 terminal). This list is more
compact, and also sorted by groups.
The old output format (plus grouping) is now available with 'help -v'.
Example:
Information commands:
?, devinfo, help, iomem, meminfo, version
Boot commands:
boot, bootm, go, loadb, loads, loadx, loady, saves, uimage
...
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 14:14:05 +00:00
|
|
|
BAREBOX_CMD_GROUP(CMD_GRP_ENV)
|
2009-12-15 08:11:09 +00:00
|
|
|
BAREBOX_CMD_HELP(cmd_setenv_help)
|
|
|
|
BAREBOX_CMD_END
|