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: Sun, 17 Apr 2005 18:40:02 -0400

Index: graveman/current/src/config.c
diff -u graveman/current/src/config.c:1.34 graveman/current/src/config.c:1.35
--- graveman/current/src/config.c:1.34  Sun Apr 17 21:56:06 2005
+++ graveman/current/src/config.c       Sun Apr 17 22:39:53 2005
@@ -296,15 +296,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("data_file"))) {
+    Llistpath = g_strsplit(Lpath, ":", 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_DATA_HOME"))) {
-    g_strdup_printf(Lpath, sizeof(Lpath)-1, "%s/%s/%s.conf", Lenv, PACKAGE, 
PACKAGE);
+    Lpath = g_strdup_printf("%s/%s", Lenv, PACKAGE);
     Lnewlist = g_slist_append(Lnewlist, Lpath);
   } else if ((Lenv=g_getenv("HOME"))) {
-    g_strdup_printf(Lpath, sizeof(Lpath)-1, "%s/.local/share/%s/%s.conf", 
Lenv, PACKAGE, PACKAGE);
+    Lpath = g_strdup_printf("%s/.local/share/%s", Lenv, PACKAGE);
     Lnewlist = g_slist_append(Lnewlist, Lpath);
   }
 
@@ -312,15 +324,15 @@
     Llistpath = g_strsplit(Lenv, ":", 0);
 
     for (i=0; Llistpath[i]; i++) {
-      g_strdup_printf(Lpath, sizeof(Lpath)-1, "%s/%s/%s.conf", Llistpath[i], 
PACKAGE, PACKAGE);
+      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, "/usr/local/share/%s", PACKAGE);
+    Lpath = g_strdup_printf("/usr/local/share/%s", PACKAGE);
     Lnewlist = g_slist_append(Lnewlist, Lpath);
-    g_snprintf(Lpath, sizeof(Lpath)-1, "/usr/share/%s", PACKAGE);
+    Lpath = g_strdup_printf("/usr/share/%s", PACKAGE);
     Lnewlist = g_slist_append(Lnewlist, Lpath);
   }
 




reply via email to

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