Enlightenment CVS committal

Author  : handyande
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/lib


Modified Files:
        e_main.c 


Log Message:
Fixup to use e's DISPLAY padding and use the env if passed param is NULL
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/lib/e_main.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- e_main.c    30 Jan 2005 06:27:51 -0000      1.4
+++ e_main.c    11 Feb 2005 23:24:50 -0000      1.5
@@ -34,9 +34,43 @@
 int
 e_init(const char* display)
 {
+   char *disp, *pos;
+   int free_disp;
+
    if (_e_ipc_server)
      return 0;
 
+   free_disp = 0;
+   if (display)
+     disp = (char *) display;
+   else
+     disp = getenv("DISPLAY");
+   
+   if (!disp)
+     fprintf(stderr, "ERROR: No display parameter passed to e_init, and no 
DISPLAY variable\n");
+
+   pos = strrchr(disp, ':');
+   if (!pos)
+     {
+       char *tmp;
+       tmp = malloc(strlen(disp) + 5);
+       snprintf(tmp, sizeof(tmp), "%s:0.0", disp);
+       disp = tmp;
+       free_disp = 1;
+     }
+   else
+     {
+       pos = strrchr(pos, '.');
+       if (!pos)
+         {
+            char *tmp;
+            tmp = malloc(strlen(disp) + 3);
+            snprintf(tmp, strlen(tmp), "%s.0", disp);
+            disp = tmp;
+            free_disp = 1;
+         }
+     }
+
    /* basic ecore init */
    if (!ecore_init())
      {
@@ -54,7 +88,7 @@
      }
 
    /* setup e ipc service */
-   if (!_e_ipc_init(display))
+   if (!_e_ipc_init(disp))
      {
        fprintf(stderr, "ERROR: Enlightenment cannot set up the IPC socket.\n"
               "Did you specify the right display?\n");
@@ -67,6 +101,8 @@
        E_RESPONSE_BACKGROUND_GET = ecore_event_type_new();
      }
    
+   if (free_disp)
+     free(disp);
    return 1;
 }
 




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to