- property __save=kids option

This commit is contained in:
zolliker
2012-06-19 07:13:01 +00:00
parent fbb4af6ec9
commit f01ee45933

View File

@ -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) {
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);
}
child = node->child;
while (child != NULL) {
snprintf(newprefix, 1024, "%s/%s", prefix, child->name);