diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2005-09-13 16:45:11 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2005-09-13 16:45:11 +0000 |
commit | f820d0ac236f6953e7bd5d115775a8751837ef4f (patch) | |
tree | 46099eb18548525e22c20ddd8b82ace532d898c8 | |
parent | db8c41e2d5ba00d0c67dd6a3faa9816eaa377b32 (diff) | |
download | rsyslog-f820d0ac236f6953e7bd5d115775a8751837ef4f.tar.gz rsyslog-f820d0ac236f6953e7bd5d115775a8751837ef4f.tar.xz rsyslog-f820d0ac236f6953e7bd5d115775a8751837ef4f.zip |
fixed probem with my regex merge; added compile time option output to -v
option display
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | linux/Makefile | 4 | ||||
-rw-r--r-- | master.make | 2 | ||||
-rw-r--r-- | syslogd.c | 10 | ||||
-rw-r--r-- | template.c | 166 |
5 files changed, 102 insertions, 81 deletions
@@ -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 diff --git a/linux/Makefile b/linux/Makefile index 5fd60168..06047ed0 100644 --- a/linux/Makefile +++ b/linux/Makefile @@ -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 diff --git a/master.make b/master.make index 914167cb..1838bed9 100644 --- a/master.make +++ b/master.make @@ -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 @@ -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: @@ -268,98 +268,104 @@ static int do_Parameter(char **pp, struct template *pTpl) /* Check frompos, if it has an R, then topos should be a regex */ if(*p == ':') { ++p; /* eat ':' */ -#ifdef FEATURE_REGEXP
- if (*p == 'R') {
- /* APR: R found! regex alarm ! :) */
- ++p; /* eat ':' */
-
- if (*p != ':') {
- /* There is something more than an R , this is invalid ! */
- /* Complain on extra characters */
- dprintf
- ("error: extra character in frompos, only \"R\" and numbers are allowed: '%s'\n",
- p);
- /* TODO: rger- add/change to logerror? */
- } else {
- pTpe->data.field.has_regex = 1;
- }
- } else {
- /* now we fall through the "regular" FromPos code */
+#ifdef FEATURE_REGEXP + if (*p == 'R') { + /* APR: R found! regex alarm ! :) */ + ++p; /* eat ':' */ + + if (*p != ':') { + /* There is something more than an R , this is invalid ! */ + /* Complain on extra characters */ + dprintf + ("error: extra character in frompos, only \"R\" and numbers are allowed: '%s'\n", + p); + /* TODO: rger- add/change to logerror? */ + } else { + pTpe->data.field.has_regex = 1; + } + } 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 == ':') { ++p; /* eat ':' */ #ifdef FEATURE_REGEXP - if (pTpe->data.field.has_regex) {
-
- dprintf("debug: has regex \n");
-
- /* APR 2005-09 I need the string that represent the regex */
- /* The regex end is: "--end" */
- /* TODO : this is hardcoded and cant be escaped, please change */
- regex_end = strstr(p, "--end");
- if (regex_end == NULL) {
- dprintf("error: Cant find regex end in: '%s'\n", p);
- pTpe->data.field.has_regex = 0;
- } else {
- /* We get here ONLY if the regex end was found */
- longitud = regex_end - p;
- /* Malloc for the regex string */
- regex_char = (char *) malloc(longitud + 1);
- if (regex_char == NULL) {
- dprintf
- ("Could not allocate memory for template parameter!\n");
- pTpe->data.field.has_regex = 0;
- return 1;
- /* TODO: RGer: check if we can recover better... (probably not) */
- }
-
- regex_char[0] = '\0';
-
- /* Get the regex string for compiling later */
- strncpy(regex_char, p, longitud);
-
- dprintf("debug: regex detected: '%s'\n",
- regex_char);
-
- /* Now i compile the regex */
- /* Remember that the re is an attribute of the Template entry */
- if (regcomp(&(pTpe->data.field.re), regex_char, 0) != 0) {
- dprintf("error: Cant compile regex: '%s'\n", regex_char);
- 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 */
- p = regex_end + 5/*strlen("--end")*/;
- free(regex_char);
- }
- } else {
- /* fallthrough to "regular" ToPos code */
+ if (pTpe->data.field.has_regex) { + + dprintf("debug: has regex \n"); + + /* APR 2005-09 I need the string that represent the regex */ + /* The regex end is: "--end" */ + /* TODO : this is hardcoded and cant be escaped, please change */ + regex_end = strstr(p, "--end"); + if (regex_end == NULL) { + dprintf("error: Cant find regex end in: '%s'\n", p); + pTpe->data.field.has_regex = 0; + } else { + /* We get here ONLY if the regex end was found */ + longitud = regex_end - p; + /* Malloc for the regex string */ + regex_char = (char *) malloc(longitud + 1); + if (regex_char == NULL) { + dprintf + ("Could not allocate memory for template parameter!\n"); + pTpe->data.field.has_regex = 0; + return 1; + /* TODO: RGer: check if we can recover better... (probably not) */ + } + + regex_char[0] = '\0'; + /* Get the regex string for compiling later */ + strncpy(regex_char, p, longitud); + + dprintf("debug: regex detected: '%s'\n", + regex_char); + + /* Now i compile the regex */ + /* Remember that the re is an attribute of the Template entry */ + if (regcomp(&(pTpe->data.field.re), regex_char, 0) != 0) { + dprintf("error: Cant compile regex: '%s'\n", regex_char); + 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 */ + 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 */ |