summaryrefslogtreecommitdiff
path: root/ShellPkg/Application/Shell/ShellProtocol.c
diff options
context:
space:
mode:
Diffstat (limited to 'ShellPkg/Application/Shell/ShellProtocol.c')
-rw-r--r--ShellPkg/Application/Shell/ShellProtocol.c46
1 files changed, 27 insertions, 19 deletions
diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c
index 89132969b..c619ba15a 100644
--- a/ShellPkg/Application/Shell/ShellProtocol.c
+++ b/ShellPkg/Application/Shell/ShellProtocol.c
@@ -2,7 +2,7 @@
Member functions of EFI_SHELL_PROTOCOL and functions for creation,
manipulation, and initialization of EFI_SHELL_PROTOCOL.
- Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2014, 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
@@ -1619,6 +1619,8 @@ EfiShellFreeFileList(
RemoveEntryList(&ShellFileListItem->Link);
InternalFreeShellFileInfoNode(ShellFileListItem);
}
+ InternalFreeShellFileInfoNode(*FileList);
+ *FileList = NULL;
return(EFI_SUCCESS);
}
@@ -1714,7 +1716,6 @@ InternalDuplicateShellFileInfo(
@param[in] BasePath the Path to prepend onto filename for FullPath
@param[in] Status Status member initial value.
- @param[in] FullName FullName member initial value.
@param[in] FileName FileName member initial value.
@param[in] Handle Handle member initial value.
@param[in] Info Info struct to copy.
@@ -1727,7 +1728,6 @@ EFIAPI
CreateAndPopulateShellFileInfo(
IN CONST CHAR16 *BasePath,
IN CONST EFI_STATUS Status,
- IN CONST CHAR16 *FullName,
IN CONST CHAR16 *FileName,
IN CONST SHELL_FILE_HANDLE Handle,
IN CONST EFI_FILE_INFO *Info
@@ -1836,6 +1836,7 @@ EfiShellFindFilesInDir(
Size = 0;
TempString = StrnCatGrow(&TempString, &Size, ShellFileHandleGetPath(FileDirHandle), 0);
if (TempString == NULL) {
+ SHELL_FREE_NON_NULL(BasePath);
return (EFI_OUT_OF_RESOURCES);
}
TempSpot = StrStr(TempString, L";");
@@ -1846,8 +1847,10 @@ EfiShellFindFilesInDir(
TempString = StrnCatGrow(&TempString, &Size, BasePath, 0);
if (TempString == NULL) {
+ SHELL_FREE_NON_NULL(BasePath);
return (EFI_OUT_OF_RESOURCES);
}
+ SHELL_FREE_NON_NULL(BasePath);
BasePath = TempString;
}
@@ -1862,20 +1865,14 @@ EfiShellFindFilesInDir(
; !EFI_ERROR(Status) && !NoFile
; Status = FileHandleFindNextFile(FileDirHandle, FileInfo, &NoFile)
){
- TempString = NULL;
- Size = 0;
//
// allocate a new EFI_SHELL_FILE_INFO and populate it...
//
- ASSERT((TempString == NULL && Size == 0) || (TempString != NULL));
- TempString = StrnCatGrow(&TempString, &Size, BasePath, 0);
- TempString = StrnCatGrow(&TempString, &Size, FileInfo->FileName, 0);
ShellFileListItem = CreateAndPopulateShellFileInfo(
BasePath,
- EFI_SUCCESS, // success since we didnt fail to open it...
- TempString,
+ EFI_SUCCESS, // success since we didnt fail to open it...
FileInfo->FileName,
- NULL, // no handle since not open
+ NULL, // no handle since not open
FileInfo);
if (ShellFileList == NULL) {
@@ -2769,15 +2766,33 @@ EfiShellGetHelpText(
)
{
CONST CHAR16 *ManFileName;
+ CHAR16 *FixCommand;
+ EFI_STATUS Status;
ASSERT(HelpText != NULL);
+ FixCommand = NULL;
ManFileName = ShellCommandGetManFileNameHandler(Command);
if (ManFileName != NULL) {
return (ProcessManFile(ManFileName, Command, Sections, NULL, HelpText));
} else {
- return (ProcessManFile(Command, Command, Sections, NULL, HelpText));
+ if ((StrLen(Command)> 4)
+ && (Command[StrLen(Command)-1] == L'i' || Command[StrLen(Command)-1] == L'I')
+ && (Command[StrLen(Command)-2] == L'f' || Command[StrLen(Command)-2] == L'F')
+ && (Command[StrLen(Command)-3] == L'e' || Command[StrLen(Command)-3] == L'E')
+ && (Command[StrLen(Command)-4] == L'.')
+ ) {
+ FixCommand = AllocateZeroPool(StrSize(Command) - 4 * sizeof (CHAR16));
+ ASSERT(FixCommand != NULL);
+
+ StrnCpy(FixCommand, Command, StrLen(Command)-4);
+ Status = ProcessManFile(FixCommand, FixCommand, Sections, NULL, HelpText);
+ FreePool(FixCommand);
+ return Status;
+ } else {
+ return (ProcessManFile(Command, Command, Sections, NULL, HelpText));
+ }
}
}
@@ -3279,7 +3294,6 @@ NotificationFunction(
IN EFI_KEY_DATA *KeyData
)
{
- EFI_INPUT_KEY Key;
if ( ((KeyData->Key.UnicodeChar == L'c') &&
(KeyData->KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED) || KeyData->KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED))) ||
(KeyData->Key.UnicodeChar == 3)
@@ -3292,12 +3306,6 @@ NotificationFunction(
(KeyData->KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED) || KeyData->KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED))
){
ShellInfoObject.HaltOutput = TRUE;
-
- //
- // Make sure that there are no pending keystrokes to pervent the pause.
- //
- gST->ConIn->Reset(gST->ConIn, FALSE);
- while (gST->ConIn->ReadKeyStroke (gST->ConIn, &Key)==EFI_SUCCESS);
}
return (EFI_SUCCESS);
}