- moved IFServerOption to ifile.c

- moved PWSicsUser to passwd.c
- moved back InitObjectCommands to ofac.c
This commit is contained in:
zolliker
2010-01-28 08:39:21 +00:00
parent 492bed4ba7
commit 969b35d1d7
4 changed files with 136 additions and 9 deletions

66
ofac.c
View File

@ -7,14 +7,17 @@
* heavy modifications to separate PSI specific commands into a
* separate library. Mark Koennecke, June 2003
*
* moved all staff except command and initialization list to sicsutil.c
* moved some functions to sicsutil.c
* Markus Zolliker Jan 2010
*/
#include "ofac.h"
#include "exeman.h"
#include "statusfile.h"
#include "site.h"
/*--------------------------------------------------------------------------*/
void InitGeneral(void)
static void InitGeneral(void)
{
#define INIT(F) { void F(void); F(); }
@ -38,7 +41,7 @@ void InitGeneral(void)
INIT(SiteInit); /* site specific initializations */
}
void InitIniCommands(SicsInterp * pInter)
static void InitIniCommands(SicsInterp * pInter)
{
/* declare and add permanent command */
@ -165,4 +168,59 @@ void InitIniCommands(SicsInterp * pInter)
}
/* all other content moved to sicsutil.c - M.Zolliker Jan 2010 */
/*--------------------------------------------------------------------------*/
int InitObjectCommands(pServer pServ, char *file)
{
SConnection *pCon = NULL;
char pBueffel[1024];
int iRet;
SicsInterp *pSics;
pExeList pExe;
pEnvMon pEnv = NULL;
pSite site = NULL;
pSics = pServ->pSics;
assert(pSics);
InitGeneral();
/* general initialization */
/* create a connection */
pCon = SCCreateDummyConnection(pSics);
if (!pCon) {
return 0;
}
MakeExeManager(pCon, pSics, NULL, 1, NULL);
pExe = CreateExeList(pServ->pTasker);
pServ->pExecutor = pExe;
pEnv = CreateEnvMon();
assert(pExe);
assert(pEnv);
InitIniCommands(pSics);
/*
install site specific commands
*/
site = getSite();
if (site != NULL) {
site->AddSiteCommands(pServ->pSics);
}
InstallBckRestore(pCon, pSics);
/* evaluate the file */
snprintf(pBueffel,sizeof(pBueffel)-1, "fileeval %s", file);
iRet = InterpExecute(pSics, pCon, pBueffel);
/* done */
SCDeleteConnection(pCon);
if (site != NULL && site->RemoveSiteCommands != NULL) {
site->RemoveSiteCommands(pSics);
}
RemoveStartupCommands();
return 1;
}