diff options
author | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-03-25 20:43:03 +0000 |
---|---|---|
committer | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-03-25 20:43:03 +0000 |
commit | 77dcec128bde3e7f0db64d60501b5a072f9f0e8f (patch) | |
tree | 6ae0989456c54301f7c3d35f146316e3eae49324 /ShellPkg/Library/UefiShellLevel1CommandsLib/Exit.c | |
parent | a47c681fc0fd1c2ebc08973a4742f0188eafcf44 (diff) | |
download | edk2-platforms-77dcec128bde3e7f0db64d60501b5a072f9f0e8f.tar.xz |
Updating level 1 commands.
exit - correctly convert the parameter to the return code.
for - update string-to-number conversion.
if - use shell string-to-number conversion and add comments.
stall- add command
main lib files:
add comments, clarify user visible strings, add stall.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11420 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Library/UefiShellLevel1CommandsLib/Exit.c')
-rw-r--r-- | ShellPkg/Library/UefiShellLevel1CommandsLib/Exit.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/Exit.c b/ShellPkg/Library/UefiShellLevel1CommandsLib/Exit.c index 2f2a5bf565..5620d023b1 100644 --- a/ShellPkg/Library/UefiShellLevel1CommandsLib/Exit.c +++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/Exit.c @@ -1,7 +1,7 @@ /** @file
Main file for exit shell level 1 function.
- Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
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
@@ -36,6 +36,8 @@ ShellCommandRunExit ( LIST_ENTRY *Package;
CHAR16 *ProblemParam;
SHELL_STATUS ShellStatus;
+ UINT64 RetVal;
+ CONST CHAR16 *Return;
ShellStatus = SHELL_SUCCESS;
@@ -63,15 +65,28 @@ ShellCommandRunExit ( } else {
//
- // If we are in a batch file and /b then pass TRUE otherwise false...
- //
- ShellCommandRegisterExit((BOOLEAN)(gEfiShellProtocol->BatchIsActive() && ShellCommandLineGetFlag(Package, L"/b")));
-
- //
// return the specified error code
//
- if (ShellCommandLineGetRawValue(Package, 1) != NULL) {
- ShellStatus = (SHELL_STATUS)(ShellStrToUintn(ShellCommandLineGetRawValue(Package, 1)));
+ Return = ShellCommandLineGetRawValue(Package, 1);
+ if (Return != NULL) {
+ Status = ShellConvertStringToUint64(Return, &RetVal, FALSE, FALSE);
+ if (EFI_ERROR(Status)) {
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel1HiiHandle, Return);
+ ShellStatus = SHELL_INVALID_PARAMETER;
+ } else {
+ //
+ // If we are in a batch file and /b then pass TRUE otherwise false...
+ //
+ ShellCommandRegisterExit((BOOLEAN)(gEfiShellProtocol->BatchIsActive() && ShellCommandLineGetFlag(Package, L"/b")));
+
+ ShellStatus = (SHELL_STATUS)(RetVal);
+ }
+ } else {
+ // If we are in a batch file and /b then pass TRUE otherwise false...
+ //
+ ShellCommandRegisterExit((BOOLEAN)(gEfiShellProtocol->BatchIsActive() && ShellCommandLineGetFlag(Package, L"/b")));
+
+ ShellStatus = (SHELL_STATUS)0;
}
ShellCommandLineFreeVarList (Package);
|