]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Include/Library/ShellCommandLib.h
ShellPkg: Update sources to include MdePkg protocol definitions
[mirror_edk2.git] / ShellPkg / Include / Library / ShellCommandLib.h
index 027c0caad50e1bd9d53c0fb2f7e22d701105e90d..08de1332c713938a8cdcadfcfbef400645ee23fe 100644 (file)
@@ -4,7 +4,9 @@
   This library is for use ONLY by shell commands linked into the shell application.\r
   This library will not funciton if it is used for UEFI Shell 2.0 Applications.\r
 \r
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
+  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
+  (C) Copyright 2013-2014 Hewlett-Packard Development Company, L.P.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
 #define _SHELL_COMMAND_LIB_\r
 \r
 #include <Uefi.h>\r
-#include <ShellBase.h>\r
 \r
-#include <Protocol/EfiShell.h>\r
-#include <Protocol/EfiShellParameters.h>\r
+#include <Protocol/Shell.h>\r
+#include <Protocol/ShellParameters.h>\r
 #include <Protocol/UnicodeCollation.h>\r
-#include <Protocol/DevicePathToText.h>\r
 #include <Protocol/SimpleFileSystem.h>\r
 \r
 #include <Library/UefiBootServicesTableLib.h>\r
@@ -33,7 +33,6 @@
 // The extern global protocol poionters.\r
 //\r
 extern        EFI_UNICODE_COLLATION_PROTOCOL    *gUnicodeCollation;\r
-extern        EFI_DEVICE_PATH_TO_TEXT_PROTOCOL  *gDevPathToText;\r
 extern        CONST CHAR16*                     SupportLevel[];\r
 \r
 //\r
@@ -159,12 +158,12 @@ ShellCommandRegisterCommandName (
   information is returned. If Sections is NULL, then all help text information\r
   available is returned.\r
 \r
-  @param[in]  CommandString         The pointer to the command name.  This is the name\r
-                                    found on the command line in the shell.\r
-  @param[in,out] RetVal             The pointer to the return value from the command handler.\r
+  @param[in]   CommandString         The pointer to the command name.  This is the name\r
+                                     found on the command line in the shell.\r
+  @param[in, out] RetVal             The pointer to the return value from the command handler.\r
 \r
-  @param[in,out]  CanAffectLE       Indicates whether this command's return value\r
-                                    needs to be placed into LASTERROR environment variable.\r
+  @param[in, out]  CanAffectLE       Indicates whether this command's return value\r
+                                     needs to be placed into LASTERROR environment variable.\r
 \r
   @retval RETURN_SUCCESS            The handler was run.\r
   @retval RETURN_NOT_FOUND          The CommandString did not match a registered\r
@@ -340,11 +339,24 @@ ShellCommandSetEchoState (
   Indicate that the current shell or script should exit.\r
 \r
   @param[in] ScriptOnly   TRUE if exiting a script; FALSE otherwise.\r
+  @param[in] ErrorCode    The 64 bit error code to return.\r
 **/\r
 VOID\r
 EFIAPI\r
 ShellCommandRegisterExit (\r
-  IN BOOLEAN ScriptOnly\r
+  IN BOOLEAN      ScriptOnly,\r
+  IN CONST UINT64 ErrorCode\r
+  );\r
+\r
+/**\r
+  Retrieve the Exit code.\r
+\r
+  @return the value passed into RegisterExit.\r
+**/\r
+UINT64\r
+EFIAPI\r
+ShellCommandGetExitCode (\r
+  VOID\r
   );\r
 \r
 /**\r
@@ -573,17 +585,14 @@ ShellCommandCreateInitialMappingsAndPaths(
   );\r
 \r
 /**\r
-  Function to standardize the directory indicators to \ characters.\r
+  Add mappings for any devices without one.  Do not change any existing maps.\r
 \r
-  @param[in,out] Path   The pointer to the path string to fix.\r
-\r
-  @retval NULL          The operation failed.\r
-  @return               The Path pointer.\r
+  @retval EFI_SUCCESS   The operation was successful.\r
 **/\r
-CHAR16*\r
+EFI_STATUS\r
 EFIAPI\r
-ShellCommandCleanPath (\r
-  IN OUT CHAR16 *Path\r
+ShellCommandUpdateMapping (\r
+  VOID\r
   );\r
 \r
 /**\r
@@ -660,64 +669,6 @@ ShellFileHandleEof(
   IN SHELL_FILE_HANDLE Handle\r
   );\r
 \r
-/**\r
-  Function to read a single line from a SHELL_FILE_HANDLE. The \n is not included in the returned\r
-  buffer.  The returned buffer must be callee freed.\r
-\r
-  If the position upon start is 0, then the Ascii Boolean will be set.  This should be\r
-  maintained and not changed for all operations with the same file.\r
-\r
-  @param[in]      Handle        SHELL_FILE_HANDLE to read from.\r
-  @param[in,out]  Ascii         Boolean value for indicating whether the file is\r
-                                Ascii (TRUE) or UCS2 (FALSE).\r
-\r
-  @return                       The line of text from the file.\r
-\r
-  @sa ShellFileHandleReadLine\r
-**/\r
-CHAR16*\r
-EFIAPI\r
-ShellFileHandleReturnLine(\r
-  IN SHELL_FILE_HANDLE            Handle,\r
-  IN OUT BOOLEAN                *Ascii\r
-  );\r
-\r
-/**\r
-  Function to read a single line (up to but not including the \n) from a SHELL_FILE_HANDLE.\r
-\r
-  If the position upon start is 0, then the Ascii Boolean will be set.  This should be\r
-  maintained and not changed for all operations with the same file.\r
-\r
-  @param[in]      Handle        SHELL_FILE_HANDLE to read from.\r
-  @param[in,out]  Buffer        The pointer to buffer to read into.\r
-  @param[in,out]  Size          The pointer to number of bytes in Buffer.\r
-  @param[in]      Truncate      If the buffer is large enough, this has no effect.\r
-                                If the buffer is is too small and Truncate is TRUE,\r
-                                the line will be truncated.\r
-                                If the buffer is is too small and Truncate is FALSE,\r
-                                then no read will occur.\r
-\r
-  @param[in,out]  Ascii         Boolean value for indicating whether the file is\r
-                                Ascii (TRUE) or UCS2 (FALSE).\r
-\r
-  @retval EFI_SUCCESS           The operation was successful.  The line is stored in\r
-                                Buffer.\r
-  @retval EFI_INVALID_PARAMETER Handle was NULL.\r
-  @retval EFI_INVALID_PARAMETER Size was NULL.\r
-  @retval EFI_BUFFER_TOO_SMALL  Size was not large enough to store the line.\r
-                                Size was updated to the minimum space required.\r
-  @sa ShellFileHandleRead\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ShellFileHandleReadLine(\r
-  IN SHELL_FILE_HANDLE          Handle,\r
-  IN OUT CHAR16                 *Buffer,\r
-  IN OUT UINTN                  *Size,\r
-  IN BOOLEAN                    Truncate,\r
-  IN OUT BOOLEAN                *Ascii\r
-  );\r
-\r
 typedef struct {\r
   LIST_ENTRY    Link;\r
   void          *Buffer;\r
@@ -735,34 +686,36 @@ FreeBufferList (
   );\r
 \r
 /**\r
-  Chops off last directory or file entry in a path by changing the last '\' to a CHAR_NULL\r
-\r
-  @param[in,out] PathToReturn   The pointer to the path to modify.\r
+  Function printing hex output to the console.\r
 \r
-  @retval FALSE     No directory was found to chop off.\r
-  @retval TRUE      A directory was chopped off.\r
+  @param[in] Indent       Number of spaces to indent.\r
+  @param[in] Offset       Offset to start with.\r
+  @param[in] DataSize     Length of data.\r
+  @param[in] UserData     Pointer to some data.\r
 **/\r
-BOOLEAN\r
-EFIAPI\r
-ChopLastSlash(\r
-  IN OUT CHAR16 *PathToReturn\r
+VOID\r
+DumpHex (\r
+  IN UINTN        Indent,\r
+  IN UINTN        Offset,\r
+  IN UINTN        DataSize,\r
+  IN VOID         *UserData\r
   );\r
 \r
 /**\r
-  Function to clean up paths.  Removes the following items:\r
-    single periods in the path (no need for the current directory tag)\r
-    double periods in the path and removes a single parent directory.\r
-\r
-  This will be done inline and the resultant string may be be 'too big'.\r
-\r
-  @param[in] PathToReturn  The pointer to the string containing the path.\r
+  Dump HEX data into buffer.\r
 \r
-  @return PathToReturn is always returned.\r
+  @param[in] Buffer     HEX data to be dumped in Buffer.\r
+  @param[in] Indent     How many spaces to indent the output.\r
+  @param[in] Offset     The offset of the printing.\r
+  @param[in] DataSize   The size in bytes of UserData.\r
+  @param[in] UserData   The data to print out.\r
 **/\r
 CHAR16*\r
-EFIAPI\r
-CleanPath(\r
-  IN CHAR16 *PathToReturn\r
+CatSDumpHex (\r
+  IN CHAR16  *Buffer,\r
+  IN UINTN   Indent,\r
+  IN UINTN   Offset,\r
+  IN UINTN   DataSize,\r
+  IN VOID    *UserData\r
   );\r
-\r
 #endif //_SHELL_COMMAND_LIB_\r