Revision: 15871
          http://sourceforge.net/p/edk2/code/15871
Author:   jcarsey
Date:     2014-08-21 20:18:47 +0000 (Thu, 21 Aug 2014)
Log Message:
-----------
ShellPkg: Add support for UEFI Shell 2.1 spec command line comments
Example:
Shell> echo "You are ^#1!" # Testing echo
You are #1!

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chris Phillips <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>

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

Modified: trunk/edk2/ShellPkg/Application/Shell/Shell.c
===================================================================
--- trunk/edk2/ShellPkg/Application/Shell/Shell.c       2014-08-21 20:16:32 UTC 
(rev 15870)
+++ trunk/edk2/ShellPkg/Application/Shell/Shell.c       2014-08-21 20:18:47 UTC 
(rev 15871)
@@ -2458,6 +2458,24 @@
   TrimSpaces(&CleanOriginal);
 
   //
+  // NULL out comments (leveraged from RunScriptFileHandle() ).
+  // The # character on a line is used to denote that all characters on the 
same line
+  // and to the right of the # are to be ignored by the shell.
+  // Afterward, again remove spaces, in case any were between the last 
command-parameter and '#'.
+  //
+  for (TempWalker = CleanOriginal; TempWalker != NULL && *TempWalker != 
CHAR_NULL; TempWalker++) {
+    if (*TempWalker == L'^') {
+      if (*(TempWalker + 1) == L'#') {
+        CopyMem (TempWalker, TempWalker + 1, StrSize (TempWalker) - sizeof 
(TempWalker[0]));
+      }
+    } else if (*TempWalker == L'#') {
+      *TempWalker = CHAR_NULL;
+    }
+  }
+
+  TrimSpaces(&CleanOriginal);
+
+  //
   // Handle case that passed in command line is just 1 or more " " characters.
   //
   if (StrLen (CleanOriginal) == 0) {

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


------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to