]> git.proxmox.com Git - mirror_edk2.git/commit - ShellPkg/Application/Shell/Shell.c
ShellPkg: Refactor the RunCommand API
authorJaben Carsey <jaben.carsey@intel.com>
Thu, 19 Dec 2013 16:05:34 +0000 (16:05 +0000)
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 19 Dec 2013 16:05:34 +0000 (16:05 +0000)
commit806c49db0538080ac397892c750b86d1c55d32af
tree426f222eb7fe748dcf2bfb8834a003d2b692c422
parent8dcd84b9d756172401d26ab2bad66316a7061b65
ShellPkg: Refactor the RunCommand API

This almost completely splits the RunCommand API into sub-routines.

 - the ProcessCommandLineToFinal API handles replacing the a found alias and any found environment variables.  This will redirect "-?" to "help", if necessary.  Upon return, the command line is complete and finalized.  It may still have redirection in it, and those will get chopped off later (but no further modifications occur).
 - the SetupAndRunCommandOrFile API handles updating and then later restoring StdIn, StdOut, and StdErr (and removing their information from the command line).  It will call into RunCommandOrFile.
 - the RunCommandOrFile API divides the logic to RunInternalCommand, RunScriptFile, or running an .EFI file directly.
 - the RunInternalCommand API handles updating and then restoring Argc and Argv.  It will run the internal command in between.
 - the SetLastError API handles updating of the environment variable "lasterror"
 - the DoHelpUpdateArgcArgv was changed to DoHelpUpdate and now works on the raw command line and not the argc/argv.  This allows the processing to be moved earlier.

Note this change has the following positive side effects (this eliminates unnecessary step):
 - Argc/Argv are only updated for internal commands (as they are library based)
 - no Argv/Argc/StdIn/StdOut/StdErr processing is done for file system changes.
 - The ProcessCommandLineToFinal API exists and it's critical to the ability to correctly pre-process split ("|") command lines ahead of time to verify their correctness.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15007 6f19259b-4bc3-4df7-8a09-765794883524
ShellPkg/Application/Shell/Shell.c