From 1da5fc90627c5a32ebd6694f4799d73370fa0f4b Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 19 Jun 2014 14:24:46 +1000 Subject: [PATCH] Create and use sicsglobal.h and add isDuringInitialization --- SICSmain.c | 2 +- macro.c | 2 +- ofac.c | 2 ++ sicsglobal.c | 2 +- sicsglobal.h | 6 ++++++ 5 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 sicsglobal.h diff --git a/SICSmain.c b/SICSmain.c index 3009a07f..617606a4 100644 --- a/SICSmain.c +++ b/SICSmain.c @@ -23,6 +23,7 @@ #include #include "nserver.h" #include "servlog.h" +#include "sicsglobal.h" /* ========================= Less dreadful file statics =================== */ @@ -47,7 +48,6 @@ 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]; diff --git a/macro.c b/macro.c index 0a91a302..86216907 100644 --- a/macro.c +++ b/macro.c @@ -68,6 +68,7 @@ #include "ifile.h" #include "Dbg.h" #include "servlog.h" +#include "sicsglobal.h" #include "stringdict.h" #include "exeman.h" #include "nxcopy.h" @@ -323,7 +324,6 @@ Tcl_Interp *MacroInit(SicsInterp * pSics) assert(pSics); /* create interpreter and unknown */ - extern const char *argv0; Tcl_FindExecutable(argv0); pInter = Tcl_CreateInterp(); pUnknown = (struct __SicsUnknown *) malloc(sizeof(struct __SicsUnknown)); diff --git a/ofac.c b/ofac.c index b2b0bc43..9fca22bb 100644 --- a/ofac.c +++ b/ofac.c @@ -16,6 +16,7 @@ #include "statusfile.h" #include "site.h" #include "sicshipadaba.h" +#include "sicsglobal.h" extern void DevExecInit(void); /* devexec.c */ /*--------------------------------------------------------------------------*/ @@ -231,5 +232,6 @@ int InitObjectCommands(pServer pServ, char *file) } RemoveStartupCommands(); + isDuringInitialization = 0; return 1; } diff --git a/sicsglobal.c b/sicsglobal.c index 70f744f8..7956f6a6 100644 --- a/sicsglobal.c +++ b/sicsglobal.c @@ -1,4 +1,4 @@ /***************************** Necessary Globals ****************************/ const char *argv0 = (void*) 0; - +int isDuringInitialization = 1; /* gets set to zero after initialization */ diff --git a/sicsglobal.h b/sicsglobal.h new file mode 100644 index 00000000..49d43352 --- /dev/null +++ b/sicsglobal.h @@ -0,0 +1,6 @@ +#ifndef SICSGLOBAL_H +#define SICSGLOBAL_H + +extern const char *argv0; +extern int isDuringInitialization; +#endif