summaryrefslogtreecommitdiff
path: root/src/muniad.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/muniad.cc')
-rw-r--r--src/muniad.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/muniad.cc b/src/muniad.cc
index 741241a..b9651dd 100644
--- a/src/muniad.cc
+++ b/src/muniad.cc
@@ -38,6 +38,8 @@
#include "http.h"
#include "munia_proto.h"
#include "debug.h"
+#include "taskmanager.h"
+extern TaskManager task_manager;
static struct libwebsocket_protocols protocols[] = {
// first protocol must always be HTTP handler
@@ -51,6 +53,7 @@ static struct libwebsocket_protocols protocols[] = {
static struct option options[] = {
{ "help", no_argument, NULL, 'h' },
{ "port", required_argument, NULL, 'p' },
+ { "file", required_argument, NULL, 'f' },
{ "ssl", no_argument, NULL, 's' },
{ "killmask", no_argument, NULL, 'k' },
{ "interface", required_argument, NULL, 'i' },
@@ -60,6 +63,7 @@ static struct option options[] = {
int main(int argc, char **argv)
{
+ const char *db_filename = "/tmp/munia.xml";
int n = 0;
const char *cert_path =
LOCAL_RESOURCE_PATH"/libwebsockets-test-server.pem";
@@ -84,7 +88,7 @@ int main(int argc, char **argv)
"There is NO WARRANTY, to the extent permitted by law.\n");
while(n >= 0) {
- n = getopt_long(argc, argv, "ci:khsp:", options, NULL);
+ n = getopt_long(argc, argv, "ci:khsp:f:", options, NULL);
if(n < 0) continue;
switch(n) {
case 's':
@@ -98,19 +102,24 @@ int main(int argc, char **argv)
case 'p':
port = atoi(optarg);
break;
- case 'i':
+ case 'f':
+ db_filename = strdup(optarg);
+ break;
+ case 'i':
strncpy(interface_name, optarg, sizeof interface_name);
interface_name[(sizeof interface_name) - 1] = '\0';
interface = interface_name;
break;
case 'h':
- fprintf(stderr, "Usage: muniad [--port=<p>] [--ssl]\n");
+ fprintf(stderr, "Usage: muniad [--port=<p>] [--ssl] [--file=<f>]\n");
exit(1);
}
}
debug_parse("+all");
+ task_manager.init(db_filename);
+
if(!use_ssl) cert_path = key_path = NULL;
context = libwebsocket_create_context(port, interface, protocols,