gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r1314 - GNUnet/src/conf


From: grothoff
Subject: [GNUnet-SVN] r1314 - GNUnet/src/conf
Date: Fri, 8 Jul 2005 12:30:45 -0700 (PDT)

Author: grothoff
Date: 2005-07-08 12:30:42 -0700 (Fri, 08 Jul 2005)
New Revision: 1314

Modified:
   GNUnet/src/conf/confdata.c
Log:
Using standard config functions instead of private functions

Modified: GNUnet/src/conf/confdata.c
===================================================================
--- GNUnet/src/conf/confdata.c  2005-07-08 11:50:22 UTC (rev 1313)
+++ GNUnet/src/conf/confdata.c  2005-07-08 19:30:42 UTC (rev 1314)
@@ -152,7 +152,10 @@
                                                if (c != '\\' && c != '/')
                                                        strcat(key, 
DIR_SEPARATOR_STR);
                                                strcat(key, file);
-                                               cfg_parse_file(key);
+                                               setConfigurationString("FILES",
+                                                                      
"gnunet.conf",
+                                                                      key);
+                                               readConfiguration();
                                        }
                                }
                                free(key);
@@ -163,21 +166,25 @@
                if (!i) {
                        const char **names = conf_confnames;
                        
-                       while ((name = *names++)) {
-                               name = conf_expand_value(name);
-                               if (cfg_parse_file((char *) name) == 0) {
-                                       printf("#\n"
-                                              "# using defaults found in %s\n"
-                                              "#\n", name);
-                                       i = 1;
-                                       break;
-                               }
+                       while ( (name = *names++)) {
+                         name = conf_expand_value(name); 
+                         if (0 == ACCESS(name, R_OK)) {
+                           setConfigurationString("FILES",
+                                                  "gnunet.conf",
+                                                  name);
+                           readConfiguration();
+                           i = 1;
+                           break;
+                         }
                        }
                }
        }
        else {
                i = 1;
-               cfg_parse_file((char *) name);
+               setConfigurationString("FILES",
+                                      "gnunet.conf",
+                                      name);
+               readConfiguration();
        }
 
        if (!i)
@@ -187,7 +194,7 @@
          sym->flags |= SYMBOL_NEW | SYMBOL_CHANGED;
                sym->flags &= ~SYMBOL_VALID;
                
-               val = cfg_get_str(sym->sect, sym->name);
+               val = getConfigurationString(sym->sect, sym->name);
                if (val) {
                switch (sym->type) {
                        case S_TRISTATE:
@@ -212,7 +219,6 @@
                                }
                                else {
                                        fprintf(stderr, "%s: symbol value '%s' 
invalid for %s\n", name, val, sym->name);
-                                       doneParseConfig();
                                        exit(1);
                                }
 
@@ -223,6 +229,7 @@
                        default:
                        sym->user.val = NULL;
                        sym->user.tri = no;
+                       
                }
                
                if (sym && sym_is_choice_value(sym)) {
@@ -255,7 +262,8 @@
                for (e = prop->expr; e; e = e->left.expr)
                        if (e->right.sym->visible != no)
                                sym->flags |= e->right.sym->flags & SYMBOL_NEW;
-       }
+               FREE(val);
+               }
        }
        
        sym_change_count = 1;





reply via email to

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