mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 13:45:10 +00:00
[ADD] -O3, -C [config] flag
This commit is contained in:
parent
4b2ede6a66
commit
6cd3df21db
2 changed files with 31 additions and 15 deletions
4
Makefile
4
Makefile
|
|
@ -26,8 +26,8 @@ AYAS=ayaya
|
||||||
ETC=etc
|
ETC=etc
|
||||||
INCLUDES=src/include
|
INCLUDES=src/include
|
||||||
CC=cc
|
CC=cc
|
||||||
CFLAGS=-I$(SOURCE) -I$(INCLUDES) -I$(CYTO_INC) -DNAME="\"$(NAME)\"" -DVERSION="\"$(VERSION)\"" -DREPOSITORY=\"$(REPOSITORY)\" -DCODE=\"$(CODE)\" -g -ggdb -Wall -Werror
|
CFLAGS=-I$(SOURCE) -I$(INCLUDES) -I$(CYTO_INC) -DNAME="\"$(NAME)\"" -DVERSION="\"$(VERSION)\"" -DREPOSITORY=\"$(REPOSITORY)\" -DCODE=\"$(CODE)\" -O3 -s -Wall -Werror
|
||||||
LDFLAGS=-L $(CYTO_LIB) -lCytoplasm -g -ggdb
|
LDFLAGS=-L $(CYTO_LIB) -lCytoplasm -O3 -s
|
||||||
AFLAGS=-C "$(ETC)/ayadoc/style.css" -p "$(NAME)"
|
AFLAGS=-C "$(ETC)/ayadoc/style.css" -p "$(NAME)"
|
||||||
BINARY=parsee
|
BINARY=parsee
|
||||||
# ============================ Compilation =================================
|
# ============================ Compilation =================================
|
||||||
|
|
|
||||||
42
src/Main.c
42
src/Main.c
|
|
@ -29,22 +29,26 @@ ParseeUptime(void)
|
||||||
|
|
||||||
static const Argument arguments[] =
|
static const Argument arguments[] =
|
||||||
{
|
{
|
||||||
#define Argument(c, req, vdesc, desc) \
|
#define Arg(c, req, vdesc, desc) \
|
||||||
{ \
|
{ \
|
||||||
.end = false, \
|
.end = false, \
|
||||||
.argument = c, .value_req = req, \
|
.argument = c, .value_req = req, \
|
||||||
.value_descr = vdesc, \
|
.value_descr = vdesc, \
|
||||||
.description = desc \
|
.description = desc \
|
||||||
},
|
},
|
||||||
|
#define EndOfArgs { .end = true }
|
||||||
|
|
||||||
Argument('H', true, "number", "Sets the number of HTTP threads")
|
Arg('H', true, "number(=8)", "Sets the number of HTTP threads")
|
||||||
Argument('J', true, "number", "Sets the number of XMPP threads")
|
Arg('J', true, "number(=8)", "Sets the number of XMPP threads")
|
||||||
|
Arg('C', true, "file(='parsee.json')", "Sets the JSON config to use")
|
||||||
|
|
||||||
Argument('g',false,NULL,"Generates a parsee.yaml AS file before exiting")
|
Arg('g', false, NULL,"Generates a parsee.yaml AS file before exiting")
|
||||||
Argument('v',false,NULL,"Forces Parsee to print in a more verbose fashion")
|
Arg('v', false, NULL,"Forces Parsee to print in a more verbose fashion")
|
||||||
Argument('h',false,NULL,"Generates an help screen(this one!)")
|
Arg('h', false, NULL,"Generates an help screen(this one!)")
|
||||||
|
|
||||||
{ .end = true }
|
EndOfArgs
|
||||||
|
|
||||||
|
#undef EndOfArgs
|
||||||
#undef Argument
|
#undef Argument
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -56,6 +60,10 @@ Main(Array *args, HashMap *env)
|
||||||
Stream *yaml;
|
Stream *yaml;
|
||||||
Cron *cron = NULL;
|
Cron *cron = NULL;
|
||||||
|
|
||||||
|
char *configuration = "parsee.json";
|
||||||
|
int xmpp = 8;
|
||||||
|
int http = 8;
|
||||||
|
|
||||||
start = UtilTsMillis();
|
start = UtilTsMillis();
|
||||||
|
|
||||||
memset(&conf, 0, sizeof(conf));
|
memset(&conf, 0, sizeof(conf));
|
||||||
|
|
@ -66,16 +74,10 @@ Main(Array *args, HashMap *env)
|
||||||
Log(LOG_INFO, "=======================");
|
Log(LOG_INFO, "=======================");
|
||||||
LogConfigIndent(LogConfigGlobal());
|
LogConfigIndent(LogConfigGlobal());
|
||||||
|
|
||||||
ParseeConfigLoad("parsee.json");
|
|
||||||
ParseeConfigInit();
|
|
||||||
parsee_conf = ParseeConfigGet();
|
|
||||||
|
|
||||||
{
|
{
|
||||||
ArgParseState state;
|
ArgParseState state;
|
||||||
char *opts = ParseeGenerateGetopt(arguments);
|
char *opts = ParseeGenerateGetopt(arguments);
|
||||||
int flag;
|
int flag;
|
||||||
int xmpp = 8;
|
|
||||||
int http = 8;
|
|
||||||
|
|
||||||
ArgParseStateInit(&state);
|
ArgParseStateInit(&state);
|
||||||
/* TODO: Have a smarter way of generating the arg table
|
/* TODO: Have a smarter way of generating the arg table
|
||||||
|
|
@ -105,6 +107,15 @@ Main(Array *args, HashMap *env)
|
||||||
case 'v':
|
case 'v':
|
||||||
LogConfigLevelSet(LogConfigGlobal(), LOG_DEBUG);
|
LogConfigLevelSet(LogConfigGlobal(), LOG_DEBUG);
|
||||||
break;
|
break;
|
||||||
|
case 'C':
|
||||||
|
if (!UtilLastModified(state.optArg))
|
||||||
|
{
|
||||||
|
Log(LOG_ERR, "Invalid config: %s", state.optArg);
|
||||||
|
Log(LOG_ERR, "Ignoring.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
configuration = state.optArg;
|
||||||
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
Log(LOG_ERR, "INVALID ARGUMENT GIVEN");
|
Log(LOG_ERR, "INVALID ARGUMENT GIVEN");
|
||||||
Free(opts);
|
Free(opts);
|
||||||
|
|
@ -115,6 +126,11 @@ Main(Array *args, HashMap *env)
|
||||||
ParseeSetThreads(xmpp, http);
|
ParseeSetThreads(xmpp, http);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ParseeConfigLoad(configuration);
|
||||||
|
ParseeConfigInit();
|
||||||
|
parsee_conf = ParseeConfigGet();
|
||||||
|
|
||||||
|
|
||||||
Log(LOG_NOTICE, "Connecting to XMPP...");
|
Log(LOG_NOTICE, "Connecting to XMPP...");
|
||||||
jabber = XMPPInitialiseCompStream(
|
jabber = XMPPInitialiseCompStream(
|
||||||
parsee_conf->component_host,
|
parsee_conf->component_host,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue