Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        main.c 


Log Message:
Remove broken -smfile command line option.
Add -p (--config-prefix) command line option to set the configuration file 
prefix.

===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/main.c,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -3 -r1.120 -r1.121
--- main.c      30 Mar 2005 22:51:02 -0000      1.120
+++ main.c      3 Apr 2005 14:05:04 -0000       1.121
@@ -49,12 +49,14 @@
 Window              init_win_ext = None;
 #endif
 
-static void         ESetSavePrefix(const char *path);
 static void         ECheckEprog(const char *name);
 static void         EDirUserSet(const char *dir);
+static void         EConfNameSet(const char *dir);
 static void         EDirUserCacheSet(const char *dir);
 static void         EDirsSetup(void);
+static void         ESetSavePrefix(const char *path);
 static void         RunInitPrograms(void);
+static const char  *EConfName(void);
 
 int
 main(int argc, char **argv)
@@ -81,14 +83,15 @@
    if (str)
       Mode.wm.coredump = 1;
 
-#if 0                          /* No! */
    str = getenv("ECONFDIR");
    if (str)
       EDirUserSet(str);
+   str = getenv("ECONFNAME");
+   if (str)
+      EConfNameSet(str);
    str = getenv("ECACHEDIR");
    if (str)
       EDirUserCacheSet(str);
-#endif
 
    /* Set up the internal data lists used to find everything */
    ListsInit(LIST_TYPE_COUNT);
@@ -142,9 +145,10 @@
          {
             SetSMID(argv[++i]);
          }
-       else if ((!strcmp("-smfile", argv[i])) && (argc - i > 1))
+       else if ((!strcmp("-p", argv[i]) || !strcmp("--config-prefix", argv[i]))
+                && (argc - i > 1))
          {
-            ESetSavePrefix(argv[++i]);
+            EConfNameSet(argv[++i]);
          }
 #ifdef USE_EXT_INIT_WIN
        else if ((!strcmp("-ext_init_win", argv[i])) && (argc - i > 1))
@@ -168,8 +172,8 @@
                    "\t-ecachedir /path/to/cached/dir\n"
                    "\t-econfdir /path/to/config/dir\n"
                    "\t-ext_init_win window_id\n"
+                   "\t[-p | --config-prefix] config_file_prefix\n"
                    "\t[-s | -single]\n"
-                   "\t-smfile file\n"
                    "\t[-smid | -clientId | --sm-client-id] id\n"
                    "\t[-t | -theme] theme\n"
                    "\t[-v | -verbose]\n"
@@ -222,9 +226,10 @@
    Esetenv("EVERSION", ENLIGHTENMENT_VERSION, 1);
    Esetenv("EROOT", EDirRoot(), 1);
    Esetenv("EBIN", EDirBin(), 1);
-   Esetenv("ETHEME", Mode.theme.path, 1);
    Esetenv("ECONFDIR", EDirUser(), 1);
+   Esetenv("ECONFNAME", EConfName(), 1);
    Esetenv("ECACHEDIR", EDirUserCache(), 1);
+   Esetenv("ETHEME", Mode.theme.path, 1);
 
    /* Unmap the clients */
    MapUnmap(0);
@@ -388,6 +393,7 @@
 }
 
 static char        *userDir = NULL;
+static char        *userConf = NULL;
 static char        *cacheDir = NULL;
 
 const char         *
@@ -403,6 +409,26 @@
 }
 
 static void
+EConfNameSet(const char *name)
+{
+   if (userConf)
+      Efree(userConf);
+   userConf = Estrdup(name);
+}
+
+static const char  *
+EConfNameDefault(void)
+{
+   return "e_config";
+}
+
+static const char  *
+EConfName(void)
+{
+   return (userConf) ? userConf : EConfNameDefault();
+}
+
+static void
 EDirUserSet(const char *dir)
 {
    if (userDir)
@@ -538,10 +564,14 @@
    if (def_prefix)
       return def_prefix;
 
-   if (Mode.wm.window)
-      Esnprintf(buf, sizeof(buf), "%s/e_config-window", EDirUser());
+   if (userConf)
+      Esnprintf(buf, sizeof(buf), "%s/%s-%d", EDirUser(), EConfName(),
+               VRoot.scr);
+   else if (Mode.wm.window)
+      Esnprintf(buf, sizeof(buf), "%s/%s-window", EDirUser(),
+               EConfNameDefault());
    else
-      Esnprintf(buf, sizeof(buf), "%s/e_config-%s", EDirUser(),
+      Esnprintf(buf, sizeof(buf), "%s/%s-%s", EDirUser(), EConfNameDefault(),
                Mode.display.name);
    def_prefix = Estrdup(buf);
 
@@ -582,7 +612,7 @@
    if (pfx)
       return pfx;
 
-   Esnprintf(buf, sizeof(buf), "%s/e_config", EDirUser());
+   Esnprintf(buf, sizeof(buf), "%s/%s", EDirUser(), EConfName());
    pfx = Estrdup(buf);
 
    return pfx;




-------------------------------------------------------
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