From f1e3ae7c0b9d71eaf3898e9954c241ff2730c1b8 Mon Sep 17 00:00:00 2001 From: Mark Koennecke Date: Tue, 3 Jun 2014 12:01:52 +0200 Subject: [PATCH] Fixed a bug in sicshipadaba which would not cause bin transfer mode properly honoured on hget Added a total feature to histmemsec --- histmemsec.c | 18 ++++++++++++++++++ sicshipadaba.c | 6 +++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/histmemsec.c b/histmemsec.c index 259466ef..ed06e956 100644 --- a/histmemsec.c +++ b/histmemsec.c @@ -262,6 +262,22 @@ static int SumCmd(pSICSOBJ ccmd, SConnection * pCon, } return 1; } +/*-------------------------------------------------------------------------*/ +static int TotalCmd(pSICSOBJ ccmd, SConnection * pCon, + Hdb * cmdNode, Hdb * par[], int nPar) +{ + pHdb dataNode = NULL; + long lSum = 0; + int i; + + dataNode = GetHipadabaNode(ccmd->objectNode,"data"); + assert(dataNode != NULL); + for(i = 0, lSum = 0; i < dataNode->value.arrayLength; i++){ + lSum += dataNode->value.v.intArray[i]; + } + SCPrintf(pCon,eValue,"%s.total = %ld", ccmd->objectNode->name, lSum); + return 1; +} /*--------------------------------------------------------------------------*/ static int InitCmd(pSICSOBJ ccmd, SConnection * con, Hdb * cmdNode, Hdb * par[], int nPar) @@ -382,6 +398,8 @@ int MakeSecHM(SConnection * pCon, SicsInterp * pSics, void *pData, AddSICSHdbPar(child, "ystart", usSpy, MakeHdbInt(0)); AddSICSHdbPar(child, "yend", usSpy, MakeHdbInt(0)); + child = AddSICSHdbPar(node,"total", usSpy, MakeSICSFunc(TotalCmd)); + /* * test TOF option */ diff --git a/sicshipadaba.c b/sicshipadaba.c index 2e7ec442..365bddae 100644 --- a/sicshipadaba.c +++ b/sicshipadaba.c @@ -693,7 +693,7 @@ static hdbCallbackReturn SICSNotifyCallback(pHdb node, void *userData, SCPureSockWrite(cbInfo->pCon, GetCharArray(result), outCode); DeleteDynString(printedData); } else { - formatNameValue(protocol, pPath, "!!datachange!!", result, HIPTEXT); + formatNameValue(protocol, updatePath, "!!datachange!!", result, HIPTEXT); SCWrite(cbInfo->pCon, GetCharArray(result), outCode); } DeleteDynString(result); @@ -2708,10 +2708,10 @@ static int GetHdbNode(SConnection * pCon, SicsInterp * pSics, void *pData, return 0; } /* - * if transfer = zip, redirect to zip + * if transfer = zip or bin, redirect to zip */ if (GetHdbProperty(targetNode, "transfer", value, 80) == 1) { - if (strstr(value, "zip") != NULL) { + if (strstr(value, "zip") != NULL || strstr(value,"bin") != NULL) { return ZipGetHdbNode(pCon, pSics, pData, argc, argv); } }