]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellLevel1CommandsLib/Exit.c
ShellPkg: Update Level1 profile commands response output
[mirror_edk2.git] / ShellPkg / Library / UefiShellLevel1CommandsLib / Exit.c
index 2f2a5bf56580da6b17815affa1108588a941d603..d8e6adca7f139ed9b31c33f6611eefd4bc25c797 100644 (file)
@@ -1,7 +1,8 @@
 /** @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) 2015, Hewlett-Packard Development Company, L.P.<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 +37,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
@@ -54,7 +57,7 @@ ShellCommandRunExit (
   Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);\r
   if (EFI_ERROR(Status)) {\r
     if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel1HiiHandle, ProblemParam);\r
+      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel1HiiHandle, L"exit", ProblemParam);\r
       FreePool(ProblemParam);\r
       ShellStatus = SHELL_INVALID_PARAMETER;\r
     } else {\r
@@ -62,16 +65,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_PARAM_INV), gShellLevel1HiiHandle, L"exit", 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")), RetVal);\r
+\r
+        ShellStatus = SHELL_SUCCESS;\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")), 0);\r
+\r
+      ShellStatus = SHELL_SUCCESS;\r
     }\r
 \r
     ShellCommandLineFreeVarList (Package);\r