From 42f75495f3a89f30747406f7bf8fec9919da7b28 Mon Sep 17 00:00:00 2001 From: Shumin Qiu Date: Mon, 9 Dec 2013 02:24:39 +0000 Subject: =?UTF-8?q?Follow=20Shell=20specification=20to=20make=20sure=20the?= =?UTF-8?q?=20=E2=80=9Ccommand.man=E2=80=9D=20file=20is=20always=20used=20?= =?UTF-8?q?no=20matter=20=E2=80=9Ccommand.efi=20-=3F=E2=80=9D=20or=20=20?= =?UTF-8?q?=E2=80=9Ccommand=20-=3F=E2=80=9D=20is=20typed.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Shumin Qiu Reviewed-by: Jaben Carsey git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14947 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Application/Shell/ShellProtocol.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'ShellPkg/Application/Shell/ShellProtocol.c') diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c index 89132969b6..ea30aaefc3 100644 --- a/ShellPkg/Application/Shell/ShellProtocol.c +++ b/ShellPkg/Application/Shell/ShellProtocol.c @@ -2769,15 +2769,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)); + } } } -- cgit v1.2.3