From d5fc9f417c02ebe34b8f06847c375cd246f8c832 Mon Sep 17 00:00:00 2001 From: fcolin Date: Mon, 25 Jul 2005 14:28:35 +0000 Subject: gestion argument Ivy --- src/ivybind.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/ivybind.c') diff --git a/src/ivybind.c b/src/ivybind.c index cd758c6..e859457 100644 --- a/src/ivybind.c +++ b/src/ivybind.c @@ -109,7 +109,7 @@ void IvyBindingFree( IvyBinding bind ) #endif free ( bind ); } -int IvyBindExec( IvyBinding bind, const char * message ) +int IvyBindingExec( IvyBinding bind, const char * message ) { int nb_match = 0; #ifdef USE_PCRE_REGEX @@ -129,8 +129,14 @@ int IvyBindExec( IvyBinding bind, const char * message ) #else memset( bind->match, -1, sizeof(bind->match )); /* work around bug !!!*/ nb_match = regexec (&bind->regexp, message, MAX_MSG_FIELDS, bind->match, 0) - if (nb_match != 0) + if (nb_match == REG_NOMATCH) return 0; + /* TODO Possible BUG if empty match in middle of regexp */ + for ( index = 0; index < MAX_MSG_FIELDS; index++ ) + { + if ( bind->match[i].rm_so != -1 ) + nb_match++; + } #endif return nb_match; } -- cgit v1.1