summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGao, Liming liming.gao <Gao, Liming liming.gao@intel.com>2014-07-25 21:10:20 +0000
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2014-07-25 21:10:20 +0000
commit8b7ebdb0055241e3e573fb7c561a969be33d591d (patch)
treed99a1feb7313c0a3873172d307d220790f61f3b1
parent05154781676f8f591f4c0846ba6305ab9716c9e6 (diff)
downloadedk2-8b7ebdb0055241e3e573fb7c561a969be33d591d.tar.gz
edk2-8b7ebdb0055241e3e573fb7c561a969be33d591d.tar.bz2
edk2-8b7ebdb0055241e3e573fb7c561a969be33d591d.zip
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
-rw-r--r--BaseTools/Source/C/Common/ParseInf.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/BaseTools/Source/C/Common/ParseInf.c b/BaseTools/Source/C/Common/ParseInf.c
index bbccb61732..385758f836 100644
--- a/BaseTools/Source/C/Common/ParseInf.c
+++ b/BaseTools/Source/C/Common/ParseInf.c
@@ -236,6 +236,7 @@ Returns:
{
CHAR8 InputBuffer[_MAX_PATH];
CHAR8 *CurrentToken;
+ CHAR8 *Delimiter;
BOOLEAN ParseError;
BOOLEAN ReadError;
UINTN Occurrance;
@@ -283,8 +284,13 @@ Returns:
//
// Get the first non-whitespace string
//
+ Delimiter = strchr (InputBuffer, '=');
+ if (Delimiter != NULL) {
+ *Delimiter = 0;
+ }
+
CurrentToken = strtok (InputBuffer, " \t\n");
- if (CurrentToken == NULL) {
+ if (CurrentToken == NULL || Delimiter == NULL) {
//
// Whitespace line found (or comment) so continue
//
@@ -311,17 +317,29 @@ Returns:
//
// Copy the contents following the =
//
- CurrentToken = strtok (NULL, "= \t\n");
- if (CurrentToken == NULL) {
+ CurrentToken = Delimiter + 1;
+ if (*CurrentToken == 0) {
//
// Nothing found, parsing error
//
ParseError = TRUE;
} else {
//
+ // Strip leading white space
+ //
+ while (*CurrentToken == ' ' || *CurrentToken == '\t') {
+ CurrentToken++;
+ }
+ //
// Copy the current token to the output value
//
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;
}
} else {