From 4bbdc0e1bd5807c00a33e30dfc208e0e86b4c236 Mon Sep 17 00:00:00 2001 From: jcarsey Date: Fri, 25 Mar 2011 21:03:58 +0000 Subject: [PATCH] FileHandleLib - use standard unicode file tag. ShellCEntryLib - add #define protection. ShellCommandLib - add optional sorting of command list. ShellLib - add string-to-number with EFI_STATUS return value for verification. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11429 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Include/Library/FileHandleLib.h | 6 ++-- ShellPkg/Include/Library/ShellCEntryLib.h | 8 ++++- ShellPkg/Include/Library/ShellCommandLib.h | 8 +++-- ShellPkg/Include/Library/ShellLib.h | 38 +++++++++++++++++++--- 4 files changed, 47 insertions(+), 13 deletions(-) diff --git a/ShellPkg/Include/Library/FileHandleLib.h b/ShellPkg/Include/Library/FileHandleLib.h index 1c191ad64a..b4c2e7ddee 100644 --- a/ShellPkg/Include/Library/FileHandleLib.h +++ b/ShellPkg/Include/Library/FileHandleLib.h @@ -1,7 +1,7 @@ /** @file Provides interface to EFI_FILE_HANDLE functionality. - Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -19,9 +19,7 @@ /// The tag for use in identifying UNICODE files. /// If the file is UNICODE, the first 16 bits of the file will equal this value. -enum { - UnicodeFileTag = 0xFEFF -}; +extern CONST UINT16 gUnicodeFileTag; /** This function retrieves information about the file for the handle diff --git a/ShellPkg/Include/Library/ShellCEntryLib.h b/ShellPkg/Include/Library/ShellCEntryLib.h index f839372b39..79136a6894 100644 --- a/ShellPkg/Include/Library/ShellCEntryLib.h +++ b/ShellPkg/Include/Library/ShellCEntryLib.h @@ -1,7 +1,7 @@ /** @file Provides application point extension for "C" style main funciton. - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -12,6 +12,9 @@ **/ +#if !defined (_SHELL_C_ENTRY_LIB_) +#define _SHELL_C_ENTRY_LIB_ + /** UEFI application entry point which has an interface similar to a standard C main function. @@ -32,3 +35,6 @@ ShellAppMain ( IN UINTN Argc, IN CHAR16 **Argv ); + +#endif + diff --git a/ShellPkg/Include/Library/ShellCommandLib.h b/ShellPkg/Include/Library/ShellCommandLib.h index af16c85ef3..6edd36676b 100644 --- a/ShellPkg/Include/Library/ShellCommandLib.h +++ b/ShellPkg/Include/Library/ShellCommandLib.h @@ -4,7 +4,7 @@ This library is for use ONLY by shell commands linked into the shell application. This library will not funciton if it is used for UEFI Shell 2.0 Applications. - Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -211,12 +211,14 @@ typedef struct { via the LIST_ENTRY structure. Enumerate through it using the BaseLib linked list functions. Do not modify the values. + @param[in] Sort TRUE to alphabetically sort the values first. FALSE otherwise. + @return A linked list of all available shell commands. **/ CONST COMMAND_LIST* EFIAPI ShellCommandGetCommandList ( - VOID + IN CONST BOOLEAN Sort ); typedef struct { @@ -501,7 +503,7 @@ ShellCommandConsistMappingUnInitialize ( This must be called after ShellCommandConsistMappingInitialize() and before ShellCommandConsistMappingUnInitialize() is called. - @param[in] DeviecPath The pointer to the dev path for the device. + @param[in] DevicePath The pointer to the dev path for the device. @param[in] Table The Table of mapping information. @retval NULL A consistent mapped name could not be created. diff --git a/ShellPkg/Include/Library/ShellLib.h b/ShellPkg/Include/Library/ShellLib.h index 7a5d96157b..6061262221 100644 --- a/ShellPkg/Include/Library/ShellLib.h +++ b/ShellPkg/Include/Library/ShellLib.h @@ -1,7 +1,7 @@ /** @file Provides interface to shell functionality for shell commands and applications. - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -988,9 +988,13 @@ ShellIsFileInPath( Function to determine whether a string is decimal or hex representation of a number and return the number converted from the string. - @param[in] String String representation of a number + Note: this function cannot be used when (UINTN)(-1), (0xFFFFFFFF) may be a valid + result. Use ShellConvertStringToUint64 instead. + + @param[in] String String representation of a number. @return The unsigned integer result of the conversion. + @retval (UINTN)(-1) An error occured. **/ UINTN EFIAPI @@ -1183,11 +1187,11 @@ ShellPromptForResponse ( This function is the same as ShellPromptForResponse, except that the prompt is automatically pulled from HII. - @param Type What type of question is asked. This is used to filter the input + @param[in] Type What type of question is asked. This is used to filter the input to prevent invalid answers to question. @param[in] HiiFormatStringId The format string Id for getting from Hii. @param[in] HiiFormatHandle The format string Handle for getting from Hii. - @param Response The pointer to Response, which will be populated upon return. + @param[out] Response The pointer to Response, which will be populated upon return. @retval EFI_SUCCESS The operation was sucessful. @return other The operation failed. @@ -1206,7 +1210,7 @@ ShellPromptForResponseHii ( /** Function to determin if an entire string is a valid number. - If Hex it must be preceeded with a 0x or has ForceHex, set TRUE. + If Hex it must be preceeded with a 0x, 0X, or has ForceHex set TRUE. @param[in] String The string to evaluate. @param[in] ForceHex TRUE - always assume hex. @@ -1223,6 +1227,30 @@ ShellIsHexOrDecimalNumber ( IN CONST BOOLEAN StopAtSpace ); +/** + Function to verify and convert a string to its numerical 64 bit representation. + + If Hex it must be preceeded with a 0x, 0X, or has ForceHex set TRUE. + + @param[in] String The string to evaluate. + @param[out] Value Upon a successful return the value of the conversion. + @param[in] ForceHex TRUE - always assume hex. + @param[in] StopAtSpace TRUE to halt upon finding a space, FALSE to + process the entire String. + + @retval EFI_SUCCESS The conversion was successful. + @retval EFI_INVALID_PARAMETER String contained an invalid character. + @retval EFI_NOT_FOUND String was a number, but Value was NULL. +**/ +EFI_STATUS +EFIAPI +ShellConvertStringToUint64( + IN CONST CHAR16 *String, + OUT UINT64 *Value, + IN CONST BOOLEAN ForceHex, + IN CONST BOOLEAN StopAtSpace + ); + /** Function to determine if a given filename exists.