summaryrefslogtreecommitdiff
path: root/common/command.c
diff options
context:
space:
mode:
authorDetlev Zundel <dzu@denx.de>2009-03-25 17:27:52 +0100
committerWolfgang Denk <wd@denx.de>2009-03-27 21:06:30 +0100
commit2dce551e10728f9e5655279f761f1d3cc0a8fe90 (patch)
tree981e2c3efa07a2058fa98b745243a230ba1f15e5 /common/command.c
parent4e325fbfa4dea04eceb6392e00807c40d214dc6f (diff)
downloadu-boot-imx-2dce551e10728f9e5655279f761f1d3cc0a8fe90.zip
u-boot-imx-2dce551e10728f9e5655279f761f1d3cc0a8fe90.tar.gz
u-boot-imx-2dce551e10728f9e5655279f761f1d3cc0a8fe90.tar.bz2
command.c: Expose the core of do_help as _do_help to the rest of u-boot.
Other commands implementing subcommands can reuse this code nicely. Signed-off-by: Detlev Zundel <dzu@denx.de> Signed-off-by: Andreas Pfefferle <ap@denx.de>
Diffstat (limited to 'common/command.c')
-rw-r--r--common/command.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/common/command.c b/common/command.c
index 3b9ccc9..c9a3f5b 100644
--- a/common/command.c
+++ b/common/command.c
@@ -1,5 +1,5 @@
/*
- * (C) Copyright 2000-2003
+ * (C) Copyright 2000-2009
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* See file CREDITS for list of people who contributed to this
@@ -233,20 +233,19 @@ U_BOOT_CMD(
* Use puts() instead of printf() to avoid printf buffer overflow
* for long help messages
*/
-int do_help (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+
+int _do_help (cmd_tbl_t *cmd_start, int cmd_items, cmd_tbl_t * cmdtp, int
+ flag, int argc, char *argv[])
{
int i;
int rcode = 0;
if (argc == 1) { /*show list of commands */
-
- int cmd_items = &__u_boot_cmd_end -
- &__u_boot_cmd_start; /* pointer arith! */
cmd_tbl_t *cmd_array[cmd_items];
int i, j, swaps;
/* Make array of commands from .uboot_cmd section */
- cmdtp = &__u_boot_cmd_start;
+ cmdtp = cmd_start;
for (i = 0; i < cmd_items; i++) {
cmd_array[i] = cmdtp++;
}
@@ -286,7 +285,7 @@ int do_help (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
* command help (long version)
*/
for (i = 1; i < argc; ++i) {
- if ((cmdtp = find_cmd (argv[i])) != NULL) {
+ if ((cmdtp = find_cmd_tbl (argv[i], cmd_start, cmd_items )) != NULL) {
#ifdef CONFIG_SYS_LONGHELP
/* found - print (long) help info */
puts (cmdtp->name);
@@ -313,6 +312,13 @@ int do_help (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
return rcode;
}
+int do_help (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+{
+ return _do_help(&__u_boot_cmd_start,
+ &__u_boot_cmd_end - &__u_boot_cmd_start,
+ cmdtp, flag, argc, argv);
+}
+
U_BOOT_CMD(
help, CONFIG_SYS_MAXARGS, 1, do_help,