help.c 996 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright 2000-2009
  4. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  5. */
  6. #include <common.h>
  7. #include <command.h>
  8. static int do_help(struct cmd_tbl *cmdtp, int flag, int argc,
  9. char *const argv[])
  10. {
  11. #ifdef CONFIG_CMDLINE
  12. struct cmd_tbl *start = ll_entry_start(struct cmd_tbl, cmd);
  13. const int len = ll_entry_count(struct cmd_tbl, cmd);
  14. return _do_help(start, len, cmdtp, flag, argc, argv);
  15. #else
  16. return 0;
  17. #endif
  18. }
  19. U_BOOT_CMD(
  20. help, CONFIG_SYS_MAXARGS, 1, do_help,
  21. "print command description/usage",
  22. "\n"
  23. " - print brief description of all commands\n"
  24. "help command ...\n"
  25. " - print detailed usage of 'command'"
  26. );
  27. #ifdef CONFIG_CMDLINE
  28. /* This does not use the U_BOOT_CMD macro as ? can't be used in symbol names */
  29. ll_entry_declare(struct cmd_tbl, question_mark, cmd) = {
  30. "?", CONFIG_SYS_MAXARGS, cmd_always_repeatable, do_help,
  31. "alias for 'help'",
  32. #ifdef CONFIG_SYS_LONGHELP
  33. ""
  34. #endif /* CONFIG_SYS_LONGHELP */
  35. };
  36. #endif