Update GenFv tool to handle the file path with space.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gao, Liming liming.gao@intel.com
Review-by: Kinney, Michael D michael.d.kinney@intel.com

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15685 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Gao, Liming liming.gao
2014-07-25 21:10:20 +00:00
committed by jljusten
parent 0515478167
commit 8b7ebdb005

View File

@ -236,6 +236,7 @@ Returns:
{ {
CHAR8 InputBuffer[_MAX_PATH]; CHAR8 InputBuffer[_MAX_PATH];
CHAR8 *CurrentToken; CHAR8 *CurrentToken;
CHAR8 *Delimiter;
BOOLEAN ParseError; BOOLEAN ParseError;
BOOLEAN ReadError; BOOLEAN ReadError;
UINTN Occurrance; UINTN Occurrance;
@ -283,8 +284,13 @@ Returns:
// //
// Get the first non-whitespace string // Get the first non-whitespace string
// //
Delimiter = strchr (InputBuffer, '=');
if (Delimiter != NULL) {
*Delimiter = 0;
}
CurrentToken = strtok (InputBuffer, " \t\n"); CurrentToken = strtok (InputBuffer, " \t\n");
if (CurrentToken == NULL) { if (CurrentToken == NULL || Delimiter == NULL) {
// //
// Whitespace line found (or comment) so continue // Whitespace line found (or comment) so continue
// //
@ -311,17 +317,29 @@ Returns:
// //
// Copy the contents following the = // Copy the contents following the =
// //
CurrentToken = strtok (NULL, "= \t\n"); CurrentToken = Delimiter + 1;
if (CurrentToken == NULL) { if (*CurrentToken == 0) {
// //
// Nothing found, parsing error // Nothing found, parsing error
// //
ParseError = TRUE; ParseError = TRUE;
} else { } else {
//
// Strip leading white space
//
while (*CurrentToken == ' ' || *CurrentToken == '\t') {
CurrentToken++;
}
// //
// Copy the current token to the output value // Copy the current token to the output value
// //
strcpy (Value, CurrentToken); strcpy (Value, CurrentToken);
//
// Strip trailing white space
//
while (strlen(Value) > 0 && (*(Value + strlen(Value) - 1) == ' ' || *(Value + strlen(Value) - 1) == '\t')) {
*(Value + strlen(Value) - 1) = 0;
}
return EFI_SUCCESS; return EFI_SUCCESS;
} }
} else { } else {