suppress empty reply and print nodepath

This commit is contained in:
Douglas Clowes
2012-11-29 12:57:35 +11:00
parent 933c7157cd
commit f57fe9262e

View File

@@ -426,23 +426,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);
}
}
/*
* When this is a followup, we use the content of the
* state field as the property storing the next script to
@@ -930,12 +931,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));