From ca32aba4df1b021b1acaa8f0650fa6a0cd7b9d80 Mon Sep 17 00:00:00 2001 From: deva Date: Mon, 6 Jul 2009 13:50:56 +0000 Subject: Rewrite of parameter handler. A new fieldnames module... currently does nothing useful. --- server/src/macrotool.cc | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'server/src/macrotool.cc') diff --git a/server/src/macrotool.cc b/server/src/macrotool.cc index 46fbc24..44beeef 100644 --- a/server/src/macrotool.cc +++ b/server/src/macrotool.cc @@ -31,12 +31,16 @@ // For getopt_long and friends #include +#include +#include + #include "configurationparser.h" #include "configuration.h" #include "debug.h" #include "macrotool_dump.h" +#include "macrotool_fieldnames.h" static const char version_str[] = "Pracro server v" VERSION "\n" @@ -62,6 +66,8 @@ static const char usage_str[] = "\n" "Commands:\n" " dump entity Dumps 'entity' to screen ('dump help' to see list of entities).\n" +" fieldnames entity Add/delete/update entries in the fieldnames database\n" +" ('fieldnames help' to see list of entities).\n" ; ConfigurationParser *configparser = NULL; @@ -125,8 +131,6 @@ int main(int argc, char *argv[]) printf(usage_str, argv[0]); exit(EXIT_FAILURE); } - - std::string command = argv[optind]; if(debugstr) { pracro_debug_parse(debugstr); @@ -140,16 +144,15 @@ int main(int argc, char *argv[]) Conf::xml_basedir = xml_basedir; } - if(command == "dump") { - optind++; - if(optind >= argc) { - fprintf(stderr, "Missing command parameter\n"); - printf(usage_str, argv[0]); - exit(EXIT_FAILURE); - } - macrotool_dump(argv[optind]); + std::string command = argv[optind++]; + std::vector params; + while(optind < argc) { + params.push_back(argv[optind++]); } + if(command == "dump") macrotool_dump(params); + if(command == "fieldnames") macrotool_fieldnames(params); + // Clean up if(configfile) free(configfile); -- cgit v1.2.3