X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=ShellPkg%2FLibrary%2FUefiShellLevel2CommandsLib%2FParse.c;h=4072b9469d01b961beb010224862c34c55148661;hp=927c8d972993dbd373d51baa468a769fa3aad0b8;hb=3a8406adb367e8b0d2f107adfc6c141b953d938d;hpb=a405b86d274d32b92f69842bfb9a1ab143128f57 diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c index 927c8d9729..4072b9469d 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c @@ -1,7 +1,7 @@ /** @file Main file for Parse shell level 2 function. - Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -14,6 +14,19 @@ #include "UefiShellLevel2CommandsLib.h" +/** + Do the actual parsing of the file. the file should be SFO output from a + shell command or a similar format. + + @param[in] FileName The filename to open. + @param[in] TableName The name of the table to find. + @param[in] ColumnIndex The column number to get. + @param[in] TableNameInstance Which instance of the table to get (row). + @param[in] ShellCommandInstance Which instance of the command to get. + + @retval SHELL_NOT_FOUND The requested instance was not found. + @retval SHELL_SUCCESS The operation was successful. +**/ SHELL_STATUS EFIAPI PerformParsing( @@ -78,22 +91,26 @@ PerformParsing( } } if (ColumnLoop == ColumnIndex) { - ASSERT(ColumnPointer != NULL); - 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) { + 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); } - 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); } } SHELL_FREE_NON_NULL(TempLine);