diff options
| author | Jonas Suhr Christensen <jsc@umbraculum.org> | 2012-05-22 12:09:36 +0200 | 
|---|---|---|
| committer | Jonas Suhr Christensen <jsc@umbraculum.org> | 2012-05-22 12:09:36 +0200 | 
| commit | 181210b62a721b300e7ffe64880e069a91575212 (patch) | |
| tree | 7339a2203fbedadde4a04201ad999377955b9561 /src/muniad.cc | |
| parent | ae4b5a79e5863ee6440b2070361f3229285a9380 (diff) | |
| parent | 9818ab31e050f9389e4ebf76ed3aea4c07a1e893 (diff) | |
Merge branch 'master' of https://git.oftal.dk/munia
Diffstat (limited to 'src/muniad.cc')
| -rw-r--r-- | src/muniad.cc | 15 | 
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, | 
