Create and use sicsglobal.h and add isDuringInitialization

This commit is contained in:
Douglas Clowes
2014-06-19 14:24:46 +10:00
parent 0d39693c3b
commit 1da5fc9062
5 changed files with 11 additions and 3 deletions

View File

@ -23,6 +23,7 @@
#include <unistd.h> #include <unistd.h>
#include "nserver.h" #include "nserver.h"
#include "servlog.h" #include "servlog.h"
#include "sicsglobal.h"
/* ========================= Less dreadful file statics =================== */ /* ========================= Less dreadful file statics =================== */
@ -47,7 +48,6 @@ int main(int argc, char *argv[])
int daemonize = 0; int daemonize = 0;
char *file = NULL; char *file = NULL;
int i, firstArg = 1; int i, firstArg = 1;
extern const char *argv0;
extern pServer pServ; extern pServer pServ;
argv0 = argv[0]; argv0 = argv[0];

View File

@ -68,6 +68,7 @@
#include "ifile.h" #include "ifile.h"
#include "Dbg.h" #include "Dbg.h"
#include "servlog.h" #include "servlog.h"
#include "sicsglobal.h"
#include "stringdict.h" #include "stringdict.h"
#include "exeman.h" #include "exeman.h"
#include "nxcopy.h" #include "nxcopy.h"
@ -323,7 +324,6 @@ Tcl_Interp *MacroInit(SicsInterp * pSics)
assert(pSics); assert(pSics);
/* create interpreter and unknown */ /* create interpreter and unknown */
extern const char *argv0;
Tcl_FindExecutable(argv0); Tcl_FindExecutable(argv0);
pInter = Tcl_CreateInterp(); pInter = Tcl_CreateInterp();
pUnknown = (struct __SicsUnknown *) malloc(sizeof(struct __SicsUnknown)); pUnknown = (struct __SicsUnknown *) malloc(sizeof(struct __SicsUnknown));

2
ofac.c
View File

@ -16,6 +16,7 @@
#include "statusfile.h" #include "statusfile.h"
#include "site.h" #include "site.h"
#include "sicshipadaba.h" #include "sicshipadaba.h"
#include "sicsglobal.h"
extern void DevExecInit(void); /* devexec.c */ extern void DevExecInit(void); /* devexec.c */
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@ -231,5 +232,6 @@ int InitObjectCommands(pServer pServ, char *file)
} }
RemoveStartupCommands(); RemoveStartupCommands();
isDuringInitialization = 0;
return 1; return 1;
} }

View File

@ -1,4 +1,4 @@
/***************************** Necessary Globals ****************************/ /***************************** Necessary Globals ****************************/
const char *argv0 = (void*) 0; const char *argv0 = (void*) 0;
int isDuringInitialization = 1; /* gets set to zero after initialization */

6
sicsglobal.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef SICSGLOBAL_H
#define SICSGLOBAL_H
extern const char *argv0;
extern int isDuringInitialization;
#endif