diff options
Diffstat (limited to 'lib/avtp_pipeline/inih/ini.c')
-rw-r--r-- | lib/avtp_pipeline/inih/ini.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/avtp_pipeline/inih/ini.c b/lib/avtp_pipeline/inih/ini.c index 0f32fa56..d38006c9 100644 --- a/lib/avtp_pipeline/inih/ini.c +++ b/lib/avtp_pipeline/inih/ini.c @@ -79,6 +79,7 @@ int ini_parse_file(FILE* file, char* value; int lineno = 0; int error = 0; + int value_quoted = 0; #if !INI_USE_STACK line = (char*)malloc(INI_MAX_LINE); @@ -140,9 +141,18 @@ int ini_parse_file(FILE* file, *end = '\0'; rstrip(value); + /* If the value starts and ends with a quote character, extract the string from inside the quotes. */ + if (value[0] == '\"') { + char *end_quote = strchr(value + 1, '\"'); + if (end_quote) { + *end_quote = '\0'; + value_quoted = 1; + } + } + /* Valid name[=:]value pair found, call handler */ strncpy0(prev_name, name, sizeof(prev_name)); - if (!handler(user, section, name, value) && !error) + if (!handler(user, section, name, (value_quoted ? value + 1 : value)) && !error) error = lineno; } else if (!error) { |