---
 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


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Abook-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/abook-devel

Reply via email to