diff options
Diffstat (limited to 'src/common/core.c')
-rw-r--r-- | src/common/core.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/common/core.c b/src/common/core.c index e663c4e4c..7f5a1da53 100644 --- a/src/common/core.c +++ b/src/common/core.c @@ -41,11 +41,8 @@ /// Called when a terminate signal is received. void (*shutdown_callback)(void) = NULL; -int runflag = CORE_ST_RUN; -int arg_c = 0; -char **arg_v = NULL; - -char *SERVER_NAME = NULL; +struct core_interface core_s; +struct core_interface *core = &core_s; #ifndef MINICORE // minimalist Core // Added by Gabuzomeu @@ -90,7 +87,7 @@ static BOOL WINAPI console_handler(DWORD c_event) { if( shutdown_callback != NULL ) shutdown_callback(); else - runflag = CORE_ST_STOP;// auto-shutdown + core->runflag = CORE_ST_STOP;// auto-shutdown break; default: return FALSE; @@ -118,7 +115,7 @@ static void sig_proc(int sn) { if( shutdown_callback != NULL ) shutdown_callback(); else - runflag = CORE_ST_STOP;// auto-shutdown + core->runflag = CORE_ST_STOP;// auto-shutdown break; case SIGSEGV: case SIGFPE: @@ -176,6 +173,7 @@ void core_defaults(void) { console_defaults(); strlib_defaults(); malloc_defaults(); + showmsg_defaults(); cmdline_defaults(); #ifndef MINICORE libconfig_defaults(); @@ -317,7 +315,7 @@ int cmdline_exec(int argc, char **argv, unsigned int options) } if (options&CMDLINE_OPT_SILENT) { if (data->options&CMDLINE_OPT_SILENT) { - msg_silent = 0x7; // silence information and status messages + showmsg->silent = 0x7; // silence information and status messages break; } } else if ((data->options&CMDLINE_OPT_PREINIT) == (options&CMDLINE_OPT_PREINIT)) { @@ -360,6 +358,7 @@ void cmdline_final(void) } struct cmdline_interface cmdline_s; +struct cmdline_interface *cmdline; void cmdline_defaults(void) { @@ -387,12 +386,14 @@ int main (int argc, char **argv) { SERVER_NAME = ++p1; p2 = p1; } - arg_c = argc; - arg_v = argv; + core->arg_c = argc; + core->arg_v = argv; + core->runflag = CORE_ST_RUN; } core_defaults(); iMalloc->init();// needed for Show* in display_title() [FlavioJS] + showmsg->init(); cmdline->init(); @@ -402,7 +403,7 @@ int main (int argc, char **argv) { sysinfo->init(); - if (!(msg_silent&0x1)) + if (!(showmsg->silent&0x1)) console->display_title(); usercheck(); @@ -439,7 +440,7 @@ int main (int argc, char **argv) { do_init(argc,argv); // Main runtime cycle - while (runflag != CORE_ST_STOP) { + while (core->runflag != CORE_ST_STOP) { int next = timer->perform(timer->gettick_nocache()); sockt->perform(next); } @@ -458,6 +459,7 @@ int main (int argc, char **argv) { //sysinfo->final(); Called by iMalloc->final() iMalloc->final(); + showmsg->final(); // Should be after iMalloc->final() return retval; } |