[lwatch-cvs] files/src strpcre.c,1.3,1.4
Brought to you by:
arturcz
|
From: <ar...@us...> - 2002-06-30 19:09:45
|
Update of /cvsroot/lwatch/files/src
In directory usw-pr-cvs1:/tmp/cvs-serv20780
Modified Files:
strpcre.c
Log Message:
All options except highlight works.
Index: strpcre.c
===================================================================
RCS file: /cvsroot/lwatch/files/src/strpcre.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** strpcre.c 30 Jun 2002 00:23:53 -0000 1.3
--- strpcre.c 30 Jun 2002 19:09:35 -0000 1.4
***************
*** 117,123 ****
void showline(char *input) {
! int n;
int date_c,host_c,serv_c,mesg_c;
const char **re_str;
//memcpy((void*)&date_c,(void*)&lw_conf.def_date_color,4*sizeof(int));
--- 117,124 ----
void showline(char *input) {
! int i,n,ignore;
int date_c,host_c,serv_c,mesg_c;
const char **re_str;
+ const char *match;
//memcpy((void*)&date_c,(void*)&lw_conf.def_date_color,4*sizeof(int));
***************
*** 126,137 ****
serv_c=lw_conf.def_serv_color;
mesg_c=lw_conf.def_mesg_color;
n=pcre_exec(parser.pre,parser.prh,input,strlen(input),0,0,
(int*)&re_matches,RE_NMATCHES);
pcre_get_substring_list(input,(int*)&re_matches,n,&re_str);
! printf("%s%s%s%s%s%s%s%s"_S_RESET"\n",
DATE_COLOR,re_str[1],
HOST_COLOR,re_str[2],
SERV_COLOR,re_str[3],
MESG_COLOR,re_str[4]);
pcre_free_substring_list(re_str);
}
--- 127,167 ----
serv_c=lw_conf.def_serv_color;
mesg_c=lw_conf.def_mesg_color;
+ ignore=0;
n=pcre_exec(parser.pre,parser.prh,input,strlen(input),0,0,
(int*)&re_matches,RE_NMATCHES);
pcre_get_substring_list(input,(int*)&re_matches,n,&re_str);
! for(i=0;i<no_actions;i++) {
! if(lw_actions[i].match_service) {
! match=re_str[3]; /* match service */
! } else {
! match=re_str[4]; /* match message body */
! }
! n=pcre_exec(lw_actions[i].re,lw_actions[i].rh,
! match,strlen(match),0,0,
! (int*)&re_matches,RE_NMATCHES);
! if(n>0) {
! ignore=lw_actions[i].ignore;
! if(lw_actions[i].date_color) date_c=lw_actions[i].date_color;
! if(lw_actions[i].host_color) host_c=lw_actions[i].host_color;
! if(lw_actions[i].serv_color) serv_c=lw_actions[i].serv_color;
! if(lw_actions[i].mesg_color) mesg_c=lw_actions[i].mesg_color;
! break;
! }
! }
! #ifdef DEBUG
! printf("all: %i, cur: [%i] %s\n",no_actions,i,lw_actions[i].restr);
! #endif
! if(!ignore) {
! printf("%s%s%s%s%s%s%s%s"_S_RESET"\n",
DATE_COLOR,re_str[1],
HOST_COLOR,re_str[2],
SERV_COLOR,re_str[3],
MESG_COLOR,re_str[4]);
+ }
+ #ifdef DEBUG
+ else {
+ printf("Ignored %s\n\t%s\n",lw_actions[i].restr,input);
+ }
+ #endif
pcre_free_substring_list(re_str);
}
|