- split status.c into status.c and statusfile.c
- improvements for scriptcontext.c
This commit is contained in:
22
savehdb.c
22
savehdb.c
@ -1,9 +1,9 @@
|
||||
#include <stdio.h>
|
||||
#include "dynstring.h"
|
||||
#include "statusfile.h"
|
||||
#include "sicshipadaba.h"
|
||||
|
||||
static pDummy creationCommands = NULL;
|
||||
static int saveit = 0;
|
||||
|
||||
static void SaveHdbBranch(pHdb node, FILE *fil) {
|
||||
pHdb child;
|
||||
@ -32,7 +32,7 @@ static int SaveHdbTree(void *object, char *name, FILE *fil) {
|
||||
}
|
||||
|
||||
static int SaveHdbCallback(void *user, void *conn, pHdb node, hdbValue value) {
|
||||
saveit = 1;
|
||||
StatusFileDirty();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -62,22 +62,7 @@ static int SaveHdbEnable(SConnection *con, SicsInterp *sics,
|
||||
SetHdbProperty(node, "save", "kids");
|
||||
}
|
||||
}
|
||||
saveit = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int SaveHdbTask(void *data) {
|
||||
char *pFile = NULL;
|
||||
|
||||
if (saveit) {
|
||||
saveit = 0;
|
||||
|
||||
assert(pServ->pSics);
|
||||
pFile = IFindOption(pSICSOptions,"statusfile");
|
||||
if (pFile) {
|
||||
WriteSicsStatus(pServ->pSics,pFile,0);
|
||||
}
|
||||
}
|
||||
StatusFileDirty();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -87,5 +72,4 @@ void SaveHdbInit(void) {
|
||||
hs = CreateDummy("hdb saver");
|
||||
hs->pDescriptor->SaveStatus = SaveHdbTree;
|
||||
AddCommandWithFlag(pServ->pSics, "hsave", SaveHdbEnable, KillDummy, hs, 0);
|
||||
TaskRegister(pServ->pTasker, SaveHdbTask, NULL, NULL, NULL, 0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user