lwatch-cvs Mailing List for Log Watcher (Page 15)
Brought to you by:
arturcz
You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(9) |
Jul
(22) |
Aug
(11) |
Sep
(5) |
Oct
|
Nov
(4) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(5) |
Feb
(29) |
Mar
(85) |
Apr
(45) |
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2004 |
Jan
(30) |
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(55) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
| 2005 |
Jan
|
Feb
(10) |
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
|
Feb
(6) |
Mar
(12) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
| 2010 |
Jan
|
Feb
(15) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <ar...@us...> - 2002-07-13 00:23:26
|
Update of /cvsroot/lwatch/files/src
In directory usw-pr-cvs1:/tmp/cvs-serv31888
Modified Files:
control.c
Log Message:
Cosmetic changes.
Index: control.c
===================================================================
RCS file: /cvsroot/lwatch/files/src/control.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** control.c 30 Jun 2002 00:32:46 -0000 1.7
--- control.c 13 Jul 2002 00:23:16 -0000 1.8
***************
*** 1,3 ****
! /* die.c -- LogWatcher
This file is part of the LogWatcher tool.
--- 1,3 ----
! /* control.c -- LogWatcher
This file is part of the LogWatcher tool.
|
|
From: <ar...@us...> - 2002-07-09 14:27:38
|
Update of /cvsroot/lwatch/files/doc In directory usw-pr-cvs1:/tmp/cvs-serv27667 Added Files: lwatch.sgml Log Message: I dit it! I did it! First version of documentation. --- NEW FILE: lwatch.sgml --- <!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [ <!ENTITY conf "/etc/lwatch.conf"> <!ENTITY conf2 "<filename>/etc/lwatch.conf</filename>"> ]> <!-- This file is part of the LogWatcher tool. Copyright (C) 2002 Artur Robert Czechowski The LogWatcher is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The LogWatcher is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with the LogWatcher; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Artur R. Czechowski <ar...@he...> http://hell.pl/arturcz/ $Id: lwatch.sgml,v 1.1 2002/07/09 14:27:35 arturcz Exp $ $Source: /cvsroot/lwatch/files/doc/lwatch.sgml,v $ --> <refentry> <refentryinfo> <address> <email>ar...@he...</email> </address> <author> <firstname>Artur</firstname> <surname>Czechowski</surname> </author> <date>2002-07-09</date> </refentryinfo> <refmeta> <refentrytitle>lwatch</refentrytitle> <manvolnum>1</manvolnum> </refmeta> <refnamediv> <refname>lwatch</refname> <refpurpose>syntax highlighting for syslog/syslog-ng file</refpurpose> </refnamediv> <refsynopsisdiv> <cmdsynopsis> <command>lwatch</command> <arg>-C <replaceable>filename</replaceable></arg> <arg>--config <replaceable>filename</replaceable></arg> <arg>-f <replaceable>filename</replaceable></arg> <arg>--fifo <replaceable>filename</replaceable></arg> <arg>-coh</arg> <arg>--create-fifo</arg> <arg>--omit-rc</arg> <arg>--help</arg> </cmdsynopsis> </refsynopsisdiv> <refsect1> <title>Description</title> <para>The lwatch is a log colorizer. It reads syslog/syslog-ng data from named fifo or from stdin and display colored logs into stdout.</para> <para>The lwatch is highly user-customizable. It reads configuration data from file &conf; or (if given) from file provided with option <option>-C</option></para> </refsect1> <refsect1> <title>Environment</title> <para>The lwatch does not use any <envvar>VARIABLES</envvar></para> </refsect1> <refsect1> <title>Copyright</title> <para>GPL disclaimer should be placed here</para> </refsect1> <refsect1> <title>See also</title> <para>lwatch.conf(5)</para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:2 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:nil sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> |
|
From: <ar...@us...> - 2002-07-09 13:27:20
|
Update of /cvsroot/lwatch/files/doc In directory usw-pr-cvs1:/tmp/cvs-serv11596/doc Log Message: Directory /cvsroot/lwatch/files/doc added to the repository |
|
From: <ar...@us...> - 2002-07-04 14:36:05
|
Update of /cvsroot/lwatch/files/src
In directory usw-pr-cvs1:/tmp/cvs-serv22049
Modified Files:
yparse.l
Log Message:
Remove unnecessary debug message.
Index: yparse.l
===================================================================
RCS file: /cvsroot/lwatch/files/src/yparse.l,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** yparse.l 29 Jun 2002 14:58:02 -0000 1.9
--- yparse.l 4 Jul 2002 14:35:54 -0000 1.10
***************
*** 228,232 ****
}
<REGEXP>\/ {
- printf("RE: end %s\n",restr);
BEGIN(ACTION);
}
--- 228,231 ----
|
|
From: <ar...@us...> - 2002-07-01 15:53:51
|
Update of /cvsroot/lwatch/files/src
In directory usw-pr-cvs1:/tmp/cvs-serv20427
Modified Files:
lwatch.conf strpcre.c strpcre.h
Log Message:
highlight keyword supported
Index: lwatch.conf
===================================================================
RCS file: /cvsroot/lwatch/files/src/lwatch.conf,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** lwatch.conf 30 Jun 2002 00:23:53 -0000 1.4
--- lwatch.conf 1 Jul 2002 15:53:31 -0000 1.5
***************
*** 13,17 ****
# Default color for displaing message body
# mesg_color=white
- serv_color=green
# Where is source for reading data?
--- 13,16 ----
***************
*** 38,45 ****
# Below is configuration which works for me
! /root/ color=yellow # all messages with root string are yellow
/^fw-reject:/ { # all rejectd from fw are red
color=red
}
--- 37,47 ----
# Below is configuration which works for me
! /root/ highlight=yellow # all messages with root string are yellow
!
! /failed/ color=red # attention, operation failed
/^fw-reject:/ { # all rejectd from fw are red
color=red
+ serv_color=yellow
}
***************
*** 54,57 ****
/disconnect/ highlight=red # highlight only disconnect on red
! //USR/SBIN/CRON/ color=blue # cron's messages are not important
! # display it in blue
--- 56,61 ----
/disconnect/ highlight=red # highlight only disconnect on red
! //USR/SBIN/CRON/ { # cron's messages are not important
! color=blue # display it in blue
! match_service
! }
Index: strpcre.c
===================================================================
RCS file: /cvsroot/lwatch/files/src/strpcre.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** strpcre.c 1 Jul 2002 15:38:17 -0000 1.5
--- strpcre.c 1 Jul 2002 15:53:31 -0000 1.6
***************
*** 42,45 ****
--- 42,46 ----
#define SERV_COLOR colmode[serv_c]
#define MESG_COLOR colmode[mesg_c]
+ #define HL_COLOR colmode[hl_c]
struct {
***************
*** 52,55 ****
--- 53,57 ----
} re_matches[RE_NMATCHES];
+ int date_c,host_c,serv_c,mesg_c,hl_c;
int compile_re(char *re, pcre **pre, pcre_extra **prh) {
***************
*** 95,99 ****
}
! char *newstr(char *str) {
char *ptmp;
ptmp=(char *)malloc(strlen(str)+1);
--- 97,101 ----
}
! char *newstr(const char *str) {
char *ptmp;
ptmp=(char *)malloc(strlen(str)+1);
***************
*** 116,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));
--- 118,156 ----
}
+ char *hl_str(struct s_action *act,char *str) {
+ char *pmatch,*pres;
+ int i,j;
+ int start_match;
+ pmatch=newstr(str);
+ start_match=0;
+ while(pcre_exec(act->re,act->rh,pmatch,strlen(pmatch),start_match,0,(int*)&re_matches,RE_NMATCHES)>0) {
+ pres=(char*)malloc(strlen(pmatch)+strlen(HL_COLOR)+strlen(MESG_COLOR)+1);
+ i=j=0;
+ while(j<re_matches->start)
+ pres[i++]=pmatch[j++];
+ j=0;
+ while(pres[i++]=HL_COLOR[j++]);
+ i--;
+ j=re_matches->start;
+ while(j<re_matches->stop)
+ pres[i++]=pmatch[j++];
+ pres[i]='\0';
+ j=0;
+ while(pres[i++]=MESG_COLOR[j++]);
+ i--;
+ j=re_matches->stop;
+ while(pres[i++]=pmatch[j++]);
+ free(pmatch);
+ pmatch=pres;
+ start_match=re_matches->stop+strlen(MESG_COLOR);
+ }
+ return(pres);
+ }
+
void showline(char *input) {
int i,n,ignore;
const char **re_str;
! char *match;
! char *date_s,*host_s,*serv_s,*mesg_s;
//memcpy((void*)&date_c,(void*)&lw_conf.def_date_color,4*sizeof(int));
***************
*** 127,130 ****
--- 159,163 ----
serv_c=lw_conf.def_serv_color;
mesg_c=lw_conf.def_mesg_color;
+ hl_c=0;
ignore=0;
n=pcre_exec(parser.pre,parser.prh,input,strlen(input),0,0,
***************
*** 135,143 ****
}
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,
--- 168,181 ----
}
pcre_get_substring_list(input,(int*)&re_matches,n,&re_str);
+ date_s=newstr(re_str[1]);
+ host_s=newstr(re_str[2]);
+ serv_s=newstr(re_str[3]);
+ mesg_s=newstr(re_str[4]);
+ pcre_free_substring_list(re_str);
for(i=0;i<no_actions;i++) {
if(lw_actions[i].match_service) {
! match=serv_s; /* match service */
} else {
! match=mesg_s; /* match message body */
}
n=pcre_exec(lw_actions[i].re,lw_actions[i].rh,
***************
*** 150,153 ****
--- 188,198 ----
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;
+ if(lw_actions[i].highlight_color) {
+ hl_c=lw_actions[i].highlight_color;
+ match=hl_str(&lw_actions[i],mesg_s);
+ free(mesg_s);
+ mesg_s=match;
+ }
+
break;
}
***************
*** 158,165 ****
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
--- 203,210 ----
if(!ignore) {
printf("%s%s%s%s%s%s%s%s"_S_RESET"\n",
! DATE_COLOR,date_s,
! HOST_COLOR,host_s,
! SERV_COLOR,serv_s,
! MESG_COLOR,mesg_s);
}
#ifdef DEBUG
***************
*** 168,171 ****
}
#endif
! pcre_free_substring_list(re_str);
}
--- 213,219 ----
}
#endif
! free(date_s);
! free(host_s);
! free(serv_s);
! free(mesg_s);
}
Index: strpcre.h
===================================================================
RCS file: /cvsroot/lwatch/files/src/strpcre.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** strpcre.h 30 Jun 2002 00:23:53 -0000 1.4
--- strpcre.h 1 Jul 2002 15:53:31 -0000 1.5
***************
*** 40,44 ****
void init_parser(void);
int compile_re(char *re, pcre **pre, pcre_extra **prh);
! char *newstr(char *str);
char *addstr(char *s1, const char *s2);
void showline(char *str);
--- 40,44 ----
void init_parser(void);
int compile_re(char *re, pcre **pre, pcre_extra **prh);
! char *newstr(const char *str);
char *addstr(char *s1, const char *s2);
void showline(char *str);
|
|
From: <ar...@us...> - 2002-07-01 15:38:27
|
Update of /cvsroot/lwatch/files/src
In directory usw-pr-cvs1:/tmp/cvs-serv13702
Modified Files:
strpcre.c
Log Message:
Bugfix - program crashes when input does not match with fixed rule dividing it into
parts: date, host, service and message.
Index: strpcre.c
===================================================================
RCS file: /cvsroot/lwatch/files/src/strpcre.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** strpcre.c 30 Jun 2002 19:09:35 -0000 1.4
--- strpcre.c 1 Jul 2002 15:38:17 -0000 1.5
***************
*** 130,133 ****
--- 130,137 ----
n=pcre_exec(parser.pre,parser.prh,input,strlen(input),0,0,
(int*)&re_matches,RE_NMATCHES);
+ if(n<0) {
+ printf("%s\n",input);
+ return;
+ }
pcre_get_substring_list(input,(int*)&re_matches,n,&re_str);
for(i=0;i<no_actions;i++) {
|
|
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);
}
|
|
From: <ar...@us...> - 2002-06-30 00:32:49
|
Update of /cvsroot/lwatch/files/src
In directory usw-pr-cvs1:/tmp/cvs-serv1887
Modified Files:
control.c
Log Message:
Remove redundant code.
Index: control.c
===================================================================
RCS file: /cvsroot/lwatch/files/src/control.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** control.c 30 Jun 2002 00:02:21 -0000 1.6
--- control.c 30 Jun 2002 00:32:46 -0000 1.7
***************
*** 52,56 ****
int ex;
ex=0;
- if((i==SIGTERM)||(i==SIGINT)) loop=0;
switch(i) {
case SIGTERM:
--- 52,55 ----
|
|
From: <ar...@us...> - 2002-06-30 00:24:01
|
Update of /cvsroot/lwatch/files/src
In directory usw-pr-cvs1:/tmp/cvs-serv32424
Modified Files:
Makefile lwatch.c lwatch.conf settings.c strpcre.c strpcre.h
Log Message:
Basic color support.
Index: Makefile
===================================================================
RCS file: /cvsroot/lwatch/files/src/Makefile,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Makefile 28 Jun 2002 13:10:06 -0000 1.5
--- Makefile 30 Jun 2002 00:23:53 -0000 1.6
***************
*** 47,52 ****
acolors.o: acolors.h
lwatch.o: control.h strpcre.h settings.h
! settings.o: defaults.h control.h settings.h strpcre.h yparse.h
! strpcre.o: strpcre.h
yparse.o: acolors.h settings.h strpcre.h yparse.h
--- 47,52 ----
acolors.o: acolors.h
lwatch.o: control.h strpcre.h settings.h
! settings.o: acolors.h control.h defaults.h settings.h strpcre.h yparse.h
! strpcre.o: acolors.h settings.h strpcre.h
yparse.o: acolors.h settings.h strpcre.h yparse.h
Index: lwatch.c
===================================================================
RCS file: /cvsroot/lwatch/files/src/lwatch.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** lwatch.c 29 Jun 2002 15:04:37 -0000 1.8
--- lwatch.c 30 Jun 2002 00:23:53 -0000 1.9
***************
*** 93,98 ****
while((pstop=strchr(pstart,'\n'))!=NULL) {
(*pstop++)='\0';
! /* parseline(pstart); */
! printf("%s\n",pstart);
pstart=pstop;
}
--- 93,97 ----
while((pstop=strchr(pstart,'\n'))!=NULL) {
(*pstop++)='\0';
! showline(pstart);
pstart=pstop;
}
Index: lwatch.conf
===================================================================
RCS file: /cvsroot/lwatch/files/src/lwatch.conf,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** lwatch.conf 28 Jun 2002 01:20:21 -0000 1.3
--- lwatch.conf 30 Jun 2002 00:23:53 -0000 1.4
***************
*** 1,6 ****
# Config file for lwatch
# Created by Artur Czechowski <ar...@he...>
! # $Id $
! # $Source $
# Format of this file is described in manual FIXME
--- 1,6 ----
# Config file for lwatch
# Created by Artur Czechowski <ar...@he...>
! # $Id$
! # $Source$
# Format of this file is described in manual FIXME
***************
*** 13,17 ****
# Default color for displaing message body
# mesg_color=white
! mesg_color=green
# Where is source for reading data?
--- 13,17 ----
# Default color for displaing message body
# mesg_color=white
! serv_color=green
# Where is source for reading data?
Index: settings.c
===================================================================
RCS file: /cvsroot/lwatch/files/src/settings.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** settings.c 29 Jun 2002 13:44:57 -0000 1.9
--- settings.c 30 Jun 2002 00:23:53 -0000 1.10
***************
*** 37,40 ****
--- 37,41 ----
#include <unistd.h>
+ #include "acolors.h"
#include "defaults.h"
#include "control.h"
***************
*** 43,50 ****
#include "yparse.h"
- #ifdef DEBUG
- #include "acolors.h"
- #endif
-
struct s_conf lw_conf;
struct s_action *lw_actions;
--- 44,47 ----
***************
*** 147,150 ****
--- 144,151 ----
void parse_config(void) {
+ lw_conf.def_date_color=FGCYAN;
+ lw_conf.def_host_color=FGMAGENTA;
+ lw_conf.def_serv_color=FGBLUE;
+ lw_conf.def_mesg_color=FGWHITE;
if(omit_config)
return;
Index: strpcre.c
===================================================================
RCS file: /cvsroot/lwatch/files/src/strpcre.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** strpcre.c 28 Jun 2002 11:03:58 -0000 1.2
--- strpcre.c 30 Jun 2002 00:23:53 -0000 1.3
***************
*** 34,39 ****
--- 34,46 ----
#include <string.h>
+ #include "acolors.h"
+ #include "settings.h"
#include "strpcre.h"
+ #define DATE_COLOR colmode[date_c]
+ #define HOST_COLOR colmode[host_c]
+ #define SERV_COLOR colmode[serv_c]
+ #define MESG_COLOR colmode[mesg_c]
+
struct {
pcre *pre;
***************
*** 41,44 ****
--- 48,56 ----
} parser;
+ struct {
+ int start,stop;
+ } re_matches[RE_NMATCHES];
+
+
int compile_re(char *re, pcre **pre, pcre_extra **prh) {
const char *re_error;
***************
*** 104,105 ****
--- 116,137 ----
}
+ 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));
+ date_c=lw_conf.def_date_color;
+ host_c=lw_conf.def_host_color;
+ 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);
+ }
Index: strpcre.h
===================================================================
RCS file: /cvsroot/lwatch/files/src/strpcre.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** strpcre.h 28 Jun 2002 11:03:58 -0000 1.3
--- strpcre.h 30 Jun 2002 00:23:53 -0000 1.4
***************
*** 34,37 ****
--- 34,38 ----
#define PCRE_COPT PCRE_CASELESS|PCRE_DOTALL
#define PARSELINE "^(.+?\\s.+?\\s.+?\\s)(.+?\\s)(.+?:\\s)(.*)$"
+ #define RE_NMATCHES 30
#define freestr(a) free((void*)a); a=NULL
***************
*** 41,42 ****
--- 42,44 ----
char *newstr(char *str);
char *addstr(char *s1, const char *s2);
+ void showline(char *str);
|
|
From: <ar...@us...> - 2002-06-30 00:02:23
|
Update of /cvsroot/lwatch/files/src
In directory usw-pr-cvs1:/tmp/cvs-serv26347
Modified Files:
control.c
Log Message:
Default value for ex is 0.
Index: control.c
===================================================================
RCS file: /cvsroot/lwatch/files/src/control.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** control.c 29 Jun 2002 23:51:49 -0000 1.5
--- control.c 30 Jun 2002 00:02:21 -0000 1.6
***************
*** 51,55 ****
void signal_handle(int i) {
int ex;
! ex=1;
if((i==SIGTERM)||(i==SIGINT)) loop=0;
switch(i) {
--- 51,55 ----
void signal_handle(int i) {
int ex;
! ex=0;
if((i==SIGTERM)||(i==SIGINT)) loop=0;
switch(i) {
|
|
From: <ar...@us...> - 2002-06-29 23:52:17
|
Update of /cvsroot/lwatch/files/src
In directory usw-pr-cvs1:/tmp/cvs-serv23168
Modified Files:
control.c
Log Message:
Special support for SIGSEGV
Index: control.c
===================================================================
RCS file: /cvsroot/lwatch/files/src/control.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** control.c 29 Jun 2002 15:04:37 -0000 1.4
--- control.c 29 Jun 2002 23:51:49 -0000 1.5
***************
*** 50,57 ****
--- 50,70 ----
void signal_handle(int i) {
+ int ex;
+ ex=1;
if((i==SIGTERM)||(i==SIGINT)) loop=0;
+ switch(i) {
+ case SIGTERM:
+ case SIGINT:
+ loop=0;
+ break;
+ case SIGSEGV:
+ ex=1;
+ loop=0;
+ break;
+ }
#ifdef DEBUG
printf("Received signal %i%s\n",i,loop?"":" - exiting");
#endif
+ if(ex) die("Received signal %i%s\n",i,loop?"":" - exiting");
}
|
|
From: <ar...@us...> - 2002-06-29 15:04:40
|
Update of /cvsroot/lwatch/files/src
In directory usw-pr-cvs1:/tmp/cvs-serv26084
Modified Files:
control.c control.h lwatch.c
Log Message:
Detect end of input data.
Better error messages.
Index: control.c
===================================================================
RCS file: /cvsroot/lwatch/files/src/control.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** control.c 29 Jun 2002 13:44:57 -0000 1.3
--- control.c 29 Jun 2002 15:04:37 -0000 1.4
***************
*** 35,38 ****
--- 35,40 ----
#include <stdlib.h>
+ #include <sys/poll.h>
+
#include "control.h"
***************
*** 67,68 ****
--- 69,82 ----
}
}
+
+ #ifdef DEBUG
+ void show_poll_res(int res, struct pollfd *ufds, int n) {
+ int i;
+ 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);
+ }
+ }
+ #endif
Index: control.h
===================================================================
RCS file: /cvsroot/lwatch/files/src/control.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** control.h 29 Jun 2002 13:44:57 -0000 1.4
--- control.h 29 Jun 2002 15:04:37 -0000 1.5
***************
*** 34,44 ****
#include <string.h>
! #define io_check(res,str) if((res)==-1) die("%s[%i] %s\n",str,errno,strerror(errno))
! #define io_fcheck(res,str) if((res)==NULL) die("%s[%i] %s\n",str,errno,strerror(errno))
! #define sig_check(res,str) if((res)==SIG_ERR) die("%sCannot set signal handler\n",str);
void die(const char *s, ...);
void signal_handle(int i);
void set_handlers(void);
extern int loop;
--- 34,49 ----
#include <string.h>
! #include <sys/poll.h>
!
! #define io_check(res,str) if((res)==-1) die("%s%s[%i] %s\n",str,strlen(str)?": ":"",errno,strerror(errno))
! #define io_fcheck(res,str) if((res)==NULL) die("%s%s[%i] %s\n",str,strlen(str)?": ":"",errno,strerror(errno))
! #define sig_check(res,str) if((res)==SIG_ERR) die("%s%sCannot set signal handler\n",str,strlen(str)?": ":"");
void die(const char *s, ...);
void signal_handle(int i);
void set_handlers(void);
+ #ifdef DEBUG
+ void show_poll_res(int res, struct pollfd *ufds, int n);
+ #endif
extern int loop;
Index: lwatch.c
===================================================================
RCS file: /cvsroot/lwatch/files/src/lwatch.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** lwatch.c 29 Jun 2002 13:44:57 -0000 1.7
--- lwatch.c 29 Jun 2002 15:04:37 -0000 1.8
***************
*** 71,80 ****
pbuf=newstr("");
input.fd=fd;
! input.events=POLLIN;
while(loop) {
res=poll(&input,1,-1);
! if(errno!=EINTR) io_check(res,"poll: ");
if(res<1) continue;
! io_check(res=read(fd,(void*)rbuf,BUFSIZE),"read: ");
if(!res) continue;
rbuf[res]='\0';
--- 71,91 ----
pbuf=newstr("");
input.fd=fd;
! input.events=POLLIN|POLLHUP;
while(loop) {
+ input.revents=0;
res=poll(&input,1,-1);
! #ifdef DEBUG
! show_poll_res(res,&input,1);
! #endif
! if(errno!=EINTR) io_check(res,"poll");
! if(input.revents==POLLHUP) {
! loop=0; /* end of data */
! continue;
! }
if(res<1) continue;
! io_check(res=read(fd,(void*)rbuf,BUFSIZE),"read input");
! #ifdef DEBUG
! printf("Read %i byte(s)\n",res);
! #endif
if(!res) continue;
rbuf[res]='\0';
|
|
From: <ar...@us...> - 2002-06-29 14:58:05
|
Update of /cvsroot/lwatch/files/src
In directory usw-pr-cvs1:/tmp/cvs-serv23200
Modified Files:
yparse.l
Log Message:
Do not generate unnecessary messages in debug mode.
Index: yparse.l
===================================================================
RCS file: /cvsroot/lwatch/files/src/yparse.l,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** yparse.l 29 Jun 2002 13:53:45 -0000 1.8
--- yparse.l 29 Jun 2002 14:58:02 -0000 1.9
***************
*** 189,196 ****
die("Filename too long: %s\n",yytext);
}
! if(!strlen(yypch)) strcpy(yypch,yytext);
#ifdef DEBUG
! printf("Set %s to %s\n",mymsg,yytext);
#endif
POP;
}
--- 189,198 ----
die("Filename too long: %s\n",yytext);
}
! if(!strlen(yypch)) {
! strcpy(yypch,yytext);
#ifdef DEBUG
! printf("Set %s to %s\n",mymsg,yytext);
#endif
+ }
POP;
}
|
|
From: Artur R. C. <ar...@he...> - 2002-06-29 13:10:45
|
--
- Nie. Moglibyśmy się spotkać w real life.
/"CyberJoly Dream", Nina Liedtke/
|
|
From: Artur R. C. <ar...@he...> - 2002-06-29 13:05:08
|
-- Someone needs to beat panasync six miles deep into hard granite for even thinking about making that a BitchX default. http://sackheads.org/~bnaylor/spew/away_msgs.html |