Commit 599b66b0 authored by Matteo Quintiliani's avatar Matteo Quintiliani

added parameter message string to nmxptool_ew_send_error()


git-svn-id: file:///home/quintiliani/svncopy/nmxptool/trunk@1001 3cd66e75-5955-46cb-a940-c26e5fc5497d
parent b2800da2
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Istituto Nazionale di Geofisica e Vulcanologia - Italy * Istituto Nazionale di Geofisica e Vulcanologia - Italy
* quintiliani@ingv.it * quintiliani@ingv.it
* *
* $Id: nmxptool.c,v 1.164 2008-03-31 07:47:35 mtheo Exp $ * $Id: nmxptool.c,v 1.165 2008-03-31 11:31:10 mtheo Exp $
* *
*/ */
...@@ -671,7 +671,7 @@ int main (int argc, char **argv) { ...@@ -671,7 +671,7 @@ int main (int argc, char **argv) {
/* Check if we are being asked to terminate */ /* Check if we are being asked to terminate */
if( nmxptool_ew_check_flag_terminate() ) { if( nmxptool_ew_check_flag_terminate() ) {
logit ("t", "nmxptool terminating on request\n"); logit ("t", "nmxptool terminating on request\n");
nmxptool_ew_send_error(NMXPTOOL_EW_ERR_TERMREQ); nmxptool_ew_send_error(NMXPTOOL_EW_ERR_TERMREQ, NULL);
exitdapcondition = 0; exitdapcondition = 0;
times_flow = TIMES_FLOW_EXIT; times_flow = TIMES_FLOW_EXIT;
} }
...@@ -817,7 +817,7 @@ int main (int argc, char **argv) { ...@@ -817,7 +817,7 @@ int main (int argc, char **argv) {
#ifdef HAVE_EARTHWORMOBJS #ifdef HAVE_EARTHWORMOBJS
if(params.ew_configuration_file) { if(params.ew_configuration_file) {
nmxptool_ew_send_error(NMXPTOOL_EW_ERR_RECVDATA); nmxptool_ew_send_error(NMXPTOOL_EW_ERR_RECVDATA, nmxp_strerror(recv_errno));
} }
#endif #endif
exitpdscondition = 0; exitpdscondition = 0;
...@@ -955,7 +955,7 @@ int main (int argc, char **argv) { ...@@ -955,7 +955,7 @@ int main (int argc, char **argv) {
/* Check if we are being asked to terminate */ /* Check if we are being asked to terminate */
if( nmxptool_ew_check_flag_terminate() ) { if( nmxptool_ew_check_flag_terminate() ) {
logit ("t", "nmxptool terminating on request\n"); logit ("t", "nmxptool terminating on request\n");
nmxptool_ew_send_error(NMXPTOOL_EW_ERR_TERMREQ); nmxptool_ew_send_error(NMXPTOOL_EW_ERR_TERMREQ, NULL);
exitpdscondition = 0; exitpdscondition = 0;
times_flow = TIMES_FLOW_EXIT; times_flow = TIMES_FLOW_EXIT;
} }
......
...@@ -593,7 +593,8 @@ void nmxptool_ew_send_heartbeat_if_needed() { ...@@ -593,7 +593,8 @@ void nmxptool_ew_send_heartbeat_if_needed() {
} }
} }
void nmxptool_ew_send_error(unsigned int ierr) { void nmxptool_ew_send_error(unsigned int ierr, char *message) {
char complete_message[NMXPTOOL_EW_MAXSZE_MSG];
int i; int i;
i=0; i=0;
...@@ -601,6 +602,11 @@ void nmxptool_ew_send_error(unsigned int ierr) { ...@@ -601,6 +602,11 @@ void nmxptool_ew_send_error(unsigned int ierr) {
i++; i++;
} }
if(i < NMXPTOOL_EW_ERR_MAXVALUE) { if(i < NMXPTOOL_EW_ERR_MAXVALUE) {
if(message) {
snprintf(complete_message, NMXPTOOL_EW_MAXSZE_MSG, "%s %s", nmxptool_ew_err_msg[i].message, message);
} else {
snprintf(complete_message, NMXPTOOL_EW_MAXSZE_MSG, "%s", nmxptool_ew_err_msg[i].message);
}
nmxptool_ew_report_status ( &errLogo, nmxptool_ew_err_msg[i].error, nmxptool_ew_err_msg[i].message); nmxptool_ew_report_status ( &errLogo, nmxptool_ew_err_msg[i].error, nmxptool_ew_err_msg[i].message);
} else { } else {
nmxptool_ew_report_status ( &errLogo, 0, "Unknown error"); nmxptool_ew_report_status ( &errLogo, 0, "Unknown error");
......
...@@ -29,9 +29,11 @@ ...@@ -29,9 +29,11 @@
#define NMXPTOOL_EW_ERR_RECVDATA 1 #define NMXPTOOL_EW_ERR_RECVDATA 1
#define NMXPTOOL_EW_ERR_TERMREQ 2 #define NMXPTOOL_EW_ERR_TERMREQ 2
#define NMXPTOOL_EW_MAXSZE_MSG 1024
typedef struct { typedef struct {
unsigned int error; unsigned int error;
char message[1024]; char message[NMXPTOOL_EW_MAXSZE_MSG];
} NMXPTOOL_EW_ERR_MSG; } NMXPTOOL_EW_ERR_MSG;
void nmxptool_ew_attach(); void nmxptool_ew_attach();
...@@ -49,7 +51,7 @@ void nmxptool_ew_report_status ( MSG_LOGO *pLogo, short code, char * message ); ...@@ -49,7 +51,7 @@ void nmxptool_ew_report_status ( MSG_LOGO *pLogo, short code, char * message );
int nmxptool_ew_check_flag_terminate(); int nmxptool_ew_check_flag_terminate();
void nmxptool_ew_send_heartbeat_if_needed(); void nmxptool_ew_send_heartbeat_if_needed();
void nmxptool_ew_send_error(unsigned int ierr); void nmxptool_ew_send_error(unsigned int ierr, char *message);
int nmxptool_ew_logit_msg ( char *msg ); int nmxptool_ew_logit_msg ( char *msg );
int nmxptool_ew_logit_err ( char *msg ); int nmxptool_ew_logit_err ( char *msg );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment