]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Include/Library/ShellLib.h
adding new parameter to search and replace function to allow for easy skipping of...
[mirror_edk2.git] / ShellPkg / Include / Library / ShellLib.h
index fc1b6bacd5314a6d439969aa59e076b3e1e9fbf5..3d2fbe27af8b0264c432564048140df6cbd7f881 100644 (file)
@@ -1,36 +1,42 @@
 /** @file\r
   Provides interface to shell functionality for shell commands and applications.\r
 \r
-Copyright (c) 2006 - 2009, Intel Corporation<BR>\r
-All rights reserved. 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
-http://opensource.org/licenses/bsd-license.php\r
+  Copyright (c) 2006 - 2010, Intel Corporation<BR>\r
+  All rights reserved. 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
+  http://opensource.org/licenses/bsd-license.php\r
 \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
 \r
 #if !defined(__SHELL_LIB__)\r
 #define __SHELL_LIB__\r
 \r
+#include <Uefi.h>\r
+#include <Guid/FileInfo.h>\r
 #include <Protocol/SimpleFileSystem.h>\r
+#include <Protocol/LoadedImage.h>\r
+#include <Protocol/EfiShellInterface.h>\r
+#include <Protocol/EfiShellEnvironment2.h>\r
 #include <Protocol/EfiShell.h>\r
+#include <Protocol/EfiShellParameters.h>\r
 \r
 /**\r
   This function will retrieve the information about the file for the handle \r
   specified and store it in allocated pool memory.\r
 \r
   This function allocates a buffer to store the file's information. It is the \r
-  caller's responsibility to free the buffer\r
+  caller's responsibility to free the buffer.\r
 \r
-  @param  FileHandle  The file handle of the file for which information is \r
-                      being requested.\r
+  @param[in] FileHandle         The file handle of the file for which information is \r
+                                being requested.\r
 \r
-  @retval NULL        information could not be retrieved.\r
+  @retval NULL                  Information could not be retrieved.\r
 \r
-  @return             the information about the file\r
+  @return                       The information about the file.\r
 **/\r
 EFI_FILE_INFO*\r
 EFIAPI\r
@@ -42,10 +48,10 @@ ShellGetFileInfo (
   This function will set the information about the file for the opened handle \r
   specified.\r
 \r
-  @param  FileHandle            The file handle of the file for which information \r
+  @param[in]  FileHandle        The file handle of the file for which information \r
                                 is being set.\r
 \r
-  @param  FileInfo              The infotmation to set.\r
+  @param[in] FileInfo           The infotmation to set.\r
 \r
   @retval EFI_SUCCESS            The information was set.\r
   @retval EFI_UNSUPPORTED       The InformationType is not known.\r
@@ -69,12 +75,12 @@ ShellSetFileInfo (
   This function opens a file with the open mode according to the file path. The \r
   Attributes is valid only for EFI_FILE_MODE_CREATE.\r
 \r
-  @param  FilePath                 On input the device path to the file.  On output \r
-                          the remaining device path.\r
-  @param  DeviceHandle         pointer to the system device handle.\r
-  @param  FileHandle             pointer to the file handle.\r
-  @param  OpenMode             the mode to open the file with.\r
-  @param  Attributes           the file's file attributes.\r
+  @param[in]  FilePath                       On input the device path to the file.  On output \r
+                                the remaining device path.\r
+  @param[out]  DeviceHandle      Pointer to the system device handle.\r
+  @param[out]  FileHandle                  Pointer to the file handle.\r
+  @param[in]  OpenMode           The mode to open the file with.\r
+  @param[in]  Attributes                 The file's file attributes.\r
 \r
   @retval EFI_SUCCESS                  The information was set.\r
   @retval EFI_INVALID_PARAMETER        One of the parameters has an invalid value.\r
@@ -110,10 +116,10 @@ ShellOpenFileByDevicePath(
   otherwise, the Filehandle is NULL. The Attributes is valid only for \r
   EFI_FILE_MODE_CREATE.\r
 \r
-  @param  FileName               pointer to file name\r
-  @param  FileHandle           pointer to the file handle.\r
-  @param  OpenMode               the mode to open the file with.\r
-  @param  Attributes           the file's file attributes.\r
+  @param[in] FileName                Pointer to file name.\r
+  @param[out] FileHandle                   Pointer to the file handle.\r
+  @param[in] OpenMode                  The mode to open the file with.\r
+  @param[in] Attributes                      The file's file attributes.\r
 \r
   @retval EFI_SUCCESS                  The information was set.\r
   @retval EFI_INVALID_PARAMETER        One of the parameters has an invalid value.\r
@@ -142,14 +148,14 @@ ShellOpenFileByName(
   );\r
 \r
 /**\r
-  This function create a directory\r
+  This function creates a directory.\r
 \r
   If return is EFI_SUCCESS, the Filehandle is the opened directory's handle; \r
   otherwise, the Filehandle is NULL. If the directory already existed, this \r
   function opens the existing directory.\r
 \r
-  @param  DirectoryName         Pointer to Directory name.\r
-  @param  FileHandle                   Pointer to the file handle.\r
+  @param[in]  DirectoryName     Pointer to Directory name.\r
+  @param[out] FileHandle        Pointer to the file handle.\r
 \r
   @retval EFI_SUCCESS                  The information was set.\r
   @retval EFI_INVALID_PARAMETER        One of the parameters has an invalid value.\r
@@ -191,10 +197,10 @@ ShellCreateDirectory(
   are no more directory entries, the read returns a zero-length buffer. \r
   EFI_FILE_INFO is the structure returned as the directory entry.\r
 \r
-  @param FileHandle             The opened file handle.\r
-  @param ReadSize               On input the size of buffer in bytes.  On return \r
+  @param[in] FileHandle         The opened file handle.\r
+  @param[in] ReadSize           On input the size of buffer in bytes.  On return \r
                                 the number of bytes written.\r
-  @param Buffer                 The buffer to put read data into.\r
+  @param[out] Buffer            The buffer to put read data into.\r
 \r
   @retval EFI_SUCCESS            Data was read.\r
   @retval EFI_NO_MEDIA         The device has no media.\r
@@ -222,12 +228,12 @@ ShellReadFile(
   The file is automatically grown to hold the data if required. Direct writes to \r
   opened directories are not supported.\r
 \r
-  @param FileHandle             The opened file for writing.\r
+  @param[in] FileHandle         The opened file for writing.\r
 \r
-  @param BufferSize             On input the number of bytes in Buffer.  On output\r
+  @param[in] BufferSize         On input the number of bytes in Buffer.  On output\r
                                 the number of bytes written.\r
 \r
-  @param Buffer                 The buffer containing data to write is stored.\r
+  @param[in] Buffer             The buffer containing data to write is stored.\r
 \r
   @retval EFI_SUCCESS            Data was written.\r
   @retval EFI_UNSUPPORTED            Writes to an open directory are not supported.\r
@@ -253,7 +259,7 @@ ShellWriteFile(
   flushed to the device, and the file is closed. In all cases the handle is \r
   closed.\r
 \r
-  @param FileHandle               The file handle to close.\r
+  @param[in] FileHandle           The file handle to close.\r
 \r
   @retval EFI_SUCCESS             The file handle was closed sucessfully.\r
   @retval INVALID_PARAMETER            One of the parameters has an invalid value.\r
@@ -271,7 +277,7 @@ ShellCloseFile (
   If the file cannot be deleted, the warning code EFI_WARN_DELETE_FAILURE is \r
   returned, but the handle is still closed.\r
 \r
-  @param FileHandle                 The file handle to delete.\r
+  @param[in] FileHandle             The file handle to delete.\r
 \r
   @retval EFI_SUCCESS               The file was closed sucessfully.\r
   @retval EFI_WARN_DELETE_FAILURE   The handle was closed, but the file was not \r
@@ -295,12 +301,12 @@ ShellDeleteFile (
   If FileHandle is a directory, the only position that may be set is zero. This \r
   has the effect of starting the read process of the directory entries over.\r
 \r
-  @param FileHandle             The file handle on which the position is being set\r
+  @param[in] FileHandle         The file handle on which the position is being set.\r
 \r
-  @param Position               Byte position from begining of file\r
+  @param[in] Position           Byte position from begining of file.\r
 \r
   @retval EFI_SUCCESS           Operation completed sucessfully.\r
-  @retval EFI_UNSUPPORTED       the seek request for non-zero is not valid on \r
+  @retval EFI_UNSUPPORTED       The seek request for non-zero is not valid on \r
                                 directories.\r
   @retval INVALID_PARAMETER     One of the parameters has an invalid value.\r
 **/\r
@@ -319,12 +325,12 @@ ShellSetFilePosition (
   system driver and as such the operation is not supported. An error is returned\r
   if FileHandle is a directory.\r
 \r
-  @param FileHandle             The open file handle on which to get the position.\r
-  @param Position               Byte position from begining of file.\r
+  @param[in] FileHandle         The open file handle on which to get the position.\r
+  @param[out] Position          Byte position from begining of file.\r
 \r
-  @retval EFI_SUCCESS           the operation completed sucessfully.\r
+  @retval EFI_SUCCESS           The operation completed sucessfully.\r
   @retval INVALID_PARAMETER     One of the parameters has an invalid value.\r
-  @retval EFI_UNSUPPORTED       the request is not valid on directories.\r
+  @retval EFI_UNSUPPORTED       The request is not valid on directories.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -338,7 +344,7 @@ ShellGetFilePosition (
   \r
   This function flushes all modified data associated with a file to a device.\r
 \r
-  @param FileHandle             The file handle on which to flush data\r
+  @param[in] FileHandle         The file handle on which to flush data.\r
 \r
   @retval EFI_SUCCESS           The data was flushed.\r
   @retval EFI_NO_MEDIA          The device has no media.\r
@@ -362,8 +368,8 @@ ShellFlushFile (
 \r
   Caller must use FreePool on *Buffer opon completion of all file searching.\r
 \r
-  @param DirHandle              The file handle of the directory to search\r
-  @param Buffer                 Pointer to pointer to buffer for file's information\r
+  @param[in] DirHandle          The file handle of the directory to search\r
+  @param[out] Buffer            Pointer to pointer to buffer for file's information\r
 \r
   @retval EFI_SUCCESS           Found the first file.\r
   @retval EFI_NOT_FOUND         Cannot find the directory.\r
@@ -389,9 +395,9 @@ ShellFindFirstFile (
   call of this function has no file to get. *NoFile will be set to TRUE and the \r
   data in Buffer is meaningless. \r
 \r
-  @param DirHandle              the file handle of the directory\r
-  @param Buffer                                    pointer to buffer for file's information\r
-  @param NoFile                                    pointer to boolean when last file is found\r
+  @param[in] DirHandle          The file handle of the directory.\r
+  @param[out] Buffer                         Pointer to buffer for file's information.\r
+  @param[out] NoFile                         Pointer to boolean when last file is found.\r
 \r
   @retval EFI_SUCCESS           Found the next file.\r
   @retval EFI_NO_MEDIA          The device has no media.\r
@@ -412,8 +418,8 @@ ShellFindNextFile(
   This function extracts the file size info from the FileHandle's EFI_FILE_INFO \r
   data.\r
 \r
-  @param FileHandle             The file handle from which size is retrieved.\r
-  @param Size                   Pointer to size.\r
+  @param[in] FileHandle         The file handle from which size is retrieved.\r
+  @param[out] Size              Pointer to size.\r
 \r
   @retval EFI_SUCCESS           The operation was completed sucessfully.\r
   @retval EFI_DEVICE_ERROR      Cannot access the file.\r
@@ -428,7 +434,7 @@ ShellGetFileSize (
 /**\r
   Retrieves the status of the break execution flag\r
 \r
-  this function is useful to check whether the application is being asked to halt by the shell.\r
+  This function is useful to check whether the application is being asked to halt by the shell.\r
 \r
   @retval TRUE                  the execution break is enabled\r
   @retval FALSE                 the execution break is not enabled\r
@@ -445,7 +451,7 @@ ShellGetExecutionBreakFlag(
   This function gets the value of the environment variable set by the \r
   ShellSetEnvironmentVariable function.\r
 \r
-  @param EnvKey                 The key name of the environment variable.\r
+  @param[in] EnvKey             The key name of the environment variable.\r
 \r
   @retval NULL                  The named environment variable does not exist.\r
   @return != NULL               pointer to the value of the environment variable.\r
@@ -457,7 +463,7 @@ ShellGetEnvironmentVariable (
   );\r
 \r
 /**\r
-  set the value of an environment variable\r
+  Set the value of an environment variable.\r
 \r
   This function changes the current value of the specified environment variable. If the\r
   environment variable exists and the Value is an empty string, then the environment\r
@@ -469,9 +475,9 @@ ShellGetEnvironmentVariable (
 \r
   This is not supported pre-UEFI Shell 2.0.\r
 \r
-  @param EnvKey                 The key name of the environment variable.\r
-  @param EnvVal                 The Value of the environment variable\r
-  @param Volatile               Indicates whether the variable is non-volatile (FALSE) or volatile (TRUE).\r
+  @param[in] EnvKey             The key name of the environment variable.\r
+  @param[in] EnvVal             The Value of the environment variable\r
+  @param[in] Volatile           Indicates whether the variable is non-volatile (FALSE) or volatile (TRUE).\r
 \r
   @retval EFI_SUCCESS           the operation was completed sucessfully\r
   @retval EFI_UNSUPPORTED       This operation is not allowed in pre UEFI 2.0 Shell environments\r
@@ -496,21 +502,21 @@ ShellSetEnvironmentVariable (
   The CommandLine is executed from the current working directory on the current\r
   device.\r
 \r
-  EnvironmentVariables and Status are only supported for UEFI Shell 2.0.\r
+  EnvironmentVariables and Status are only supported for UEFI Shell 2.0 (or later).\r
   Output is only supported for pre-UEFI Shell 2.0\r
 \r
-  @param ImageHandle            Parent image that is starting the operation.\r
-  @param CommandLine            Pointer to null terminated command line.\r
-  @param Output                 True to display debug output.  false to hide it.\r
-  @param EnvironmentVariables   Optional pointer to array of environment variables\r
-                                in the form "x=y".  If NULL current set is used.\r
-  @param Status                 The status of the run command line.\r
-\r
-  @retval EFI_SUCCESS           The operation completed sucessfully.  Status\r
-                                contains the status code returned.\r
-  @retval EFI_INVALID_PARAMETER A parameter contains an invalid value.\r
-  @retval EFI_OUT_OF_RESOURCES  Out of resources.\r
-  @retval EFI_UNSUPPORTED       The operation is not allowed.\r
+  @param[in] ImageHandle          Parent image that is starting the operation.\r
+  @param[in] CommandLine          Pointer to null terminated command line.\r
+  @param[in] Output               True to display debug output.  False to hide it.\r
+  @param[in] EnvironmentVariables Optional pointer to array of environment variables\r
+                                  in the form "x=y".  If NULL current set is used.\r
+  @param[out] Status              The status of the run command line.\r
+\r
+  @retval EFI_SUCCESS             The operation completed sucessfully.  Status\r
+                                  contains the status code returned.\r
+  @retval EFI_INVALID_PARAMETER   A parameter contains an invalid value.\r
+  @retval EFI_OUT_OF_RESOURCES    Out of resources.\r
+  @retval EFI_UNSUPPORTED         The operation is not allowed.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -529,10 +535,10 @@ ShellExecute (
   name. If the DeviceName is not NULL, it returns the current directory name \r
   on specified drive.\r
 \r
-  @param DeviceName             The name of the file system to get directory on.\r
+  @param[in] DeviceName         The name of the file system to get directory on.\r
 \r
   @retval NULL                  The directory does not exist.\r
-  @return != NULL               The directory.\r
+  @retval != NULL               The directory.\r
 **/\r
 CONST CHAR16*\r
 EFIAPI\r
@@ -546,7 +552,7 @@ ShellGetCurrentDir (
   When page break mode is enabled the screen will stop scrolling \r
   and wait for operator input before scrolling a subsequent screen.\r
 \r
-  @param CurrentState           TRUE to enable and FALSE to disable.\r
+  @param[in] CurrentState       TRUE to enable and FALSE to disable.\r
 **/\r
 VOID \r
 EFIAPI\r
@@ -567,9 +573,9 @@ ShellSetPageBreakMode (
   If you are NOT appending to an existing list *ListHead must be NULL.  If \r
   *ListHead is NULL then it must be callee freed.\r
 \r
-  @param Arg                    Pointer to path string.\r
-  @param OpenMode               Mode to open files with.\r
-  @param ListHead               Head of linked list of results.\r
+  @param[in] Arg                Pointer to path string.\r
+  @param[in] OpenMode           Mode to open files with.\r
+  @param[in] ListHead           Head of linked list of results.\r
 \r
   @retval EFI_SUCCESS           The operation was sucessful and the list head \r
                                 contains the list of opened files.\r
@@ -588,7 +594,7 @@ ShellOpenFileMetaArg (
 /**\r
   Free the linked list returned from ShellOpenFileMetaArg.\r
 \r
-  @param ListHead               The pointer to free.\r
+  @param[in] ListHead           The pointer to free.\r
 \r
   @retval EFI_SUCCESS           The operation was sucessful.\r
   @retval EFI_INVALID_PARAMETER A parameter was invalid.\r
@@ -606,10 +612,10 @@ ShellCloseFileMetaArg (
 \r
   If the return value is not NULL then the memory must be caller freed.\r
 \r
-  @param FileName               Filename string.\r
+  @param[in] FileName           Filename string.\r
 \r
   @retval NULL                  The file was not found.\r
-  @return !NULL                 The path to the file.\r
+  @retval !NULL                 The path to the file.\r
 **/\r
 CHAR16 *\r
 EFIAPI\r
@@ -617,13 +623,36 @@ ShellFindFilePath (
   IN CONST CHAR16 *FileName\r
   );\r
 \r
+/**\r
+  Find a file by searching the CWD and then the path with a variable set of file \r
+  extensions.  If the file is not found it will append each extension in the list \r
+  in the order provided and return the first one that is successful.\r
+\r
+  If FileName is NULL, then ASSERT.\r
+  If FileExtension is NULL, then behavior is identical to ShellFindFilePath.\r
+\r
+  If the return value is not NULL then the memory must be caller freed.\r
+\r
+  @param[in] FileName           Filename string.\r
+  @param[in] FileExtension      Semi-colon delimeted list of possible extensions.\r
+\r
+  @retval NULL                  The file was not found.\r
+  @retval !NULL                 The path to the file.\r
+**/\r
+CHAR16 *\r
+EFIAPI\r
+ShellFindFilePathEx (\r
+  IN CONST CHAR16 *FileName,\r
+  IN CONST CHAR16 *FileExtension\r
+  );\r
+\r
 typedef enum {\r
-  TypeFlag  = 0,    ///< a flag that is present or not present only (IE "-a").\r
-  TypeValue,        ///< a flag that has some data following it with a space (IE "-a 1").\r
-  TypePosition,     ///< some data that did not follow a parameter (IE "filename.txt").\r
-  TypeStart,        ///< a flag that has variable value appended to the end (IE "-ad", "-afd", "-adf", etc...).\r
-  TypeDoubleValue,  ///< a flag that has 2 space seperated value data following it (IE "-a 1 2").\r
-  TypeMaxValue,     ///< a flag followed by all the command line data before the next flag.\r
+  TypeFlag  = 0,    ///< A flag that is present or not present only (IE "-a").\r
+  TypeValue,        ///< A flag that has some data following it with a space (IE "-a 1").\r
+  TypePosition,     ///< Some data that did not follow a parameter (IE "filename.txt").\r
+  TypeStart,        ///< A flag that has variable value appended to the end (IE "-ad", "-afd", "-adf", etc...).\r
+  TypeDoubleValue,  ///< A flag that has 2 space seperated value data following it (IE "-a 1 2").\r
+  TypeMaxValue,     ///< A flag followed by all the command line data before the next flag.\r
   TypeMax,\r
 } ParamType;\r
 \r
@@ -642,16 +671,17 @@ extern SHELL_PARAM_ITEM EmptyParamList[];
   \r
   If no initialization is required, then return RETURN_SUCCESS.\r
   \r
-  @param CheckList              Pointer to list of parameters to check.\r
-  @param CheckPackage           Package of checked values.\r
-  @param ProblemParam           Optional pointer to pointer to unicode string for \r
+  @param[in] CheckList          Pointer to list of parameters to check.\r
+  @param[out] CheckPackage      Package of checked values.\r
+  @param[out] ProblemParam      Optional pointer to pointer to unicode string for \r
                                 the paramater that caused failure.\r
-  @param AutoPageBreak          Will automatically set PageBreakEnabled.\r
+  @param[in] AutoPageBreak      Will automatically set PageBreakEnabled.\r
+  @param[in] AlwaysAllowNumbers Will never fail for number based flags.\r
 \r
   @retval EFI_SUCCESS           The operation completed sucessfully.\r
   @retval EFI_OUT_OF_RESOURCES  A memory allocation failed.\r
   @retval EFI_INVALID_PARAMETER A parameter was invalid.\r
-  @retval EFI_VOLUME_CORRUPTED  The command line was corrupt.  an argument was \r
+  @retval EFI_VOLUME_CORRUPTED  The command line was corrupt.  An argument was \r
                                 duplicated.  The duplicated command line argument \r
                                 was returned in ProblemParam if provided.\r
   @retval EFI_DEVICE_ERROR      The commands contained 2 opposing arguments.  One\r
@@ -671,7 +701,7 @@ ShellCommandLineParseEx (
   IN BOOLEAN                    AlwaysAllowNumbers\r
   );\r
 \r
-/// make it easy to upgrade from older versions of the shell library.\r
+/// Make it easy to upgrade from older versions of the shell library.\r
 #define ShellCommandLineParse(CheckList,CheckPackage,ProblemParam,AutoPageBreak) ShellCommandLineParseEx(CheckList,CheckPackage,ProblemParam,AutoPageBreak,FALSE)\r
 \r
 /**\r
@@ -682,7 +712,7 @@ ShellCommandLineParseEx (
 \r
   If CheckPackage is NULL, then return.\r
 \r
-  @param CheckPackage           The list to de-allocate.\r
+  @param[in] CheckPackage       The list to de-allocate.\r
   **/\r
 VOID\r
 EFIAPI\r
@@ -693,13 +723,13 @@ ShellCommandLineFreeVarList (
 /**\r
   Checks for presence of a flag parameter.\r
 \r
-  flag arguments are in the form of "-<Key>" or "/<Key>", but do not have a value following the key\r
+  Flag arguments are in the form of "-<Key>" or "/<Key>", but do not have a value following the key.\r
 \r
-  if CheckPackage is NULL then return FALSE.\r
-  if KeyString is NULL then ASSERT().\r
+  If CheckPackage is NULL then return FALSE.\r
+  If KeyString is NULL then ASSERT().\r
   \r
-  @param CheckPackage           The package of parsed command line arguments.\r
-  @param KeyString              The Key of the command line argument to check for.\r
+  @param[in] CheckPackage       The package of parsed command line arguments.\r
+  @param[in] KeyString          The Key of the command line argument to check for.\r
 \r
   @retval TRUE                  The flag is on the command line.\r
   @retval FALSE                 The flag is not on the command line.\r
@@ -714,7 +744,7 @@ ShellCommandLineGetFlag (
 /**\r
   Returns value from command line argument.\r
 \r
-  Value parameters are in the form of "-<Key> value" or "/<Key> value"\r
+  Value parameters are in the form of "-<Key> value" or "/<Key> value".\r
   \r
   If CheckPackage is NULL, then return NULL.\r
 \r
@@ -756,8 +786,8 @@ ShellCommandLineGetRawValue (
   \r
   This will not include flags.\r
 \r
-  @retval (UINTN)-1     No parsing has ocurred\r
-  @return               The number of value parameters found\r
+  @retval (UINTN)-1     No parsing has ocurred.\r
+  @return               The number of value parameters found.\r
 **/\r
 UINTN\r
 EFIAPI\r
@@ -826,11 +856,11 @@ ShellInitialize (
 \r
   Note: The background color is controlled by the shell command cls.\r
 \r
-  @param[in] Row        the row to print at\r
-  @param[in] Col        the column to print at\r
-  @param[in] Format     the format string\r
+  @param[in] Row        The row to print at.\r
+  @param[in] Col        The column to print at.\r
+  @param[in] Format     The format string.\r
 \r
-  @return the number of characters printed to the screen\r
+  @return The number of characters printed to the screen.\r
 **/\r
 \r
 UINTN\r
@@ -855,20 +885,20 @@ ShellPrintEx(
 \r
   In addition to the standard %-based flags as supported by UefiLib Print() this supports \r
   the following additional flags:\r
-    %N       -   Set output attribute to normal\r
-    %H       -   Set output attribute to highlight\r
-    %E       -   Set output attribute to error\r
-    %B       -   Set output attribute to blue color\r
-    %V       -   Set output attribute to green color\r
+    %N       -   Set output attribute to normal.\r
+    %H       -   Set output attribute to highlight.\r
+    %E       -   Set output attribute to error.\r
+    %B       -   Set output attribute to blue color.\r
+    %V       -   Set output attribute to green color.\r
 \r
   Note: The background color is controlled by the shell command cls.\r
 \r
-  @param[in] Row                the row to print at\r
-  @param[in] Col                the column to print at\r
-  @param[in] HiiFormatStringId  the format string Id for getting from Hii\r
-  @param[in] HiiFormatHandle    the format string Handle for getting from Hii\r
+  @param[in] Row                The row to print at.\r
+  @param[in] Col                The column to print at.\r
+  @param[in] HiiFormatStringId  The format string Id for getting from Hii.\r
+  @param[in] HiiFormatHandle    The format string Handle for getting from Hii.\r
 \r
-  @return the number of characters printed to the screen\r
+  @return the number of characters printed to the screen.\r
 **/\r
 UINTN\r
 EFIAPI\r
@@ -883,6 +913,8 @@ ShellPrintHiiEx(
 /**\r
   Function to determine if a given filename represents a directory.\r
 \r
+  If DirName is NULL, then ASSERT.\r
+\r
   @param[in] DirName      Path to directory to test.\r
 \r
   @retval EFI_SUCCESS     The Path represents a directory.\r
@@ -898,6 +930,10 @@ ShellIsDirectory(
 /**\r
   Function to determine if a given filename represents a file.\r
 \r
+  This will search the CWD only.\r
+\r
+  If Name is NULL, then ASSERT.\r
+\r
   @param[in] Name         Path to file to test.\r
 \r
   @retval EFI_SUCCESS     The Path represents a file.\r
@@ -910,6 +946,25 @@ ShellIsFile(
   IN CONST CHAR16 *Name\r
   );\r
 \r
+/**\r
+  Function to determine if a given filename represents a file.\r
+\r
+  This will search the CWD and then the Path.\r
+\r
+  If Name is NULL, then ASSERT.\r
+\r
+  @param[in] Name         Path to file to test.\r
+\r
+  @retval EFI_SUCCESS     The Path represents a file.\r
+  @retval EFI_NOT_FOUND   The Path does not represent a file.\r
+  @retval other           The path failed to open.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ShellIsFileInPath(\r
+  IN CONST CHAR16 *Name\r
+  );\r
+\r
 /**\r
   Function to determine whether a string is decimal or hex representation of a number \r
   and return the number converted from the string.\r
@@ -942,19 +997,19 @@ ShellStrToUintn(
   If Source is NULL, there is nothing to append, just return the current buffer in \r
   Destination.\r
 \r
-  if Destination is NULL, then ASSERT().\r
-  if Destination's current length (including NULL terminator) is already more the\r
+  If Destination is NULL, then ASSERT().\r
+  If Destination's current length (including NULL terminator) is already more tha\r
   CurrentSize, then ASSERT().\r
 \r
   @param[in,out] Destination    The String to append onto.\r
   @param[in,out] CurrentSize    On call the number of bytes in Destination.  On \r
-                                return possibly the new size (still in bytes).  if NULL\r
+                                return possibly the new size (still in bytes).  If NULL\r
                                 then allocate whatever is needed.\r
   @param[in]     Source         The String to append from.\r
   @param[in]     Count          Maximum number of characters to append.  If 0 then \r
                                 all are appended.\r
 \r
-  @return                       the Destination after apending the Source.\r
+  @return                       The Destination after apending the Source.\r
 **/\r
 CHAR16* \r
 EFIAPI\r
@@ -965,4 +1020,66 @@ StrnCatGrow (
   IN     UINTN            Count\r
   );\r
 \r
+/**\r
+  This is a find and replace function.  Upon successful return the NewString is a copy of \r
+  SourceString with each instance of FindTarget replaced with ReplaceWith.\r
+\r
+  If SourceString and NewString overlap the behavior is undefined.\r
+\r
+  If the string would grow bigger than NewSize it will halt and return error.\r
+\r
+  @param[in] SourceString             String with source buffer.\r
+  @param[in,out] NewString            String with resultant buffer.\r
+  @param[in] NewSize                  Size in bytes of NewString.\r
+  @param[in] FindTarget               String to look for.\r
+  @param[in] ReplaceWith              String to replace FindTarget with.\r
+  @param[in] SkipPreCarrot            If TRUE will skip a FindTarget that has a '^'\r
+                                      immediately before it.\r
+\r
+  @retval EFI_INVALID_PARAMETER       SourceString was NULL.\r
+  @retval EFI_INVALID_PARAMETER       NewString was NULL.\r
+  @retval EFI_INVALID_PARAMETER       FindTarget was NULL.\r
+  @retval EFI_INVALID_PARAMETER       ReplaceWith was NULL.\r
+  @retval EFI_INVALID_PARAMETER       FindTarget had length < 1.\r
+  @retval EFI_INVALID_PARAMETER       SourceString had length < 1.\r
+  @retval EFI_BUFFER_TOO_SMALL        NewSize was less than the minimum size to hold \r
+                                      the new string (truncation occurred).\r
+  @retval EFI_SUCCESS                 The string was sucessfully copied with replacement.\r
+**/\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+ShellCopySearchAndReplace2(\r
+  IN CHAR16 CONST                     *SourceString,\r
+  IN CHAR16                           *NewString,\r
+  IN UINTN                            NewSize,\r
+  IN CONST CHAR16                     *FindTarget,\r
+  IN CONST CHAR16                     *ReplaceWith,\r
+  IN CONST BOOLEAN                    SkipPreCarrot\r
+  );\r
+\r
+///\r
+/// make upgrades easier from old version\r
+///\r
+#define ShellLibCopySearchAndReplace(a,b,c,d,e) ShellCopySearchAndReplace2(a,b,c,d,e,FALSE)\r
+\r
+/**\r
+  Check if a Unicode character is a hexadecimal character.\r
+\r
+  This internal function checks if a Unicode character is a \r
+  decimal character.  The valid hexadecimal character is \r
+  L'0' to L'9', L'a' to L'f', or L'A' to L'F'.\r
+\r
+  @param[in]  Char  The character to check.\r
+\r
+  @retval TRUE      The Char is a hexadecmial character.\r
+  @retval FALSE     The Char is not a hexadecmial character.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+ShellIsHexaDecimalDigitCharacter (\r
+  IN      CHAR16                    Char\r
+  );\r
+\r
 #endif // __SHELL_LIB__\r