diff options
Diffstat (limited to 'server/src/macrotool/macrotool.cc')
-rw-r--r-- | server/src/macrotool/macrotool.cc | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/server/src/macrotool/macrotool.cc b/server/src/macrotool/macrotool.cc index 6d484ad..b811c29 100644 --- a/server/src/macrotool/macrotool.cc +++ b/server/src/macrotool/macrotool.cc @@ -45,6 +45,7 @@ #include "dump.h" #include "fieldnames.h" #include "filehandler.h" +#include "export.h" static const char version_str[] = "Pracro server v" VERSION "\n" @@ -69,10 +70,11 @@ static const char usage_str[] = " -D, --debug ddd Enable debug messages on 'ddd'; see documentation for details\n" "\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" +" 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" -" filehandler entity Handle macro files ('macrohandler help' to see list of entities).\n" +" filehandler entity Handle macro files ('filehandler help' to see list of entities).\n" +" export entity Export data from database to comma separated file ('export help' to see list of entities)\n" ; ConfigurationParser *configparser = NULL; @@ -80,8 +82,8 @@ ConfigurationParser *configparser = NULL; int main(int argc, char *argv[]) { int c; - char *configfile = NULL; - char *xml_basedir = NULL; + std::string configfile; + std::string xml_basedir; char *debugstr = NULL; debug_init(stderr); @@ -104,11 +106,11 @@ int main(int argc, char *argv[]) switch(c) { case 'c': - configfile = strdup(optarg); + configfile = optarg; break; case 'x': - xml_basedir = strdup(optarg); + xml_basedir = optarg; break; case 'D': @@ -142,10 +144,10 @@ int main(int argc, char *argv[]) } // Load config - if(configfile) configparser = new ConfigurationParser(configfile); - else configparser = new ConfigurationParser(ETC"/pracrod.conf"); + if(configfile == "") configfile = ETC"/pracrod.conf"; + configparser = new ConfigurationParser(configfile); - if(xml_basedir) { + if(xml_basedir != "") { Conf::xml_basedir = xml_basedir; } @@ -158,9 +160,7 @@ int main(int argc, char *argv[]) if(command == "dump") macrotool_dump(params); if(command == "fieldnames") macrotool_fieldnames(params); if(command == "filehandler") macrotool_filehandler(params); - - // Clean up - if(configfile) free(configfile); + if(command == "export") macrotool_export(params); return 0; } |