]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Follow Shell specification to make sure the “command.man” file is always used no...
authorShumin Qiu <shumin.qiu@intel.com>
Mon, 9 Dec 2013 02:24:39 +0000 (02:24 +0000)
committershenshushi <shenshushi@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 9 Dec 2013 02:24:39 +0000 (02:24 +0000)
Signed-off-by: Shumin Qiu <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14947 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Application/Shell/ShellManParser.c
ShellPkg/Application/Shell/ShellProtocol.c

index 8196a6ac9dcaf385d3d7abf744a368a959150475..525c9343bd96c9481ab78287eb07d74404b6e9d2 100644 (file)
@@ -492,19 +492,6 @@ ManFileFindTitleSection(
   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
index 89132969b6aad9ab5523016f004b61b762d42c17..ea30aaefc3f752b8c4bc66d34de4bcece22c1fa4 100644 (file)
@@ -2769,15 +2769,33 @@ EfiShellGetHelpText(
   )\r
 {\r
   CONST CHAR16  *ManFileName;\r
+  CHAR16        *FixCommand;\r
+  EFI_STATUS    Status;\r
 \r
   ASSERT(HelpText != NULL);\r
+  FixCommand = NULL;\r
 \r
   ManFileName = ShellCommandGetManFileNameHandler(Command);\r
 \r
   if (ManFileName != NULL) {\r
     return (ProcessManFile(ManFileName, Command, Sections, NULL, HelpText));\r
   } else {\r
-    return (ProcessManFile(Command, Command, Sections, NULL, HelpText));\r
+    if ((StrLen(Command)> 4)\r
+    && (Command[StrLen(Command)-1] == L'i' || Command[StrLen(Command)-1] == L'I')\r
+    && (Command[StrLen(Command)-2] == L'f' || Command[StrLen(Command)-2] == L'F')\r
+    && (Command[StrLen(Command)-3] == L'e' || Command[StrLen(Command)-3] == L'E')\r
+    && (Command[StrLen(Command)-4] == L'.')\r
+    ) {\r
+      FixCommand = AllocateZeroPool(StrSize(Command) - 4 * sizeof (CHAR16));\r
+      ASSERT(FixCommand != NULL);\r
+\r
+      StrnCpy(FixCommand, Command, StrLen(Command)-4);\r
+      Status = ProcessManFile(FixCommand, FixCommand, Sections, NULL, HelpText);\r
+      FreePool(FixCommand);\r
+      return Status;\r
+    } else {\r
+      return (ProcessManFile(Command, Command, Sections, NULL, HelpText));\r
+    }\r
   }\r
 }\r
 \r