diff options
author | Chris Phillips <chrisp@hp.com> | 2014-08-21 20:18:47 +0000 |
---|---|---|
committer | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-08-21 20:18:47 +0000 |
commit | d41a79a0daaac52b3c555695d4dd3873d6f019c0 (patch) | |
tree | 1e1ecfd86d6897e739ff6e8f9440a775e2582cc8 /ShellPkg/Application/Shell | |
parent | a29117bf9e278763dfa6113492eb443be4ab67bc (diff) | |
download | edk2-platforms-d41a79a0daaac52b3c555695d4dd3873d6f019c0.tar.xz |
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 <chrisp@hp.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15871 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Application/Shell')
-rw-r--r-- | ShellPkg/Application/Shell/Shell.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c index 2f1e3eb65c..1d3064531d 100644 --- a/ShellPkg/Application/Shell/Shell.c +++ b/ShellPkg/Application/Shell/Shell.c @@ -2458,6 +2458,24 @@ RunCommand( 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) {
|