Enlightenment CVS committal

Author  : xcomputerman
Project : e17
Module  : apps/entrance

Dir     : e17/apps/entrance/src/daemon


Modified Files:
        spawner.c spawner.h 


Log Message:
- Fix non-working -display option for spawner
- Add option to specify a custom config instead of the default

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/daemon/spawner.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- spawner.c   6 Nov 2003 23:56:26 -0000       1.12
+++ spawner.c   16 Feb 2004 01:04:06 -0000      1.13
@@ -78,6 +78,7 @@
    d->xprog = strdup(X_SERVER);
    d->attempts = 5;
    d->status = NOT_RUNNING;
+   d->config = NULL;
    d->e_exe = NULL;
    d->x_exe = NULL;
    d->display = NULL;
@@ -114,6 +115,7 @@
 Entranced_Start_Server_Once(Entranced_Spawner_Display * d)
 {
    double start_time;
+   char x_cmd[PATH_MAX];
 
    /* Ecore_Exe *x_exe; */
    pid_t xpid;
@@ -127,6 +129,11 @@
 
    x_ready = 0;
 
+   if(d->name)
+      snprintf(x_cmd, PATH_MAX, "%s %s", X_SERVER, d->name);
+   else
+      snprintf(x_cmd, PATH_MAX, "%s", X_SERVER);
+
    /* x_exe = ecore_exe_run(d->xprog, d); */
    switch (xpid = fork())
    {
@@ -135,10 +142,12 @@
         return -1;
      case 0:
         sigaction(SIGUSR1, &_entrance_x_sa, NULL);
-        execl("/bin/sh", "/bin/sh", "-c", X_SERVER, NULL);
+        execl("/bin/sh", "/bin/sh", "-c", x_cmd, NULL);
         syslog(LOG_WARNING, "Could not execute X server.");
         exit(1);
      default:
+        if (d->name)
+           free(d->name);
         d->name = strdup(getenv("DISPLAY"));
         start_time = ecore_time_get();
 
@@ -170,7 +179,12 @@
 {
    char entrance_cmd[PATH_MAX];
 
-   snprintf(entrance_cmd, PATH_MAX, "%s %s", ENTRANCE, d->name);
+   snprintf(entrance_cmd, PATH_MAX, "%s -d %s", ENTRANCE, d->name);
+   if (d->config)
+      snprintf(entrance_cmd, PATH_MAX, "%s -d %s -c \"%s\"", 
+               ENTRANCE, d->name, d->config);
+   else
+      snprintf(entrance_cmd, PATH_MAX, "%s -d %s", ENTRANCE, d->name);
    d->e_exe = ecore_exe_run(entrance_cmd, d);
 }
 
@@ -346,6 +360,8 @@
    int nodaemon = 0;            /* TODO: Config-ize this variable */
    Entranced_Spawner_Display *d;
    struct option d_opt[] = {
+      {"config", 1, 0, 1},
+      {"display", 1, 0, 1},
       {"nodaemon", 0, 0, 1},
       {"help", 0, 0, 2},
       {0, 0, 0, 0}
@@ -359,15 +375,22 @@
    putenv("DISPLAY");           /* Not sure why this is here :) */
    openlog("entranced", LOG_NOWAIT, LOG_DAEMON);
 
+   /* Set up a spawner context */
+   d = Entranced_Spawner_Display_New();
+
    /* Parse command-line options */
    while (1)
    {
-      c = getopt_long_only(argc, argv, "d:", d_opt, NULL);
+      c = getopt_long_only(argc, argv, "c:d:", d_opt, NULL);
       if (c == -1)
          break;
       switch (c)
       {
+        case 'c':
+           d->config = strdup(optarg);
+           break;
         case 'd':
+           d->name = strdup(optarg);
            setenv("DISPLAY", optarg, 1);
            break;
         case 1:
@@ -379,6 +402,7 @@
            printf("Usage: %s [OPTION] ...\n\n", argv[0]);
            printf
               
("--------------------------------------------------------------------------\n");
+           printf("  -c CONFIG          Specify config file for greeter\n");
            printf("  -d DISPLAY         Connect to an existing X server\n");
            printf("  -help              Display this help message\n");
            printf
@@ -427,9 +451,6 @@
       close(2);
    }
 
-   /* Set up a spawner context */
-   d = Entranced_Spawner_Display_New();
-
    /* Event filter */
    _e_filter =
       ecore_event_filter_add(Entranced_Filter_Start, Entranced_Filter_Loop,
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/daemon/spawner.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- spawner.h   25 Oct 2003 04:50:28 -0000      1.7
+++ spawner.h   16 Feb 2004 01:04:06 -0000      1.8
@@ -36,6 +36,7 @@
    Display *display;
    char *name;                  /* the name of the x display */
    char *xprog;                 /* the X execution string */
+   char *config;                /* Config file for entrance binary */
    int attempts;
    int status;
    Ecore_Exe *e_exe, *x_exe;




-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to