fixed probem with my regex merge; added compile time option output to -v

option display
This commit is contained in:
Rainer Gerhards 2005-09-13 16:45:11 +00:00
parent db8c41e2d5
commit f820d0ac23
5 changed files with 102 additions and 81 deletions

1
NEWS
View File

@ -10,6 +10,7 @@ Version 1.10.0 (RGer), 2005-09-??
- added the FROMHOST property in the template processor, which could
previously not be obtained. Thanks to Cristian Testa for pointing
this out and even providing a fix.
- added display of compile-time options to -v output
---------------------------------------------------------------------------
Version 1.0.0 (RGer), 2005-09-12
- changed install doc to cover daily cron scripts - a trouble source

View File

@ -49,6 +49,10 @@ ifeq ($(strip $(FEATURE_DB)), 1)
WITHDB=-DWITH_DB
endif
ifeq ($(strip $(FEATURE_REGEXP)), 1)
F_REGEXP=-DFEATURE_REGEXP
endif
# Include MySQL client lib if DB is selected
ifdef WITHDB
LIBS = -lmysqlclient -L/usr/local/lib/mysql

View File

@ -11,7 +11,7 @@
#LDFLAGS= -g -Wall -fno-omit-frame-pointer
#CFLAGS= -DSYSV -g -Wall -fno-omit-frame-pointer
CFLAGS= $(RPM_OPT_FLAGS) -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce -I/usr/local/include $(NOLARGEFILE) $(WITHDB)
CFLAGS= $(RPM_OPT_FLAGS) -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce -I/usr/local/include $(NOLARGEFILE) $(WITHDB) $(F_REGEXP)
LDFLAGS= -s
# There is one report that under an all ELF system there may be a need to

View File

@ -2325,6 +2325,16 @@ int main(argc, argv)
break;
case 'v':
printf("rsyslogd %s.%s\n", VERSION, PATCHLEVEL);
printf("compiled with:\n");
#ifdef FEATURE_REGEXP
printf("\tFEATURE_REGEXP\n");
#endif
#ifdef WITH_DB
printf("\tFEATURE_DB\n");
#endif
#ifndef NOLARGEFILE
printf("\tFEATURE_LARGEFILE\n");
#endif
exit(0);
case '?':
default:

View File

@ -286,16 +286,19 @@ static int do_Parameter(char **pp, struct template *pTpl)
} else {
/* now we fall through the "regular" FromPos code */
#endif /* #ifdef FEATURE_REGEXP */
iNum = 0;
while(isdigit(*p))
iNum = iNum * 10 + *p++ - '0';
pTpe->data.field.iFromPos = iNum;
/* skip to next known good */
while(*p && *p != '%' && *p != ':') {
/* TODO: complain on extra characters */
dprintf("error: extra character in frompos: '%s'\n", p);
++p;
iNum = 0;
while(isdigit(*p))
iNum = iNum * 10 + *p++ - '0';
pTpe->data.field.iFromPos = iNum;
/* skip to next known good */
while(*p && *p != '%' && *p != ':') {
/* TODO: complain on extra characters */
dprintf("error: extra character in frompos: '%s'\n", p);
++p;
}
#ifdef FEATURE_REGEXP
}
#endif /* #ifdef FEATURE_REGEXP */
}
/* check topos (holds an regex if FromPos is "R"*/
if(*p == ':') {
@ -341,25 +344,28 @@ static int do_Parameter(char **pp, struct template *pTpl)
pTpe->data.field.has_regex = 2;
}
/* Finally we move the pointer to the end of the regex so it aint parsed twice or something weird */
/* Finally we move the pointer to the end of the regex
* so it aint parsed twice or something weird */
p = regex_end + 5/*strlen("--end")*/;
free(regex_char);
}
} else {
/* fallthrough to "regular" ToPos code */
#endif /* #ifdef FEATURE_REGEXP */
iNum = 0;
while(isdigit(*p))
iNum = iNum * 10 + *p++ - '0';
pTpe->data.field.iToPos = iNum;
/* skip to next known good */
while(*p && *p != '%' && *p != ':') {
/* TODO: complain on extra characters */
dprintf("error: extra character in frompos: '%s'\n", p);
++p;
iNum = 0;
while(isdigit(*p))
iNum = iNum * 10 + *p++ - '0';
pTpe->data.field.iToPos = iNum;
/* skip to next known good */
while(*p && *p != '%' && *p != ':') {
/* TODO: complain on extra characters */
dprintf("error: extra character in frompos: '%s'\n", p);
++p;
}
#ifdef FEATURE_REGEXP
}
#endif /* #ifdef FEATURE_REGEXP */
}
/* TODO: add more sanity checks. For now, we do the bare minimum */