25 SHELL_FILE_HANDLE FileHandle;
29 UINT64 OriginalFilePosition;
33 OriginalFilePosition = 0;
36 CharSize =
sizeof (CHAR16);
37 gEfiShellProtocol->GetFilePosition (FileHandle, &OriginalFilePosition);
38 Status = gEfiShellProtocol->ReadFile (FileHandle, &CharSize, &CharBuffer);
39 if (EFI_ERROR (Status) || (CharSize !=
sizeof (CHAR16))) {
43 gEfiShellProtocol->SetFilePosition (FileHandle, OriginalFilePosition);
46 if (FileHandle ==
NULL) {
85 while (*StrWalker != CHAR_NULL) {
86 if ((*StrWalker == L
'^') && ((*(StrWalker + 1) == L
'^') || (*(StrWalker + 1) == L
'"'))) {
87 *NewStr = *(StrWalker + 1);
121 IN BOOLEAN StreamingUnicode
124 SHELL_FILE_HANDLE FileHandle;
130 CHAR16 *ColumnPointer;
135 ASSERT (FileName !=
NULL);
136 ASSERT (TableName !=
NULL);
141 if (EFI_ERROR (Status)) {
148 for (LoopVariable = 0; LoopVariable < ShellCommandInstance && !
ShellFileHandleEof (FileHandle);) {
151 if ((TempLine ==
NULL) || ((*TempLine == CHAR_NULL) && StreamingUnicode)) {
160 if (
StrStr (TempLine, L
"ShellCommand,") == TempLine) {
164 SHELL_FREE_NON_NULL (TempLine);
167 if (LoopVariable == ShellCommandInstance) {
171 if ( (TempLine ==
NULL)
172 || (*TempLine == CHAR_NULL)
173 || (
StrStr (TempLine, L
"ShellCommand,") == TempLine))
175 SHELL_FREE_NON_NULL (TempLine);
179 if (
StrStr (TempLine, TableName) == TempLine) {
181 if ( (LoopVariable == TableNameInstance)
182 || (TableNameInstance == (
UINTN)-1))
184 for (ColumnLoop = 1, ColumnPointer = TempLine; ColumnLoop < ColumnIndex && ColumnPointer !=
NULL && *ColumnPointer != CHAR_NULL; ColumnLoop++) {
185 ColumnPointer =
StrStr (ColumnPointer, L
",\"");
186 if ((ColumnPointer !=
NULL) && (*ColumnPointer != CHAR_NULL)) {
191 if (ColumnLoop == ColumnIndex) {
192 if (ColumnPointer ==
NULL) {
196 TempSpot =
StrStr (ColumnPointer, L
",\"");
197 if (TempSpot !=
NULL) {
198 *TempSpot = CHAR_NULL;
201 while (ColumnPointer !=
NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[0] == L
' ') {
205 if ((ColumnPointer !=
NULL) && (*ColumnPointer != CHAR_NULL) && (ColumnPointer[0] == L
'\"')) {
209 if ((ColumnPointer !=
NULL) && (*ColumnPointer != CHAR_NULL) && (ColumnPointer[
StrLen (ColumnPointer) - 1] == L
'\"')) {
210 ColumnPointer[
StrLen (ColumnPointer) - 1] = CHAR_NULL;
214 if (SfoString !=
NULL) {
216 SHELL_FREE_NON_NULL (SfoString);
223 SHELL_FREE_NON_NULL (TempLine);
228 return (ShellStatus);
252 CHAR16 *ProblemParam;
253 CONST CHAR16 *FileName;
254 CONST CHAR16 *TableName;
255 CONST CHAR16 *ColumnString;
257 UINTN ShellCommandInstance;
258 UINTN TableNameInstance;
259 BOOLEAN StreamingUnicode;
263 StreamingUnicode =
FALSE;
275 if (EFI_ERROR (Status)) {
276 if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam !=
NULL)) {
296 if (StreamingUnicode) {
307 TableNameInstance = (
UINTN)-1;
313 ShellCommandInstance = 1;
318 if ((FileName !=
NULL) && (TableName !=
NULL) && (ColumnString !=
NULL)) {
319 ShellStatus =
PerformParsing (FileName, TableName,
ShellStrToUintn (ColumnString), TableNameInstance, ShellCommandInstance, StreamingUnicode);
331 return (ShellStatus);
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
CHAR16 *EFIAPI StrStr(IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_STATUS EFIAPI FileHandleIsDirectory(IN EFI_FILE_HANDLE DirHandle)
#define ASSERT_EFI_ERROR(StatusParameter)
@ SHELL_INVALID_PARAMETER
EFI_STRING HandleStringWithEscapeCharForParse(IN CHAR16 *String)
BOOLEAN IsStdInDataAvailable(VOID)
SHELL_STATUS PerformParsing(IN CONST CHAR16 *FileName, IN CONST CHAR16 *TableName, IN CONST UINTN ColumnIndex, IN CONST UINTN TableNameInstance, IN CONST UINTN ShellCommandInstance, IN BOOLEAN StreamingUnicode)
SHELL_STATUS EFIAPI ShellCommandRunParse(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
BOOLEAN EFIAPI ShellFileHandleEof(IN SHELL_FILE_HANDLE Handle)
CHAR16 *EFIAPI ShellFileHandleReturnLine(IN SHELL_FILE_HANDLE Handle, IN OUT BOOLEAN *Ascii)
CONST CHAR16 *EFIAPI ShellCommandLineGetValue(IN CONST LIST_ENTRY *CheckPackage, IN CHAR16 *KeyString)
UINTN EFIAPI ShellStrToUintn(IN CONST CHAR16 *String)
EFI_STATUS EFIAPI ShellPrintHiiEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR8 *Language OPTIONAL, IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_HII_HANDLE HiiFormatHandle,...)
@ TypeValue
A flag that has some data following it with a space (IE "-a 1").
EFI_STATUS EFIAPI ShellOpenFileByName(IN CONST CHAR16 *FileName, OUT SHELL_FILE_HANDLE *FileHandle, IN UINT64 OpenMode, IN UINT64 Attributes)
EFI_STATUS EFIAPI ShellCommandLineParseEx(IN CONST SHELL_PARAM_ITEM *CheckList, OUT LIST_ENTRY **CheckPackage, OUT CHAR16 **ProblemParam OPTIONAL, IN BOOLEAN AutoPageBreak, IN BOOLEAN AlwaysAllowNumbers)
VOID EFIAPI ShellCommandLineFreeVarList(IN LIST_ENTRY *CheckPackage)
EFI_STATUS EFIAPI ShellInitialize(VOID)
EFI_STATUS EFIAPI ShellPrintEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR16 *Format,...)
CONST CHAR16 *EFIAPI ShellCommandLineGetRawValue(IN CONST LIST_ENTRY *CONST CheckPackage, IN UINTN Position)
UINTN EFIAPI ShellCommandLineGetCount(IN CONST LIST_ENTRY *CheckPackage)