ShellPkg: Fix help MAN file searching

Make sure that “help App” and “help App.EFI” work the same by removing “.efi” (case insensitive) from the end of the string before searching for MAN file.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14853 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Jaben Carsey 2013-11-15 20:21:34 +00:00 committed by jcarsey
parent 12f1a36cf4
commit d233c12291
1 changed files with 15 additions and 1 deletions

View File

@ -1,7 +1,7 @@
/** @file
Provides interface to shell MAN file parser.
Copyright (c) 2009 - 2011, 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
@ -491,6 +491,20 @@ ManFileFindTitleSection(
}
StrCpy(TitleString, L".TH ");
StrCat(TitleString, Command);
//
// If the "name" ends with .efi we can safely chop that off since "help foo.efi" and "help foo"
// should produce the same results.
//
if ((StrLen(Command)> 4)
&& (TitleString[StrLen(TitleString)-1] == L'i' || TitleString[StrLen(TitleString)-1] == L'I')
&& (TitleString[StrLen(TitleString)-2] == L'f' || TitleString[StrLen(TitleString)-2] == L'F')
&& (TitleString[StrLen(TitleString)-3] == L'e' || TitleString[StrLen(TitleString)-2] == L'E')
&& (TitleString[StrLen(TitleString)-4] == L'.')
) {
TitleString[StrLen(TitleString)-4] = CHAR_NULL;
}
TitleLen = StrLen(TitleString);
for (;!ShellFileHandleEof(Handle);Size = 1024) {
Status = ShellFileHandleReadLine(Handle, ReadLine, &Size, TRUE, Ascii);