]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Include/Library/ShellCommandLib.h
ShellPkg: Move UpdateMapping() out of Map command and added to UefiShellCommandLib...
[mirror_edk2.git] / ShellPkg / Include / Library / ShellCommandLib.h
index 53cc80b4b56749e18cadad5aba69ecccc1985c2e..aed947c1a9814ddb62a842b8df12923e05258cb0 100644 (file)
@@ -4,7 +4,8 @@
   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 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  (C) Copyright 2013-2014, Hewlett-Packard Development Company, L.P.\r
+  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<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
@@ -24,7 +25,6 @@
 #include <Protocol/EfiShell.h>\r
 #include <Protocol/EfiShellParameters.h>\r
 #include <Protocol/UnicodeCollation.h>\r
-#include <Protocol/DevicePathToText.h>\r
 #include <Protocol/SimpleFileSystem.h>\r
 \r
 #include <Library/UefiBootServicesTableLib.h>\r
 //\r
 // The extern global protocol poionters.\r
 //\r
-extern        EFI_SHELL_PROTOCOL                *gEfiShellProtocol;\r
-extern        EFI_SHELL_PARAMETERS_PROTOCOL     *gEfiShellParametersProtocol;\r
 extern        EFI_UNICODE_COLLATION_PROTOCOL    *gUnicodeCollation;\r
-extern        EFI_DEVICE_PATH_TO_TEXT_PROTOCOL  *gDevPathToText;\r
 extern        CONST CHAR16*                     SupportLevel[];\r
 \r
 //\r
@@ -161,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
@@ -211,12 +208,14 @@ typedef struct {
   via the LIST_ENTRY structure.  Enumerate through it using the BaseLib linked\r
   list functions.  Do not modify the values.\r
 \r
+  @param[in] Sort       TRUE to alphabetically sort the values first.  FALSE otherwise.\r
+\r
   @return A linked list of all available shell commands.\r
 **/\r
 CONST COMMAND_LIST*\r
 EFIAPI\r
 ShellCommandGetCommandList (\r
-  VOID\r
+  IN CONST BOOLEAN Sort\r
   );\r
 \r
 typedef struct {\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
@@ -419,6 +431,17 @@ ShellCommandSetNewScript (
   IN SCRIPT_FILE *Script OPTIONAL\r
   );\r
 \r
+/**\r
+  Function to cleanup all memory from a SCRIPT_FILE structure.\r
+\r
+  @param[in] Script     The pointer to the structure to cleanup.\r
+**/\r
+VOID\r
+EFIAPI\r
+DeleteScriptFileStruct (\r
+  IN SCRIPT_FILE *Script\r
+  );\r
+\r
 /**\r
   Function to get the current Profile string.\r
 \r
@@ -490,7 +513,7 @@ ShellCommandConsistMappingUnInitialize (
   This must be called after ShellCommandConsistMappingInitialize() and \r
   before ShellCommandConsistMappingUnInitialize() is called.\r
 \r
-  @param[in] DeviecPath   The pointer to the dev path for the device.\r
+  @param[in] DevicePath   The pointer to the dev path for the device.\r
   @param[in] Table        The Table of mapping information.\r
 \r
   @retval NULL            A consistent mapped name could not be created.\r
@@ -562,17 +585,14 @@ ShellCommandCreateInitialMappingsAndPaths(
   );\r
 \r
 /**\r
-  Function to standardize the directory indicators to \ characters.\r
-\r
-  @param[in,out] Path   The pointer to the path string to fix.\r
+  Add mappings for any devices without one.  Do not change any existing maps.\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
@@ -649,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
@@ -723,35 +685,4 @@ FreeBufferList (
   IN BUFFER_LIST *List\r
   );\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
-\r
-  @retval FALSE     No directory was found to chop off.\r
-  @retval TRUE      A directory was chopped off.\r
-**/\r
-BOOLEAN\r
-EFIAPI\r
-ChopLastSlash(\r
-  IN OUT CHAR16 *PathToReturn\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
-\r
-  @return PathToReturn is always returned.\r
-**/\r
-CHAR16*\r
-EFIAPI\r
-CleanPath(\r
-  IN CHAR16 *PathToReturn\r
-  );\r
-\r
 #endif //_SHELL_COMMAND_LIB_\r