From f01ee45933e0a725bec9256dd016259f6a8d0aed Mon Sep 17 00:00:00 2001 From: zolliker Date: Tue, 19 Jun 2012 07:13:01 +0000 Subject: [PATCH] - property __save=kids option --- sicsobj.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/sicsobj.c b/sicsobj.c index 7f044686..ba97ab00 100644 --- a/sicsobj.c +++ b/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);