Revision: 14444
          http://sourceforge.net/p/edk2/code/14444
Author:   jcarsey
Date:     2013-06-27 16:11:39 +0000 (Thu, 27 Jun 2013)
Log Message:
-----------
ShellPkg: make automatically created shells quit automatically

This creates a new parameter to this shell implementation 
?\226?\128?\156_exit?\226?\128?\157 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 <[email protected]>
Reviewed-by: Samer El-Haj-Mahmoud <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ShellPkg/Application/Shell/Shell.c
    trunk/edk2/ShellPkg/Application/Shell/Shell.h
    trunk/edk2/ShellPkg/Application/Shell/ShellProtocol.c

Modified: trunk/edk2/ShellPkg/Application/Shell/Shell.c
===================================================================
--- trunk/edk2/ShellPkg/Application/Shell/Shell.c       2013-06-27 05:07:29 UTC 
(rev 14443)
+++ trunk/edk2/ShellPkg/Application/Shell/Shell.c       2013-06-27 16:11:39 UTC 
(rev 14444)
@@ -1,7 +1,7 @@
 /** @file
   This is THE shell (application)
 
-  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2013, 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
@@ -381,7 +381,7 @@
         Status = DoStartupScript(ShellInfoObject.ImageDevPath, 
ShellInfoObject.FileDevPath);
       }
 
-      if (!ShellCommandGetExit() && (PcdGet8(PcdShellSupportLevel) >= 3 || 
PcdGetBool(PcdShellForceConsole)) && !EFI_ERROR(Status) && 
!ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn) {
+      if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.Exit && 
!ShellCommandGetExit() && (PcdGet8(PcdShellSupportLevel) >= 3 || 
PcdGetBool(PcdShellForceConsole)) && !EFI_ERROR(Status) && 
!ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn) {
         //
         // begin the UI waiting loop
         //
@@ -642,6 +642,7 @@
   {L"-noversion",     TypeFlag},
   {L"-startup",       TypeFlag},
   {L"-delay",         TypeValue},
+  {L"-_exit",         TypeFlag},
   {NULL, TypeMax}
   };
 
@@ -749,6 +750,7 @@
   ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoMap        = 
ShellCommandLineGetFlag(Package, L"-nomap");
   ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoVersion    = 
ShellCommandLineGetFlag(Package, L"-noversion");
   ShellInfoObject.ShellInitSettings.BitUnion.Bits.Delay        = 
ShellCommandLineGetFlag(Package, L"-delay");
+  ShellInfoObject.ShellInitSettings.BitUnion.Bits.Exit         = 
ShellCommandLineGetFlag(Package, L"-_exit");
 
   ShellInfoObject.ShellInitSettings.Delay = 5;
 

Modified: trunk/edk2/ShellPkg/Application/Shell/Shell.h
===================================================================
--- trunk/edk2/ShellPkg/Application/Shell/Shell.h       2013-06-27 05:07:29 UTC 
(rev 14443)
+++ trunk/edk2/ShellPkg/Application/Shell/Shell.h       2013-06-27 16:11:39 UTC 
(rev 14444)
@@ -1,7 +1,7 @@
 /** @file
   function definitions for internal to shell functions.
 
-  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2013, 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
@@ -71,7 +71,8 @@
   UINT32  NoMap:1;        ///< Was "-nomap"         found on command line.
   UINT32  NoVersion:1;    ///< Was "-noversion"     found on command line.
   UINT32  Delay:1;        ///< Was "-delay[:n]      found on command line
-  UINT32  Reserved:8;     ///< Extra bits
+  UINT32  Exit:1;         ///< Was "-_exit"          found on command line
+  UINT32  Reserved:7;     ///< Extra bits
 } SHELL_BITS;
 
 typedef union {

Modified: trunk/edk2/ShellPkg/Application/Shell/ShellProtocol.c
===================================================================
--- trunk/edk2/ShellPkg/Application/Shell/ShellProtocol.c       2013-06-27 
05:07:29 UTC (rev 14443)
+++ trunk/edk2/ShellPkg/Application/Shell/ShellProtocol.c       2013-06-27 
16:11:39 UTC (rev 14444)
@@ -2,7 +2,7 @@
   Member functions of EFI_SHELL_PROTOCOL and functions for creation,
   manipulation, and initialization of EFI_SHELL_PROTOCOL.
 
-  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2013, 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
@@ -1594,7 +1594,7 @@
   Temp = NULL;
   Size = 0;
   ASSERT((Temp == NULL && Size == 0) || (Temp != NULL));
-  StrnCatGrow(&Temp, &Size, L"Shell.efi ", 0);
+  StrnCatGrow(&Temp, &Size, L"Shell.efi -_exit ", 0);
   StrnCatGrow(&Temp, &Size, CommandLine, 0);
 
   Status = InternalShellExecuteDevicePath(

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to