diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-11-11 12:58:53 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-11-11 12:58:53 +0100 |
commit | c9078c722003ac87e8b39363ed9b8b70d2812dd9 (patch) | |
tree | 51b44e6eab1a7cb5f80547252468e3c351c8cb36 /runtime/msg.c | |
parent | 05bd696ebb7766f33b3ae176b841bcecb0bfedfc (diff) | |
parent | 4cfbf894fd0caebaf65e1b7ffcb5725a530cf67d (diff) | |
download | rsyslog-c9078c722003ac87e8b39363ed9b8b70d2812dd9.tar.gz rsyslog-c9078c722003ac87e8b39363ed9b8b70d2812dd9.tar.xz rsyslog-c9078c722003ac87e8b39363ed9b8b70d2812dd9.zip |
Merge branch 'v3-stable' into beta
Conflicts:
ChangeLog
doc/manual.html
Diffstat (limited to 'runtime/msg.c')
-rw-r--r-- | runtime/msg.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/runtime/msg.c b/runtime/msg.c index 9c2e3f17..3073fc5f 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -1958,7 +1958,10 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, * potential matches over the string. */ while(!bFound) { - if(regexp.regexec(&pTpe->data.field.re, pRes + iOffs, nmatch, pmatch, 0) == 0) { + int iREstat; + iREstat = regexp.regexec(&pTpe->data.field.re, pRes + iOffs, nmatch, pmatch, 0); + dbgprintf("regexec return is %d\n", iREstat); + if(iREstat == 0) { if(pmatch[0].rm_so == -1) { dbgprintf("oops ... start offset of successful regexec is -1\n"); break; @@ -1966,6 +1969,8 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, if(iTry == pTpe->data.field.iMatchToUse) { bFound = 1; } else { + dbgprintf("regex found at offset %d, new offset %d, tries %d\n", + iOffs, iOffs + pmatch[0].rm_eo, iTry); iOffs += pmatch[0].rm_eo; ++iTry; } @@ -1973,6 +1978,7 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, break; } } + dbgprintf("regex: end search, found %d\n", bFound); if(!bFound) { /* we got no match! */ if(pTpe->data.field.nomatchAction != TPL_REGEX_NOMATCH_USE_WHOLE_FIELD) { @@ -1982,6 +1988,8 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, } if(pTpe->data.field.nomatchAction == TPL_REGEX_NOMATCH_USE_DFLTSTR) return "**NO MATCH**"; + else if(pTpe->data.field.nomatchAction == TPL_REGEX_NOMATCH_USE_ZERO) + return "0"; else return ""; } |