]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
config: search in global section by default
authorYehuda Sadeh <yehuda@hq.newdream.net>
Wed, 11 Mar 2009 22:33:43 +0000 (15:33 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Wed, 11 Mar 2009 22:33:43 +0000 (15:33 -0700)
src/cconf.cc
src/config.cc

index 0fbba7fdedfab1f1782104b8e214613318476f49..2760132a1f1a8f3083ebbe4477e5ef4252bba16e 100644 (file)
@@ -12,6 +12,14 @@ using namespace std;
 #include "config.h"
 #include "common/ConfUtils.h"
 
+
+const char *id = NULL, *type = NULL;
+char *name, *alt_name;
+
+char *post_process_val(char *val)
+{
+}
+
 void usage() 
 {
   cerr << "usage: cconf <-c filename> [-t type] [-i id] [-l|--list_sections <prefix>] [-s <section>] [[-s section] ... ] <key> [default]" << std::endl;
@@ -25,8 +33,6 @@ int main(int argc, const char **argv)
   const char *list_sections = 0;
   char *val;
   int param = 0;
-  const char *id = NULL, *type = NULL;
-  char *name, *alt_name;
   deque<const char*> args;
   deque<const char *> sections;
   argv_to_deq(argc, argv, args);
index 63237b966aa8dc4c1fa501598e08653054d928c5..09ad5b23947100d67cff6a180d4129169439252e 100644 (file)
@@ -743,7 +743,7 @@ void parse_config_file(ConfFile *cf, bool auto_update, const char *module_type,
   cf->parse();
 
   for (int i=0; i<opt_len; i++) {
-    for (s=0; s<3; s++) {
+    for (s=0; s<4; s++) {
       config_option *opt = &config_optionsp[i];
       const char *section;
 
@@ -757,9 +757,14 @@ void parse_config_file(ConfFile *cf, bool auto_update, const char *module_type,
             section = module_type;
             if (section)
               break;
-       default:
+       case 2:
            s = 2;
             section = opt->section;
+           if (section)
+             break;
+       default:
+           s = 3;
+           section = "global";
       }
 
       switch (opt->type) {