Enlightenment CVS committal

Author  : sebastid
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/src/lib/ecore_file


Modified Files:
        ecore_file.c 


Log Message:
Tilde expansion

===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_file/ecore_file.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- ecore_file.c        30 Sep 2005 00:46:14 -0000      1.17
+++ ecore_file.c        30 Sep 2005 00:51:29 -0000      1.18
@@ -307,12 +307,39 @@
      }
    exe2 = p;
    if (exe2 == exe1) return NULL;
-   exe = malloc(exe2 - exe1 + 1);
-   if (!exe) return NULL;
+   if (*exe1 == '~')
+     {
+       char *homedir;
+       int len;
+
+       /* Skip ~ */
+       exe1++;
+
+       homedir = getenv("HOME");
+       if (!homedir) return NULL;
+       len = strlen(homedir);
+       exe = malloc(len + exe2 - exe1 + 2);
+       if (!exe) return NULL;
+       if (len)
+         {
+            strcpy(exe, homedir);
+            pp = exe + len;
+            if (*(pp - 1) != '/')
+              {
+                 *pp = '/';
+                 pp++;
+              }
+         }
+     }
+   else
+     {
+       exe = malloc(exe2 - exe1 + 1);
+       if (!exe) return NULL;
+       pp = exe;
+     }
    p = exe1;
    in_quot_dbl = 0;
    in_quot_sing = 0;
-   pp = exe;
    while (*p)
      {
        if (in_quot_sing)




-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to