Peter Tyser | 6b8f5ad | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2000-2009 |
| 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Peter Tyser | 6b8f5ad | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <command.h> |
| 10 | |
Kim Phillips | 088f1b1 | 2012-10-29 13:34:31 +0000 | [diff] [blame] | 11 | static int do_help(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
Peter Tyser | 6b8f5ad | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 12 | { |
Marek Vasut | 6c7c946 | 2012-10-12 10:27:04 +0000 | [diff] [blame] | 13 | cmd_tbl_t *start = ll_entry_start(cmd_tbl_t, cmd); |
| 14 | const int len = ll_entry_count(cmd_tbl_t, cmd); |
| 15 | return _do_help(start, len, cmdtp, flag, argc, argv); |
Peter Tyser | 6b8f5ad | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 16 | } |
| 17 | |
| 18 | U_BOOT_CMD( |
| 19 | help, CONFIG_SYS_MAXARGS, 1, do_help, |
Peter Tyser | 4e1ca93 | 2009-10-16 17:36:26 -0500 | [diff] [blame] | 20 | "print command description/usage", |
| 21 | "\n" |
| 22 | " - print brief description of all commands\n" |
| 23 | "help command ...\n" |
| 24 | " - print detailed usage of 'command'" |
Peter Tyser | 6b8f5ad | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 25 | ); |
| 26 | |
| 27 | /* This does not use the U_BOOT_CMD macro as ? can't be used in symbol names */ |
Albert ARIBAUD | ef123c5 | 2013-02-25 00:59:00 +0000 | [diff] [blame] | 28 | ll_entry_declare(cmd_tbl_t, question_mark, cmd) = { |
Peter Tyser | 6b8f5ad | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 29 | "?", CONFIG_SYS_MAXARGS, 1, do_help, |
| 30 | "alias for 'help'", |
Peter Tyser | 4e1ca93 | 2009-10-16 17:36:26 -0500 | [diff] [blame] | 31 | #ifdef CONFIG_SYS_LONGHELP |
Peter Tyser | 6b8f5ad | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 32 | "" |
Peter Tyser | 6b8f5ad | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 33 | #endif /* CONFIG_SYS_LONGHELP */ |
Peter Tyser | 4e1ca93 | 2009-10-16 17:36:26 -0500 | [diff] [blame] | 34 | }; |