summaryrefslogtreecommitdiff
path: root/server/src/macrotool.cc
diff options
context:
space:
mode:
authordeva <deva>2009-07-06 13:50:56 +0000
committerdeva <deva>2009-07-06 13:50:56 +0000
commitca32aba4df1b021b1acaa8f0650fa6a0cd7b9d80 (patch)
treec5556cefdc68846cf3c3343d54ae964c43ba65ec /server/src/macrotool.cc
parentce3ee895ae8c893c0202e4cddb068dce9919cd0d (diff)
Rewrite of parameter handler. A new fieldnames module... currently does nothing useful.
Diffstat (limited to 'server/src/macrotool.cc')
-rw-r--r--server/src/macrotool.cc23
1 files changed, 13 insertions, 10 deletions
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 <getopt.h>
+#include <vector>
+#include <string>
+
#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<std::string> 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);