graveman-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Graveman-cvs] Changes to graveman/current/src/config.c


From: sylvain cresto
Subject: [Graveman-cvs] Changes to graveman/current/src/config.c
Date: Thu, 14 Apr 2005 17:45:33 -0400

Index: graveman/current/src/config.c
diff -u graveman/current/src/config.c:1.30 graveman/current/src/config.c:1.31
--- graveman/current/src/config.c:1.30  Tue Apr 12 23:12:52 2005
+++ graveman/current/src/config.c       Thu Apr 14 21:45:32 2005
@@ -225,15 +225,27 @@
 {
   GSList *Lnewlist = NULL;
   const gchar *Lenv;
-  gchar Lpath[MAXPATHLEN];
+  gchar *Lpath;
   gchar **Llistpath;
   gint i;
 
+  /* parametre -c sur la ligne de commande */
+  if ((Lpath = param_get_string("config_file"))) {
+    Llistpath = g_strsplit(Lenv, ":", 0);
+
+    for (i=0; Llistpath[i]; i++) {
+      if (!*Llistpath[i]) continue; /* on ignore les entrees vides */
+      Lnewlist = g_slist_append(Lnewlist, g_strdup_printf(Llistpath[i]));
+    }
+
+    g_strfreev(Llistpath);
+  }
+  
   if ((Lenv=g_getenv("XDG_CONFIG_HOME"))) {
-    g_snprintf(Lpath, sizeof(Lpath)-1, "%s/%s/%s.conf", Lenv, PACKAGE, 
PACKAGE);
+    Lpath = g_strdup_printf("%s/%s/%s.conf", Lenv, PACKAGE, PACKAGE);
     Lnewlist = g_slist_append(Lnewlist, Lpath);
   } else if ((Lenv=g_getenv("HOME"))) {
-    g_snprintf(Lpath, sizeof(Lpath)-1, "%s/.config/%s/%s.conf", Lenv, PACKAGE, 
PACKAGE);
+    Lpath = g_strdup_printf("%s/.config/%s/%s.conf", Lenv, PACKAGE, PACKAGE);
     Lnewlist = g_slist_append(Lnewlist, Lpath);
   }
 
@@ -241,14 +253,16 @@
     Llistpath = g_strsplit(Lenv, ":", 0);
 
     for (i=0; Llistpath[i]; i++) {
-      g_snprintf(Lpath, sizeof(Lpath)-1, "%s/%s/%s.conf", Llistpath[i], 
PACKAGE, PACKAGE);
+      if (!*Llistpath[i]) continue; /* on ignore les entrees vides */
+      Lpath = g_strdup_printf("%s/%s/%s.conf", Llistpath[i], PACKAGE, PACKAGE);
       Lnewlist = g_slist_append(Lnewlist, Lpath);
     }
 
     g_strfreev(Llistpath);
 
   } else {
-    g_snprintf(Lpath, sizeof(Lpath)-1, "/etc/xdg/%s", PACKAGE);
+    Lpath = g_strdup_printf("/etc/xdg/%s/%s.conf", PACKAGE, PACKAGE);
+    Lnewlist = g_slist_append(Lnewlist, Lpath);
   }
 
   return Lnewlist;
@@ -304,6 +318,7 @@
   gchar *s;
   
   *Gfileconf = 0; 
+
   for (Lcurlist = Llistconfig; Lcurlist; Lcurlist = g_slist_next(Lcurlist)) {
     if (W_OK == Lmode) {
       g_strlcpy(Lonlyname, (gchar *)Lcurlist->data, sizeof(Lonlyname)-1);      




reply via email to

[Prev in Thread] Current Thread [Next in Thread]