- property __save=kids option
This commit is contained in:
13
sicsobj.c
13
sicsobj.c
@ -40,6 +40,12 @@ void DefaultFree(void *data)
|
|||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void saveSICSNode(pHdb node, char *prefix, FILE * fd)
|
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 newprefix[1024], val[20];
|
||||||
char path[MAX_HDB_PATH];
|
char path[MAX_HDB_PATH];
|
||||||
pHdb child;
|
pHdb child;
|
||||||
@ -55,16 +61,23 @@ static void saveSICSNode(pHdb node, char *prefix, FILE * fd)
|
|||||||
fprintf(fd, "\n");
|
fprintf(fd, "\n");
|
||||||
}
|
}
|
||||||
if (GetHdbProperty(node, "__save", val, 20) == 1) {
|
if (GetHdbProperty(node, "__save", val, 20) == 1) {
|
||||||
|
if (strcasecmp(val, "kids") != 0) {
|
||||||
GetHipadabaPar(node, &v, NULL);
|
GetHipadabaPar(node, &v, NULL);
|
||||||
data = formatValue(v, node);
|
data = formatValue(v, node);
|
||||||
if (data != NULL) {
|
if (data != NULL) {
|
||||||
value = GetCharArray(data);
|
value = GetCharArray(data);
|
||||||
str = Arg2Tcl(1, &value, NULL, 0);
|
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);
|
fprintf(fd, "%s %s\n", prefix, str);
|
||||||
|
}
|
||||||
DeleteDynString(data);
|
DeleteDynString(data);
|
||||||
free(str);
|
free(str);
|
||||||
}
|
}
|
||||||
ReleaseHdbValue(&v);
|
ReleaseHdbValue(&v);
|
||||||
|
}
|
||||||
child = node->child;
|
child = node->child;
|
||||||
while (child != NULL) {
|
while (child != NULL) {
|
||||||
snprintf(newprefix, 1024, "%s/%s", prefix, child->name);
|
snprintf(newprefix, 1024, "%s/%s", prefix, child->name);
|
||||||
|
Reference in New Issue
Block a user