Merge commit 'refs/merge-requests/1' of ssh://gitorious.psi.ch/sinqdev/sics into merge-requests/1
First merge with ANSTO which compiles Conflicts: SICSmain.c asynnet.c confvirtualmot.c counter.c devexec.c drive.c exebuf.c hipadaba.c interface.h make_gen motor.c nserver.c nwatch.c ofac.c protocol.c sicshipadaba.c
This commit is contained in:
@@ -404,6 +404,7 @@ static char *SctActionHandler(void *actionData, char *lastReply,
|
||||
char *errorScript = NULL;
|
||||
char *send = NULL;
|
||||
int i;
|
||||
int j;
|
||||
SConnection *con;
|
||||
char eprop[80];
|
||||
char msg[1024];
|
||||
@@ -431,23 +432,24 @@ static char *SctActionHandler(void *actionData, char *lastReply,
|
||||
* property result to the data from the device. Read this now and
|
||||
* print it if diagnostics is required.
|
||||
*/
|
||||
SetProp(node, controller->node, "result", lastReply);
|
||||
script = NULL;
|
||||
if (!commError && controller->verbose && lastReply != NULL
|
||||
&& *lastReply != '\0') {
|
||||
SCPrintf(con, eLog, "%6.3f reply : %s\n", secondsOfMinute(), lastReply);
|
||||
if (lastReply != NULL) {
|
||||
SetProp(node, controller->node, "result", lastReply);
|
||||
if (*lastReply != '\0') {
|
||||
if (!commError && controller->verbose) {
|
||||
SCPrintf(con, eLog, "%6.3f reply : %s\n", secondsOfMinute(), lastReply);
|
||||
}
|
||||
if(!commError && controller->fd != NULL) {
|
||||
fprintf(controller->fd, "%6.3f reply : %s\n", secondsOfMinute(), lastReply);
|
||||
}
|
||||
if(data != NULL && data->controller != NULL) {
|
||||
traceIO(data->controller->node->name, "reply:%s", lastReply);
|
||||
} else {
|
||||
traceIO("sctunknown", "reply:%s", lastReply);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!commError && controller->fd != NULL && lastReply != NULL && *lastReply != '\0'){
|
||||
fprintf(controller->fd, "%6.3f reply : %s\n", secondsOfMinute(), lastReply);
|
||||
}
|
||||
if(lastReply != NULL && *lastReply != '\0'){
|
||||
if(data != NULL && data->controller != NULL){
|
||||
traceIO(data->controller->node->name, "reply:%s", lastReply);
|
||||
} else {
|
||||
traceIO("sctunknown", "reply:%s", lastReply);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Make sure that the state property is set to the name of the property
|
||||
* which holds the name of the script to run at this stage.
|
||||
@@ -521,7 +523,7 @@ static char *SctActionHandler(void *actionData, char *lastReply,
|
||||
traceIO(data->controller->node->name, "ERROR: action {%s} in {%s} node %s:\nERROR: %s",
|
||||
data->name, origScript, path, result);
|
||||
} else {
|
||||
traceIO("sctunknown", "reply:%s", "ERROR: action {%s} in {%s} node %s:\nERROR: %s",
|
||||
traceIO("sctunknown", "ERROR: action {%s} in {%s} node %s:\nERROR: %s",
|
||||
data->name, origScript, path, result);
|
||||
}
|
||||
}
|
||||
@@ -529,6 +531,21 @@ static char *SctActionHandler(void *actionData, char *lastReply,
|
||||
if (strcasecmp(data->name, "read") == 0) {
|
||||
SetHdbProperty(node, "geterror", result);
|
||||
}
|
||||
/* Sanitize the text to reduce TCL problems with unbalanced and substituted items */
|
||||
for (j = 0; msg[j]; ++j) {
|
||||
switch (msg[j]) {
|
||||
case '{':
|
||||
case '}':
|
||||
case '[':
|
||||
case ']':
|
||||
case '<':
|
||||
case '>':
|
||||
case '\'':
|
||||
case '"':
|
||||
case '$':
|
||||
msg[j] = '_';
|
||||
}
|
||||
}
|
||||
SetHdbProperty(node, eprop, msg);
|
||||
blank = strchr(origScript, ' ');
|
||||
if (blank != NULL) {
|
||||
@@ -544,6 +561,21 @@ static char *SctActionHandler(void *actionData, char *lastReply,
|
||||
}
|
||||
cnt++;
|
||||
snprintf(msg, sizeof msg, "%dx {%s}: %s", cnt, origScript, result);
|
||||
/* Sanitize the text to reduce TCL problems with unbalanced and substituted items */
|
||||
for (j = 0; msg[j]; ++j) {
|
||||
switch (msg[j]) {
|
||||
case '{':
|
||||
case '}':
|
||||
case '[':
|
||||
case ']':
|
||||
case '<':
|
||||
case '>':
|
||||
case '\'':
|
||||
case '"':
|
||||
case '$':
|
||||
msg[j] = '_';
|
||||
}
|
||||
}
|
||||
SetHdbProperty(node, eprop, msg);
|
||||
send = NULL;
|
||||
free(script);
|
||||
@@ -951,12 +983,15 @@ int SctAddPollNode(SctController * controller, Hdb * node, double interval,
|
||||
{
|
||||
SctData *data;
|
||||
hdbCallback *cb;
|
||||
|
||||
char nodePath[512], info[1024];
|
||||
|
||||
if (!FindHdbCallbackData(node, controller)) {
|
||||
cb = MakeHipadabaCallback(SctMainCallback, controller, NULL);
|
||||
assert(cb);
|
||||
AppendHipadabaCallback(node, cb);
|
||||
SetHdbProperty(node, "geterror", "Not read yet");
|
||||
GetHdbPath(node, nodePath, sizeof nodePath);
|
||||
snprintf(info, 1023, "%s: Not read yet", nodePath);
|
||||
SetHdbProperty(node, "geterror", info);
|
||||
}
|
||||
|
||||
data = calloc(1, sizeof(*data));
|
||||
|
||||
Reference in New Issue
Block a user