/[graveman]/graveman/current/src/config.c
ViewVC logotype

Diff of /graveman/current/src/config.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.30 by scresto, Tue Apr 12 23:12:52 2005 UTC revision 1.31 by scresto, Thu Apr 14 21:45:32 2005 UTC
# Line 225  GSList *get_config_path() Line 225  GSList *get_config_path()
225  {  {
226    GSList *Lnewlist = NULL;    GSList *Lnewlist = NULL;
227    const gchar *Lenv;    const gchar *Lenv;
228    gchar Lpath[MAXPATHLEN];    gchar *Lpath;
229    gchar **Llistpath;    gchar **Llistpath;
230    gint i;    gint i;
231    
232      /* parametre -c sur la ligne de commande */
233      if ((Lpath = param_get_string("config_file"))) {
234        Llistpath = g_strsplit(Lenv, ":", 0);
235    
236        for (i=0; Llistpath[i]; i++) {
237          if (!*Llistpath[i]) continue; /* on ignore les entrees vides */
238          Lnewlist = g_slist_append(Lnewlist, g_strdup_printf(Llistpath[i]));
239        }
240    
241        g_strfreev(Llistpath);
242      }
243      
244    if ((Lenv=g_getenv("XDG_CONFIG_HOME"))) {    if ((Lenv=g_getenv("XDG_CONFIG_HOME"))) {
245      g_snprintf(Lpath, sizeof(Lpath)-1, "%s/%s/%s.conf", Lenv, PACKAGE, PACKAGE);      Lpath = g_strdup_printf("%s/%s/%s.conf", Lenv, PACKAGE, PACKAGE);
246      Lnewlist = g_slist_append(Lnewlist, Lpath);      Lnewlist = g_slist_append(Lnewlist, Lpath);
247    } else if ((Lenv=g_getenv("HOME"))) {    } else if ((Lenv=g_getenv("HOME"))) {
248      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);
249      Lnewlist = g_slist_append(Lnewlist, Lpath);      Lnewlist = g_slist_append(Lnewlist, Lpath);
250    }    }
251    
# Line 241  GSList *get_config_path() Line 253  GSList *get_config_path()
253      Llistpath = g_strsplit(Lenv, ":", 0);      Llistpath = g_strsplit(Lenv, ":", 0);
254    
255      for (i=0; Llistpath[i]; i++) {      for (i=0; Llistpath[i]; i++) {
256        g_snprintf(Lpath, sizeof(Lpath)-1, "%s/%s/%s.conf", Llistpath[i], PACKAGE, PACKAGE);        if (!*Llistpath[i]) continue; /* on ignore les entrees vides */
257          Lpath = g_strdup_printf("%s/%s/%s.conf", Llistpath[i], PACKAGE, PACKAGE);
258        Lnewlist = g_slist_append(Lnewlist, Lpath);        Lnewlist = g_slist_append(Lnewlist, Lpath);
259      }      }
260    
261      g_strfreev(Llistpath);      g_strfreev(Llistpath);
262    
263    } else {    } else {
264      g_snprintf(Lpath, sizeof(Lpath)-1, "/etc/xdg/%s", PACKAGE);      Lpath = g_strdup_printf("/etc/xdg/%s/%s.conf", PACKAGE, PACKAGE);
265        Lnewlist = g_slist_append(Lnewlist, Lpath);
266    }    }
267    
268    return Lnewlist;    return Lnewlist;
# Line 304  gboolean get_config_file(gint Lmode) Line 318  gboolean get_config_file(gint Lmode)
318    gchar *s;    gchar *s;
319        
320    *Gfileconf = 0;    *Gfileconf = 0;
321    
322    for (Lcurlist = Llistconfig; Lcurlist; Lcurlist = g_slist_next(Lcurlist)) {    for (Lcurlist = Llistconfig; Lcurlist; Lcurlist = g_slist_next(Lcurlist)) {
323      if (W_OK == Lmode) {      if (W_OK == Lmode) {
324        g_strlcpy(Lonlyname, (gchar *)Lcurlist->data, sizeof(Lonlyname)-1);              g_strlcpy(Lonlyname, (gchar *)Lcurlist->data, sizeof(Lonlyname)-1);      

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.31

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26