ShellPkg: Fix ASCII input redirection does not work correctly.
When executing 'ls -b <a arg.txt' Shell cannot get the ASCII char in 'arg.txt' correctly. This patch updates the file read buffer size when read from ASCII file to fix the bug. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qiu Shumin <shumin.qiu@intel.com> Signed-off-by: Felix Poludov <Felixp@ami.com> Signed-off-by: Oleksiy Yakovlev <Oleksiyy@ami.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18609 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
Function definitions for shell simple text in and out on top of file handles.
|
||||
|
||||
(C) Copyright 2013 Hewlett-Packard Development Company, L.P.<BR>
|
||||
Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2010 - 2015, 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
|
||||
@ -15,6 +15,8 @@
|
||||
|
||||
#include "Shell.h"
|
||||
|
||||
extern BOOLEAN AsciiRedirection;
|
||||
|
||||
typedef struct {
|
||||
EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleTextIn;
|
||||
SHELL_FILE_HANDLE FileHandle;
|
||||
@ -81,6 +83,7 @@ FileBasedSimpleTextInReadKeyStroke(
|
||||
)
|
||||
{
|
||||
UINTN Size;
|
||||
UINTN CharSize;
|
||||
|
||||
//
|
||||
// Verify the parameters
|
||||
@ -98,11 +101,16 @@ FileBasedSimpleTextInReadKeyStroke(
|
||||
|
||||
Size = sizeof(CHAR16);
|
||||
|
||||
if(!AsciiRedirection) {
|
||||
CharSize = sizeof(CHAR16);
|
||||
} else {
|
||||
CharSize = sizeof(CHAR8);
|
||||
}
|
||||
//
|
||||
// Decrement the amount of free space by Size or set to zero (for odd length files)
|
||||
//
|
||||
if (((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)This)->RemainingBytesOfInputFile > Size) {
|
||||
((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)This)->RemainingBytesOfInputFile -= Size;
|
||||
if (((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)This)->RemainingBytesOfInputFile > CharSize) {
|
||||
((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)This)->RemainingBytesOfInputFile -= CharSize;
|
||||
} else {
|
||||
((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)This)->RemainingBytesOfInputFile = 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user