- property __save=kids option
This commit is contained in:
31
sicsobj.c
31
sicsobj.c
@ -40,6 +40,12 @@ void DefaultFree(void *data)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void saveSICSNode(pHdb node, char *prefix, FILE * fd)
|
||||
{
|
||||
/*
|
||||
nodes with the property __save are saved
|
||||
special cases:
|
||||
__save=update: a hupdate command is used instead of a set command
|
||||
__save=kids: save kids, but not the value of this node
|
||||
*/
|
||||
char newprefix[1024], val[20];
|
||||
char path[MAX_HDB_PATH];
|
||||
pHdb child;
|
||||
@ -55,16 +61,23 @@ static void saveSICSNode(pHdb node, char *prefix, FILE * fd)
|
||||
fprintf(fd, "\n");
|
||||
}
|
||||
if (GetHdbProperty(node, "__save", val, 20) == 1) {
|
||||
GetHipadabaPar(node, &v, NULL);
|
||||
data = formatValue(v, node);
|
||||
if (data != NULL) {
|
||||
value = GetCharArray(data);
|
||||
str = Arg2Tcl(1, &value, NULL, 0);
|
||||
fprintf(fd, "%s %s\n", prefix, str);
|
||||
DeleteDynString(data);
|
||||
free(str);
|
||||
if (strcasecmp(val, "kids") != 0) {
|
||||
GetHipadabaPar(node, &v, NULL);
|
||||
data = formatValue(v, node);
|
||||
if (data != NULL) {
|
||||
value = GetCharArray(data);
|
||||
str = Arg2Tcl(1, &value, NULL, 0);
|
||||
if (strcasecmp(val, "update") == 0) {
|
||||
GetHdbPath(node, path, sizeof path);
|
||||
fprintf(fd, "hupdate %s %s\n", path, str);
|
||||
} else {
|
||||
fprintf(fd, "%s %s\n", prefix, str);
|
||||
}
|
||||
DeleteDynString(data);
|
||||
free(str);
|
||||
}
|
||||
ReleaseHdbValue(&v);
|
||||
}
|
||||
ReleaseHdbValue(&v);
|
||||
child = node->child;
|
||||
while (child != NULL) {
|
||||
snprintf(newprefix, 1024, "%s/%s", prefix, child->name);
|
||||
|
Reference in New Issue
Block a user