diff options
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 c030fa45..2e2d41ad 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -2009,7 +2009,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; @@ -2017,6 +2020,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; } @@ -2024,6 +2029,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) { @@ -2033,6 +2039,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 ""; } |