From 284e034f4f43530e85b38c74322772e669f561d6 Mon Sep 17 00:00:00 2001 From: Chris Phillips Date: Fri, 18 Oct 2013 15:49:23 +0000 Subject: =?UTF-8?q?ShellPkg:=20Fixes=20for=20shell=20application=20launch,?= =?UTF-8?q?=20argument=20handling,=20and=20version=20output:=20-=20Fixes?= =?UTF-8?q?=20shell=20application=20launch=20version=20output=20to=20match?= =?UTF-8?q?=20=E2=80=98ver=E2=80=99=20command,=20as=20specified=20by=20the?= =?UTF-8?q?=20UEFI=20Shell=20spec.=20-=20Adds=20PcdShellSupplier=20for=20=20line=20of=20version=20output.?= =?UTF-8?q?=20=20Defaulted=20to=20=E2=80=9CEDK=20II=E2=80=9D.=20-=20Displa?= =?UTF-8?q?y=20only=201=20startup.nsh=20countdown=20line=20per=20second=20?= =?UTF-8?q?instead=20of=2010=20per=20second.=20-=20Fix=20issue=20where=20c?= =?UTF-8?q?ommand=20line=20is=20just=201=20or=20more=20=E2=80=9C=20?= =?UTF-8?q?=E2=80=9C=20characters=20and=20displayed=20garbage.=20-=20Fix?= =?UTF-8?q?=20for=20@echo=20=E2=80=93off=20and=20@echo=20=E2=80=93on=20to?= =?UTF-8?q?=20not=20restore=20echo=20state?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chris Phillips reviewed-by: Jaben Carsey git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14784 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Application/Shell/Shell.c | 62 +++++++++++++++++++++++++++++------ ShellPkg/Application/Shell/Shell.inf | 2 ++ ShellPkg/Application/Shell/Shell.uni | Bin 4588 -> 4938 bytes 3 files changed, 54 insertions(+), 10 deletions(-) (limited to 'ShellPkg/Application/Shell') diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c index 3019c7d410..e5a648833d 100644 --- a/ShellPkg/Application/Shell/Shell.c +++ b/ShellPkg/Application/Shell/Shell.c @@ -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); @@ -1892,9 +1928,15 @@ RunScriptFileHandle ( Status = RunCommand(CommandLine3+1); // - // Now restore the pre-'@' echo state. + // If command was "@echo -off" or "@echo -on" then don't restore echo state // - ShellCommandSetEchoState(PreCommandEchoState); + 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"); diff --git a/ShellPkg/Application/Shell/Shell.inf b/ShellPkg/Application/Shell/Shell.inf index c3af617430..801180ea0d 100644 --- a/ShellPkg/Application/Shell/Shell.inf +++ b/ShellPkg/Application/Shell/Shell.inf @@ -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.
# # 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 diff --git a/ShellPkg/Application/Shell/Shell.uni b/ShellPkg/Application/Shell/Shell.uni index b9ddcaed61..dae54e8c25 100644 Binary files a/ShellPkg/Application/Shell/Shell.uni and b/ShellPkg/Application/Shell/Shell.uni differ -- cgit v1.2.3