Revision: 14947
          http://sourceforge.net/p/edk2/code/14947
Author:   shenshushi
Date:     2013-12-09 02:24:39 +0000 (Mon, 09 Dec 2013)
Log Message:
-----------
Follow Shell specification to make sure the 
?\226?\128?\156command.man?\226?\128?\157 file is always used no matter 
?\226?\128?\156command.efi -??\226?\128?\157 or  ?\226?\128?\156command 
-??\226?\128?\157 is typed.

Signed-off-by: Shumin Qiu <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ShellPkg/Application/Shell/ShellManParser.c
    trunk/edk2/ShellPkg/Application/Shell/ShellProtocol.c

Modified: trunk/edk2/ShellPkg/Application/Shell/ShellManParser.c
===================================================================
--- trunk/edk2/ShellPkg/Application/Shell/ShellManParser.c      2013-12-08 
01:36:25 UTC (rev 14946)
+++ trunk/edk2/ShellPkg/Application/Shell/ShellManParser.c      2013-12-09 
02:24:39 UTC (rev 14947)
@@ -492,19 +492,6 @@
   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);

Modified: trunk/edk2/ShellPkg/Application/Shell/ShellProtocol.c
===================================================================
--- trunk/edk2/ShellPkg/Application/Shell/ShellProtocol.c       2013-12-08 
01:36:25 UTC (rev 14946)
+++ trunk/edk2/ShellPkg/Application/Shell/ShellProtocol.c       2013-12-09 
02:24:39 UTC (rev 14947)
@@ -2769,15 +2769,33 @@
   )
 {
   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));
+    }
   }
 }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to