summaryrefslogtreecommitdiff
path: root/src/ivybind.c
diff options
context:
space:
mode:
authorfcolin2005-07-25 14:28:35 +0000
committerfcolin2005-07-25 14:28:35 +0000
commitd5fc9f417c02ebe34b8f06847c375cd246f8c832 (patch)
treeb475d57c7441d0f2251a77cabd4ef38d57158b8d /src/ivybind.c
parent97c5a6a52b134334f04a394f4ed774b287f8e774 (diff)
downloadivy-c-d5fc9f417c02ebe34b8f06847c375cd246f8c832.zip
ivy-c-d5fc9f417c02ebe34b8f06847c375cd246f8c832.tar.gz
ivy-c-d5fc9f417c02ebe34b8f06847c375cd246f8c832.tar.bz2
ivy-c-d5fc9f417c02ebe34b8f06847c375cd246f8c832.tar.xz
gestion argument Ivy
Diffstat (limited to 'src/ivybind.c')
-rw-r--r--src/ivybind.c10
1 files changed, 8 insertions, 2 deletions
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;
}