Commit Graph

324 Commits

Author SHA1 Message Date
Michael Kinney 898378c2be ShellPkg/Shell - Fix ASSERT() when FvSimpleFileSystemDxe is used
When the FvSimpleFileSystemDxe module is included in a platform,
Simple File System Protocols are produced for firmware volumes(FV)
that do not have the same style device paths as file systems with
file names.  The ShellPkg has an assumption that the device path
contains device path nodes of type MEDIA_FILEPATH_DP and generates
an ASSERT() if any other device path nodes are encountered.  This
change removes the ASSERT() condition and instead returns NULL that
means EfiShellGetFilePathFromDevicePath() can not convert the
device path nodes that represent the file path to a Unicode string.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19228 6f19259b-4bc3-4df7-8a09-765794883524
2015-12-12 19:28:21 +00:00
Jordan Justen e329f98b86 ShellPkg: Convert all .uni files to utf-8
To convert these files I ran:

$ python3 BaseTools/Scripts/ConvertUni.py ShellPkg

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Shumin Qiu <shumin.qiu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19176 6f19259b-4bc3-4df7-8a09-765794883524
2015-12-09 23:07:58 +00:00
Cohen Eugene 01e3a97671 ShellPkg: fix RVCT warning due to CONST in typecast.
Building the latest shell on RVCT exposed this warning:

ShellPkg\Application\Shell\Shell.c(1090,69): error #191-D: type qualifier is meaningless on cast type

The CONST in the cast was deemed meaningless.  Removing the CONST fixed the warning.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cohen Eugene <eugene@hp.com>
Reviewed-by: Qiu Shumin <shumin.qiu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18954 6f19259b-4bc3-4df7-8a09-765794883524
2015-11-26 01:04:41 +00:00
Qiu Shumin d1c275c651 ShellPkg: Don't strip positional parameters of quotation marks.
Per Shell SPEC 2.1 'Double-quotation marks that surround arguments are not stripped in positional parameters'. This patch makes Shell implementation to follow SPEC.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18742 6f19259b-4bc3-4df7-8a09-765794883524
2015-11-09 02:29:31 +00:00
Qiu Shumin c617380446 ShellPkg: Refine code by initializing local variable and adding ASSERT statement.
Add ASSERT statement and initialize local variable to make code more readable.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18689 6f19259b-4bc3-4df7-8a09-765794883524
2015-10-28 01:14:34 +00:00
Qiu Shumin 490ce43d92 ShellPkg: Fix 'EfiShellExecute' doesn't get command status correctly.
1. Add a new  function 'RunShellCommand' to return command status, thus 'EfiShellExecute' can get the command return status of 'CommandLine'.
2. Refine the code logic of 'EfiShellExecute' to make the new image of shell be loaded only if  'Environment' isn't NULL.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Signed-off-by: Jin Eric <eric.jin@intel.com>
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18664 6f19259b-4bc3-4df7-8a09-765794883524
2015-10-26 13:28:01 +00:00
Qiu Shumin fbd2dfadfe ShellPkg: Follow spec to remove the last '\' char in return name of GetCurDir().
In Shell spec 2.1 the return name of EFI_SHELL_PROTOCOL.GetCurDir() is defined as 'fs0:\current-dir' while in current implementation it's 'fs0:\current-dir\'. 
To follow spec the patch removed the redundant '\' char.

Since it has been broken for a long time, some codes may depend on the broken behavior.
After this change 'EFI_SHELL_PROTOCOL.GetCurDir()' and 'UefiShellLib.ShellGetCurrentDir()'
will return a current directory string without tailing '\' (fs0:\current-dir), the value of Shell environment variable 'cwd' will become 'fs0:\current-dir' as well.

This patch has updated all the code in EDKII to make them depend on the new behavior.
Developers should check whether 'GetCurDir()' and 'ShellGetCurrentDir' are used in their source code.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18653 6f19259b-4bc3-4df7-8a09-765794883524
2015-10-23 02:03:20 +00:00
Qiu Shumin 48cb33ec30 ShellPkg: Fix ASCII input redirection does not work correctly.
When executing 'ls -b <a arg.txt' Shell cannot get the ASCII char in 'arg.txt' correctly. 
This patch updates the file read buffer size when read from ASCII file to fix the bug.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Signed-off-by: Felix Poludov <Felixp@ami.com>
Signed-off-by: Oleksiy Yakovlev <Oleksiyy@ami.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18609 6f19259b-4bc3-4df7-8a09-765794883524
2015-10-15 02:43:31 +00:00
Ruiyu Ni 7534ae58f4 ShellPkg: Add a simple case to test shell parameter parsing logic
TestArgv.nsh is a very simple shell script to test how the interpreter parses
the parameters. It uses ShellCTestApp.efi to dump the parameters passed from the
interpreter.

TestArgv.log is the desired output created using "TestArgv.nsh > TestArgv.log".

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18558 6f19259b-4bc3-4df7-8a09-765794883524
2015-09-29 06:35:33 +00:00
Qiu Shumin 1fab91765f ShellPkg: Fix GCC build fail and code refine.
1. Fix GCC build fail.
2. It's not correct to cast away constness to allow TrimSpaces() to modify 'commandline'. 
   This patch makes a copy of 'commandLine' and work with that in the remainder of the function.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18500 6f19259b-4bc3-4df7-8a09-765794883524
2015-09-18 01:08:31 +00:00
Yang Jadis fb977e3395 ShellPkg: Fix Shell fail when execute command in ShellProtocol.Execute().
When execute a command with tailing blank spaces in ShellProtocol.Execute() Shell will fail. 
This patch move the TrimSpaces operation into ParseCommandLineToArgs function to fix the problem.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yang Jadis <jadis.yang@intel.com>
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18491 6f19259b-4bc3-4df7-8a09-765794883524
2015-09-17 01:42:59 +00:00
Qiu Shumin a5382ce06c ShellPkg: Fix Shell does not support ASCII pipe(|a).
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18452 6f19259b-4bc3-4df7-8a09-765794883524
2015-09-15 00:58:59 +00:00
Qiu Shumin 389824ffbe ShellPkg: Fix Shell fail with redundant space following delay number.
When boot from Shell we can use '-delay [num]' as optional data. If blank space exist after '[num]' Shell will fail. This patch add error handling to avoid this failure.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18431 6f19259b-4bc3-4df7-8a09-765794883524
2015-09-10 03:08:56 +00:00
Eric Dong 4c33aace3f ShellPkg: Replace use case of deprecated function GetVariable with GetVariable2.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18368 6f19259b-4bc3-4df7-8a09-765794883524
2015-09-01 01:06:08 +00:00
Ard Biesheuvel ad93e04298 ShellPkg: force use of AARCH64 small model when building DEBUG shell
The tiny code model used by AARCH64 only supports binaries of up to
1 MB in size. Since the Shell application exceeds that when built in
DEBUG mode, make sure we build it using the small code model instead.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Tested-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18241 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-20 06:39:04 +00:00
Qiu Shumin b0f81b62de ShellPkg: Fix the ASSERT issue in Shell 'for' loop
The Length parameter of 'GetNextParameter' is the buffer size in bytes.
While StrnCpys requires user to pass the max number of dest unicode char,
we should convert size in bytes to the number of char.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
[lersek@redhat.com: updated commit message as requested by Jaben]
Signed-off-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18059 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-26 08:06:01 +00:00
Qiu Shumin 4dc0d578b8 ShellPkg: Refine code to use Strn**S safe functions instead of Str**S ones in some cases.
Safe string functions may ASSERT when the source length is larger than the MaxDest. This patch use Strn**S to indicate the copy length. 

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Tapan Shah <<tapandshah@hp.com>>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17894 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-09 03:19:06 +00:00
Heyi Guo a5e28cc1d0 ShellPkg: Fix bug introduced by r17730.
CurrentFilePattern is only part of FilePattern and will be less than or equal to FilePattern. If we use StrCpyS to replace StrnCpy, it will cause assert when FilePattern is longer.
The bug can be replayed when we cd to one directory and run ls command.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Qiu Shumin <shumin.qiu@intel.com> 


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17821 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-04 02:26:54 +00:00
Qiu Shumin 6956ecfe1e ShellPkg: Refine code to make catenae length more precise.
This commit refine the catenae length. A too long catenae length in StrnCat may cause potential buffer overflow while in StrnCatS it may ASSERT.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17747 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-30 20:15:15 +00:00
Qiu Shumin e75390f029 ShellPkg: Use safe string functions to refine code.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17730 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-30 03:18:31 +00:00
Qiu Shumin f5bc9da5a3 ShellPkg: Make BOOLEAN variable not use explicit comparison.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Daryl McDaniel <daryl.mcdaniel@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17677 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-23 01:04:26 +00:00
Jaben Carsey 8e4fd502c5 ShellPkg: update Console to clear screen when resetting
This clears the screen when scrolling is ended by a non-scrolling key press.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hp.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17632 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-15 20:21:06 +00:00
Qiu Shumin c17c4a1ffd ShellPkg\Application\Shell: Clean start row information after the console has been Reset or SetMode.
OriginalStartRow and CurrentStartRow should be initialized after new mode is set.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Signed-off-by: Eric Jin <eric.jin@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17584 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-09 02:29:37 +00:00
Qiu Shumin 654a012ba5 ShellPkg: Refine the logic about allocating memory for variable name and data.
The run time service 'QueryVariableInfo' is not proper to be used to get the variable name size. This patch refine the logic about allocating memory for variable name and data.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Ruiyu Ni <Ruiyu.ni@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17201 6f19259b-4bc3-4df7-8a09-765794883524
2015-04-27 03:09:34 +00:00
Olivier Martin 88ff5ba793 ShellPkg: Added newline at the end of source files
Some compilers (such as ARM toolchain) complain if there is
no new line at the end of a source file.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17105 6f19259b-4bc3-4df7-8a09-765794883524
2015-04-02 11:32:32 +00:00
Joe Peterson d08a546471 Shellpkg: Fix spelling errors in Shell.c/Shell.h comments
This patch fixes spelling errors in comments. No functional change.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Joe Peterson <joe.peterson@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16816 6f19259b-4bc3-4df7-8a09-765794883524
2015-02-06 22:25:05 +00:00
Jaben Carsey a8f98806ed ShellPkg: command help with -? flag is not working and it gives too many arguments error message.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hp.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16815 6f19259b-4bc3-4df7-8a09-765794883524
2015-02-06 21:03:28 +00:00
Tapan Shah c011b6c9e2 ShellPkg: Standardized HP Copyright Message String
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Tapan Shah <tapandshah@hp.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16759 6f19259b-4bc3-4df7-8a09-765794883524
2015-02-04 22:25:01 +00:00
Jaben Carsey fe8ec3dd93 ShellPkg: Revert 16720 and 16734.
I will submit a new patch.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <Jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16758 6f19259b-4bc3-4df7-8a09-765794883524
2015-02-04 16:46:59 +00:00
Jaben Carsey a95cf8f0f4 ShellPkg: Revert 16720 and 16734.
I will submit a new patch.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <Jaben.carsey@intel.com>




git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16757 6f19259b-4bc3-4df7-8a09-765794883524
2015-02-04 16:39:04 +00:00
Jaben Carsey 432bf14cf1 ShellPkg: cast return value to correct type based on what we passed in.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <Jaben.carsey@intel.com>
Reviewed-by: Joe Peterson <joe.peterson@intel.com>
Reviewed-by: Shumin Qiu <shumin.qiu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16734 6f19259b-4bc3-4df7-8a09-765794883524
2015-02-04 01:23:14 +00:00
Qiu Shumin 69c569bf55 ShellPkg: Fix typos.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>





git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16733 6f19259b-4bc3-4df7-8a09-765794883524
2015-02-04 01:15:17 +00:00
Tapan Shah 7df7964379 ShellPkg: Update Shell.uni file with a better general command response output.
1.	Updates to the general command response output.
2.	Re-wording some of common shell messages.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Tapan Shah <tapandshah@hp.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16725 6f19259b-4bc3-4df7-8a09-765794883524
2015-02-03 18:37:58 +00:00
Jaben Carsey 0a82f7af9b ShellPkg: Refactor out a now-redundant function
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <Jaben.carsey@intel.com>
Reviewed-by: Joe Peterson <joe.peterson@intel.com>
Reviewed-by: Shumin Qiu <shumin.qiu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16720 6f19259b-4bc3-4df7-8a09-765794883524
2015-02-03 16:50:12 +00:00
Jaben Carsey 5e737e835e ShellPkg: Add quotes around NSH index argument replacement
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <Jaben.carsey@intel.com>
Reviewed-by: Shumin Qiu <shumin.qiu@intel.com>
Reviewed-by: Joe Peterson <joe.peterson@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16699 6f19259b-4bc3-4df7-8a09-765794883524
2015-02-02 21:02:56 +00:00
Qiu Shumin 3ab016b2a3 ShellPkg: Fix typos.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>





git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16683 6f19259b-4bc3-4df7-8a09-765794883524
2015-02-02 01:51:59 +00:00
Jaben Carsey 7cc7022dfc ShellPkg: Refactor quote and escape search to use new function
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <Jaben.carsey@intel.com>
Signed-off-by: Joe Peterson <joe.peterson@intel.com>
Reviewed-by: Shumin Qiu <shumin.qiu@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hp.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16682 6f19259b-4bc3-4df7-8a09-765794883524
2015-01-30 16:29:20 +00:00
Jaben Carsey 00534bc3e2 ShellPkg: Refactor Split search to generic function
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <Jaben.carsey@intel.com>
Signed-off-by: Joe Peterson <joe.peterson@intel.com>
Reviewed-by: Shumin Qiu <shumin.qiu@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hp.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16681 6f19259b-4bc3-4df7-8a09-765794883524
2015-01-30 16:28:22 +00:00
Jaben Carsey 14030c5c85 ShellPkg: refine command line parsing
Correctly divide up parameters for Argc/Argv including quote ("), escape (^), and space ( ) processing.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <Jaben.carsey@intel.com>
Reviewed-by: Joe Peterson <joe.peterson@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hp.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16673 6f19259b-4bc3-4df7-8a09-765794883524
2015-01-27 18:56:36 +00:00
Jaben Carsey fdd52bde51 ShellPkg: Always remove non-defined environment variable
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <Jaben.carsey@intel.com>
Reviewed-by: Joe Peterson <joe.peterson@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hp.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16672 6f19259b-4bc3-4df7-8a09-765794883524
2015-01-27 18:53:27 +00:00
Qiu Shumin ecd07f3737 ShellPkg: Refine the fomat in INF/DEC files to follow spec.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>





git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16634 6f19259b-4bc3-4df7-8a09-765794883524
2015-01-22 01:44:11 +00:00
Daryl McDaniel ae591c14b3 MdeModulePkg, MdePkg, NetworkPkg, OvmfPkg, PerformancePkg, ShellPkg: Library Migration.
Move libraries from ShellPkg into MdeModulePkg and MdePkg.

The following libraries are being migrated out of ShellPkg in order to make
their functionality more widely available.
  • PathLib:        Incorporate into MdePkg/Library/BaseLib
  • FileHandleLib:  MdePkg/Library/UefiFileHandleLib
  • BaseSortLib:    MdeModulePkg/Library/BaseSortLib
  • UefiSortLib:    MdeModulePkg/Library/UefiSortLib

Diffs showing file changes are in the attached file, LibMigration.patch.
A description of the changes follows:

  • Move ShellPkg/Include/Library/FileHandleLib.h to MdePkg/Include/Library/FileHandleLib.h
  • Move ShellPkg/Include/Library/SortLib.h to MdeModulePkg/Include/Library/SortLib.h
  • Move ShellPkg/Library/BaseSortLib to MdeModulePkg/Library/BaseSortLib
  • Move ShellPkg/Library/UefiSortLib to MdeModulePkg/Library/UefiSortLib
  • Move ShellPkg/Library/BasePathLib/BasePathLib.c to MdePkg/Library/BaseLib/FilePaths.c
  • Merge ShellPkg/Include/Library/PathLib.h into MdePkg/Include/Library/BaseLib.h
  • Delete  ShellPkg/Library/BasePathLib; Includes BasePathLib.c and BasePathLib.inf

  • NetworkPkg/NetworkPkg.dsc
  • PerformancePkg.dsc
  • OvmfPkg/OvmfPkgX64.dsc
  • OvmfPkg/OvmfPkgIa32X64.dsc
  • OvmfPkg/OvmfPkgIa32.dsc
    o Update SortLib and FileHandleLib library classes to point to the new library locations.
    o Remove PathLib library class and make sure that BaseLib is described.

  • MdeModulePkg/MdeModulePkg.dec
    o Add SortLib library class

  • MdePkg/MdePkg.dec
    o Add FileHandleLib library class
    o Add PcdUefiFileHandleLibPrintBufferSize PCD

  • MdePkg/Library/BaseLib/BaseLib.inf
    o Add FilePaths.c to [Sources]

  • MdePkg/Include/Library/BaseLib.h
    o Update file description to include "file path functions"

  • ShellPkg/ShellPkg.dsc
    o Change PACKAGE_GUID to { C1014BB7-4092-43D4-984F-0738EB424DBF }
    o Update PACKAGE_VERSION to 1.0
    o Update SortLib and FileHandleLib library classes to point to the new library locations.
    o Remove PathLib library class and make sure that BaseLib is described.
    o Remove ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf from [Components]

  • ShellPkg/ShellPkg.dec
    o Update PLATFORM_VERSION to 1.0
    o Remove declarations of the FileHandleLib, SortLib, and PathLib Library Classes
    o Update comment for the PcdShellPrintBufferSize PCD.

  • ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf
  • ShellPkg/Application/Shell/Shell.inf
    o Remove PathLib from [LibraryClasses]

  • ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h
  • ShellPkg/Application/Shell/Shell.h
    o Remove #include <Library/PathLib.h>

  • ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.inf
    o Add PathLib to [LibraryClasses]

  • ShellPkg/Library/UefiShellLevel1CommandsLib/If.c
    o Remove #include <Library/PathLib.h>

  • ShellPkg/Application/ShellSortTestApp/ShellSortTestApp.inf
    o Add MdeModulePkg/MdeModulePkg.dec to [Packages]

  • MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
  • MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
    o Replace ShellPkg.dec with MdeModulePkg.dec in [Packages]

  • MdeModulePkg/Library/UefiSortLib/UefiSortLib.c
    o Remove #include <ShellBase.h>
    o Define USL_FREE_NON_NULL() to replace SHELL_FREE_NON_NULL()

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Daryl McDaniel <daryl.mcdaniel@intel.com>
Reviewed-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@16601 6f19259b-4bc3-4df7-8a09-765794883524
2015-01-13 01:04:07 +00:00
Qiu Shumin 4243567133 ShellPkg: Check the unrecognized environment variable name before it is removed from command line.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>





git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16563 6f19259b-4bc3-4df7-8a09-765794883524
2014-12-31 01:31:00 +00:00
Qiu Shumin 6f6792b820 ShellPkg: Add code to handle the split ('|') in a double-quoted string.
This patch update the code in function 'ContainsSplit', and make 'ContainsSplit' depend on 'FindNextInstance'. So we move 'FindNextInstance' in front of 'ContainsSplit'.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>





git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16560 6f19259b-4bc3-4df7-8a09-765794883524
2014-12-26 08:22:35 +00:00
Jaben Carsey 75e34de46c ShellPkg: Fix Meta Data misspelling
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@16195 6f19259b-4bc3-4df7-8a09-765794883524
2014-10-03 15:49:59 +00:00
Ruiyu Ni a308e0588b Roll back check in r15180 which caused the shell always returns EFI_ABORTED no matter what exit-code is specified for "exit" command.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Carsey Jaben <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16127 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-18 01:58:03 +00:00
Qiu Shumin 4b6b543e77 ShellPkg: Fix the support for command line comments.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-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@16126 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-18 01:21:01 +00:00
Ni Ruiyu 75eb337f60 ShellPkg: Do TrimSpace again after StdIn, StdOut, and StdErr are set up.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ni Ruiyu <ruiyu.ni@intel.com>
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16123 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-17 08:41:31 +00:00
Qiu Shumin 323d3d1118 ShellPkg: Replace the usage of StrnCpy with CopyMem to avoid potential buffer overflow and refine the code style.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Signed-off-by: Yao Jiewen <jiewen.yao@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16083 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-10 01:03:43 +00:00
Qiu Shumin cc72674b58 ShellPkg: Replace assignment statement with 'StrnCpy' to append terminal NULL character in a string.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16064 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-09 01:47:19 +00:00
Jaben Carsey a753677e33 ShellPkg: Not add redundant quotes any longer to parameters with spaces.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <Jaben.carsey@intel.com>
Reviewed-by: : Qiu Shumin <shumin.qiu@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16062 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-05 02:05:16 +00:00
Qiu Shumin 33fe830841 ShellPkg: Refine the code style and comment.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: : Jaben Carsey <Jaben.carsey@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16061 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-05 01:01:24 +00:00
Jaben Carsey 7f79b01e8e ShellPkg: Refactor string manipulation
This patch replaces StrCpy with StrnCpy or refactors out the usage of StrCpy through some other means.
This patch replaces StrCat with StrnCat or refactors out the usage of StrCat through some other means.


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@16038 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-02 20:17:38 +00:00
Qiu Shumin de4caceb8b ShellPkg: Remove 'STATIC' from function declarations to avoid source level debugging problem.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: : Jaben Carsey <Jaben.carsey@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15975 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-29 01:30:43 +00:00
Jaben Carsey 5eadb80f09 ShellPkg: leave quotes around params
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@15875 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-21 22:13:08 +00:00
Chris Phillips d41a79a0da 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
2014-08-21 20:18:47 +00:00
Chris Phillips 838b31a68c ShellPkg: Fix EFI_SHELL_PROTOCOL to contain new members from UEFI Shell 2.1 spec
- Removes EFI_SHELL_PROTOCOL21
- Adds RegisterGuidName, GetGuidName, GetGuidFromName, and GetEnvEx to EFI_SHELL_PROTOCOL

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@15818 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-18 20:00:08 +00:00
Qiu Shumin f5ba4007ae ShellPkg: Fix comments. Refine code style.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15815 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-18 00:48:22 +00:00
Jaben Carsey 09fd5328a4 Updates the UEFI Shell to produce the new protocol with additional 4 functions.
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>
Reviewed by: Daryl McDaniel <daryl.mcdaniel@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15764 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-06 16:18:38 +00:00
Laszlo Ersek 5967886d58 ShellPkg: UpdateStdInStdOutStdErr(): append BOM to new unicode file
The >> operator redirects stdout to a file, using append mode and unicode
encoding. Write the BOM when redirection happens to a new file (which
starts out empty).

This makes the >> operator behave similarly to the > operator, when the
redirection target doesn't exist originally:

  OutUnicode && OutAppend && FileSize == 0 // >> to new unicode file
vs.
  OutUnicode && !OutAppend                 // >  to any unicode file

(Note that (FileSize == 0) is equivalent to "new file" in this context,
due to the earlier "Check that filetypes (Unicode/Ascii) do not change
during an append".)

Reported-by: Lowell Dennis <Lowell_Dennis@Dell.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15725 6f19259b-4bc3-4df7-8a09-765794883524
2014-07-31 15:44:43 +00:00
Laszlo Ersek 94c2a04449 ShellPkg: UpdateStdInStdOutStdErr(): extract WriteFileTag()
Drop TagBuffer in the process.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15724 6f19259b-4bc3-4df7-8a09-765794883524
2014-07-31 15:44:30 +00:00
Eric Dong 0d807dae4a Update code to support VS2013 tool chain.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15704 6f19259b-4bc3-4df7-8a09-765794883524
2014-07-29 02:00:55 +00:00
Eric Dong 81cd2f536e Refine code to make it more safely.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15593 6f19259b-4bc3-4df7-8a09-765794883524
2014-06-26 01:38:46 +00:00
Jaben Carsey 0c41d28e59 ShellPkg: replace unrecognized Environment Variables with empty quotes so commands or applications know something existed.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <Jaben.carsey@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hp.com>
Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15547 6f19259b-4bc3-4df7-8a09-765794883524
2014-05-22 22:06:41 +00:00
Qiu Shumin b5ce69c3da Update the comments for function 'InternalShellExecuteDevicePath' in ShellProtocol.c to make it consistent with parameter names.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben carsey <Jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15546 6f19259b-4bc3-4df7-8a09-765794883524
2014-05-22 08:32:50 +00:00
Olivier Martin cd39fe082c ShellPkg: Do not mix status when executing a command
The function InternalShellExecuteDevicePath() did not differentiate an error occuring during the preparation of an image and an error occurring during its execution.

A use case of the issue was when a EFI application was called in a EFI Shell script. If the EFI application was returning an error then the NSH script stopped its execution. While the EFI Shell specification says the script should continue its execution (see 4.2 Error Handling).

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Jaben Carsey <Jaben.Carsey@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15523 6f19259b-4bc3-4df7-8a09-765794883524
2014-05-13 21:16:42 +00:00
Jaben Carsey bbf904d154 ShellPkg: Fix using root of drive
This allows near complete use of drive roots “fs0:” and “fs0:\” as directories and arguments to commands.

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>
Reviewed-by: Tapan Shah <tapandshah@hp.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15463 6f19259b-4bc3-4df7-8a09-765794883524
2014-04-11 19:15:02 +00:00
Chris Phillips e9d19a80af ShellPkg: Fix command-line parsing to start with Argv[0] when comparing passed-in options
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chris Phillips <chrisp@hp.com>
Reviewed-By: Olivier Martin <Olivier.Martin@arm.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15432 6f19259b-4bc3-4df7-8a09-765794883524
2014-04-04 13:45:36 +00:00
Jaben Carsey d0a5723f50 ShellPkg: Allow opening of root drive nodes
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@15424 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-31 21:06:13 +00:00
Jaben Carsey 4b5168d852 ShellPkg: Fix potential memory leak when failing to fully create a structure
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@15423 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-31 20:43:04 +00:00
Chris Phillips d6e88a6c60 ShellPkg: Fix file system change issue that results in ASSERT
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@15406 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-27 18:21:43 +00:00
Shumin Qiu 4f344fffc7 1.Add code to check the pointer 'CorrectedPath' in Ls.c line 460 before referenced. 2.Not use explicit comparisons to TRUE or FALSE for Boolean variable in Ls.c. 3.Add doxygen tags in comment and return type for 'ToLower' in ShellProtocol.c.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Shumin Qiu <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15320 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-07 01:06:37 +00:00
Shumin Qiu f716d7b8c5 Convert the value from 'int' to 'CHAR16' to match the type of variable in ShellProtocol.c.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Shumin Qiu <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15271 6f19259b-4bc3-4df7-8a09-765794883524
2014-02-28 00:36:03 +00:00
Brendan Jackman b9b77ab1ba ShellPkg/ShellProtocol.c: Fix case sensitivity in GetAlias and SetAlias
ShellCommandIsOnAliasList is case insensitive, but GetAlias and SetAlias use the
UEFI variable services, which are case sensitive.

Force alias names to lowercase to get around this.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brendan Jackman <Brendan.Jackman@arm.com>
Reviewed-By: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15270 6f19259b-4bc3-4df7-8a09-765794883524
2014-02-26 09:46:40 +00:00
Jaben Carsey d5b5440bf2 ShellPkg: refactor elimination of non-replaced environment variables
This changes how non-replaced environment variables are found and eliminated from the command line.  This new method makes sure that the found environment variables are not using escaped characters and that they do not stretch over quoted strings

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@15242 6f19259b-4bc3-4df7-8a09-765794883524
2014-02-12 18:27:07 +00:00
Shumin Qiu a7563b08d9 Add code to check whether the pointer 'PathForReturn' in ShellProtocol.c is NULL before used.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Shumin Qiu <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15230 6f19259b-4bc3-4df7-8a09-765794883524
2014-02-12 01:51:15 +00:00
Jaben Carsey fc4c7b30d9 ShellPkg: Fix changing to file system with 2 colons like "fs0::"
first colon must be last character in the string.

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@15226 6f19259b-4bc3-4df7-8a09-765794883524
2014-02-11 23:56:32 +00:00
Jaben Carsey ba71f79058 ShellPkg: Fix uninitialized Variable error
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@15225 6f19259b-4bc3-4df7-8a09-765794883524
2014-02-11 23:37:18 +00:00
Brendan Jackman fe6c94d2e1 ShellPkg: InternalShellExecuteDevicePath: avoid memory leaks
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brendan Jackman <Brendan.Jackman@arm.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15224 6f19259b-4bc3-4df7-8a09-765794883524
2014-02-11 22:46:56 +00:00
Brendan Jackman 3e2b20a1ad ShellPkg: Make Argv[0] the full file path of the command
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brendan Jackman <Brendan.Jackman@arm.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15223 6f19259b-4bc3-4df7-8a09-765794883524
2014-02-11 22:45:18 +00:00
Brendan Jackman da92bf853f ShellPkg: Error out when ProcessCommandLine fails
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brendan Jackman <Brendan.Jackman@arm.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15222 6f19259b-4bc3-4df7-8a09-765794883524
2014-02-11 22:43:36 +00:00
Brendan Jackman 0477054bc0 ShellPkg: Fixed Memory leak in UefiMain()
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brendan Jackman <Brendan.Jackman@arm.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15221 6f19259b-4bc3-4df7-8a09-765794883524
2014-02-11 22:42:49 +00:00
Brendan Jackman 23385d6319 ShellPkg: Manually parse parameters
We can't use ShellCommandLineParse as it would error out when the shell was
called with args like "cp -r foo bar", because "-r" is not a recognised shell
option

A different way to avoid some of this manual parsing would be to prepend '^' to
each argument, but that would still require the degree of parsing necessary to work
out which words are part of the command and which are shell options.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brendan Jackman <Brendan.Jackman@arm.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15220 6f19259b-4bc3-4df7-8a09-765794883524
2014-02-11 22:39:49 +00:00
Shumin Qiu 71c49eafc5 Add initializing code for local variable 'CalleeExitStatus' and 'ExitStatus' in 'Shell.c'.
Signed-off-by: Shumin Qiu <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15191 6f19259b-4bc3-4df7-8a09-765794883524
2014-01-28 00:59:46 +00:00
Shumin Qiu 7bc3ec3d80 1. Fix several comments in function headers for 'ShellProtocol.c', 'ShellProtocol.h' and 'Ls.c'. 2. Remove the initialization of variable 'CalleeExitStatus' in function 'RunScriptFileHandle' of 'Shell.c' from its declarartion.
Signed-off-by: Shumin Qiu <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15190 6f19259b-4bc3-4df7-8a09-765794883524
2014-01-28 00:37:11 +00:00
Brendan Jackman 6ddc2ff3ef ShellPkg/ShellProtocol.c: Don't put consective "\"s in file paths
The UEFI and UEFI Shell specs do not allow consecutive path separators.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brendan Jackman <Brendan.Jackman@arm.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15184 6f19259b-4bc3-4df7-8a09-765794883524
2014-01-24 22:32:38 +00:00
Brendan Jackman d9c7741d4f ShellPkg/ShellProtocol.c: Don't overwrite Status in InternalShellExecuteDevicePath
Due to the ASSERT_EFI_ERROR, this patch is necessary only to ensure specified
behaviour in RELEASE builds.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brendan Jackman <Brendan.Jackman@arm.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15181 6f19259b-4bc3-4df7-8a09-765794883524
2014-01-24 22:28:36 +00:00
Brendan Jackman 5223c12135 ShellPkg/Shell: Fix reporting of exit status in ShellProtocol.Execute
When the exit status of the command run by the shell is other than
SHELL_SUCCESS, the shell image will now exit with EFI_ABORTED, placing the
commands exit status (which is a SHELL_STATUS) in ExitData.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brendan Jackman <Brendan.Jackman@arm.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15180 6f19259b-4bc3-4df7-8a09-765794883524
2014-01-24 22:27:11 +00:00
Shumin Qiu f614ce7ebb Update the comments in function headers to follow Doxygen special documentation blocks in section 2.3.5.
Signed-off-by: Shumin Qiu <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15163 6f19259b-4bc3-4df7-8a09-765794883524
2014-01-23 00:27:52 +00:00
Tian, Hot d42aab6e61 Fix CRLF format
Signed-off-by: Tian, Hot <hot.tian@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15160 6f19259b-4bc3-4df7-8a09-765794883524
2014-01-22 08:40:29 +00:00
Jaben Carsey 2c86b6b785 ShellPkg: Change StdIn redirection
This changes how StdIn redirection works such that the file is opened and parsed for length up front and not each time.  This prevents TPL issues.

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@15140 6f19259b-4bc3-4df7-8a09-765794883524
2014-01-17 17:51:09 +00:00
Jaben Carsey 4dd8c7af19 ShellPkg: Return the failure
This change returns the error code when they keyboard fails to read instead of potentially spinning endlessly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15135 6f19259b-4bc3-4df7-8a09-765794883524
2014-01-16 16:53:56 +00:00
Jaben Carsey 8e4a89a335 ShellPkg: Remove ASSERT
This change removes ASSERT statements and replaces them with logic to break out of the loop.  This both prevents spinning forever and prevents processing the returned data from the function that failed.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15134 6f19259b-4bc3-4df7-8a09-765794883524
2014-01-16 16:53:23 +00:00
Jaben Carsey 49bb76ff71 ShellPkg: Remove UNICODE file tag (FEFF) from files used for input redirection
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@15109 6f19259b-4bc3-4df7-8a09-765794883524
2014-01-13 18:52:48 +00:00
Jaben Carsey 8844288c4e ShellPkg: assign pointer to NULL after free to prevent double free
Since the API caller may call twice we need to make sure that we set pointer to NULL so we can tell if already free.

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@15107 6f19259b-4bc3-4df7-8a09-765794883524
2014-01-13 18:47:18 +00:00
Jaben Carsey e958b94662 ShellPkg: Fix command line parsing for script files (%1, %1, etc...)
This change makes sure that all script files get their command lines properly parsed for use in the script file.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15103 6f19259b-4bc3-4df7-8a09-765794883524
2014-01-13 07:30:08 +00:00
Jaben Carsey 4922715d85 ShellPkg: Fix NSH parsing
This skips lines in NSH files that are completely comments.  This reduces the memory overhead and the later processing.

This also frees memory correctly when a second memory allocation fails.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Ruiyu Ni <Ruiyu.ni@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15072 6f19259b-4bc3-4df7-8a09-765794883524
2014-01-09 18:02:26 +00:00
Jaben Carsey c1f9c34621 ShellPkg: Remove memory leak from file list usage
This change removes an un-used parameter that was then causing a leak since the memory was assumed to be used.

This also verifies that the list is freed when no longer needed.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Ruiyu Ni <Ruiyu.ni@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15071 6f19259b-4bc3-4df7-8a09-765794883524
2014-01-09 17:59:46 +00:00
Shumin Qiu 03bc7c2b09 Add code to check whether the pointer 'NewBuffer' in 'FileHandelWrappers.c' and the pointer 'FoundVarName' in 'Dmpstore.c' are NULL before used.
Signed-off-by: Shumin Qiu <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15060 6f19259b-4bc3-4df7-8a09-765794883524
2014-01-09 00:30:27 +00:00
Ruiyu Ni 31c2a2c7c0 Enhance Shell 2.0 to not depend on keyboard driver implementation to fix the "CTRL+s" pause malfunction issue.
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Carsey Jaben <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15052 6f19259b-4bc3-4df7-8a09-765794883524
2014-01-07 02:23:10 +00:00
Shumin Qiu de4ebdcfcd Add the comment for function 'IsValidSplit' in 'Shell.c'. Add code to check whether pointer 'DataBuffer' in 'DmpStore.c' is NULL before used.
Signed-off-by: Shumin Qiu <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>




git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15051 6f19259b-4bc3-4df7-8a09-765794883524
2014-01-07 01:51:08 +00:00
Shumin Qiu 3e108dfd7d Set the type of variable 'StatusCode' as SHELL_STATUS to match the parameter type of function 'SetLastError'.
Signed-off-by: Shumin Qiu <shumin.qiu@intel.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15031 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-31 04:01:17 +00:00
Shumin Qiu 5142926433 Fix ECC errors:1.Update the comments in function headers to follow the Doxygen special documentation. 2.Make the first line of text in a comment block end with a period. 3.Update the member variable name for SHELL_OPERATION_TYPES to follow the rules "Must contain lower case characters". 4. Return type of a function should exist and in the first line.
Signed-off-by: Shumin Qiu <shumin.qiu@intel.com>
Reviewed-by: Dong, Eric <eric.dong@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15019 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-25 00:55:33 +00:00
Laszlo Ersek 6fa0da7d52 Add default way for switch in function 'RunCommandOrFile' of 'Shell.c'.
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Shumin Qiu <shumin.qiu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15018 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-24 07:25:31 +00:00
Jaben Carsey 6bd644638d ShellPkg: pre-verify split commands
This makes sure that all parts of commands split via pipe operation are valid before starting.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15011 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-20 01:13:36 +00:00
Jaben Carsey 12a27a6d81 ShellPkg: API name typo.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15010 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-19 22:09:17 +00:00
Jaben Carsey 404b3f4394 ShellPkg: fix whitespace character trimming
This makes TrimSpaces() trim tab characters off the end of the string also (not just the beginning).  Also updates loop to prevent buffer underrun.

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@15009 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-19 22:03:37 +00:00
Jaben Carsey e3eb7d825a ShellPkg: CTRL-C stops a running script at the same time
This makes CTRL-C stop a running script after trying to stop the command.  And adds comments to describe the behavior more clearly.

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@15008 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-19 21:55:13 +00:00
Jaben Carsey 806c49db05 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
2013-12-19 16:05:34 +00:00
Shumin Qiu 8dcd84b9d7 Converse the return value from 'int' to 'BOOLEAN' for function ‘ContainsSplit’ in Shell.c.
Signed-off-by: Shumin Qiu <shumin.qiu@intel.com>
Reviewed-by: Ni, Ruiyu <ruiyu.ni@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15006 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-19 02:03:42 +00:00
Jaben Carsey e7831c9070 ShellPkg: Add missing function header comments
I found that some function headers had insufficient/incorrect information.

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@14998 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-17 22:23:05 +00:00
Shumin Qiu 6f05676ddd Add a new line to initialize the variable “PassThruProtocol” in ConsoleWrapers.c to ensure the initialization not to be a part of its declaration.
Signed-off-by: Shumin Qiu <shumin.qiu@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14989 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-16 01:53:11 +00:00
Jaben Carsey cc31ac1e40 ShellPkg: add error messages into function
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@14986 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-13 23:53:59 +00:00
Jaben Carsey 5a5eb8069c ShellPkg: Refactor updating command line for help use
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@14985 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-13 21:58:51 +00:00
Jaben Carsey daf705847f ShellPkg: Refactor change to current file system
This moves the initialization for handling file system changes into a separate function.

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@14983 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-13 18:45:43 +00:00
Jaben Carsey 680db51153 ShellPkg: Refactor Split/Pipe based command lines
This moves the initialization for handling command lines with pipe ‘|’ into a separate function.

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@14982 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-13 18:18:27 +00:00
Jaben Carsey 6ba2921da3 ShellPkg: add API for determining operation type
There are no callers for this new API yet.  They will be added in the next commits.

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@14975 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-13 00:13:59 +00:00
Jaben Carsey 1ef61d0390 ShellPkg: Refactor Variable replacement into separate function
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@14974 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-12 21:44:23 +00:00
Jaben Carsey ca53c0af00 ShellPkg: Refactor Alias replacement into separate function
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@14973 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-12 21:16:38 +00:00
Jaben Carsey ad2bc85412 ShellPkg: refactor out leading and trailing space trimming
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@14972 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-12 18:42:18 +00:00
Jaben Carsey 321a8d494f ShellPkg: typo in the last commit.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14971 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-12 17:55:37 +00:00
Jaben Carsey 518c8cdc5c ShellPkg: Refactor out the searching for pipe characters
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@14969 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-12 17:27:27 +00:00
Jaben Carsey 19a4497259 ShellPkg: Refactor Pipe handling
This moves some logic for handling command lines with pipe ‘|’ into a separate function.

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@14958 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-10 18:41:35 +00:00
Shumin Qiu 42f75495f3 Follow Shell specification to make sure the “command.man” file is always used no matter “command.efi -?” or “command -?” is typed.
Signed-off-by: Shumin Qiu <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14947 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-09 02:24:39 +00:00
Jaben Carsey ed8b529782 ShellPkg: Unregister all registrations
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@14925 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-02 19:27:45 +00:00
Chris Phillips 416a423f08 ShellPkg: Remove trailing \r\n when redirect to env variable (EX: use ">v")
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@14891 6f19259b-4bc3-4df7-8a09-765794883524
2013-11-22 21:15:19 +00:00
Jaben Carsey d233c12291 ShellPkg: Fix help MAN file searching
Make sure that “help App” and “help App.EFI” work the same by removing “.efi” (case insensitive) from the end of the string before searching for MAN file.

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@14853 6f19259b-4bc3-4df7-8a09-765794883524
2013-11-15 20:21:34 +00:00
Chris Phillips 13acebbdef ShellPkg: Skip leading tabs when processing command line and scripts
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@14850 6f19259b-4bc3-4df7-8a09-765794883524
2013-11-15 18:41:50 +00:00
Jaben Carsey 6813ba402a ShellPkg: verify that leading and trailing % are removed from variable names when doing command line redirection to an environment variable.
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@14849 6f19259b-4bc3-4df7-8a09-765794883524
2013-11-15 18:39:26 +00:00
Chris Phillips 5b5cd144f3 ShellPkg: Properly set lasterror environment variable
- Set lasterror value based on platform width
- Use “lasterror” rather than “Lasterror” for variable name to match Shell Specification
- Set lasterror value when a binary or script file is not found

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@14816 6f19259b-4bc3-4df7-8a09-765794883524
2013-10-29 16:30:25 +00:00
Chris Phillips dcf9b428e6 ShellPkg: Fixes the shell so output redirection works for the 'mode' command
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@14800 6f19259b-4bc3-4df7-8a09-765794883524
2013-10-24 17:47:57 +00:00
Chris Phillips 85a3fa3ad7 ShellPkg: Stop running command when page break quit
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@14799 6f19259b-4bc3-4df7-8a09-765794883524
2013-10-24 17:29:33 +00:00
Eric Dong 2c5a8aed24 ShellPkg: Fix copy load option error.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14795 6f19259b-4bc3-4df7-8a09-765794883524
2013-10-22 01:14:54 +00:00
Chris Phillips 284e034f4f ShellPkg: Fixes for shell application launch, argument handling, and version output:
- Fixes shell application launch version output to match ‘ver’ command, as specified by the UEFI Shell spec.
- Adds PcdShellSupplier for <shell-supplier-specific-data> line of version output.  Defaulted to “EDK II”.
- Display only 1 startup.nsh countdown line per second instead of 10 per second.
- Fix issue where command line is just 1 or more “ “ characters and displayed garbage.
- Fix for @echo –off and @echo –on to not restore echo state

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@14784 6f19259b-4bc3-4df7-8a09-765794883524
2013-10-18 15:49:23 +00:00
Eric Dong a71003f249 Refine the select language logic.
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14629 6f19259b-4bc3-4df7-8a09-765794883524
2013-09-05 03:02:14 +00:00
Robert Matthews ed34da4007 ShellPkg: Fix LastError environment variable truncation
-Fixes LastError environment variable being truncated to 32 bits on 64 bit systems
-Fixes possible buffer overrun issue with LastError string value

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Robert Matthews <robert.matthews@hp.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14608 6f19259b-4bc3-4df7-8a09-765794883524
2013-08-28 14:38:13 +00:00
Jaben Carsey df07baea2f ShellPkg: update behavior with undefined environment variables
Undefined environment variables are now removed during script execution.
Excepted environment variables are now correctly un-excepted right before processing continues

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <Jaben.carsey@intel.com>
reviewed-by: Matthews, Robert <Robert.Matthews@hp.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14585 6f19259b-4bc3-4df7-8a09-765794883524
2013-08-21 18:11:23 +00:00
Ruiyu Ni e3df6949e7 Fix GCC build failure.
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14519 6f19259b-4bc3-4df7-8a09-765794883524
2013-07-30 06:41:43 +00:00
Ruiyu Ni 863986b3c8 Update all the code to consume the ConvertDevicePathToText, ConvertDevicePathNodeToText, ConvertTextToDevicePath and ConvertTextToDeviceNode APIs in DevicePathLib.
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Elvin Li <elvin.li@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14505 6f19259b-4bc3-4df7-8a09-765794883524
2013-07-26 03:14:08 +00:00
jaben carsey ca79c79821 ShellPkg: make automatically created shells quit automatically
This creates a new parameter to this shell implementation “_exit” that causes the shell to automatically exit after running the initial specified command line.  This also automatically uses that command in the Execute() API.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: jaben carsey <jaben.carsey@intel.com>
Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hp.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14444 6f19259b-4bc3-4df7-8a09-765794883524
2013-06-27 16:11:39 +00:00
jcarsey 28981267c5 ShellPkg: Fix ARM build errors.
submitted-by: Olivier Martin olivier.martin@arm.com>
reviewed-by: Jaben Carsey <Jaben.Carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14400 6f19259b-4bc3-4df7-8a09-765794883524
2013-06-11 22:07:03 +00:00
jcarsey e755a4ca10 ShellPkg: Fixed build error 'variable set but not used'
GCC toolchain cannot build ShellPkg.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Harry Liebel <Harry.Liebel@arm.com>
Signed-off-by: Olivier Martin <Olivier.Martin@arm.com>
Reviewed-by: Jaben Carsey <Jaben.Carsey@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14326 6f19259b-4bc3-4df7-8a09-765794883524
2013-05-07 17:57:58 +00:00
jcarsey e886b675bd ShellPkg: Fix pointer initialization error of “ShellOpt” Shell environment variable
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Samer El-Haj-Mahmoud elhaj@hp.com 
Reviewed-by: jaben carsey <jaben.carsey@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14064 6f19259b-4bc3-4df7-8a09-765794883524
2013-01-17 19:04:36 +00:00
jcarsey 73b5f8bcee ShellPkg: Remove “2.0” prefix text from shell prompt.
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://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13982 6f19259b-4bc3-4df7-8a09-765794883524
2012-12-03 16:40:55 +00:00
jcarsey 926704714e ShellPkg: Fix line responsible for deleting “cwd” variable when exit shell.
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://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13943 6f19259b-4bc3-4df7-8a09-765794883524
2012-11-14 23:43:33 +00:00
jcarsey 0406a5717b ShellPkg: Clean up header file usage.
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://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13939 6f19259b-4bc3-4df7-8a09-765794883524
2012-11-13 22:39:09 +00:00
jcarsey 3f869579a4 ShellPkg: Correct 3 places where memory was not being properly released by the shell.
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>
Reviewed-by: Liu, Jiang A <jiang.a.liu@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13938 6f19259b-4bc3-4df7-8a09-765794883524
2012-11-13 16:08:52 +00:00
lzeng14 ce68d3bc68 Add missing braces around initializer.
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Qian Ouyang <qian.ouyang@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13817 6f19259b-4bc3-4df7-8a09-765794883524
2012-10-11 02:15:23 +00:00
ydong10 81634bfb53 Fix display color error when scroll up/down the screen.
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13705 6f19259b-4bc3-4df7-8a09-765794883524
2012-09-07 01:54:47 +00:00
ydong10 4ccd9214a4 Update the "ConErr" related variable name to the new one "ErrOut".
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13641 6f19259b-4bc3-4df7-8a09-765794883524
2012-08-17 03:58:17 +00:00