summaryrefslogtreecommitdiff
path: root/src/ivyprobe.c
diff options
context:
space:
mode:
authorjestin2004-07-23 13:25:23 +0000
committerjestin2004-07-23 13:25:23 +0000
commit4e3c475fa7b990a2a898c051061c5bc253b1d634 (patch)
treedc8b0245cf1a637bab22db33d902131e39bd936e /src/ivyprobe.c
parenta1eb3a36064e13c725c6d8f6301b43a431783afd (diff)
downloadivy-c-4e3c475fa7b990a2a898c051061c5bc253b1d634.zip
ivy-c-4e3c475fa7b990a2a898c051061c5bc253b1d634.tar.gz
ivy-c-4e3c475fa7b990a2a898c051061c5bc253b1d634.tar.bz2
ivy-c-4e3c475fa7b990a2a898c051061c5bc253b1d634.tar.xz
now uses USE_PCRE_REGEXP in ivyprobe (xtprobe ... gtkprobe ...) when binding a
pattern
Diffstat (limited to 'src/ivyprobe.c')
-rw-r--r--src/ivyprobe.c48
1 files changed, 31 insertions, 17 deletions
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 <regex.h>
+#ifndef USE_PCRE_REGEX
+#include <regex.h>
+#else
+#define OVECSIZE 60 /* must be multiple of 3, for regexp return */
+#include <pcre.h>
+#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(&reg,arg,REG_ICASE|REG_EXTENDED)!=0)
- {
- char errbuf[4096];
- regerror (err, &reg, 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(&reg,arg,REG_ICASE|REG_EXTENDED)!=0) {
+ char errbuf[4096];
+ regerror (err, &reg, 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");