Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Peter Tyser | eabe6d9 | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 2 | /* |
| 3 | * Copyright 2000-2009 |
| 4 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
Peter Tyser | eabe6d9 | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 5 | */ |
| 6 | |
Peter Tyser | eabe6d9 | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 7 | #include <command.h> |
| 8 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 9 | static int do_help(struct cmd_tbl *cmdtp, int flag, int argc, |
| 10 | char *const argv[]) |
Peter Tyser | eabe6d9 | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 11 | { |
Simon Glass | 4ef90b7 | 2016-03-19 02:18:38 -0600 | [diff] [blame] | 12 | #ifdef CONFIG_CMDLINE |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 13 | struct cmd_tbl *start = ll_entry_start(struct cmd_tbl, cmd); |
| 14 | const int len = ll_entry_count(struct cmd_tbl, cmd); |
Marek Vasut | 69c5e34 | 2012-10-12 10:27:04 +0000 | [diff] [blame] | 15 | return _do_help(start, len, cmdtp, flag, argc, argv); |
Simon Glass | 4ef90b7 | 2016-03-19 02:18:38 -0600 | [diff] [blame] | 16 | #else |
| 17 | return 0; |
| 18 | #endif |
Peter Tyser | eabe6d9 | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 19 | } |
| 20 | |
| 21 | U_BOOT_CMD( |
| 22 | help, CONFIG_SYS_MAXARGS, 1, do_help, |
Peter Tyser | 2d2712a | 2009-10-16 17:36:26 -0500 | [diff] [blame] | 23 | "print command description/usage", |
| 24 | "\n" |
| 25 | " - print brief description of all commands\n" |
| 26 | "help command ...\n" |
| 27 | " - print detailed usage of 'command'" |
Peter Tyser | eabe6d9 | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 28 | ); |
| 29 | |
Andrej Rosano | 6533a7e | 2019-07-29 09:24:53 +0200 | [diff] [blame] | 30 | #ifdef CONFIG_CMDLINE |
Tom Rini | 03f146c | 2023-10-07 15:13:08 -0400 | [diff] [blame] | 31 | /* |
| 32 | * This does not use the U_BOOT_CMD macro as ? can't be used in symbol names |
| 33 | * nor can we rely on the CONFIG_SYS_LONGHELP helper macro |
| 34 | */ |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 35 | ll_entry_declare(struct cmd_tbl, question_mark, cmd) = { |
Boris Brezillon | c71dfd1 | 2018-12-03 22:54:20 +0100 | [diff] [blame] | 36 | "?", CONFIG_SYS_MAXARGS, cmd_always_repeatable, do_help, |
Peter Tyser | eabe6d9 | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 37 | "alias for 'help'", |
Peter Tyser | 2d2712a | 2009-10-16 17:36:26 -0500 | [diff] [blame] | 38 | #ifdef CONFIG_SYS_LONGHELP |
Peter Tyser | eabe6d9 | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 39 | "" |
Peter Tyser | eabe6d9 | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 40 | #endif /* CONFIG_SYS_LONGHELP */ |
Peter Tyser | 2d2712a | 2009-10-16 17:36:26 -0500 | [diff] [blame] | 41 | }; |
Andrej Rosano | 6533a7e | 2019-07-29 09:24:53 +0200 | [diff] [blame] | 42 | #endif |