]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Include/Library/ShellLib.h
Upgrade ShellLib and fix bug with param parsing
[mirror_edk2.git] / ShellPkg / Include / Library / ShellLib.h
index f0998d8346118e41bc891fd7be7287b057553183..6211343f1690f5aa0e5a0d0e00fd83f61cd3243e 100644 (file)
@@ -47,7 +47,7 @@ ShellGetFileInfo (
 \r
   @param  FileInfo              The infotmation to set.\r
 \r
-  @retval EFI_SUCCESS                  The information was set.\r
+  @retval EFI_SUCCESS            The information was set.\r
   @retval EFI_UNSUPPORTED       The InformationType is not known.\r
   @retval EFI_NO_MEDIA               The device has no medium.\r
   @retval EFI_DEVICE_ERROR         The device reported an error.\r
@@ -115,27 +115,27 @@ ShellOpenFileByDevicePath(
   @param  OpenMode               the mode to open the file with.\r
   @param  Attributes           the file's file attributes.\r
 \r
-  @retval EFI_SUCCESS          The information was set.\r
+  @retval EFI_SUCCESS                  The information was set.\r
   @retval EFI_INVALID_PARAMETER        One of the parameters has an invalid value.\r
-  @retval EFI_UNSUPPORTED      Could not open the file path.   \r
+  @retval EFI_UNSUPPORTED            Could not open the file path.     \r
   @retval EFI_NOT_FOUND                The specified file could not be found on the \r
                                 device or the file system could not be found \r
                                 on the device.\r
-  @retval EFI_NO_MEDIA         The device has no medium.\r
-  @retval EFI_MEDIA_CHANGED    The device has a different medium in it or the \r
+  @retval EFI_NO_MEDIA               The device has no medium.\r
+  @retval EFI_MEDIA_CHANGED        The device has a different medium in it or the \r
                                 medium is no longer supported.\r
-  @retval EFI_DEVICE_ERROR     The device reported an error.\r
+  @retval EFI_DEVICE_ERROR         The device reported an error.\r
   @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
-  @retval EFI_WRITE_PROTECTED  The file or medium is write protected.\r
-  @retval EFI_ACCESS_DENIED    The file was opened read only.\r
+  @retval EFI_WRITE_PROTECTED    The file or medium is write protected.\r
+  @retval EFI_ACCESS_DENIED        The file was opened read only.\r
   @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the \r
                                 file.\r
-  @retval EFI_VOLUME_FULL      The volume is full.\r
+  @retval EFI_VOLUME_FULL            The volume is full.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ShellOpenFileByName(\r
-  IN CHAR16                              *FilePath,\r
+  IN CONST CHAR16                          *FilePath,\r
   OUT EFI_FILE_HANDLE           *FileHandle,\r
   IN UINT64                     OpenMode,\r
   IN UINT64                            Attributes\r
@@ -157,21 +157,21 @@ ShellOpenFileByName(
   @retval EFI_NOT_FOUND                The specified file could not be found on the \r
                                 device or the file system could not be found \r
                                 on the device.\r
-  @retval EFI_NO_MEDIA         The device has no medium.\r
-  @retval EFI_MEDIA_CHANGED    The device has a different medium in it or the \r
+  @retval EFI_NO_MEDIA               The device has no medium.\r
+  @retval EFI_MEDIA_CHANGED        The device has a different medium in it or the \r
                                 medium is no longer supported.\r
-  @retval EFI_DEVICE_ERROR     The device reported an error.\r
+  @retval EFI_DEVICE_ERROR         The device reported an error.\r
   @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
-  @retval EFI_WRITE_PROTECTED  The file or medium is write protected.\r
-  @retval EFI_ACCESS_DENIED    The file was opened read only.\r
+  @retval EFI_WRITE_PROTECTED    The file or medium is write protected.\r
+  @retval EFI_ACCESS_DENIED        The file was opened read only.\r
   @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the \r
                                 file.\r
-  @retval EFI_VOLUME_FULL      The volume is full.\r
+  @retval EFI_VOLUME_FULL            The volume is full.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ShellCreateDirectory(\r
-  IN CHAR16                   *DirectoryName,\r
+  IN CONST CHAR16             *DirectoryName,\r
   OUT EFI_FILE_HANDLE         *FileHandle\r
   );\r
 \r
@@ -198,11 +198,11 @@ ShellCreateDirectory(
 \r
   @param 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
- @retval EFI_DEVICE_ERROR      The device reported an error.\r
- @retval EFI_VOLUME_CORRUPTED  The file system structures are corrupted.\r
- @retval EFI_BUFFER_TO_SMALL   Buffer is too small. ReadSize contains required \r
+ @retval EFI_SUCCESS             Data was read.\r
+ @retval EFI_NO_MEDIA            The device has no media.\r
+ @retval EFI_DEVICE_ERROR            The device reported an error.\r
+ @retval EFI_VOLUME_CORRUPTED    The file system structures are corrupted.\r
+ @retval EFI_BUFFER_TO_SMALL     Buffer is too small. ReadSize contains required \r
                                 size.\r
 \r
 **/\r
@@ -232,13 +232,13 @@ ShellReadFile(
   @param 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
+ @retval EFI_UNSUPPORTED           Writes to an open directory are not supported.\r
  @retval EFI_NO_MEDIA          The device has no media.\r
- @retval EFI_DEVICE_ERROR      The device reported an error.\r
+ @retval EFI_DEVICE_ERROR          The device reported an error.\r
  @retval EFI_VOLUME_CORRUPTED  The file system structures are corrupted.\r
  @retval EFI_WRITE_PROTECTED   The device is write-protected.\r
- @retval EFI_ACCESS_DENIED     The file was open for read only.\r
- @retval EFI_VOLUME_FULL       The volume is full.\r
+ @retval EFI_ACCESS_DENIED       The file was open for read only.\r
+ @retval EFI_VOLUME_FULL           The volume is full.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -455,7 +455,7 @@ ShellGetExecutionBreakFlag(
 CONST CHAR16*\r
 EFIAPI\r
 ShellGetEnvironmentVariable (\r
-  IN CHAR16                     *EnvKey\r
+  IN CONST CHAR16                *EnvKey\r
   );\r
 \r
 /**\r
@@ -566,7 +566,8 @@ ShellSetPageBreakMode (
   and will process '?' and '*' as such.  the list must be freed with a call to \r
   ShellCloseFileMetaArg().\r
 \r
-  This function will fail if called sequentially without freeing the list in the middle.\r
+  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
@@ -606,6 +607,7 @@ typedef enum {
   TypeFlag  = 0,\r
   TypeValue,\r
   TypePosition,\r
+  TypeStart,\r
   TypeMax,\r
 } ParamType;\r
 \r
@@ -645,13 +647,17 @@ extern SHELL_PARAM_ITEM EmptyParamList[];
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-ShellCommandLineParse (\r
+ShellCommandLineParseEx (\r
   IN CONST SHELL_PARAM_ITEM     *CheckList,\r
   OUT LIST_ENTRY                **CheckPackage,\r
   OUT CHAR16                    **ProblemParam OPTIONAL,\r
-  IN BOOLEAN                    AutoPageBreak\r
+  IN BOOLEAN                    AutoPageBreak,\r
+  IN BOOLEAN                    AlwaysAllowNumbers\r
   );\r
 \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
   Frees shell variable list that was returned from ShellCommandLineParse.\r
 \r
@@ -731,6 +737,20 @@ ShellCommandLineGetRawValue (
   IN UINT32                        Position\r
   );\r
 \r
+/**\r
+  returns the number of command line value parameters that were parsed.  \r
+  \r
+  this will not include flags.\r
+\r
+  @retval (UINTN)-1     No parsing has ocurred\r
+  @return other         The number of value parameters found\r
+**/\r
+UINTN\r
+EFIAPI\r
+ShellCommandLineGetCount(\r
+  VOID\r
+  );\r
+\r
 /**\r
   This function causes the shell library to initialize itself.  If the shell library\r
   is already initialized it will de-initialize all the current protocol poitners and\r
@@ -787,4 +807,59 @@ ShellPrintEx(
   ...\r
   );\r
 \r
-#endif // __SHELL_LIB__
\ No newline at end of file
+/**\r
+  Print at a specific location on the screen.\r
+\r
+  This function will move the cursor to a given screen location, print the specified string, \r
+  and return the cursor to the original locaiton.  \r
+  \r
+  If -1 is specified for either the Row or Col the current screen location for BOTH \r
+  will be used and the cursor's position will not be moved back to an original location.\r
+\r
+  if either Row or Col is out of range for the current console, then ASSERT\r
+  if Format is NULL, then ASSERT\r
+\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
+\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
+\r
+  @return the number of characters printed to the screen\r
+**/\r
+UINTN\r
+EFIAPI\r
+ShellPrintHiiEx(\r
+  IN INT32                Col OPTIONAL,\r
+  IN INT32                Row OPTIONAL,\r
+  IN CONST EFI_STRING_ID  HiiFormatStringId,\r
+  IN CONST EFI_HANDLE     HiiFormatHandle,\r
+  ...\r
+  );\r
+\r
+/**\r
+  Function to determine if a given filename represents a file or a directory.\r
+\r
+  @param[in] DirName      Path to directory to test.\r
+\r
+  @retval EFI_SUCCESS     The Path represents a directory\r
+  @retval EFI_NOT_FOUND   The Path does not represent a directory\r
+  @return other           The path failed to open\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ShellIsDirectory(\r
+  IN CONST CHAR16 *DirName\r
+  );\r
+\r
+\r
+#endif // __SHELL_LIB__\r