Enlightenment CVS committal

Author  : atmosphere
Project : misc
Module  : elogin

Dir     : misc/elogin/src/daemon


Modified Files:
        spawner.c 


Log Message:
patch from JeopardE 
* don't segv when unknown commands are passed
* added -help flag 

===================================================================
RCS file: /cvsroot/enlightenment/misc/elogin/src/daemon/spawner.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- spawner.c   21 Jan 2003 05:20:17 -0000      1.13
+++ spawner.c   22 Jan 2003 16:23:05 -0000      1.14
@@ -72,21 +72,19 @@
 main(int argc, char **argv)
 {
    int c;
-   char *d_opt_str = "nodaemon";
    int nodaemon = 0;
-   struct option d_opt;
+   struct option d_opt[] = {
+      {"nodaemon", 0, 0, 1},
+      {"help", 0, 0, 2},
+      {0, 0, 0, 0}
+   };
    pid_t elogind_pid = getpid();
 
-   d_opt.name = d_opt_str;
-   d_opt.has_arg = 0;
-   d_opt.flag = NULL;
-   d_opt.val = 2;
-
    putenv("DISPLAY");
    /* get command line arguments */
    while (1)
    {
-      c = getopt_long_only(argc, argv, "d:", &d_opt, NULL);
+      c = getopt_long_only(argc, argv, "d:", d_opt, NULL);
       if (c == -1)
          break;
       switch (c)
@@ -94,9 +92,27 @@
         case 'd':              /* display */
            setenv("DISPLAY", optarg, 1);
            break;
-        case 2:                /* nodaemon */
+        case 1:                /* nodaemon */
            nodaemon = 1;
            break;
+        case 2:
+           printf("Elogind - Launcher for the Elogin Display Manager\n");
+           printf("Usage: %s [OPTION] ...\n\n", argv[0]);
+           printf
+              
+("--------------------------------------------------------------------------\n");
+           printf("  -d DISPLAY         Connect to an existing X server\n");
+           printf("  -help              Display this help message\n");
+           printf
+              ("  -nodaemon          Don't fork to background (useful for init 
+scripts)\n");
+           printf
+              
+("==========================================================================\n\n");
+           printf
+              ("Note: if you're launching Elogin from within an existing X session, 
+don't\n");
+           printf
+              ("try to use elogind or you may get unexpected results. Instead, 
+launch\n");
+           printf("elogin directly by typing \"elogin\".\n\n");
+           exit(0);
+
         default:
            fprintf(stderr, "Warning: Unknown command line option\n");
       }




-------------------------------------------------------
This SF.net email is sponsored by: Scholarships for Techies!
Can't afford IT training? All 2003 ictp students receive scholarships.
Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more.
www.ictp.com/training/sourceforge.asp
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to