From: Daniel <qu...@ha...> - 2013-07-26 18:33:51
|
--- database.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/database.c b/database.c index 7dd4a9a..8e2757f 100644 --- a/database.c +++ b/database.c @@ -275,13 +275,23 @@ parse_database(FILE *in) if(!(tmp = strchr(line, ']'))) sec = 0; /*incorrect section lines are skipped*/ } else if((tmp = strchr(line, '=') ) && sec) { + char *fieldend = tmp - 1; *tmp++ = '\0'; + while (fieldend >= line && (*fieldend == ' ' || *fieldend == '\t')) { + *fieldend-- = '\0'; + } find_field_number(line, &field); if(field != -1) { + while (*tmp == ' ' || *tmp == '\t') { + tmp++; + } item[field] = xstrdup(tmp); goto next; } else if(!strcasecmp(opt_get_str(STR_PRESERVE_FIELDS), "all")){ + while (*tmp == ' ' || *tmp == '\t') { + tmp++; + } declare_unknown_field(line); item = xrealloc(item, ITEM_SIZE); item[fields_count - 1] = xstrdup(tmp); -- 1.8.3.4 |