]> git.proxmox.com Git - mirror_edk2.git/blob - ShellPkg/Application/Shell/ShellManParser.h
ShellPkg: Fix the bug that handling Ctrl-C improperly
[mirror_edk2.git] / ShellPkg / Application / Shell / ShellManParser.h
1 /** @file
2 Provides interface to shell MAN file parser.
3
4 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef _SHELL_MAN_FILE_PARSER_HEADER_
16 #define _SHELL_MAN_FILE_PARSER_HEADER_
17
18 /**
19 This function returns the help information for the specified command. The help text
20 will be parsed from a UEFI Shell manual page. (see UEFI Shell 2.0 Appendix B)
21
22 If Sections is specified, then each section name listed will be compared in a casesensitive
23 manner, to the section names described in Appendix B. If the section exists,
24 it will be appended to the returned help text. If the section does not exist, no
25 information will be returned. If Sections is NULL, then all help text information
26 available will be returned.
27
28 if BriefDesc is NULL, then the breif description will not be savedd seperatly,
29 but placed first in the main HelpText.
30
31 @param[in] ManFileName Points to the NULL-terminated UEFI Shell MAN file name.
32 @param[in] Command Points to the NULL-terminated UEFI Shell command name.
33 @param[in] Sections Points to the NULL-terminated comma-delimited
34 section names to return. If NULL, then all
35 sections will be returned.
36 @param[out] BriefDesc On return, points to a callee-allocated buffer
37 containing brief description text.
38 @param[out] HelpText On return, points to a callee-allocated buffer
39 containing all specified help text.
40
41 @retval EFI_SUCCESS The help text was returned.
42 @retval EFI_OUT_OF_RESOURCES The necessary buffer could not be allocated to hold the
43 returned help text.
44 @retval EFI_INVALID_PARAMETER HelpText is NULL
45 @retval EFI_NOT_FOUND There is no help text available for Command.
46 **/
47 EFI_STATUS
48 ProcessManFile(
49 IN CONST CHAR16 *ManFileName,
50 IN CONST CHAR16 *Command,
51 IN CONST CHAR16 *Sections OPTIONAL,
52 OUT CHAR16 **BriefDesc,
53 OUT CHAR16 **HelpText
54 );
55
56 /**
57 parses through the MAN file specified by SHELL_FILE_HANDLE and returns the
58 detailed help for any sub section specified in the comma seperated list of
59 sections provided. If the end of the file or a .TH section is found then
60 return.
61
62 Upon a sucessful return the caller is responsible to free the memory in *HelpText
63
64 @param[in] Handle FileHandle to read from
65 @param[in] Sections name of command's sub sections to find
66 @param[out] HelpText pointer to pointer to string where text goes.
67 @param[out] HelpSize pointer to size of allocated HelpText (may be updated)
68 @param[in] Ascii TRUE if the file is ASCII, FALSE otherwise.
69
70 @retval EFI_OUT_OF_RESOURCES a memory allocation failed.
71 @retval EFI_SUCCESS the section was found and its description sotred in
72 an alloceted buffer.
73 **/
74 EFI_STATUS
75 ManFileFindSections(
76 IN SHELL_FILE_HANDLE Handle,
77 IN CONST CHAR16 *Sections,
78 OUT CHAR16 **HelpText,
79 OUT UINTN *HelpSize,
80 IN BOOLEAN Ascii
81 );
82
83 #endif //_SHELL_MAN_FILE_PARSER_HEADER_
84