[lwatch-cvs] files/src control.c,1.18,1.19 lwatch.c,1.23,1.24 settings.c,1.25,1.26 strpcre.c,1.20,1.
Brought to you by:
arturcz
|
From: <os...@us...> - 2004-01-12 21:19:44
|
Update of /cvsroot/lwatch/files/src
In directory sc8-pr-cvs1:/tmp/cvs-serv25718
Modified Files:
control.c lwatch.c settings.c strpcre.c yparse.l
Log Message:
Now output non-log messages to stderr.
Index: control.c
===================================================================
RCS file: /cvsroot/lwatch/files/src/control.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** control.c 12 Jan 2004 18:42:36 -0000 1.18
--- control.c 12 Jan 2004 21:19:41 -0000 1.19
***************
*** 53,57 ****
retval=wsz.ws_col;
#ifdef DEBUG
! printf("Terminal width=%d\n",retval);
#endif
return retval;
--- 53,57 ----
retval=wsz.ws_col;
#ifdef DEBUG
! fprintf(stderr,"Terminal width=%d\n",retval);
#endif
return retval;
***************
*** 90,94 ****
}
#ifdef DEBUG
! printf("Received signal %i%s\n",i,loop?"":" - exiting");
#endif
if(ex) {
--- 90,94 ----
}
#ifdef DEBUG
! fprintf(stderr,"Received signal %i%s\n",i,loop?"":" - exiting");
#endif
if(ex) {
***************
*** 113,119 ****
i=0;
while(i<n) {
! printf("fd: %i res: %i\n",ufds[i].fd,res);
! printf("watch: %i\n",ufds[i].events);
! printf("return: %i\n",ufds[i++].revents);
}
}
--- 113,119 ----
i=0;
while(i<n) {
! fprintf(stderr,"fd: %i res: %i\n",ufds[i].fd,res);
! fprintf(stderr,"watch: %i\n",ufds[i].events);
! fprintf(stderr,"return: %i\n",ufds[i++].revents);
}
}
Index: lwatch.c
===================================================================
RCS file: /cvsroot/lwatch/files/src/lwatch.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** lwatch.c 12 Jan 2004 12:46:22 -0000 1.23
--- lwatch.c 12 Jan 2004 21:19:41 -0000 1.24
***************
*** 73,77 ****
fd=0;
#ifdef DEBUG
! printf("Input from stdin\n");
#endif
} else {
--- 73,77 ----
fd=0;
#ifdef DEBUG
! fprintf(stderr,"Input from stdin\n");
#endif
} else {
***************
*** 81,90 ****
io_check(fd=open(lw_conf.in_file,O_RDONLY),lw_conf.in_file);
#ifdef DEBUG
! printf("Input from %s\n",lw_conf.in_file);
#endif
}
if(strcmp(lw_conf.out_file,"-")==0) {
#ifdef DEBUG
! printf("Output to stdout\n");
#endif
} else {
--- 81,90 ----
io_check(fd=open(lw_conf.in_file,O_RDONLY),lw_conf.in_file);
#ifdef DEBUG
! fprintf(stderr,"Input from %s\n",lw_conf.in_file);
#endif
}
if(strcmp(lw_conf.out_file,"-")==0) {
#ifdef DEBUG
! fprintf(stderr,"Output to stdout\n");
#endif
} else {
***************
*** 92,96 ****
/* io_check(fd=open(lw_conf.out_file,O_WRONLY),lw_conf.out_file); */
#ifdef DEBUG
! printf("Output to %s\n",lw_conf.out_file);
#endif
}
--- 92,96 ----
/* io_check(fd=open(lw_conf.out_file,O_WRONLY),lw_conf.out_file); */
#ifdef DEBUG
! fprintf(stderr,"Output to %s\n",lw_conf.out_file);
#endif
}
***************
*** 110,114 ****
/* from fifo */
#ifdef DEBUG
! printf("syslog closed second end of fifo %s\nTrying to reopen\n",lw_conf.in_file);
#endif
/* trying to reopen or die */
--- 110,114 ----
/* from fifo */
#ifdef DEBUG
! fprintf(stderr,"syslog closed second end of fifo %s\nTrying to reopen\n",lw_conf.in_file);
#endif
/* trying to reopen or die */
***************
*** 118,122 ****
/* from stdin */
#ifdef DEBUG
! printf("end of file on stdin, exitting...\n");
#endif
loop=0;
--- 118,122 ----
/* from stdin */
#ifdef DEBUG
! fprintf(stderr,"end of file on stdin, exitting...\n");
#endif
loop=0;
Index: settings.c
===================================================================
RCS file: /cvsroot/lwatch/files/src/settings.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** settings.c 12 Jan 2004 18:42:36 -0000 1.25
--- settings.c 12 Jan 2004 21:19:41 -0000 1.26
***************
*** 144,148 ****
no_actions=0;
#ifdef DEBUG
! printf("Parse options\n");
#endif
memset(&lw_conf,0,sizeof(lw_conf));
--- 144,148 ----
no_actions=0;
#ifdef DEBUG
! fprintf(stderr,"Parse options\n");
#endif
memset(&lw_conf,0,sizeof(lw_conf));
***************
*** 155,166 ****
strncpy(lw_conf.conf_file,optarg,MAXPATHLEN);
#ifdef DEBUG
! printf("Configuration file set to: %s\n",lw_conf.conf_file);
#endif
}
break;
case 'f':
! printf("USAGE OF --fifo AND -f IS DEPRECATED.\n");
! printf("PLEASE USE --input OR -i INSTEAD IT.\n");
! printf("OPTIONS --fifo AND -f ARE SUBJECTS TO REMOVE IN NEXT RELEASE.\n");
case 'i':
if(strlen(optarg)>MAXPATHLEN) {
--- 155,166 ----
strncpy(lw_conf.conf_file,optarg,MAXPATHLEN);
#ifdef DEBUG
! fprintf(stderr,"Configuration file set to: %s\n",lw_conf.conf_file);
#endif
}
break;
case 'f':
! fprintf(stderr,"USAGE OF --fifo AND -f IS DEPRECATED.\n");
! fprintf(stderr,"PLEASE USE --input OR -i INSTEAD IT.\n");
! fprintf(stderr,"OPTIONS --fifo AND -f ARE SUBJECTS TO REMOVE IN NEXT RELEASE.\n");
case 'i':
if(strlen(optarg)>MAXPATHLEN) {
***************
*** 169,173 ****
strncpy(lw_conf.in_file,optarg,MAXPATHLEN);
#ifdef DEBUG
! printf("Input file set to: %s\n",lw_conf.in_file);
#endif
}
--- 169,173 ----
strncpy(lw_conf.in_file,optarg,MAXPATHLEN);
#ifdef DEBUG
! fprintf(stderr,"Input file set to: %s\n",lw_conf.in_file);
#endif
}
***************
*** 179,183 ****
strncpy(lw_conf.out_file,optarg,MAXPATHLEN);
#ifdef DEBUG
! printf("Output file set to: %s\n",lw_conf.out_file);
#endif
}
--- 179,183 ----
strncpy(lw_conf.out_file,optarg,MAXPATHLEN);
#ifdef DEBUG
! fprintf(stderr,"Output file set to: %s\n",lw_conf.out_file);
#endif
}
***************
*** 186,190 ****
lw_conf.create_fifo=1;
#ifdef DEBUG
! printf("Create fifo if doesn't exist\n");
#endif
break;
--- 186,190 ----
lw_conf.create_fifo=1;
#ifdef DEBUG
! fprintf(stderr,"Create fifo if doesn't exist\n");
#endif
break;
***************
*** 192,196 ****
lw_conf.show_unparsed=1;
#ifdef DEBUG
! printf("Shows unparsed lines\n");
#endif
break;
--- 192,196 ----
lw_conf.show_unparsed=1;
#ifdef DEBUG
! fprintf(stderr,"Shows unparsed lines\n");
#endif
break;
***************
*** 198,202 ****
omit_config=1;
#ifdef DEBUG
! printf("Omit config file\n");
#endif
break;
--- 198,202 ----
omit_config=1;
#ifdef DEBUG
! fprintf(stderr,"Omit config file\n");
#endif
break;
***************
*** 205,209 ****
lw_conf.term_cut=1;
#ifdef DEBUG
! printf("Term-cut\n");
#endif
break;
--- 205,209 ----
lw_conf.term_cut=1;
#ifdef DEBUG
! fprintf(stderr,"Term-cut\n");
#endif
break;
***************
*** 235,247 ****
strncpy(lw_conf.conf_file,DEF_CONF_FILE,MAXPATHLEN);
#ifdef DEBUG
! printf("Open config file: %s\n",lw_conf.conf_file);
#endif
io_fcheck(yyin=fopen(lw_conf.conf_file,"r"),lw_conf.conf_file);
#ifdef DEBUG
! printf("Parse...\n");
#endif
yylex();
#ifdef DEBUG
! printf("Finished\n");
#endif
fclose(yyin);
--- 235,247 ----
strncpy(lw_conf.conf_file,DEF_CONF_FILE,MAXPATHLEN);
#ifdef DEBUG
! fprintf(stderr,"Open config file: %s\n",lw_conf.conf_file);
#endif
io_fcheck(yyin=fopen(lw_conf.conf_file,"r"),lw_conf.conf_file);
#ifdef DEBUG
! fprintf(stderr,"Parse...\n");
#endif
yylex();
#ifdef DEBUG
! fprintf(stderr,"Finished\n");
#endif
fclose(yyin);
***************
*** 253,257 ****
***************************************/
#ifdef DEBUG
! printf("date: %i, host: %i, serv: %i, mesg: %i\n",
lw_conf.def_date_color,
lw_conf.def_host_color,
--- 253,257 ----
***************************************/
#ifdef DEBUG
! fprintf(stderr,"date: %i, host: %i, serv: %i, mesg: %i\n",
lw_conf.def_date_color,
lw_conf.def_host_color,
***************
*** 271,276 ****
memcpy(&lw_actions[no_actions],paction,sizeof(struct s_action));
#ifdef DEBUG
! printf("vvvvvvvvvvvvvvvv\n");
! printf("RE: %s\ndate: [%i]\nhost: [%i]\nserv: [%i]\nmesg: [%i]\n",
paction->restr,
paction->date_color,
--- 271,276 ----
memcpy(&lw_actions[no_actions],paction,sizeof(struct s_action));
#ifdef DEBUG
! fprintf(stderr,"vvvvvvvvvvvvvvvv\n");
! fprintf(stderr,"RE: %s\ndate: [%i]\nhost: [%i]\nserv: [%i]\nmesg: [%i]\n",
paction->restr,
paction->date_color,
***************
*** 278,282 ****
paction->serv_color,
paction->mesg_color);
! printf("Highlight: %i\nIgnore: %s\nMatch service: %s\n",
paction->highlight_color,
paction->ignore?"yes":"no",
--- 278,282 ----
paction->serv_color,
paction->mesg_color);
! fprintf(stderr,"Highlight: %i\nIgnore: %s\nMatch service: %s\n",
paction->highlight_color,
paction->ignore?"yes":"no",
***************
*** 284,288 ****
paction->match_service?"yes":"no",
paction->match_host?"yes":"no");
! printf("^^^^^^^^^^^^^^^^\n");
#endif
no_actions++;
--- 284,288 ----
paction->match_service?"yes":"no",
paction->match_host?"yes":"no");
! fprintf(stderr,"^^^^^^^^^^^^^^^^\n");
#endif
no_actions++;
***************
*** 292,296 ****
while(no_actions--) {
#ifdef DEBUG
! printf("Freed resources for action [%i]%s\n",
no_actions,lw_actions[no_actions].restr);
#endif
--- 292,296 ----
while(no_actions--) {
#ifdef DEBUG
! fprintf(stderr,"Freed resources for action [%i]%s\n",
no_actions,lw_actions[no_actions].restr);
#endif
***************
*** 302,306 ****
free(lw_actions);
#ifdef DEBUG
! printf("Freed memory for actions\n");
#endif
}
--- 302,306 ----
free(lw_actions);
#ifdef DEBUG
! fprintf(stderr,"Freed memory for actions\n");
#endif
}
Index: strpcre.c
===================================================================
RCS file: /cvsroot/lwatch/files/src/strpcre.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** strpcre.c 12 Jan 2004 21:10:28 -0000 1.20
--- strpcre.c 12 Jan 2004 21:19:41 -0000 1.21
***************
*** 72,80 ****
#ifdef DEBUG
! printf("Compiling pattern: %s\n",re);
#endif
*pre=pcre_compile(re,PCRE_COPT,&re_error,&re_errno,NULL);
if(*pre==NULL) {
! printf("Regexp: %s\nCompile error %s at offset %d\n",
re,re_error,re_errno);
return(0);
--- 72,80 ----
#ifdef DEBUG
! fprintf(stderr,"Compiling pattern: %s\n",re);
#endif
*pre=pcre_compile(re,PCRE_COPT,&re_error,&re_errno,NULL);
if(*pre==NULL) {
! fprintf(stderr,"Regexp: %s\nCompile error %s at offset %d\n",
re,re_error,re_errno);
return(0);
***************
*** 82,86 ****
*prh=pcre_study(*pre,0,&re_error);
if(re_error!=NULL) {
! printf("Regexp: %s\nStuding error %s\n",re,re_error);
return(0);
}
--- 82,86 ----
*prh=pcre_study(*pre,0,&re_error);
if(re_error!=NULL) {
! fprintf(stderr,"Regexp: %s\nStuding error %s\n",re,re_error);
return(0);
}
***************
*** 98,102 ****
}
#ifdef DEBUG
! printf("Parser initialized\n");
#endif
}
--- 98,102 ----
}
#ifdef DEBUG
! fprintf(stderr,"Parser initialized\n");
#endif
}
***************
*** 105,109 ****
free_re(&parser.pre,&parser.prh);
#ifdef DEBUG
! printf("Parser freed\n");
#endif
}
--- 105,109 ----
free_re(&parser.pre,&parser.prh);
#ifdef DEBUG
! fprintf(stderr,"Parser freed\n");
#endif
}
Index: yparse.l
===================================================================
RCS file: /cvsroot/lwatch/files/src/yparse.l,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** yparse.l 11 Jan 2004 21:49:08 -0000 1.22
--- yparse.l 12 Jan 2004 21:19:41 -0000 1.23
***************
*** 203,207 ****
POP;
#ifdef DEBUG
! printf("Set %s to %s[%i]\n",mymsg,yytext,*yyip);
#endif
}
--- 203,207 ----
POP;
#ifdef DEBUG
! fprintf(stderr,"Set %s to %s[%i]\n",mymsg,yytext,*yyip);
#endif
}
***************
*** 213,217 ****
strcpy(yypch,yytext);
#ifdef DEBUG
! printf("Set %s to %s\n",mymsg,yytext);
#endif
}
--- 213,217 ----
strcpy(yypch,yytext);
#ifdef DEBUG
! fprintf(stderr,"Set %s to %s\n",mymsg,yytext);
#endif
}
***************
*** 234,238 ****
action.match_service=1;
#ifdef DEBUG
! printf("Match service instead message\n");
#endif
}
--- 234,238 ----
action.match_service=1;
#ifdef DEBUG
! fprintf(stderr,"Match service instead message\n");
#endif
}
***************
*** 243,247 ****
}
#ifdef DEBUG
! printf("Match hostname instead message\n");
#endif
}
--- 243,247 ----
}
#ifdef DEBUG
! fprintf(stderr,"Match hostname instead message\n");
#endif
}
***************
*** 250,254 ****
action.exit=1;
#ifdef DEBUG
! printf("Ignore RE\n");
#endif
}
--- 250,254 ----
action.exit=1;
#ifdef DEBUG
! fprintf(stderr,"Ignore RE\n");
#endif
}
***************
*** 256,260 ****
action.exit=1;
#ifdef DEBUG
! printf("Exit on action\n");
#endif
}
--- 256,260 ----
action.exit=1;
#ifdef DEBUG
! fprintf(stderr,"Exit on action\n");
#endif
}
|