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