2007-10-19 09:28:58 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2000-2003
|
|
|
|
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
|
|
*
|
|
|
|
* 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 as
|
|
|
|
* published by the Free Software Foundation; either version 2 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <command.h>
|
|
|
|
#include <malloc.h>
|
|
|
|
#include <xfuncs.h>
|
|
|
|
#include <environment.h>
|
|
|
|
|
2011-12-21 13:18:57 +00:00
|
|
|
static int do_readline(int argc, char *argv[])
|
2007-10-19 09:28:58 +00:00
|
|
|
{
|
|
|
|
char *buf = xzalloc(CONFIG_CBSIZE);
|
|
|
|
|
2009-10-17 10:44:19 +00:00
|
|
|
if (argc < 3)
|
|
|
|
return COMMAND_ERROR_USAGE;
|
2007-10-19 09:28:58 +00:00
|
|
|
|
|
|
|
if (readline(argv[1], buf, CONFIG_CBSIZE) < 0) {
|
|
|
|
free(buf);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
setenv(argv[2], buf);
|
|
|
|
free(buf);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-04-04 09:46:55 +00:00
|
|
|
static const __maybe_unused char cmd_readline_help[] =
|
2007-10-19 09:28:58 +00:00
|
|
|
"Usage: readline <prompt> VAR\n"
|
|
|
|
"readline reads a line of user input into variable VAR.\n";
|
|
|
|
|
2009-12-15 08:11:09 +00:00
|
|
|
BAREBOX_CMD_START(readline)
|
2007-10-19 09:28:58 +00:00
|
|
|
.cmd = do_readline,
|
|
|
|
.usage = "prompt for user input",
|
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_SCRIPT)
|
2009-12-15 08:11:09 +00:00
|
|
|
BAREBOX_CMD_HELP(cmd_readline_help)
|
|
|
|
BAREBOX_CMD_END
|
2007-10-19 09:28:58 +00:00
|
|
|
|