Title: [opsview-base] [229] Unescape other characters including \t and \r
- Revision
- 229
- Author
- tvoon
- Date
- 2013-03-22 18:25:56 +0000 (Fri, 22 Mar 2013)
Log Message
Unescape other characters including \t and \r
Modified Paths
Modified: trunk/patches/nagios_convert_to_linefeeds_from_checkresults.patch
===================================================================
--- trunk/patches/nagios_convert_to_linefeeds_from_checkresults.patch 2013-03-22 17:19:19 UTC (rev 228)
+++ trunk/patches/nagios_convert_to_linefeeds_from_checkresults.patch 2013-03-22 18:25:56 UTC (rev 229)
@@ -1,7 +1,7 @@
-diff -ur nagios-4.0.20130107.orig/base/utils.c nagios-4.0.20130107/base/utils.c
---- nagios-4.0.20130107.orig/base/utils.c 2013-03-22 17:10:38.000000000 +0000
-+++ nagios-4.0.20130107/base/utils.c 2013-03-22 17:13:48.000000000 +0000
-@@ -2256,8 +2256,30 @@
+diff -ur nagios-4.0.20130107.original/base/utils.c nagios-4.0.20130107/base/utils.c
+--- nagios-4.0.20130107.original/base/utils.c 2013-03-22 15:54:58.000000000 +0000
++++ nagios-4.0.20130107/base/utils.c 2013-03-22 18:23:03.000000000 +0000
+@@ -2256,8 +2256,36 @@
cr.exited_ok = atoi(val);
else if(!strcmp(var, "return_code"))
cr.return_code = atoi(val);
@@ -12,18 +12,24 @@
+ // Opsview patch: The checkresults dir is only for NRD type data now
+ // We convert \n to actual linefeeds, because the subsequent parse_check_result
+ // expects linefeeds in the stream. We also convert \\ to a single backslash
-+ // This is mirrored with the output from SERVICEOUTPUT on a slave system. There was a change somewhere in Nagios 4
-+ int x,y;
++ // This is mirrored with the output from SERVICEOUTPUT on a slave system.
++ // There was a change somewhere in Nagios 4
++ register int x,y;
+ char *buf = cr.output;
+ for(x=0,y=0;buf[x]!='\x0';x++){
-+ if(buf[x]=='\\' && buf[x+1]=='n'){
++ if(buf[x]=='\\'){
++ if(buf[x+1]=='n')
++ buf[y++]='\n';
++ else if (buf[x+1]=='\\')
++ buf[y++]='\\';
++ else if (buf[x+1]=='t')
++ buf[y++]='\t';
++ else if (buf[x+1]=='r')
++ buf[y++]='\r';
++ else
++ buf[y++]=buf[x+1];
+ x++;
-+ buf[y++]='\n';
+ }
-+ else if (buf[x]=='\\' && buf[x+1]=='\\'){
-+ x++;
-+ buf[y++]='\\';
-+ }
+ else
+ buf[y++]=buf[x];
+ }
_______________________________________________
Opsview-checkins mailing list
Opsview-checkins@lists.opsview.org
http://lists.opsview.org/lists/listinfo/opsview-checkins