]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: Fix help MAN file searching
authorJaben Carsey <jaben.carsey@intel.com>
Fri, 15 Nov 2013 20:21:34 +0000 (20:21 +0000)
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 15 Nov 2013 20:21:34 +0000 (20:21 +0000)
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

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