diff --git a/ShellPkg/Application/Shell/ShellManParser.c b/ShellPkg/Application/Shell/ShellManParser.c index 470f51a8ea..8196a6ac9d 100644 --- a/ShellPkg/Application/Shell/ShellManParser.c +++ b/ShellPkg/Application/Shell/ShellManParser.c @@ -1,7 +1,7 @@ /** @file Provides interface to shell MAN file parser. - Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.
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);