From 4e3c475fa7b990a2a898c051061c5bc253b1d634 Mon Sep 17 00:00:00 2001 From: jestin Date: Fri, 23 Jul 2004 13:25:23 +0000 Subject: now uses USE_PCRE_REGEXP in ivyprobe (xtprobe ... gtkprobe ...) when binding a pattern --- src/ivyprobe.c | 48 +++++++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 17 deletions(-) (limited to 'src/ivyprobe.c') diff --git a/src/ivyprobe.c b/src/ivyprobe.c index 45fe00a..c054be9 100644 --- a/src/ivyprobe.c +++ b/src/ivyprobe.c @@ -45,7 +45,14 @@ extern char *optarg; extern int optind; #endif -#include +#ifndef USE_PCRE_REGEX +#include +#else +#define OVECSIZE 60 /* must be multiple of 3, for regexp return */ +#include +#endif + + #endif #ifdef XTMAINLOOP #include "ivyxtloop.h" @@ -144,22 +151,29 @@ void HandleStdin (Channel channel, HANDLE fd, void *data) } } else if (strcmp(cmd, "bind") == 0) { - arg = strtok (NULL, "'"); - if (arg) { - regex_t reg; - int err; - Chop(arg); - if (err=regcomp(®,arg,REG_ICASE|REG_EXTENDED)!=0) - { - char errbuf[4096]; - regerror (err, ®, errbuf, 4096); - printf("Error compiling '%s', %s, not bound\n", arg, errbuf); - } - else - { - IvyBindMsg (Callback, NULL, Chop(arg)); - } - } + arg = strtok (NULL, "'"); + if (arg) { +#ifndef USE_PCRE_REGEX + regex_t reg; + int err; + Chop(arg); + if (err=regcomp(®,arg,REG_ICASE|REG_EXTENDED)!=0) { + char errbuf[4096]; + regerror (err, ®, errbuf, 4096); + printf("Error compiling '%s', %s, not bound\n", arg, errbuf); +#else + pcre *regexp; + const char *errbuf; + int erroffset; + Chop(arg); + regexp = pcre_compile(arg, 0,&errbuf,&erroffset,NULL); + if (regexp==NULL) { + printf("Error compiling '%s', %s, not bound\n", arg, errbuf); +#endif + } else { + IvyBindMsg (Callback, NULL, Chop(arg)); + } + } } else if (strcmp(cmd, "where") == 0) { arg = strtok (NULL, " \n"); -- cgit v1.1