ShellPkg: Fixes for shell application launch, argument handling, and version output:

- Fixes shell application launch version output to match ‘ver’ command, as specified by the UEFI Shell spec.
- Adds PcdShellSupplier for <shell-supplier-specific-data> line of version output.  Defaulted to “EDK II”.
- Display only 1 startup.nsh countdown line per second instead of 10 per second.
- Fix issue where command line is just 1 or more “ “ characters and displayed garbage.
- Fix for @echo –off and @echo –on to not restore echo state

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chris Phillips <chrisp@hp.com>
reviewed-by: Jaben Carsey <Jaben.Carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14784 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Chris Phillips 2013-10-18 15:49:23 +00:00 committed by jcarsey
parent 03b08d7a06
commit 284e034f4f
7 changed files with 66 additions and 14 deletions

View File

@ -297,11 +297,28 @@ UefiMain (
0,
gST->ConOut->Mode->CursorRow,
NULL,
STRING_TOKEN (STR_VER_OUTPUT_MAIN),
STRING_TOKEN (STR_VER_OUTPUT_MAIN_SHELL),
ShellInfoObject.HiiHandle,
SupportLevel[PcdGet8(PcdShellSupportLevel)],
gEfiShellProtocol->MajorVersion,
gEfiShellProtocol->MinorVersion,
gEfiShellProtocol->MinorVersion
);
ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_VER_OUTPUT_MAIN_SUPPLIER),
ShellInfoObject.HiiHandle,
(CHAR16 *) PcdGetPtr (PcdShellSupplier)
);
ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_VER_OUTPUT_MAIN_UEFI),
ShellInfoObject.HiiHandle,
(gST->Hdr.Revision&0xffff0000)>>16,
(gST->Hdr.Revision&0x0000ffff),
gST->FirmwareVendor,
@ -840,12 +857,12 @@ DoStartupScript(
//
// print out our warning and see if they press a key
//
for ( Status = EFI_UNSUPPORTED, Delay = ShellInfoObject.ShellInitSettings.Delay * 10
for ( Status = EFI_UNSUPPORTED, Delay = ShellInfoObject.ShellInitSettings.Delay
; Delay != 0 && EFI_ERROR(Status)
; Delay--
){
ShellPrintHiiEx(0, gST->ConOut->Mode->CursorRow, NULL, STRING_TOKEN (STR_SHELL_STARTUP_QUESTION), ShellInfoObject.HiiHandle, Delay/10);
gBS->Stall (100000);
ShellPrintHiiEx(0, gST->ConOut->Mode->CursorRow, NULL, STRING_TOKEN (STR_SHELL_STARTUP_QUESTION), ShellInfoObject.HiiHandle, Delay);
gBS->Stall (1000000);
if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn) {
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
}
@ -1396,13 +1413,32 @@ RunCommand(
if (CleanOriginal == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
while (CleanOriginal[StrLen(CleanOriginal)-1] == L' ') {
CleanOriginal[StrLen(CleanOriginal)-1] = CHAR_NULL;
}
//
// Remove any spaces at the beginning of the string.
//
while (CleanOriginal[0] == L' ') {
CopyMem(CleanOriginal, CleanOriginal+1, StrSize(CleanOriginal) - sizeof(CleanOriginal[0]));
}
//
// Handle case that passed in command line is just 1 or more " " characters.
//
if (StrLen (CleanOriginal) == 0) {
if (CleanOriginal != NULL) {
FreePool(CleanOriginal);
CleanOriginal = NULL;
}
return (EFI_SUCCESS);
}
//
// Remove any spaces at the end of the string.
//
while (CleanOriginal[StrLen(CleanOriginal)-1] == L' ') {
CleanOriginal[StrLen(CleanOriginal)-1] = CHAR_NULL;
}
CommandName = NULL;
if (StrStr(CleanOriginal, L" ") == NULL){
StrnCatGrow(&CommandName, NULL, CleanOriginal, 0);
@ -1891,10 +1927,16 @@ RunScriptFileHandle (
ShellCommandSetEchoState(FALSE);
Status = RunCommand(CommandLine3+1);
//
// If command was "@echo -off" or "@echo -on" then don't restore echo state
//
if (StrCmp (L"@echo -off", CommandLine3) != 0 &&
StrCmp (L"@echo -on", CommandLine3) != 0) {
//
// Now restore the pre-'@' echo state.
//
ShellCommandSetEchoState(PreCommandEchoState);
}
} else {
if (ShellCommandGetEchoState()) {
CurDir = ShellInfoObject.NewEfiShellProtocol->GetEnv(L"cwd");

View File

@ -1,6 +1,7 @@
## @file
# This is the shell application
#
# Copyright (c) 2013, Hewlett-Packard Development Company, L.P.
# Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
@ -106,4 +107,5 @@
gEfiShellPkgTokenSpaceGuid.PcdShellMapNameLength # ALWAYS_CONSUMED
gEfiShellPkgTokenSpaceGuid.PcdShellPrintBufferSize # ALWAYS_CONSUMED
gEfiShellPkgTokenSpaceGuid.PcdShellForceConsole # ALWAYS_CONSUMED
gEfiShellPkgTokenSpaceGuid.PcdShellSupplier # ALWAYS_CONSUMED

Binary file not shown.

View File

@ -2,6 +2,7 @@
# Provides shell level 3 functions
# Note that the interactive versions of the time, date, and timezone functions are handled in the level 2 library.
#
# Copyright (c) 2013, Hewlett-Packard Development Company, L.P.
# Copyright (c) 2009-2011, Intel Corporation. All rights reserved. <BR>
#
# This program and the accompanying materials
@ -66,4 +67,5 @@
[Pcd.common]
gEfiShellPkgTokenSpaceGuid.PcdShellSupportLevel
gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize
gEfiShellPkgTokenSpaceGuid.PcdShellSupplier

View File

@ -1,6 +1,7 @@
/** @file
Main file for Ver shell level 3 function.
Copyright (c) 2013, Hewlett-Packard Development Company, L.P.
Copyright (c) 2009 - 2010, 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
@ -108,8 +109,9 @@ ShellCommandRunVer (
-1,
-1,
NULL,
STRING_TOKEN (STR_VER_EXTRA_STRING),
gShellLevel3HiiHandle
STRING_TOKEN (STR_VER_OUTPUT_SUPPLIER),
gShellLevel3HiiHandle,
(CHAR16 *) PcdGetPtr (PcdShellSupplier)
);

View File

@ -2,6 +2,7 @@
#
# This Package provides all definitions for EFI and UEFI Shell
#
# Copyright (c) 2013, Hewlett-Packard Development Company, L.P.
# Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available under
@ -119,3 +120,6 @@
## this flag determins the default number of screens kept for history log.
# the spec defines 3 as the minimum
gEfiShellPkgTokenSpaceGuid.PcdShellScreenLogCount|3|UINT8|0x00000008
## Unicode string of the shell supplier
gEfiShellPkgTokenSpaceGuid.PcdShellSupplier|L"EDK II"|VOID*|0x00000010