summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/Modules/pcre.c15
2 files changed, 15 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 4052355bc..d7dfad425 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-04-05 Clint Adams <clint@zsh.org>
+
+ * 23264: Src/Modules/pcre.c: don't add the -pcre-match
+ operator unless the pcre functions are available.
+
2007-04-02 Peter Stephenson <pws@csr.com>
* 23258: Src/Zle/complist.c: debugging added in 23248
diff --git a/Src/Modules/pcre.c b/Src/Modules/pcre.c
index 3ed536671..c19c8c137 100644
--- a/Src/Modules/pcre.c
+++ b/Src/Modules/pcre.c
@@ -189,13 +189,16 @@ cond_pcre_match(char **a, int id)
return 0;
}
+static struct conddef cotab[] = {
+ CONDDEF("pcre-match", CONDF_INFIX, cond_pcre_match, 0, 0, CPCRE_PLAIN)
+};
+
/**/
#else /* !(HAVE_PCRE_COMPILE && HAVE_PCRE_EXEC) */
# define bin_pcre_compile bin_notavail
# define bin_pcre_study bin_notavail
# define bin_pcre_match bin_notavail
-# define cond_pcre_match cond_match
/**/
#endif /* !(HAVE_PCRE_COMPILE && HAVE_PCRE_EXEC) */
@@ -206,10 +209,6 @@ static struct builtin bintab[] = {
BUILTIN("pcre_match", 0, bin_pcre_match, 1, 2, 0, "a", NULL)
};
-static struct conddef cotab[] = {
- CONDDEF("pcre-match", CONDF_INFIX, cond_pcre_match, 0, 0, CPCRE_PLAIN)
-};
-
/**/
int
@@ -222,8 +221,12 @@ setup_(UNUSED(Module m))
int
boot_(Module m)
{
+#if defined(HAVE_PCRE_COMPILE) && defined(HAVE_PCRE_EXEC)
return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)) ||
!addconddefs(m->nam, cotab, sizeof(cotab)/sizeof(*cotab));
+#else /* !(HAVE_PCRE_COMPILE && HAVE_PCRE_EXEC) */
+ return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
+#endif /* !(HAVE_PCRE_COMPILE && HAVE_PCRE_EXEC) */
}
/**/
@@ -231,7 +234,9 @@ int
cleanup_(Module m)
{
deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
+#if defined(HAVE_PCRE_COMPILE) && defined(HAVE_PCRE_EXEC)
deleteconddefs(m->nam, cotab, sizeof(cotab)/sizeof(*cotab));
+#endif /* !(HAVE_PCRE_COMPILE && HAVE_PCRE_EXEC) */
return 0;
}