]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellLevel1CommandsLib/Exit.c
Updating level 1 commands.
[mirror_edk2.git] / ShellPkg / Library / UefiShellLevel1CommandsLib / Exit.c
index 2f2a5bf56580da6b17815affa1108588a941d603..5620d023b1223ac05e32d5a9bc330343ce137a8b 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Main file for exit shell level 1 function.\r
 \r
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2011, 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
@@ -36,6 +36,8 @@ ShellCommandRunExit (
   LIST_ENTRY          *Package;\r
   CHAR16              *ProblemParam;\r
   SHELL_STATUS        ShellStatus;\r
+  UINT64              RetVal;\r
+  CONST CHAR16        *Return;\r
 \r
   ShellStatus         = SHELL_SUCCESS;\r
 \r
@@ -62,16 +64,29 @@ ShellCommandRunExit (
     }\r
   } else {\r
 \r
-    //\r
-    // If we are in a batch file and /b then pass TRUE otherwise false...\r
-    //\r
-    ShellCommandRegisterExit((BOOLEAN)(gEfiShellProtocol->BatchIsActive() && ShellCommandLineGetFlag(Package, L"/b")));\r
-\r
     //\r
     // return the specified error code\r
     //\r
-    if (ShellCommandLineGetRawValue(Package, 1) != NULL) {\r
-      ShellStatus = (SHELL_STATUS)(ShellStrToUintn(ShellCommandLineGetRawValue(Package, 1)));\r
+    Return = ShellCommandLineGetRawValue(Package, 1);\r
+    if (Return != NULL) {\r
+      Status = ShellConvertStringToUint64(Return, &RetVal, FALSE, FALSE);\r
+      if (EFI_ERROR(Status)) {\r
+        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel1HiiHandle, Return);\r
+        ShellStatus = SHELL_INVALID_PARAMETER;\r
+      } else {\r
+        //\r
+        // If we are in a batch file and /b then pass TRUE otherwise false...\r
+        //\r
+        ShellCommandRegisterExit((BOOLEAN)(gEfiShellProtocol->BatchIsActive() && ShellCommandLineGetFlag(Package, L"/b")));\r
+\r
+        ShellStatus = (SHELL_STATUS)(RetVal);\r
+      }\r
+    } else {\r
+      // If we are in a batch file and /b then pass TRUE otherwise false...\r
+      //\r
+      ShellCommandRegisterExit((BOOLEAN)(gEfiShellProtocol->BatchIsActive() && ShellCommandLineGetFlag(Package, L"/b")));\r
+\r
+      ShellStatus = (SHELL_STATUS)0;\r
     }\r
 \r
     ShellCommandLineFreeVarList (Package);\r