ShellManParser.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /** @file
  2. Provides interface to shell MAN file parser.
  3. Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef _SHELL_MAN_FILE_PARSER_HEADER_
  7. #define _SHELL_MAN_FILE_PARSER_HEADER_
  8. /**
  9. This function returns the help information for the specified command. The help text
  10. will be parsed from a UEFI Shell manual page. (see UEFI Shell 2.0 Appendix B)
  11. If Sections is specified, then each section name listed will be compared in a casesensitive
  12. manner, to the section names described in Appendix B. If the section exists,
  13. it will be appended to the returned help text. If the section does not exist, no
  14. information will be returned. If Sections is NULL, then all help text information
  15. available will be returned.
  16. if BriefDesc is NULL, then the breif description will not be savedd separately,
  17. but placed first in the main HelpText.
  18. @param[in] ManFileName Points to the NULL-terminated UEFI Shell MAN file name.
  19. @param[in] Command Points to the NULL-terminated UEFI Shell command name.
  20. @param[in] Sections Points to the NULL-terminated comma-delimited
  21. section names to return. If NULL, then all
  22. sections will be returned.
  23. @param[out] BriefDesc On return, points to a callee-allocated buffer
  24. containing brief description text.
  25. @param[out] HelpText On return, points to a callee-allocated buffer
  26. containing all specified help text.
  27. @retval EFI_SUCCESS The help text was returned.
  28. @retval EFI_OUT_OF_RESOURCES The necessary buffer could not be allocated to hold the
  29. returned help text.
  30. @retval EFI_INVALID_PARAMETER HelpText is NULL
  31. @retval EFI_NOT_FOUND There is no help text available for Command.
  32. **/
  33. EFI_STATUS
  34. ProcessManFile (
  35. IN CONST CHAR16 *ManFileName,
  36. IN CONST CHAR16 *Command,
  37. IN CONST CHAR16 *Sections OPTIONAL,
  38. OUT CHAR16 **BriefDesc,
  39. OUT CHAR16 **HelpText
  40. );
  41. /**
  42. parses through the MAN file specified by SHELL_FILE_HANDLE and returns the
  43. detailed help for any sub section specified in the comma separated list of
  44. sections provided. If the end of the file or a .TH section is found then
  45. return.
  46. Upon a successful return the caller is responsible to free the memory in *HelpText
  47. @param[in] Handle FileHandle to read from
  48. @param[in] Sections name of command's sub sections to find
  49. @param[out] HelpText pointer to pointer to string where text goes.
  50. @param[out] HelpSize pointer to size of allocated HelpText (may be updated)
  51. @param[in] Ascii TRUE if the file is ASCII, FALSE otherwise.
  52. @retval EFI_OUT_OF_RESOURCES a memory allocation failed.
  53. @retval EFI_SUCCESS the section was found and its description stored in
  54. an allocated buffer.
  55. **/
  56. EFI_STATUS
  57. ManFileFindSections (
  58. IN SHELL_FILE_HANDLE Handle,
  59. IN CONST CHAR16 *Sections,
  60. OUT CHAR16 **HelpText,
  61. OUT UINTN *HelpSize,
  62. IN BOOLEAN Ascii
  63. );
  64. #endif //_SHELL_MAN_FILE_PARSER_HEADER_