From 4af5b9b88d1b3bd7475b9cc8c2bdb7b2f3a8e9ac Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Fri, 24 Jun 2011 10:57:07 +0200 Subject: [PATCH] rclconfig test: added option to print fields config --- src/common/rclconfig.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/common/rclconfig.cpp b/src/common/rclconfig.cpp index 547fc071..ee975168 100644 --- a/src/common/rclconfig.cpp +++ b/src/common/rclconfig.cpp @@ -1110,7 +1110,9 @@ static char *thisprog; static char usage [] = "\n" "-c: check a few things in the configuration files\n" "[-s subkey] -q param : query parameter value\n" +"-f : print some field data\n" " : default: print parameters\n" + ; static void Usage(void) @@ -1124,6 +1126,8 @@ static int op_flags; #define OPT_s 0x2 #define OPT_q 0x4 #define OPT_c 0x8 +#define OPT_f 0x10 + int main(int argc, char **argv) { string pname, skey; @@ -1139,6 +1143,7 @@ int main(int argc, char **argv) while (**argv) switch (*(*argv)++) { case 'c': op_flags |= OPT_c; break; + case 'f': op_flags |= OPT_f; break; case 's': op_flags |= OPT_s; if (argc < 2) Usage(); skey = *(++argv); argc--; @@ -1170,6 +1175,23 @@ int main(int argc, char **argv) exit(1); } printf("[%s] -> [%s]\n", pname.c_str(), value.c_str()); + } else if (op_flags & OPT_f) { + set stored = config->getStoredFields(); + set indexed = config->getIndexedFields(); + cout << "Stored fields: "; + for (set::const_iterator it = stored.begin(); + it != stored.end(); it++) { + cout << "[" << *it << "] "; + } + cout << endl; + cout << "Indexed fields: "; + for (set::const_iterator it = indexed.begin(); + it != indexed.end(); it++) { + string prefix; + config->getFieldPrefix(*it, prefix); + cout << "[" << *it << "]" << " -> [" << prefix << "] "; + } + cout << endl; } else if (op_flags & OPT_c) { // Check that all known mime types have an icon and belong to // some category