]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: make automatically created shells quit automatically
authorjaben carsey <jaben.carsey@intel.com>
Thu, 27 Jun 2013 16:11:39 +0000 (16:11 +0000)
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 27 Jun 2013 16:11:39 +0000 (16:11 +0000)
This creates a new parameter to this shell implementation “_exit” that causes the shell to automatically exit after running the initial specified command line.  This also automatically uses that command in the Execute() API.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: jaben carsey <jaben.carsey@intel.com>
Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hp.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14444 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Application/Shell/Shell.c
ShellPkg/Application/Shell/Shell.h
ShellPkg/Application/Shell/ShellProtocol.c

index b6b54efb5eacf25cc10fab70c14a0617c9dd7ebd..00c7bb58cf326b2aa5736f919c3364f1fdf15476 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   This is THE shell (application)\r
 \r
 /** @file\r
   This is THE shell (application)\r
 \r
-  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2013, 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
   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
@@ -381,7 +381,7 @@ UefiMain (
         Status = DoStartupScript(ShellInfoObject.ImageDevPath, ShellInfoObject.FileDevPath);\r
       }\r
 \r
         Status = DoStartupScript(ShellInfoObject.ImageDevPath, ShellInfoObject.FileDevPath);\r
       }\r
 \r
-      if (!ShellCommandGetExit() && (PcdGet8(PcdShellSupportLevel) >= 3 || PcdGetBool(PcdShellForceConsole)) && !EFI_ERROR(Status) && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn) {\r
+      if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.Exit && !ShellCommandGetExit() && (PcdGet8(PcdShellSupportLevel) >= 3 || PcdGetBool(PcdShellForceConsole)) && !EFI_ERROR(Status) && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn) {\r
         //\r
         // begin the UI waiting loop\r
         //\r
         //\r
         // begin the UI waiting loop\r
         //\r
@@ -642,6 +642,7 @@ STATIC CONST SHELL_PARAM_ITEM mShellParamList[] = {
   {L"-noversion",     TypeFlag},\r
   {L"-startup",       TypeFlag},\r
   {L"-delay",         TypeValue},\r
   {L"-noversion",     TypeFlag},\r
   {L"-startup",       TypeFlag},\r
   {L"-delay",         TypeValue},\r
+  {L"-_exit",         TypeFlag},\r
   {NULL, TypeMax}\r
   };\r
 \r
   {NULL, TypeMax}\r
   };\r
 \r
@@ -749,6 +750,7 @@ ProcessCommandLine(
   ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoMap        = ShellCommandLineGetFlag(Package, L"-nomap");\r
   ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoVersion    = ShellCommandLineGetFlag(Package, L"-noversion");\r
   ShellInfoObject.ShellInitSettings.BitUnion.Bits.Delay        = ShellCommandLineGetFlag(Package, L"-delay");\r
   ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoMap        = ShellCommandLineGetFlag(Package, L"-nomap");\r
   ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoVersion    = ShellCommandLineGetFlag(Package, L"-noversion");\r
   ShellInfoObject.ShellInitSettings.BitUnion.Bits.Delay        = ShellCommandLineGetFlag(Package, L"-delay");\r
+  ShellInfoObject.ShellInitSettings.BitUnion.Bits.Exit         = ShellCommandLineGetFlag(Package, L"-_exit");\r
 \r
   ShellInfoObject.ShellInitSettings.Delay = 5;\r
 \r
 \r
   ShellInfoObject.ShellInitSettings.Delay = 5;\r
 \r
index da98fc1a56d0e4efb48c93235f4c163165efb876..2ed05b8a1c566f23a9793dc9071259c5d2562ac1 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   function definitions for internal to shell functions.\r
 \r
 /** @file\r
   function definitions for internal to shell functions.\r
 \r
-  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2013, 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
   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
@@ -71,7 +71,8 @@ typedef struct {
   UINT32  NoMap:1;        ///< Was "-nomap"         found on command line.\r
   UINT32  NoVersion:1;    ///< Was "-noversion"     found on command line.\r
   UINT32  Delay:1;        ///< Was "-delay[:n]      found on command line\r
   UINT32  NoMap:1;        ///< Was "-nomap"         found on command line.\r
   UINT32  NoVersion:1;    ///< Was "-noversion"     found on command line.\r
   UINT32  Delay:1;        ///< Was "-delay[:n]      found on command line\r
-  UINT32  Reserved:8;     ///< Extra bits\r
+  UINT32  Exit:1;         ///< Was "-_exit"          found on command line\r
+  UINT32  Reserved:7;     ///< Extra bits\r
 } SHELL_BITS;\r
 \r
 typedef union {\r
 } SHELL_BITS;\r
 \r
 typedef union {\r
index c5b836aaf9e1a28585766cfe2b7197bb431423cc..df4874a23cf0df1fed392f27e23731c9bf9eda2d 100644 (file)
@@ -2,7 +2,7 @@
   Member functions of EFI_SHELL_PROTOCOL and functions for creation,\r
   manipulation, and initialization of EFI_SHELL_PROTOCOL.\r
 \r
   Member functions of EFI_SHELL_PROTOCOL and functions for creation,\r
   manipulation, and initialization of EFI_SHELL_PROTOCOL.\r
 \r
-  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2013, 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
   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
@@ -1594,7 +1594,7 @@ EfiShellExecute(
   Temp = NULL;\r
   Size = 0;\r
   ASSERT((Temp == NULL && Size == 0) || (Temp != NULL));\r
   Temp = NULL;\r
   Size = 0;\r
   ASSERT((Temp == NULL && Size == 0) || (Temp != NULL));\r
-  StrnCatGrow(&Temp, &Size, L"Shell.efi ", 0);\r
+  StrnCatGrow(&Temp, &Size, L"Shell.efi -_exit ", 0);\r
   StrnCatGrow(&Temp, &Size, CommandLine, 0);\r
 \r
   Status = InternalShellExecuteDevicePath(\r
   StrnCatGrow(&Temp, &Size, CommandLine, 0);\r
 \r
   Status = InternalShellExecuteDevicePath(\r