summaryrefslogtreecommitdiff
path: root/ShellPkg
diff options
context:
space:
mode:
authorChris Phillips <chrisp@hp.com>2014-08-21 20:28:32 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2014-08-21 20:28:32 +0000
commit78d42190ce066d36909ec63b213b37dc04b9f2c4 (patch)
treeb6a940715af4d0f84591553e008bbf039a218a96 /ShellPkg
parent73768087c464615d95ea95fb4a281cbfb17147a3 (diff)
downloadedk2-78d42190ce066d36909ec63b213b37dc04b9f2c4.zip
edk2-78d42190ce066d36909ec63b213b37dc04b9f2c4.tar.gz
edk2-78d42190ce066d36909ec63b213b37dc04b9f2c4.tar.bz2
ShellPkg: Fixes and updates for the 'parse' command
- Fix SFO file parsing to match UEFI Shell 2.1 spec - Update help output for easier viewing 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@15873 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c74
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.unibin113196 -> 114538 bytes
2 files changed, 41 insertions, 33 deletions
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c
index 4072b94..3b7a04f 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c
@@ -1,6 +1,7 @@
/** @file
Main file for Parse shell level 2 function.
+ (C) Copyright 2013-2014, Hewlett-Packard Development Company, L.P.
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -56,13 +57,22 @@ PerformParsing(
if (EFI_ERROR(Status)) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel2HiiHandle, FileName);
ShellStatus = SHELL_NOT_FOUND;
+ } else if (!EFI_ERROR (FileHandleIsDirectory (FileHandle))) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NOT_FILE), gShellLevel2HiiHandle, FileName);
+ ShellStatus = SHELL_NOT_FOUND;
} else {
for (LoopVariable = 0 ; LoopVariable < ShellCommandInstance && !ShellFileHandleEof(FileHandle);) {
TempLine = ShellFileHandleReturnLine(FileHandle, &Ascii);
if (TempLine == NULL) {
break;
}
- if (StrStr(TempLine, L"ShellCommand, \"") == TempLine) {
+
+ //
+ // Search for "ShellCommand," in the file to start the SFO table
+ // for a given ShellCommand. The UEFI Shell spec does not specify
+ // a space after the comma.
+ //
+ if (StrStr (TempLine, L"ShellCommand,") == TempLine) {
LoopVariable++;
}
SHELL_FREE_NON_NULL(TempLine);
@@ -71,45 +81,43 @@ PerformParsing(
LoopVariable = 0;
while(1) {
TempLine = ShellFileHandleReturnLine(FileHandle, &Ascii);
- if ( TempLine == NULL
- || *TempLine == CHAR_NULL
- || StrStr(TempLine, L"ShellCommand, \"") == TempLine
- ){
+ if (TempLine == NULL
+ || *TempLine == CHAR_NULL
+ || StrStr (TempLine, L"ShellCommand,") == TempLine) {
SHELL_FREE_NON_NULL(TempLine);
break;
}
- if (StrStr(TempLine, TableName) == TempLine) {
+ if (StrStr (TempLine, TableName) == TempLine) {
LoopVariable++;
- }
- if ( LoopVariable == TableNameInstance
- || (TableNameInstance == (UINTN)-1 && StrStr(TempLine, TableName) == TempLine)
- ){
- for (ColumnLoop = 1, ColumnPointer = TempLine; ColumnLoop < ColumnIndex && ColumnPointer != NULL && *ColumnPointer != CHAR_NULL; ColumnLoop++) {
- ColumnPointer = StrStr(ColumnPointer, L",");
- if (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL){
- ColumnPointer++;
- }
- }
- if (ColumnLoop == ColumnIndex) {
- if (ColumnPointer == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel2HiiHandle, L"Column Index");
- ShellStatus = SHELL_INVALID_PARAMETER;
- } else {
- TempSpot = StrStr(ColumnPointer, L",");
- if (TempSpot != NULL) {
- *TempSpot = CHAR_NULL;
- }
- while (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[0] == L' '){
- ColumnPointer++;
- }
- if (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[0] == L'\"'){
+ if (LoopVariable == TableNameInstance
+ || (TableNameInstance == (UINTN)-1)) {
+ for (ColumnLoop = 1, ColumnPointer = TempLine; ColumnLoop < ColumnIndex && ColumnPointer != NULL && *ColumnPointer != CHAR_NULL; ColumnLoop++) {
+ ColumnPointer = StrStr (ColumnPointer, L",");
+ if (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL){
ColumnPointer++;
}
- if (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[StrLen(ColumnPointer)-1] == L'\"'){
- ColumnPointer[StrLen(ColumnPointer)-1] = CHAR_NULL;
+ }
+ if (ColumnLoop == ColumnIndex) {
+ if (ColumnPointer == NULL) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel2HiiHandle, L"Column Index");
+ ShellStatus = SHELL_INVALID_PARAMETER;
+ } else {
+ TempSpot = StrStr (ColumnPointer, L",");
+ if (TempSpot != NULL) {
+ *TempSpot = CHAR_NULL;
+ }
+ while (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[0] == L' '){
+ ColumnPointer++;
+ }
+ if (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[0] == L'\"'){
+ ColumnPointer++;
+ }
+ if (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[StrLen (ColumnPointer) - 1] == L'\"'){
+ ColumnPointer[StrLen (ColumnPointer) - 1] = CHAR_NULL;
+ }
+
+ ShellPrintEx (-1, -1, L"%s\r\n", ColumnPointer);
}
-
- ShellPrintEx(-1, -1, L"%s\r\n", ColumnPointer);
}
}
}
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni
index 464c218..dd07cf0 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni
Binary files differ