From d233c1229161480fb7ba1407962172436fdc4f2c Mon Sep 17 00:00:00 2001 From: Jaben Carsey Date: Fri, 15 Nov 2013 20:21:34 +0000 Subject: =?UTF-8?q?ShellPkg:=20Fix=20help=20MAN=20file=20searching=20Make?= =?UTF-8?q?=20sure=20that=20=E2=80=9Chelp=20App=E2=80=9D=20and=20=E2=80=9C?= =?UTF-8?q?help=20App.EFI=E2=80=9D=20work=20the=20same=20by=20removing=20?= =?UTF-8?q?=E2=80=9C.efi=E2=80=9D=20(case=20insensitive)=20from=20the=20en?= =?UTF-8?q?d=20of=20the=20string=20before=20searching=20for=20MAN=20file.?= 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: Jaben Carsey Reviewed-by: Erik Bjorge git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14853 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Application/Shell/ShellManParser.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3