]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Application/Shell/ShellManParser.c
ShellPkg: Fix help MAN file searching
[mirror_edk2.git] / ShellPkg / Application / Shell / ShellManParser.c
index 470f51a8ea3d2d45202c35a854561e7daaa8800a..8196a6ac9dcaf385d3d7abf744a368a959150475 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Provides interface to shell MAN file parser.\r
 \r
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -491,6 +491,20 @@ ManFileFindTitleSection(
   }\r
   StrCpy(TitleString, L".TH ");\r
   StrCat(TitleString, Command);\r
+\r
+  //\r
+  // If the "name" ends with .efi we can safely chop that off since "help foo.efi" and "help foo" \r
+  // should produce the same results.\r
+  //\r
+  if ((StrLen(Command)> 4)\r
+    && (TitleString[StrLen(TitleString)-1] == L'i' || TitleString[StrLen(TitleString)-1] == L'I')\r
+    && (TitleString[StrLen(TitleString)-2] == L'f' || TitleString[StrLen(TitleString)-2] == L'F')\r
+    && (TitleString[StrLen(TitleString)-3] == L'e' || TitleString[StrLen(TitleString)-2] == L'E')\r
+    && (TitleString[StrLen(TitleString)-4] == L'.')\r
+    ) {\r
+    TitleString[StrLen(TitleString)-4] = CHAR_NULL;\r
+  }\r
+\r
   TitleLen = StrLen(TitleString);\r
   for (;!ShellFileHandleEof(Handle);Size = 1024) {\r
    Status = ShellFileHandleReadLine(Handle, ReadLine, &Size, TRUE, Ascii);\r