summaryrefslogtreecommitdiff
path: root/server/src/macrotool/macrotool.cc
diff options
context:
space:
mode:
authordeva <deva>2011-01-27 10:34:07 +0000
committerdeva <deva>2011-01-27 10:34:07 +0000
commit8db72a90338995daa1ef30242ed3fadce7051f6d (patch)
tree58889c413741de808c01d69a17f30d3733fde0f4 /server/src/macrotool/macrotool.cc
parent13f286925b1e9e34fe71413edcba23686c005f8a (diff)
New data extraction tool.
Diffstat (limited to 'server/src/macrotool/macrotool.cc')
-rw-r--r--server/src/macrotool/macrotool.cc26
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;
}