diff --git a/SICSmain.c b/SICSmain.c index 3aeaabb6..3009a07f 100644 --- a/SICSmain.c +++ b/SICSmain.c @@ -24,12 +24,6 @@ #include "nserver.h" #include "servlog.h" -/***************************** Necessary Globals ****************************/ - -IPair *pSICSOptions = NULL; -pServer pServ = NULL; -const char *argv0; - /* ========================= Less dreadful file statics =================== */ #define DEFAULTINIFILE "servo.tcl" @@ -53,6 +47,8 @@ int main(int argc, char *argv[]) int daemonize = 0; char *file = NULL; int i, firstArg = 1; + extern const char *argv0; + extern pServer pServ; argv0 = argv[0]; if (argc < 2) @@ -101,28 +97,3 @@ int main(int argc, char *argv[]) exit(0); } -/*--------------------------------------------------------------------------*/ -SicsInterp *GetInterpreter(void) -{ - return pServ->pSics; -} - -/*--------------------------------------------------------------------------*/ -pExeList GetExecutor(void) -{ - return pServ->pExecutor; -} - -/*------------------------------------------------------------------------*/ -void StopExit(void) -{ - if (pServ) { - StopServer(pServ); - } -} - -/*-------------------------------------------------------------------------*/ -pTaskMan GetTasker(void) -{ - return pServ->pTasker; -} diff --git a/ifile.c b/ifile.c index a35fc862..25767f57 100644 --- a/ifile.c +++ b/ifile.c @@ -47,6 +47,7 @@ #include "ifile.h" /*====================== Locals ============================================*/ +IPair *pSICSOptions = NULL; static IPair *CreateNewEntry(char *name, char *val, IPair * pN) { diff --git a/nserver.c b/nserver.c index 9207eca9..d3660fe0 100644 --- a/nserver.c +++ b/nserver.c @@ -44,13 +44,19 @@ int ServerSetupInterrupt(int iPort, pNetRead pNet, pTaskMan pTasker); configures a port for listening for interrupts */ -extern void StopExit(void); /* in SICSmain.c */ - extern int openDevexecLog(); /* in devexec.c */ extern int NetWatchTask(void *pData); /* in nwatch.c */ /* ========================= Less dreadful file statics =================== */ +/*------------------------------------------------------------------------*/ +static void StopExit(void) +{ + if (pServ) { + StopServer(pServ); + } +} + #define DEFAULTINIFILE "servo.tcl" #define DEFAULTSTATUSFILE "sicsstat.tcl" #define INIT(F) { void F(void); F(); } @@ -510,3 +516,23 @@ int ServerIsStarting(pServer self) { return self->pReader == NULL; } + +pServer pServ = NULL; + +/*--------------------------------------------------------------------------*/ +SicsInterp *GetInterpreter(void) +{ + return pServ->pSics; +} + +/*--------------------------------------------------------------------------*/ +pExeList GetExecutor(void) +{ + return pServ->pExecutor; +} + +/*-------------------------------------------------------------------------*/ +pTaskMan GetTasker(void) +{ + return pServ->pTasker; +} diff --git a/sicsglobal.c b/sicsglobal.c new file mode 100644 index 00000000..70f744f8 --- /dev/null +++ b/sicsglobal.c @@ -0,0 +1,4 @@ +/***************************** Necessary Globals ****************************/ + +const char *argv0 = (void*) 0; + diff --git a/site_ansto/make_gen_variables b/site_ansto/make_gen_variables index 825be52b..4fc334c4 100644 --- a/site_ansto/make_gen_variables +++ b/site_ansto/make_gen_variables @@ -17,7 +17,7 @@ SOBJ = alias.o anticollider.o arrayutil.o ascon.o asyncprotocol.o asyncqueue.o a passwd.o perfmon.o polldriv.o protocol.o proxy.o reflist.o regresscter.o remob.o \ rmtrail.o rs232controller.o rwpuffer.o sansbc.o savehdb.o scaldate.o scan.o scanvar.o SCinter.o \ scriptcontext.o script.o sctdriveadapter.o sctdriveobj.o sdynar.o selector.o \ - selvar.o servlog.o sgclib.o sghkl.o sgio.o sicscron.o sicsdata.o sicsexit.o sicshdbadapter.o \ + selvar.o servlog.o sgclib.o sghkl.o sgio.o sicscron.o sicsdata.o sicsexit.o sicsglobal.o sicshdbadapter.o \ sicshdbfactory.o sicshipadaba.o sicslist.o SICSmain.o sicsobj.o sicspoll.o sicsutil.o \ sicvar.o sig_die.o simchop.o simev.o simidx.o simindex.o sinfox.o singlebi.o singlediff.o singlenb.o singlebinb.o singletas.o singlex.o splitter.o s_rnge.o statemon.o \ statistics.o statusfile.o status.o stdscan.o stptok.o stringdict.o strlutil.o strrepl.o \