Home | History | Annotate | Download | only in Shell
      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 EFIAPI
     49 ProcessManFile(
     50   IN CONST CHAR16 *ManFileName,
     51   IN CONST CHAR16 *Command,
     52   IN CONST CHAR16 *Sections OPTIONAL,
     53   OUT CHAR16      **BriefDesc,
     54   OUT CHAR16      **HelpText
     55   );
     56 
     57 /**
     58   parses through the MAN file specified by SHELL_FILE_HANDLE and returns the
     59   detailed help for any sub section specified in the comma seperated list of
     60   sections provided.  If the end of the file or a .TH section is found then
     61   return.
     62 
     63   Upon a sucessful return the caller is responsible to free the memory in *HelpText
     64 
     65   @param[in] Handle             FileHandle to read from
     66   @param[in] Sections           name of command's sub sections to find
     67   @param[out] HelpText          pointer to pointer to string where text goes.
     68   @param[out] HelpSize          pointer to size of allocated HelpText (may be updated)
     69   @param[in] Ascii              TRUE if the file is ASCII, FALSE otherwise.
     70 
     71   @retval EFI_OUT_OF_RESOURCES  a memory allocation failed.
     72   @retval EFI_SUCCESS           the section was found and its description sotred in
     73                                 an alloceted buffer.
     74 **/
     75 EFI_STATUS
     76 EFIAPI
     77 ManFileFindSections(
     78   IN SHELL_FILE_HANDLE  Handle,
     79   IN CONST CHAR16       *Sections,
     80   OUT CHAR16            **HelpText,
     81   OUT UINTN             *HelpSize,
     82   IN BOOLEAN            Ascii
     83   );
     84 
     85 #endif //_SHELL_MAN_FILE_PARSER_HEADER_
     86 
     87