/** @file\r
Main file for If and else shell level 1 function.\r
\r
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+ (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>\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
\r
#include "UefiShellLevel1CommandsLib.h"\r
#include <Library/PrintLib.h>\r
-#include <Library/PathLib.h>\r
\r
typedef enum {\r
EndTagOr,\r
}\r
}\r
return (FALSE);\r
- break;\r
case OperatorUnsignedLessThan:\r
case OperatorLessThan:\r
if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) {\r
\r
}\r
return (FALSE);\r
- break;\r
case OperatorEqual:\r
if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) {\r
//\r
}\r
}\r
return (FALSE);\r
- break;\r
case OperatorNotEqual:\r
if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) {\r
//\r
}\r
}\r
return (FALSE);\r
- break;\r
case OperatorUnsignedGreaterOrEqual:\r
case OperatorGreatorOrEqual:\r
if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) {\r
}\r
}\r
return (FALSE);\r
- break;\r
case OperatorLessOrEqual:\r
case OperatorUnsignedLessOrEqual:\r
if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) {\r
}\r
}\r
return (FALSE);\r
- break;\r
default:\r
ASSERT(FALSE);\r
return (FALSE);\r
continue;\r
}\r
CommandWalker = CommandName;\r
- while (CommandWalker[0] == L' ') {\r
+\r
+ //\r
+ // Skip leading spaces and tabs.\r
+ //\r
+ while ((CommandWalker[0] == L' ') || (CommandWalker[0] == L'\t')) {\r
CommandWalker++;\r
}\r
TempLocation = StrStr(CommandWalker, L" ");\r
ASSERT_EFI_ERROR(Status);\r
\r
if (!gEfiShellProtocol->BatchIsActive()) {\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"If");\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"if"); \r
return (SHELL_UNSUPPORTED);\r
}\r
\r
if (gEfiShellParametersProtocol->Argc < 3) {\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel1HiiHandle);\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel1HiiHandle, L"if"); \r
return (SHELL_INVALID_PARAMETER);\r
}\r
\r
NULL, \r
STRING_TOKEN (STR_SYNTAX_NO_MATCHING), \r
gShellLevel1HiiHandle, \r
- L"EnfIf", \r
+ L"EndIf", \r
L"If", \r
CurrentScriptFile!=NULL \r
&& CurrentScriptFile->CurrentCommand!=NULL\r
// we are at the then\r
//\r
if (CurrentParameter+1 != gEfiShellParametersProtocol->Argc) {\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TEXT_AFTER_THEN), gShellLevel1HiiHandle);\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TEXT_AFTER_THEN), gShellLevel1HiiHandle, L"if"); \r
ShellStatus = SHELL_INVALID_PARAMETER;\r
} else {\r
Status = PerformResultOperation(CurrentValue);\r
if (EFI_ERROR(Status)) {\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_AFTER_BAD), gShellLevel1HiiHandle, gEfiShellParametersProtocol->Argv[CurrentParameter]);\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_AFTER_BAD), gShellLevel1HiiHandle, L"if", gEfiShellParametersProtocol->Argv[CurrentParameter]); \r
ShellStatus = SHELL_INVALID_PARAMETER;\r
}\r
}\r
if ((Ending == EndTagOr && CurrentValue) || (Ending == EndTagAnd && !CurrentValue)) {\r
Status = PerformResultOperation(CurrentValue);\r
if (EFI_ERROR(Status)) {\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_AFTER_BAD), gShellLevel1HiiHandle, gEfiShellParametersProtocol->Argv[CurrentParameter]);\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_AFTER_BAD), gShellLevel1HiiHandle, L"if", gEfiShellParametersProtocol->Argv[CurrentParameter]); \r
ShellStatus = SHELL_INVALID_PARAMETER;\r
}\r
break;\r
ASSERT_EFI_ERROR(CommandInit());\r
\r
if (gEfiShellParametersProtocol->Argc > 1) {\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle);\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"if"); \r
return (SHELL_INVALID_PARAMETER);\r
}\r
\r
ASSERT_EFI_ERROR(CommandInit());\r
\r
if (gEfiShellParametersProtocol->Argc > 1) {\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle);\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"if"); \r
return (SHELL_INVALID_PARAMETER);\r
}\r
\r