/** @file\r
Provides interface to shell functionality for shell commands and applications.\r
\r
- Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2006 - 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
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
+ TypeTimeValue, ///< A flag that has a time value following it (IE "-a -5:00").\r
TypeMax,\r
} SHELL_PARAM_TYPE;\r
\r
\r
@param[in] Name pointer to Name of parameter found\r
@param[in] AlwaysAllowNumbers TRUE to allow numbers, FALSE to not.\r
+ @param[in] TimeNumbers TRUE to allow numbers with ":", FALSE otherwise.\r
\r
@retval TRUE the Parameter is a flag.\r
@retval FALSE the Parameter not a flag.\r
EFIAPI\r
InternalIsFlag (\r
IN CONST CHAR16 *Name,\r
- IN BOOLEAN AlwaysAllowNumbers\r
+ IN CONST BOOLEAN AlwaysAllowNumbers,\r
+ IN CONST BOOLEAN TimeNumbers\r
)\r
{\r
//\r
//\r
// If we accept numbers then dont return TRUE. (they will be values)\r
//\r
- if (((Name[0] == L'-' || Name[0] == L'+') && InternalShellIsHexOrDecimalNumber(Name+1, FALSE, FALSE)) && AlwaysAllowNumbers) {\r
+ if (((Name[0] == L'-' || Name[0] == L'+') && InternalShellIsHexOrDecimalNumber(Name+1, FALSE, FALSE, TimeNumbers)) && AlwaysAllowNumbers) {\r
return (FALSE);\r
}\r
\r
// possibly trigger the next loop(s) to populate the value of this item\r
//\r
case TypeValue:\r
+ case TypeTimeValue:\r
GetItemValue = 1;\r
ValueSize = 0;\r
break;\r
ASSERT(GetItemValue == 0);\r
break;\r
}\r
- } else if (GetItemValue != 0 && !InternalIsFlag(Argv[LoopCounter], AlwaysAllowNumbers)) {\r
+ } else if (GetItemValue != 0 && !InternalIsFlag(Argv[LoopCounter], AlwaysAllowNumbers, CurrentItemPackage->Type == TypeTimeValue)) {\r
ASSERT(CurrentItemPackage != NULL);\r
//\r
// get the item VALUE for a previous flag\r
if (GetItemValue == 0) {\r
InsertHeadList(*CheckPackage, &CurrentItemPackage->Link);\r
}\r
- } else if (!InternalIsFlag(Argv[LoopCounter], AlwaysAllowNumbers) ){ //|| ProblemParam == NULL) {\r
+ } else if (!InternalIsFlag(Argv[LoopCounter], AlwaysAllowNumbers, FALSE)){\r
//\r
// add this one as a non-flag\r
//\r
\r
Hex = FALSE;\r
\r
- if (!InternalShellIsHexOrDecimalNumber(String, Hex, TRUE)) {\r
+ if (!InternalShellIsHexOrDecimalNumber(String, Hex, TRUE, FALSE)) {\r
Hex = TRUE;\r
}\r
\r
@param[in] String The string to evaluate.\r
@param[in] ForceHex TRUE - always assume hex.\r
@param[in] StopAtSpace TRUE to halt upon finding a space, FALSE to keep going.\r
+ @param[in] TimeNumbers TRUE to allow numbers with ":", FALSE otherwise.\r
\r
@retval TRUE It is all numeric (dec/hex) characters.\r
@retval FALSE There is a non-numeric character.\r
InternalShellIsHexOrDecimalNumber (\r
IN CONST CHAR16 *String,\r
IN CONST BOOLEAN ForceHex,\r
- IN CONST BOOLEAN StopAtSpace\r
+ IN CONST BOOLEAN StopAtSpace,\r
+ IN CONST BOOLEAN TimeNumbers\r
)\r
{\r
BOOLEAN Hex;\r
// loop through the remaining characters and use the lib function\r
//\r
for ( ; String != NULL && *String != CHAR_NULL && !(StopAtSpace && *String == L' ') ; String++){\r
+ if (TimeNumbers && (String[0] == L':')) {\r
+ continue;\r
+ }\r
if (Hex) {\r
if (!ShellIsHexaDecimalDigitCharacter(*String)) {\r
return (FALSE);\r
\r
Hex = ForceHex;\r
\r
- if (!InternalShellIsHexOrDecimalNumber(String, Hex, StopAtSpace)) {\r
+ if (!InternalShellIsHexOrDecimalNumber(String, Hex, StopAtSpace, FALSE)) {\r
if (!Hex) {\r
Hex = TRUE;\r
- if (!InternalShellIsHexOrDecimalNumber(String, Hex, StopAtSpace)) {\r
+ if (!InternalShellIsHexOrDecimalNumber(String, Hex, StopAtSpace, FALSE)) {\r
return (EFI_INVALID_PARAMETER);\r
}\r
} else {\r
//\r
// make sure we have something left that is numeric.\r
//\r
- if (Walker == NULL || *Walker == CHAR_NULL || !InternalShellIsHexOrDecimalNumber(Walker, Hex, StopAtSpace)) {\r
+ if (Walker == NULL || *Walker == CHAR_NULL || !InternalShellIsHexOrDecimalNumber(Walker, Hex, StopAtSpace, FALSE)) {\r
return (EFI_INVALID_PARAMETER);\r
}\r
\r
/** @file\r
Provides interface to shell functionality for shell commands and applications.\r
\r
- Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2006 - 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
@param[in] String The string to evaluate.\r
@param[in] ForceHex TRUE - always assume hex.\r
@param[in] StopAtSpace TRUE to halt upon finding a space, FALSE to keep going.\r
+ @param[in] TimeNumbers TRUE to allow numbers with ":", FALSE otherwise.\r
\r
@retval TRUE It is all numeric (dec/hex) characters.\r
@retval FALSE There is a non-numeric character.\r
InternalShellIsHexOrDecimalNumber (\r
IN CONST CHAR16 *String,\r
IN CONST BOOLEAN ForceHex,\r
- IN CONST BOOLEAN StopAtSpace\r
+ IN CONST BOOLEAN StopAtSpace,\r
+ IN CONST BOOLEAN TimeNumbers\r
);\r
\r
/**\r