diff options
| author | Andrey A. Chernov <ache@FreeBSD.org> | 1994-10-02 01:33:28 +0000 |
|---|---|---|
| committer | Andrey A. Chernov <ache@FreeBSD.org> | 1994-10-02 01:33:28 +0000 |
| commit | c6acecdc95de9195b46a1767ec6318818c52726c (patch) | |
| tree | eab6a15f7e9cd40928ea07e3ce7ef065405c3146 /lib/libedit/search.c | |
| parent | 21abf3d3ce98c4cc184386997d3ce101899920ed (diff) | |
Notes
Diffstat (limited to 'lib/libedit/search.c')
| -rw-r--r-- | lib/libedit/search.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/libedit/search.c b/lib/libedit/search.c index 4ff9c61a5103..c57b96b3dc6b 100644 --- a/lib/libedit/search.c +++ b/lib/libedit/search.c @@ -43,9 +43,14 @@ static char sccsid[] = "@(#)search.c 8.1 (Berkeley) 6/4/93"; */ #include "sys.h" #include <stdlib.h> +#ifdef REGEXEC +#include <sys/types.h> +#include <regex.h> +#else #ifdef REGEXP #include <regexp.h> #endif +#endif #include "el.h" /* @@ -102,6 +107,10 @@ el_match(str, pat) const char *str; const char *pat; { +#ifdef REGEXEC + regex_t re; + regmatch_t mb; +#else #ifndef REGEXP extern char *re_comp __P((const char *)); extern int re_exec __P((const char *)); @@ -109,9 +118,15 @@ el_match(str, pat) regexp *re; int rv; #endif +#endif if (strstr(str, pat) != NULL) return 1; +#ifdef REGEXEC + if (regcomp(&re, pat, REG_EXTENDED) != 0) + return 0; + return (regexec(&re, str, 1, &mb, 0) == 0); +#else #ifndef REGEXP if (re_comp(pat) != NULL) return 0; @@ -126,7 +141,7 @@ el_match(str, pat) rv = 0; return rv; #endif - +#endif } |
