Revision: 14982
          http://sourceforge.net/p/edk2/code/14982
Author:   jcarsey
Date:     2013-12-13 18:18:27 +0000 (Fri, 13 Dec 2013)
Log Message:
-----------
ShellPkg: Refactor Split/Pipe based command lines

This moves the initialization for handling command lines with pipe 
?\226?\128?\152|?\226?\128?\153 into a separate function.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <[email protected]>
Reviewed-by: Erik Bjorge <[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       2013-12-13 12:05:01 UTC 
(rev 14981)
+++ trunk/edk2/ShellPkg/Application/Shell/Shell.c       2013-12-13 18:18:27 UTC 
(rev 14982)
@@ -1589,6 +1589,36 @@
 }
 
 /**
+**/
+EFI_STATUS
+EFIAPI
+ProcessNewSplitCommandLine(
+  IN CONST CHAR16 *CmdLine
+  )
+{
+  SPLIT_LIST                *Split;
+  EFI_STATUS                Status;
+
+  Split = NULL;
+
+  //
+  // are we in an existing split???
+  //
+  if (!IsListEmpty(&ShellInfoObject.SplitList.Link)) {
+    Split = (SPLIT_LIST*)GetFirstNode(&ShellInfoObject.SplitList.Link);
+  }
+
+  if (Split == NULL) {
+    Status = RunSplitCommand(CmdLine, NULL, NULL);
+  } else {
+    Status = RunSplitCommand(CmdLine, Split->SplitStdIn, Split->SplitStdOut);
+  }
+  if (EFI_ERROR(Status)) {
+    ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_INVALID_SPLIT), 
ShellInfoObject.HiiHandle, CmdLine);
+  }
+  return (Status);
+}
+/**
   Function will process and run a command line.
 
   This will determine if the command line represents an internal shell 
@@ -1624,7 +1654,6 @@
   UINTN                     Count;
   UINTN                     Count2;
   CHAR16                    *CleanOriginal;
-  SPLIT_LIST                *Split;
 
   ASSERT(CmdLine != NULL);
   if (StrLen(CmdLine) == 0) {
@@ -1636,7 +1665,6 @@
   DevPath             = NULL;
   Status              = EFI_SUCCESS;
   CleanOriginal       = NULL;
-  Split               = NULL;
 
   CleanOriginal = StrnCatGrow(&CleanOriginal, NULL, CmdLine, 0);
   if (CleanOriginal == NULL) {
@@ -1672,21 +1700,7 @@
   // We dont do normal processing with a split command line (output from one 
command input to another)
   //
   if (ContainsSplit(CleanOriginal)) {
-    //
-    // are we in an existing split???
-    //
-    if (!IsListEmpty(&ShellInfoObject.SplitList.Link)) {
-      Split = (SPLIT_LIST*)GetFirstNode(&ShellInfoObject.SplitList.Link);
-    }
-
-    if (Split == NULL) {
-      Status = RunSplitCommand(CleanOriginal, NULL, NULL);
-    } else {
-      Status = RunSplitCommand(CleanOriginal, Split->SplitStdIn, 
Split->SplitStdOut);
-    }
-    if (EFI_ERROR(Status)) {
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_INVALID_SPLIT), 
ShellInfoObject.HiiHandle, CleanOriginal);
-    }
+    Status = ProcessNewSplitCommandLine(CleanOriginal);
   } else {
 
     //

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


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to