efreet: backport patch for user dirs
authorenglebass <englebass@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 22 Nov 2012 20:54:51 +0000 (20:54 +0000)
committerenglebass <englebass@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 22 Nov 2012 20:54:51 +0000 (20:54 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/branches/efreet-1.7@79549 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/efreet_base.c

index afb5920..6ee0119 100644 (file)
@@ -21,6 +21,7 @@ void *alloca (size_t);
 #endif
 
 #include <unistd.h>
+#include <ctype.h>
 
 #ifdef _WIN32
 # include <winsock2.h>
@@ -356,6 +357,7 @@ efreet_user_dir_get(const char *key, const char *fallback)
    EINA_ITERATOR_FOREACH(it, line)
      {
         const char *eq, *end;
+        Eina_Bool quote = EINA_FALSE;
 
         if (line->length < 3) continue;
         if (line->start[0] == '#') continue;
@@ -364,9 +366,18 @@ efreet_user_dir_get(const char *key, const char *fallback)
         if (!eq) continue;
         if (strncmp(key, line->start, eq - line->start)) continue;
         if (++eq >= line->end) continue;
-        if (*eq != '"') continue;
-        if (++eq >= line->end) continue;
-        end = memchr(eq, '"', line->end - eq);
+        if (*eq == '"')
+        {
+            quote = EINA_TRUE;
+            if (++eq >= line->end) continue;
+        }
+        if (quote)
+            end = memchr(eq, '"', line->end - eq);
+        else
+        {
+            end = line->end;
+            while (isspace(*end)) end--;
+        }
         if (!end) continue;
         ret = alloca(end - eq + 1);
         memcpy(ret, eq, end - eq);